https://github.com/akkartik/mu/blob/master/apps/mu.subx
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 == data
155
156
157 Program:
158 0/imm32
159
160
161
162
163
164
165
166 Function-next:
167 0x10/imm32
168 Function-size:
169 0x14/imm32/20
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 == code
213
214 Entry:
215
216 89/<- %ebp 4/r32/esp
217 (new-segment Heap-size Heap)
218
219 {
220
221 81 7/subop/compare *ebp 1/imm32
222 7e/jump-if-lesser-or-equal break/disp8
223
224 (kernel-string-equal? *(ebp+8) "test")
225 3d/compare-eax-and 0/imm32
226 74/jump-if-equal break/disp8
227
228 (run-tests)
229
230 8b/-> *Num-test-failures 3/r32/ebx
231 eb/jump $mu-main:end/disp8
232 }
233
234 (convert-mu Stdin Stdout)
235 (flush Stdout)
236
237 bb/copy-to-ebx 0/imm32
238 $mu-main:end:
239 b8/copy-to-eax 1/imm32/exit
240 cd/syscall 0x80/imm8
241
242 convert-mu:
243
244 55/push-ebp
245 89/<- %ebp 4/r32/esp
246
247 (parse-mu *(ebp+8))
248 (check-mu-types)
249 (emit-subx *(ebp+0xc))
250 $convert-mu:end:
251
252 89/<- %esp 5/r32/ebp
253 5d/pop-to-ebp
254 c3/return
255
256 test-convert-empty-input:
257
258
259 55/push-ebp
260 89/<- %ebp 4/r32/esp
261
262 (clear-stream _test-input-stream)
263 (clear-stream _test-input-buffered-file->buffer)
264 (clear-stream _test-output-stream)
265 (clear-stream _test-output-buffered-file->buffer)
266
267 (convert-mu _test-input-buffered-file _test-output-buffered-file)
268 (flush _test-output-buffered-file)
269 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input")
270
271 89/<- %esp 5/r32/ebp
272 5d/pop-to-ebp
273 c3/return
274
275 test-convert-function-skeleton:
276
277
278
279
280
281
282
283
284
285
286
287
288
289 55/push-ebp
290 89/<- %ebp 4/r32/esp
291
292 (clear-stream _test-input-stream)
293 (clear-stream _test-input-buffered-file->buffer)
294 (clear-stream _test-output-stream)
295 (clear-stream _test-output-buffered-file->buffer)
296
297 (write _test-input-stream "fn foo {\n")
298 (write _test-input-stream "}\n")
299
300 (convert-mu _test-input-buffered-file _test-output-buffered-file)
301 (flush _test-output-buffered-file)
302 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
308
309 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0")
310 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-skeleton/1")
311 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-skeleton/2")
312 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3")
313 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-skeleton/4")
314 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5")
315 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-skeleton/6")
316 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-skeleton/7")
317
318 89/<- %esp 5/r32/ebp
319 5d/pop-to-ebp
320 c3/return
321
322 test-convert-multiple-function-skeletons:
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346 55/push-ebp
347 89/<- %ebp 4/r32/esp
348
349 (clear-stream _test-input-stream)
350 (clear-stream _test-input-buffered-file->buffer)
351 (clear-stream _test-output-stream)
352 (clear-stream _test-output-buffered-file->buffer)
353
354 (write _test-input-stream "fn foo {\n")
355 (write _test-input-stream "}\n")
356 (write _test-input-stream "fn bar {\n")
357 (write _test-input-stream "}\n")
358
359 (convert-mu _test-input-buffered-file _test-output-buffered-file)
360 (flush _test-output-buffered-file)
361 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
367
368 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0")
369 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-multiple-function-skeletons/1")
370 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-multiple-function-skeletons/2")
371 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3")
372 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-multiple-function-skeletons/4")
373 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5")
374 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6")
375 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-multiple-function-skeletons/7")
376
377 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10")
378 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-multiple-function-skeletons/11")
379 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-multiple-function-skeletons/12")
380 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13")
381 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-multiple-function-skeletons/14")
382 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15")
383 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16")
384 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-multiple-function-skeletons/17")
385
386 89/<- %esp 5/r32/ebp
387 5d/pop-to-ebp
388 c3/return
389
390 test-convert-function-with-arg:
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409 55/push-ebp
410 89/<- %ebp 4/r32/esp
411
412 (clear-stream _test-input-stream)
413 (clear-stream _test-input-buffered-file->buffer)
414 (clear-stream _test-output-stream)
415 (clear-stream _test-output-buffered-file->buffer)
416
417 (write _test-input-stream "fn foo {\n")
418 (write _test-input-stream "}\n")
419
420 (convert-mu _test-input-buffered-file _test-output-buffered-file)
421 (flush _test-output-buffered-file)
422 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
428
429 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0")
430 (check-next-stream-line-equal _test-output-stream "# . prologue" "F - test-convert-function-skeleton/1")
431 (check-next-stream-line-equal _test-output-stream "55/push-ebp" "F - test-convert-function-skeleton/2")
432 (check-next-stream-line-equal _test-output-stream "89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3")
433 (check-next-stream-line-equal _test-output-stream "# . epilogue" "F - test-convert-function-skeleton/4")
434 (check-next-stream-line-equal _test-output-stream "89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5")
435 (check-next-stream-line-equal _test-output-stream "5d/pop-to-ebp" "F - test-convert-function-skeleton/6")
436 (check-next-stream-line-equal _test-output-stream "c3/return" "F - test-convert-function-skeleton/7")
437
438 89/<- %esp 5/r32/ebp
439 5d/pop-to-ebp
440 c3/return
441
442 parse-mu:
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466 55/push-ebp
467 89/<- %ebp 4/r32/esp
468
469 50/push-eax
470 51/push-ecx
471 52/push-edx
472 57/push-edi
473
474 81 5/subop/subtract %esp 0x200/imm32
475 68/push 0x200/imm32/length
476 68/push 0/imm32/read
477 68/push 0/imm32/write
478 89/<- %ecx 4/r32/esp
479
480 68/push 0/imm32/end
481 68/push 0/imm32/start
482 89/<- %edx 4/r32/esp
483
484 bf/copy-to-edi Program/imm32
485 {
486 $parse-mu:line-loop:
487 (clear-stream %ecx)
488 (read-line-buffered *(ebp+8) %ecx)
489
490 81 7/subop/compare *ecx 0/imm32
491 0f 84/jump-if-equal break/disp32
492 +-- 6 lines: #? # dump line ---------------------------------------------------------------------------------------------------------------------------
498 {
499 $parse-mu:word-loop:
500 (next-word-or-string %ecx %edx)
501
502 (slice-empty? %edx)
503 3d/compare-eax-and 0/imm32
504 0f 85/jump-if-not-equal break/disp32
505
506
507 8b/-> *edx 0/r32/eax
508 8a/copy-byte *eax 0/r32/AL
509 81 4/subop/and %eax 0xff/imm32
510
511 3d/compare-eax-and 0x23/imm32/hash
512 0f 84/jump-if-equal break/disp32
513
514 {
515 (slice-equal? %edx "fn")
516 3d/compare-eax-and 0/imm32
517 0f 84/jump-if-equal break/disp32
518
519 (allocate Heap *Function-size)
520 (populate-mu-function-header %ecx %eax)
521 (populate-mu-function-body *(ebp+8) %eax)
522
523 89/<- *edi 0/r32/eax
524
525 8d/address-> *(eax+0x10) 7/r32/edi
526 e9/jump $parse-mu:word-loop/disp32
527 }
528
529 e9/jump $parse-mu:abort/disp32
530 }
531 e9/jump loop/disp32
532 }
533 $parse-mu:end:
534
535 81 0/subop/add %esp 0x214/imm32
536
537 5f/pop-to-edi
538 5a/pop-to-edx
539 59/pop-to-ecx
540 58/pop-to-eax
541
542 89/<- %esp 5/r32/ebp
543 5d/pop-to-ebp
544 c3/return
545
546 $parse-mu:abort:
547
548 (write-buffered Stderr "unexpected top-level command: ")
549 (write-buffered Stderr %edx)
550 (write-buffered Stderr "\n")
551 (flush Stderr)
552
553 bb/copy-to-ebx 1/imm32
554 b8/copy-to-eax 1/imm32/exit
555 cd/syscall 0x80/imm8
556
557
558
559
560
561
562
563 populate-mu-function-header:
564
565 55/push-ebp
566 89/<- %ebp 4/r32/esp
567
568 50/push-eax
569 51/push-ecx
570 57/push-edi
571
572 8b/-> *(ebp+0xc) 7/r32/edi
573
574 68/push 0/imm32/end
575 68/push 0/imm32/start
576 89/<- %ecx 4/r32/esp
577
578 (next-word *(ebp+8) %ecx)
579 (slice-to-string Heap %ecx)
580 89/<- *edi 0/r32/eax
581
582 (next-word *(ebp+8) %ecx)
583 (slice-equal? %ecx "{")
584 3d/compare-eax-and 0/imm32
585 74/jump-if-equal $populate-mu-function-header:abort/disp8
586
587 {
588
589 (next-word *(ebp+8) %ecx)
590
591 (slice-empty? %ecx)
592 3d/compare-eax-and 0/imm32
593 75/jump-if-not-equal break/disp8
594
595
596 8b/-> *edx 0/r32/eax
597 8a/copy-byte *eax 0/r32/AL
598 81 4/subop/and %eax 0xff/imm32
599
600 3d/compare-eax-and 0x23/imm32/hash
601 74/jump-if-equal break/disp8
602
603 eb/jump $populate-mu-function-header:abort/disp8
604 }
605 $populate-mu-function-header:end:
606
607 81 0/subop/add %esp 8/imm32
608
609 5f/pop-to-edi
610 59/pop-to-ecx
611 58/pop-to-eax
612
613 89/<- %esp 5/r32/ebp
614 5d/pop-to-ebp
615 c3/return
616
617 $populate-mu-function-header:abort:
618
619 (write-buffered Stderr "function header not in form 'fn <name> {' -- '")
620 (rewind-stream *(ebp+8))
621 (write-stream 2 *(ebp+8))
622 (write-buffered Stderr "'\n")
623 (flush Stderr)
624
625 bb/copy-to-ebx 1/imm32
626 b8/copy-to-eax 1/imm32/exit
627 cd/syscall 0x80/imm8
628
629
630
631
632 populate-mu-function-body:
633
634 55/push-ebp
635 89/<- %ebp 4/r32/esp
636
637 50/push-eax
638 51/push-ecx
639 52/push-edx
640 53/push-ebx
641
642 81 5/subop/subtract %esp 0x200/imm32
643 68/push 0x200/imm32/length
644 68/push 0/imm32/read
645 68/push 0/imm32/write
646 89/<- %ecx 4/r32/esp
647
648 68/push 0/imm32/end
649 68/push 0/imm32/start
650 89/<- %edx 4/r32/esp
651
652 bb/copy-to-ebx 1/imm32
653 {
654 $populate-mu-function-body:line-loop:
655
656 81 7/subop/compare %ebx 0/imm32
657 0f 84/jump-if-equal break/disp32
658
659 (clear-stream %ecx)
660 (read-line-buffered *(ebp+8) %ecx)
661
662 81 7/subop/compare *ecx 0/imm32
663 0f 84/jump-if-equal break/disp32
664
665 (next-word %ecx %edx)
666
667 (slice-empty? %ecx)
668 3d/compare-eax-and 0/imm32
669 75/jump-if-not-equal loop/disp8
670
671
672 8b/-> *edx 0/r32/eax
673 8a/copy-byte *eax 0/r32/AL
674 81 4/subop/and %eax 0xff/imm32
675
676 3d/compare-eax-and 0x23/imm32/hash
677 74/jump-if-equal loop/disp8
678 {
679
680 {
681 (slice-equal? %ecx "{")
682 3d/compare-eax-and 0/imm32
683 74/jump-if-equal break/disp8
684 43/increment-ebx
685 eb/jump $curly-found:end/disp8
686 }
687
688 {
689 (slice-equal? %ecx "}")
690 3d/compare-eax-and 0/imm32
691 74/jump-if-equal break/disp8
692 4b/decrement-ebx
693 eb/jump $curly-found:end/disp8
694 }
695
696 eb/jump $populate-mu-function-body:end/disp8
697 }
698
699 $curly-found:end:
700
701 (next-word %ecx %edx)
702
703 (slice-empty? %ecx)
704 3d/compare-eax-and 0/imm32
705 0f 85/jump-if-not-equal loop/disp32
706
707
708 8b/-> *edx 0/r32/eax
709 8a/copy-byte *eax 0/r32/AL
710 81 4/subop/and %eax 0xff/imm32
711
712 3d/compare-eax-and 0x23/imm32/hash
713 0f 84/jump-if-equal loop/disp32
714
715 eb/jump $populate-mu-function-body:abort/disp8
716 }
717 $populate-mu-function-body:end:
718
719 81 0/subop/add %esp 0x214/imm32
720
721 5b/pop-to-ebx
722 5a/pop-to-edx
723 59/pop-to-ecx
724 58/pop-to-eax
725
726 89/<- %esp 5/r32/ebp
727 5d/pop-to-ebp
728 c3/return
729
730 $populate-mu-function-body:abort:
731
732 (write-buffered Stderr "'{' or '}' should be on its own line, but got '")
733 (rewind-stream %ecx)
734 (write-stream 2 %ecx)
735 (write-buffered Stderr "'\n")
736 (flush Stderr)
737
738 bb/copy-to-ebx 1/imm32
739 b8/copy-to-eax 1/imm32/exit
740 cd/syscall 0x80/imm8
741
742
743 check-mu-types:
744
745 55/push-ebp
746 89/<- %ebp 4/r32/esp
747
748 $check-types:end:
749
750 89/<- %esp 5/r32/ebp
751 5d/pop-to-ebp
752 c3/return
753
754 emit-subx:
755
756 55/push-ebp
757 89/<- %ebp 4/r32/esp
758
759 50/push-eax
760 51/push-ecx
761 57/push-edi
762
763 8b/-> *(ebp+8) 7/r32/edi
764
765 8b/-> *Program 1/r32/ecx
766 {
767
768 81 7/subop/compare %ecx 0/imm32
769 0f 84/jump-if-equal break/disp32
770 (emit-subx-function %edi %ecx)
771
772 8b/-> *(ecx+0x10) 1/r32/ecx
773 e9/jump loop/disp32
774 }
775 $emit-subx:end:
776
777 5f/pop-to-edi
778 59/pop-to-ecx
779 58/pop-to-eax
780
781 89/<- %esp 5/r32/ebp
782 5d/pop-to-ebp
783 c3/return
784
785
786
787
788
789
790
791 emit-subx-function:
792
793 55/push-ebp
794 89/<- %ebp 4/r32/esp
795
796 50/push-eax
797 51/push-ecx
798 57/push-edi
799
800 8b/-> *(ebp+8) 7/r32/edi
801
802 8b/-> *(ebp+0xc) 1/r32/ecx
803
804 (write-buffered %edi *ecx)
805 (write-buffered %edi ":\n")
806 (emit-subx-prologue %edi)
807 (emit-subx-block %edi *(ecx+4))
808 (emit-subx-epilogue %edi)
809 $emit-subx-function:end:
810
811 5f/pop-to-edi
812 59/pop-to-ecx
813 58/pop-to-eax
814
815 89/<- %esp 5/r32/ebp
816 5d/pop-to-ebp
817 c3/return
818
819 emit-subx-block:
820
821 55/push-ebp
822 89/<- %ebp 4/r32/esp
823
824 $emit-subx-block:end:
825
826 89/<- %esp 5/r32/ebp
827 5d/pop-to-ebp
828 c3/return
829
830 emit-subx-statement:
831
832 55/push-ebp
833 89/<- %ebp 4/r32/esp
834
835 50/push-eax
836 51/push-ecx
837
838 8b/-> *(ebp+0x18) 1/r32/ecx
839 {
840
841 81 7/subop/compare *(ebp+0xc) 0/imm32
842 0f 84/jump-if-equal $emit-subx-statement:abort/disp32
843
844 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx)
845 3d/compare-eax-and 0/imm32
846 75/jump-if-not-equal break/disp8
847
848
849 8b/-> *(ecx+0x10) 1/r32/ecx
850 e9/jump loop/disp32
851 }
852 $emit-subx-statement:end:
853
854 59/pop-to-ecx
855 58/pop-to-eax
856
857 89/<- %esp 5/r32/ebp
858 5d/pop-to-ebp
859 c3/return
860
861 $emit-subx-statement:abort:
862
863 (write-buffered Stderr "couldn't translate '")
864
865 (write-buffered Stderr "'\n")
866 (flush Stderr)
867
868 bb/copy-to-ebx 1/imm32
869 b8/copy-to-eax 1/imm32/exit
870 cd/syscall 0x80/imm8
871
872
873 mu-stmt-matches-primitive?:
874
875 55/push-ebp
876 89/<- %ebp 4/r32/esp
877
878 51/push-ecx
879
880 8b/-> *(ebp+8) 1/r32/ecx
881 8b/-> *(ebp+0xc) 0/r32/eax
882 (string-equal? *ecx *eax)
883 $mu-stmt-matches-primitive?:end:
884
885 59/pop-to-ecx
886
887 89/<- %esp 5/r32/ebp
888 5d/pop-to-ebp
889 c3/return
890
891 test-emit-subx-statement-primitive:
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914 55/push-ebp
915 89/<- %ebp 4/r32/esp
916
917 (clear-stream _test-output-stream)
918 (clear-stream _test-output-buffered-file->buffer)
919
920 68/push 0/imm32/next
921 68/push -8/imm32/stack-offset
922 68/push 0/imm32/int
923 68/push "foo"/imm32
924 89/<- %ecx 4/r32/esp
925
926 68/push 0/imm32/next
927 51/push-ecx/var-foo
928 89/<- %edx 4/r32/esp
929
930 68/push 0/imm32/next
931 68/push 0/imm32/outputs
932 52/push-edx/operand
933 68/push "increment"/imm32/operation
934 89/<- %edx 4/r32/esp
935
936 68/push 0/imm32/next
937 68/push "ff 0/subop/increment"/imm32
938 68/push 0/imm32/type-int
939 68/push 0/imm32/storage-memory
940 68/push "increment"/imm32/name
941 89/<- %ebx 4/r32/esp
942
943 (emit-subx-statement _test-output-buffered-file %edx %ecx 0 %ebx 0)
944 (flush _test-output-buffered-file)
945 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
951
952 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp-8)" "F - test-emit-subx-statement-primitive/0")
953
954 81 0/subop/add %esp 0x3c/imm32
955
956 89/<- %esp 5/r32/ebp
957 5d/pop-to-ebp
958 c3/return
959
960 test-emit-subx-statement-function-call:
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984 55/push-ebp
985 89/<- %ebp 4/r32/esp
986
987 (clear-stream _test-output-stream)
988 (clear-stream _test-output-buffered-file->buffer)
989
990 68/push 0/imm32/next
991 68/push -8/imm32/stack-offset
992 68/push 0/imm32/int
993 68/push "var"/imm32
994 89/<- %ecx 4/r32/esp
995
996 68/push 0/imm32/next
997 51/push-ecx/var
998 89/<- %edx 4/r32/esp
999
1000 68/push 0/imm32/next
1001 68/push 0/imm32/outputs
1002 52/push-edx/operand
1003 68/push "f"/imm32/operation
1004 89/<- %edx 4/r32/esp
1005
1006 68/push 0/imm32/next
1007 68/push "f2"/imm32
1008 68/push 0/imm32/type-int
1009 68/push 0/imm32/storage-memory
1010 68/push "f"/imm32/name
1011 89/<- %ebx 4/r32/esp
1012
1013 (emit-subx-statement _test-output-buffered-file %edx %ecx 0 0 %ebx)
1014 (flush _test-output-buffered-file)
1015 +-- 6 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
1021
1022 (check-next-stream-line-equal _test-output-stream "f2 *(ebp-8)" "F - test-emit-subx-statement-function-call/0")
1023
1024 81 0/subop/add %esp 0x3c/imm32
1025
1026 89/<- %esp 5/r32/ebp
1027 5d/pop-to-ebp
1028 c3/return
1029
1030 emit-subx-prologue:
1031
1032 55/push-ebp
1033 89/<- %ebp 4/r32/esp
1034
1035 (write-buffered *(ebp+8) "# . prologue\n")
1036 (write-buffered *(ebp+8) "55/push-ebp\n")
1037 (write-buffered *(ebp+8) "89/<- %ebp 4/r32/esp\n")
1038 $emit-subx-prologue:end:
1039
1040 89/<- %esp 5/r32/ebp
1041 5d/pop-to-ebp
1042 c3/return
1043
1044 emit-subx-epilogue:
1045
1046 55/push-ebp
1047 89/<- %ebp 4/r32/esp
1048
1049 (write-buffered *(ebp+8) "# . epilogue\n")
1050 (write-buffered *(ebp+8) "89/<- %esp 5/r32/ebp\n")
1051 (write-buffered *(ebp+8) "5d/pop-to-ebp\n")
1052 (write-buffered *(ebp+8) "c3/return\n")
1053 $emit-subx-epilogue:end:
1054
1055 89/<- %esp 5/r32/ebp
1056 5d/pop-to-ebp
1057 c3/return