Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Starting with C code of the form int test (int x, int y) {int val =; if () {if (

ID: 3936800 • Letter: S

Question

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.

Explanation / Answer

int test(int x, int y) { int val = x^y; //line:asm:if:initialize if (x < -3) { if (y 2) val = x-y; return val; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote