blob: aaca62c9937fe635d02d33d1871e681540f3ee31 (
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
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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
const empty_Element
const empty_List
const empty_LL
func Main()
t.0 = call :LL.Start(:empty_LL)
PrintIntS(t.0)
ret
func Element.Init(this v_Age v_Salary v_Married)
[this+0] = v_Age
[this+4] = v_Salary
[this+8] = v_Married
ret 1
func Element.GetAge(this)
t.0 = [this+0]
ret t.0
func Element.GetSalary(this)
t.0 = [this+4]
ret t.0
func Element.GetMarried(this)
t.0 = [this+8]
ret t.0
func Element.Equal(this other)
ret_val = 1
if other goto :null1
Error("null pointer")
null1:
aux01 = call :Element.GetAge(other)
t.0 = [this+0]
t.1 = call :Element.Compare(this aux01 t.0)
if t.1 goto :if1_else
ret_val = 0
goto :if1_end
if1_else:
if other goto :null2
Error("null pointer")
null2:
aux02 = call :Element.GetSalary(other)
t.2 = [this+4]
t.3 = call :Element.Compare(this aux02 t.2)
if t.3 goto :if2_else
ret_val = 0
goto :if2_end
if2_else:
t.4 = [this+8]
if0 t.4 goto :if3_else
if other goto :null3
Error("null pointer")
null3:
t.5 = call :Element.GetMarried(other)
if t.5 goto :if4_else
ret_val = 0
goto :if4_end
if4_else:
nt = 0
if4_end:
goto :if3_end
if3_else:
if other goto :null4
Error("null pointer")
null4:
t.6 = call :Element.GetMarried(other)
if0 t.6 goto :if5_else
ret_val = 0
goto :if5_end
if5_else:
nt = 0
if5_end:
if3_end:
if2_end:
if1_end:
ret ret_val
func Element.Compare(this num1 num2)
retval = 0
aux02 = Add(num2 1)
t.0 = LtS(num1 num2)
if0 t.0 goto :if6_else
retval = 0
goto :if6_end
if6_else:
t.1 = LtS(num1 aux02)
if t.1 goto :if7_else
retval = 0
goto :if7_end
if7_else:
retval = 1
if7_end:
if6_end:
ret retval
func List.Init(this)
[this+8] = 1
ret 1
func List.InitNew(this v_elem v_next v_end)
[this+8] = v_end
[this+0] = v_elem
[this+4] = v_next
ret 1
func List.Insert(this new_elem)
aux03 = this
aux02 = HeapAllocZ(12)
if aux02 goto :null5
Error("null pointer")
null5:
ret_val = call :List.InitNew(aux02 new_elem aux03 0)
ret aux02
func List.SetNext(this v_next)
[this+4] = v_next
ret 1
func List.Delete(this e)
my_head = this
ret_val = 0
aux04 = Sub(0 1)
aux01 = this
prev = this
var_end = [this+8]
var_elem = [this+0]
while1_top:
if var_end goto :ss1_else
t.0 = Sub(1 ret_val)
goto :ss1_end
ss1_else:
t.0 = 0
ss1_end:
if0 t.0 goto :while1_end
if e goto :null6
Error("null pointer")
null6:
t.1 = call :Element.Equal(e var_elem)
if0 t.1 goto :if8_else
ret_val = 1
t.2 = LtS(aux04 0)
if0 t.2 goto :if9_else
if aux01 goto :null7
Error("null pointer")
null7:
my_head = call :List.GetNext(aux01)
goto :if9_end
if9_else:
t.3 = Sub(0 555)
PrintIntS(t.3)
if prev goto :null8
Error("null pointer")
null8:
if aux01 goto :null9
Error("null pointer")
null9:
t.4 = call :List.GetNext(aux01)
aux05 = call :List.SetNext(prev t.4)
t.5 = Sub(0 555)
PrintIntS(t.5)
if9_end:
goto :if8_end
if8_else:
nt = 0
if8_end:
if ret_val goto :if10_else
prev = aux01
if aux01 goto :null10
Error("null pointer")
null10:
aux01 = call :List.GetNext(aux01)
if aux01 goto :null11
Error("null pointer")
null11:
var_end = call :List.GetEnd(aux01)
if aux01 goto :null12
Error("null pointer")
null12:
var_elem = call :List.GetElem(aux01)
aux04 = 1
goto :if10_end
if10_else:
nt = 0
if10_end:
goto :while1_top
while1_end:
ret my_head
func List.Search(this e)
int_ret_val = 0
aux01 = this
var_end = [this+8]
var_elem = [this+0]
while2_top:
t.0 = Sub(1 var_end)
if0 t.0 goto :while2_end
if e goto :null13
Error("null pointer")
null13:
t.1 = call :Element.Equal(e var_elem)
if0 t.1 goto :if11_else
int_ret_val = 1
goto :if11_end
if11_else:
nt = 0
if11_end:
if aux01 goto :null14
Error("null pointer")
null14:
aux01 = call :List.GetNext(aux01)
if aux01 goto :null15
Error("null pointer")
null15:
var_end = call :List.GetEnd(aux01)
if aux01 goto :null16
Error("null pointer")
null16:
var_elem = call :List.GetElem(aux01)
goto :while2_top
while2_end:
ret int_ret_val
func List.GetEnd(this)
t.0 = [this+8]
ret t.0
func List.GetElem(this)
t.0 = [this+0]
ret t.0
func List.GetNext(this)
t.0 = [this+4]
ret t.0
func List.Print(this)
aux01 = this
var_end = [this+8]
var_elem = [this+0]
while3_top:
t.0 = Sub(1 var_end)
if0 t.0 goto :while3_end
if var_elem goto :null17
Error("null pointer")
null17:
t.1 = call :Element.GetAge(var_elem)
PrintIntS(t.1)
if aux01 goto :null18
Error("null pointer")
null18:
aux01 = call :List.GetNext(aux01)
if aux01 goto :null19
Error("null pointer")
null19:
var_end = call :List.GetEnd(aux01)
if aux01 goto :null20
Error("null pointer")
null20:
var_elem = call :List.GetElem(aux01)
goto :while3_top
while3_end:
ret 1
func LL.Start(this)
last_elem = HeapAllocZ(12)
if last_elem goto :null21
Error("null pointer")
null21:
aux01 = call :List.Init(last_elem)
head = last_elem
if head goto :null22
Error("null pointer")
null22:
aux01 = call :List.Init(head)
if head goto :null23
Error("null pointer")
null23:
aux01 = call :List.Print(head)
el01 = HeapAllocZ(12)
if el01 goto :null24
Error("null pointer")
null24:
aux01 = call :Element.Init(el01 25 37000 0)
if head goto :null25
Error("null pointer")
null25:
head = call :List.Insert(head el01)
if head goto :null26
Error("null pointer")
null26:
aux01 = call :List.Print(head)
PrintIntS(10000000)
el01 = HeapAllocZ(12)
if el01 goto :null27
Error("null pointer")
null27:
aux01 = call :Element.Init(el01 39 42000 1)
el02 = el01
if head goto :null28
Error("null pointer")
null28:
head = call :List.Insert(head el01)
if head goto :null29
Error("null pointer")
null29:
aux01 = call :List.Print(head)
PrintIntS(10000000)
el01 = HeapAllocZ(12)
if el01 goto :null30
Error("null pointer")
null30:
aux01 = call :Element.Init(el01 22 34000 0)
if head goto :null31
Error("null pointer")
null31:
head = call :List.Insert(head el01)
if head goto :null32
Error("null pointer")
null32:
aux01 = call :List.Print(head)
el03 = HeapAllocZ(12)
if el03 goto :null33
Error("null pointer")
null33:
aux01 = call :Element.Init(el03 27 34000 0)
if head goto :null34
Error("null pointer")
null34:
t.0 = call :List.Search(head el02)
PrintIntS(t.0)
if head goto :null35
Error("null pointer")
null35:
t.1 = call :List.Search(head el03)
PrintIntS(t.1)
PrintIntS(10000000)
el01 = HeapAllocZ(12)
if el01 goto :null36
Error("null pointer")
null36:
aux01 = call :Element.Init(el01 28 35000 0)
if head goto :null37
Error("null pointer")
null37:
head = call :List.Insert(head el01)
if head goto :null38
Error("null pointer")
null38:
aux01 = call :List.Print(head)
PrintIntS(2220000)
if head goto :null39
Error("null pointer")
null39:
head = call :List.Delete(head el02)
if head goto :null40
Error("null pointer")
null40:
aux01 = call :List.Print(head)
PrintIntS(33300000)
if head goto :null41
Error("null pointer")
null41:
head = call :List.Delete(head el01)
if head goto :null42
Error("null pointer")
null42:
aux01 = call :List.Print(head)
PrintIntS(44440000)
ret 0
|