https://github.com/akkartik/mu/blob/master/apps/ex3.subx
 1 # Add the first 10 numbers, and return the result in the exit code.
 2 #
 3 # To run:
 4 #   $ ./subx translate init.linux examples/ex3.subx -o examples/ex3
 5 #   $ ./subx run examples/ex3
 6 # Expected result:
 7 #   $ echo $?
 8 #   55
 9 
10 == code
11 #   instruction                     effective address                                                   register    displacement    immediate
12 # . op          subop               mod             rm32          base        index         scale       r32
13 # . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
14 
15 Entry:
16     # result: ebx = 0
17     bb/copy-to-ebx  0/imm32
18     # counter: ecx = 1
19     b9/copy-to-ecx  1/imm32
20 
21 $loop:
22     # if (counter > 10) break
23     81          7/subop/compare     3/mod/direct    1/rm32/ecx    .           .             .           .           .               0xa/imm32         # compare ecx
24     7f/jump-if->  $exit/disp8
25     # result += counter
26     01/add                          3/mod/direct    3/rm32/ebx    .           .             .           1/r32/ecx   .               .                 # add ecx to ebx
27     # ++counter
28     41/increment-ecx
29     # loop
30     eb/jump  $loop/disp8
31 
32 $exit:
33     # exit(ebx)
34     e8/call  syscall_exit/disp32
35 
36 # . . vim:nowrap:textwidth=0