Skip to content

Instantly share code, notes, and snippets.

@DmitrySoshnikov
Created October 2, 2010 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DmitrySoshnikov/607562 to your computer and use it in GitHub Desktop.
Save DmitrySoshnikov/607562 to your computer and use it in GitHub Desktop.
int main()
{
int i = 0, n = 1;
while (i++ < n) if (i == 1) break;
while (i++ < n && i != 1);
return 0;
}
.file "test.c"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
subl $16, %esp
movl $0, -4(%ebp)
movl $1, -8(%ebp)
jmp .L2
.L4:
cmpl $1, -4(%ebp)
je .L7
.L2:
movl -4(%ebp), %eax
cmpl -8(%ebp), %eax
setl %al
addl $1, -4(%ebp)
testb %al, %al
jne .L4
jmp .L3
.L7:
nop
.L3:
movl -4(%ebp), %eax
cmpl -8(%ebp), %eax
setl %al
addl $1, -4(%ebp)
testb %al, %al
je .L5
cmpl $1, -4(%ebp)
jne .L3
.L5:
movl $0, %eax
leave
ret
.size main, .-main
.ident "GCC: (Ubuntu 4.4.3-4ubuntu5) 4.4.3"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment