I have observed that when generating assembly code from simple C programs using GCC, the stack is initialized as follows:
pushl %ebp movl %esp, %ebp andl $-16, %esp
my question concerns the last instruction where -16 is anded with the stack pointer. Am I correct in assuming that this is for proper memory alignment for 32 bit data? If so, then why not -4?
I have also observed that in a simple program I have written that compares data in memory, byte by byte, removing the said instruction significantly slows down the process. If this has to do with memory alignment, then I don't understand why it would have an affect since I am accessing bytes in memory individually anyway.