about summary refs log tree commit diff stats
path: root/apps/factorial4.subx
diff options
context:
space:
mode:
Diffstat (limited to 'apps/factorial4.subx')
-rw-r--r--apps/factorial4.subx12
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/factorial4.subx b/apps/factorial4.subx
index 9ab7038f..3aae0dd3 100644
--- a/apps/factorial4.subx
+++ b/apps/factorial4.subx
@@ -60,7 +60,7 @@ factorial:  # n: int -> int/eax
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # save registers
-    53/push-ebx
+    51/push-ecx
     # if (n <= 1) return 1
     81 7/subop/compare *(ebp+8) 1/imm32
     {
@@ -70,14 +70,14 @@ factorial:  # n: int -> int/eax
     # if (n > 1) return n * factorial(n-1)
     {
       7e/jump-if-<= break/disp8
-      # var ebx: int = n-1
-      8b/-> *(ebp+8) 3/r32/ebx
-      4b/decrement-ebx
-      (factorial %ebx)  # => eax
+      # var tmp/ecx: int = n-1
+      8b/-> *(ebp+8) 1/r32/ecx
+      49/decrement-ecx
+      (factorial %ecx)  # => eax
       f7 4/subop/multiply-into-eax *(ebp+8)
     }
     # restore registers
-    5b/pop-to-ebx
+    59/pop-to-ecx
     # . epilogue
     89/<- %esp 5/r32/ebp
     5d/pop-to-ebp