Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions