Question: 3-1. Consider the following assembly code: long loop(long x, int n) x in xrdi, n in Xesi loop: movl %esi, %ecx movl $1, %edx movl

 3-1. Consider the following assembly code: long loop(long x, int n)

3-1. Consider the following assembly code: long loop(long x, int n) x in xrdi, n in Xesi loop: movl %esi, %ecx movl $1, %edx movl $0, Xeax jmp. L2 .L3: movq %rdi, %r8 andq %rdx, %r8 org %r8, %rax salq xcl, %rdx . L2 testa %rdx, xrdx jne. L3 rep: ret The preceding code was generated by compiling C code that had the following overall form: long loop(long x, long n) { long result = (1) long mask; for (mask = 2 result = (5) } return result; } ; mask 3 mask = Your task is to fill in the missing parts of the C code to get a program equivalent to the generated assembly code. Recall that the result of the function is returned in register %rax. You will find it helpful to examine the assembly code before, during, and after the loop to form a consistent mapping between the registers and the program variables

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!