(module embed_backtest_step

  (fn step
    (export "backtest_step")
    (type
      (fn-type
        (params (own (con Int)) (own (con Int)))
        (ret (own (con Int)))))
    (params state sample)
    (body
      (app + state (app * sample sample))))

  (fn helper
    (type
      (fn-type
        (params (own (con Int)))
        (ret (own (con Int)))))
    (params x)
    (body
      (app * x x))))
