---
# System prepended metadata

title: CAOS Exercise Session Lecture 5

---

<style>
    th, td, th { 
      font-size: 10px;
      border-collapse: collapse;
      border-width:1px
    }
    </style>
# CAOS Exercise Session Lecture 5

## Practice Problem 3.32 p. 280-281
![](https://i.imgur.com/6mlBOh3.png)
![](https://i.imgur.com/MOJFAQ6.png)

| Name | PC       | Instruc. | %rdi | %rsi | %rax | %rsp           | \*%rsp | Description         |
| ---- | -------- | -------- | ---- | ---- | ---- | -------------- | ------ | ------------------- |
| M1   | 0x400560 | callq    | 10   | -    | -    | 0x7fffffffe820 | -      | Call first(10)      |
| F1   | 0x400548 | lea      | 10   | 11   | -    | 0x7fffffffe828 | -      | %rsi = 1+%rdi       |
| F2   | 0x40054c | sub      | 9    | 11   | -    | 0x7fffffffe828 | -      | %rdi = %rdi-1       |
| F3   | 0x400550 | callq    | 9    | 11   | -    | 0x7fffffffe830 | -      | Call last(9, 11)    |
| L1   | 0x400540 | mov      | 9    | 11   | 9    | 0x7fffffffe830 | -      | %rax = %rdi         |
| L2   | 0x400543 | imul     | 9    | 11   | 99   | 0x7fffffffe830 | -      | %rax = %rsi \* %rax |
| L3   | 0x400547 | retq     | 9    | 11   | 99   | 0x7fffffffe828 | -      | Return to first     |
| F4   | 0x400555 | retq     | 9    | 11   | 99   | 0x7fffffffe820 | -      |                     |
| M2   | 0x400565 | mov      | 9    | 11   | 99   | 0x7fffffffe820 | -      |                     |
