<aside> đź’ˇ THINGS THAT ADD TO THE STACK:
Things that dont do shit to the stack:
Function A calls function B → A is the caller function → B is the Callee
%rdi, %rsi, %rdx, %rcx, %r8, %r9 inputs in orders (might be diff)
%r10, %r11 //caller saved (values might be different after call)
rbx, %rbp, %r12, %r13, %r14, %r15 // values same after call calee guarentee
0000000000400b5d <func>:
400b5d: 83 ff 01 cmp $0x1,%edi
400b60: 7f 06 jg 400b68 <func+0xb>
400b62: b8 01 00 00 00 mov $0x1,%eax
400b67: c3 retq
400b68: 53 push %rbx // push old rbx
400b69: 89 fb mov %edi,%ebx
400b6b: 8d 7f ff lea -0x1(%rdi),%edi
400b6e: e8 ea ff ff ff callq 400b5d <func>
400b73: 0f af c3 imul %ebx,%eax // push to stack
400b76: 5b pop %rbx
400b77: c3 retq
Suppose you call the recursive function func(3). Draw the stack when func(1) is entered. If you don’t know a value, write “old” and then the value name. (eg. old %rax). (5pts)