original code |
optimized code |
comment |
movl $0, %eax movl %eax, -12(%ebp) |
movl $0, -12(%ebp) | The x86 CPU can move a constant to a memory location. |
movl $48, %ebx cmpl %ebx, %eax |
cmpl $48, %eax |
The x86 CPU can compare a constant with a register. |
movl $48, %ebx subl %ebx, %eax |
subl $48, %eax |
The x86 CPU can subtract a
constant from a register. |
movl $0, %eax pushl %eax |
pushl $0 |
The x86 CPU can push a constant. |
cmpl
%ebx, %eax sete %al movzbl %al, %eax andl %eax, %eax jz .L8 |
cmpl
%ebx, %eax jnz .L8 |
The compare op code sets the
flags. |
cmpl %ebx, %eax setg %al movzbl %al, %eax andl %eax, %eax jz .L10 |
cmpl %ebx, %eax jng .L10 |
The compare op code sets the flags. |