Question: The disassembled code for two functions first and last is shown below, along with the code for a call of first by function main: Each

The disassembled code for two functions first and last is shown below, along with the code for a call of first by function main:1 0000000000400540 : 2 3 4 5 6 7 8 9 Disassembly of last (long u, long v) u in %rdi, v in %rsi 10 11 400540:

Each of these instructions is given a label, similar to those in Figure 3.27(a). Starting with the calling of first(10) by main, fill in the following table to trace instruction execution through to the point where the program returns back to main.

Figure 3.27(a)

(a) Disassembled code for demonstrating procedure calls and returns Disassembly of leaf (long y) y in %rdi


1 0000000000400540 : 2 3 4 5 6 7 8 9 Disassembly of last (long u, long v) u in %rdi, v in %rsi 10 11 400540: 48 89 8 400543: 48 Of af c6 400547: c3 Disassembly of last (long x) x in %rdi 0000000000400548 : 400548: 48 8d 77 01 40054c: 48 83 ef 01 400550: e8 eb ff ff ff f3 c3 400555: 400560: 400565: 48 89 c2 e8 e3 ff ff ff mov imul retq %rdi,%rax %rsi,%rax lea 0x1 (%rdi), %rsi sub $0x1,%rdi callq 400540 repz retq callq 400548 mov %rax, %rdx L1: u L2: u*v L3: Return F1: x+1 F2: x-1 F3: Call last (x-1,x+1) F4: Return M1: Call first (10) M2: Resume

Step by Step Solution

3.40 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Tracing through the program execution at this level of detail reinforces many aspects of procedur... View full answer

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 Computer Systems A Programmers Perspective Questions!