Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the C function p 9 is compiled to the x 8 6 code shown on the right. complete the C function p 9 on the

the C function p9 is compiled to the x86 code shown on the right. complete the C function p9 on the left using a while loop, so that it does the same thing as the compiled x86 code. long p9(long *val){ # *val in %rdi p9: pushq %rbp movq %rsp,%rbp movq %rdi, -24(%rbp) movq $0,-8(%rbp) movl $6,-12(%rbp) jmp .L2.L5: movl -12(%rbp),%eax cltq leaq 0(,%rax,8),%rdx movq -24(%rbp),%rax addq %rdx,%rax movq (%rax),%rax testq %rax, %rax jne .L3 subl $1,-12(%rbp) jmp .L2.L3 movq $-1,-8(%rbp) jmp .L4.L2: cmpl $0,-12(%rbp) jg .L5.L4: movq -8(%rbp),%rax 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

Question

LO 13-2 What are the eff ects of meditation?

Answered: 1 week ago