-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.s
160 lines (160 loc) · 2.69 KB
/
test.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
.file "test.c"
.comm message_count,4,4
.section .rodata
.LC0:
.string "["
.LC1:
.string "]: "
.LC2:
.string "Recieved message[%d]: %s\n"
.text
.globl PrintMessage
.type PrintMessage, @function
PrintMessage:
.LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
pushl %edi
pushl %ebx
subl $288, %esp
movl $.LC0, %edx
leal -264(%ebp), %eax
movzwl (%edx), %edx
movw %dx, (%eax)
leal 8(%ebp), %eax
movl %eax, 4(%esp)
leal -264(%ebp), %eax
movl %eax, (%esp)
.cfi_offset 3, -16
.cfi_offset 7, -12
call strcat
movl $.LC1, %ebx
leal -264(%ebp), %eax
movl $-1, -268(%ebp)
movl %eax, %edx
movl $0, %eax
movl -268(%ebp), %ecx
movl %edx, %edi
repnz scasb
movl %ecx, %eax
notl %eax
leal -1(%eax), %edx
leal -264(%ebp), %eax
addl %eax, %edx
movl (%ebx), %eax
movl %eax, (%edx)
leal 40(%ebp), %eax
movl %eax, 4(%esp)
leal -264(%ebp), %eax
movl %eax, (%esp)
call strcat
movl message_count, %edx
movl $.LC2, %eax
leal -264(%ebp), %ecx
movl %ecx, 8(%esp)
movl %edx, 4(%esp)
movl %eax, (%esp)
call printf
addl $288, %esp
popl %ebx
.cfi_restore 3
popl %edi
.cfi_restore 7
popl %ebp
.cfi_def_cfa 4, 4
.cfi_restore 5
ret
.cfi_endproc
.LFE0:
.size PrintMessage, .-PrintMessage
.section .rodata
.LC3:
.string "i = %d\n"
.LC4:
.string "n = %d\n"
.text
.globl main
.type main, @function
main:
.LFB1:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
pushl %edi
pushl %esi
pushl %ebx
andl $-16, %esp
subl $2144, %esp
movl $0, 2136(%esp)
movl $0, 2140(%esp)
jmp .L3
.cfi_offset 3, -20
.cfi_offset 6, -16
.cfi_offset 7, -12
.L4:
leal 1076(%esp), %eax
addl 2140(%esp), %eax
movb $111, (%eax)
addl $1, 2140(%esp)
.L3:
cmpl $30, 2140(%esp)
jle .L4
movl $.LC3, %eax
movl 2140(%esp), %edx
movl %edx, 4(%esp)
movl %eax, (%esp)
call printf
leal 1076(%esp), %eax
addl 2140(%esp), %eax
movb $0, (%eax)
movl $0, 2140(%esp)
jmp .L5
.L6:
leal 1108(%esp), %eax
addl 2140(%esp), %eax
movb $97, (%eax)
addl $1, 2140(%esp)
.L5:
cmpl $227, 2140(%esp)
jle .L6
leal 1108(%esp), %eax
addl 2140(%esp), %eax
movb $0, (%eax)
movl %esp, %edx
leal 1076(%esp), %ebx
movl $265, %eax
movl %edx, %edi
movl %ebx, %esi
movl %eax, %ecx
rep movsl
call PrintMessage
addl $1, 2136(%esp)
movl $.LC4, %eax
movl 2136(%esp), %edx
movl %edx, 4(%esp)
movl %eax, (%esp)
call printf
movl $0, %eax
leal -12(%ebp), %esp
popl %ebx
.cfi_restore 3
popl %esi
.cfi_restore 6
popl %edi
.cfi_restore 7
popl %ebp
.cfi_def_cfa 4, 4
.cfi_restore 5
ret
.cfi_endproc
.LFE1:
.size main, .-main
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
.section .note.GNU-stack,"",@progbits