IF STATEMENTS

IF/ELSE

IF

#C CODE SNIPPET
int x = 1;
int y = 2;

if(x == y){
      printf("x equals y.\n");
}else{
      printf("x is not equal to y.\n");
}

IDA Pro adds "false" (1) and "true" (2) labels at the decision points at the bottom of the upper code box. graphing a function can greatly speed up the reverse-engineering process.

Analyzing functions graphically with IDA Pro

NESTED IF

nested if statement is more complicated as seen in the assembly code

#C CODE SNIPPET
int x = 0;
int y = 1;
int z = 2;

if(x == y){
     if(z==0){
          printf("z is zero and x = y.\n");
     }else{
          printf("z is non-zero and x = y.\n");
     }
}else{
     if(z==0){
          printf("z zero and x != y.\n");
     }else{
          printf("z non-zero and x != y.\n");
     }
}

Last updated