summaryrefslogtreecommitdiff
path: root/vaporize/tests/Factorial.opt.names.vaporm
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-14 02:36:20 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-14 02:36:20 -0600
commitbd59acec960bf9e2ad93f0d1caa11a65613ee168 (patch)
tree3ef38b63578eaaea2b8b8e929d00195e57ab8834 /vaporize/tests/Factorial.opt.names.vaporm
parentee60d3f9a32f75c628961f40a9bf4f1bf387ac06 (diff)
Add HW4 Test Files
Diffstat (limited to 'vaporize/tests/Factorial.opt.names.vaporm')
-rw-r--r--vaporize/tests/Factorial.opt.names.vaporm30
1 files changed, 30 insertions, 0 deletions
diff --git a/vaporize/tests/Factorial.opt.names.vaporm b/vaporize/tests/Factorial.opt.names.vaporm
new file mode 100644
index 0000000..bbc6604
--- /dev/null
+++ b/vaporize/tests/Factorial.opt.names.vaporm
@@ -0,0 +1,30 @@
+const empty_Fac
+
+func Main [in 0, out 0, local 0]
+ $a0 = :empty_Fac
+ $a1 = 10
+ call :Fac.ComputeFac
+ $t0{t.0} = $v0
+ PrintIntS($t0{t.0})
+ ret
+
+func Fac.ComputeFac [in 0, out 0, local 1]
+ local[0] = $s0
+ $t0{this} = $a0
+ $s0{num} = $a1
+ $t1{t.0} = LtS($s0{num} 1)
+ if0 $t1{t.0} goto :if1_else
+ $t1{num_aux} = 1
+ goto :if1_end
+if1_else:
+ $t2{t.1} = Sub($s0{num} 1)
+ $a0 = $t0{this}
+ $a1 = $t2{t.1}
+ call :Fac.ComputeFac
+ $t2{t.2} = $v0
+ $t1{num_aux} = MulS($s0{num} $t2{t.2})
+if1_end:
+ $v0 = $t1{num_aux}
+ $s0 = local[0]
+ ret
+