-
Notifications
You must be signed in to change notification settings - Fork 10
/
output.s
108 lines (96 loc) · 1.35 KB
/
output.s
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
section .text
global main
extern printInt1
extern scanInt0
extern printString1
extern scanString0
extern fcreate1
extern fwrite2
extern fclose1
extern fopen1
extern fread2
extern append2
extern val1
extern next1
main:
push ebp
mov ebp , esp
sub esp , 100
push 1
push 0
call append2
mov ebx , eax
mov ecx , ebx
mov esi , 0
mov [ebp-12] , ebx
mov [ebp-4] , ecx
mov [ebp-8] , esi
label1:
mov ebx , [ebp-8]
cmp ebx , 5
mov [ebp-8] , ebx
jge label4
jmp label3
label2:
mov ebx , [ebp-8]
mov ecx , ebx
mov esi , ebx
add esi , 1
mov ebx , esi
mov [ebp-8] , ebx
jmp label1
label3:
mov ebx , [ebp-8]
mov ecx , ebx
add ecx , 3
push ecx
mov esi , [ebp-12]
push esi
mov [ebp-8] , ebx
mov [ebp-12] , esi
call append2
mov ebx , eax
mov [ebp-12] , ebx
jmp label2
label4:
mov ebx , 0
mov [ebp-8] , ebx
label5:
mov ebx , [ebp-8]
cmp ebx , 5
mov [ebp-8] , ebx
jge label10
jmp label7
label6:
mov ebx , [ebp-8]
mov ecx , ebx
mov esi , ebx
add esi , 1
mov ebx , esi
mov [ebp-8] , ebx
jmp label5
label7:
mov ebx , [ebp-4]
push ebx
mov [ebp-4] , ebx
call val1
mov ebx , eax
cmp ebx , 5
mov [ebp-16] , ebx
jne label9
jmp label8
label8:
push 1
call printInt1
label9:
mov ebx , [ebp-4]
push ebx
mov [ebp-4] , ebx
call next1
mov ebx , eax
mov [ebp-4] , ebx
jmp label6
label10:
mov eax , 1
mov ebx , 0
int 0x80