aboutsummaryrefslogtreecommitdiffstats
path: root/code/tools/lcc/x86/win32/tst/cf.sbk
blob: 9ab4cfc2868895661580808e78e7ba45d74b1d97 (plain)
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
.486
.model flat
extrn __fltused:near
extrn __ftol:near
public _main
_TEXT segment
_main:
push ebx
push esi
push edi
push ebp
mov ebp,esp
sub esp,24
cmp dword ptr (20)[ebp],1
jg L2
fld dword ptr (L4)
fstp dword ptr (-16)[ebp]
jmp L3
L2:
mov edi,dword ptr (24)[ebp]
mov edi,dword ptr (4)[edi]
push edi
call _atof
add esp,4
fstp dword ptr (-20)[ebp]
fld dword ptr (-20)[ebp]
fdiv dword ptr (L5)
fstp dword ptr (-16)[ebp]
L3:
mov dword ptr (-4)[ebp],0
L6:
mov edi,dword ptr (-4)[ebp]
lea esi,(1)[edi]
mov dword ptr (-4)[ebp],esi
fld dword ptr (L4)
fstp dword ptr (_f)[edi*4]
L7:
cmp dword ptr (-4)[ebp],127
jle L6
mov dword ptr (-8)[ebp],0
jmp L11
L10:
mov edi,dword ptr (-12)[ebp]
lea edi,(_f)[edi*4]
fld dword ptr [edi]
fadd dword ptr (L13)
fstp dword ptr [edi]
inc dword ptr (-8)[ebp]
L11:
call _getchar
add esp,0
mov dword ptr (-12)[ebp],eax
cmp eax,-1
jne L10
lea edi,(L14)
push edi
call _printf
add esp,4
mov dword ptr (-4)[ebp],0
L15:
mov edi,dword ptr (-4)[ebp]
fld dword ptr (_f)[edi*4]
fstp dword ptr (-24)[ebp]
fld dword ptr (L4)
fcomp dword ptr (-24)[ebp]
fstsw ax
sahf
je L19
fld dword ptr (-24)[ebp]
mov edi,dword ptr (-8)[ebp]
push edi
fild dword ptr 0[esp]
add esp,4
fdivp st(1),st
fld dword ptr (-16)[ebp]
fcompp
fstsw ax
sahf
ja L19
cmp dword ptr (-4)[ebp],32
jg L21
mov edi,dword ptr (-4)[ebp]
push edi
lea edi,(L23)
push edi
call _printf
add esp,8
jmp L22
L21:
mov edi,dword ptr (-4)[ebp]
push edi
lea edi,(L24)
push edi
call _printf
add esp,8
L22:
fld dword ptr (L5)
mov edi,dword ptr (-4)[ebp]
fmul dword ptr (_f)[edi*4]
mov edi,dword ptr (-8)[ebp]
push edi
fild dword ptr 0[esp]
add esp,4
fdivp st(1),st
sub esp,8
fstp qword ptr [esp]
lea edi,(L25)
push edi
call _printf
add esp,12
L19:
L16:
inc dword ptr (-4)[ebp]
cmp dword ptr (-4)[ebp],127
jle L15
mov eax,0
L1:
mov esp,ebp
pop ebp
pop edi
pop esi
pop ebx
ret
_TEXT ends
extrn _printf:near
_TEXT segment
_TEXT ends
extrn _getchar:near
_TEXT segment
_TEXT ends
extrn _atof:near
_TEXT segment
_TEXT ends
_DATA segment
public _f
align 4
_f label byte
db 512 dup (0)
_DATA ends
_TEXT segment
align 1
L25 label byte
db 9
db 37
db 46
db 49
db 102
db 10
db 0
align 1
L24 label byte
db 37
db 99
db 0
align 1
L23 label byte
db 37
db 48
db 51
db 111
db 0
align 1
L14 label byte
db 99
db 104
db 97
db 114
db 9
db 102
db 114
db 101
db 113
db 10
db 0
align 4
L13 label byte
dd 03f800000H
align 4
L5 label byte
dd 042c80000H
align 4
L4 label byte
dd 00H
_TEXT ends
end