- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
int main() {
float a = 3.14;
asm volatile (
"decl %%esp" "\n\t"
"movb $0, (%%esp)" "\n\t"
"decl %%esp" "\n\t"
"movb $'\n', (%%esp)" "\n\t"
"movl $32, %%eax" "\n"
"label0:" "\n\t"
"shrl %[A]" "\n\t"
"decl %%esp" "\n\t"
"jc label1" "\n\t"
"movb $'0', (%%esp)" "\n\t"
"jmp label2" "\n"
"label1:" "\n\t"
"movb $'1', (%%esp)" "\n\t"
"label2:" "\n\t"
"decl %%eax" "\n\t"
"cmpl $0, %%eax" "\n\t"
"ja label0" "\n\t"
"\n\t"
"pushl %%esp" "\n\t"
"call printf" "\n\t"
"\n\t"
"addl $38, %%esp" "\n"
: /* no output registers */
: [A] "r" (a)
: "%esp", "%eax"
);
return 0;
}