EDITOR
1 2 3 4 5 6 7 8 9 10 11 12
fun factorial (i32) i32 { R1 = R0 // ACC = argument 0 R0 = 1 // RES brz R1 end // if n==0 goto end b1: // <- [b0] b1 R0 = R1 * R0 // RES = ACC * RES R1 = R1 - 1 // ACC = ACC - 1 brnz R1 b1 // if n!=0 goto b1 end: // <- b0 [b1] ret // RES is at R0 }
LOG
Run
Input R
Output R