I've been studying assembly for a while now and i'm beginning to get the hang of it, however the one thing that i can't seem to understand is why do we need for decrementing the stack pointer to leave roam for the local variables, take a look at this code: (code compiled with 64 bit GNU compiler, AT&T syntax)
pushq %rbp
movq %rsp, %rbp
subq $48, %rsp
call __main
movl $0, -4(%rbp)
movl $4, -8(%rbp)
movl -8(%rbp), %edx
movl -4(%rbp), %eax
addl %edx, %eax
movl %eax, -12(%rbp)
movl -4(%rbp), %edx
movl -12(%rbp), %eax
addl %eax, %edx
movl -8(%rbp), %eax
addl %edx, %eax
movl %eax, -16(%rbp)
addq $48, %rsp
popq %rbp
ret
in this small program I can imagine doing all of that without the need to decrement esp by 48. I can just use the base pointer to move values from and on to the stack, and just have esp point to the same position ready to pop ebp and return. can someone clarify why is it necessary to leave "room" for local variables. thanks!! I apologize if this seems like a foolish question