Question: the C function p 8 is compiled to the x 8 6 code shown on the right. complete the definition of the C function p

the C function p8 is compiled to the x86 code shown on the right. complete the definition of the C function p8 on the left, so that it does the same thing as the assembly code on the right. int p8(int a[], int n){ p8: pushq %rbp movq %rsp,%rbp pushq%rbx subq $24,%rsp movq %rdi, -24(%rbp) movl %esi, -28(%rbp) cmpl $0,-28(%rbp) jne .L2 movq -24(%rbp),%rax movl (%rax),%eax jmp .L3.L2: movl -28(%rbp),%eax cltq leaq 0(,%rax,4),%rdx movq -24(%rbp),%rax, addq %rdx %rax movl (%rax),%ebx movl -28(%rbp),%eax leal -1(%rax),%edx movq -24(%rbp),%rax movl %edx, %esi movq %rax, %rdi call p8 addl %ebx, %eax addq $24,%rsp popq %rbx popq %rbp 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!