1 # Unnecessarily use an array to sum 1..10 2 # 3 # To run: 4 # $ ./translate_mu apps/ex3.2.mu 5 # $ ./a.elf 6 # $ echo $? 7 # 55 8 9 fn main -> result/ebx: int { 10 # populate a 11 var a: (array int 0xb) # 11; we waste index 0 12 var i/ecx: int <- copy 1 13 { 14 compare i, 0xb 15 break-if->= 16 var x/eax: (addr int) <- index a, i 17 copy-to *x, i 18 i <- increment 19 loop 20 } 21 # sum 22 result <- copy 0 23 i <- copy 1 24 { 25 compare i, 0xb 26 break-if->= 27 var x/eax: (addr int) <- index a, i 28 result <- add *x 29 i <- increment 30 loop 31 } 32 }