vextoly/cryn

[# strings are byte arrays: print text, measure length, reverse #]
make string "interrupt" word
make string "\n" nl

define newline result nothing
  address nl
  output text
  set nothing
  return
end

define main
  address word
  output text
  call newline

  make int64 n
  set 0
  move n
  write

  mark count
  move n
  read
  move word
  move index
  read
  compare 0
  jump counted when equal
  move n
  read
  add 1
  move n
  write
  set 0
  jump count
  mark counted

  move n
  read
  output
  call newline

  make int64 k
  move n
  read
  subtract 1
  move k
  write
  set 0

  mark reverse
  move k
  read
  compare 0
  jump done when less
  move k
  read
  move word
  move index
  read
  output
  move k
  read
  subtract 1
  move k
  write
  set 0
  jump reverse
  mark done
  call newline
  return
end