I\'m self-studying how compilers works. I\'m learning by reading the disassembly of GCC generated code from small 64-bit Linux programs.
I wrote this C
Regarding the second question, since the C99 standard it's allowed to not have an explicit return 0
in the main
function, the compiler will add it implicitly. Note that this is only for the main
function, no other function.
As for the third question, the rbp
register acts as the frame pointer.
Lastly the PS. It's likely that the called function is using 16
bytes (0x10
) for the arguments passed to the function. The subtraction is what "removes" those variables from the stack. Could it possibly be two pointers you pass as arguments?
If you're serious learning how compilers in general works, and possibly want to create your own (it's fun! :)), then I suggest you invest in some books about the theory and practice of it. The dragon book is an excellent addition to any programmers bookshelf.