Calling conventions are the rules that let functions cooperate safely. They define where arguments go, where return values come back, which registers must be preserved, and how the stack frame is built and cleaned up.
The call instruction saves a return address, and ret pops that saved address from the stack and jumps back to it.
Local variables live inside the current stack frame. When the frame is restored, that local storage is discarded and the previous frame is restored.
In 64-bit Linux System V, arguments are passed in registers first: rdi, rsi, rdx, rcx, r8, r9. Extra arguments go on the stack.
A common prologue is push rbp / mov rbp, rsp / sub rsp, X. A common epilogue is leave / ret.
Argument passing, register names, stack alignment, and which registers must be preserved all change between 32-bit and 64-bit conventions.
Rule 1: Arguments go into specific registers in 64-bit System V: rdi, rsi, rdx, rcx, r8, r9. Extra arguments go on the stack.
Rule 2: Return values usually go in eax for 32-bit or rax for 64-bit.
Rule 3: Stack frame creation often uses push rbp / mov rbp, rsp / sub rsp, X.
Rule 4: Callee-preserved registers in System V x86-64 include rbx, rbp, r12, r13, r14, r15.
Rule 5: ret pops the return address and jumps back to the caller.
Rule 6: leave restores the frame and ret returns execution.
Rule 7: 64-bit stacks should be 16-byte aligned before calls.
Place the correct token in the correct location so the function call works properly.
WASD move
E pick up or place token
Q switch register label
+10 for each correct placement
+5 for each quiz answer you get right
+1 for each brownie you collect
-2 for each wrong placement