Question: Below is the C code for a function f , but with the if test expression replaced by the comment / * TEST * /

Below is the C code for a function f, but with the if test expression replaced by the comment /* TEST */. The assembly that was generated by compiling the original function f appears below the C code. What was the test expression in the original C code?
long f(long x, long y){
if (/* TEST */)
return x *16;
else
return x |4;
}
f:
movq %rdi, %rdx
salq $4,%rdx
movq %rdi, %rax
orq $4,%rax
cmpq %rsi, %rdi
cmovg %rdx,%rax
ret

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!