Starting with C code of the form int test int x int y int va
Starting with C code of the form int test (int x, int y) {int val =; if () {if () val =; else val =;} else if () val =; return val;} gcc generates the following assembly code: x at lebp + 8, y at lebp + 12 nov1 8(%ebp), %eax nov1 12(%ebp), %edx cmpl $-3, %eax jge .L2 cmpl %edx, %eax jle .L3 inull %edx, 5eax jmp .L4 .L3; leal (%edx, %eax), %eax jmp .L4 -L2: cmpl $2, %eax jg .L5 xorl %edx, %eax jmp .L4 -L5: sub1 %edx, %eax .L4; Fill in the missing expression* in the C code. To make the code fit into the C code template, you will need to undo some of the reordering of computations done by Gcc.
Solution
int test(int x, int y) { int val = x^y; //line:asm:if:initialize if (x < -3) { if (y < x) val = x*y; else val = x+y; } else if (x > 2) val = x-y; return val; }