Question: Given the following assembly code, re - construct the C code that produced it . < + 0 > : mov $ 0 x 1

Given the following assembly code, re-construct the C code that produced it.
<+0>:mov$0x1,%eax
<+5>:cmp%rsi,%rdi
<+8>:jnz0x1151
<+10>:lea(%rdi,%rsi,1),%rdx
<+14>:imul%rdx,%rax
<+18>:sub$0x1,%rdi
<+22>:jmp0x113e
<+24>:retq
Fill in the blanks to complete the below C code:
long loop(long a, long b){
long result =_________;
while (_________){
result =____________;
a =_________;
}
return result;
}
(Total points: 3+3+3+3=12)

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 Programming Questions!