;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; We implement this python program: ;; ;; def fact(n): ;; result = 1 ;; i = 1 ;; while i <= n: ;; result = result * i ;; return result ;; ;; n = input() ;; print(fact(n)) ;; ;; Author: The MCS-178 gang. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; allocate-registers n cont result fact one i test start read n li cont after-callL li fact factL j fact after-callL: write result halt ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Compute the factorial of n ;; ;; input register: n ;; ;; cont register: cont ;; ;; output register: result ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; factL: li result 1 li i 1 li one 1 li start startL startL: sle test i n jeqz test cont mul result result i add i one i j start