vextoly/cryn

[# recursion: factorial(10) and fib(20) #]
define fact int64 n result int64
  move n
  read
  compare 1
  jump base when less-or-equal
  move n
  read
  push
  move n
  read
  subtract 1
  push
  call fact
  multiply
  return
  mark base
  set 1
  return
end

define fib int64 n result int64
  move n
  read
  compare 2
  jump base when less
  move n
  read
  subtract 1
  push
  call fib
  push
  move n
  read
  subtract 2
  push
  call fib
  add
  return
  mark base
  set 1
  return
end

define main
  set 10
  push
  call fact
  output

  set 20
  push
  call fib
  output
  return
end