y in your code is a local variable. Despite the fact that many people believe that they are not allocated. They may or may not have a place reserved for them on the stack, but this is only guaranteed if, after optimization, their address is fulfilled.
In all other cases, they may not have enough space on the stack. Or there may be some space on the stack that they use, but the same space is used for several variables, or even in some cases to pass arguments to the functions that you call.
When space is reserved on the stack (which may or may not happen), this space is usually reserved immediately after the function is entered. However, this is an implementation detail. This is done as it is the fastest way to do it. There is no need for this to be done, and the implementation can very well dynamically change the size of the current stack frame (on most modern processors this is a silly thing, but such an implementation will still be correct).
Analog file
source share