https://github.com/akkartik/mu/blob/master/subx/058stream-equal.subx
1
2
3 == code
4
5
6
7
8
9
10
11
12
13
14
15
16 stream-data-equal?:
17
18 55/push-EBP
19 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
20
21 51/push-ECX
22 52/push-EDX
23 56/push-ESI
24 57/push-EDI
25
26 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
27
28 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
29 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 0/index/EAX . 2/r32/EDX 0xc/disp8 .
30
31 81 0/subop/add 3/mod/direct 6/rm32/ESI . . . . . 0xc/imm32
32
33 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 0xc/disp8 .
34
35 39/compare 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
36 75/jump-if-not-equal $stream-data-equal?:false/disp8
37
38 81 0/subop/add 3/mod/direct 7/rm32/EDI . . . . . 4/imm32
39
40 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
41 31/xor 3/mod/direct 1/rm32/ECX . . . 1/r32/ECX . .
42 $stream-data-equal?:loop:
43
44 39/compare 3/mod/direct 6/rm32/ESI . . . 2/r32/EDX . .
45 7d/jump-if-greater-or-equal $stream-data-equal?:true/disp8
46
47 8a/copy-byte 0/mod/indirect 6/rm32/ESI . . . 0/r32/AL . .
48
49 8a/copy-byte 0/mod/indirect 7/rm32/EDI . . . 1/r32/CL . .
50
51 39/compare 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
52 75/jump-if-not-equal $stream-data-equal?:false/disp8
53
54 46/increment-ESI
55
56 47/increment-EDI
57 eb/jump $stream-data-equal?:loop/disp8
58 $stream-data-equal?:false:
59 b8/copy-to-EAX 0/imm32
60 eb/jump $stream-data-equal?:end/disp8
61 $stream-data-equal?:true:
62 b8/copy-to-EAX 1/imm32
63 $stream-data-equal?:end:
64
65 5f/pop-to-EDI
66 5e/pop-to-ESI
67 5a/pop-to-EDX
68 59/pop-to-ECX
69
70 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
71 5d/pop-to-EBP
72 c3/return
73
74 test-stream-data-equal:
75
76 55/push-EBP
77 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
78
79
80 68/push _test-stream/imm32
81
82 e8/call clear-stream/disp32
83
84 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
85
86
87 68/push "Abc"/imm32
88 68/push _test-stream/imm32
89
90 e8/call write/disp32
91
92 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
93
94
95 68/push "Abc"/imm32
96 68/push _test-stream/imm32
97
98 e8/call stream-data-equal?/disp32
99
100 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
101
102
103 68/push "F - test-stream-data-equal"/imm32
104 68/push 1/imm32
105 50/push-EAX
106
107 e8/call check-ints-equal/disp32
108
109 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
110
111 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
112 5d/pop-to-EBP
113 c3/return
114
115 test-stream-data-equal-2:
116
117 55/push-EBP
118 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
119
120
121 68/push _test-stream/imm32
122
123 e8/call clear-stream/disp32
124
125 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
126
127
128 68/push "Abc"/imm32
129 68/push _test-stream/imm32
130
131 e8/call write/disp32
132
133 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
134
135
136 68/push "Abd"/imm32
137 68/push _test-stream/imm32
138
139 e8/call stream-data-equal?/disp32
140
141 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
142
143
144 68/push "F - test-stream-data-equal-2"/imm32
145 68/push 0/imm32
146 50/push-EAX
147
148 e8/call check-ints-equal/disp32
149
150 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
151
152 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
153 5d/pop-to-EBP
154 c3/return
155
156 test-stream-data-equal-length-check:
157
158 55/push-EBP
159 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
160
161
162 68/push _test-stream/imm32
163
164 e8/call clear-stream/disp32
165
166 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
167
168
169 68/push "Abc"/imm32
170 68/push _test-stream/imm32
171
172 e8/call write/disp32
173
174 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
175
176
177 68/push "Abcd"/imm32
178 68/push _test-stream/imm32
179
180 e8/call stream-data-equal?/disp32
181
182 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
183
184
185 68/push "F - test-stream-data-equal-length-check"/imm32
186 68/push 0/imm32
187 50/push-EAX
188
189 e8/call check-ints-equal/disp32
190
191 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
192
193 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
194 5d/pop-to-EBP
195 c3/return
196
197
198 check-stream-equal:
199
200 55/push-EBP
201 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
202
203 50/push-EAX
204
205
206 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
207 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
208
209 e8/call stream-data-equal?/disp32
210
211 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
212
213
214 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
215 68/push 1/imm32
216 50/push-EAX
217
218 e8/call check-ints-equal/disp32
219
220 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
221
222 58/pop-to-EAX
223
224 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
225 5d/pop-to-EBP
226 c3/return
227
228
229
230
231
232
233 next-stream-line-equal?:
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 55/push-EBP
272 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
273
274 51/push-ECX
275 52/push-EDX
276 56/push-ESI
277 57/push-EDI
278
279 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
280
281 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
282
283 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 0xc/disp8 .
284
285 31/xor 3/mod/direct 2/rm32/EDX . . . 2/r32/EDX . .
286
287 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
288 31/xor 3/mod/direct 3/rm32/EBX . . . 3/r32/EBX . .
289 $next-stream-line-equal?:loop:
290
291 3b/compare 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
292 7d/jump-if-greater-or-equal $next-stream-line-equal?:break/disp8
293
294 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xc/disp8 .
295
296 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0xa/imm32/newline
297 74/jump-if-equal $next-stream-line-equal?:break/disp8
298
299 3b/compare 0/mod/indirect 7/rm32/EDI . . . 2/r32/EDX . .
300 7d/jump-if-greater-or-equal $next-stream-line-equal?:false/disp8
301
302 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 7/base/EDI 2/index/EDX . 3/r32/BL 4/disp8 .
303
304 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . .
305 75/jump-if-not-equal $next-stream-line-equal?:false/disp8
306
307 41/increment-ECX
308
309 42/increment-EDX
310 eb/jump $next-stream-line-equal?:loop/disp8
311 $next-stream-line-equal?:break:
312
313 41/increment-ECX
314
315 3b/compare 0/mod/indirect 7/rm32/EDI . . . 2/r32/EDX . .
316 7c/jump-if-lesser $next-stream-line-equal?:false/disp8
317 $next-stream-line-equal?:true:
318 b8/copy-to-EAX 1/imm32
319
320 89/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
321 eb/jump $next-stream-line-equal?:end/disp8
322 $next-stream-line-equal?:false:
323 b8/copy-to-EAX 0/imm32
324 $next-stream-line-equal?:end:
325
326 5f/pop-to-EDI
327 5e/pop-to-ESI
328 5a/pop-to-EDX
329 59/pop-to-ECX
330
331 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
332 5d/pop-to-EBP
333 c3/return
334
335 test-next-stream-line-equal-stops-at-newline:
336
337 55/push-EBP
338 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
339
340
341 68/push _test-stream/imm32
342
343 e8/call clear-stream/disp32
344
345 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
346
347
348
349 68/push "Abc"/imm32
350 68/push _test-stream/imm32
351
352 e8/call write/disp32
353
354 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
355
356
357 68/push Newline/imm32
358 68/push _test-stream/imm32
359
360 e8/call write/disp32
361
362 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
363
364
365 68/push "def"/imm32
366 68/push _test-stream/imm32
367
368 e8/call write/disp32
369
370 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
371
372
373 68/push "Abc"/imm32
374 68/push _test-stream/imm32
375
376 e8/call next-stream-line-equal?/disp32
377
378 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
379
380
381 68/push "F - test-next-stream-line-equal-stops-at-newline"/imm32
382 68/push 1/imm32
383 50/push-EAX
384
385 e8/call check-ints-equal/disp32
386
387 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
388
389 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
390 5d/pop-to-EBP
391 c3/return
392
393 test-next-stream-line-equal-stops-at-newline-2:
394
395 55/push-EBP
396 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
397
398
399 68/push _test-stream/imm32
400
401 e8/call clear-stream/disp32
402
403 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
404
405
406
407 68/push "Abc"/imm32
408 68/push _test-stream/imm32
409
410 e8/call write/disp32
411
412 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
413
414
415 68/push Newline/imm32
416 68/push _test-stream/imm32
417
418 e8/call write/disp32
419
420 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
421
422
423 68/push "def"/imm32
424 68/push _test-stream/imm32
425
426 e8/call write/disp32
427
428 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
429
430
431 68/push "def"/imm32
432 68/push _test-stream/imm32
433
434 e8/call next-stream-line-equal?/disp32
435
436 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
437
438
439 68/push "F - test-next-stream-line-equal-stops-at-newline-2"/imm32
440 68/push 0/imm32
441 50/push-EAX
442
443 e8/call check-ints-equal/disp32
444
445 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
446
447 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
448 5d/pop-to-EBP
449 c3/return
450
451 test-next-stream-line-equal-skips-newline:
452
453 55/push-EBP
454 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
455
456
457 68/push _test-stream/imm32
458
459 e8/call clear-stream/disp32
460
461 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
462
463
464
465 68/push "Abc"/imm32
466 68/push _test-stream/imm32
467
468 e8/call write/disp32
469
470 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
471
472
473 68/push Newline/imm32
474 68/push _test-stream/imm32
475
476 e8/call write/disp32
477
478 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
479
480
481 68/push "def"/imm32
482 68/push _test-stream/imm32
483
484 e8/call write/disp32
485
486 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
487
488
489 68/push Newline/imm32
490 68/push _test-stream/imm32
491
492 e8/call write/disp32
493
494 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
495
496
497 68/push "Abc"/imm32
498 68/push _test-stream/imm32
499
500 e8/call next-stream-line-equal?/disp32
501
502 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
503
504
505 68/push "def"/imm32
506 68/push _test-stream/imm32
507
508 e8/call next-stream-line-equal?/disp32
509
510 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
511
512
513 68/push "F - test-next-stream-line-equal-skips-newline"/imm32
514 68/push 1/imm32
515 50/push-EAX
516
517 e8/call check-ints-equal/disp32
518
519 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
520
521 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
522 5d/pop-to-EBP
523 c3/return
524
525 test-next-stream-line-equal-handles-final-line:
526
527 55/push-EBP
528 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
529
530
531 68/push _test-stream/imm32
532
533 e8/call clear-stream/disp32
534
535 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
536
537
538
539 68/push "Abc"/imm32
540 68/push _test-stream/imm32
541
542 e8/call write/disp32
543
544 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
545
546
547 68/push Newline/imm32
548 68/push _test-stream/imm32
549
550 e8/call write/disp32
551
552 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
553
554
555 68/push "def"/imm32
556 68/push _test-stream/imm32
557
558 e8/call write/disp32
559
560 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
561
562
563 68/push "Abc"/imm32
564 68/push _test-stream/imm32
565
566 e8/call next-stream-line-equal?/disp32
567
568 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
569
570
571 68/push "def"/imm32
572 68/push _test-stream/imm32
573
574 e8/call next-stream-line-equal?/disp32
575
576 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
577
578
579 68/push "F - test-next-stream-line-equal-skips-newline"/imm32
580 68/push 1/imm32
581 50/push-EAX
582
583 e8/call check-ints-equal/disp32
584
585 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
586
587 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
588 5d/pop-to-EBP
589 c3/return
590
591 test-next-stream-line-equal-always-fails-after-eof:
592
593 55/push-EBP
594 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
595
596
597 68/push _test-stream/imm32
598
599 e8/call clear-stream/disp32
600
601 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
602
603
604
605 68/push ""/imm32
606 68/push _test-stream/imm32
607
608 e8/call next-stream-line-equal?/disp32
609
610 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
611
612
613 68/push "F - test-next-stream-line-equal-always-fails-after-eof"/imm32
614 68/push 1/imm32
615 50/push-EAX
616
617 e8/call check-ints-equal/disp32
618
619 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
620
621
622 68/push ""/imm32
623 68/push _test-stream/imm32
624
625 e8/call next-stream-line-equal?/disp32
626
627 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
628
629
630 68/push "F - test-next-stream-line-equal-always-fails-after-eof/2"/imm32
631 68/push 1/imm32
632 50/push-EAX
633
634 e8/call check-ints-equal/disp32
635
636 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
637
638 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
639 5d/pop-to-EBP
640 c3/return
641
642
643 check-next-stream-line-equal:
644
645 55/push-EBP
646 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
647
648 50/push-EAX
649
650
651 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
652 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
653
654 e8/call next-stream-line-equal?/disp32
655
656 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
657
658
659 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
660 68/push 1/imm32
661 50/push-EAX
662
663 e8/call check-ints-equal/disp32
664
665 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
666
667 58/pop-to-EAX
668
669 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
670 5d/pop-to-EBP
671 c3/return