; NEGATIVE FIXTURE. The LLM-natural mistake: the author treats
; `recur` like a value-returning recursive call and multiplies its
; result, computing factorial as `n * recur(n-1)`. recur is an
; argument to *, not in tail position.
; Expected: `ail check` exits 1 with code recur-not-in-tail-position.
(module loop_recur_3d_recur_not_tail
  (fn factorial
    (type (fn-type (params (own (con Int))) (ret (own (con Int)))))
    (params n)
    (body
      (loop (i (con Int) n)
        (if (app eq i 1)
            1
            (app * i (recur (app - i 1)))))))
  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body (app print (app factorial 5)))))
