please explain me how we get %rdi %rsi %rax  numbers in tables please in easy word step by step.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

please explain me how we get %rdi %rsi %rax  numbers in tables please in easy word step by step. 

 

### Disassembled Code and Instructions

#### C Code:
```c
int main(int argc, char **argv) {
    long x = 1, y = 2, z = 3;
    z = top(x, y);
    return z;
}

long top(long x, long y) {
    x = x + y;
    return leaf(x, y);
}

long leaf(long y, long z) {
    z = y - z;
    return z;
}
```

#### Disassembled Code:

- **Leaf Function:**
  ```
  1  00000000004004d6 <leaf>:
  2  4004d6: 48 89 f8             mov    %rdi,%rax
  3  4004d9: 48 29 f0             sub    %rsi,%rax
  4  4004dc: c3                   retq
  ```

- **Top Function:**
  ```
  5  00000000004004dc <top>:
  6  4004dc: 48 01 f7             add    %rsi,%rdi
  7  4004df: b8 00 00 00 00       mov    $0x0,%eax
  8  4004e4: e8 ec ff ff ff       callq  4004d6 <leaf>
  9  4004e9: c3                   retq
  ```

- **Main Function:**
  ```
  10 00000000004004ec <main>:
  11 4004ec: b9 02 00 00 00       mov    $0x2,%ecx
  12 4004f1: bf 03 00 00 00       mov    $0x3,%edi
  13 4004f6: b8 01 00 00 00       mov    $0x1,%eax
  14 4004fb: e8 dc ff ff ff       callq  4004dc <top>
  15 400500: c3                   retq
  ```

#### Instructions Table:

Fill the table with appropriate values right before the instruction executes.

| Line # | PC    | Instruction | %rdi |
Transcribed Image Text:### Disassembled Code and Instructions #### C Code: ```c int main(int argc, char **argv) { long x = 1, y = 2, z = 3; z = top(x, y); return z; } long top(long x, long y) { x = x + y; return leaf(x, y); } long leaf(long y, long z) { z = y - z; return z; } ``` #### Disassembled Code: - **Leaf Function:** ``` 1 00000000004004d6 <leaf>: 2 4004d6: 48 89 f8 mov %rdi,%rax 3 4004d9: 48 29 f0 sub %rsi,%rax 4 4004dc: c3 retq ``` - **Top Function:** ``` 5 00000000004004dc <top>: 6 4004dc: 48 01 f7 add %rsi,%rdi 7 4004df: b8 00 00 00 00 mov $0x0,%eax 8 4004e4: e8 ec ff ff ff callq 4004d6 <leaf> 9 4004e9: c3 retq ``` - **Main Function:** ``` 10 00000000004004ec <main>: 11 4004ec: b9 02 00 00 00 mov $0x2,%ecx 12 4004f1: bf 03 00 00 00 mov $0x3,%edi 13 4004f6: b8 01 00 00 00 mov $0x1,%eax 14 4004fb: e8 dc ff ff ff callq 4004dc <top> 15 400500: c3 retq ``` #### Instructions Table: Fill the table with appropriate values right before the instruction executes. | Line # | PC | Instruction | %rdi |
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education