Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A function is declared as follows: void foo(long a, long b, long c, int n); Its body compiles to the following code: # a


 

A function is declared as follows: void foo(long a, long b, long c, int n); Its body compiles to the following code: # a in %rdi, b in %rsi, c in %rdx, n in %ecx movl $0, %eax .12: .LA: capl %ecx, %eax jge .LA movalq %eax, %r8 mov (%rdx,%r8,8), %r9 addq (%rai,%r8,8), %19 movq Zr9, (Zrdi, %r8,8) addl $1, %eax jmp .L2 ret The C code for the body a loop of the form: int i; for (i=0; a. What register holds the loop variable i? b. What is i compared to in the loop test? e. What do the first three arguments point to? d. What do the three instructions in the middle of the loop (novq, addq. movq) do? e. Say in words what is the purpose of the function.

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_2

Step: 3

blur-text-image_3

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

Computer Systems A Programmers Perspective

Authors: Randal E. Bryant, David R. O'Hallaron

3rd Global Edition

1292101768, 978-1292101767

More Books

Students also viewed these Programming questions

Question

4. Greet students at the door to the class every day.

Answered: 1 week ago