summaryrefslogtreecommitdiff
path: root/base/Factorial.opt.vapor
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-26 15:50:38 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-26 15:50:38 -0600
commit1851f5e76018ec1df3b55dce6cc9a64c9497bf7a (patch)
tree30f629f7b137a494d4202487f4e22df2d9456481 /base/Factorial.opt.vapor
parent012298517078170762112abe2654dc69b2f146e1 (diff)
Rearrange directory structure
Diffstat (limited to 'base/Factorial.opt.vapor')
-rw-r--r--base/Factorial.opt.vapor20
1 files changed, 20 insertions, 0 deletions
diff --git a/base/Factorial.opt.vapor b/base/Factorial.opt.vapor
new file mode 100644
index 0000000..aca17fe
--- /dev/null
+++ b/base/Factorial.opt.vapor
@@ -0,0 +1,20 @@
+
+const empty_Fac
+
+
+func Main()
+ t.0 = call :Fac.ComputeFac(:empty_Fac 10)
+ PrintIntS(t.0)
+ ret
+
+func Fac.ComputeFac(this num)
+ t.0 = LtS(num 1)
+ if0 t.0 goto :if1_else
+ num_aux = 1
+ goto :if1_end
+ if1_else:
+ t.1 = Sub(num 1)
+ t.2 = call :Fac.ComputeFac(this t.1)
+ num_aux = MulS(num t.2)
+ if1_end:
+ ret num_aux