https://github.com/akkartik/mu/blob/main/linux/mu-init-test.subx
 1 # Just a test stub for mu-init.subx
 2 #
 3 # Try it out like this:
 4 #   $ ./translate_subx init.linux [0-9]*.subx mu-init.subx mu-init-test.subx
 5 #   $ ./a.elf  # should run all tests
 6 
 7 main:  # args: (addr array (addr array byte)) -> result/ebx: int
 8     # . prologue
 9     55/push-ebp
10     89/<- %ebp 4/r32/esp
11     # . save registers
12     50/push-eax
13     56/push-esi
14     # esi = args
15     8b/-> *(ebp+8) 6/r32/esi
16     {
17       # if (argc <= 1) break
18       81 7/subop/compare *esi 4/imm32
19       7e/jump-if-<= break/disp8
20       # if (argv[1] != "test") break
21       (string-equal? *(esi+8) "test")  # => eax
22       3d/compare-eax-and 0/imm32
23       74/jump-if-= break/disp8
24       #
25       (run-tests)
26       # return *Num-test-failures
27       8b/-> *Num-test-failures 3/r32/ebx
28       eb/jump $main:end/disp8
29     }
30 $main:end:
31     # . restore registers
32     5e/pop-to-esi
33     58/pop-to-eax
34     # . epilogue
35     89/<- %esp 5/r32/ebp
36     5d/pop-to-ebp
37     c3/return