1
2
3
4
5
6
7
8
9
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
36
37
38
39
40
41
42
43
44
45
| int main()
{
char str[] = "Undefined state";
short S, R, Q;
S = 1;
R = 0;
Q = 0;
__asm__ ( "movw %1, %%ax\n\t"
"testw $1, %%ax\n\t"
"jz a1\n\t"
"movw %0, %%ax\n\t"
"testw $1, %%ax\n\t"
"jz a2\n\t"
"movl %3, %%ebx\n\t"
"pushl %%ebx\n\t"
"call _printf\n\t"
"popl %%ebx\n\t"
"jmp exit\n\t"
"a1:\n\t"
"movw %0, %%ax\n\t"
"testw $1, %%ax\n\t"
"jz exit\n\t"
"movw $1, %%ax\n\t"
"movw %%ax, %2\n\t"
"jmp exit\n\t"
"a2: xorw %%ax, %%ax\n\t"
"movw %%ax, %2\n\t"
"exit:\n\t"
:
: "r" (S), "r" (R), "r" (Q), "r" (str)
: );
cout << Q << endl;
//system ("PAUSE");
return 0;
} |