c_src: regenerate with soft nullable handling
[nit.git] / c_src / sorter._sep.c
1 /* This C file is generated by NIT to compile module sorter. */
2 #include "sorter._sep.h"
3 val_t sorter___AbstractSorter___compare(val_t self, val_t param0, val_t param1) {
4 struct trace_t trace = {NULL, NULL, 22, LOCATE_sorter___AbstractSorter___compare};
5 val_t *variable = NULL;
6 struct WBT_ **closurevariable = NULL;
7 trace.prev = tracehead; tracehead = &trace;
8 trace.file = LOCATE_sorter;
9 fprintf(stderr, "Deferred method called");
10 fprintf(stderr, " (%s:%d)\n", LOCATE_sorter, 22);
11 nit_exit(1);
12 tracehead = trace.prev;
13 return NIT_NULL;
14 }
15 void sorter___AbstractSorter___sort(val_t self, val_t param0) {
16 struct trace_t trace = {NULL, NULL, 29, LOCATE_sorter___AbstractSorter___sort};
17 val_t variable[4];
18 struct WBT_ **closurevariable = NULL;
19 trace.prev = tracehead; tracehead = &trace;
20 trace.file = LOCATE_sorter;
21 /* Register variable[0]: Local variable */
22 variable[0] = self;
23 /* Register variable[1]: Local variable */
24 variable[1] = param0;
25 /* Register variable[2]: Method return value and escape marker */
26 /* Register variable[3]: Result */
27 variable[3] = CALL_abstract_collection___Collection___length( variable[1] /*array*/)( variable[1] /*array*/) /*AbstractArrayRead::length*/;
28 /* Register variable[3]: Result */
29 variable[3] = TAG_Int(UNTAG_Int(variable[3])-UNTAG_Int( TAG_Int(1)));
30 CALL_sorter___AbstractSorter___sub_sort(variable[0])(variable[0], variable[1] /*array*/, TAG_Int(0), variable[3]) /*AbstractSorter::sub_sort*/;
31 return_label0: while(false);
32 tracehead = trace.prev;
33 return;
34 }
35 void sorter___AbstractSorter___sub_sort(val_t self, val_t param0, val_t param1, val_t param2) {
36 struct trace_t trace = {NULL, NULL, 32, LOCATE_sorter___AbstractSorter___sub_sort};
37 val_t variable[6];
38 struct WBT_ **closurevariable = NULL;
39 trace.prev = tracehead; tracehead = &trace;
40 trace.file = LOCATE_sorter;
41 /* Register variable[0]: Local variable */
42 variable[0] = self;
43 /* Register variable[1]: Local variable */
44 variable[1] = param0;
45 /* Register variable[2]: Local variable */
46 variable[2] = param1;
47 /* Register variable[3]: Local variable */
48 variable[3] = param2;
49 /* Register variable[4]: Method return value and escape marker */
50 /* Register variable[5]: Result */
51 variable[5] = TAG_Bool(UNTAG_Int( variable[2] /*from*/)>=UNTAG_Int( variable[3] /*to*/));
52 if (UNTAG_Bool(variable[5])) { /*if*/
53 goto return_label1;
54 } else { /*if*/
55 /* Register variable[5]: Result */
56 variable[5] = TAG_Int(UNTAG_Int( variable[2] /*from*/)+UNTAG_Int( TAG_Int(7)));
57 /* Register variable[5]: Result */
58 variable[5] = TAG_Bool(UNTAG_Int(variable[5])<UNTAG_Int( variable[3] /*to*/));
59 if (UNTAG_Bool(variable[5])) { /*if*/
60 CALL_sorter___AbstractSorter___quick_sort(variable[0])(variable[0], variable[1] /*array*/, variable[2] /*from*/, variable[3] /*to*/) /*AbstractSorter::quick_sort*/;
61 } else { /*if*/
62 CALL_sorter___AbstractSorter___bubble_sort(variable[0])(variable[0], variable[1] /*array*/, variable[2] /*from*/, variable[3] /*to*/) /*AbstractSorter::bubble_sort*/;
63 }
64 }
65 return_label1: while(false);
66 tracehead = trace.prev;
67 return;
68 }
69 void sorter___AbstractSorter___quick_sort(val_t self, val_t param0, val_t param1, val_t param2) {
70 struct trace_t trace = {NULL, NULL, 44, LOCATE_sorter___AbstractSorter___quick_sort};
71 val_t variable[13];
72 struct WBT_ **closurevariable = NULL;
73 trace.prev = tracehead; tracehead = &trace;
74 trace.file = LOCATE_sorter;
75 /* Register variable[0]: Local variable */
76 variable[0] = self;
77 /* Register variable[1]: Local variable */
78 variable[1] = param0;
79 /* Register variable[2]: Local variable */
80 variable[2] = param1;
81 /* Register variable[3]: Local variable */
82 variable[3] = param2;
83 /* Register variable[4]: Method return value and escape marker */
84 /* Register variable[5]: Local variable */
85 /* Register variable[6]: Local variable */
86 variable[6] = variable[1] /*array*/;
87 /* Register variable[7]: Local variable */
88 variable[7] = variable[2] /*from*/;
89 /* Register variable[8]: Method return value and escape marker */
90 /* Register variable[9]: Result */
91 variable[9] = TAG_Bool(UNTAG_Int( variable[7] /*index*/)>=UNTAG_Int( TAG_Int(0)));
92 /* Ensure var variable[9]: Left 'and' operand*/
93 if (UNTAG_Bool(variable[9])) { /* and */
94 /* Register variable[9]: Result */
95 variable[9] = ATTR_array___AbstractArrayRead____length(variable[6]) /*AbstractArrayRead::_length*/;
96 /* Register variable[9]: Result */
97 variable[9] = TAG_Bool(UNTAG_Int( variable[7] /*index*/)<UNTAG_Int(variable[9]));
98 }
99 /* Register variable[9]: Result */
100 if (!UNTAG_Bool(variable[9])) { fprintf(stderr, "Assert%s failed", " 'index' "); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_array___Array_____bra, LOCATE_sorter, 234); nit_exit(1);}
101 /* Register variable[9]: Result */
102 variable[9] = ATTR_array___Array____items(variable[6]) /*Array::_items*/;
103 /* Register variable[9]: Result */
104 variable[9] = UNBOX_NativeArray(variable[9])[UNTAG_Int( variable[7] /*index*/)];
105 variable[8] = variable[9];
106 goto return_label3;
107 return_label3: while(false);
108 /* Register variable[6]: Result */
109 variable[6] = variable[8];
110 variable[5] = variable[6];
111 /* Register variable[6]: Local variable */
112 variable[6] = variable[2] /*from*/;
113 /* Register variable[7]: Local variable */
114 variable[7] = variable[3] /*to*/;
115 while (true) { /*while*/
116 /* Register variable[8]: Result */
117 variable[8] = TAG_Bool(UNTAG_Int( variable[7] /*j*/)>UNTAG_Int( variable[6] /*i*/));
118 if (!UNTAG_Bool(variable[8])) break; /* while*/
119 while (true) { /*while*/
120 /* Register variable[8]: Result */
121 variable[8] = TAG_Bool(UNTAG_Int( variable[6] /*i*/)<=UNTAG_Int( variable[3] /*to*/));
122 /* Ensure var variable[8]: Left 'and' operand*/
123 if (UNTAG_Bool(variable[8])) { /* and */
124 /* Register variable[8]: Local variable */
125 variable[8] = variable[1] /*array*/;
126 /* Register variable[9]: Local variable */
127 variable[9] = variable[6] /*i*/;
128 /* Register variable[10]: Method return value and escape marker */
129 /* Register variable[11]: Result */
130 variable[11] = TAG_Bool(UNTAG_Int( variable[9] /*index*/)>=UNTAG_Int( TAG_Int(0)));
131 /* Ensure var variable[11]: Left 'and' operand*/
132 if (UNTAG_Bool(variable[11])) { /* and */
133 /* Register variable[11]: Result */
134 variable[11] = ATTR_array___AbstractArrayRead____length(variable[8]) /*AbstractArrayRead::_length*/;
135 /* Register variable[11]: Result */
136 variable[11] = TAG_Bool(UNTAG_Int( variable[9] /*index*/)<UNTAG_Int(variable[11]));
137 }
138 /* Register variable[11]: Result */
139 if (!UNTAG_Bool(variable[11])) { fprintf(stderr, "Assert%s failed", " 'index' "); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_array___Array_____bra, LOCATE_sorter, 234); nit_exit(1);}
140 /* Register variable[11]: Result */
141 variable[11] = ATTR_array___Array____items(variable[8]) /*Array::_items*/;
142 /* Register variable[11]: Result */
143 variable[11] = UNBOX_NativeArray(variable[11])[UNTAG_Int( variable[9] /*index*/)];
144 variable[10] = variable[11];
145 goto return_label6;
146 return_label6: while(false);
147 /* Register variable[8]: Result */
148 variable[8] = variable[10];
149 /* Register variable[8]: Result */
150 variable[8] = CALL_sorter___AbstractSorter___compare(variable[0])(variable[0], variable[8], variable[5] /*pivot*/) /*AbstractSorter::compare*/;
151 /* Register variable[8]: Result */
152 variable[8] = TAG_Bool(UNTAG_Int(variable[8])<=UNTAG_Int( TAG_Int(0)));
153 }
154 /* Register variable[8]: Result */
155 if (!UNTAG_Bool(variable[8])) break; /* while*/
156 variable[6] = TAG_Int(UNTAG_Int(variable[6])+UNTAG_Int( TAG_Int(1))) /*i*/;
157 continue_5: while(0);
158 }
159 break_5: while(0);
160 while (true) { /*while*/
161 /* Register variable[8]: Result */
162 variable[8] = TAG_Bool(UNTAG_Int( variable[7] /*j*/)>UNTAG_Int( variable[6] /*i*/));
163 /* Ensure var variable[8]: Left 'and' operand*/
164 if (UNTAG_Bool(variable[8])) { /* and */
165 /* Register variable[8]: Local variable */
166 variable[8] = variable[1] /*array*/;
167 /* Register variable[9]: Local variable */
168 variable[9] = variable[7] /*j*/;
169 /* Register variable[10]: Method return value and escape marker */
170 /* Register variable[11]: Result */
171 variable[11] = TAG_Bool(UNTAG_Int( variable[9] /*index*/)>=UNTAG_Int( TAG_Int(0)));
172 /* Ensure var variable[11]: Left 'and' operand*/
173 if (UNTAG_Bool(variable[11])) { /* and */
174 /* Register variable[11]: Result */
175 variable[11] = ATTR_array___AbstractArrayRead____length(variable[8]) /*AbstractArrayRead::_length*/;
176 /* Register variable[11]: Result */
177 variable[11] = TAG_Bool(UNTAG_Int( variable[9] /*index*/)<UNTAG_Int(variable[11]));
178 }
179 /* Register variable[11]: Result */
180 if (!UNTAG_Bool(variable[11])) { fprintf(stderr, "Assert%s failed", " 'index' "); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_array___Array_____bra, LOCATE_sorter, 234); nit_exit(1);}
181 /* Register variable[11]: Result */
182 variable[11] = ATTR_array___Array____items(variable[8]) /*Array::_items*/;
183 /* Register variable[11]: Result */
184 variable[11] = UNBOX_NativeArray(variable[11])[UNTAG_Int( variable[9] /*index*/)];
185 variable[10] = variable[11];
186 goto return_label8;
187 return_label8: while(false);
188 /* Register variable[8]: Result */
189 variable[8] = variable[10];
190 /* Register variable[8]: Result */
191 variable[8] = CALL_sorter___AbstractSorter___compare(variable[0])(variable[0], variable[8], variable[5] /*pivot*/) /*AbstractSorter::compare*/;
192 /* Register variable[8]: Result */
193 variable[8] = TAG_Bool(UNTAG_Int(variable[8])>=UNTAG_Int( TAG_Int(0)));
194 }
195 /* Register variable[8]: Result */
196 if (!UNTAG_Bool(variable[8])) break; /* while*/
197 variable[7] = TAG_Int(UNTAG_Int(variable[7])-UNTAG_Int( TAG_Int(1))) /*j*/;
198 continue_7: while(0);
199 }
200 break_7: while(0);
201 /* Register variable[8]: Result */
202 variable[8] = TAG_Bool(UNTAG_Int( variable[7] /*j*/)>UNTAG_Int( variable[6] /*i*/));
203 if (UNTAG_Bool(variable[8])) { /*if*/
204 /* Register variable[8]: Local variable */
205 /* Register variable[9]: Local variable */
206 variable[9] = variable[1] /*array*/;
207 /* Register variable[10]: Local variable */
208 variable[10] = variable[6] /*i*/;
209 /* Register variable[11]: Method return value and escape marker */
210 /* Register variable[12]: Result */
211 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)>=UNTAG_Int( TAG_Int(0)));
212 /* Ensure var variable[12]: Left 'and' operand*/
213 if (UNTAG_Bool(variable[12])) { /* and */
214 /* Register variable[12]: Result */
215 variable[12] = ATTR_array___AbstractArrayRead____length(variable[9]) /*AbstractArrayRead::_length*/;
216 /* Register variable[12]: Result */
217 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)<UNTAG_Int(variable[12]));
218 }
219 /* Register variable[12]: Result */
220 if (!UNTAG_Bool(variable[12])) { fprintf(stderr, "Assert%s failed", " 'index' "); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_array___Array_____bra, LOCATE_sorter, 234); nit_exit(1);}
221 /* Register variable[12]: Result */
222 variable[12] = ATTR_array___Array____items(variable[9]) /*Array::_items*/;
223 /* Register variable[12]: Result */
224 variable[12] = UNBOX_NativeArray(variable[12])[UNTAG_Int( variable[10] /*index*/)];
225 variable[11] = variable[12];
226 goto return_label9;
227 return_label9: while(false);
228 /* Register variable[9]: Result */
229 variable[9] = variable[11];
230 variable[8] = variable[9];
231 /* Register variable[9]: Local variable */
232 variable[9] = variable[1] /*array*/;
233 /* Register variable[10]: Local variable */
234 variable[10] = variable[7] /*j*/;
235 /* Register variable[11]: Method return value and escape marker */
236 /* Register variable[12]: Result */
237 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)>=UNTAG_Int( TAG_Int(0)));
238 /* Ensure var variable[12]: Left 'and' operand*/
239 if (UNTAG_Bool(variable[12])) { /* and */
240 /* Register variable[12]: Result */
241 variable[12] = ATTR_array___AbstractArrayRead____length(variable[9]) /*AbstractArrayRead::_length*/;
242 /* Register variable[12]: Result */
243 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)<UNTAG_Int(variable[12]));
244 }
245 /* Register variable[12]: Result */
246 if (!UNTAG_Bool(variable[12])) { fprintf(stderr, "Assert%s failed", " 'index' "); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_array___Array_____bra, LOCATE_sorter, 234); nit_exit(1);}
247 /* Register variable[12]: Result */
248 variable[12] = ATTR_array___Array____items(variable[9]) /*Array::_items*/;
249 /* Register variable[12]: Result */
250 variable[12] = UNBOX_NativeArray(variable[12])[UNTAG_Int( variable[10] /*index*/)];
251 variable[11] = variable[12];
252 goto return_label10;
253 return_label10: while(false);
254 /* Register variable[9]: Result */
255 variable[9] = variable[11];
256 CALL_abstract_collection___Map_____braeq( variable[1] /*array*/)( variable[1] /*array*/, variable[6] /*i*/, variable[9]) /*Array::[]=*/;
257 CALL_abstract_collection___Map_____braeq( variable[1] /*array*/)( variable[1] /*array*/, variable[7] /*j*/, variable[8] /*t*/) /*Array::[]=*/;
258 }
259 continue_4: while(0);
260 }
261 break_4: while(0);
262 /* Register variable[8]: Result */
263 variable[8] = TAG_Int(UNTAG_Int( variable[6] /*i*/)-UNTAG_Int( TAG_Int(1)));
264 /* Register variable[9]: Local variable */
265 variable[9] = variable[1] /*array*/;
266 /* Register variable[10]: Local variable */
267 variable[10] = variable[8];
268 /* Register variable[11]: Method return value and escape marker */
269 /* Register variable[12]: Result */
270 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)>=UNTAG_Int( TAG_Int(0)));
271 /* Ensure var variable[12]: Left 'and' operand*/
272 if (UNTAG_Bool(variable[12])) { /* and */
273 /* Register variable[12]: Result */
274 variable[12] = ATTR_array___AbstractArrayRead____length(variable[9]) /*AbstractArrayRead::_length*/;
275 /* Register variable[12]: Result */
276 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)<UNTAG_Int(variable[12]));
277 }
278 /* Register variable[12]: Result */
279 if (!UNTAG_Bool(variable[12])) { fprintf(stderr, "Assert%s failed", " 'index' "); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_array___Array_____bra, LOCATE_sorter, 234); nit_exit(1);}
280 /* Register variable[12]: Result */
281 variable[12] = ATTR_array___Array____items(variable[9]) /*Array::_items*/;
282 /* Register variable[12]: Result */
283 variable[12] = UNBOX_NativeArray(variable[12])[UNTAG_Int( variable[10] /*index*/)];
284 variable[11] = variable[12];
285 goto return_label11;
286 return_label11: while(false);
287 /* Register variable[8]: Result */
288 variable[8] = variable[11];
289 CALL_abstract_collection___Map_____braeq( variable[1] /*array*/)( variable[1] /*array*/, variable[2] /*from*/, variable[8]) /*Array::[]=*/;
290 /* Register variable[8]: Result */
291 variable[8] = TAG_Int(UNTAG_Int( variable[6] /*i*/)-UNTAG_Int( TAG_Int(1)));
292 CALL_abstract_collection___Map_____braeq( variable[1] /*array*/)( variable[1] /*array*/, variable[8], variable[5] /*pivot*/) /*Array::[]=*/;
293 /* Register variable[8]: Result */
294 variable[8] = TAG_Int(UNTAG_Int( variable[6] /*i*/)-UNTAG_Int( TAG_Int(2)));
295 CALL_sorter___AbstractSorter___sub_sort(variable[0])(variable[0], variable[1] /*array*/, variable[2] /*from*/, variable[8]) /*AbstractSorter::sub_sort*/;
296 CALL_sorter___AbstractSorter___sub_sort(variable[0])(variable[0], variable[1] /*array*/, variable[6] /*i*/, variable[3] /*to*/) /*AbstractSorter::sub_sort*/;
297 return_label2: while(false);
298 tracehead = trace.prev;
299 return;
300 }
301 void sorter___AbstractSorter___bubble_sort(val_t self, val_t param0, val_t param1, val_t param2) {
302 struct trace_t trace = {NULL, NULL, 65, LOCATE_sorter___AbstractSorter___bubble_sort};
303 val_t variable[13];
304 struct WBT_ **closurevariable = NULL;
305 trace.prev = tracehead; tracehead = &trace;
306 trace.file = LOCATE_sorter;
307 /* Register variable[0]: Local variable */
308 variable[0] = self;
309 /* Register variable[1]: Local variable */
310 variable[1] = param0;
311 /* Register variable[2]: Local variable */
312 variable[2] = param1;
313 /* Register variable[3]: Local variable */
314 variable[3] = param2;
315 /* Register variable[4]: Method return value and escape marker */
316 /* Register variable[5]: Local variable */
317 variable[5] = variable[2] /*from*/;
318 while (true) { /*while*/
319 /* Register variable[6]: Result */
320 variable[6] = TAG_Bool(UNTAG_Int( variable[5] /*i*/)<UNTAG_Int( variable[3] /*to*/));
321 if (!UNTAG_Bool(variable[6])) break; /* while*/
322 /* Register variable[6]: Local variable */
323 variable[6] = variable[5] /*i*/;
324 /* Register variable[7]: Local variable */
325 /* Register variable[8]: Local variable */
326 variable[8] = variable[1] /*array*/;
327 /* Register variable[9]: Local variable */
328 variable[9] = variable[5] /*i*/;
329 /* Register variable[10]: Method return value and escape marker */
330 /* Register variable[11]: Result */
331 variable[11] = TAG_Bool(UNTAG_Int( variable[9] /*index*/)>=UNTAG_Int( TAG_Int(0)));
332 /* Ensure var variable[11]: Left 'and' operand*/
333 if (UNTAG_Bool(variable[11])) { /* and */
334 /* Register variable[11]: Result */
335 variable[11] = ATTR_array___AbstractArrayRead____length(variable[8]) /*AbstractArrayRead::_length*/;
336 /* Register variable[11]: Result */
337 variable[11] = TAG_Bool(UNTAG_Int( variable[9] /*index*/)<UNTAG_Int(variable[11]));
338 }
339 /* Register variable[11]: Result */
340 if (!UNTAG_Bool(variable[11])) { fprintf(stderr, "Assert%s failed", " 'index' "); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_array___Array_____bra, LOCATE_sorter, 234); nit_exit(1);}
341 /* Register variable[11]: Result */
342 variable[11] = ATTR_array___Array____items(variable[8]) /*Array::_items*/;
343 /* Register variable[11]: Result */
344 variable[11] = UNBOX_NativeArray(variable[11])[UNTAG_Int( variable[9] /*index*/)];
345 variable[10] = variable[11];
346 goto return_label14;
347 return_label14: while(false);
348 /* Register variable[8]: Result */
349 variable[8] = variable[10];
350 variable[7] = variable[8];
351 /* Register variable[8]: Local variable */
352 variable[8] = variable[5] /*i*/;
353 while (true) { /*while*/
354 /* Register variable[9]: Result */
355 variable[9] = TAG_Bool(UNTAG_Int( variable[8] /*j*/)<=UNTAG_Int( variable[3] /*to*/));
356 if (!UNTAG_Bool(variable[9])) break; /* while*/
357 /* Register variable[9]: Local variable */
358 variable[9] = variable[1] /*array*/;
359 /* Register variable[10]: Local variable */
360 variable[10] = variable[8] /*j*/;
361 /* Register variable[11]: Method return value and escape marker */
362 /* Register variable[12]: Result */
363 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)>=UNTAG_Int( TAG_Int(0)));
364 /* Ensure var variable[12]: Left 'and' operand*/
365 if (UNTAG_Bool(variable[12])) { /* and */
366 /* Register variable[12]: Result */
367 variable[12] = ATTR_array___AbstractArrayRead____length(variable[9]) /*AbstractArrayRead::_length*/;
368 /* Register variable[12]: Result */
369 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)<UNTAG_Int(variable[12]));
370 }
371 /* Register variable[12]: Result */
372 if (!UNTAG_Bool(variable[12])) { fprintf(stderr, "Assert%s failed", " 'index' "); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_array___Array_____bra, LOCATE_sorter, 234); nit_exit(1);}
373 /* Register variable[12]: Result */
374 variable[12] = ATTR_array___Array____items(variable[9]) /*Array::_items*/;
375 /* Register variable[12]: Result */
376 variable[12] = UNBOX_NativeArray(variable[12])[UNTAG_Int( variable[10] /*index*/)];
377 variable[11] = variable[12];
378 goto return_label16;
379 return_label16: while(false);
380 /* Register variable[9]: Result */
381 variable[9] = variable[11];
382 /* Register variable[9]: Result */
383 variable[9] = CALL_sorter___AbstractSorter___compare(variable[0])(variable[0], variable[7] /*min_v*/, variable[9]) /*AbstractSorter::compare*/;
384 /* Register variable[9]: Result */
385 variable[9] = TAG_Bool(UNTAG_Int(variable[9])>UNTAG_Int( TAG_Int(0)));
386 if (UNTAG_Bool(variable[9])) { /*if*/
387 variable[6] = variable[8] /*j*/ /*min=*/;
388 /* Register variable[9]: Local variable */
389 variable[9] = variable[1] /*array*/;
390 /* Register variable[10]: Local variable */
391 variable[10] = variable[8] /*j*/;
392 /* Register variable[11]: Method return value and escape marker */
393 /* Register variable[12]: Result */
394 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)>=UNTAG_Int( TAG_Int(0)));
395 /* Ensure var variable[12]: Left 'and' operand*/
396 if (UNTAG_Bool(variable[12])) { /* and */
397 /* Register variable[12]: Result */
398 variable[12] = ATTR_array___AbstractArrayRead____length(variable[9]) /*AbstractArrayRead::_length*/;
399 /* Register variable[12]: Result */
400 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)<UNTAG_Int(variable[12]));
401 }
402 /* Register variable[12]: Result */
403 if (!UNTAG_Bool(variable[12])) { fprintf(stderr, "Assert%s failed", " 'index' "); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_array___Array_____bra, LOCATE_sorter, 234); nit_exit(1);}
404 /* Register variable[12]: Result */
405 variable[12] = ATTR_array___Array____items(variable[9]) /*Array::_items*/;
406 /* Register variable[12]: Result */
407 variable[12] = UNBOX_NativeArray(variable[12])[UNTAG_Int( variable[10] /*index*/)];
408 variable[11] = variable[12];
409 goto return_label17;
410 return_label17: while(false);
411 /* Register variable[9]: Result */
412 variable[9] = variable[11];
413 variable[7] = variable[9] /*min_v=*/;
414 }
415 variable[8] = TAG_Int(UNTAG_Int(variable[8])+UNTAG_Int( TAG_Int(1))) /*j*/;
416 continue_15: while(0);
417 }
418 break_15: while(0);
419 /* Register variable[9]: Result */
420 variable[9] = TAG_Bool(( variable[6] /*min*/)!=( variable[5] /*i*/));
421 if (UNTAG_Bool(variable[9])) { /*if*/
422 /* Register variable[9]: Local variable */
423 variable[9] = variable[1] /*array*/;
424 /* Register variable[10]: Local variable */
425 variable[10] = variable[5] /*i*/;
426 /* Register variable[11]: Method return value and escape marker */
427 /* Register variable[12]: Result */
428 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)>=UNTAG_Int( TAG_Int(0)));
429 /* Ensure var variable[12]: Left 'and' operand*/
430 if (UNTAG_Bool(variable[12])) { /* and */
431 /* Register variable[12]: Result */
432 variable[12] = ATTR_array___AbstractArrayRead____length(variable[9]) /*AbstractArrayRead::_length*/;
433 /* Register variable[12]: Result */
434 variable[12] = TAG_Bool(UNTAG_Int( variable[10] /*index*/)<UNTAG_Int(variable[12]));
435 }
436 /* Register variable[12]: Result */
437 if (!UNTAG_Bool(variable[12])) { fprintf(stderr, "Assert%s failed", " 'index' "); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_array___Array_____bra, LOCATE_sorter, 234); nit_exit(1);}
438 /* Register variable[12]: Result */
439 variable[12] = ATTR_array___Array____items(variable[9]) /*Array::_items*/;
440 /* Register variable[12]: Result */
441 variable[12] = UNBOX_NativeArray(variable[12])[UNTAG_Int( variable[10] /*index*/)];
442 variable[11] = variable[12];
443 goto return_label18;
444 return_label18: while(false);
445 /* Register variable[9]: Result */
446 variable[9] = variable[11];
447 CALL_abstract_collection___Map_____braeq( variable[1] /*array*/)( variable[1] /*array*/, variable[6] /*min*/, variable[9]) /*Array::[]=*/;
448 CALL_abstract_collection___Map_____braeq( variable[1] /*array*/)( variable[1] /*array*/, variable[5] /*i*/, variable[7] /*min_v*/) /*Array::[]=*/;
449 }
450 variable[5] = TAG_Int(UNTAG_Int(variable[5])+UNTAG_Int( TAG_Int(1))) /*i*/;
451 continue_13: while(0);
452 }
453 break_13: while(0);
454 return_label12: while(false);
455 tracehead = trace.prev;
456 return;
457 }
458 void sorter___AbstractSorter___init(val_t self, int* init_table) {
459 struct trace_t trace = {NULL, NULL, 0, LOCATE_sorter___AbstractSorter___init};
460 val_t *variable = NULL;
461 struct WBT_ **closurevariable = NULL;
462 trace.prev = tracehead; tracehead = &trace;
463 trace.file = LOCATE_sorter;
464 tracehead = trace.prev;
465 return;
466 }
467 val_t sorter___ComparableSorter___compare(val_t self, val_t param0, val_t param1) {
468 struct trace_t trace = {NULL, NULL, 93, LOCATE_sorter___ComparableSorter___compare};
469 val_t variable[5];
470 struct WBT_ **closurevariable = NULL;
471 trace.prev = tracehead; tracehead = &trace;
472 trace.file = LOCATE_sorter;
473 /* Register variable[0]: Local variable */
474 variable[0] = self;
475 /* Register variable[1]: Local variable */
476 variable[1] = param0;
477 /* Register variable[2]: Local variable */
478 variable[2] = param1;
479 /* Register variable[3]: Method return value and escape marker */
480 /* Register variable[4]: Result */
481 variable[4] = CALL_kernel___Comparable_____leqg( variable[1] /*a*/)( variable[1] /*a*/, variable[2] /*b*/) /*Comparable::<=>*/;
482 variable[3] = variable[4];
483 goto return_label19;
484 return_label19: while(false);
485 tracehead = trace.prev;
486 return variable[3];
487 }
488 void sorter___ComparableSorter___init(val_t self, int* init_table) {
489 struct trace_t trace = {NULL, NULL, 96, LOCATE_sorter___ComparableSorter___init};
490 val_t variable[2];
491 struct WBT_ **closurevariable = NULL;
492 trace.prev = tracehead; tracehead = &trace;
493 trace.file = LOCATE_sorter;
494 /* Register variable[0]: Local variable */
495 variable[0] = self;
496 if (init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_ComparableSorter].i]) return;
497 /* Register variable[1]: Method return value and escape marker */
498 return_label20: while(false);
499 init_table[VAL2OBJ(variable[0])->vft[INIT_TABLE_POS_ComparableSorter].i] = 1;
500 tracehead = trace.prev;
501 return;
502 }