Function Prologue and Epilogue
A typical callee sets up a frame on entry and tears it down on exit:
foo:
push rbp ; save caller's frame pointer
mov rbp, rsp ; establish new frame base
sub rsp, 0x20 ; reserve 32 bytes for locals
... ; function body (locals at [rbp-8], ...)
leave ; mov rsp, rbp ; pop rbp
ret ; pop return address into RIP
RBPanchors local variables and arguments at fixed offsets.leaverestores the caller frame;retreturns control.