(module rc_own_param_partial_drop_leak
  (data Wrap
    (ctor MkWrap (con Int)))
  (data Cell
    (ctor MkCell (con Wrap) (con Wrap)))
  (data Pair
    (ctor MkPair (con Cell) (con Cell)))
  (fn build_pair
    (type (fn-type (params (own (con Int))) (ret (own (con Pair)))))
    (params n)
    (body (term-ctor Pair MkPair (term-ctor Cell MkCell (term-ctor Wrap MkWrap n) (term-ctor Wrap MkWrap 2)) (term-ctor Cell MkCell (term-ctor Wrap MkWrap 3) (term-ctor Wrap MkWrap 4)))))
  (fn use_first
    (suppress (code "over-strict-mode") (because "RC codegen test: exercises Iter B fn-return dynamic-tag partial-drop"))
    (type (fn-type (params (own (con Pair))) (ret (own (con Int)))))
    (params p)
    (body (match p
      (case (pat-ctor MkPair a _) 1))))
  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body (app print (app use_first (app build_pair 1))))))
