The latest version of gcc is producing assembly that doesn\'t make sense to me. I compiled the code using no optimization; but, some parts of this code don\'t make sense, even
By default gcc compiles with optimization disabled, which is the case here, apparently.
You need to enable it with one of the optimization switches (e.g. -O2
or -O3
).
Then you will not see redundant and seemingly meaningless things.
As for rbx
, it has to be preserved because that's what the calling conventions require. Your function modifies it (movl -32(%rbp), %ebx
), so it has to be saved and restored explicitly.