I had some problem when I learned about assembly code.
I use "compiler explorer" that is a website that supporting a lot of compiler.
I made a simple code and compiled it as x86-64 gcc.
<C++ code>:
int sum(int a, int b)
{
return a + b;
}
int main(void)
{
return sum(3, 4);
}
:
sum(int, int):
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], edi
mov DWORD PTR [rbp-8], esi
mov edx, DWORD PTR [rbp-4]
mov eax, DWORD PTR [rbp-8]
add eax, edx
pop rbp
ret
main:
push rbp
mov rbp, rsp
mov esi, 4
mov edi, 3
call sum(int, int)
nop
pop rbp
ret
As I know, stack presents for local variable and saving return address, etc in x86.
I can't see that anything about "sub rsp, ??" in function prologue. And I can't see "add rsp, ??" in function epilogue, too.