This allocates 40 bytes on the stack. However, there are uses for it other than local variables, so my guess is that the rest is used for alignment and arguments for a future function call.
Since function arguments are also passed on the stack, there needs to be space for any that this function wants to pass to another. It is possible to allocate this space when performing the call by using push
, but it is quite common to allocate the space once at the beginning of the function and just use mov
to place the data in position later. If your function is using 12 bytes for local variables, that leaves up to 28 for function arguments to be used later.
There could also be a little bit extra allocated for alignment. In addition to the alignment of variables mentioned by Jerry, many systems expect the stack pointer to be aligned to a certain value, so this needs to be preserved if you are going to make a function call. On 32-bit systems, this is often 8 bytes, but could also be 16 in this case.