Hello, Sir
I am reading your book and I have a question to ask you.
In chapter 6, the "if statements" topic, you provide a example, the ifthen.c program .After convert the C code to assembly, it looks like as follow:
Code:
main:
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
subl $32, %esp
movl $100, 24(%esp)
movl $20, 28(%esp)
movl 24(%esp), %eax
cmpl 28(%esp), %eax
jle .L2
movl $.LC0, %eax
movl 24(%esp), %edx
movl %edx, 4(%esp)
movl %eax, (%esp)
call printf
jmp .L3
.L2:
movl $.LC0, %eax
movl 28(%esp), %edx
movl %edx, 4(%esp)
movl %eax, (%esp)
call printf
.L3:
movl $0, %eax
leave
ret
I noticed that there are two assembly statements,
11 andl $-16, %esp
12 subl $32, %esp
in my opinion, these two statements could be instead by this statement,
subl %48, %esp.
I don't know why the gcc compiler use two statements rather than one. BTW, even the latest gcc compiler with O2 option, these two statements still exist.
Hope you reply.
Thank you very much!