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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
.486
.model flat
extrn __fltused:near
extrn __ftol:near
_DATA segment
public _x
align 4
_x label byte
dd 1
db 2
db 3 dup (0)
db 03H
db 040H
db 2 dup (0)
db 050H
db 6
db 2 dup (0)
public _i
align 4
_i label byte
dd 16
public _y
align 4
_y label byte
db 023H
db 3 dup (0)
db 09H
db 00H
db 00H
db 00H
public _main
_DATA ends
_TEXT segment
_main:
push ebx
push esi
push edi
push ebp
mov ebp,esp
movsx edi,byte ptr (_x+13)
push edi
mov edi,dword ptr (_x+12)
sal edi,25
sar edi,29
push edi
mov edi,dword ptr (_x+8)
sal edi,16
sar edi,28
push edi
mov edi,dword ptr (_x+8)
sal edi,20
sar edi,20
push edi
movsx edi,byte ptr (_x+4)
push edi
mov edi,dword ptr (_x)
push edi
lea edi,(L4)
push edi
call _printf
add esp,28
mov edi,dword ptr (_y+4)
push edi
mov edi,dword ptr (_y)
mov esi,edi
shr esi,2
and esi,15
push esi
and edi,3
push edi
lea edi,(L10)
push edi
call _printf
add esp,16
mov edi,dword ptr (_x+8)
and edi,0ffff0fffH
mov esi,dword ptr (_i)
sal esi,28
sar esi,28
shl esi,12
and esi,0f000H
or edi,esi
mov dword ptr (_x+8),edi
mov edi,dword ptr (_x+12)
and edi,0ffffff8fH
mov dword ptr (_x+12),edi
movsx edi,byte ptr (_x+13)
push edi
mov edi,dword ptr (_x+12)
sal edi,25
sar edi,29
push edi
mov edi,dword ptr (_x+8)
sal edi,16
sar edi,28
push edi
mov edi,dword ptr (_x+8)
sal edi,20
sar edi,20
push edi
movsx edi,byte ptr (_x+4)
push edi
mov edi,dword ptr (_x)
push edi
lea edi,(L4)
push edi
call _printf
add esp,28
mov edi,dword ptr (_y)
and edi,0fffffffcH
or edi,2
mov dword ptr (_y),edi
mov edi,dword ptr (_i)
mov dword ptr (_y+4),edi
mov edi,dword ptr (_y+4)
push edi
mov edi,dword ptr (_y)
mov esi,edi
shr esi,2
and esi,15
push esi
and edi,3
push edi
lea edi,(L10)
push edi
call _printf
add esp,16
lea edi,(_x)
push edi
call _f2
add esp,4
mov eax,0
L3:
mov esp,ebp
pop ebp
pop edi
pop esi
pop ebx
ret
public _f1
_f1:
push ebx
push esi
push edi
push ebp
mov ebp,esp
mov edi,dword ptr (20)[ebp]
and dword ptr [edi],0ffffffc3H
mov edi,dword ptr (20)[ebp]
mov esi,dword ptr [edi]
and esi,0fffffffcH
mov ebx,0
and ebx,3
and ebx,3
or esi,ebx
mov dword ptr [edi],esi
mov edi,dword ptr (20)[ebp]
mov edi,dword ptr [edi]
and edi,60
cmp edi,0
je L22
lea edi,(L24)
push edi
call _printf
add esp,4
L22:
mov edi,dword ptr (20)[ebp]
or dword ptr [edi],3
mov edi,dword ptr (20)[ebp]
or dword ptr [edi],60
mov edi,dword ptr (20)[ebp]
mov edi,dword ptr [edi]
mov esi,edi
shr esi,2
and esi,15
push esi
and edi,3
push edi
lea edi,(L25)
push edi
call _printf
add esp,12
mov eax,0
L21:
mov esp,ebp
pop ebp
pop edi
pop esi
pop ebx
ret
public _f2
_f2:
push ebx
push esi
push edi
push ebp
mov ebp,esp
sub esp,4
cmp dword ptr (_i),0
jne L28
mov dword ptr (-4)[ebp],1
jmp L29
L28:
mov dword ptr (-4)[ebp],0
L29:
mov edi,dword ptr (20)[ebp]
mov esi,dword ptr [edi]
and esi,0fffffffcH
mov ebx,dword ptr (-4)[ebp]
and ebx,3
and ebx,3
or esi,ebx
mov dword ptr [edi],esi
mov edi,dword ptr (20)[ebp]
push edi
call _f1
add esp,4
mov esi,dword ptr [edi]
and esi,0ffffffc3H
mov ebx,0
and ebx,15
lea ebx,[ebx*4]
and ebx,60
or esi,ebx
mov dword ptr [edi],esi
mov eax,0
L26:
mov esp,ebp
pop ebp
pop edi
pop esi
pop ebx
ret
_TEXT ends
extrn _printf:near
_TEXT segment
_TEXT ends
_TEXT segment
align 1
L25 label byte
db 112
db 45
db 62
db 97
db 32
db 61
db 32
db 48
db 120
db 37
db 120
db 44
db 32
db 112
db 45
db 62
db 98
db 32
db 61
db 32
db 48
db 120
db 37
db 120
db 10
db 0
align 1
L24 label byte
db 112
db 45
db 62
db 98
db 32
db 33
db 61
db 32
db 48
db 33
db 10
db 0
align 1
L10 label byte
db 121
db 32
db 61
db 32
db 37
db 100
db 32
db 37
db 100
db 32
db 37
db 100
db 10
db 0
align 1
L4 label byte
db 120
db 32
db 61
db 32
db 37
db 100
db 32
db 37
db 100
db 32
db 37
db 100
db 32
db 37
db 100
db 32
db 37
db 100
db 32
db 37
db 100
db 10
db 0
_TEXT ends
end
|