diff --git a/library/init/control/estate.lean b/library/init/control/estate.lean index d8d8f8b06f..bdb68fa4ea 100644 --- a/library/init/control/estate.lean +++ b/library/init/control/estate.lean @@ -52,6 +52,11 @@ namespace estate variables {ε σ α β : Type u} +instance [inhabited ε] : inhabited (estate ε σ α) := +⟨λ r, match r with + | ⟨result.ok _ s, _⟩ := result.error (default ε) s + | ⟨result.error _ _, h⟩ := unreachable_error h⟩ + @[inline] protected def pure (a : α) : estate ε σ α := λ r, match r with | ⟨result.ok _ s, _⟩ := result.ok a s @@ -97,9 +102,9 @@ variables {ε σ α β : Type u} | ok := ok) | ok := ok -@[inline] def adapt_except {ε' : Type u} [has_lift_t ε' ε] (f : ε → ε') (x : estate ε σ α) : estate ε' σ α := +@[inline] def adapt_except {ε' : Type u} [has_lift ε ε'] (x : estate ε σ α) : estate ε' σ α := λ r, match x r with - | result.error e s := result.error (f e) s + | result.error e s := result.error (lift e) s | result.ok a s := result.ok a s @[inline] protected def bind (x : estate ε σ α) (f : α → estate ε σ β) : estate ε σ β := diff --git a/library/init/io.lean b/library/init/io.lean index 1a0311057d..7ec3266ae3 100644 --- a/library/init/io.lean +++ b/library/init/io.lean @@ -4,59 +4,51 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Luke Nelson, Jared Roesch, Leonardo de Moura, Sebastian Ullrich -/ prelude -import init.control.state init.control.except init.data.string.basic init.fix +import init.control.estate init.data.string.basic init.fix /-- Like https://hackage.haskell.org/package/ghc-prim-0.5.2.0/docs/GHC-Prim.html#t:RealWorld. Makes sure we never reorder `io` operations. -/ constant io.real_world : Type := unit --- TODO: make opaque -@[irreducible, derive monad] -def io : Type → Type := state io.real_world +@[derive monad] +def eio (ε : Type) : Type → Type := estate ε io.real_world + +instance {ε : Type} {α : Type} [inhabited ε] : inhabited (eio ε α) := +infer_instance_as (inhabited (estate ε io.real_world α)) + +/- +In the future, we may want to give more concrete data +like in https://doc.rust-lang.org/std/io/enum.ErrorKind.html +-/ +@[derive has_to_string inhabited] +def io.error := string + +abbrev io : Type → Type := eio io.error @[extern "lean_io_unsafe"] -constant unsafe_io {α : Type} [inhabited α] (fn : io α) : α := default α +constant unsafe_io {α : Type} (fn : io α) : option α := default (option α) @[extern 4 "lean_io_timeit"] -constant timeit {α : Type} (msg : @& string) (fn : io α) : io α := fn +constant timeit {α : Type} (msg : @& string) (fn : io α) : io α := default (io α) @[extern 4 "lean_io_allocprof"] -constant allocprof {α : Type} (msg : @& string) (fn : io α) : io α := fn +constant allocprof {α : Type} (msg : @& string) (fn : io α) : io α := default (io α) abbrev monad_io (m : Type → Type) := has_monad_lift_t io m --- TODO: make opaque --- In the future, we may want to give more concrete data --- like in https://doc.rust-lang.org/std/io/enum.ErrorKind.html -@[irreducible, derive has_to_string] -def io.error := string - -section -local attribute [reducible] io.error -instance : inhabited io.error := -⟨""⟩ -end - --- The `io` primitives can also be used with [monad_except string m] --- via this error conversion +/- The `io` primitives can also be used with [monad_except string m] + via this error conversion -/ instance : has_lift io.error string := ⟨to_string⟩ -/-- 'io with errors'. A useful default monad stack to use for operations - in the `io` namespace if there is no need for additional layers or - a more specific error type than `io.error`. -/ -abbrev eio := except_t io.error io - namespace io -section -local attribute [reducible] io def lazy_pure {α : Type} (fn : unit → α) : io α := -λ w, (fn (), w) -end +pure (fn ()) inductive fs.mode | read | write | read_write | append + constant fs.handle : Type := unit namespace prim @@ -69,59 +61,39 @@ def iterate_aux {α β : Type} (f : α → io (sum α β)) : (α → io β) → | sum.inl a := rec a | sum.inr b := pure b -instance io_inhabited {β : Type} [inhabited β] : inhabited (io β) := -⟨pure (default β)⟩ - @[specialize] def iterate {α β : Type} [inhabited β] (a : α) (f : α → io (sum α β)) : io β := fix (iterate_aux f) a instance {ε α : Type} [inhabited ε] : inhabited (except ε α) := ⟨except.error (default ε)⟩ -@[specialize] def iterate_eio {ε α β : Type} [inhabited ε] (a : α) (f : α → except_t ε io (sum α β)) : except_t ε io β := -iterate a $ λ r, do - r ← (f r).run, - match r with - | except.ok (sum.inl r) := pure (sum.inl r) - | except.ok (sum.inr r) := pure (sum.inr (except.ok r)) - | except.error e := pure (sum.inr (except.error e)) - - -section -local attribute [reducible] io -def eio_inh {α : Type} : eio α := -λ s, (except.error (default io.error), s) -end - @[extern 2 "lean_io_prim_put_str"] -constant put_str (s: @& string) : eio unit := eio_inh +constant put_str (s: @& string) : io unit := default (io unit) @[extern 1 "lean_io_prim_get_line"] -constant get_line : eio string := eio_inh +constant get_line : io string := default (io string) @[extern 4 "lean_io_prim_handle_mk"] -constant handle.mk (s : @& string) (m : mode) (bin : bool := ff) : eio handle := eio_inh +constant handle.mk (s : @& string) (m : mode) (bin : bool := ff) : io handle := default (io handle) @[extern 2 "lean_io_prim_handle_is_eof"] -constant handle.is_eof (h : @& handle) : eio bool := eio_inh +constant handle.is_eof (h : @& handle) : io bool := default (io bool) @[extern 2 "lean_io_prim_handle_flush"] -constant handle.flush (h : @& handle) : eio unit := eio_inh +constant handle.flush (h : @& handle) : io unit := default (io unit) @[extern 2 "lean_io_prim_handle_close"] -constant handle.close (h : @& handle) : eio unit := eio_inh +constant handle.close (h : @& handle) : io unit := default (io unit) -- TODO: replace `string` with byte buffer -- constant handle.read : handle → nat → eio string -- constant handle.write : handle → string → eio unit @[extern 2 "lean_io_prim_handle_get_line"] -constant handle.get_line (h : @& handle) : eio string := eio_inh +constant handle.get_line (h : @& handle) : io string := default (io string) -@[inline] def lift_eio {m : Type → Type} {ε α : Type} [monad_io m] [monad_except ε m] [has_lift_t io.error ε] [monad m] - (x : eio α) : m α := -do e : except io.error α ← monad_lift (except_t.run x), -- uses [monad_io m] instance - monad_except.lift_except e -- uses [monad_except ε m] [has_lift_t io.error ε] instances +@[inline] def lift_io {m : Type → Type} {α : Type} [monad_io m] (x : io α) : m α := +monad_lift x end prim section -variables {m : Type → Type} {ε : Type} [monad_io m] [monad_except ε m] [has_lift_t io.error ε] [monad m] +variables {m : Type → Type} [monad m] [monad_io m] private def put_str : string → m unit := -prim.lift_eio ∘ prim.put_str +prim.lift_io ∘ prim.put_str def print {α} [has_to_string α] (s : α) : m unit := put_str ∘ to_string $ s @@ -131,15 +103,15 @@ print s *> put_str "\n" end namespace fs -variables {m : Type → Type} {ε : Type} [monad_io m] [monad_except ε m] [has_lift_t io.error ε] [monad m] +variables {m : Type → Type} [monad m] [monad_io m] -def handle.mk (s : string) (mode : mode) (bin : bool := ff) : m handle := prim.lift_eio (prim.handle.mk s mode bin) -def handle.is_eof : handle → m bool := prim.lift_eio ∘ prim.handle.is_eof -def handle.flush : handle → m unit := prim.lift_eio ∘ prim.handle.flush -def handle.close : handle → m unit := prim.lift_eio ∘ prim.handle.flush +def handle.mk (s : string) (mode : mode) (bin : bool := ff) : m handle := prim.lift_io (prim.handle.mk s mode bin) +def handle.is_eof : handle → m bool := prim.lift_io ∘ prim.handle.is_eof +def handle.flush : handle → m unit := prim.lift_io ∘ prim.handle.flush +def handle.close : handle → m unit := prim.lift_io ∘ prim.handle.flush -- def handle.read (h : handle) (bytes : nat) : m string := prim.lift_eio (prim.handle.read h bytes) -- def handle.write (h : handle) (s : string) : m unit := prim.lift_eio (prim.handle.write h s) -def handle.get_line : handle → m string := prim.lift_eio ∘ prim.handle.get_line +def handle.get_line : handle → m string := prim.lift_io ∘ prim.handle.get_line /- def get_char (h : handle) : m char := @@ -158,7 +130,7 @@ do b ← h.read 1, -- h.put_str s *> h.put_str "\n" def handle.read_to_end (h : handle) : m string := -prim.lift_eio $ prim.iterate_eio "" $ λ r, do +prim.lift_io $ prim.iterate "" $ λ r, do done ← h.is_eof, if done then pure (sum.inr r) -- stop @@ -224,18 +196,12 @@ do child ← io.proc.spawn { stdout := io.process.stdio.piped, ..args }, universe u -@[inline] def from_eio (x : eio unit) : io unit := -x.run *> pure () - -def io.println' (x : string) : io unit := -from_eio $ io.println x - /-- Typeclass used for presenting the output of an `#eval` command. -/ class has_eval (α : Type u) := (eval : α → io unit) instance has_repr.has_eval {α : Type u} [has_repr α] : has_eval α := -⟨λ a, io.println' (repr a)⟩ +⟨λ a, io.println (repr a)⟩ instance io.has_eval {α : Type} [has_eval α] : has_eval (io α) := ⟨λ x, do a ← x, has_eval.eval a⟩ @@ -243,18 +209,3 @@ instance io.has_eval {α : Type} [has_eval α] : has_eval (io α) := -- special case: do not print `()` instance io_unit.has_eval : has_eval (io unit) := ⟨λ x, x⟩ - -instance eio.has_eval {ε α : Type} [has_to_string ε] [has_eval α] : has_eval (except_t ε io α) := -⟨λ x, do - e : except ε α ← x.run, - match e with - | except.ok a := has_eval.eval a - | except.error e := io.println' ("Error: " ++ to_string e)⟩ - --- special case: do not print `()` -instance eio_unit.has_eval {ε : Type} [has_to_string ε] : has_eval (except_t ε io unit) := -⟨λ x, do - e : except ε unit ← monad_lift $ x.run, - match e with - | except.ok _ := pure () - | except.error e := io.println' ("Error: " ++ to_string e)⟩ diff --git a/library/init/lean/frontend.lean b/library/init/lean/frontend.lean index 17be8381cb..180cd36049 100644 --- a/library/init/lean/frontend.lean +++ b/library/init/lean/frontend.lean @@ -38,7 +38,7 @@ def run_frontend (filename input : string) (print_msg : message → except_t str let opts := options.mk.set_bool `trace.as_messages tt, let elab_st := elaborator.mk_state elab_cfg env opts, let add_output (out : syntax) outs := if collect_outputs then out::outs else [], - io.prim.iterate_eio (p_snap, elab_st, parser_cfg, expander_cfg, ([] : list syntax)) $ λ ⟨p_snap, elab_st, parser_cfg, expander_cfg, outs⟩, do { + io.prim.iterate (p_snap, elab_st, parser_cfg, expander_cfg, ([] : list syntax)) $ λ ⟨p_snap, elab_st, parser_cfg, expander_cfg, outs⟩, do { let pos := parser_cfg.file_map.to_position p_snap.it.offset, r ← monad_lift $ profileit_pure "parsing" pos $ λ _, parse_command parser_cfg p_snap, match r with @@ -46,7 +46,7 @@ def run_frontend (filename input : string) (print_msg : message → except_t str -- fatal error (should never happen?) print_msg msg, msgs.to_list.mfor print_msg, - pure $ sum.inr ((add_output cmd outs).reverse, elab_st.env) + pure $ sum.inr (except.ok ((add_output cmd outs).reverse, elab_st.env)) } | (cmd, except.ok (p_snap, msgs)) := do { msgs.to_list.mfor print_msg, @@ -61,7 +61,7 @@ def run_frontend (filename input : string) (print_msg : message → except_t str pos := ⟨1, 0⟩, text := "parser cache hit rate: " ++ to_string out.cache.hit ++ "/" ++ to_string (out.cache.hit + out.cache.miss)},-/ - pure $ sum.inr ((add_output cmd outs).reverse, elab_st.env) + pure $ sum.inr (except.ok ((add_output cmd outs).reverse, elab_st.env)) else pure (sum.inl (p_snap, elab_st, elab_st.parser_cfg, elab_st.expander_cfg, add_output cmd outs)) } @@ -69,10 +69,8 @@ def run_frontend (filename input : string) (print_msg : message → except_t str } } - @[export lean_process_file] def process_file (f s : string) (json : bool) : state_t environment (except_t unit io) unit := do - --let s := (s.mk_iterator.nextn 10000).prev_to_string, let print_msg : message → except_t string io unit := λ msg, if json then io.println $ "{\"file_name\": \"\", \"pos_line\": " ++ to_string msg.pos.line ++ diff --git a/src/boot/init/control/estate.cpp b/src/boot/init/control/estate.cpp index 7cf52dba24..485af31a9c 100644 --- a/src/boot/init/control/estate.cpp +++ b/src/boot/init/control/estate.cpp @@ -24,6 +24,8 @@ obj* l_estate_has__orelse(obj*, obj*); obj* l_estate_result_repr___boxed(obj*, obj*, obj*); obj* l_estate_monad___closed__1; obj* l_estate_monad___boxed(obj*, obj*); +obj* l_estate_inhabited(obj*, obj*, obj*); +obj* l_estate_inhabited___boxed(obj*, obj*, obj*); obj* l_estate_throw(obj*, obj*, obj*); obj* l_estate_orelse(obj*, obj*, obj*); obj* l_estate_modify___rarg(obj*, obj*); @@ -44,13 +46,14 @@ obj* l_estate_orelse_x_27___rarg___boxed(obj*, obj*, obj*, obj*); obj* l_estate_result_to__string___main(obj*, obj*, obj*); obj* l_estate_orelse_x_27___boxed(obj*, obj*, obj*); obj* l_estate_map___boxed(obj*, obj*, obj*, obj*); -obj* l_estate_adapt__except___boxed(obj*, obj*, obj*, obj*, obj*); +obj* l_estate_adapt__except___boxed(obj*, obj*, obj*, obj*); obj* l_estate_result_repr___main___rarg(obj*, obj*, obj*); +obj* l_estate_inhabited___rarg(obj*, obj*); obj* l_estate_result_to__string(obj*, obj*, obj*); obj* l_estate_result_to__string___main___rarg___closed__1; obj* l_estate_has__to__string___boxed(obj*, obj*, obj*); obj* l_estate_monad___lambda__1___boxed(obj*, obj*, obj*, obj*, obj*); -obj* l_estate_adapt__except(obj*, obj*, obj*, obj*, obj*); +obj* l_estate_adapt__except(obj*, obj*, obj*, obj*); obj* l_estate_get___boxed(obj*, obj*); obj* l_estate_result_repr(obj*, obj*, obj*); obj* l_estate_unreachable__error___boxed(obj*, obj*, obj*, obj*, obj*, obj*, obj*); @@ -381,6 +384,49 @@ lean::dec(x_2); return x_3; } } +obj* l_estate_inhabited___rarg(obj* x_0, obj* x_1) { +_start: +{ +obj* x_2; obj* x_4; obj* x_5; +x_2 = lean::cnstr_get(x_1, 1); +if (lean::is_exclusive(x_1)) { + lean::cnstr_release(x_1, 0); + x_4 = x_1; +} else { + lean::inc(x_2); + lean::dec(x_1); + x_4 = lean::box(0); +} +if (lean::is_scalar(x_4)) { + x_5 = lean::alloc_cnstr(1, 2, 0); +} else { + x_5 = x_4; + lean::cnstr_set_tag(x_4, 1); +} +lean::cnstr_set(x_5, 0, x_0); +lean::cnstr_set(x_5, 1, x_2); +return x_5; +} +} +obj* l_estate_inhabited(obj* x_0, obj* x_1, obj* x_2) { +_start: +{ +obj* x_3; +x_3 = lean::alloc_closure(reinterpret_cast(l_estate_inhabited___rarg), 2, 0); +return x_3; +} +} +obj* l_estate_inhabited___boxed(obj* x_0, obj* x_1, obj* x_2) { +_start: +{ +obj* x_3; +x_3 = l_estate_inhabited(x_0, x_1, x_2); +lean::dec(x_0); +lean::dec(x_1); +lean::dec(x_2); +return x_3; +} +} obj* l_estate_pure___rarg(obj* x_0, obj* x_1) { _start: { @@ -872,25 +918,24 @@ return x_17; } } } -obj* l_estate_adapt__except(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { +obj* l_estate_adapt__except(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { _start: { -obj* x_5; -x_5 = lean::alloc_closure(reinterpret_cast(l_estate_adapt__except___rarg), 3, 0); -return x_5; +obj* x_4; +x_4 = lean::alloc_closure(reinterpret_cast(l_estate_adapt__except___rarg), 3, 0); +return x_4; } } -obj* l_estate_adapt__except___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { +obj* l_estate_adapt__except___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { _start: { -obj* x_5; -x_5 = l_estate_adapt__except(x_0, x_1, x_2, x_3, x_4); +obj* x_4; +x_4 = l_estate_adapt__except(x_0, x_1, x_2, x_3); lean::dec(x_0); lean::dec(x_1); lean::dec(x_2); lean::dec(x_3); -lean::dec(x_4); -return x_5; +return x_4; } } obj* l_estate_bind___rarg(obj* x_0, obj* x_1, obj* x_2) { diff --git a/src/boot/init/io.cpp b/src/boot/init/io.cpp index 8d7db4a966..30ddd0b969 100644 --- a/src/boot/init/io.cpp +++ b/src/boot/init/io.cpp @@ -1,6 +1,6 @@ // Lean compiler output // Module: init.io -// Imports: init.control.state init.control.except init.data.string.basic init.fix +// Imports: init.control.estate init.data.string.basic init.fix #include "runtime/object.h" #include "runtime/apply.h" typedef lean::object obj; typedef lean::usize usize; @@ -15,182 +15,185 @@ typedef lean::uint32 uint32; typedef lean::uint64 uint64; #pragma GCC diagnostic ignored "-Wunused-but-set-variable" #endif obj* l_io_prim_iterate__aux___main___boxed(obj*, obj*); -obj* l_io_prim_iterate___at_io_prim_iterate__eio___spec__1(obj*, obj*, obj*, obj*); -obj* l_io_prim_eio__inh___rarg___closed__1; -obj* l_io_fs_handle_mk___rarg(obj*, obj*, obj*, obj*, obj*, uint8, uint8); +obj* l_io_print___at_has__repr_has__eval___spec__2(obj*, obj*); +obj* l_io_fs_handle_mk___rarg(obj*, obj*, uint8, uint8); obj* l_io_fs_handle_is__eof___at_io_fs_handle_read__to__end___spec__1(obj*, obj*); -obj* l_io_println___at_io_println_x_27___spec__1(obj*, obj*); obj* l_io_prim_iterate__aux___boxed(obj*, obj*); -obj* l_from__eio(obj*, obj*); obj* l_io_print___boxed(obj*, obj*); obj* l_io_prim_iterate__aux___rarg(obj*, obj*, obj*, obj*); -obj* l_id___boxed(obj*); obj* l_io_fs_handle_read__to__end___boxed(obj*, obj*); -obj* l_io_prim_lift__eio___rarg___lambda__1(obj*, obj*, obj*, obj*); obj* l_string_has__to__string___boxed(obj*); extern "C" obj* lean_io_prim_handle_mk(obj*, uint8, uint8, obj*); obj* l_io_prim_handle_get__line___boxed(obj*, obj*); -obj* l_io_prim_io__inhabited(obj*); -obj* l_io_fs_handle_flush___rarg(obj*, obj*, obj*, obj*, obj*); +obj* l_io_fs_handle_flush___rarg(obj*, obj*); obj* l_io_has__eval___boxed(obj*); extern obj* l_string_iterator_extract___main___closed__1; -obj* l___private_init_io_1__put__str___rarg(obj*, obj*, obj*, obj*, obj*); -obj* l_io_prim_iterate___at_io_prim_iterate__eio___spec__1___boxed(obj*, obj*, obj*, obj*); +obj* l___private_init_io_1__put__str___rarg(obj*, obj*); +extern obj* l_estate_monad___closed__1; obj* l_io_prim_handle_flush___boxed(obj*, obj*); -obj* l_io_fs_handle_is__eof___rarg___lambda__1(obj*, obj*, obj*, obj*); obj* l_io_has__eval(obj*); obj* l_has__repr_has__eval___rarg(obj*, obj*, obj*); obj* l_io_fs_handle_close___boxed(obj*, obj*); obj* l_io_prim_iterate___rarg(obj*, obj*, obj*); obj* l_io_fs_handle_get__line___at_io_fs_handle_read__to__end___spec__2___boxed(obj*, obj*); obj* l_io_has__eval___rarg(obj*, obj*, obj*); -obj* l_eio__unit_has__eval___boxed(obj*); extern "C" obj* lean_io_prim_put_str(obj*, obj*); obj* l_io_fs_handle_flush(obj*, obj*); -obj* l_io_prim_lift__eio___rarg(obj*, obj*, obj*, obj*, obj*); obj* l_io_prim_get__line___boxed(obj*); obj* l_io_prim_handle_is__eof___boxed(obj*, obj*); -obj* l_io_prim_iterate___at_io_prim_iterate__eio___spec__1___rarg(obj*, obj*, obj*); obj* l_io_prim_handle_mk___boxed(obj*, obj*, obj*, obj*); -obj* l_io_fs_read__file___rarg(obj*, obj*, obj*, obj*, obj*, uint8); -obj* l_io_prim_lift__eio(obj*, obj*, obj*); -obj* l_io_prim_io__inhabited___boxed(obj*); -obj* l_io_prim_eio__inh(obj*); +obj* l_io_fs_read__file___rarg(obj*, obj*, obj*, uint8); obj* l_io_fs_handle_mk___boxed(obj*, obj*); obj* l_io_fs_handle_is__eof___at_io_fs_handle_read__to__end___spec__1___boxed(obj*, obj*); -obj* l_io_println_x_27___boxed(obj*, obj*); obj* l_allocprof___boxed(obj*, obj*, obj*, obj*); obj* l_io_fs_handle_get__line___at_io_fs_handle_read__to__end___spec__2(obj*, obj*); -obj* l_io_println___rarg(obj*, obj*, obj*, obj*, obj*, obj*, obj*); +obj* l_eio_inhabited___rarg(obj*); +obj* l_io_println___rarg(obj*, obj*, obj*, obj*, obj*); extern "C" obj* lean_io_allocprof(obj*, obj*, obj*, obj*); -obj* l_io_print___at_io_println_x_27___spec__2___boxed(obj*, obj*); obj* l_io_fs_handle_get__line___boxed(obj*, obj*); -obj* l_io_fs_handle_is__eof___rarg(obj*, obj*, obj*, obj*, obj*); +obj* l_io_fs_handle_is__eof___rarg(obj*, obj*); namespace lean { obj* string_append(obj*, obj*); } -obj* l_eio_has__eval(obj*, obj*); -obj* l_io_print___rarg(obj*, obj*, obj*, obj*, obj*, obj*, obj*); -obj* l_io_fs_read__file___boxed(obj*, obj*); +obj* l_io_print___rarg(obj*, obj*, obj*, obj*); +obj* l_io_fs_read__file___boxed(obj*); +obj* l_io_print___at_has__repr_has__eval___spec__2___boxed(obj*, obj*); obj* l___private_init_io_1__put__str(obj*, obj*); obj* l_io_fs_handle_is__eof___boxed(obj*, obj*); -obj* l_io_fs_read__file___rarg___lambda__2(obj*, obj*, obj*, obj*, obj*, obj*, obj*); +obj* l_io_fs_read__file___rarg___lambda__2(obj*, obj*, obj*, obj*, obj*); obj* l_io_fs_handle_read__to__end(obj*, obj*); obj* l_io_prim_put__str___boxed(obj*, obj*); -obj* l_io_prim_iterate__eio___rarg___boxed(obj*, obj*, obj*, obj*); -obj* l_io_prim_iterate__eio___boxed(obj*, obj*, obj*); +obj* l_io_println___at_has__repr_has__eval___spec__1(obj*, obj*); +obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__3(obj*, obj*, obj*); +obj* l_estate_inhabited___rarg(obj*, obj*); obj* l_io_error_has__to__string; -obj* l_io_prim_io__inhabited___rarg(obj*); -obj* l_io_fs_read__file___rarg___lambda__3(obj*, obj*, obj*, obj*, obj*, obj*); +obj* l_io_prim_lift__io(obj*, obj*); +obj* l_io_fs_read__file___rarg___lambda__3(obj*, obj*, obj*, obj*); extern "C" obj* lean_io_prim_handle_close(obj*, obj*); obj* l_io_lazy__pure___boxed(obj*); -obj* l___private_init_io_1__put__str___at_io_println_x_27___spec__3___boxed(obj*, obj*); obj* l_io_prim_inhabited(obj*, obj*); -obj* l_io_println___boxed(obj*, obj*); +obj* l_io_println___boxed(obj*); obj* l_io_prim_iterate(obj*, obj*, obj*); obj* l_io_prim_iterate___boxed(obj*, obj*, obj*); -obj* l_io_prim_iterate__eio___rarg(obj*, obj*, obj*, obj*); obj* l_has__repr_has__eval(obj*); obj* l_io_println___rarg___closed__1; obj* l_io_print(obj*, obj*); obj* l_io_fs_handle_is__eof(obj*, obj*); obj* l___private_init_io_1__put__str___boxed(obj*, obj*); -obj* l_io_prim_iterate___at_io_prim_iterate__eio___spec__1___rarg___lambda__1(obj*, obj*, obj*); -obj* l_io_prim_eio__inh___boxed(obj*); +obj* l_io_prim_lift__io___rarg(obj*, obj*); +obj* l_eio_monad(obj*); obj* l_io_prim_inhabited___rarg(obj*); -obj* l_io_fs_handle_close___rarg(obj*, obj*, obj*, obj*, obj*); +obj* l_io_fs_handle_close___rarg(obj*, obj*); extern "C" obj* lean_io_prim_handle_flush(obj*, obj*); obj* l_io_fs_read__file___rarg___lambda__1(obj*, obj*, obj*); -obj* l_io_monad; -obj* l_io_println___rarg___boxed(obj*, obj*, obj*, obj*, obj*, obj*, obj*); -obj* l_state__t_pure___at_io_prim_io__inhabited___spec__1___rarg(obj*, obj*); -obj* l_id_monad___lambda__1___boxed(obj*, obj*, obj*, obj*); -obj* l_state__t_monad___rarg(obj*); -obj* l_eio__unit_has__eval(obj*); +obj* l_io_println___rarg___boxed(obj*, obj*, obj*, obj*, obj*); +extern obj* l_string_inhabited; obj* l_has__repr_has__eval___boxed(obj*); -obj* l_eio_has__eval___rarg(obj*, obj*, obj*, obj*); extern "C" obj* lean_io_prim_get_line(obj*); +obj* l_eio_inhabited(obj*, obj*); obj* l_string_has__lift___boxed(obj*); -obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__4___lambda__1(obj*, obj*, obj*); -obj* l_io_fs_handle_get__line___rarg(obj*, obj*, obj*, obj*, obj*); -obj* l_eio__unit_has__eval___rarg(obj*, obj*, obj*); +obj* l_io_fs_handle_get__line___rarg(obj*, obj*); obj* l_io_prim_iterate__aux(obj*, obj*); -extern "C" obj* lean_io_unsafe(obj*, obj*, obj*); -obj* l_io_fs_read__file(obj*, obj*); -obj* l_io_prim_lift__eio___boxed(obj*, obj*, obj*); +extern "C" obj* lean_io_unsafe(obj*, obj*); +obj* l_io_fs_read__file(obj*); obj* l_io_fs_handle_flush___boxed(obj*, obj*); -obj* l_state__t_pure___at_io_prim_io__inhabited___spec__1(obj*); +obj* l_eio_monad___boxed(obj*); extern "C" obj* lean_io_prim_handle_get_line(obj*, obj*); -obj* l_unsafe__io___boxed(obj*, obj*, obj*); +obj* l_unsafe__io___boxed(obj*, obj*); +obj* l___private_init_io_1__put__str___at_has__repr_has__eval___spec__3___boxed(obj*, obj*); obj* l_io_lazy__pure(obj*); obj* l_io_fs_handle_mk(obj*, obj*); obj* l_io_fs_read__file___rarg___lambda__1___boxed(obj*, obj*, obj*); -obj* l_io_println_x_27(obj*, obj*); obj* l_io_lazy__pure___rarg(obj*, obj*); obj* l_io_error_inhabited; -obj* l_io_fs_handle_read__to__end___rarg(obj*, obj*, obj*, obj*, obj*); +obj* l_io_fs_handle_read__to__end___rarg(obj*, obj*); obj* l_io_prim_handle_close___boxed(obj*, obj*); -obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__4(obj*, obj*, obj*); -obj* l_id_bind___boxed(obj*, obj*); +obj* l_eio_inhabited___boxed(obj*, obj*); obj* l_io_prim_iterate__aux___main___rarg(obj*, obj*, obj*, obj*); -obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__4___lambda__1___boxed(obj*, obj*, obj*); -obj* l_io_println(obj*, obj*); -obj* l_io_print___rarg___boxed(obj*, obj*, obj*, obj*, obj*, obj*, obj*); +obj* l_io_println(obj*); +obj* l_io_print___rarg___boxed(obj*, obj*, obj*, obj*); obj* l_timeit___boxed(obj*, obj*, obj*, obj*); -obj* l_io_print___at_io_println_x_27___spec__2(obj*, obj*); -obj* l_io_fs_handle_mk___rarg___boxed(obj*, obj*, obj*, obj*, obj*, obj*, obj*); +obj* l___private_init_io_1__put__str___at_has__repr_has__eval___spec__3(obj*, obj*); +obj* l_io_fs_handle_mk___rarg___boxed(obj*, obj*, obj*, obj*); extern "C" obj* lean_io_timeit(obj*, obj*, obj*, obj*); obj* l_io_prim_inhabited___boxed(obj*, obj*); obj* l_io_fs_handle_close(obj*, obj*); -obj* l_io_println___at_io_println_x_27___spec__1___boxed(obj*, obj*); +obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__3___lambda__1(obj*, obj*, obj*); +obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__3___lambda__1___boxed(obj*, obj*, obj*); obj* l_io__unit_has__eval(obj*, obj*); -obj* l_io_prim_eio__inh___rarg(obj*); -obj* l_state__t_pure___at_io_prim_io__inhabited___spec__1___boxed(obj*); +obj* l_io_println___at_has__repr_has__eval___spec__1___boxed(obj*, obj*); extern "C" obj* lean_io_prim_handle_is_eof(obj*, obj*); -obj* l_eio_has__eval___boxed(obj*, obj*); -obj* l_eio_has__eval___rarg___closed__1; -obj* l_id_monad___lambda__2___boxed(obj*, obj*, obj*, obj*); +obj* l_io_prim_lift__io___boxed(obj*, obj*); obj* l_string_has__lift(obj*); obj* l_io_fs_handle_get__line(obj*, obj*); -obj* l_id_monad___lambda__3___boxed(obj*, obj*, obj*, obj*); -obj* l___private_init_io_1__put__str___at_io_println_x_27___spec__3(obj*, obj*); -obj* l_io_prim_iterate__eio___at_io_fs_handle_read__to__end___spec__3(obj*, obj*, obj*); obj* l_io_prim_iterate__aux___main(obj*, obj*); -obj* l_io_fs_read__file___rarg___boxed(obj*, obj*, obj*, obj*, obj*, obj*); -obj* l_io_prim_iterate__eio(obj*, obj*, obj*); -obj* _init_l_io_monad() { +obj* l_io_fs_read__file___rarg___boxed(obj*, obj*, obj*, obj*); +obj* l_eio_monad(obj* x_0) { _start: { -obj* x_0; obj* x_1; obj* x_4; obj* x_5; obj* x_6; obj* x_7; obj* x_8; obj* x_9; obj* x_10; -x_0 = lean::alloc_closure(reinterpret_cast(l_id_monad___lambda__1___boxed), 4, 0); -x_1 = lean::alloc_closure(reinterpret_cast(l_id_monad___lambda__2___boxed), 4, 0); -lean::inc(x_1); -lean::inc(x_0); -x_4 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_4, 0, x_0); -lean::cnstr_set(x_4, 1, x_1); -x_5 = lean::alloc_closure(reinterpret_cast(l_id___boxed), 1, 0); -x_6 = lean::alloc_closure(reinterpret_cast(l_id_monad___lambda__3___boxed), 4, 0); -x_7 = lean::alloc_cnstr(0, 5, 0); -lean::cnstr_set(x_7, 0, x_4); -lean::cnstr_set(x_7, 1, x_5); -lean::cnstr_set(x_7, 2, x_0); -lean::cnstr_set(x_7, 3, x_1); -lean::cnstr_set(x_7, 4, x_6); -x_8 = lean::alloc_closure(reinterpret_cast(l_id_bind___boxed), 2, 0); -x_9 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_9, 0, x_7); -lean::cnstr_set(x_9, 1, x_8); -x_10 = l_state__t_monad___rarg(x_9); -return x_10; +obj* x_1; +x_1 = l_estate_monad___closed__1; +return x_1; } } -obj* l_unsafe__io___boxed(obj* x_0, obj* x_1, obj* x_2) { +obj* l_eio_monad___boxed(obj* x_0) { _start: { -obj* x_3; -x_3 = lean_io_unsafe(x_0, x_1, x_2); -return x_3; +obj* x_1; +x_1 = l_eio_monad(x_0); +lean::dec(x_0); +return x_1; +} +} +obj* l_eio_inhabited___rarg(obj* x_0) { +_start: +{ +obj* x_1; +x_1 = lean::alloc_closure(reinterpret_cast(l_estate_inhabited___rarg), 2, 1); +lean::closure_set(x_1, 0, x_0); +return x_1; +} +} +obj* l_eio_inhabited(obj* x_0, obj* x_1) { +_start: +{ +obj* x_2; +x_2 = lean::alloc_closure(reinterpret_cast(l_eio_inhabited___rarg), 1, 0); +return x_2; +} +} +obj* l_eio_inhabited___boxed(obj* x_0, obj* x_1) { +_start: +{ +obj* x_2; +x_2 = l_eio_inhabited(x_0, x_1); +lean::dec(x_0); +lean::dec(x_1); +return x_2; +} +} +obj* _init_l_io_error_has__to__string() { +_start: +{ +obj* x_0; +x_0 = lean::alloc_closure(reinterpret_cast(l_string_has__to__string___boxed), 1, 0); +return x_0; +} +} +obj* _init_l_io_error_inhabited() { +_start: +{ +obj* x_0; +x_0 = l_string_inhabited; +return x_0; +} +} +obj* l_unsafe__io___boxed(obj* x_0, obj* x_1) { +_start: +{ +obj* x_2; +x_2 = lean_io_unsafe(x_0, x_1); +return x_2; } } obj* l_timeit___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { @@ -211,22 +214,6 @@ lean::dec(x_1); return x_4; } } -obj* _init_l_io_error_has__to__string() { -_start: -{ -obj* x_0; -x_0 = lean::alloc_closure(reinterpret_cast(l_string_has__to__string___boxed), 1, 0); -return x_0; -} -} -obj* _init_l_io_error_inhabited() { -_start: -{ -obj* x_0; -x_0 = lean::mk_string(""); -return x_0; -} -} obj* l_string_has__lift(obj* x_0) { _start: { @@ -246,13 +233,26 @@ return x_1; obj* l_io_lazy__pure___rarg(obj* x_0, obj* x_1) { _start: { -obj* x_2; obj* x_3; obj* x_4; -x_2 = lean::box(0); -x_3 = lean::apply_1(x_0, x_2); -x_4 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_4, 0, x_3); -lean::cnstr_set(x_4, 1, x_1); -return x_4; +obj* x_2; obj* x_4; obj* x_5; obj* x_6; obj* x_7; +x_2 = lean::cnstr_get(x_1, 1); +if (lean::is_exclusive(x_1)) { + lean::cnstr_release(x_1, 0); + x_4 = x_1; +} else { + lean::inc(x_2); + lean::dec(x_1); + x_4 = lean::box(0); +} +x_5 = lean::box(0); +x_6 = lean::apply_1(x_0, x_5); +if (lean::is_scalar(x_4)) { + x_7 = lean::alloc_cnstr(0, 2, 0); +} else { + x_7 = x_4; +} +lean::cnstr_set(x_7, 0, x_6); +lean::cnstr_set(x_7, 1, x_2); +return x_7; } } obj* l_io_lazy__pure(obj* x_0) { @@ -275,46 +275,87 @@ return x_1; obj* l_io_prim_iterate__aux___main___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { _start: { -obj* x_4; obj* x_5; +obj* x_4; x_4 = lean::apply_2(x_0, x_2, x_3); +if (lean::obj_tag(x_4) == 0) +{ +obj* x_5; x_5 = lean::cnstr_get(x_4, 0); lean::inc(x_5); if (lean::obj_tag(x_5) == 0) { -obj* x_7; obj* x_10; obj* x_13; +obj* x_7; obj* x_9; obj* x_10; obj* x_13; obj* x_14; obj* x_15; x_7 = lean::cnstr_get(x_4, 1); -lean::inc(x_7); -lean::dec(x_4); +if (lean::is_exclusive(x_4)) { + lean::cnstr_release(x_4, 0); + x_9 = x_4; +} else { + lean::inc(x_7); + lean::dec(x_4); + x_9 = lean::box(0); +} x_10 = lean::cnstr_get(x_5, 0); lean::inc(x_10); lean::dec(x_5); -x_13 = lean::apply_2(x_1, x_10, x_7); -return x_13; +x_13 = lean::box(0); +if (lean::is_scalar(x_9)) { + x_14 = lean::alloc_cnstr(0, 2, 0); +} else { + x_14 = x_9; +} +lean::cnstr_set(x_14, 0, x_13); +lean::cnstr_set(x_14, 1, x_7); +x_15 = lean::apply_2(x_1, x_10, x_14); +return x_15; } else { -obj* x_15; obj* x_17; obj* x_18; obj* x_21; +obj* x_17; obj* x_19; obj* x_20; obj* x_23; lean::dec(x_1); -x_15 = lean::cnstr_get(x_4, 1); +x_17 = lean::cnstr_get(x_4, 1); if (lean::is_exclusive(x_4)) { lean::cnstr_release(x_4, 0); - x_17 = x_4; + x_19 = x_4; } else { - lean::inc(x_15); + lean::inc(x_17); lean::dec(x_4); - x_17 = lean::box(0); + x_19 = lean::box(0); } -x_18 = lean::cnstr_get(x_5, 0); -lean::inc(x_18); +x_20 = lean::cnstr_get(x_5, 0); +lean::inc(x_20); lean::dec(x_5); -if (lean::is_scalar(x_17)) { - x_21 = lean::alloc_cnstr(0, 2, 0); +if (lean::is_scalar(x_19)) { + x_23 = lean::alloc_cnstr(0, 2, 0); } else { - x_21 = x_17; + x_23 = x_19; } -lean::cnstr_set(x_21, 0, x_18); -lean::cnstr_set(x_21, 1, x_15); -return x_21; +lean::cnstr_set(x_23, 0, x_20); +lean::cnstr_set(x_23, 1, x_17); +return x_23; +} +} +else +{ +obj* x_25; obj* x_27; obj* x_29; obj* x_30; +lean::dec(x_1); +x_25 = lean::cnstr_get(x_4, 0); +x_27 = lean::cnstr_get(x_4, 1); +if (lean::is_exclusive(x_4)) { + x_29 = x_4; +} else { + lean::inc(x_25); + lean::inc(x_27); + lean::dec(x_4); + x_29 = lean::box(0); +} +if (lean::is_scalar(x_29)) { + x_30 = lean::alloc_cnstr(1, 2, 0); +} else { + x_30 = x_29; +} +lean::cnstr_set(x_30, 0, x_25); +lean::cnstr_set(x_30, 1, x_27); +return x_30; } } } @@ -362,59 +403,6 @@ lean::dec(x_1); return x_2; } } -obj* l_state__t_pure___at_io_prim_io__inhabited___spec__1___rarg(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; -x_2 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_2, 0, x_0); -lean::cnstr_set(x_2, 1, x_1); -return x_2; -} -} -obj* l_state__t_pure___at_io_prim_io__inhabited___spec__1(obj* x_0) { -_start: -{ -obj* x_1; -x_1 = lean::alloc_closure(reinterpret_cast(l_state__t_pure___at_io_prim_io__inhabited___spec__1___rarg), 2, 0); -return x_1; -} -} -obj* l_io_prim_io__inhabited___rarg(obj* x_0) { -_start: -{ -obj* x_1; -x_1 = lean::alloc_closure(reinterpret_cast(l_state__t_pure___at_io_prim_io__inhabited___spec__1___rarg), 2, 1); -lean::closure_set(x_1, 0, x_0); -return x_1; -} -} -obj* l_io_prim_io__inhabited(obj* x_0) { -_start: -{ -obj* x_1; -x_1 = lean::alloc_closure(reinterpret_cast(l_io_prim_io__inhabited___rarg), 1, 0); -return x_1; -} -} -obj* l_state__t_pure___at_io_prim_io__inhabited___spec__1___boxed(obj* x_0) { -_start: -{ -obj* x_1; -x_1 = l_state__t_pure___at_io_prim_io__inhabited___spec__1(x_0); -lean::dec(x_0); -return x_1; -} -} -obj* l_io_prim_io__inhabited___boxed(obj* x_0) { -_start: -{ -obj* x_1; -x_1 = l_io_prim_io__inhabited(x_0); -lean::dec(x_0); -return x_1; -} -} obj* l_io_prim_iterate___rarg(obj* x_0, obj* x_1, obj* x_2) { _start: { @@ -471,248 +459,6 @@ lean::dec(x_1); return x_2; } } -obj* l_io_prim_iterate___at_io_prim_iterate__eio___spec__1___rarg___lambda__1(obj* x_0, obj* x_1, obj* x_2) { -_start: -{ -obj* x_3; obj* x_4; -x_3 = lean::apply_2(x_0, x_1, x_2); -x_4 = lean::cnstr_get(x_3, 0); -lean::inc(x_4); -if (lean::obj_tag(x_4) == 0) -{ -obj* x_6; obj* x_8; obj* x_9; obj* x_11; obj* x_12; obj* x_13; obj* x_14; -x_6 = lean::cnstr_get(x_3, 1); -if (lean::is_exclusive(x_3)) { - lean::cnstr_release(x_3, 0); - x_8 = x_3; -} else { - lean::inc(x_6); - lean::dec(x_3); - x_8 = lean::box(0); -} -x_9 = lean::cnstr_get(x_4, 0); -if (lean::is_exclusive(x_4)) { - x_11 = x_4; -} else { - lean::inc(x_9); - lean::dec(x_4); - x_11 = lean::box(0); -} -if (lean::is_scalar(x_11)) { - x_12 = lean::alloc_cnstr(0, 1, 0); -} else { - x_12 = x_11; -} -lean::cnstr_set(x_12, 0, x_9); -x_13 = lean::alloc_cnstr(1, 1, 0); -lean::cnstr_set(x_13, 0, x_12); -if (lean::is_scalar(x_8)) { - x_14 = lean::alloc_cnstr(0, 2, 0); -} else { - x_14 = x_8; -} -lean::cnstr_set(x_14, 0, x_13); -lean::cnstr_set(x_14, 1, x_6); -return x_14; -} -else -{ -obj* x_15; obj* x_17; -x_15 = lean::cnstr_get(x_4, 0); -if (lean::is_exclusive(x_4)) { - lean::cnstr_set(x_4, 0, lean::box(0)); - x_17 = x_4; -} else { - lean::inc(x_15); - lean::dec(x_4); - x_17 = lean::box(0); -} -if (lean::obj_tag(x_15) == 0) -{ -obj* x_19; obj* x_21; obj* x_22; obj* x_24; obj* x_25; obj* x_26; -lean::dec(x_17); -x_19 = lean::cnstr_get(x_3, 1); -if (lean::is_exclusive(x_3)) { - lean::cnstr_release(x_3, 0); - x_21 = x_3; -} else { - lean::inc(x_19); - lean::dec(x_3); - x_21 = lean::box(0); -} -x_22 = lean::cnstr_get(x_15, 0); -if (lean::is_exclusive(x_15)) { - x_24 = x_15; -} else { - lean::inc(x_22); - lean::dec(x_15); - x_24 = lean::box(0); -} -if (lean::is_scalar(x_24)) { - x_25 = lean::alloc_cnstr(0, 1, 0); -} else { - x_25 = x_24; -} -lean::cnstr_set(x_25, 0, x_22); -if (lean::is_scalar(x_21)) { - x_26 = lean::alloc_cnstr(0, 2, 0); -} else { - x_26 = x_21; -} -lean::cnstr_set(x_26, 0, x_25); -lean::cnstr_set(x_26, 1, x_19); -return x_26; -} -else -{ -obj* x_27; obj* x_29; obj* x_30; obj* x_32; obj* x_33; obj* x_34; obj* x_35; -x_27 = lean::cnstr_get(x_3, 1); -if (lean::is_exclusive(x_3)) { - lean::cnstr_release(x_3, 0); - x_29 = x_3; -} else { - lean::inc(x_27); - lean::dec(x_3); - x_29 = lean::box(0); -} -x_30 = lean::cnstr_get(x_15, 0); -if (lean::is_exclusive(x_15)) { - x_32 = x_15; -} else { - lean::inc(x_30); - lean::dec(x_15); - x_32 = lean::box(0); -} -if (lean::is_scalar(x_17)) { - x_33 = lean::alloc_cnstr(1, 1, 0); -} else { - x_33 = x_17; -} -lean::cnstr_set(x_33, 0, x_30); -if (lean::is_scalar(x_32)) { - x_34 = lean::alloc_cnstr(1, 1, 0); -} else { - x_34 = x_32; -} -lean::cnstr_set(x_34, 0, x_33); -if (lean::is_scalar(x_29)) { - x_35 = lean::alloc_cnstr(0, 2, 0); -} else { - x_35 = x_29; -} -lean::cnstr_set(x_35, 0, x_34); -lean::cnstr_set(x_35, 1, x_27); -return x_35; -} -} -} -} -obj* l_io_prim_iterate___at_io_prim_iterate__eio___spec__1___rarg(obj* x_0, obj* x_1, obj* x_2) { -_start: -{ -obj* x_3; obj* x_4; obj* x_5; -x_3 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_io_prim_iterate__eio___spec__1___rarg___lambda__1), 3, 1); -lean::closure_set(x_3, 0, x_0); -x_4 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate__aux___rarg), 4, 1); -lean::closure_set(x_4, 0, x_3); -x_5 = lean::fixpoint2(x_4, x_1, x_2); -return x_5; -} -} -obj* l_io_prim_iterate___at_io_prim_iterate__eio___spec__1(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_io_prim_iterate__eio___spec__1___rarg), 3, 0); -return x_4; -} -} -obj* l_io_prim_iterate__eio___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_io_prim_iterate___at_io_prim_iterate__eio___spec__1___rarg(x_2, x_1, x_3); -return x_4; -} -} -obj* l_io_prim_iterate__eio(obj* x_0, obj* x_1, obj* x_2) { -_start: -{ -obj* x_3; -x_3 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate__eio___rarg___boxed), 4, 0); -return x_3; -} -} -obj* l_io_prim_iterate___at_io_prim_iterate__eio___spec__1___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_io_prim_iterate___at_io_prim_iterate__eio___spec__1(x_0, x_1, x_2, x_3); -lean::dec(x_0); -lean::dec(x_1); -lean::dec(x_2); -lean::dec(x_3); -return x_4; -} -} -obj* l_io_prim_iterate__eio___rarg___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_io_prim_iterate__eio___rarg(x_0, x_1, x_2, x_3); -lean::dec(x_0); -return x_4; -} -} -obj* l_io_prim_iterate__eio___boxed(obj* x_0, obj* x_1, obj* x_2) { -_start: -{ -obj* x_3; -x_3 = l_io_prim_iterate__eio(x_0, x_1, x_2); -lean::dec(x_0); -lean::dec(x_1); -lean::dec(x_2); -return x_3; -} -} -obj* _init_l_io_prim_eio__inh___rarg___closed__1() { -_start: -{ -obj* x_0; obj* x_1; -x_0 = lean::mk_string(""); -x_1 = lean::alloc_cnstr(0, 1, 0); -lean::cnstr_set(x_1, 0, x_0); -return x_1; -} -} -obj* l_io_prim_eio__inh___rarg(obj* x_0) { -_start: -{ -obj* x_1; obj* x_2; -x_1 = l_io_prim_eio__inh___rarg___closed__1; -x_2 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_2, 0, x_1); -lean::cnstr_set(x_2, 1, x_0); -return x_2; -} -} -obj* l_io_prim_eio__inh(obj* x_0) { -_start: -{ -obj* x_1; -x_1 = lean::alloc_closure(reinterpret_cast(l_io_prim_eio__inh___rarg), 1, 0); -return x_1; -} -} -obj* l_io_prim_eio__inh___boxed(obj* x_0) { -_start: -{ -obj* x_1; -x_1 = l_io_prim_eio__inh(x_0); -lean::dec(x_0); -return x_1; -} -} obj* l_io_prim_put__str___boxed(obj* x_0, obj* x_1) { _start: { @@ -777,98 +523,47 @@ lean::dec(x_0); return x_2; } } -obj* l_io_prim_lift__eio___rarg___lambda__1(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { +obj* l_io_prim_lift__io___rarg(obj* x_0, obj* x_1) { _start: { -if (lean::obj_tag(x_3) == 0) -{ -obj* x_5; obj* x_8; obj* x_11; obj* x_12; -lean::dec(x_2); -x_5 = lean::cnstr_get(x_3, 0); -lean::inc(x_5); -lean::dec(x_3); -x_8 = lean::cnstr_get(x_0, 0); -lean::inc(x_8); -lean::dec(x_0); -x_11 = lean::apply_1(x_1, x_5); -x_12 = lean::apply_2(x_8, lean::box(0), x_11); -return x_12; -} -else -{ -obj* x_15; obj* x_18; obj* x_21; obj* x_24; -lean::dec(x_1); -lean::dec(x_0); -x_15 = lean::cnstr_get(x_3, 0); -lean::inc(x_15); -lean::dec(x_3); -x_18 = lean::cnstr_get(x_2, 0); -lean::inc(x_18); -lean::dec(x_2); -x_21 = lean::cnstr_get(x_18, 1); -lean::inc(x_21); -lean::dec(x_18); -x_24 = lean::apply_2(x_21, lean::box(0), x_15); -return x_24; +obj* x_2; +x_2 = lean::apply_2(x_0, lean::box(0), x_1); +return x_2; } } -} -obj* l_io_prim_lift__eio___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { +obj* l_io_prim_lift__io(obj* x_0, obj* x_1) { _start: { -obj* x_5; obj* x_7; obj* x_8; obj* x_9; -x_5 = lean::cnstr_get(x_3, 1); -lean::inc(x_5); -x_7 = lean::apply_2(x_0, lean::box(0), x_4); -x_8 = lean::alloc_closure(reinterpret_cast(l_io_prim_lift__eio___rarg___lambda__1), 4, 3); -lean::closure_set(x_8, 0, x_1); -lean::closure_set(x_8, 1, x_2); -lean::closure_set(x_8, 2, x_3); -x_9 = lean::apply_4(x_5, lean::box(0), lean::box(0), x_7, x_8); -return x_9; +obj* x_2; +x_2 = lean::alloc_closure(reinterpret_cast(l_io_prim_lift__io___rarg), 2, 0); +return x_2; } } -obj* l_io_prim_lift__eio(obj* x_0, obj* x_1, obj* x_2) { +obj* l_io_prim_lift__io___boxed(obj* x_0, obj* x_1) { _start: { -obj* x_3; -x_3 = lean::alloc_closure(reinterpret_cast(l_io_prim_lift__eio___rarg), 5, 0); -return x_3; -} -} -obj* l_io_prim_lift__eio___boxed(obj* x_0, obj* x_1, obj* x_2) { -_start: -{ -obj* x_3; -x_3 = l_io_prim_lift__eio(x_0, x_1, x_2); +obj* x_2; +x_2 = l_io_prim_lift__io(x_0, x_1); lean::dec(x_0); lean::dec(x_1); -lean::dec(x_2); -return x_3; +return x_2; } } -obj* l___private_init_io_1__put__str___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { +obj* l___private_init_io_1__put__str___rarg(obj* x_0, obj* x_1) { _start: { -obj* x_5; obj* x_6; obj* x_8; obj* x_9; obj* x_10; -x_5 = lean::alloc_closure(reinterpret_cast(l_io_prim_put__str___boxed), 2, 1); -lean::closure_set(x_5, 0, x_4); -x_6 = lean::cnstr_get(x_3, 1); -lean::inc(x_6); -x_8 = lean::apply_2(x_0, lean::box(0), x_5); -x_9 = lean::alloc_closure(reinterpret_cast(l_io_prim_lift__eio___rarg___lambda__1), 4, 3); -lean::closure_set(x_9, 0, x_1); -lean::closure_set(x_9, 1, x_2); -lean::closure_set(x_9, 2, x_3); -x_10 = lean::apply_4(x_6, lean::box(0), lean::box(0), x_8, x_9); -return x_10; +obj* x_2; obj* x_3; +x_2 = lean::alloc_closure(reinterpret_cast(l_io_prim_put__str___boxed), 2, 1); +lean::closure_set(x_2, 0, x_1); +x_3 = lean::apply_2(x_0, lean::box(0), x_2); +return x_3; } } obj* l___private_init_io_1__put__str(obj* x_0, obj* x_1) { _start: { obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l___private_init_io_1__put__str___rarg), 5, 0); +x_2 = lean::alloc_closure(reinterpret_cast(l___private_init_io_1__put__str___rarg), 2, 0); return x_2; } } @@ -882,30 +577,30 @@ lean::dec(x_1); return x_2; } } -obj* l_io_print___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { +obj* l_io_print___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { _start: { -obj* x_7; obj* x_8; -x_7 = lean::apply_1(x_5, x_6); -x_8 = l___private_init_io_1__put__str___rarg(x_0, x_1, x_2, x_3, x_7); -return x_8; +obj* x_4; obj* x_5; +x_4 = lean::apply_1(x_2, x_3); +x_5 = l___private_init_io_1__put__str___rarg(x_0, x_4); +return x_5; } } obj* l_io_print(obj* x_0, obj* x_1) { _start: { obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l_io_print___rarg___boxed), 7, 0); +x_2 = lean::alloc_closure(reinterpret_cast(l_io_print___rarg___boxed), 4, 0); return x_2; } } -obj* l_io_print___rarg___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { +obj* l_io_print___rarg___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { _start: { -obj* x_7; -x_7 = l_io_print___rarg(x_0, x_1, x_2, x_3, x_4, x_5, x_6); -lean::dec(x_4); -return x_7; +obj* x_4; +x_4 = l_io_print___rarg(x_0, x_1, x_2, x_3); +lean::dec(x_1); +return x_4; } } obj* l_io_print___boxed(obj* x_0, obj* x_1) { @@ -926,90 +621,80 @@ x_0 = lean::mk_string("\n"); return x_0; } } -obj* l_io_println___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { +obj* l_io_println___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { _start: { -obj* x_7; obj* x_9; obj* x_16; obj* x_17; obj* x_18; obj* x_19; -x_7 = lean::cnstr_get(x_3, 0); -lean::inc(x_7); -x_9 = lean::cnstr_get(x_7, 4); -lean::inc(x_9); -lean::dec(x_7); -lean::inc(x_3); -lean::inc(x_2); -lean::inc(x_1); -lean::inc(x_0); -x_16 = l_io_print___rarg(x_0, x_1, x_2, x_3, lean::box(0), x_5, x_6); -x_17 = l_io_println___rarg___closed__1; -x_18 = l___private_init_io_1__put__str___rarg(x_0, x_1, x_2, x_3, x_17); -x_19 = lean::apply_4(x_9, lean::box(0), lean::box(0), x_16, x_18); -return x_19; -} -} -obj* l_io_println(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l_io_println___rarg___boxed), 7, 0); -return x_2; -} -} -obj* l_io_println___rarg___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { -_start: -{ -obj* x_7; -x_7 = l_io_println___rarg(x_0, x_1, x_2, x_3, x_4, x_5, x_6); -lean::dec(x_4); -return x_7; -} -} -obj* l_io_println___boxed(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; -x_2 = l_io_println(x_0, x_1); +obj* x_5; obj* x_8; obj* x_12; obj* x_13; obj* x_14; obj* x_15; +x_5 = lean::cnstr_get(x_0, 0); +lean::inc(x_5); lean::dec(x_0); -lean::dec(x_1); -return x_2; +x_8 = lean::cnstr_get(x_5, 4); +lean::inc(x_8); +lean::dec(x_5); +lean::inc(x_1); +x_12 = l_io_print___rarg(x_1, lean::box(0), x_3, x_4); +x_13 = l_io_println___rarg___closed__1; +x_14 = l___private_init_io_1__put__str___rarg(x_1, x_13); +x_15 = lean::apply_4(x_8, lean::box(0), lean::box(0), x_12, x_14); +return x_15; } } -obj* l_io_fs_handle_mk___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, uint8 x_5, uint8 x_6) { +obj* l_io_println(obj* x_0) { _start: { -obj* x_7; obj* x_8; obj* x_9; obj* x_10; obj* x_12; obj* x_13; obj* x_14; -x_7 = lean::box(x_5); -x_8 = lean::box(x_6); -x_9 = lean::alloc_closure(reinterpret_cast(l_io_prim_handle_mk___boxed), 4, 3); -lean::closure_set(x_9, 0, x_4); -lean::closure_set(x_9, 1, x_7); -lean::closure_set(x_9, 2, x_8); -x_10 = lean::cnstr_get(x_3, 1); -lean::inc(x_10); -x_12 = lean::apply_2(x_0, lean::box(0), x_9); -x_13 = lean::alloc_closure(reinterpret_cast(l_io_prim_lift__eio___rarg___lambda__1), 4, 3); -lean::closure_set(x_13, 0, x_1); -lean::closure_set(x_13, 1, x_2); -lean::closure_set(x_13, 2, x_3); -x_14 = lean::apply_4(x_10, lean::box(0), lean::box(0), x_12, x_13); -return x_14; +obj* x_1; +x_1 = lean::alloc_closure(reinterpret_cast(l_io_println___rarg___boxed), 5, 0); +return x_1; +} +} +obj* l_io_println___rarg___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { +_start: +{ +obj* x_5; +x_5 = l_io_println___rarg(x_0, x_1, x_2, x_3, x_4); +lean::dec(x_2); +return x_5; +} +} +obj* l_io_println___boxed(obj* x_0) { +_start: +{ +obj* x_1; +x_1 = l_io_println(x_0); +lean::dec(x_0); +return x_1; +} +} +obj* l_io_fs_handle_mk___rarg(obj* x_0, obj* x_1, uint8 x_2, uint8 x_3) { +_start: +{ +obj* x_4; obj* x_5; obj* x_6; obj* x_7; +x_4 = lean::box(x_2); +x_5 = lean::box(x_3); +x_6 = lean::alloc_closure(reinterpret_cast(l_io_prim_handle_mk___boxed), 4, 3); +lean::closure_set(x_6, 0, x_1); +lean::closure_set(x_6, 1, x_4); +lean::closure_set(x_6, 2, x_5); +x_7 = lean::apply_2(x_0, lean::box(0), x_6); +return x_7; } } obj* l_io_fs_handle_mk(obj* x_0, obj* x_1) { _start: { obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_mk___rarg___boxed), 7, 0); +x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_mk___rarg___boxed), 4, 0); return x_2; } } -obj* l_io_fs_handle_mk___rarg___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { +obj* l_io_fs_handle_mk___rarg___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { _start: { -uint8 x_7; uint8 x_8; obj* x_9; -x_7 = lean::unbox(x_5); -x_8 = lean::unbox(x_6); -x_9 = l_io_fs_handle_mk___rarg(x_0, x_1, x_2, x_3, x_4, x_7, x_8); -return x_9; +uint8 x_4; uint8 x_5; obj* x_6; +x_4 = lean::unbox(x_2); +x_5 = lean::unbox(x_3); +x_6 = l_io_fs_handle_mk___rarg(x_0, x_1, x_4, x_5); +return x_6; } } obj* l_io_fs_handle_mk___boxed(obj* x_0, obj* x_1) { @@ -1022,64 +707,21 @@ lean::dec(x_1); return x_2; } } -obj* l_io_fs_handle_is__eof___rarg___lambda__1(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { +obj* l_io_fs_handle_is__eof___rarg(obj* x_0, obj* x_1) { _start: { -if (lean::obj_tag(x_3) == 0) -{ -obj* x_5; obj* x_8; obj* x_11; obj* x_12; -lean::dec(x_2); -x_5 = lean::cnstr_get(x_3, 0); -lean::inc(x_5); -lean::dec(x_3); -x_8 = lean::cnstr_get(x_0, 0); -lean::inc(x_8); -lean::dec(x_0); -x_11 = lean::apply_1(x_1, x_5); -x_12 = lean::apply_2(x_8, lean::box(0), x_11); -return x_12; -} -else -{ -obj* x_15; obj* x_18; obj* x_21; obj* x_24; -lean::dec(x_1); -lean::dec(x_0); -x_15 = lean::cnstr_get(x_3, 0); -lean::inc(x_15); -lean::dec(x_3); -x_18 = lean::cnstr_get(x_2, 0); -lean::inc(x_18); -lean::dec(x_2); -x_21 = lean::cnstr_get(x_18, 1); -lean::inc(x_21); -lean::dec(x_18); -x_24 = lean::apply_2(x_21, lean::box(0), x_15); -return x_24; -} -} -} -obj* l_io_fs_handle_is__eof___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { -_start: -{ -obj* x_5; obj* x_6; obj* x_8; obj* x_9; obj* x_10; -x_5 = lean::alloc_closure(reinterpret_cast(l_io_prim_handle_is__eof___boxed), 2, 1); -lean::closure_set(x_5, 0, x_4); -x_6 = lean::cnstr_get(x_3, 1); -lean::inc(x_6); -x_8 = lean::apply_2(x_0, lean::box(0), x_5); -x_9 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_is__eof___rarg___lambda__1), 4, 3); -lean::closure_set(x_9, 0, x_1); -lean::closure_set(x_9, 1, x_2); -lean::closure_set(x_9, 2, x_3); -x_10 = lean::apply_4(x_6, lean::box(0), lean::box(0), x_8, x_9); -return x_10; +obj* x_2; obj* x_3; +x_2 = lean::alloc_closure(reinterpret_cast(l_io_prim_handle_is__eof___boxed), 2, 1); +lean::closure_set(x_2, 0, x_1); +x_3 = lean::apply_2(x_0, lean::box(0), x_2); +return x_3; } } obj* l_io_fs_handle_is__eof(obj* x_0, obj* x_1) { _start: { obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_is__eof___rarg), 5, 0); +x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_is__eof___rarg), 2, 0); return x_2; } } @@ -1093,28 +735,21 @@ lean::dec(x_1); return x_2; } } -obj* l_io_fs_handle_flush___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { +obj* l_io_fs_handle_flush___rarg(obj* x_0, obj* x_1) { _start: { -obj* x_5; obj* x_6; obj* x_8; obj* x_9; obj* x_10; -x_5 = lean::alloc_closure(reinterpret_cast(l_io_prim_handle_flush___boxed), 2, 1); -lean::closure_set(x_5, 0, x_4); -x_6 = lean::cnstr_get(x_3, 1); -lean::inc(x_6); -x_8 = lean::apply_2(x_0, lean::box(0), x_5); -x_9 = lean::alloc_closure(reinterpret_cast(l_io_prim_lift__eio___rarg___lambda__1), 4, 3); -lean::closure_set(x_9, 0, x_1); -lean::closure_set(x_9, 1, x_2); -lean::closure_set(x_9, 2, x_3); -x_10 = lean::apply_4(x_6, lean::box(0), lean::box(0), x_8, x_9); -return x_10; +obj* x_2; obj* x_3; +x_2 = lean::alloc_closure(reinterpret_cast(l_io_prim_handle_flush___boxed), 2, 1); +lean::closure_set(x_2, 0, x_1); +x_3 = lean::apply_2(x_0, lean::box(0), x_2); +return x_3; } } obj* l_io_fs_handle_flush(obj* x_0, obj* x_1) { _start: { obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_flush___rarg), 5, 0); +x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_flush___rarg), 2, 0); return x_2; } } @@ -1128,28 +763,21 @@ lean::dec(x_1); return x_2; } } -obj* l_io_fs_handle_close___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { +obj* l_io_fs_handle_close___rarg(obj* x_0, obj* x_1) { _start: { -obj* x_5; obj* x_6; obj* x_8; obj* x_9; obj* x_10; -x_5 = lean::alloc_closure(reinterpret_cast(l_io_prim_handle_flush___boxed), 2, 1); -lean::closure_set(x_5, 0, x_4); -x_6 = lean::cnstr_get(x_3, 1); -lean::inc(x_6); -x_8 = lean::apply_2(x_0, lean::box(0), x_5); -x_9 = lean::alloc_closure(reinterpret_cast(l_io_prim_lift__eio___rarg___lambda__1), 4, 3); -lean::closure_set(x_9, 0, x_1); -lean::closure_set(x_9, 1, x_2); -lean::closure_set(x_9, 2, x_3); -x_10 = lean::apply_4(x_6, lean::box(0), lean::box(0), x_8, x_9); -return x_10; +obj* x_2; obj* x_3; +x_2 = lean::alloc_closure(reinterpret_cast(l_io_prim_handle_flush___boxed), 2, 1); +lean::closure_set(x_2, 0, x_1); +x_3 = lean::apply_2(x_0, lean::box(0), x_2); +return x_3; } } obj* l_io_fs_handle_close(obj* x_0, obj* x_1) { _start: { obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_close___rarg), 5, 0); +x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_close___rarg), 2, 0); return x_2; } } @@ -1163,28 +791,21 @@ lean::dec(x_1); return x_2; } } -obj* l_io_fs_handle_get__line___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { +obj* l_io_fs_handle_get__line___rarg(obj* x_0, obj* x_1) { _start: { -obj* x_5; obj* x_6; obj* x_8; obj* x_9; obj* x_10; -x_5 = lean::alloc_closure(reinterpret_cast(l_io_prim_handle_get__line___boxed), 2, 1); -lean::closure_set(x_5, 0, x_4); -x_6 = lean::cnstr_get(x_3, 1); -lean::inc(x_6); -x_8 = lean::apply_2(x_0, lean::box(0), x_5); -x_9 = lean::alloc_closure(reinterpret_cast(l_io_prim_lift__eio___rarg___lambda__1), 4, 3); -lean::closure_set(x_9, 0, x_1); -lean::closure_set(x_9, 1, x_2); -lean::closure_set(x_9, 2, x_3); -x_10 = lean::apply_4(x_6, lean::box(0), lean::box(0), x_8, x_9); -return x_10; +obj* x_2; obj* x_3; +x_2 = lean::alloc_closure(reinterpret_cast(l_io_prim_handle_get__line___boxed), 2, 1); +lean::closure_set(x_2, 0, x_1); +x_3 = lean::apply_2(x_0, lean::box(0), x_2); +return x_3; } } obj* l_io_fs_handle_get__line(obj* x_0, obj* x_1) { _start: { obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_get__line___rarg), 5, 0); +x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_get__line___rarg), 2, 0); return x_2; } } @@ -1201,387 +822,155 @@ return x_2; obj* l_io_fs_handle_is__eof___at_io_fs_handle_read__to__end___spec__1(obj* x_0, obj* x_1) { _start: { -obj* x_2; obj* x_3; +obj* x_2; x_2 = lean_io_prim_handle_is_eof(x_0, x_1); -x_3 = lean::cnstr_get(x_2, 0); -lean::inc(x_3); -if (lean::obj_tag(x_3) == 0) -{ -obj* x_5; obj* x_7; obj* x_8; obj* x_10; obj* x_11; obj* x_12; -x_5 = lean::cnstr_get(x_2, 1); -if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); - x_7 = x_2; -} else { - lean::inc(x_5); - lean::dec(x_2); - x_7 = lean::box(0); -} -x_8 = lean::cnstr_get(x_3, 0); -if (lean::is_exclusive(x_3)) { - x_10 = x_3; -} else { - lean::inc(x_8); - lean::dec(x_3); - x_10 = lean::box(0); -} -if (lean::is_scalar(x_10)) { - x_11 = lean::alloc_cnstr(0, 1, 0); -} else { - x_11 = x_10; -} -lean::cnstr_set(x_11, 0, x_8); -if (lean::is_scalar(x_7)) { - x_12 = lean::alloc_cnstr(0, 2, 0); -} else { - x_12 = x_7; -} -lean::cnstr_set(x_12, 0, x_11); -lean::cnstr_set(x_12, 1, x_5); -return x_12; -} -else -{ -obj* x_13; obj* x_15; obj* x_16; obj* x_18; obj* x_19; obj* x_20; -x_13 = lean::cnstr_get(x_2, 1); -if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); - x_15 = x_2; -} else { - lean::inc(x_13); - lean::dec(x_2); - x_15 = lean::box(0); -} -x_16 = lean::cnstr_get(x_3, 0); -if (lean::is_exclusive(x_3)) { - x_18 = x_3; -} else { - lean::inc(x_16); - lean::dec(x_3); - x_18 = lean::box(0); -} -if (lean::is_scalar(x_18)) { - x_19 = lean::alloc_cnstr(1, 1, 0); -} else { - x_19 = x_18; -} -lean::cnstr_set(x_19, 0, x_16); -if (lean::is_scalar(x_15)) { - x_20 = lean::alloc_cnstr(0, 2, 0); -} else { - x_20 = x_15; -} -lean::cnstr_set(x_20, 0, x_19); -lean::cnstr_set(x_20, 1, x_13); -return x_20; -} +return x_2; } } obj* l_io_fs_handle_get__line___at_io_fs_handle_read__to__end___spec__2(obj* x_0, obj* x_1) { _start: { -obj* x_2; obj* x_3; +obj* x_2; x_2 = lean_io_prim_handle_get_line(x_0, x_1); -x_3 = lean::cnstr_get(x_2, 0); -lean::inc(x_3); -if (lean::obj_tag(x_3) == 0) -{ -obj* x_5; obj* x_7; obj* x_8; obj* x_10; obj* x_11; obj* x_12; -x_5 = lean::cnstr_get(x_2, 1); -if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); - x_7 = x_2; -} else { - lean::inc(x_5); - lean::dec(x_2); - x_7 = lean::box(0); -} -x_8 = lean::cnstr_get(x_3, 0); -if (lean::is_exclusive(x_3)) { - x_10 = x_3; -} else { - lean::inc(x_8); - lean::dec(x_3); - x_10 = lean::box(0); -} -if (lean::is_scalar(x_10)) { - x_11 = lean::alloc_cnstr(0, 1, 0); -} else { - x_11 = x_10; -} -lean::cnstr_set(x_11, 0, x_8); -if (lean::is_scalar(x_7)) { - x_12 = lean::alloc_cnstr(0, 2, 0); -} else { - x_12 = x_7; -} -lean::cnstr_set(x_12, 0, x_11); -lean::cnstr_set(x_12, 1, x_5); -return x_12; -} -else -{ -obj* x_13; obj* x_15; obj* x_16; obj* x_18; obj* x_19; obj* x_20; -x_13 = lean::cnstr_get(x_2, 1); -if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); - x_15 = x_2; -} else { - lean::inc(x_13); - lean::dec(x_2); - x_15 = lean::box(0); -} -x_16 = lean::cnstr_get(x_3, 0); -if (lean::is_exclusive(x_3)) { - x_18 = x_3; -} else { - lean::inc(x_16); - lean::dec(x_3); - x_18 = lean::box(0); -} -if (lean::is_scalar(x_18)) { - x_19 = lean::alloc_cnstr(1, 1, 0); -} else { - x_19 = x_18; -} -lean::cnstr_set(x_19, 0, x_16); -if (lean::is_scalar(x_15)) { - x_20 = lean::alloc_cnstr(0, 2, 0); -} else { - x_20 = x_15; -} -lean::cnstr_set(x_20, 0, x_19); -lean::cnstr_set(x_20, 1, x_13); -return x_20; +return x_2; } } -} -obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__4___lambda__1(obj* x_0, obj* x_1, obj* x_2) { +obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__3___lambda__1(obj* x_0, obj* x_1, obj* x_2) { _start: { -obj* x_3; obj* x_4; obj* x_6; obj* x_7; -x_6 = l_io_fs_handle_is__eof___at_io_fs_handle_read__to__end___spec__1(x_0, x_2); -x_7 = lean::cnstr_get(x_6, 0); -lean::inc(x_7); -if (lean::obj_tag(x_7) == 0) -{ -obj* x_10; obj* x_13; obj* x_15; obj* x_16; -lean::dec(x_1); -x_10 = lean::cnstr_get(x_6, 1); -lean::inc(x_10); -lean::dec(x_6); -x_13 = lean::cnstr_get(x_7, 0); -if (lean::is_exclusive(x_7)) { - x_15 = x_7; -} else { - lean::inc(x_13); - lean::dec(x_7); - x_15 = lean::box(0); -} -if (lean::is_scalar(x_15)) { - x_16 = lean::alloc_cnstr(0, 1, 0); -} else { - x_16 = x_15; -} -lean::cnstr_set(x_16, 0, x_13); -x_3 = x_16; -x_4 = x_10; -goto lbl_5; -} -else -{ -obj* x_17; obj* x_19; uint8 x_20; -x_17 = lean::cnstr_get(x_7, 0); -if (lean::is_exclusive(x_7)) { - lean::cnstr_set(x_7, 0, lean::box(0)); - x_19 = x_7; -} else { - lean::inc(x_17); - lean::dec(x_7); - x_19 = lean::box(0); -} -x_20 = lean::unbox(x_17); -if (x_20 == 0) -{ -obj* x_22; obj* x_25; obj* x_26; -lean::dec(x_19); -x_22 = lean::cnstr_get(x_6, 1); -lean::inc(x_22); -lean::dec(x_6); -x_25 = l_io_fs_handle_get__line___at_io_fs_handle_read__to__end___spec__2(x_0, x_22); -x_26 = lean::cnstr_get(x_25, 0); -lean::inc(x_26); -if (lean::obj_tag(x_26) == 0) -{ -obj* x_29; obj* x_32; obj* x_34; obj* x_35; -lean::dec(x_1); -x_29 = lean::cnstr_get(x_25, 1); -lean::inc(x_29); -lean::dec(x_25); -x_32 = lean::cnstr_get(x_26, 0); -if (lean::is_exclusive(x_26)) { - x_34 = x_26; -} else { - lean::inc(x_32); - lean::dec(x_26); - x_34 = lean::box(0); -} -if (lean::is_scalar(x_34)) { - x_35 = lean::alloc_cnstr(0, 1, 0); -} else { - x_35 = x_34; -} -lean::cnstr_set(x_35, 0, x_32); -x_3 = x_35; -x_4 = x_29; -goto lbl_5; -} -else -{ -obj* x_36; obj* x_39; obj* x_41; obj* x_42; obj* x_44; obj* x_45; -x_36 = lean::cnstr_get(x_25, 1); -lean::inc(x_36); -lean::dec(x_25); -x_39 = lean::cnstr_get(x_26, 0); -if (lean::is_exclusive(x_26)) { - x_41 = x_26; -} else { - lean::inc(x_39); - lean::dec(x_26); - x_41 = lean::box(0); -} -x_42 = lean::string_append(x_1, x_39); -lean::dec(x_39); -x_44 = lean::alloc_cnstr(0, 1, 0); -lean::cnstr_set(x_44, 0, x_42); -if (lean::is_scalar(x_41)) { - x_45 = lean::alloc_cnstr(1, 1, 0); -} else { - x_45 = x_41; -} -lean::cnstr_set(x_45, 0, x_44); -x_3 = x_45; -x_4 = x_36; -goto lbl_5; -} -} -else -{ -obj* x_46; obj* x_49; obj* x_50; -x_46 = lean::cnstr_get(x_6, 1); -lean::inc(x_46); -lean::dec(x_6); -x_49 = lean::alloc_cnstr(1, 1, 0); -lean::cnstr_set(x_49, 0, x_1); -if (lean::is_scalar(x_19)) { - x_50 = lean::alloc_cnstr(1, 1, 0); -} else { - x_50 = x_19; -} -lean::cnstr_set(x_50, 0, x_49); -x_3 = x_50; -x_4 = x_46; -goto lbl_5; -} -} -lbl_5: -{ +obj* x_3; +x_3 = lean_io_prim_handle_is_eof(x_0, x_2); if (lean::obj_tag(x_3) == 0) { -obj* x_51; obj* x_53; obj* x_54; obj* x_55; obj* x_56; -x_51 = lean::cnstr_get(x_3, 0); +obj* x_4; uint8 x_6; +x_4 = lean::cnstr_get(x_3, 0); +lean::inc(x_4); +x_6 = lean::unbox(x_4); +if (x_6 == 0) +{ +obj* x_7; obj* x_9; obj* x_10; obj* x_11; obj* x_12; +x_7 = lean::cnstr_get(x_3, 1); if (lean::is_exclusive(x_3)) { - x_53 = x_3; + lean::cnstr_release(x_3, 0); + x_9 = x_3; } else { - lean::inc(x_51); + lean::inc(x_7); lean::dec(x_3); - x_53 = lean::box(0); + x_9 = lean::box(0); } -if (lean::is_scalar(x_53)) { - x_54 = lean::alloc_cnstr(0, 1, 0); +x_10 = lean::box(0); +if (lean::is_scalar(x_9)) { + x_11 = lean::alloc_cnstr(0, 2, 0); } else { - x_54 = x_53; + x_11 = x_9; } -lean::cnstr_set(x_54, 0, x_51); -x_55 = lean::alloc_cnstr(1, 1, 0); -lean::cnstr_set(x_55, 0, x_54); -x_56 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_56, 0, x_55); -lean::cnstr_set(x_56, 1, x_4); -return x_56; +lean::cnstr_set(x_11, 0, x_10); +lean::cnstr_set(x_11, 1, x_7); +x_12 = lean_io_prim_handle_get_line(x_0, x_11); +if (lean::obj_tag(x_12) == 0) +{ +obj* x_13; obj* x_15; obj* x_17; obj* x_18; obj* x_20; obj* x_21; +x_13 = lean::cnstr_get(x_12, 0); +x_15 = lean::cnstr_get(x_12, 1); +if (lean::is_exclusive(x_12)) { + x_17 = x_12; +} else { + lean::inc(x_13); + lean::inc(x_15); + lean::dec(x_12); + x_17 = lean::box(0); +} +x_18 = lean::string_append(x_1, x_13); +lean::dec(x_13); +x_20 = lean::alloc_cnstr(0, 1, 0); +lean::cnstr_set(x_20, 0, x_18); +if (lean::is_scalar(x_17)) { + x_21 = lean::alloc_cnstr(0, 2, 0); +} else { + x_21 = x_17; +} +lean::cnstr_set(x_21, 0, x_20); +lean::cnstr_set(x_21, 1, x_15); +return x_21; } else { -obj* x_57; obj* x_59; -x_57 = lean::cnstr_get(x_3, 0); -if (lean::is_exclusive(x_3)) { - lean::cnstr_set(x_3, 0, lean::box(0)); - x_59 = x_3; +obj* x_23; obj* x_25; obj* x_27; obj* x_28; +lean::dec(x_1); +x_23 = lean::cnstr_get(x_12, 0); +x_25 = lean::cnstr_get(x_12, 1); +if (lean::is_exclusive(x_12)) { + x_27 = x_12; } else { - lean::inc(x_57); - lean::dec(x_3); - x_59 = lean::box(0); + lean::inc(x_23); + lean::inc(x_25); + lean::dec(x_12); + x_27 = lean::box(0); } -if (lean::obj_tag(x_57) == 0) -{ -obj* x_61; obj* x_63; obj* x_64; obj* x_65; -lean::dec(x_59); -x_61 = lean::cnstr_get(x_57, 0); -if (lean::is_exclusive(x_57)) { - x_63 = x_57; +if (lean::is_scalar(x_27)) { + x_28 = lean::alloc_cnstr(1, 2, 0); } else { - lean::inc(x_61); - lean::dec(x_57); - x_63 = lean::box(0); + x_28 = x_27; } -if (lean::is_scalar(x_63)) { - x_64 = lean::alloc_cnstr(0, 1, 0); -} else { - x_64 = x_63; +lean::cnstr_set(x_28, 0, x_23); +lean::cnstr_set(x_28, 1, x_25); +return x_28; } -lean::cnstr_set(x_64, 0, x_61); -x_65 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_65, 0, x_64); -lean::cnstr_set(x_65, 1, x_4); -return x_65; } else { -obj* x_66; obj* x_68; obj* x_69; obj* x_70; obj* x_71; -x_66 = lean::cnstr_get(x_57, 0); -if (lean::is_exclusive(x_57)) { - x_68 = x_57; +obj* x_29; obj* x_31; obj* x_32; obj* x_33; +x_29 = lean::cnstr_get(x_3, 1); +if (lean::is_exclusive(x_3)) { + lean::cnstr_release(x_3, 0); + x_31 = x_3; } else { - lean::inc(x_66); - lean::dec(x_57); - x_68 = lean::box(0); + lean::inc(x_29); + lean::dec(x_3); + x_31 = lean::box(0); } -if (lean::is_scalar(x_59)) { - x_69 = lean::alloc_cnstr(1, 1, 0); +x_32 = lean::alloc_cnstr(1, 1, 0); +lean::cnstr_set(x_32, 0, x_1); +if (lean::is_scalar(x_31)) { + x_33 = lean::alloc_cnstr(0, 2, 0); } else { - x_69 = x_59; + x_33 = x_31; } -lean::cnstr_set(x_69, 0, x_66); -if (lean::is_scalar(x_68)) { - x_70 = lean::alloc_cnstr(1, 1, 0); +lean::cnstr_set(x_33, 0, x_32); +lean::cnstr_set(x_33, 1, x_29); +return x_33; +} +} +else +{ +obj* x_35; obj* x_37; obj* x_39; obj* x_40; +lean::dec(x_1); +x_35 = lean::cnstr_get(x_3, 0); +x_37 = lean::cnstr_get(x_3, 1); +if (lean::is_exclusive(x_3)) { + x_39 = x_3; } else { - x_70 = x_68; + lean::inc(x_35); + lean::inc(x_37); + lean::dec(x_3); + x_39 = lean::box(0); } -lean::cnstr_set(x_70, 0, x_69); -x_71 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_71, 0, x_70); -lean::cnstr_set(x_71, 1, x_4); -return x_71; +if (lean::is_scalar(x_39)) { + x_40 = lean::alloc_cnstr(1, 2, 0); +} else { + x_40 = x_39; +} +lean::cnstr_set(x_40, 0, x_35); +lean::cnstr_set(x_40, 1, x_37); +return x_40; } } } -} -} -obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__4(obj* x_0, obj* x_1, obj* x_2) { +obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__3(obj* x_0, obj* x_1, obj* x_2) { _start: { obj* x_3; obj* x_4; obj* x_5; -x_3 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__4___lambda__1___boxed), 3, 1); +x_3 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__3___lambda__1___boxed), 3, 1); lean::closure_set(x_3, 0, x_0); x_4 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate__aux___rarg), 4, 1); lean::closure_set(x_4, 0, x_3); @@ -1589,38 +978,23 @@ x_5 = lean::fixpoint2(x_4, x_1, x_2); return x_5; } } -obj* l_io_prim_iterate__eio___at_io_fs_handle_read__to__end___spec__3(obj* x_0, obj* x_1, obj* x_2) { +obj* l_io_fs_handle_read__to__end___rarg(obj* x_0, obj* x_1) { _start: { -obj* x_3; -x_3 = l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__4(x_0, x_1, x_2); -return x_3; -} -} -obj* l_io_fs_handle_read__to__end___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { -_start: -{ -obj* x_5; obj* x_6; obj* x_7; obj* x_9; obj* x_10; obj* x_11; -x_5 = l_string_iterator_extract___main___closed__1; -x_6 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate__eio___at_io_fs_handle_read__to__end___spec__3), 3, 2); -lean::closure_set(x_6, 0, x_4); -lean::closure_set(x_6, 1, x_5); -x_7 = lean::cnstr_get(x_3, 1); -lean::inc(x_7); -x_9 = lean::apply_2(x_0, lean::box(0), x_6); -x_10 = lean::alloc_closure(reinterpret_cast(l_io_prim_lift__eio___rarg___lambda__1), 4, 3); -lean::closure_set(x_10, 0, x_1); -lean::closure_set(x_10, 1, x_2); -lean::closure_set(x_10, 2, x_3); -x_11 = lean::apply_4(x_7, lean::box(0), lean::box(0), x_9, x_10); -return x_11; +obj* x_2; obj* x_3; obj* x_4; +x_2 = l_string_iterator_extract___main___closed__1; +x_3 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__3), 3, 2); +lean::closure_set(x_3, 0, x_1); +lean::closure_set(x_3, 1, x_2); +x_4 = lean::apply_2(x_0, lean::box(0), x_3); +return x_4; } } obj* l_io_fs_handle_read__to__end(obj* x_0, obj* x_1) { _start: { obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_read__to__end___rarg), 5, 0); +x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_handle_read__to__end___rarg), 2, 0); return x_2; } } @@ -1642,11 +1016,11 @@ lean::dec(x_0); return x_2; } } -obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__4___lambda__1___boxed(obj* x_0, obj* x_1, obj* x_2) { +obj* l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__3___lambda__1___boxed(obj* x_0, obj* x_1, obj* x_2) { _start: { obj* x_3; -x_3 = l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__4___lambda__1(x_0, x_1, x_2); +x_3 = l_io_prim_iterate___at_io_fs_handle_read__to__end___spec__3___lambda__1(x_0, x_1, x_2); lean::dec(x_0); return x_3; } @@ -1675,70 +1049,59 @@ x_9 = lean::apply_2(x_6, lean::box(0), x_1); return x_9; } } -obj* l_io_fs_read__file___rarg___lambda__2(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { +obj* l_io_fs_read__file___rarg___lambda__2(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4) { _start: { -obj* x_8; obj* x_9; obj* x_10; -lean::inc(x_3); -x_8 = l_io_fs_handle_close___rarg(x_0, x_1, x_2, x_3, x_4); -x_9 = lean::alloc_closure(reinterpret_cast(l_io_fs_read__file___rarg___lambda__1___boxed), 3, 2); -lean::closure_set(x_9, 0, x_3); -lean::closure_set(x_9, 1, x_6); -x_10 = lean::apply_4(x_5, lean::box(0), lean::box(0), x_8, x_9); -return x_10; +obj* x_5; obj* x_6; obj* x_7; +x_5 = l_io_fs_handle_close___rarg(x_0, x_1); +x_6 = lean::alloc_closure(reinterpret_cast(l_io_fs_read__file___rarg___lambda__1___boxed), 3, 2); +lean::closure_set(x_6, 0, x_2); +lean::closure_set(x_6, 1, x_4); +x_7 = lean::apply_4(x_3, lean::box(0), lean::box(0), x_5, x_6); +return x_7; } } -obj* l_io_fs_read__file___rarg___lambda__3(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5) { +obj* l_io_fs_read__file___rarg___lambda__3(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { _start: { -obj* x_11; obj* x_13; obj* x_14; -lean::inc(x_5); +obj* x_6; obj* x_8; obj* x_9; lean::inc(x_3); -lean::inc(x_2); -lean::inc(x_1); lean::inc(x_0); -x_11 = l_io_fs_handle_read__to__end___rarg(x_0, x_1, x_2, x_3, x_5); +x_6 = l_io_fs_handle_read__to__end___rarg(x_0, x_3); +lean::inc(x_2); +x_8 = lean::alloc_closure(reinterpret_cast(l_io_fs_read__file___rarg___lambda__2), 5, 4); +lean::closure_set(x_8, 0, x_0); +lean::closure_set(x_8, 1, x_3); +lean::closure_set(x_8, 2, x_1); +lean::closure_set(x_8, 3, x_2); +x_9 = lean::apply_4(x_2, lean::box(0), lean::box(0), x_6, x_8); +return x_9; +} +} +obj* l_io_fs_read__file___rarg(obj* x_0, obj* x_1, obj* x_2, uint8 x_3) { +_start: +{ +obj* x_4; uint8 x_6; obj* x_8; obj* x_10; obj* x_11; +x_4 = lean::cnstr_get(x_0, 1); lean::inc(x_4); -x_13 = lean::alloc_closure(reinterpret_cast(l_io_fs_read__file___rarg___lambda__2), 7, 6); -lean::closure_set(x_13, 0, x_0); -lean::closure_set(x_13, 1, x_1); -lean::closure_set(x_13, 2, x_2); -lean::closure_set(x_13, 3, x_3); -lean::closure_set(x_13, 4, x_5); -lean::closure_set(x_13, 5, x_4); -x_14 = lean::apply_4(x_4, lean::box(0), lean::box(0), x_11, x_13); -return x_14; -} -} -obj* l_io_fs_read__file___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, uint8 x_5) { -_start: -{ -obj* x_6; uint8 x_8; obj* x_13; obj* x_15; obj* x_16; -x_6 = lean::cnstr_get(x_3, 1); -lean::inc(x_6); -x_8 = 0; -lean::inc(x_3); -lean::inc(x_2); +x_6 = 0; lean::inc(x_1); -lean::inc(x_0); -x_13 = l_io_fs_handle_mk___rarg(x_0, x_1, x_2, x_3, x_4, x_8, x_5); -lean::inc(x_6); -x_15 = lean::alloc_closure(reinterpret_cast(l_io_fs_read__file___rarg___lambda__3), 6, 5); -lean::closure_set(x_15, 0, x_0); -lean::closure_set(x_15, 1, x_1); -lean::closure_set(x_15, 2, x_2); -lean::closure_set(x_15, 3, x_3); -lean::closure_set(x_15, 4, x_6); -x_16 = lean::apply_4(x_6, lean::box(0), lean::box(0), x_13, x_15); -return x_16; +x_8 = l_io_fs_handle_mk___rarg(x_1, x_2, x_6, x_3); +lean::inc(x_4); +x_10 = lean::alloc_closure(reinterpret_cast(l_io_fs_read__file___rarg___lambda__3), 4, 3); +lean::closure_set(x_10, 0, x_1); +lean::closure_set(x_10, 1, x_0); +lean::closure_set(x_10, 2, x_4); +x_11 = lean::apply_4(x_4, lean::box(0), lean::box(0), x_8, x_10); +return x_11; } } -obj* l_io_fs_read__file(obj* x_0, obj* x_1) { +obj* l_io_fs_read__file(obj* x_0) { _start: { -obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l_io_fs_read__file___rarg___boxed), 6, 0); -return x_2; +obj* x_1; +x_1 = lean::alloc_closure(reinterpret_cast(l_io_fs_read__file___rarg___boxed), 4, 0); +return x_1; } } obj* l_io_fs_read__file___rarg___lambda__1___boxed(obj* x_0, obj* x_1, obj* x_2) { @@ -1750,197 +1113,48 @@ lean::dec(x_2); return x_3; } } -obj* l_io_fs_read__file___rarg___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5) { +obj* l_io_fs_read__file___rarg___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { _start: { -uint8 x_6; obj* x_7; -x_6 = lean::unbox(x_5); -x_7 = l_io_fs_read__file___rarg(x_0, x_1, x_2, x_3, x_4, x_6); -return x_7; +uint8 x_4; obj* x_5; +x_4 = lean::unbox(x_3); +x_5 = l_io_fs_read__file___rarg(x_0, x_1, x_2, x_4); +return x_5; } } -obj* l_io_fs_read__file___boxed(obj* x_0, obj* x_1) { +obj* l_io_fs_read__file___boxed(obj* x_0) { +_start: +{ +obj* x_1; +x_1 = l_io_fs_read__file(x_0); +lean::dec(x_0); +return x_1; +} +} +obj* l___private_init_io_1__put__str___at_has__repr_has__eval___spec__3(obj* x_0, obj* x_1) { _start: { obj* x_2; -x_2 = l_io_fs_read__file(x_0, x_1); -lean::dec(x_0); -lean::dec(x_1); -return x_2; -} -} -obj* l_from__eio(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; obj* x_3; obj* x_5; obj* x_6; obj* x_7; -x_2 = lean::apply_1(x_0, x_1); -x_3 = lean::cnstr_get(x_2, 1); -if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); - x_5 = x_2; -} else { - lean::inc(x_3); - lean::dec(x_2); - x_5 = lean::box(0); -} -x_6 = lean::box(0); -if (lean::is_scalar(x_5)) { - x_7 = lean::alloc_cnstr(0, 2, 0); -} else { - x_7 = x_5; -} -lean::cnstr_set(x_7, 0, x_6); -lean::cnstr_set(x_7, 1, x_3); -return x_7; -} -} -obj* l___private_init_io_1__put__str___at_io_println_x_27___spec__3(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; obj* x_3; x_2 = lean_io_prim_put_str(x_0, x_1); -x_3 = lean::cnstr_get(x_2, 0); -lean::inc(x_3); -if (lean::obj_tag(x_3) == 0) -{ -obj* x_5; obj* x_7; obj* x_8; obj* x_10; obj* x_11; obj* x_12; -x_5 = lean::cnstr_get(x_2, 1); -if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); - x_7 = x_2; -} else { - lean::inc(x_5); - lean::dec(x_2); - x_7 = lean::box(0); -} -x_8 = lean::cnstr_get(x_3, 0); -if (lean::is_exclusive(x_3)) { - x_10 = x_3; -} else { - lean::inc(x_8); - lean::dec(x_3); - x_10 = lean::box(0); -} -if (lean::is_scalar(x_10)) { - x_11 = lean::alloc_cnstr(0, 1, 0); -} else { - x_11 = x_10; -} -lean::cnstr_set(x_11, 0, x_8); -if (lean::is_scalar(x_7)) { - x_12 = lean::alloc_cnstr(0, 2, 0); -} else { - x_12 = x_7; -} -lean::cnstr_set(x_12, 0, x_11); -lean::cnstr_set(x_12, 1, x_5); -return x_12; -} -else -{ -obj* x_13; obj* x_15; obj* x_16; obj* x_18; obj* x_19; obj* x_20; -x_13 = lean::cnstr_get(x_2, 1); -if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); - x_15 = x_2; -} else { - lean::inc(x_13); - lean::dec(x_2); - x_15 = lean::box(0); -} -x_16 = lean::cnstr_get(x_3, 0); -if (lean::is_exclusive(x_3)) { - x_18 = x_3; -} else { - lean::inc(x_16); - lean::dec(x_3); - x_18 = lean::box(0); -} -if (lean::is_scalar(x_18)) { - x_19 = lean::alloc_cnstr(1, 1, 0); -} else { - x_19 = x_18; -} -lean::cnstr_set(x_19, 0, x_16); -if (lean::is_scalar(x_15)) { - x_20 = lean::alloc_cnstr(0, 2, 0); -} else { - x_20 = x_15; -} -lean::cnstr_set(x_20, 0, x_19); -lean::cnstr_set(x_20, 1, x_13); -return x_20; -} -} -} -obj* l_io_print___at_io_println_x_27___spec__2(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; -x_2 = l___private_init_io_1__put__str___at_io_println_x_27___spec__3(x_0, x_1); return x_2; } } -obj* l_io_println___at_io_println_x_27___spec__1(obj* x_0, obj* x_1) { +obj* l_io_print___at_has__repr_has__eval___spec__2(obj* x_0, obj* x_1) { _start: { -obj* x_2; obj* x_3; -x_2 = l___private_init_io_1__put__str___at_io_println_x_27___spec__3(x_0, x_1); -x_3 = lean::cnstr_get(x_2, 0); -lean::inc(x_3); -if (lean::obj_tag(x_3) == 0) -{ -obj* x_5; obj* x_7; obj* x_8; obj* x_10; obj* x_11; obj* x_12; -x_5 = lean::cnstr_get(x_2, 1); -if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); - x_7 = x_2; -} else { - lean::inc(x_5); - lean::dec(x_2); - x_7 = lean::box(0); -} -x_8 = lean::cnstr_get(x_3, 0); -if (lean::is_exclusive(x_3)) { - x_10 = x_3; -} else { - lean::inc(x_8); - lean::dec(x_3); - x_10 = lean::box(0); -} -if (lean::is_scalar(x_10)) { - x_11 = lean::alloc_cnstr(0, 1, 0); -} else { - x_11 = x_10; -} -lean::cnstr_set(x_11, 0, x_8); -if (lean::is_scalar(x_7)) { - x_12 = lean::alloc_cnstr(0, 2, 0); -} else { - x_12 = x_7; -} -lean::cnstr_set(x_12, 0, x_11); -lean::cnstr_set(x_12, 1, x_5); -return x_12; -} -else -{ -obj* x_14; obj* x_17; obj* x_18; -lean::dec(x_3); -x_14 = lean::cnstr_get(x_2, 1); -lean::inc(x_14); -lean::dec(x_2); -x_17 = l_io_println___rarg___closed__1; -x_18 = l___private_init_io_1__put__str___at_io_println_x_27___spec__3(x_17, x_14); -return x_18; +obj* x_2; +x_2 = lean_io_prim_put_str(x_0, x_1); +return x_2; } } -} -obj* l_io_println_x_27(obj* x_0, obj* x_1) { +obj* l_io_println___at_has__repr_has__eval___spec__1(obj* x_0, obj* x_1) { _start: { -obj* x_2; obj* x_3; obj* x_5; obj* x_6; obj* x_7; -x_2 = l_io_println___at_io_println_x_27___spec__1(x_0, x_1); +obj* x_2; +x_2 = lean_io_prim_put_str(x_0, x_1); +if (lean::obj_tag(x_2) == 0) +{ +obj* x_3; obj* x_5; obj* x_6; obj* x_7; obj* x_8; obj* x_9; x_3 = lean::cnstr_get(x_2, 1); if (lean::is_exclusive(x_2)) { lean::cnstr_release(x_2, 0); @@ -1958,51 +1172,40 @@ if (lean::is_scalar(x_5)) { } lean::cnstr_set(x_7, 0, x_6); lean::cnstr_set(x_7, 1, x_3); -return x_7; +x_8 = l_io_println___rarg___closed__1; +x_9 = lean_io_prim_put_str(x_8, x_7); +return x_9; } -} -obj* l___private_init_io_1__put__str___at_io_println_x_27___spec__3___boxed(obj* x_0, obj* x_1) { -_start: +else { -obj* x_2; -x_2 = l___private_init_io_1__put__str___at_io_println_x_27___spec__3(x_0, x_1); -lean::dec(x_0); -return x_2; +obj* x_10; obj* x_12; obj* x_14; obj* x_15; +x_10 = lean::cnstr_get(x_2, 0); +x_12 = lean::cnstr_get(x_2, 1); +if (lean::is_exclusive(x_2)) { + x_14 = x_2; +} else { + lean::inc(x_10); + lean::inc(x_12); + lean::dec(x_2); + x_14 = lean::box(0); } +if (lean::is_scalar(x_14)) { + x_15 = lean::alloc_cnstr(1, 2, 0); +} else { + x_15 = x_14; } -obj* l_io_print___at_io_println_x_27___spec__2___boxed(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; -x_2 = l_io_print___at_io_println_x_27___spec__2(x_0, x_1); -lean::dec(x_0); -return x_2; +lean::cnstr_set(x_15, 0, x_10); +lean::cnstr_set(x_15, 1, x_12); +return x_15; } } -obj* l_io_println___at_io_println_x_27___spec__1___boxed(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; -x_2 = l_io_println___at_io_println_x_27___spec__1(x_0, x_1); -lean::dec(x_0); -return x_2; -} -} -obj* l_io_println_x_27___boxed(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; -x_2 = l_io_println_x_27(x_0, x_1); -lean::dec(x_0); -return x_2; -} } obj* l_has__repr_has__eval___rarg(obj* x_0, obj* x_1, obj* x_2) { _start: { obj* x_3; obj* x_4; x_3 = lean::apply_1(x_0, x_1); -x_4 = l_io_println_x_27(x_3, x_2); +x_4 = l_io_println___at_has__repr_has__eval___spec__1(x_3, x_2); lean::dec(x_3); return x_4; } @@ -2015,6 +1218,33 @@ x_1 = lean::alloc_closure(reinterpret_cast(l_has__repr_has__eval___rarg), return x_1; } } +obj* l___private_init_io_1__put__str___at_has__repr_has__eval___spec__3___boxed(obj* x_0, obj* x_1) { +_start: +{ +obj* x_2; +x_2 = l___private_init_io_1__put__str___at_has__repr_has__eval___spec__3(x_0, x_1); +lean::dec(x_0); +return x_2; +} +} +obj* l_io_print___at_has__repr_has__eval___spec__2___boxed(obj* x_0, obj* x_1) { +_start: +{ +obj* x_2; +x_2 = l_io_print___at_has__repr_has__eval___spec__2(x_0, x_1); +lean::dec(x_0); +return x_2; +} +} +obj* l_io_println___at_has__repr_has__eval___spec__1___boxed(obj* x_0, obj* x_1) { +_start: +{ +obj* x_2; +x_2 = l_io_println___at_has__repr_has__eval___spec__1(x_0, x_1); +lean::dec(x_0); +return x_2; +} +} obj* l_has__repr_has__eval___boxed(obj* x_0) { _start: { @@ -2027,15 +1257,55 @@ return x_1; obj* l_io_has__eval___rarg(obj* x_0, obj* x_1, obj* x_2) { _start: { -obj* x_3; obj* x_4; obj* x_6; obj* x_9; +obj* x_3; x_3 = lean::apply_1(x_1, x_2); +if (lean::obj_tag(x_3) == 0) +{ +obj* x_4; obj* x_6; obj* x_8; obj* x_9; obj* x_10; obj* x_11; x_4 = lean::cnstr_get(x_3, 0); -lean::inc(x_4); x_6 = lean::cnstr_get(x_3, 1); -lean::inc(x_6); -lean::dec(x_3); -x_9 = lean::apply_2(x_0, x_4, x_6); -return x_9; +if (lean::is_exclusive(x_3)) { + x_8 = x_3; +} else { + lean::inc(x_4); + lean::inc(x_6); + lean::dec(x_3); + x_8 = lean::box(0); +} +x_9 = lean::box(0); +if (lean::is_scalar(x_8)) { + x_10 = lean::alloc_cnstr(0, 2, 0); +} else { + x_10 = x_8; +} +lean::cnstr_set(x_10, 0, x_9); +lean::cnstr_set(x_10, 1, x_6); +x_11 = lean::apply_2(x_0, x_4, x_10); +return x_11; +} +else +{ +obj* x_13; obj* x_15; obj* x_17; obj* x_18; +lean::dec(x_0); +x_13 = lean::cnstr_get(x_3, 0); +x_15 = lean::cnstr_get(x_3, 1); +if (lean::is_exclusive(x_3)) { + x_17 = x_3; +} else { + lean::inc(x_13); + lean::inc(x_15); + lean::dec(x_3); + x_17 = lean::box(0); +} +if (lean::is_scalar(x_17)) { + x_18 = lean::alloc_cnstr(1, 2, 0); +} else { + x_18 = x_17; +} +lean::cnstr_set(x_18, 0, x_13); +lean::cnstr_set(x_18, 1, x_15); +return x_18; +} } } obj* l_io_has__eval(obj* x_0) { @@ -2063,161 +1333,20 @@ x_2 = lean::apply_1(x_0, x_1); return x_2; } } -obj* _init_l_eio_has__eval___rarg___closed__1() { -_start: -{ -obj* x_0; -x_0 = lean::mk_string("Error: "); -return x_0; -} -} -obj* l_eio_has__eval___rarg(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; obj* x_5; -x_4 = lean::apply_1(x_2, x_3); -x_5 = lean::cnstr_get(x_4, 0); -lean::inc(x_5); -if (lean::obj_tag(x_5) == 0) -{ -obj* x_8; obj* x_11; obj* x_14; obj* x_15; obj* x_16; obj* x_18; -lean::dec(x_1); -x_8 = lean::cnstr_get(x_4, 1); -lean::inc(x_8); -lean::dec(x_4); -x_11 = lean::cnstr_get(x_5, 0); -lean::inc(x_11); -lean::dec(x_5); -x_14 = lean::apply_1(x_0, x_11); -x_15 = l_eio_has__eval___rarg___closed__1; -x_16 = lean::string_append(x_15, x_14); -lean::dec(x_14); -x_18 = l_io_println_x_27(x_16, x_8); -lean::dec(x_16); -return x_18; -} -else -{ -obj* x_21; obj* x_24; obj* x_27; -lean::dec(x_0); -x_21 = lean::cnstr_get(x_4, 1); -lean::inc(x_21); -lean::dec(x_4); -x_24 = lean::cnstr_get(x_5, 0); -lean::inc(x_24); -lean::dec(x_5); -x_27 = lean::apply_2(x_1, x_24, x_21); -return x_27; -} -} -} -obj* l_eio_has__eval(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; -x_2 = lean::alloc_closure(reinterpret_cast(l_eio_has__eval___rarg), 4, 0); -return x_2; -} -} -obj* l_eio_has__eval___boxed(obj* x_0, obj* x_1) { -_start: -{ -obj* x_2; -x_2 = l_eio_has__eval(x_0, x_1); -lean::dec(x_0); -lean::dec(x_1); -return x_2; -} -} -obj* l_eio__unit_has__eval___rarg(obj* x_0, obj* x_1, obj* x_2) { -_start: -{ -obj* x_3; obj* x_4; -x_3 = lean::apply_1(x_1, x_2); -x_4 = lean::cnstr_get(x_3, 0); -lean::inc(x_4); -if (lean::obj_tag(x_4) == 0) -{ -obj* x_6; obj* x_9; obj* x_12; obj* x_13; obj* x_14; obj* x_16; -x_6 = lean::cnstr_get(x_3, 1); -lean::inc(x_6); -lean::dec(x_3); -x_9 = lean::cnstr_get(x_4, 0); -lean::inc(x_9); -lean::dec(x_4); -x_12 = lean::apply_1(x_0, x_9); -x_13 = l_eio_has__eval___rarg___closed__1; -x_14 = lean::string_append(x_13, x_12); -lean::dec(x_12); -x_16 = l_io_println_x_27(x_14, x_6); -lean::dec(x_14); -return x_16; -} -else -{ -obj* x_20; obj* x_22; obj* x_23; obj* x_24; -lean::dec(x_4); -lean::dec(x_0); -x_20 = lean::cnstr_get(x_3, 1); -if (lean::is_exclusive(x_3)) { - lean::cnstr_release(x_3, 0); - x_22 = x_3; -} else { - lean::inc(x_20); - lean::dec(x_3); - x_22 = lean::box(0); -} -x_23 = lean::box(0); -if (lean::is_scalar(x_22)) { - x_24 = lean::alloc_cnstr(0, 2, 0); -} else { - x_24 = x_22; -} -lean::cnstr_set(x_24, 0, x_23); -lean::cnstr_set(x_24, 1, x_20); -return x_24; -} -} -} -obj* l_eio__unit_has__eval(obj* x_0) { -_start: -{ -obj* x_1; -x_1 = lean::alloc_closure(reinterpret_cast(l_eio__unit_has__eval___rarg), 3, 0); -return x_1; -} -} -obj* l_eio__unit_has__eval___boxed(obj* x_0) { -_start: -{ -obj* x_1; -x_1 = l_eio__unit_has__eval(x_0); -lean::dec(x_0); -return x_1; -} -} -void initialize_init_control_state(); -void initialize_init_control_except(); +void initialize_init_control_estate(); void initialize_init_data_string_basic(); void initialize_init_fix(); static bool _G_initialized = false; void initialize_init_io() { if (_G_initialized) return; _G_initialized = true; - initialize_init_control_state(); - initialize_init_control_except(); + initialize_init_control_estate(); initialize_init_data_string_basic(); initialize_init_fix(); - l_io_monad = _init_l_io_monad(); -lean::mark_persistent(l_io_monad); l_io_error_has__to__string = _init_l_io_error_has__to__string(); lean::mark_persistent(l_io_error_has__to__string); l_io_error_inhabited = _init_l_io_error_inhabited(); lean::mark_persistent(l_io_error_inhabited); - l_io_prim_eio__inh___rarg___closed__1 = _init_l_io_prim_eio__inh___rarg___closed__1(); -lean::mark_persistent(l_io_prim_eio__inh___rarg___closed__1); l_io_println___rarg___closed__1 = _init_l_io_println___rarg___closed__1(); lean::mark_persistent(l_io_println___rarg___closed__1); - l_eio_has__eval___rarg___closed__1 = _init_l_eio_has__eval___rarg___closed__1(); -lean::mark_persistent(l_eio_has__eval___rarg___closed__1); } diff --git a/src/boot/init/lean/frontend.cpp b/src/boot/init/lean/frontend.cpp index e9ab9ebb3d..1c5eb24fa0 100644 --- a/src/boot/init/lean/frontend.cpp +++ b/src/boot/init/lean/frontend.cpp @@ -14,6 +14,7 @@ typedef lean::uint32 uint32; typedef lean::uint64 uint64; #pragma GCC diagnostic ignored "-Wunused-label" #pragma GCC diagnostic ignored "-Wunused-but-set-variable" #endif +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___boxed(obj*, obj*, obj*, obj*, obj*, obj*, obj*); obj* l___private_init_io_1__put__str___at_lean_process__file___spec__3(obj*, obj*); obj* l_io_prim_iterate__aux___rarg(obj*, obj*, obj*, obj*); obj* l_list_mmap_x_27___main___at_lean_run__frontend___spec__2(obj*, obj*, obj*); @@ -22,7 +23,6 @@ obj* l_lean_expander_expand(obj*, obj*); extern obj* l_lean_elaborator_notation_elaborate___closed__1; extern obj* l_string_iterator_extract___main___closed__1; obj* l_lean_parser_mk__token__trie(obj*); -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4(obj*, obj*, uint8, obj*, obj*, obj*, obj*); obj* l_lean_process__file___lambda__1___closed__6; extern "C" obj* lean_io_prim_put_str(obj*, obj*); obj* l_lean_process__file___lambda__1___closed__3; @@ -30,68 +30,66 @@ obj* l_list_reverse___rarg(obj*); extern "C" obj* lean_name_mk_string(obj*, obj*); obj* l_list_mmap_x_27___main___at_lean_run__frontend___spec__4(obj*, obj*, obj*); uint8 l_lean_parser_syntax_is__of__kind___main(obj*, obj*); +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__2; obj* l_lean_parser_parse__command(obj*, obj*); obj* l_string_quote(obj*); +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__3(obj*, obj*, obj*, obj*); +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__3; extern obj* l_lean_expander_builtin__transformers; obj* l_lean_mk__config(obj*, obj*); +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4(obj*, obj*, uint8, obj*, obj*, obj*, obj*); +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__3___boxed(obj*, obj*, obj*, obj*); obj* l_lean_process__file___lambda__1___closed__5; obj* l_lean_process__file___lambda__1___closed__8; obj* lean_process_file(obj*, obj*, uint8, obj*, obj*); obj* l_lean_run__frontend(obj*, obj*, obj*, uint8, obj*, obj*); -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___boxed(obj*, obj*, obj*, obj*, obj*, obj*, obj*); namespace lean { obj* string_append(obj*, obj*); } +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__1(obj*, obj*, obj*); obj* l_lean_process__file___lambda__1___closed__2; obj* l_list_mmap_x_27___main___at_lean_run__frontend___spec__1(obj*, obj*, obj*); obj* l_lean_kvmap_set__bool(obj*, obj*, uint8); +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__1___boxed(obj*, obj*, obj*); obj* l_lean_process__file___closed__1; obj* l_lean_run__frontend___closed__1; extern obj* l_lean_parser_term_builtin__trailing__parsers_lean_parser_has__tokens; extern obj* l_lean_parser_term_builtin__leading__parsers; -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__3___boxed(obj*, obj*, obj*, obj*); obj* l_lean_process__file___lambda__1___closed__1; obj* l_lean_parser_tokens___rarg(obj*); obj* l_lean_process__file___closed__2; extern obj* l_lean_parser_module_eoi; obj* l_io_println___at_lean_process__file___spec__1___boxed(obj*, obj*); extern obj* l_lean_format_be___main___closed__1; -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__1___boxed(obj*, obj*, obj*); -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__2; obj* l_io_print___at_lean_process__file___spec__2___boxed(obj*, obj*); -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__1(obj*, obj*, obj*); -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__3(obj*, obj*, obj*, obj*); obj* l_io_println___at_lean_process__file___spec__1(obj*, obj*); extern obj* l_lean_options_mk; -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__1; obj* l_lean_process__file___lambda__1___boxed(obj*, obj*, obj*); -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__2___boxed(obj*, obj*, obj*); obj* l_lean_message_to__string(obj*); obj* l_lean_process__file___lambda__1___closed__7; -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__3; obj* l___private_init_io_1__put__str___at_lean_process__file___spec__3___boxed(obj*, obj*); obj* l_lean_file__map_from__string(obj*); extern obj* l_lean_parser_module_header_parser_lean_parser_has__tokens; +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__2(obj*, obj*, obj*); obj* l_lean_process__file___boxed(obj*, obj*, obj*, obj*, obj*); +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5(obj*, uint8, obj*, obj*, obj*, obj*, obj*); extern obj* l_lean_parser_term_builtin__leading__parsers_lean_parser_has__tokens; -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___boxed(obj*, obj*, obj*, obj*, obj*, obj*, obj*); +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__2___boxed(obj*, obj*, obj*); obj* l_lean_parser_parse__header(obj*); -obj* l_io_prim_iterate__eio___at_lean_run__frontend___spec__5(obj*, uint8, obj*, obj*, obj*, obj*, obj*); extern obj* l_lean_parser_command_builtin__command__parsers; -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__2(obj*, obj*, obj*); obj* l_list_mmap_x_27___main___at_lean_run__frontend___spec__1___closed__1; obj* l_lean_elaborator_mk__state(obj*, obj*, obj*); extern obj* l_lean_parser_command_builtin__command__parsers_lean_parser_has__tokens; extern obj* l_lean_parser_term_builtin__trailing__parsers; obj* l_nat_repr(obj*); -obj* l_io_prim_iterate__eio___at_lean_run__frontend___spec__5___boxed(obj*, obj*, obj*, obj*, obj*, obj*, obj*); obj* l_lean_elaborator_process__command(obj*, obj*, obj*); obj* l_lean_process__file___lambda__1___closed__9; +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__1; obj* l_io_print___at_lean_process__file___spec__2(obj*, obj*); obj* l_lean_file__map_to__position(obj*, obj*); obj* l_list_append___rarg(obj*, obj*); +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___boxed(obj*, obj*, obj*, obj*, obj*, obj*, obj*); obj* l_lean_process__file___lambda__1(uint8, obj*, obj*); -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6(obj*, uint8, obj*, obj*, obj*, obj*, obj*); obj* l_lean_profileit__pure___rarg(obj*, obj*, obj*, obj*); obj* l_lean_process__file___lambda__1___closed__4; obj* l_list_mmap_x_27___main___at_lean_run__frontend___spec__3(obj*, obj*, obj*); @@ -190,75 +188,130 @@ _start: { if (lean::obj_tag(x_1) == 0) { -obj* x_4; obj* x_5; +obj* x_4; obj* x_6; obj* x_7; obj* x_8; lean::dec(x_0); -x_4 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__1___closed__1; -x_5 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_5, 0, x_4); -lean::cnstr_set(x_5, 1, x_2); -return x_5; +x_4 = lean::cnstr_get(x_2, 1); +if (lean::is_exclusive(x_2)) { + lean::cnstr_release(x_2, 0); + x_6 = x_2; +} else { + lean::inc(x_4); + lean::dec(x_2); + x_6 = lean::box(0); +} +x_7 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__1___closed__1; +if (lean::is_scalar(x_6)) { + x_8 = lean::alloc_cnstr(0, 2, 0); +} else { + x_8 = x_6; +} +lean::cnstr_set(x_8, 0, x_7); +lean::cnstr_set(x_8, 1, x_4); +return x_8; } else { -obj* x_6; obj* x_8; obj* x_12; obj* x_13; -x_6 = lean::cnstr_get(x_1, 0); -lean::inc(x_6); -x_8 = lean::cnstr_get(x_1, 1); -lean::inc(x_8); +obj* x_9; obj* x_11; obj* x_15; +x_9 = lean::cnstr_get(x_1, 0); +lean::inc(x_9); +x_11 = lean::cnstr_get(x_1, 1); +lean::inc(x_11); lean::dec(x_1); lean::inc(x_0); -x_12 = lean::apply_2(x_0, x_6, x_2); -x_13 = lean::cnstr_get(x_12, 0); -lean::inc(x_13); -if (lean::obj_tag(x_13) == 0) +x_15 = lean::apply_2(x_0, x_9, x_2); +if (lean::obj_tag(x_15) == 0) { -obj* x_17; obj* x_19; obj* x_20; obj* x_22; obj* x_23; obj* x_24; -lean::dec(x_8); +obj* x_16; +x_16 = lean::cnstr_get(x_15, 0); +lean::inc(x_16); +if (lean::obj_tag(x_16) == 0) +{ +obj* x_20; obj* x_22; obj* x_23; obj* x_25; obj* x_26; obj* x_27; lean::dec(x_0); -x_17 = lean::cnstr_get(x_12, 1); -if (lean::is_exclusive(x_12)) { - lean::cnstr_release(x_12, 0); - x_19 = x_12; -} else { - lean::inc(x_17); - lean::dec(x_12); - x_19 = lean::box(0); -} -x_20 = lean::cnstr_get(x_13, 0); -if (lean::is_exclusive(x_13)) { - x_22 = x_13; +lean::dec(x_11); +x_20 = lean::cnstr_get(x_15, 1); +if (lean::is_exclusive(x_15)) { + lean::cnstr_release(x_15, 0); + x_22 = x_15; } else { lean::inc(x_20); - lean::dec(x_13); + lean::dec(x_15); x_22 = lean::box(0); } +x_23 = lean::cnstr_get(x_16, 0); +if (lean::is_exclusive(x_16)) { + x_25 = x_16; +} else { + lean::inc(x_23); + lean::dec(x_16); + x_25 = lean::box(0); +} +if (lean::is_scalar(x_25)) { + x_26 = lean::alloc_cnstr(0, 1, 0); +} else { + x_26 = x_25; +} +lean::cnstr_set(x_26, 0, x_23); if (lean::is_scalar(x_22)) { - x_23 = lean::alloc_cnstr(0, 1, 0); + x_27 = lean::alloc_cnstr(0, 2, 0); } else { - x_23 = x_22; + x_27 = x_22; } -lean::cnstr_set(x_23, 0, x_20); -if (lean::is_scalar(x_19)) { - x_24 = lean::alloc_cnstr(0, 2, 0); -} else { - x_24 = x_19; -} -lean::cnstr_set(x_24, 0, x_23); -lean::cnstr_set(x_24, 1, x_17); -return x_24; +lean::cnstr_set(x_27, 0, x_26); +lean::cnstr_set(x_27, 1, x_20); +return x_27; } else { -obj* x_26; -lean::dec(x_13); -x_26 = lean::cnstr_get(x_12, 1); -lean::inc(x_26); -lean::dec(x_12); -x_1 = x_8; -x_2 = x_26; +obj* x_29; obj* x_31; obj* x_32; obj* x_33; +lean::dec(x_16); +x_29 = lean::cnstr_get(x_15, 1); +if (lean::is_exclusive(x_15)) { + lean::cnstr_release(x_15, 0); + x_31 = x_15; +} else { + lean::inc(x_29); + lean::dec(x_15); + x_31 = lean::box(0); +} +x_32 = lean::box(0); +if (lean::is_scalar(x_31)) { + x_33 = lean::alloc_cnstr(0, 2, 0); +} else { + x_33 = x_31; +} +lean::cnstr_set(x_33, 0, x_32); +lean::cnstr_set(x_33, 1, x_29); +x_1 = x_11; +x_2 = x_33; goto _start; } } +else +{ +obj* x_37; obj* x_39; obj* x_41; obj* x_42; +lean::dec(x_0); +lean::dec(x_11); +x_37 = lean::cnstr_get(x_15, 0); +x_39 = lean::cnstr_get(x_15, 1); +if (lean::is_exclusive(x_15)) { + x_41 = x_15; +} else { + lean::inc(x_37); + lean::inc(x_39); + lean::dec(x_15); + x_41 = lean::box(0); +} +if (lean::is_scalar(x_41)) { + x_42 = lean::alloc_cnstr(1, 2, 0); +} else { + x_42 = x_41; +} +lean::cnstr_set(x_42, 0, x_37); +lean::cnstr_set(x_42, 1, x_39); +return x_42; +} +} } } obj* l_list_mmap_x_27___main___at_lean_run__frontend___spec__2(obj* x_0, obj* x_1, obj* x_2) { @@ -266,73 +319,84 @@ _start: { if (lean::obj_tag(x_1) == 0) { -obj* x_4; obj* x_5; +obj* x_4; obj* x_6; obj* x_7; obj* x_8; lean::dec(x_0); -x_4 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__1___closed__1; -x_5 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_5, 0, x_4); -lean::cnstr_set(x_5, 1, x_2); -return x_5; +x_4 = lean::cnstr_get(x_2, 1); +if (lean::is_exclusive(x_2)) { + lean::cnstr_release(x_2, 0); + x_6 = x_2; +} else { + lean::inc(x_4); + lean::dec(x_2); + x_6 = lean::box(0); +} +x_7 = lean::box(0); +if (lean::is_scalar(x_6)) { + x_8 = lean::alloc_cnstr(0, 2, 0); +} else { + x_8 = x_6; +} +lean::cnstr_set(x_8, 0, x_7); +lean::cnstr_set(x_8, 1, x_4); +return x_8; } else { -obj* x_6; obj* x_8; obj* x_12; obj* x_13; -x_6 = lean::cnstr_get(x_1, 0); -lean::inc(x_6); -x_8 = lean::cnstr_get(x_1, 1); -lean::inc(x_8); +obj* x_9; obj* x_11; obj* x_15; +x_9 = lean::cnstr_get(x_1, 0); +lean::inc(x_9); +x_11 = lean::cnstr_get(x_1, 1); +lean::inc(x_11); lean::dec(x_1); lean::inc(x_0); -x_12 = lean::apply_2(x_0, x_6, x_2); -x_13 = lean::cnstr_get(x_12, 0); -lean::inc(x_13); -if (lean::obj_tag(x_13) == 0) +x_15 = lean::apply_2(x_0, x_9, x_2); +if (lean::obj_tag(x_15) == 0) { -obj* x_17; obj* x_19; obj* x_20; obj* x_22; obj* x_23; obj* x_24; -lean::dec(x_8); -lean::dec(x_0); -x_17 = lean::cnstr_get(x_12, 1); -if (lean::is_exclusive(x_12)) { - lean::cnstr_release(x_12, 0); - x_19 = x_12; +obj* x_16; obj* x_18; obj* x_19; obj* x_20; +x_16 = lean::cnstr_get(x_15, 1); +if (lean::is_exclusive(x_15)) { + lean::cnstr_release(x_15, 0); + x_18 = x_15; } else { - lean::inc(x_17); - lean::dec(x_12); - x_19 = lean::box(0); + lean::inc(x_16); + lean::dec(x_15); + x_18 = lean::box(0); } -x_20 = lean::cnstr_get(x_13, 0); -if (lean::is_exclusive(x_13)) { - x_22 = x_13; +x_19 = lean::box(0); +if (lean::is_scalar(x_18)) { + x_20 = lean::alloc_cnstr(0, 2, 0); } else { - lean::inc(x_20); - lean::dec(x_13); - x_22 = lean::box(0); + x_20 = x_18; } -if (lean::is_scalar(x_22)) { - x_23 = lean::alloc_cnstr(0, 1, 0); -} else { - x_23 = x_22; -} -lean::cnstr_set(x_23, 0, x_20); -if (lean::is_scalar(x_19)) { - x_24 = lean::alloc_cnstr(0, 2, 0); -} else { - x_24 = x_19; -} -lean::cnstr_set(x_24, 0, x_23); -lean::cnstr_set(x_24, 1, x_17); -return x_24; +lean::cnstr_set(x_20, 0, x_19); +lean::cnstr_set(x_20, 1, x_16); +x_1 = x_11; +x_2 = x_20; +goto _start; } else { -obj* x_26; -lean::dec(x_13); -x_26 = lean::cnstr_get(x_12, 1); -lean::inc(x_26); -lean::dec(x_12); -x_1 = x_8; -x_2 = x_26; -goto _start; +obj* x_24; obj* x_26; obj* x_28; obj* x_29; +lean::dec(x_0); +lean::dec(x_11); +x_24 = lean::cnstr_get(x_15, 0); +x_26 = lean::cnstr_get(x_15, 1); +if (lean::is_exclusive(x_15)) { + x_28 = x_15; +} else { + lean::inc(x_24); + lean::inc(x_26); + lean::dec(x_15); + x_28 = lean::box(0); +} +if (lean::is_scalar(x_28)) { + x_29 = lean::alloc_cnstr(1, 2, 0); +} else { + x_29 = x_28; +} +lean::cnstr_set(x_29, 0, x_24); +lean::cnstr_set(x_29, 1, x_26); +return x_29; } } } @@ -342,73 +406,84 @@ _start: { if (lean::obj_tag(x_1) == 0) { -obj* x_4; obj* x_5; +obj* x_4; obj* x_6; obj* x_7; obj* x_8; lean::dec(x_0); -x_4 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__1___closed__1; -x_5 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_5, 0, x_4); -lean::cnstr_set(x_5, 1, x_2); -return x_5; +x_4 = lean::cnstr_get(x_2, 1); +if (lean::is_exclusive(x_2)) { + lean::cnstr_release(x_2, 0); + x_6 = x_2; +} else { + lean::inc(x_4); + lean::dec(x_2); + x_6 = lean::box(0); +} +x_7 = lean::box(0); +if (lean::is_scalar(x_6)) { + x_8 = lean::alloc_cnstr(0, 2, 0); +} else { + x_8 = x_6; +} +lean::cnstr_set(x_8, 0, x_7); +lean::cnstr_set(x_8, 1, x_4); +return x_8; } else { -obj* x_6; obj* x_8; obj* x_12; obj* x_13; -x_6 = lean::cnstr_get(x_1, 0); -lean::inc(x_6); -x_8 = lean::cnstr_get(x_1, 1); -lean::inc(x_8); +obj* x_9; obj* x_11; obj* x_15; +x_9 = lean::cnstr_get(x_1, 0); +lean::inc(x_9); +x_11 = lean::cnstr_get(x_1, 1); +lean::inc(x_11); lean::dec(x_1); lean::inc(x_0); -x_12 = lean::apply_2(x_0, x_6, x_2); -x_13 = lean::cnstr_get(x_12, 0); -lean::inc(x_13); -if (lean::obj_tag(x_13) == 0) +x_15 = lean::apply_2(x_0, x_9, x_2); +if (lean::obj_tag(x_15) == 0) { -obj* x_17; obj* x_19; obj* x_20; obj* x_22; obj* x_23; obj* x_24; -lean::dec(x_8); -lean::dec(x_0); -x_17 = lean::cnstr_get(x_12, 1); -if (lean::is_exclusive(x_12)) { - lean::cnstr_release(x_12, 0); - x_19 = x_12; +obj* x_16; obj* x_18; obj* x_19; obj* x_20; +x_16 = lean::cnstr_get(x_15, 1); +if (lean::is_exclusive(x_15)) { + lean::cnstr_release(x_15, 0); + x_18 = x_15; } else { - lean::inc(x_17); - lean::dec(x_12); - x_19 = lean::box(0); + lean::inc(x_16); + lean::dec(x_15); + x_18 = lean::box(0); } -x_20 = lean::cnstr_get(x_13, 0); -if (lean::is_exclusive(x_13)) { - x_22 = x_13; +x_19 = lean::box(0); +if (lean::is_scalar(x_18)) { + x_20 = lean::alloc_cnstr(0, 2, 0); } else { - lean::inc(x_20); - lean::dec(x_13); - x_22 = lean::box(0); + x_20 = x_18; } -if (lean::is_scalar(x_22)) { - x_23 = lean::alloc_cnstr(0, 1, 0); -} else { - x_23 = x_22; -} -lean::cnstr_set(x_23, 0, x_20); -if (lean::is_scalar(x_19)) { - x_24 = lean::alloc_cnstr(0, 2, 0); -} else { - x_24 = x_19; -} -lean::cnstr_set(x_24, 0, x_23); -lean::cnstr_set(x_24, 1, x_17); -return x_24; +lean::cnstr_set(x_20, 0, x_19); +lean::cnstr_set(x_20, 1, x_16); +x_1 = x_11; +x_2 = x_20; +goto _start; } else { -obj* x_26; -lean::dec(x_13); -x_26 = lean::cnstr_get(x_12, 1); -lean::inc(x_26); -lean::dec(x_12); -x_1 = x_8; -x_2 = x_26; -goto _start; +obj* x_24; obj* x_26; obj* x_28; obj* x_29; +lean::dec(x_0); +lean::dec(x_11); +x_24 = lean::cnstr_get(x_15, 0); +x_26 = lean::cnstr_get(x_15, 1); +if (lean::is_exclusive(x_15)) { + x_28 = x_15; +} else { + lean::inc(x_24); + lean::inc(x_26); + lean::dec(x_15); + x_28 = lean::box(0); +} +if (lean::is_scalar(x_28)) { + x_29 = lean::alloc_cnstr(1, 2, 0); +} else { + x_29 = x_28; +} +lean::cnstr_set(x_29, 0, x_24); +lean::cnstr_set(x_29, 1, x_26); +return x_29; } } } @@ -418,78 +493,89 @@ _start: { if (lean::obj_tag(x_1) == 0) { -obj* x_4; obj* x_5; +obj* x_4; obj* x_6; obj* x_7; obj* x_8; lean::dec(x_0); -x_4 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__1___closed__1; -x_5 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_5, 0, x_4); -lean::cnstr_set(x_5, 1, x_2); -return x_5; +x_4 = lean::cnstr_get(x_2, 1); +if (lean::is_exclusive(x_2)) { + lean::cnstr_release(x_2, 0); + x_6 = x_2; +} else { + lean::inc(x_4); + lean::dec(x_2); + x_6 = lean::box(0); +} +x_7 = lean::box(0); +if (lean::is_scalar(x_6)) { + x_8 = lean::alloc_cnstr(0, 2, 0); +} else { + x_8 = x_6; +} +lean::cnstr_set(x_8, 0, x_7); +lean::cnstr_set(x_8, 1, x_4); +return x_8; } else { -obj* x_6; obj* x_8; obj* x_12; obj* x_13; -x_6 = lean::cnstr_get(x_1, 0); -lean::inc(x_6); -x_8 = lean::cnstr_get(x_1, 1); -lean::inc(x_8); +obj* x_9; obj* x_11; obj* x_15; +x_9 = lean::cnstr_get(x_1, 0); +lean::inc(x_9); +x_11 = lean::cnstr_get(x_1, 1); +lean::inc(x_11); lean::dec(x_1); lean::inc(x_0); -x_12 = lean::apply_2(x_0, x_6, x_2); -x_13 = lean::cnstr_get(x_12, 0); -lean::inc(x_13); -if (lean::obj_tag(x_13) == 0) +x_15 = lean::apply_2(x_0, x_9, x_2); +if (lean::obj_tag(x_15) == 0) { -obj* x_17; obj* x_19; obj* x_20; obj* x_22; obj* x_23; obj* x_24; -lean::dec(x_8); -lean::dec(x_0); -x_17 = lean::cnstr_get(x_12, 1); -if (lean::is_exclusive(x_12)) { - lean::cnstr_release(x_12, 0); - x_19 = x_12; +obj* x_16; obj* x_18; obj* x_19; obj* x_20; +x_16 = lean::cnstr_get(x_15, 1); +if (lean::is_exclusive(x_15)) { + lean::cnstr_release(x_15, 0); + x_18 = x_15; } else { - lean::inc(x_17); - lean::dec(x_12); - x_19 = lean::box(0); + lean::inc(x_16); + lean::dec(x_15); + x_18 = lean::box(0); } -x_20 = lean::cnstr_get(x_13, 0); -if (lean::is_exclusive(x_13)) { - x_22 = x_13; +x_19 = lean::box(0); +if (lean::is_scalar(x_18)) { + x_20 = lean::alloc_cnstr(0, 2, 0); } else { - lean::inc(x_20); - lean::dec(x_13); - x_22 = lean::box(0); + x_20 = x_18; } -if (lean::is_scalar(x_22)) { - x_23 = lean::alloc_cnstr(0, 1, 0); -} else { - x_23 = x_22; -} -lean::cnstr_set(x_23, 0, x_20); -if (lean::is_scalar(x_19)) { - x_24 = lean::alloc_cnstr(0, 2, 0); -} else { - x_24 = x_19; -} -lean::cnstr_set(x_24, 0, x_23); -lean::cnstr_set(x_24, 1, x_17); -return x_24; +lean::cnstr_set(x_20, 0, x_19); +lean::cnstr_set(x_20, 1, x_16); +x_1 = x_11; +x_2 = x_20; +goto _start; } else { -obj* x_26; -lean::dec(x_13); -x_26 = lean::cnstr_get(x_12, 1); -lean::inc(x_26); -lean::dec(x_12); -x_1 = x_8; -x_2 = x_26; -goto _start; +obj* x_24; obj* x_26; obj* x_28; obj* x_29; +lean::dec(x_0); +lean::dec(x_11); +x_24 = lean::cnstr_get(x_15, 0); +x_26 = lean::cnstr_get(x_15, 1); +if (lean::is_exclusive(x_15)) { + x_28 = x_15; +} else { + lean::inc(x_24); + lean::inc(x_26); + lean::dec(x_15); + x_28 = lean::box(0); +} +if (lean::is_scalar(x_28)) { + x_29 = lean::alloc_cnstr(1, 2, 0); +} else { + x_29 = x_28; +} +lean::cnstr_set(x_29, 0, x_24); +lean::cnstr_set(x_29, 1, x_26); +return x_29; } } } } -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__1(obj* x_0, obj* x_1, obj* x_2) { +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__1(obj* x_0, obj* x_1, obj* x_2) { _start: { obj* x_3; @@ -497,7 +583,7 @@ x_3 = l_lean_parser_parse__command(x_0, x_1); return x_3; } } -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__2(obj* x_0, obj* x_1, obj* x_2) { +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__2(obj* x_0, obj* x_1, obj* x_2) { _start: { obj* x_3; @@ -505,7 +591,7 @@ x_3 = l_lean_expander_expand(x_0, x_1); return x_3; } } -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__3(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__3(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { _start: { obj* x_4; @@ -513,7 +599,7 @@ x_4 = l_lean_elaborator_process__command(x_0, x_1, x_2); return x_4; } } -obj* _init_l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__1() { +obj* _init_l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__1() { _start: { obj* x_0; @@ -521,7 +607,7 @@ x_0 = lean::mk_string("parsing"); return x_0; } } -obj* _init_l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__2() { +obj* _init_l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__2() { _start: { obj* x_0; @@ -529,7 +615,7 @@ x_0 = lean::mk_string("expanding"); return x_0; } } -obj* _init_l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__3() { +obj* _init_l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__3() { _start: { obj* x_0; @@ -537,928 +623,976 @@ x_0 = lean::mk_string("elaborating"); return x_0; } } -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4(obj* x_0, obj* x_1, uint8 x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4(obj* x_0, obj* x_1, uint8 x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { _start: { -obj* x_7; obj* x_8; obj* x_10; obj* x_12; obj* x_14; obj* x_16; obj* x_19; obj* x_22; obj* x_25; obj* x_27; obj* x_30; obj* x_32; obj* x_35; obj* x_38; obj* x_41; obj* x_43; obj* x_46; obj* x_48; obj* x_49; obj* x_50; obj* x_51; obj* x_53; -x_10 = lean::cnstr_get(x_5, 1); -lean::inc(x_10); -x_12 = lean::cnstr_get(x_10, 1); -lean::inc(x_12); -x_14 = lean::cnstr_get(x_12, 1); -lean::inc(x_14); -x_16 = lean::cnstr_get(x_5, 0); -lean::inc(x_16); +obj* x_7; obj* x_9; obj* x_11; obj* x_13; obj* x_16; obj* x_19; obj* x_21; obj* x_22; obj* x_24; obj* x_26; obj* x_27; obj* x_29; obj* x_32; obj* x_35; obj* x_38; obj* x_40; obj* x_43; obj* x_45; obj* x_46; obj* x_47; +x_7 = lean::cnstr_get(x_5, 1); +lean::inc(x_7); +x_9 = lean::cnstr_get(x_7, 1); +lean::inc(x_9); +x_11 = lean::cnstr_get(x_9, 1); +lean::inc(x_11); +x_13 = lean::cnstr_get(x_5, 0); +lean::inc(x_13); lean::dec(x_5); -x_19 = lean::cnstr_get(x_10, 0); -lean::inc(x_19); -lean::dec(x_10); -x_22 = lean::cnstr_get(x_12, 0); -lean::inc(x_22); -lean::dec(x_12); -x_25 = lean::cnstr_get(x_14, 0); -lean::inc(x_25); -x_27 = lean::cnstr_get(x_14, 1); +x_16 = lean::cnstr_get(x_7, 0); +lean::inc(x_16); +lean::dec(x_7); +x_19 = lean::cnstr_get(x_9, 0); +if (lean::is_exclusive(x_9)) { + lean::cnstr_set(x_9, 0, lean::box(0)); + lean::cnstr_release(x_9, 1); + x_21 = x_9; +} else { + lean::inc(x_19); + lean::dec(x_9); + x_21 = lean::box(0); +} +x_22 = lean::cnstr_get(x_11, 0); +x_24 = lean::cnstr_get(x_11, 1); +if (lean::is_exclusive(x_11)) { + lean::cnstr_set(x_11, 0, lean::box(0)); + lean::cnstr_set(x_11, 1, lean::box(0)); + x_26 = x_11; +} else { + lean::inc(x_22); + lean::inc(x_24); + lean::dec(x_11); + x_26 = lean::box(0); +} +x_27 = lean::cnstr_get(x_19, 0); lean::inc(x_27); -lean::dec(x_14); -x_30 = lean::cnstr_get(x_22, 0); -lean::inc(x_30); -x_32 = lean::cnstr_get(x_30, 0); +x_29 = lean::cnstr_get(x_27, 0); +lean::inc(x_29); +lean::dec(x_27); +x_32 = lean::cnstr_get(x_29, 0); lean::inc(x_32); -lean::dec(x_30); -x_35 = lean::cnstr_get(x_32, 0); +lean::dec(x_29); +x_35 = lean::cnstr_get(x_32, 2); lean::inc(x_35); lean::dec(x_32); -x_38 = lean::cnstr_get(x_35, 2); +x_38 = lean::cnstr_get(x_13, 0); lean::inc(x_38); -lean::dec(x_35); -x_41 = lean::cnstr_get(x_16, 0); -lean::inc(x_41); -x_43 = lean::cnstr_get(x_41, 1); -lean::inc(x_43); -lean::dec(x_41); -x_46 = l_lean_file__map_to__position(x_38, x_43); -lean::inc(x_22); -x_48 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__1___boxed), 3, 2); -lean::closure_set(x_48, 0, x_22); -lean::closure_set(x_48, 1, x_16); -x_49 = l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__1; -x_50 = l_lean_profileit__pure___rarg(x_49, x_46, x_48, x_6); -x_51 = lean::cnstr_get(x_50, 0); -lean::inc(x_51); -x_53 = lean::cnstr_get(x_51, 1); -lean::inc(x_53); -if (lean::obj_tag(x_53) == 0) +x_40 = lean::cnstr_get(x_38, 1); +lean::inc(x_40); +lean::dec(x_38); +x_43 = l_lean_file__map_to__position(x_35, x_40); +lean::inc(x_19); +x_45 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__1___boxed), 3, 2); +lean::closure_set(x_45, 0, x_19); +lean::closure_set(x_45, 1, x_13); +x_46 = l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__1; +x_47 = l_lean_profileit__pure___rarg(x_46, x_43, x_45, x_6); +if (lean::obj_tag(x_47) == 0) { -obj* x_59; obj* x_62; obj* x_65; obj* x_69; obj* x_70; -lean::dec(x_25); -lean::dec(x_4); +obj* x_48; obj* x_50; obj* x_52; obj* x_53; obj* x_55; obj* x_57; obj* x_58; obj* x_59; +x_48 = lean::cnstr_get(x_47, 0); +x_50 = lean::cnstr_get(x_47, 1); +if (lean::is_exclusive(x_47)) { + x_52 = x_47; +} else { + lean::inc(x_48); + lean::inc(x_50); + lean::dec(x_47); + x_52 = lean::box(0); +} +x_53 = lean::cnstr_get(x_48, 0); +x_55 = lean::cnstr_get(x_48, 1); +if (lean::is_exclusive(x_48)) { + lean::cnstr_set(x_48, 0, lean::box(0)); + lean::cnstr_set(x_48, 1, lean::box(0)); + x_57 = x_48; +} else { + lean::inc(x_53); + lean::inc(x_55); + lean::dec(x_48); + x_57 = lean::box(0); +} +x_58 = lean::box(0); +if (lean::is_scalar(x_52)) { + x_59 = lean::alloc_cnstr(0, 2, 0); +} else { + x_59 = x_52; +} +lean::cnstr_set(x_59, 0, x_58); +lean::cnstr_set(x_59, 1, x_50); +if (lean::obj_tag(x_55) == 0) +{ +obj* x_66; obj* x_68; obj* x_70; lean::dec(x_22); -lean::dec(x_46); -x_59 = lean::cnstr_get(x_50, 1); -lean::inc(x_59); -lean::dec(x_50); -x_62 = lean::cnstr_get(x_51, 0); -lean::inc(x_62); -lean::dec(x_51); -x_65 = lean::cnstr_get(x_53, 0); -lean::inc(x_65); -lean::dec(x_53); +lean::dec(x_4); +lean::dec(x_19); +lean::dec(x_21); +lean::dec(x_43); +lean::dec(x_26); +x_66 = lean::cnstr_get(x_55, 0); +if (lean::is_exclusive(x_55)) { + lean::cnstr_set(x_55, 0, lean::box(0)); + x_68 = x_55; +} else { + lean::inc(x_66); + lean::dec(x_55); + x_68 = lean::box(0); +} lean::inc(x_0); -x_69 = lean::apply_2(x_0, x_65, x_59); -x_70 = lean::cnstr_get(x_69, 0); -lean::inc(x_70); +x_70 = lean::apply_2(x_0, x_66, x_59); if (lean::obj_tag(x_70) == 0) { -obj* x_78; obj* x_81; obj* x_83; obj* x_84; -lean::dec(x_27); +obj* x_71; obj* x_73; obj* x_74; obj* x_75; +x_71 = lean::cnstr_get(x_70, 1); +if (lean::is_exclusive(x_70)) { + lean::cnstr_release(x_70, 0); + x_73 = x_70; +} else { + lean::inc(x_71); + lean::dec(x_70); + x_73 = lean::box(0); +} +if (lean::is_scalar(x_73)) { + x_74 = lean::alloc_cnstr(0, 2, 0); +} else { + x_74 = x_73; +} +lean::cnstr_set(x_74, 0, x_58); +lean::cnstr_set(x_74, 1, x_71); +x_75 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__2(x_0, x_1, x_74); +if (lean::obj_tag(x_75) == 0) +{ +if (x_2 == 0) +{ +obj* x_78; obj* x_80; obj* x_81; obj* x_84; obj* x_85; obj* x_86; obj* x_87; obj* x_88; +lean::dec(x_24); +lean::dec(x_53); +x_78 = lean::cnstr_get(x_75, 1); +if (lean::is_exclusive(x_75)) { + lean::cnstr_release(x_75, 0); + x_80 = x_75; +} else { + lean::inc(x_78); + lean::dec(x_75); + x_80 = lean::box(0); +} +x_81 = lean::cnstr_get(x_16, 8); +lean::inc(x_81); +lean::dec(x_16); +x_84 = l_list_reverse___rarg(x_3); +if (lean::is_scalar(x_57)) { + x_85 = lean::alloc_cnstr(0, 2, 0); +} else { + x_85 = x_57; +} +lean::cnstr_set(x_85, 0, x_84); +lean::cnstr_set(x_85, 1, x_81); +if (lean::is_scalar(x_68)) { + x_86 = lean::alloc_cnstr(1, 1, 0); +} else { + x_86 = x_68; + lean::cnstr_set_tag(x_68, 1); +} +lean::cnstr_set(x_86, 0, x_85); +x_87 = lean::alloc_cnstr(1, 1, 0); +lean::cnstr_set(x_87, 0, x_86); +if (lean::is_scalar(x_80)) { + x_88 = lean::alloc_cnstr(0, 2, 0); +} else { + x_88 = x_80; +} +lean::cnstr_set(x_88, 0, x_87); +lean::cnstr_set(x_88, 1, x_78); +return x_88; +} +else +{ +obj* x_90; obj* x_92; obj* x_93; obj* x_96; obj* x_97; obj* x_98; obj* x_99; obj* x_100; obj* x_101; +lean::dec(x_3); +x_90 = lean::cnstr_get(x_75, 1); +if (lean::is_exclusive(x_75)) { + lean::cnstr_release(x_75, 0); + x_92 = x_75; +} else { + lean::inc(x_90); + lean::dec(x_75); + x_92 = lean::box(0); +} +x_93 = lean::cnstr_get(x_16, 8); +lean::inc(x_93); +lean::dec(x_16); +x_96 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_96, 0, x_53); +lean::cnstr_set(x_96, 1, x_24); +x_97 = l_list_reverse___rarg(x_96); +if (lean::is_scalar(x_57)) { + x_98 = lean::alloc_cnstr(0, 2, 0); +} else { + x_98 = x_57; +} +lean::cnstr_set(x_98, 0, x_97); +lean::cnstr_set(x_98, 1, x_93); +if (lean::is_scalar(x_68)) { + x_99 = lean::alloc_cnstr(1, 1, 0); +} else { + x_99 = x_68; + lean::cnstr_set_tag(x_68, 1); +} +lean::cnstr_set(x_99, 0, x_98); +x_100 = lean::alloc_cnstr(1, 1, 0); +lean::cnstr_set(x_100, 0, x_99); +if (lean::is_scalar(x_92)) { + x_101 = lean::alloc_cnstr(0, 2, 0); +} else { + x_101 = x_92; +} +lean::cnstr_set(x_101, 0, x_100); +lean::cnstr_set(x_101, 1, x_90); +return x_101; +} +} +else +{ +obj* x_108; obj* x_110; obj* x_112; obj* x_113; +lean::dec(x_24); +lean::dec(x_16); +lean::dec(x_3); +lean::dec(x_57); +lean::dec(x_68); +lean::dec(x_53); +x_108 = lean::cnstr_get(x_75, 0); +x_110 = lean::cnstr_get(x_75, 1); +if (lean::is_exclusive(x_75)) { + x_112 = x_75; +} else { + lean::inc(x_108); + lean::inc(x_110); + lean::dec(x_75); + x_112 = lean::box(0); +} +if (lean::is_scalar(x_112)) { + x_113 = lean::alloc_cnstr(1, 2, 0); +} else { + x_113 = x_112; +} +lean::cnstr_set(x_113, 0, x_108); +lean::cnstr_set(x_113, 1, x_110); +return x_113; +} +} +else +{ +obj* x_122; obj* x_124; obj* x_126; obj* x_127; +lean::dec(x_24); +lean::dec(x_16); lean::dec(x_1); lean::dec(x_3); lean::dec(x_0); -lean::dec(x_19); -lean::dec(x_62); -x_78 = lean::cnstr_get(x_69, 1); -lean::inc(x_78); -lean::dec(x_69); -x_81 = lean::cnstr_get(x_70, 0); -if (lean::is_exclusive(x_70)) { - x_83 = x_70; -} else { - lean::inc(x_81); - lean::dec(x_70); - x_83 = lean::box(0); -} -if (lean::is_scalar(x_83)) { - x_84 = lean::alloc_cnstr(0, 1, 0); -} else { - x_84 = x_83; -} -lean::cnstr_set(x_84, 0, x_81); -x_7 = x_84; -x_8 = x_78; -goto lbl_9; -} -else -{ -obj* x_86; obj* x_89; obj* x_90; -lean::dec(x_70); -x_86 = lean::cnstr_get(x_69, 1); -lean::inc(x_86); -lean::dec(x_69); -x_89 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__2(x_0, x_1, x_86); -x_90 = lean::cnstr_get(x_89, 0); -lean::inc(x_90); -if (lean::obj_tag(x_90) == 0) -{ -obj* x_96; obj* x_99; obj* x_101; obj* x_102; -lean::dec(x_27); -lean::dec(x_3); -lean::dec(x_19); -lean::dec(x_62); -x_96 = lean::cnstr_get(x_89, 1); -lean::inc(x_96); -lean::dec(x_89); -x_99 = lean::cnstr_get(x_90, 0); -if (lean::is_exclusive(x_90)) { - x_101 = x_90; -} else { - lean::inc(x_99); - lean::dec(x_90); - x_101 = lean::box(0); -} -if (lean::is_scalar(x_101)) { - x_102 = lean::alloc_cnstr(0, 1, 0); -} else { - x_102 = x_101; -} -lean::cnstr_set(x_102, 0, x_99); -x_7 = x_102; -x_8 = x_96; -goto lbl_9; -} -else -{ -obj* x_103; -if (lean::is_exclusive(x_90)) { - lean::cnstr_release(x_90, 0); - x_103 = x_90; -} else { - lean::dec(x_90); - x_103 = lean::box(0); -} -if (x_2 == 0) -{ -obj* x_106; obj* x_108; obj* x_109; obj* x_112; obj* x_113; obj* x_114; obj* x_115; -lean::dec(x_27); -lean::dec(x_62); -x_106 = lean::cnstr_get(x_89, 1); -if (lean::is_exclusive(x_89)) { - lean::cnstr_release(x_89, 0); - x_108 = x_89; -} else { - lean::inc(x_106); - lean::dec(x_89); - x_108 = lean::box(0); -} -x_109 = lean::cnstr_get(x_19, 8); -lean::inc(x_109); -lean::dec(x_19); -x_112 = l_list_reverse___rarg(x_3); -if (lean::is_scalar(x_108)) { - x_113 = lean::alloc_cnstr(0, 2, 0); -} else { - x_113 = x_108; -} -lean::cnstr_set(x_113, 0, x_112); -lean::cnstr_set(x_113, 1, x_109); -x_114 = lean::alloc_cnstr(1, 1, 0); -lean::cnstr_set(x_114, 0, x_113); -if (lean::is_scalar(x_103)) { - x_115 = lean::alloc_cnstr(1, 1, 0); -} else { - x_115 = x_103; -} -lean::cnstr_set(x_115, 0, x_114); -x_7 = x_115; -x_8 = x_106; -goto lbl_9; -} -else -{ -obj* x_117; obj* x_119; obj* x_120; obj* x_123; obj* x_124; obj* x_125; obj* x_126; obj* x_127; -lean::dec(x_3); -x_117 = lean::cnstr_get(x_89, 1); -if (lean::is_exclusive(x_89)) { - lean::cnstr_release(x_89, 0); - x_119 = x_89; -} else { - lean::inc(x_117); - lean::dec(x_89); - x_119 = lean::box(0); -} -x_120 = lean::cnstr_get(x_19, 8); -lean::inc(x_120); -lean::dec(x_19); -x_123 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_123, 0, x_62); -lean::cnstr_set(x_123, 1, x_27); -x_124 = l_list_reverse___rarg(x_123); -if (lean::is_scalar(x_119)) { - x_125 = lean::alloc_cnstr(0, 2, 0); -} else { - x_125 = x_119; -} -lean::cnstr_set(x_125, 0, x_124); -lean::cnstr_set(x_125, 1, x_120); -x_126 = lean::alloc_cnstr(1, 1, 0); -lean::cnstr_set(x_126, 0, x_125); -if (lean::is_scalar(x_103)) { - x_127 = lean::alloc_cnstr(1, 1, 0); -} else { - x_127 = x_103; -} -lean::cnstr_set(x_127, 0, x_126); -x_7 = x_127; -x_8 = x_117; -goto lbl_9; -} -} -} -} -else -{ -obj* x_129; obj* x_132; obj* x_135; obj* x_138; obj* x_140; obj* x_142; obj* x_143; obj* x_145; obj* x_146; -lean::dec(x_1); -x_129 = lean::cnstr_get(x_53, 0); -lean::inc(x_129); +lean::dec(x_57); +lean::dec(x_68); lean::dec(x_53); -x_132 = lean::cnstr_get(x_50, 1); -lean::inc(x_132); -lean::dec(x_50); -x_135 = lean::cnstr_get(x_51, 0); -lean::inc(x_135); -lean::dec(x_51); -x_138 = lean::cnstr_get(x_129, 0); -x_140 = lean::cnstr_get(x_129, 1); +x_122 = lean::cnstr_get(x_70, 0); +x_124 = lean::cnstr_get(x_70, 1); +if (lean::is_exclusive(x_70)) { + x_126 = x_70; +} else { + lean::inc(x_122); + lean::inc(x_124); + lean::dec(x_70); + x_126 = lean::box(0); +} +if (lean::is_scalar(x_126)) { + x_127 = lean::alloc_cnstr(1, 2, 0); +} else { + x_127 = x_126; +} +lean::cnstr_set(x_127, 0, x_122); +lean::cnstr_set(x_127, 1, x_124); +return x_127; +} +} +else +{ +obj* x_129; obj* x_132; obj* x_134; obj* x_136; obj* x_137; obj* x_139; +lean::dec(x_1); +x_129 = lean::cnstr_get(x_55, 0); +lean::inc(x_129); +lean::dec(x_55); +x_132 = lean::cnstr_get(x_129, 0); +x_134 = lean::cnstr_get(x_129, 1); if (lean::is_exclusive(x_129)) { lean::cnstr_set(x_129, 0, lean::box(0)); lean::cnstr_set(x_129, 1, lean::box(0)); - x_142 = x_129; + x_136 = x_129; } else { - lean::inc(x_138); - lean::inc(x_140); + lean::inc(x_132); + lean::inc(x_134); lean::dec(x_129); + x_136 = lean::box(0); +} +x_137 = l_list_reverse___rarg(x_134); +lean::inc(x_0); +x_139 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__3(x_0, x_137, x_59); +if (lean::obj_tag(x_139) == 0) +{ +obj* x_140; obj* x_142; obj* x_143; obj* x_146; obj* x_147; obj* x_148; +x_140 = lean::cnstr_get(x_139, 1); +if (lean::is_exclusive(x_139)) { + lean::cnstr_release(x_139, 0); + x_142 = x_139; +} else { + lean::inc(x_140); + lean::dec(x_139); x_142 = lean::box(0); } -x_143 = l_list_reverse___rarg(x_140); -lean::inc(x_0); -x_145 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__3(x_0, x_143, x_132); -x_146 = lean::cnstr_get(x_145, 0); -lean::inc(x_146); -if (lean::obj_tag(x_146) == 0) +if (lean::is_scalar(x_142)) { + x_143 = lean::alloc_cnstr(0, 2, 0); +} else { + x_143 = x_142; +} +lean::cnstr_set(x_143, 0, x_58); +lean::cnstr_set(x_143, 1, x_140); +lean::inc(x_22); +lean::inc(x_53); +x_146 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__2___boxed), 3, 2); +lean::closure_set(x_146, 0, x_53); +lean::closure_set(x_146, 1, x_22); +x_147 = l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__2; +x_148 = l_lean_profileit__pure___rarg(x_147, x_43, x_146, x_143); +if (lean::obj_tag(x_148) == 0) { -obj* x_159; obj* x_162; obj* x_164; obj* x_165; -lean::dec(x_25); -lean::dec(x_27); +obj* x_149; obj* x_151; obj* x_153; obj* x_154; +x_149 = lean::cnstr_get(x_148, 0); +x_151 = lean::cnstr_get(x_148, 1); +if (lean::is_exclusive(x_148)) { + x_153 = x_148; +} else { + lean::inc(x_149); + lean::inc(x_151); + lean::dec(x_148); + x_153 = lean::box(0); +} +if (lean::is_scalar(x_153)) { + x_154 = lean::alloc_cnstr(0, 2, 0); +} else { + x_154 = x_153; +} +lean::cnstr_set(x_154, 0, x_58); +lean::cnstr_set(x_154, 1, x_151); +if (lean::obj_tag(x_149) == 0) +{ +lean::dec(x_4); +lean::dec(x_43); +if (x_2 == 0) +{ +obj* x_159; obj* x_162; +lean::dec(x_24); +lean::dec(x_53); +x_159 = lean::cnstr_get(x_149, 0); +lean::inc(x_159); +lean::dec(x_149); +x_162 = lean::apply_2(x_0, x_159, x_154); +if (lean::obj_tag(x_162) == 0) +{ +obj* x_163; obj* x_165; obj* x_166; obj* x_167; obj* x_168; obj* x_169; obj* x_170; obj* x_171; +x_163 = lean::cnstr_get(x_162, 1); +if (lean::is_exclusive(x_162)) { + lean::cnstr_release(x_162, 0); + x_165 = x_162; +} else { + lean::inc(x_163); + lean::dec(x_162); + x_165 = lean::box(0); +} +if (lean::is_scalar(x_136)) { + x_166 = lean::alloc_cnstr(0, 2, 0); +} else { + x_166 = x_136; +} +lean::cnstr_set(x_166, 0, x_22); +lean::cnstr_set(x_166, 1, x_3); +if (lean::is_scalar(x_57)) { + x_167 = lean::alloc_cnstr(0, 2, 0); +} else { + x_167 = x_57; +} +lean::cnstr_set(x_167, 0, x_19); +lean::cnstr_set(x_167, 1, x_166); +if (lean::is_scalar(x_26)) { + x_168 = lean::alloc_cnstr(0, 2, 0); +} else { + x_168 = x_26; +} +lean::cnstr_set(x_168, 0, x_16); +lean::cnstr_set(x_168, 1, x_167); +if (lean::is_scalar(x_21)) { + x_169 = lean::alloc_cnstr(0, 2, 0); +} else { + x_169 = x_21; +} +lean::cnstr_set(x_169, 0, x_132); +lean::cnstr_set(x_169, 1, x_168); +x_170 = lean::alloc_cnstr(0, 1, 0); +lean::cnstr_set(x_170, 0, x_169); +if (lean::is_scalar(x_165)) { + x_171 = lean::alloc_cnstr(0, 2, 0); +} else { + x_171 = x_165; +} +lean::cnstr_set(x_171, 0, x_170); +lean::cnstr_set(x_171, 1, x_163); +return x_171; +} +else +{ +obj* x_181; obj* x_183; obj* x_185; obj* x_186; +lean::dec(x_22); +lean::dec(x_16); +lean::dec(x_3); +lean::dec(x_19); +lean::dec(x_21); +lean::dec(x_57); +lean::dec(x_26); +lean::dec(x_132); +lean::dec(x_136); +x_181 = lean::cnstr_get(x_162, 0); +x_183 = lean::cnstr_get(x_162, 1); +if (lean::is_exclusive(x_162)) { + x_185 = x_162; +} else { + lean::inc(x_181); + lean::inc(x_183); + lean::dec(x_162); + x_185 = lean::box(0); +} +if (lean::is_scalar(x_185)) { + x_186 = lean::alloc_cnstr(1, 2, 0); +} else { + x_186 = x_185; +} +lean::cnstr_set(x_186, 0, x_181); +lean::cnstr_set(x_186, 1, x_183); +return x_186; +} +} +else +{ +obj* x_188; obj* x_191; +lean::dec(x_3); +x_188 = lean::cnstr_get(x_149, 0); +lean::inc(x_188); +lean::dec(x_149); +x_191 = lean::apply_2(x_0, x_188, x_154); +if (lean::obj_tag(x_191) == 0) +{ +obj* x_192; obj* x_194; obj* x_195; obj* x_196; obj* x_197; obj* x_198; obj* x_199; obj* x_200; obj* x_201; +x_192 = lean::cnstr_get(x_191, 1); +if (lean::is_exclusive(x_191)) { + lean::cnstr_release(x_191, 0); + x_194 = x_191; +} else { + lean::inc(x_192); + lean::dec(x_191); + x_194 = lean::box(0); +} +x_195 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_195, 0, x_53); +lean::cnstr_set(x_195, 1, x_24); +if (lean::is_scalar(x_136)) { + x_196 = lean::alloc_cnstr(0, 2, 0); +} else { + x_196 = x_136; +} +lean::cnstr_set(x_196, 0, x_22); +lean::cnstr_set(x_196, 1, x_195); +if (lean::is_scalar(x_57)) { + x_197 = lean::alloc_cnstr(0, 2, 0); +} else { + x_197 = x_57; +} +lean::cnstr_set(x_197, 0, x_19); +lean::cnstr_set(x_197, 1, x_196); +if (lean::is_scalar(x_26)) { + x_198 = lean::alloc_cnstr(0, 2, 0); +} else { + x_198 = x_26; +} +lean::cnstr_set(x_198, 0, x_16); +lean::cnstr_set(x_198, 1, x_197); +if (lean::is_scalar(x_21)) { + x_199 = lean::alloc_cnstr(0, 2, 0); +} else { + x_199 = x_21; +} +lean::cnstr_set(x_199, 0, x_132); +lean::cnstr_set(x_199, 1, x_198); +x_200 = lean::alloc_cnstr(0, 1, 0); +lean::cnstr_set(x_200, 0, x_199); +if (lean::is_scalar(x_194)) { + x_201 = lean::alloc_cnstr(0, 2, 0); +} else { + x_201 = x_194; +} +lean::cnstr_set(x_201, 0, x_200); +lean::cnstr_set(x_201, 1, x_192); +return x_201; +} +else +{ +obj* x_212; obj* x_214; obj* x_216; obj* x_217; +lean::dec(x_22); +lean::dec(x_24); +lean::dec(x_16); +lean::dec(x_19); +lean::dec(x_21); +lean::dec(x_57); +lean::dec(x_26); +lean::dec(x_53); +lean::dec(x_132); +lean::dec(x_136); +x_212 = lean::cnstr_get(x_191, 0); +x_214 = lean::cnstr_get(x_191, 1); +if (lean::is_exclusive(x_191)) { + x_216 = x_191; +} else { + lean::inc(x_212); + lean::inc(x_214); + lean::dec(x_191); + x_216 = lean::box(0); +} +if (lean::is_scalar(x_216)) { + x_217 = lean::alloc_cnstr(1, 2, 0); +} else { + x_217 = x_216; +} +lean::cnstr_set(x_217, 0, x_212); +lean::cnstr_set(x_217, 1, x_214); +return x_217; +} +} +} +else +{ +obj* x_220; obj* x_222; obj* x_224; obj* x_225; obj* x_226; +lean::dec(x_22); +lean::dec(x_19); +x_220 = lean::cnstr_get(x_149, 0); +if (lean::is_exclusive(x_149)) { + lean::cnstr_set(x_149, 0, lean::box(0)); + x_222 = x_149; +} else { + lean::inc(x_220); + lean::dec(x_149); + x_222 = lean::box(0); +} +lean::inc(x_220); +x_224 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__3___boxed), 4, 3); +lean::closure_set(x_224, 0, x_4); +lean::closure_set(x_224, 1, x_16); +lean::closure_set(x_224, 2, x_220); +x_225 = l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__3; +x_226 = l_lean_profileit__pure___rarg(x_225, x_43, x_224, x_154); +lean::dec(x_43); +if (lean::obj_tag(x_226) == 0) +{ +obj* x_228; obj* x_230; obj* x_232; obj* x_233; obj* x_234; obj* x_236; obj* x_237; +x_228 = lean::cnstr_get(x_226, 0); +x_230 = lean::cnstr_get(x_226, 1); +if (lean::is_exclusive(x_226)) { + x_232 = x_226; +} else { + lean::inc(x_228); + lean::inc(x_230); + lean::dec(x_226); + x_232 = lean::box(0); +} +if (lean::is_scalar(x_232)) { + x_233 = lean::alloc_cnstr(0, 2, 0); +} else { + x_233 = x_232; +} +lean::cnstr_set(x_233, 0, x_58); +lean::cnstr_set(x_233, 1, x_230); +x_234 = lean::cnstr_get(x_228, 5); +lean::inc(x_234); +x_236 = l_list_reverse___rarg(x_234); +x_237 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__4(x_0, x_236, x_233); +if (lean::obj_tag(x_237) == 0) +{ +obj* x_238; obj* x_240; obj* x_241; uint8 x_242; +x_238 = lean::cnstr_get(x_237, 1); +if (lean::is_exclusive(x_237)) { + lean::cnstr_release(x_237, 0); + lean::cnstr_set(x_237, 1, lean::box(0)); + x_240 = x_237; +} else { + lean::inc(x_238); + lean::dec(x_237); + x_240 = lean::box(0); +} +x_241 = l_lean_parser_module_eoi; +x_242 = l_lean_parser_syntax_is__of__kind___main(x_241, x_220); +lean::dec(x_220); +if (x_242 == 0) +{ +lean::dec(x_222); +if (x_2 == 0) +{ +obj* x_247; obj* x_249; obj* x_251; obj* x_252; obj* x_253; obj* x_254; obj* x_255; obj* x_256; +lean::dec(x_24); +lean::dec(x_53); +x_247 = lean::cnstr_get(x_228, 6); +lean::inc(x_247); +x_249 = lean::cnstr_get(x_228, 7); +lean::inc(x_249); +if (lean::is_scalar(x_136)) { + x_251 = lean::alloc_cnstr(0, 2, 0); +} else { + x_251 = x_136; +} +lean::cnstr_set(x_251, 0, x_249); +lean::cnstr_set(x_251, 1, x_3); +if (lean::is_scalar(x_57)) { + x_252 = lean::alloc_cnstr(0, 2, 0); +} else { + x_252 = x_57; +} +lean::cnstr_set(x_252, 0, x_247); +lean::cnstr_set(x_252, 1, x_251); +if (lean::is_scalar(x_26)) { + x_253 = lean::alloc_cnstr(0, 2, 0); +} else { + x_253 = x_26; +} +lean::cnstr_set(x_253, 0, x_228); +lean::cnstr_set(x_253, 1, x_252); +if (lean::is_scalar(x_21)) { + x_254 = lean::alloc_cnstr(0, 2, 0); +} else { + x_254 = x_21; +} +lean::cnstr_set(x_254, 0, x_132); +lean::cnstr_set(x_254, 1, x_253); +x_255 = lean::alloc_cnstr(0, 1, 0); +lean::cnstr_set(x_255, 0, x_254); +if (lean::is_scalar(x_240)) { + x_256 = lean::alloc_cnstr(0, 2, 0); +} else { + x_256 = x_240; +} +lean::cnstr_set(x_256, 0, x_255); +lean::cnstr_set(x_256, 1, x_238); +return x_256; +} +else +{ +obj* x_258; obj* x_260; obj* x_262; obj* x_263; obj* x_264; obj* x_265; obj* x_266; obj* x_267; obj* x_268; +lean::dec(x_3); +x_258 = lean::cnstr_get(x_228, 6); +lean::inc(x_258); +x_260 = lean::cnstr_get(x_228, 7); +lean::inc(x_260); +x_262 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_262, 0, x_53); +lean::cnstr_set(x_262, 1, x_24); +if (lean::is_scalar(x_136)) { + x_263 = lean::alloc_cnstr(0, 2, 0); +} else { + x_263 = x_136; +} +lean::cnstr_set(x_263, 0, x_260); +lean::cnstr_set(x_263, 1, x_262); +if (lean::is_scalar(x_57)) { + x_264 = lean::alloc_cnstr(0, 2, 0); +} else { + x_264 = x_57; +} +lean::cnstr_set(x_264, 0, x_258); +lean::cnstr_set(x_264, 1, x_263); +if (lean::is_scalar(x_26)) { + x_265 = lean::alloc_cnstr(0, 2, 0); +} else { + x_265 = x_26; +} +lean::cnstr_set(x_265, 0, x_228); +lean::cnstr_set(x_265, 1, x_264); +if (lean::is_scalar(x_21)) { + x_266 = lean::alloc_cnstr(0, 2, 0); +} else { + x_266 = x_21; +} +lean::cnstr_set(x_266, 0, x_132); +lean::cnstr_set(x_266, 1, x_265); +x_267 = lean::alloc_cnstr(0, 1, 0); +lean::cnstr_set(x_267, 0, x_266); +if (lean::is_scalar(x_240)) { + x_268 = lean::alloc_cnstr(0, 2, 0); +} else { + x_268 = x_240; +} +lean::cnstr_set(x_268, 0, x_267); +lean::cnstr_set(x_268, 1, x_238); +return x_268; +} +} +else +{ +lean::dec(x_21); +lean::dec(x_57); +lean::dec(x_26); +lean::dec(x_132); +if (x_2 == 0) +{ +obj* x_275; obj* x_278; obj* x_279; obj* x_280; obj* x_281; obj* x_282; +lean::dec(x_24); +lean::dec(x_53); +x_275 = lean::cnstr_get(x_228, 8); +lean::inc(x_275); +lean::dec(x_228); +x_278 = l_list_reverse___rarg(x_3); +if (lean::is_scalar(x_136)) { + x_279 = lean::alloc_cnstr(0, 2, 0); +} else { + x_279 = x_136; +} +lean::cnstr_set(x_279, 0, x_278); +lean::cnstr_set(x_279, 1, x_275); +if (lean::is_scalar(x_222)) { + x_280 = lean::alloc_cnstr(1, 1, 0); +} else { + x_280 = x_222; +} +lean::cnstr_set(x_280, 0, x_279); +x_281 = lean::alloc_cnstr(1, 1, 0); +lean::cnstr_set(x_281, 0, x_280); +if (lean::is_scalar(x_240)) { + x_282 = lean::alloc_cnstr(0, 2, 0); +} else { + x_282 = x_240; +} +lean::cnstr_set(x_282, 0, x_281); +lean::cnstr_set(x_282, 1, x_238); +return x_282; +} +else +{ +obj* x_284; obj* x_287; obj* x_288; obj* x_289; obj* x_290; obj* x_291; obj* x_292; +lean::dec(x_3); +x_284 = lean::cnstr_get(x_228, 8); +lean::inc(x_284); +lean::dec(x_228); +x_287 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_287, 0, x_53); +lean::cnstr_set(x_287, 1, x_24); +x_288 = l_list_reverse___rarg(x_287); +if (lean::is_scalar(x_136)) { + x_289 = lean::alloc_cnstr(0, 2, 0); +} else { + x_289 = x_136; +} +lean::cnstr_set(x_289, 0, x_288); +lean::cnstr_set(x_289, 1, x_284); +if (lean::is_scalar(x_222)) { + x_290 = lean::alloc_cnstr(1, 1, 0); +} else { + x_290 = x_222; +} +lean::cnstr_set(x_290, 0, x_289); +x_291 = lean::alloc_cnstr(1, 1, 0); +lean::cnstr_set(x_291, 0, x_290); +if (lean::is_scalar(x_240)) { + x_292 = lean::alloc_cnstr(0, 2, 0); +} else { + x_292 = x_240; +} +lean::cnstr_set(x_292, 0, x_291); +lean::cnstr_set(x_292, 1, x_238); +return x_292; +} +} +} +else +{ +obj* x_304; obj* x_306; obj* x_308; obj* x_309; +lean::dec(x_220); +lean::dec(x_222); +lean::dec(x_24); +lean::dec(x_3); +lean::dec(x_21); +lean::dec(x_228); +lean::dec(x_57); +lean::dec(x_26); +lean::dec(x_53); +lean::dec(x_132); +lean::dec(x_136); +x_304 = lean::cnstr_get(x_237, 0); +x_306 = lean::cnstr_get(x_237, 1); +if (lean::is_exclusive(x_237)) { + x_308 = x_237; +} else { + lean::inc(x_304); + lean::inc(x_306); + lean::dec(x_237); + x_308 = lean::box(0); +} +if (lean::is_scalar(x_308)) { + x_309 = lean::alloc_cnstr(1, 2, 0); +} else { + x_309 = x_308; +} +lean::cnstr_set(x_309, 0, x_304); +lean::cnstr_set(x_309, 1, x_306); +return x_309; +} +} +else +{ +obj* x_321; obj* x_323; obj* x_325; obj* x_326; +lean::dec(x_220); +lean::dec(x_222); +lean::dec(x_24); +lean::dec(x_3); +lean::dec(x_0); +lean::dec(x_21); +lean::dec(x_57); +lean::dec(x_26); +lean::dec(x_53); +lean::dec(x_132); +lean::dec(x_136); +x_321 = lean::cnstr_get(x_226, 0); +x_323 = lean::cnstr_get(x_226, 1); +if (lean::is_exclusive(x_226)) { + x_325 = x_226; +} else { + lean::inc(x_321); + lean::inc(x_323); + lean::dec(x_226); + x_325 = lean::box(0); +} +if (lean::is_scalar(x_325)) { + x_326 = lean::alloc_cnstr(1, 2, 0); +} else { + x_326 = x_325; +} +lean::cnstr_set(x_326, 0, x_321); +lean::cnstr_set(x_326, 1, x_323); +return x_326; +} +} +} +else +{ +obj* x_341; obj* x_343; obj* x_345; obj* x_346; +lean::dec(x_22); +lean::dec(x_24); +lean::dec(x_16); lean::dec(x_4); lean::dec(x_3); lean::dec(x_0); lean::dec(x_19); -lean::dec(x_22); -lean::dec(x_46); -lean::dec(x_138); -lean::dec(x_135); -lean::dec(x_142); -x_159 = lean::cnstr_get(x_145, 1); -lean::inc(x_159); -lean::dec(x_145); -x_162 = lean::cnstr_get(x_146, 0); -if (lean::is_exclusive(x_146)) { - x_164 = x_146; +lean::dec(x_21); +lean::dec(x_57); +lean::dec(x_43); +lean::dec(x_26); +lean::dec(x_53); +lean::dec(x_132); +lean::dec(x_136); +x_341 = lean::cnstr_get(x_148, 0); +x_343 = lean::cnstr_get(x_148, 1); +if (lean::is_exclusive(x_148)) { + x_345 = x_148; } else { - lean::inc(x_162); - lean::dec(x_146); - x_164 = lean::box(0); + lean::inc(x_341); + lean::inc(x_343); + lean::dec(x_148); + x_345 = lean::box(0); } -if (lean::is_scalar(x_164)) { - x_165 = lean::alloc_cnstr(0, 1, 0); +if (lean::is_scalar(x_345)) { + x_346 = lean::alloc_cnstr(1, 2, 0); } else { - x_165 = x_164; + x_346 = x_345; +} +lean::cnstr_set(x_346, 0, x_341); +lean::cnstr_set(x_346, 1, x_343); +return x_346; } -lean::cnstr_set(x_165, 0, x_162); -x_7 = x_165; -x_8 = x_159; -goto lbl_9; } else { -obj* x_167; obj* x_169; obj* x_172; obj* x_173; obj* x_174; obj* x_175; -lean::dec(x_146); -x_167 = lean::cnstr_get(x_145, 1); -if (lean::is_exclusive(x_145)) { - lean::cnstr_release(x_145, 0); - lean::cnstr_set(x_145, 1, lean::box(0)); - x_169 = x_145; -} else { - lean::inc(x_167); - lean::dec(x_145); - x_169 = lean::box(0); -} -lean::inc(x_25); -lean::inc(x_135); -x_172 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__2___boxed), 3, 2); -lean::closure_set(x_172, 0, x_135); -lean::closure_set(x_172, 1, x_25); -x_173 = l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__2; -x_174 = l_lean_profileit__pure___rarg(x_173, x_46, x_172, x_167); -x_175 = lean::cnstr_get(x_174, 0); -lean::inc(x_175); -if (lean::obj_tag(x_175) == 0) -{ +obj* x_361; obj* x_363; obj* x_365; obj* x_366; +lean::dec(x_22); +lean::dec(x_24); +lean::dec(x_16); lean::dec(x_4); -lean::dec(x_46); -if (x_2 == 0) -{ -obj* x_181; obj* x_183; obj* x_184; obj* x_187; obj* x_188; -lean::dec(x_27); -lean::dec(x_135); -x_181 = lean::cnstr_get(x_174, 1); -if (lean::is_exclusive(x_174)) { - lean::cnstr_release(x_174, 0); - lean::cnstr_set(x_174, 1, lean::box(0)); - x_183 = x_174; -} else { - lean::inc(x_181); - lean::dec(x_174); - x_183 = lean::box(0); -} -x_184 = lean::cnstr_get(x_175, 0); -lean::inc(x_184); -lean::dec(x_175); -x_187 = lean::apply_2(x_0, x_184, x_181); -x_188 = lean::cnstr_get(x_187, 0); -lean::inc(x_188); -if (lean::obj_tag(x_188) == 0) -{ -obj* x_198; obj* x_201; obj* x_203; obj* x_204; -lean::dec(x_25); lean::dec(x_3); +lean::dec(x_0); lean::dec(x_19); -lean::dec(x_22); -lean::dec(x_169); -lean::dec(x_183); -lean::dec(x_138); -lean::dec(x_142); -x_198 = lean::cnstr_get(x_187, 1); -lean::inc(x_198); -lean::dec(x_187); -x_201 = lean::cnstr_get(x_188, 0); -if (lean::is_exclusive(x_188)) { - x_203 = x_188; -} else { - lean::inc(x_201); - lean::dec(x_188); - x_203 = lean::box(0); -} -if (lean::is_scalar(x_203)) { - x_204 = lean::alloc_cnstr(0, 1, 0); -} else { - x_204 = x_203; -} -lean::cnstr_set(x_204, 0, x_201); -x_7 = x_204; -x_8 = x_198; -goto lbl_9; -} -else -{ -obj* x_205; obj* x_206; obj* x_208; obj* x_209; obj* x_210; obj* x_211; obj* x_212; obj* x_213; obj* x_214; -if (lean::is_exclusive(x_188)) { - lean::cnstr_release(x_188, 0); - x_205 = x_188; -} else { - lean::dec(x_188); - x_205 = lean::box(0); -} -x_206 = lean::cnstr_get(x_187, 1); -if (lean::is_exclusive(x_187)) { - lean::cnstr_release(x_187, 0); - x_208 = x_187; -} else { - lean::inc(x_206); - lean::dec(x_187); - x_208 = lean::box(0); -} -if (lean::is_scalar(x_208)) { - x_209 = lean::alloc_cnstr(0, 2, 0); -} else { - x_209 = x_208; -} -lean::cnstr_set(x_209, 0, x_25); -lean::cnstr_set(x_209, 1, x_3); -if (lean::is_scalar(x_183)) { - x_210 = lean::alloc_cnstr(0, 2, 0); -} else { - x_210 = x_183; -} -lean::cnstr_set(x_210, 0, x_22); -lean::cnstr_set(x_210, 1, x_209); -if (lean::is_scalar(x_169)) { - x_211 = lean::alloc_cnstr(0, 2, 0); -} else { - x_211 = x_169; -} -lean::cnstr_set(x_211, 0, x_19); -lean::cnstr_set(x_211, 1, x_210); -if (lean::is_scalar(x_142)) { - x_212 = lean::alloc_cnstr(0, 2, 0); -} else { - x_212 = x_142; -} -lean::cnstr_set(x_212, 0, x_138); -lean::cnstr_set(x_212, 1, x_211); -x_213 = lean::alloc_cnstr(0, 1, 0); -lean::cnstr_set(x_213, 0, x_212); -if (lean::is_scalar(x_205)) { - x_214 = lean::alloc_cnstr(1, 1, 0); -} else { - x_214 = x_205; -} -lean::cnstr_set(x_214, 0, x_213); -x_7 = x_214; -x_8 = x_206; -goto lbl_9; -} -} -else -{ -obj* x_216; obj* x_218; obj* x_219; obj* x_222; obj* x_223; -lean::dec(x_3); -x_216 = lean::cnstr_get(x_174, 1); -if (lean::is_exclusive(x_174)) { - lean::cnstr_release(x_174, 0); - lean::cnstr_set(x_174, 1, lean::box(0)); - x_218 = x_174; -} else { - lean::inc(x_216); - lean::dec(x_174); - x_218 = lean::box(0); -} -x_219 = lean::cnstr_get(x_175, 0); -lean::inc(x_219); -lean::dec(x_175); -x_222 = lean::apply_2(x_0, x_219, x_216); -x_223 = lean::cnstr_get(x_222, 0); -lean::inc(x_223); -if (lean::obj_tag(x_223) == 0) -{ -obj* x_234; obj* x_237; obj* x_239; obj* x_240; -lean::dec(x_218); -lean::dec(x_25); -lean::dec(x_27); -lean::dec(x_19); -lean::dec(x_22); -lean::dec(x_169); -lean::dec(x_138); -lean::dec(x_135); -lean::dec(x_142); -x_234 = lean::cnstr_get(x_222, 1); -lean::inc(x_234); -lean::dec(x_222); -x_237 = lean::cnstr_get(x_223, 0); -if (lean::is_exclusive(x_223)) { - x_239 = x_223; -} else { - lean::inc(x_237); - lean::dec(x_223); - x_239 = lean::box(0); -} -if (lean::is_scalar(x_239)) { - x_240 = lean::alloc_cnstr(0, 1, 0); -} else { - x_240 = x_239; -} -lean::cnstr_set(x_240, 0, x_237); -x_7 = x_240; -x_8 = x_234; -goto lbl_9; -} -else -{ -obj* x_241; obj* x_242; obj* x_244; obj* x_245; obj* x_246; obj* x_247; obj* x_248; obj* x_249; obj* x_250; obj* x_251; -if (lean::is_exclusive(x_223)) { - lean::cnstr_release(x_223, 0); - x_241 = x_223; -} else { - lean::dec(x_223); - x_241 = lean::box(0); -} -x_242 = lean::cnstr_get(x_222, 1); -if (lean::is_exclusive(x_222)) { - lean::cnstr_release(x_222, 0); - x_244 = x_222; -} else { - lean::inc(x_242); - lean::dec(x_222); - x_244 = lean::box(0); -} -x_245 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_245, 0, x_135); -lean::cnstr_set(x_245, 1, x_27); -if (lean::is_scalar(x_244)) { - x_246 = lean::alloc_cnstr(0, 2, 0); -} else { - x_246 = x_244; -} -lean::cnstr_set(x_246, 0, x_25); -lean::cnstr_set(x_246, 1, x_245); -if (lean::is_scalar(x_218)) { - x_247 = lean::alloc_cnstr(0, 2, 0); -} else { - x_247 = x_218; -} -lean::cnstr_set(x_247, 0, x_22); -lean::cnstr_set(x_247, 1, x_246); -if (lean::is_scalar(x_169)) { - x_248 = lean::alloc_cnstr(0, 2, 0); -} else { - x_248 = x_169; -} -lean::cnstr_set(x_248, 0, x_19); -lean::cnstr_set(x_248, 1, x_247); -if (lean::is_scalar(x_142)) { - x_249 = lean::alloc_cnstr(0, 2, 0); -} else { - x_249 = x_142; -} -lean::cnstr_set(x_249, 0, x_138); -lean::cnstr_set(x_249, 1, x_248); -x_250 = lean::alloc_cnstr(0, 1, 0); -lean::cnstr_set(x_250, 0, x_249); -if (lean::is_scalar(x_241)) { - x_251 = lean::alloc_cnstr(1, 1, 0); -} else { - x_251 = x_241; -} -lean::cnstr_set(x_251, 0, x_250); -x_7 = x_251; -x_8 = x_242; -goto lbl_9; -} -} -} -else -{ -obj* x_255; obj* x_257; obj* x_258; obj* x_262; obj* x_263; obj* x_264; obj* x_266; obj* x_268; obj* x_270; obj* x_271; obj* x_273; obj* x_274; obj* x_275; -lean::dec(x_25); -lean::dec(x_22); -lean::dec(x_142); -x_255 = lean::cnstr_get(x_174, 1); -if (lean::is_exclusive(x_174)) { - lean::cnstr_release(x_174, 0); - lean::cnstr_set(x_174, 1, lean::box(0)); - x_257 = x_174; -} else { - lean::inc(x_255); - lean::dec(x_174); - x_257 = lean::box(0); -} -x_258 = lean::cnstr_get(x_175, 0); -lean::inc(x_258); -lean::dec(x_175); -lean::inc(x_258); -x_262 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__3___boxed), 4, 3); -lean::closure_set(x_262, 0, x_4); -lean::closure_set(x_262, 1, x_19); -lean::closure_set(x_262, 2, x_258); -x_263 = l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__3; -x_264 = l_lean_profileit__pure___rarg(x_263, x_46, x_262, x_255); -lean::dec(x_46); -x_266 = lean::cnstr_get(x_264, 0); -x_268 = lean::cnstr_get(x_264, 1); -if (lean::is_exclusive(x_264)) { - lean::cnstr_set(x_264, 0, lean::box(0)); - lean::cnstr_set(x_264, 1, lean::box(0)); - x_270 = x_264; -} else { - lean::inc(x_266); - lean::inc(x_268); - lean::dec(x_264); - x_270 = lean::box(0); -} -x_271 = lean::cnstr_get(x_266, 5); -lean::inc(x_271); -x_273 = l_list_reverse___rarg(x_271); -x_274 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__4(x_0, x_273, x_268); -x_275 = lean::cnstr_get(x_274, 0); -lean::inc(x_275); -if (lean::obj_tag(x_275) == 0) -{ -obj* x_286; obj* x_289; obj* x_291; obj* x_292; -lean::dec(x_266); -lean::dec(x_257); -lean::dec(x_258); -lean::dec(x_27); -lean::dec(x_3); -lean::dec(x_270); -lean::dec(x_169); -lean::dec(x_138); -lean::dec(x_135); -x_286 = lean::cnstr_get(x_274, 1); -lean::inc(x_286); -lean::dec(x_274); -x_289 = lean::cnstr_get(x_275, 0); -if (lean::is_exclusive(x_275)) { - x_291 = x_275; -} else { - lean::inc(x_289); - lean::dec(x_275); - x_291 = lean::box(0); -} -if (lean::is_scalar(x_291)) { - x_292 = lean::alloc_cnstr(0, 1, 0); -} else { - x_292 = x_291; -} -lean::cnstr_set(x_292, 0, x_289); -x_7 = x_292; -x_8 = x_286; -goto lbl_9; -} -else -{ -obj* x_293; obj* x_294; obj* x_296; obj* x_297; uint8 x_298; -if (lean::is_exclusive(x_275)) { - lean::cnstr_release(x_275, 0); - x_293 = x_275; -} else { - lean::dec(x_275); - x_293 = lean::box(0); -} -x_294 = lean::cnstr_get(x_274, 1); -if (lean::is_exclusive(x_274)) { - lean::cnstr_release(x_274, 0); - lean::cnstr_set(x_274, 1, lean::box(0)); - x_296 = x_274; -} else { - lean::inc(x_294); - lean::dec(x_274); - x_296 = lean::box(0); -} -x_297 = l_lean_parser_module_eoi; -x_298 = l_lean_parser_syntax_is__of__kind___main(x_297, x_258); -lean::dec(x_258); -if (x_298 == 0) -{ -if (x_2 == 0) -{ -obj* x_302; obj* x_304; obj* x_306; obj* x_307; obj* x_308; obj* x_309; obj* x_310; obj* x_311; -lean::dec(x_27); -lean::dec(x_135); -x_302 = lean::cnstr_get(x_266, 6); -lean::inc(x_302); -x_304 = lean::cnstr_get(x_266, 7); -lean::inc(x_304); -if (lean::is_scalar(x_296)) { - x_306 = lean::alloc_cnstr(0, 2, 0); -} else { - x_306 = x_296; -} -lean::cnstr_set(x_306, 0, x_304); -lean::cnstr_set(x_306, 1, x_3); -if (lean::is_scalar(x_270)) { - x_307 = lean::alloc_cnstr(0, 2, 0); -} else { - x_307 = x_270; -} -lean::cnstr_set(x_307, 0, x_302); -lean::cnstr_set(x_307, 1, x_306); -if (lean::is_scalar(x_257)) { - x_308 = lean::alloc_cnstr(0, 2, 0); -} else { - x_308 = x_257; -} -lean::cnstr_set(x_308, 0, x_266); -lean::cnstr_set(x_308, 1, x_307); -if (lean::is_scalar(x_169)) { - x_309 = lean::alloc_cnstr(0, 2, 0); -} else { - x_309 = x_169; -} -lean::cnstr_set(x_309, 0, x_138); -lean::cnstr_set(x_309, 1, x_308); -x_310 = lean::alloc_cnstr(0, 1, 0); -lean::cnstr_set(x_310, 0, x_309); -if (lean::is_scalar(x_293)) { - x_311 = lean::alloc_cnstr(1, 1, 0); -} else { - x_311 = x_293; -} -lean::cnstr_set(x_311, 0, x_310); -x_7 = x_311; -x_8 = x_294; -goto lbl_9; -} -else -{ -obj* x_313; obj* x_315; obj* x_317; obj* x_318; obj* x_319; obj* x_320; obj* x_321; obj* x_322; obj* x_323; -lean::dec(x_3); -x_313 = lean::cnstr_get(x_266, 6); -lean::inc(x_313); -x_315 = lean::cnstr_get(x_266, 7); -lean::inc(x_315); -x_317 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_317, 0, x_135); -lean::cnstr_set(x_317, 1, x_27); -if (lean::is_scalar(x_296)) { - x_318 = lean::alloc_cnstr(0, 2, 0); -} else { - x_318 = x_296; -} -lean::cnstr_set(x_318, 0, x_315); -lean::cnstr_set(x_318, 1, x_317); -if (lean::is_scalar(x_270)) { - x_319 = lean::alloc_cnstr(0, 2, 0); -} else { - x_319 = x_270; -} -lean::cnstr_set(x_319, 0, x_313); -lean::cnstr_set(x_319, 1, x_318); -if (lean::is_scalar(x_257)) { - x_320 = lean::alloc_cnstr(0, 2, 0); -} else { - x_320 = x_257; -} -lean::cnstr_set(x_320, 0, x_266); -lean::cnstr_set(x_320, 1, x_319); -if (lean::is_scalar(x_169)) { - x_321 = lean::alloc_cnstr(0, 2, 0); -} else { - x_321 = x_169; -} -lean::cnstr_set(x_321, 0, x_138); -lean::cnstr_set(x_321, 1, x_320); -x_322 = lean::alloc_cnstr(0, 1, 0); -lean::cnstr_set(x_322, 0, x_321); -if (lean::is_scalar(x_293)) { - x_323 = lean::alloc_cnstr(1, 1, 0); -} else { - x_323 = x_293; -} -lean::cnstr_set(x_323, 0, x_322); -x_7 = x_323; -x_8 = x_294; -goto lbl_9; -} -} -else -{ -lean::dec(x_257); -lean::dec(x_270); -lean::dec(x_169); -lean::dec(x_138); -if (x_2 == 0) -{ -obj* x_330; obj* x_333; obj* x_334; obj* x_335; obj* x_336; -lean::dec(x_27); -lean::dec(x_135); -x_330 = lean::cnstr_get(x_266, 8); -lean::inc(x_330); -lean::dec(x_266); -x_333 = l_list_reverse___rarg(x_3); -if (lean::is_scalar(x_296)) { - x_334 = lean::alloc_cnstr(0, 2, 0); -} else { - x_334 = x_296; -} -lean::cnstr_set(x_334, 0, x_333); -lean::cnstr_set(x_334, 1, x_330); -x_335 = lean::alloc_cnstr(1, 1, 0); -lean::cnstr_set(x_335, 0, x_334); -if (lean::is_scalar(x_293)) { - x_336 = lean::alloc_cnstr(1, 1, 0); -} else { - x_336 = x_293; -} -lean::cnstr_set(x_336, 0, x_335); -x_7 = x_336; -x_8 = x_294; -goto lbl_9; -} -else -{ -obj* x_338; obj* x_341; obj* x_342; obj* x_343; obj* x_344; obj* x_345; -lean::dec(x_3); -x_338 = lean::cnstr_get(x_266, 8); -lean::inc(x_338); -lean::dec(x_266); -x_341 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_341, 0, x_135); -lean::cnstr_set(x_341, 1, x_27); -x_342 = l_list_reverse___rarg(x_341); -if (lean::is_scalar(x_296)) { - x_343 = lean::alloc_cnstr(0, 2, 0); -} else { - x_343 = x_296; -} -lean::cnstr_set(x_343, 0, x_342); -lean::cnstr_set(x_343, 1, x_338); -x_344 = lean::alloc_cnstr(1, 1, 0); -lean::cnstr_set(x_344, 0, x_343); -if (lean::is_scalar(x_293)) { - x_345 = lean::alloc_cnstr(1, 1, 0); -} else { - x_345 = x_293; -} -lean::cnstr_set(x_345, 0, x_344); -x_7 = x_345; -x_8 = x_294; -goto lbl_9; -} -} -} -} -} -} -lbl_9: -{ -if (lean::obj_tag(x_7) == 0) -{ -obj* x_346; obj* x_348; obj* x_349; obj* x_350; obj* x_351; -x_346 = lean::cnstr_get(x_7, 0); -if (lean::is_exclusive(x_7)) { - x_348 = x_7; -} else { - lean::inc(x_346); - lean::dec(x_7); - x_348 = lean::box(0); -} -if (lean::is_scalar(x_348)) { - x_349 = lean::alloc_cnstr(0, 1, 0); -} else { - x_349 = x_348; -} -lean::cnstr_set(x_349, 0, x_346); -x_350 = lean::alloc_cnstr(1, 1, 0); -lean::cnstr_set(x_350, 0, x_349); -x_351 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_351, 0, x_350); -lean::cnstr_set(x_351, 1, x_8); -return x_351; -} -else -{ -obj* x_352; obj* x_354; -x_352 = lean::cnstr_get(x_7, 0); -if (lean::is_exclusive(x_7)) { - lean::cnstr_set(x_7, 0, lean::box(0)); - x_354 = x_7; -} else { - lean::inc(x_352); - lean::dec(x_7); - x_354 = lean::box(0); -} -if (lean::obj_tag(x_352) == 0) -{ -obj* x_356; obj* x_358; obj* x_359; obj* x_360; -lean::dec(x_354); -x_356 = lean::cnstr_get(x_352, 0); -if (lean::is_exclusive(x_352)) { - x_358 = x_352; -} else { - lean::inc(x_356); - lean::dec(x_352); - x_358 = lean::box(0); -} -if (lean::is_scalar(x_358)) { - x_359 = lean::alloc_cnstr(0, 1, 0); -} else { - x_359 = x_358; -} -lean::cnstr_set(x_359, 0, x_356); -x_360 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_360, 0, x_359); -lean::cnstr_set(x_360, 1, x_8); -return x_360; -} -else -{ -obj* x_361; obj* x_363; obj* x_364; obj* x_365; obj* x_366; -x_361 = lean::cnstr_get(x_352, 0); -if (lean::is_exclusive(x_352)) { - x_363 = x_352; +lean::dec(x_21); +lean::dec(x_57); +lean::dec(x_43); +lean::dec(x_26); +lean::dec(x_53); +lean::dec(x_132); +lean::dec(x_136); +x_361 = lean::cnstr_get(x_139, 0); +x_363 = lean::cnstr_get(x_139, 1); +if (lean::is_exclusive(x_139)) { + x_365 = x_139; } else { lean::inc(x_361); - lean::dec(x_352); - x_363 = lean::box(0); + lean::inc(x_363); + lean::dec(x_139); + x_365 = lean::box(0); } -if (lean::is_scalar(x_354)) { - x_364 = lean::alloc_cnstr(1, 1, 0); +if (lean::is_scalar(x_365)) { + x_366 = lean::alloc_cnstr(1, 2, 0); } else { - x_364 = x_354; + x_366 = x_365; } -lean::cnstr_set(x_364, 0, x_361); -if (lean::is_scalar(x_363)) { - x_365 = lean::alloc_cnstr(1, 1, 0); -} else { - x_365 = x_363; -} -lean::cnstr_set(x_365, 0, x_364); -x_366 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_366, 0, x_365); -lean::cnstr_set(x_366, 1, x_8); +lean::cnstr_set(x_366, 0, x_361); +lean::cnstr_set(x_366, 1, x_363); return x_366; } } } +else +{ +obj* x_378; obj* x_380; obj* x_382; obj* x_383; +lean::dec(x_22); +lean::dec(x_24); +lean::dec(x_16); +lean::dec(x_4); +lean::dec(x_1); +lean::dec(x_3); +lean::dec(x_0); +lean::dec(x_19); +lean::dec(x_21); +lean::dec(x_43); +lean::dec(x_26); +x_378 = lean::cnstr_get(x_47, 0); +x_380 = lean::cnstr_get(x_47, 1); +if (lean::is_exclusive(x_47)) { + x_382 = x_47; +} else { + lean::inc(x_378); + lean::inc(x_380); + lean::dec(x_47); + x_382 = lean::box(0); +} +if (lean::is_scalar(x_382)) { + x_383 = lean::alloc_cnstr(1, 2, 0); +} else { + x_383 = x_382; +} +lean::cnstr_set(x_383, 0, x_378); +lean::cnstr_set(x_383, 1, x_380); +return x_383; } } -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6(obj* x_0, uint8 x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { +} +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5(obj* x_0, uint8 x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { _start: { obj* x_7; obj* x_8; obj* x_9; obj* x_10; x_7 = lean::box(x_1); -x_8 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___boxed), 7, 5); +x_8 = lean::alloc_closure(reinterpret_cast(l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___boxed), 7, 5); lean::closure_set(x_8, 0, x_0); lean::closure_set(x_8, 1, x_2); lean::closure_set(x_8, 2, x_7); @@ -1470,14 +1604,6 @@ x_10 = lean::fixpoint2(x_9, x_5, x_6); return x_10; } } -obj* l_io_prim_iterate__eio___at_lean_run__frontend___spec__5(obj* x_0, uint8 x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { -_start: -{ -obj* x_7; -x_7 = l_io_prim_iterate___at_lean_run__frontend___spec__6(x_0, x_1, x_2, x_3, x_4, x_5, x_6); -return x_7; -} -} obj* _init_l_lean_run__frontend___closed__1() { _start: { @@ -1502,7 +1628,7 @@ lean::inc(x_0); x_8 = l_lean_mk__config(x_0, x_1); if (lean::obj_tag(x_8) == 0) { -obj* x_13; obj* x_15; obj* x_16; obj* x_17; +obj* x_13; obj* x_15; obj* x_16; obj* x_18; obj* x_19; obj* x_20; lean::dec(x_4); lean::dec(x_1); lean::dec(x_0); @@ -1515,318 +1641,405 @@ if (lean::is_exclusive(x_8)) { lean::dec(x_8); x_15 = lean::box(0); } -if (lean::is_scalar(x_15)) { - x_16 = lean::alloc_cnstr(0, 1, 0); +x_16 = lean::cnstr_get(x_5, 1); +if (lean::is_exclusive(x_5)) { + lean::cnstr_release(x_5, 0); + x_18 = x_5; } else { - x_16 = x_15; + lean::inc(x_16); + lean::dec(x_5); + x_18 = lean::box(0); } -lean::cnstr_set(x_16, 0, x_13); -x_17 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_17, 0, x_16); -lean::cnstr_set(x_17, 1, x_5); -return x_17; +if (lean::is_scalar(x_15)) { + x_19 = lean::alloc_cnstr(0, 1, 0); +} else { + x_19 = x_15; +} +lean::cnstr_set(x_19, 0, x_13); +if (lean::is_scalar(x_18)) { + x_20 = lean::alloc_cnstr(0, 2, 0); +} else { + x_20 = x_18; +} +lean::cnstr_set(x_20, 0, x_19); +lean::cnstr_set(x_20, 1, x_16); +return x_20; } else { -obj* x_18; obj* x_22; obj* x_23; obj* x_25; -x_18 = lean::cnstr_get(x_8, 0); -lean::inc(x_18); +obj* x_21; obj* x_24; obj* x_26; obj* x_28; obj* x_29; obj* x_31; obj* x_32; obj* x_33; +x_21 = lean::cnstr_get(x_8, 0); +lean::inc(x_21); lean::dec(x_8); -lean::inc(x_18); -x_22 = l_lean_parser_parse__header(x_18); -x_23 = lean::cnstr_get(x_22, 1); -if (lean::is_exclusive(x_22)) { - lean::cnstr_release(x_22, 0); - lean::cnstr_set(x_22, 1, lean::box(0)); - x_25 = x_22; +x_24 = lean::cnstr_get(x_5, 1); +if (lean::is_exclusive(x_5)) { + lean::cnstr_release(x_5, 0); + x_26 = x_5; } else { - lean::inc(x_23); - lean::dec(x_22); - x_25 = lean::box(0); + lean::inc(x_24); + lean::dec(x_5); + x_26 = lean::box(0); } -if (lean::obj_tag(x_23) == 0) +lean::inc(x_21); +x_28 = l_lean_parser_parse__header(x_21); +x_29 = lean::cnstr_get(x_28, 1); +if (lean::is_exclusive(x_28)) { + lean::cnstr_release(x_28, 0); + lean::cnstr_set(x_28, 1, lean::box(0)); + x_31 = x_28; +} else { + lean::inc(x_29); + lean::dec(x_28); + x_31 = lean::box(0); +} +x_32 = lean::box(0); +if (lean::is_scalar(x_26)) { + x_33 = lean::alloc_cnstr(0, 2, 0); +} else { + x_33 = x_26; +} +lean::cnstr_set(x_33, 0, x_32); +lean::cnstr_set(x_33, 1, x_24); +if (lean::obj_tag(x_29) == 0) { -obj* x_29; obj* x_32; obj* x_33; +obj* x_37; obj* x_40; +lean::dec(x_21); lean::dec(x_1); lean::dec(x_0); -lean::dec(x_18); -x_29 = lean::cnstr_get(x_23, 0); -lean::inc(x_29); -lean::dec(x_23); -x_32 = lean::apply_2(x_2, x_29, x_5); -x_33 = lean::cnstr_get(x_32, 0); -lean::inc(x_33); -if (lean::obj_tag(x_33) == 0) +x_37 = lean::cnstr_get(x_29, 0); +lean::inc(x_37); +lean::dec(x_29); +x_40 = lean::apply_2(x_2, x_37, x_33); +if (lean::obj_tag(x_40) == 0) { -obj* x_37; obj* x_39; obj* x_40; obj* x_42; obj* x_43; obj* x_44; -lean::dec(x_25); +obj* x_41; +x_41 = lean::cnstr_get(x_40, 0); +lean::inc(x_41); +if (lean::obj_tag(x_41) == 0) +{ +obj* x_45; obj* x_47; obj* x_48; obj* x_50; obj* x_51; obj* x_52; lean::dec(x_4); -x_37 = lean::cnstr_get(x_32, 1); -if (lean::is_exclusive(x_32)) { - lean::cnstr_release(x_32, 0); - x_39 = x_32; +lean::dec(x_31); +x_45 = lean::cnstr_get(x_40, 1); +if (lean::is_exclusive(x_40)) { + lean::cnstr_release(x_40, 0); + x_47 = x_40; } else { - lean::inc(x_37); - lean::dec(x_32); - x_39 = lean::box(0); + lean::inc(x_45); + lean::dec(x_40); + x_47 = lean::box(0); } -x_40 = lean::cnstr_get(x_33, 0); -if (lean::is_exclusive(x_33)) { - x_42 = x_33; +x_48 = lean::cnstr_get(x_41, 0); +if (lean::is_exclusive(x_41)) { + x_50 = x_41; } else { - lean::inc(x_40); - lean::dec(x_33); - x_42 = lean::box(0); + lean::inc(x_48); + lean::dec(x_41); + x_50 = lean::box(0); } -if (lean::is_scalar(x_42)) { - x_43 = lean::alloc_cnstr(0, 1, 0); +if (lean::is_scalar(x_50)) { + x_51 = lean::alloc_cnstr(0, 1, 0); } else { - x_43 = x_42; + x_51 = x_50; } -lean::cnstr_set(x_43, 0, x_40); -if (lean::is_scalar(x_39)) { - x_44 = lean::alloc_cnstr(0, 2, 0); -} else { - x_44 = x_39; -} -lean::cnstr_set(x_44, 0, x_43); -lean::cnstr_set(x_44, 1, x_37); -return x_44; -} -else -{ -obj* x_45; obj* x_46; obj* x_48; obj* x_49; obj* x_50; obj* x_51; obj* x_52; -if (lean::is_exclusive(x_33)) { - lean::cnstr_release(x_33, 0); - x_45 = x_33; -} else { - lean::dec(x_33); - x_45 = lean::box(0); -} -x_46 = lean::cnstr_get(x_32, 1); -if (lean::is_exclusive(x_32)) { - lean::cnstr_release(x_32, 0); - x_48 = x_32; -} else { - lean::inc(x_46); - lean::dec(x_32); - x_48 = lean::box(0); -} -x_49 = lean::box(0); -if (lean::is_scalar(x_48)) { - x_50 = lean::alloc_cnstr(0, 2, 0); -} else { - x_50 = x_48; -} -lean::cnstr_set(x_50, 0, x_49); -lean::cnstr_set(x_50, 1, x_4); -if (lean::is_scalar(x_45)) { - x_51 = lean::alloc_cnstr(1, 1, 0); -} else { - x_51 = x_45; -} -lean::cnstr_set(x_51, 0, x_50); -if (lean::is_scalar(x_25)) { +lean::cnstr_set(x_51, 0, x_48); +if (lean::is_scalar(x_47)) { x_52 = lean::alloc_cnstr(0, 2, 0); } else { - x_52 = x_25; + x_52 = x_47; } lean::cnstr_set(x_52, 0, x_51); -lean::cnstr_set(x_52, 1, x_46); +lean::cnstr_set(x_52, 1, x_45); return x_52; } +else +{ +obj* x_53; obj* x_54; obj* x_56; obj* x_57; obj* x_58; obj* x_59; obj* x_60; +if (lean::is_exclusive(x_41)) { + lean::cnstr_release(x_41, 0); + x_53 = x_41; +} else { + lean::dec(x_41); + x_53 = lean::box(0); +} +x_54 = lean::cnstr_get(x_40, 1); +if (lean::is_exclusive(x_40)) { + lean::cnstr_release(x_40, 0); + x_56 = x_40; +} else { + lean::inc(x_54); + lean::dec(x_40); + x_56 = lean::box(0); +} +x_57 = lean::box(0); +if (lean::is_scalar(x_31)) { + x_58 = lean::alloc_cnstr(0, 2, 0); +} else { + x_58 = x_31; +} +lean::cnstr_set(x_58, 0, x_57); +lean::cnstr_set(x_58, 1, x_4); +if (lean::is_scalar(x_53)) { + x_59 = lean::alloc_cnstr(1, 1, 0); +} else { + x_59 = x_53; +} +lean::cnstr_set(x_59, 0, x_58); +if (lean::is_scalar(x_56)) { + x_60 = lean::alloc_cnstr(0, 2, 0); +} else { + x_60 = x_56; +} +lean::cnstr_set(x_60, 0, x_59); +lean::cnstr_set(x_60, 1, x_54); +return x_60; +} } else { -obj* x_53; obj* x_56; obj* x_58; obj* x_60; obj* x_61; obj* x_64; obj* x_65; -x_53 = lean::cnstr_get(x_23, 0); -lean::inc(x_53); -lean::dec(x_23); -x_56 = lean::cnstr_get(x_53, 0); -x_58 = lean::cnstr_get(x_53, 1); -if (lean::is_exclusive(x_53)) { - lean::cnstr_set(x_53, 0, lean::box(0)); - lean::cnstr_set(x_53, 1, lean::box(0)); - x_60 = x_53; +obj* x_63; obj* x_65; obj* x_67; obj* x_68; +lean::dec(x_4); +lean::dec(x_31); +x_63 = lean::cnstr_get(x_40, 0); +x_65 = lean::cnstr_get(x_40, 1); +if (lean::is_exclusive(x_40)) { + x_67 = x_40; } else { - lean::inc(x_56); - lean::inc(x_58); - lean::dec(x_53); - x_60 = lean::box(0); + lean::inc(x_63); + lean::inc(x_65); + lean::dec(x_40); + x_67 = lean::box(0); } -x_61 = l_list_reverse___rarg(x_58); -lean::inc(x_61); -lean::inc(x_2); -x_64 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__1(x_2, x_61, x_5); -x_65 = lean::cnstr_get(x_64, 0); -lean::inc(x_65); -if (lean::obj_tag(x_65) == 0) +if (lean::is_scalar(x_67)) { + x_68 = lean::alloc_cnstr(1, 2, 0); +} else { + x_68 = x_67; +} +lean::cnstr_set(x_68, 0, x_63); +lean::cnstr_set(x_68, 1, x_65); +return x_68; +} +} +else { -obj* x_76; obj* x_78; obj* x_79; obj* x_81; obj* x_82; obj* x_83; -lean::dec(x_25); +obj* x_69; obj* x_72; obj* x_74; obj* x_76; obj* x_77; obj* x_80; +x_69 = lean::cnstr_get(x_29, 0); +lean::inc(x_69); +lean::dec(x_29); +x_72 = lean::cnstr_get(x_69, 0); +x_74 = lean::cnstr_get(x_69, 1); +if (lean::is_exclusive(x_69)) { + lean::cnstr_set(x_69, 0, lean::box(0)); + lean::cnstr_set(x_69, 1, lean::box(0)); + x_76 = x_69; +} else { + lean::inc(x_72); + lean::inc(x_74); + lean::dec(x_69); + x_76 = lean::box(0); +} +x_77 = l_list_reverse___rarg(x_74); +lean::inc(x_77); +lean::inc(x_2); +x_80 = l_list_mmap_x_27___main___at_lean_run__frontend___spec__1(x_2, x_77, x_33); +if (lean::obj_tag(x_80) == 0) +{ +obj* x_81; +x_81 = lean::cnstr_get(x_80, 0); +lean::inc(x_81); +if (lean::obj_tag(x_81) == 0) +{ +obj* x_92; obj* x_94; obj* x_95; obj* x_97; obj* x_98; obj* x_99; +lean::dec(x_21); lean::dec(x_4); lean::dec(x_1); lean::dec(x_0); lean::dec(x_2); -lean::dec(x_56); -lean::dec(x_60); -lean::dec(x_61); -lean::dec(x_18); -x_76 = lean::cnstr_get(x_64, 1); -if (lean::is_exclusive(x_64)) { - lean::cnstr_release(x_64, 0); - x_78 = x_64; +lean::dec(x_31); +lean::dec(x_72); +lean::dec(x_76); +lean::dec(x_77); +x_92 = lean::cnstr_get(x_80, 1); +if (lean::is_exclusive(x_80)) { + lean::cnstr_release(x_80, 0); + x_94 = x_80; } else { - lean::inc(x_76); - lean::dec(x_64); - x_78 = lean::box(0); + lean::inc(x_92); + lean::dec(x_80); + x_94 = lean::box(0); } -x_79 = lean::cnstr_get(x_65, 0); -if (lean::is_exclusive(x_65)) { - x_81 = x_65; +x_95 = lean::cnstr_get(x_81, 0); +if (lean::is_exclusive(x_81)) { + x_97 = x_81; } else { - lean::inc(x_79); - lean::dec(x_65); - x_81 = lean::box(0); + lean::inc(x_95); + lean::dec(x_81); + x_97 = lean::box(0); } -if (lean::is_scalar(x_81)) { - x_82 = lean::alloc_cnstr(0, 1, 0); +if (lean::is_scalar(x_97)) { + x_98 = lean::alloc_cnstr(0, 1, 0); } else { - x_82 = x_81; + x_98 = x_97; } -lean::cnstr_set(x_82, 0, x_79); -if (lean::is_scalar(x_78)) { - x_83 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_98, 0, x_95); +if (lean::is_scalar(x_94)) { + x_99 = lean::alloc_cnstr(0, 2, 0); } else { - x_83 = x_78; + x_99 = x_94; } -lean::cnstr_set(x_83, 0, x_82); -lean::cnstr_set(x_83, 1, x_76); -return x_83; +lean::cnstr_set(x_99, 0, x_98); +lean::cnstr_set(x_99, 1, x_92); +return x_99; } else { -obj* x_85; obj* x_87; obj* x_88; obj* x_90; obj* x_93; obj* x_96; obj* x_98; obj* x_99; obj* x_102; obj* x_104; obj* x_105; obj* x_107; obj* x_108; obj* x_109; obj* x_110; obj* x_111; obj* x_112; obj* x_113; -lean::dec(x_65); -x_85 = lean::cnstr_get(x_64, 1); -if (lean::is_exclusive(x_64)) { - lean::cnstr_release(x_64, 0); - x_87 = x_64; +obj* x_101; obj* x_103; obj* x_104; obj* x_105; obj* x_107; obj* x_110; obj* x_113; obj* x_115; obj* x_116; obj* x_119; obj* x_121; obj* x_122; obj* x_124; obj* x_125; obj* x_126; obj* x_127; obj* x_128; obj* x_129; obj* x_130; +lean::dec(x_81); +x_101 = lean::cnstr_get(x_80, 1); +if (lean::is_exclusive(x_80)) { + lean::cnstr_release(x_80, 0); + x_103 = x_80; } else { - lean::inc(x_85); - lean::dec(x_64); - x_87 = lean::box(0); + lean::inc(x_101); + lean::dec(x_80); + x_103 = lean::box(0); } -x_88 = lean::cnstr_get(x_18, 0); -lean::inc(x_88); -x_90 = lean::cnstr_get(x_88, 0); -lean::inc(x_90); -lean::dec(x_88); -x_93 = lean::cnstr_get(x_90, 0); -lean::inc(x_93); -lean::dec(x_90); -x_96 = l_lean_expander_builtin__transformers; -lean::inc(x_93); -x_98 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_98, 0, x_93); -lean::cnstr_set(x_98, 1, x_96); -x_99 = lean::cnstr_get(x_93, 2); -lean::inc(x_99); -lean::dec(x_93); -x_102 = lean::alloc_cnstr(0, 3, 0); -lean::cnstr_set(x_102, 0, x_0); -lean::cnstr_set(x_102, 1, x_1); -lean::cnstr_set(x_102, 2, x_99); -lean::inc(x_18); -x_104 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_104, 0, x_102); -lean::cnstr_set(x_104, 1, x_18); -x_105 = l_lean_run__frontend___closed__1; -lean::inc(x_104); -x_107 = l_lean_elaborator_mk__state(x_104, x_4, x_105); -x_108 = lean::box(0); -if (lean::is_scalar(x_87)) { - x_109 = lean::alloc_cnstr(0, 2, 0); +if (lean::is_scalar(x_103)) { + x_104 = lean::alloc_cnstr(0, 2, 0); } else { - x_109 = x_87; + x_104 = x_103; } -lean::cnstr_set(x_109, 0, x_98); -lean::cnstr_set(x_109, 1, x_108); -if (lean::is_scalar(x_60)) { - x_110 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_104, 0, x_32); +lean::cnstr_set(x_104, 1, x_101); +x_105 = lean::cnstr_get(x_21, 0); +lean::inc(x_105); +x_107 = lean::cnstr_get(x_105, 0); +lean::inc(x_107); +lean::dec(x_105); +x_110 = lean::cnstr_get(x_107, 0); +lean::inc(x_110); +lean::dec(x_107); +x_113 = l_lean_expander_builtin__transformers; +lean::inc(x_110); +x_115 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_115, 0, x_110); +lean::cnstr_set(x_115, 1, x_113); +x_116 = lean::cnstr_get(x_110, 2); +lean::inc(x_116); +lean::dec(x_110); +x_119 = lean::alloc_cnstr(0, 3, 0); +lean::cnstr_set(x_119, 0, x_0); +lean::cnstr_set(x_119, 1, x_1); +lean::cnstr_set(x_119, 2, x_116); +lean::inc(x_21); +x_121 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_121, 0, x_119); +lean::cnstr_set(x_121, 1, x_21); +x_122 = l_lean_run__frontend___closed__1; +lean::inc(x_121); +x_124 = l_lean_elaborator_mk__state(x_121, x_4, x_122); +x_125 = lean::box(0); +if (lean::is_scalar(x_76)) { + x_126 = lean::alloc_cnstr(0, 2, 0); } else { - x_110 = x_60; + x_126 = x_76; } -lean::cnstr_set(x_110, 0, x_18); -lean::cnstr_set(x_110, 1, x_109); -if (lean::is_scalar(x_25)) { - x_111 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_126, 0, x_115); +lean::cnstr_set(x_126, 1, x_125); +if (lean::is_scalar(x_31)) { + x_127 = lean::alloc_cnstr(0, 2, 0); } else { - x_111 = x_25; + x_127 = x_31; } -lean::cnstr_set(x_111, 0, x_107); -lean::cnstr_set(x_111, 1, x_110); -x_112 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_112, 0, x_56); -lean::cnstr_set(x_112, 1, x_111); -x_113 = l_io_prim_iterate___at_lean_run__frontend___spec__6(x_2, x_3, x_61, x_104, x_108, x_112, x_85); -return x_113; +lean::cnstr_set(x_127, 0, x_21); +lean::cnstr_set(x_127, 1, x_126); +x_128 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_128, 0, x_124); +lean::cnstr_set(x_128, 1, x_127); +x_129 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_129, 0, x_72); +lean::cnstr_set(x_129, 1, x_128); +x_130 = l_io_prim_iterate___at_lean_run__frontend___spec__5(x_2, x_3, x_77, x_121, x_125, x_129, x_104); +return x_130; +} +} +else +{ +obj* x_140; obj* x_142; obj* x_144; obj* x_145; +lean::dec(x_21); +lean::dec(x_4); +lean::dec(x_1); +lean::dec(x_0); +lean::dec(x_2); +lean::dec(x_31); +lean::dec(x_72); +lean::dec(x_76); +lean::dec(x_77); +x_140 = lean::cnstr_get(x_80, 0); +x_142 = lean::cnstr_get(x_80, 1); +if (lean::is_exclusive(x_80)) { + x_144 = x_80; +} else { + lean::inc(x_140); + lean::inc(x_142); + lean::dec(x_80); + x_144 = lean::box(0); +} +if (lean::is_scalar(x_144)) { + x_145 = lean::alloc_cnstr(1, 2, 0); +} else { + x_145 = x_144; +} +lean::cnstr_set(x_145, 0, x_140); +lean::cnstr_set(x_145, 1, x_142); +return x_145; } } } } } -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__1___boxed(obj* x_0, obj* x_1, obj* x_2) { +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__1___boxed(obj* x_0, obj* x_1, obj* x_2) { _start: { obj* x_3; -x_3 = l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__1(x_0, x_1, x_2); +x_3 = l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__1(x_0, x_1, x_2); lean::dec(x_2); return x_3; } } -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__2___boxed(obj* x_0, obj* x_1, obj* x_2) { +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__2___boxed(obj* x_0, obj* x_1, obj* x_2) { _start: { obj* x_3; -x_3 = l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__2(x_0, x_1, x_2); +x_3 = l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__2(x_0, x_1, x_2); lean::dec(x_2); return x_3; } } -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__3___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__3___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3) { _start: { obj* x_4; -x_4 = l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__3(x_0, x_1, x_2, x_3); +x_4 = l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__3(x_0, x_1, x_2, x_3); lean::dec(x_3); return x_4; } } -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { _start: { uint8 x_7; obj* x_8; x_7 = lean::unbox(x_2); -x_8 = l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4(x_0, x_1, x_7, x_3, x_4, x_5, x_6); +x_8 = l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4(x_0, x_1, x_7, x_3, x_4, x_5, x_6); return x_8; } } -obj* l_io_prim_iterate___at_lean_run__frontend___spec__6___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { +obj* l_io_prim_iterate___at_lean_run__frontend___spec__5___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { _start: { uint8 x_7; obj* x_8; x_7 = lean::unbox(x_1); -x_8 = l_io_prim_iterate___at_lean_run__frontend___spec__6(x_0, x_7, x_2, x_3, x_4, x_5, x_6); -return x_8; -} -} -obj* l_io_prim_iterate__eio___at_lean_run__frontend___spec__5___boxed(obj* x_0, obj* x_1, obj* x_2, obj* x_3, obj* x_4, obj* x_5, obj* x_6) { -_start: -{ -uint8 x_7; obj* x_8; -x_7 = lean::unbox(x_1); -x_8 = l_io_prim_iterate__eio___at_lean_run__frontend___spec__5(x_0, x_7, x_2, x_3, x_4, x_5, x_6); +x_8 = l_io_prim_iterate___at_lean_run__frontend___spec__5(x_0, x_7, x_2, x_3, x_4, x_5, x_6); return x_8; } } @@ -1842,79 +2055,53 @@ return x_7; obj* l___private_init_io_1__put__str___at_lean_process__file___spec__3(obj* x_0, obj* x_1) { _start: { -obj* x_2; obj* x_3; +obj* x_2; x_2 = lean_io_prim_put_str(x_0, x_1); -x_3 = lean::cnstr_get(x_2, 0); -lean::inc(x_3); -if (lean::obj_tag(x_3) == 0) +if (lean::obj_tag(x_2) == 0) { -obj* x_5; obj* x_7; obj* x_8; obj* x_10; obj* x_11; obj* x_12; +obj* x_3; obj* x_5; obj* x_7; obj* x_8; obj* x_9; +x_3 = lean::cnstr_get(x_2, 0); x_5 = lean::cnstr_get(x_2, 1); if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); x_7 = x_2; } else { + lean::inc(x_3); lean::inc(x_5); lean::dec(x_2); x_7 = lean::box(0); } -x_8 = lean::cnstr_get(x_3, 0); -if (lean::is_exclusive(x_3)) { - x_10 = x_3; -} else { - lean::inc(x_8); - lean::dec(x_3); - x_10 = lean::box(0); -} -if (lean::is_scalar(x_10)) { - x_11 = lean::alloc_cnstr(0, 1, 0); -} else { - x_11 = x_10; -} -lean::cnstr_set(x_11, 0, x_8); +x_8 = lean::alloc_cnstr(1, 1, 0); +lean::cnstr_set(x_8, 0, x_3); if (lean::is_scalar(x_7)) { - x_12 = lean::alloc_cnstr(0, 2, 0); + x_9 = lean::alloc_cnstr(0, 2, 0); } else { - x_12 = x_7; + x_9 = x_7; } -lean::cnstr_set(x_12, 0, x_11); -lean::cnstr_set(x_12, 1, x_5); -return x_12; +lean::cnstr_set(x_9, 0, x_8); +lean::cnstr_set(x_9, 1, x_5); +return x_9; } else { -obj* x_13; obj* x_15; obj* x_16; obj* x_18; obj* x_19; obj* x_20; -x_13 = lean::cnstr_get(x_2, 1); +obj* x_10; obj* x_12; obj* x_14; obj* x_15; +x_10 = lean::cnstr_get(x_2, 0); +x_12 = lean::cnstr_get(x_2, 1); if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); - x_15 = x_2; + x_14 = x_2; } else { - lean::inc(x_13); + lean::inc(x_10); + lean::inc(x_12); lean::dec(x_2); - x_15 = lean::box(0); + x_14 = lean::box(0); } -x_16 = lean::cnstr_get(x_3, 0); -if (lean::is_exclusive(x_3)) { - x_18 = x_3; +if (lean::is_scalar(x_14)) { + x_15 = lean::alloc_cnstr(1, 2, 0); } else { - lean::inc(x_16); - lean::dec(x_3); - x_18 = lean::box(0); + x_15 = x_14; } -if (lean::is_scalar(x_18)) { - x_19 = lean::alloc_cnstr(1, 1, 0); -} else { - x_19 = x_18; -} -lean::cnstr_set(x_19, 0, x_16); -if (lean::is_scalar(x_15)) { - x_20 = lean::alloc_cnstr(0, 2, 0); -} else { - x_20 = x_15; -} -lean::cnstr_set(x_20, 0, x_19); -lean::cnstr_set(x_20, 1, x_13); -return x_20; +lean::cnstr_set(x_15, 0, x_10); +lean::cnstr_set(x_15, 1, x_12); +return x_15; } } } @@ -1929,8 +2116,11 @@ return x_2; obj* l_io_println___at_lean_process__file___spec__1(obj* x_0, obj* x_1) { _start: { -obj* x_2; obj* x_3; +obj* x_2; x_2 = l___private_init_io_1__put__str___at_lean_process__file___spec__3(x_0, x_1); +if (lean::obj_tag(x_2) == 0) +{ +obj* x_3; x_3 = lean::cnstr_get(x_2, 0); lean::inc(x_3); if (lean::obj_tag(x_3) == 0) @@ -1970,14 +2160,51 @@ return x_12; } else { -obj* x_14; obj* x_17; obj* x_18; +obj* x_14; obj* x_16; obj* x_17; obj* x_18; obj* x_19; obj* x_20; lean::dec(x_3); x_14 = lean::cnstr_get(x_2, 1); -lean::inc(x_14); -lean::dec(x_2); -x_17 = l_lean_format_be___main___closed__1; -x_18 = l___private_init_io_1__put__str___at_lean_process__file___spec__3(x_17, x_14); -return x_18; +if (lean::is_exclusive(x_2)) { + lean::cnstr_release(x_2, 0); + x_16 = x_2; +} else { + lean::inc(x_14); + lean::dec(x_2); + x_16 = lean::box(0); +} +x_17 = lean::box(0); +if (lean::is_scalar(x_16)) { + x_18 = lean::alloc_cnstr(0, 2, 0); +} else { + x_18 = x_16; +} +lean::cnstr_set(x_18, 0, x_17); +lean::cnstr_set(x_18, 1, x_14); +x_19 = l_lean_format_be___main___closed__1; +x_20 = l___private_init_io_1__put__str___at_lean_process__file___spec__3(x_19, x_18); +return x_20; +} +} +else +{ +obj* x_21; obj* x_23; obj* x_25; obj* x_26; +x_21 = lean::cnstr_get(x_2, 0); +x_23 = lean::cnstr_get(x_2, 1); +if (lean::is_exclusive(x_2)) { + x_25 = x_2; +} else { + lean::inc(x_21); + lean::inc(x_23); + lean::dec(x_2); + x_25 = lean::box(0); +} +if (lean::is_scalar(x_25)) { + x_26 = lean::alloc_cnstr(1, 2, 0); +} else { + x_26 = x_25; +} +lean::cnstr_set(x_26, 0, x_21); +lean::cnstr_set(x_26, 1, x_23); +return x_26; } } } @@ -2207,194 +2434,351 @@ return x_27; obj* lean_process_file(obj* x_0, obj* x_1, uint8 x_2, obj* x_3, obj* x_4) { _start: { -obj* x_5; obj* x_6; obj* x_8; obj* x_9; uint8 x_10; obj* x_12; obj* x_13; -x_8 = lean::box(x_2); -x_9 = lean::alloc_closure(reinterpret_cast(l_lean_process__file___lambda__1___boxed), 3, 1); -lean::closure_set(x_9, 0, x_8); -x_10 = 0; +obj* x_5; obj* x_6; obj* x_8; obj* x_9; obj* x_11; obj* x_12; uint8 x_13; obj* x_15; +x_11 = lean::box(x_2); +x_12 = lean::alloc_closure(reinterpret_cast(l_lean_process__file___lambda__1___boxed), 3, 1); +lean::closure_set(x_12, 0, x_11); +x_13 = 0; lean::inc(x_0); -x_12 = l_lean_run__frontend(x_0, x_1, x_9, x_10, x_3, x_4); -x_13 = lean::cnstr_get(x_12, 0); -lean::inc(x_13); -if (lean::obj_tag(x_13) == 0) +x_15 = l_lean_run__frontend(x_0, x_1, x_12, x_13, x_3, x_4); +if (lean::obj_tag(x_15) == 0) { -obj* x_15; obj* x_18; obj* x_20; obj* x_21; -x_15 = lean::cnstr_get(x_12, 1); -lean::inc(x_15); -lean::dec(x_12); -x_18 = lean::cnstr_get(x_13, 0); -if (lean::is_exclusive(x_13)) { - x_20 = x_13; +obj* x_16; +x_16 = lean::cnstr_get(x_15, 0); +lean::inc(x_16); +if (lean::obj_tag(x_16) == 0) +{ +obj* x_18; obj* x_21; obj* x_23; obj* x_24; +x_18 = lean::cnstr_get(x_15, 1); +lean::inc(x_18); +lean::dec(x_15); +x_21 = lean::cnstr_get(x_16, 0); +if (lean::is_exclusive(x_16)) { + x_23 = x_16; } else { - lean::inc(x_18); - lean::dec(x_13); - x_20 = lean::box(0); + lean::inc(x_21); + lean::dec(x_16); + x_23 = lean::box(0); } -if (lean::is_scalar(x_20)) { - x_21 = lean::alloc_cnstr(0, 1, 0); +if (lean::is_scalar(x_23)) { + x_24 = lean::alloc_cnstr(0, 1, 0); } else { - x_21 = x_20; + x_24 = x_23; } -lean::cnstr_set(x_21, 0, x_18); -x_5 = x_21; -x_6 = x_15; -goto lbl_7; +lean::cnstr_set(x_24, 0, x_21); +x_8 = x_24; +x_9 = x_18; +goto lbl_10; } else { -obj* x_22; obj* x_24; obj* x_25; obj* x_28; obj* x_30; obj* x_31; obj* x_32; obj* x_33; -x_22 = lean::cnstr_get(x_13, 0); -if (lean::is_exclusive(x_13)) { - x_24 = x_13; +obj* x_25; obj* x_27; obj* x_28; obj* x_31; obj* x_33; obj* x_34; obj* x_35; obj* x_36; +x_25 = lean::cnstr_get(x_16, 0); +if (lean::is_exclusive(x_16)) { + x_27 = x_16; } else { - lean::inc(x_22); - lean::dec(x_13); - x_24 = lean::box(0); + lean::inc(x_25); + lean::dec(x_16); + x_27 = lean::box(0); } -x_25 = lean::cnstr_get(x_12, 1); -lean::inc(x_25); -lean::dec(x_12); -x_28 = lean::cnstr_get(x_22, 1); -if (lean::is_exclusive(x_22)) { - lean::cnstr_release(x_22, 0); - x_30 = x_22; +x_28 = lean::cnstr_get(x_15, 1); +lean::inc(x_28); +lean::dec(x_15); +x_31 = lean::cnstr_get(x_25, 1); +if (lean::is_exclusive(x_25)) { + lean::cnstr_release(x_25, 0); + x_33 = x_25; } else { - lean::inc(x_28); - lean::dec(x_22); - x_30 = lean::box(0); + lean::inc(x_31); + lean::dec(x_25); + x_33 = lean::box(0); } -x_31 = lean::box(0); -if (lean::is_scalar(x_30)) { - x_32 = lean::alloc_cnstr(0, 2, 0); +x_34 = lean::box(0); +if (lean::is_scalar(x_33)) { + x_35 = lean::alloc_cnstr(0, 2, 0); } else { - x_32 = x_30; + x_35 = x_33; } -lean::cnstr_set(x_32, 0, x_31); -lean::cnstr_set(x_32, 1, x_28); -if (lean::is_scalar(x_24)) { - x_33 = lean::alloc_cnstr(1, 1, 0); +lean::cnstr_set(x_35, 0, x_34); +lean::cnstr_set(x_35, 1, x_31); +if (lean::is_scalar(x_27)) { + x_36 = lean::alloc_cnstr(1, 1, 0); } else { - x_33 = x_24; + x_36 = x_27; } -lean::cnstr_set(x_33, 0, x_32); -x_5 = x_33; -x_6 = x_25; -goto lbl_7; +lean::cnstr_set(x_36, 0, x_35); +x_8 = x_36; +x_9 = x_28; +goto lbl_10; +} +} +else +{ +obj* x_38; obj* x_40; obj* x_42; obj* x_43; +lean::dec(x_0); +x_38 = lean::cnstr_get(x_15, 0); +x_40 = lean::cnstr_get(x_15, 1); +if (lean::is_exclusive(x_15)) { + x_42 = x_15; +} else { + lean::inc(x_38); + lean::inc(x_40); + lean::dec(x_15); + x_42 = lean::box(0); +} +if (lean::is_scalar(x_42)) { + x_43 = lean::alloc_cnstr(1, 2, 0); +} else { + x_43 = x_42; +} +lean::cnstr_set(x_43, 0, x_38); +lean::cnstr_set(x_43, 1, x_40); +return x_43; } lbl_7: { if (lean::obj_tag(x_5) == 0) { +obj* x_45; obj* x_46; +lean::dec(x_5); +x_45 = l_lean_process__file___closed__1; +x_46 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_46, 0, x_45); +lean::cnstr_set(x_46, 1, x_6); +return x_46; +} +else +{ +obj* x_47; obj* x_49; obj* x_50; obj* x_51; +x_47 = lean::cnstr_get(x_5, 0); +if (lean::is_exclusive(x_5)) { + x_49 = x_5; +} else { + lean::inc(x_47); + lean::dec(x_5); + x_49 = lean::box(0); +} +if (lean::is_scalar(x_49)) { + x_50 = lean::alloc_cnstr(1, 1, 0); +} else { + x_50 = x_49; +} +lean::cnstr_set(x_50, 0, x_47); +x_51 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_51, 0, x_50); +lean::cnstr_set(x_51, 1, x_6); +return x_51; +} +} +lbl_10: +{ +if (lean::obj_tag(x_8) == 0) +{ +obj* x_52; obj* x_55; obj* x_56; +x_52 = lean::cnstr_get(x_8, 0); +lean::inc(x_52); +lean::dec(x_8); +x_55 = lean::box(0); +x_56 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_56, 0, x_55); +lean::cnstr_set(x_56, 1, x_9); if (x_2 == 0) { -obj* x_34; obj* x_37; obj* x_38; uint8 x_39; obj* x_40; obj* x_41; obj* x_42; obj* x_43; obj* x_44; obj* x_46; obj* x_48; obj* x_49; obj* x_50; -x_34 = lean::cnstr_get(x_5, 0); -lean::inc(x_34); -lean::dec(x_5); -x_37 = lean::box(0); -x_38 = l_lean_elaborator_notation_elaborate___closed__1; -x_39 = 2; -x_40 = l_string_iterator_extract___main___closed__1; -x_41 = lean::alloc_cnstr(0, 5, 1); -lean::cnstr_set(x_41, 0, x_0); -lean::cnstr_set(x_41, 1, x_38); -lean::cnstr_set(x_41, 2, x_37); -lean::cnstr_set(x_41, 3, x_40); -lean::cnstr_set(x_41, 4, x_34); -lean::cnstr_set_scalar(x_41, sizeof(void*)*5, x_39); -x_42 = x_41; -x_43 = l_lean_message_to__string(x_42); -x_44 = l_io_println___at_lean_process__file___spec__1(x_43, x_6); -lean::dec(x_43); -x_46 = lean::cnstr_get(x_44, 1); -if (lean::is_exclusive(x_44)) { - lean::cnstr_release(x_44, 0); - x_48 = x_44; -} else { - lean::inc(x_46); - lean::dec(x_44); - x_48 = lean::box(0); -} -x_49 = l_lean_process__file___closed__1; -if (lean::is_scalar(x_48)) { - x_50 = lean::alloc_cnstr(0, 2, 0); -} else { - x_50 = x_48; -} -lean::cnstr_set(x_50, 0, x_49); -lean::cnstr_set(x_50, 1, x_46); -return x_50; -} -else -{ -obj* x_52; obj* x_55; obj* x_56; obj* x_57; obj* x_59; obj* x_60; obj* x_61; obj* x_63; obj* x_65; obj* x_66; obj* x_67; -lean::dec(x_0); -x_52 = lean::cnstr_get(x_5, 0); +obj* x_57; obj* x_58; uint8 x_59; obj* x_60; obj* x_62; obj* x_63; obj* x_64; obj* x_65; +x_57 = lean::box(0); +x_58 = l_lean_elaborator_notation_elaborate___closed__1; +x_59 = 2; +x_60 = l_string_iterator_extract___main___closed__1; lean::inc(x_52); -lean::dec(x_5); -x_55 = l_string_quote(x_52); -x_56 = l_lean_process__file___closed__2; -x_57 = lean::string_append(x_56, x_55); -lean::dec(x_55); -x_59 = l_lean_process__file___lambda__1___closed__7; -x_60 = lean::string_append(x_57, x_59); -x_61 = l_io_println___at_lean_process__file___spec__1(x_60, x_6); -lean::dec(x_60); -x_63 = lean::cnstr_get(x_61, 1); -if (lean::is_exclusive(x_61)) { - lean::cnstr_release(x_61, 0); - x_65 = x_61; +x_62 = lean::alloc_cnstr(0, 5, 1); +lean::cnstr_set(x_62, 0, x_0); +lean::cnstr_set(x_62, 1, x_58); +lean::cnstr_set(x_62, 2, x_57); +lean::cnstr_set(x_62, 3, x_60); +lean::cnstr_set(x_62, 4, x_52); +lean::cnstr_set_scalar(x_62, sizeof(void*)*5, x_59); +x_63 = x_62; +x_64 = l_lean_message_to__string(x_63); +x_65 = l_io_println___at_lean_process__file___spec__1(x_64, x_56); +lean::dec(x_64); +if (lean::obj_tag(x_65) == 0) +{ +obj* x_67; +x_67 = lean::cnstr_get(x_65, 0); +lean::inc(x_67); +if (lean::obj_tag(x_67) == 0) +{ +obj* x_70; obj* x_73; obj* x_75; obj* x_76; +lean::dec(x_52); +x_70 = lean::cnstr_get(x_65, 1); +lean::inc(x_70); +lean::dec(x_65); +x_73 = lean::cnstr_get(x_67, 0); +if (lean::is_exclusive(x_67)) { + x_75 = x_67; } else { - lean::inc(x_63); - lean::dec(x_61); - x_65 = lean::box(0); + lean::inc(x_73); + lean::dec(x_67); + x_75 = lean::box(0); } -x_66 = l_lean_process__file___closed__1; -if (lean::is_scalar(x_65)) { - x_67 = lean::alloc_cnstr(0, 2, 0); +if (lean::is_scalar(x_75)) { + x_76 = lean::alloc_cnstr(0, 1, 0); } else { - x_67 = x_65; + x_76 = x_75; +} +lean::cnstr_set(x_76, 0, x_73); +x_5 = x_76; +x_6 = x_70; +goto lbl_7; +} +else +{ +obj* x_77; obj* x_78; obj* x_81; +if (lean::is_exclusive(x_67)) { + lean::cnstr_release(x_67, 0); + x_77 = x_67; +} else { + lean::dec(x_67); + x_77 = lean::box(0); +} +x_78 = lean::cnstr_get(x_65, 1); +lean::inc(x_78); +lean::dec(x_65); +if (lean::is_scalar(x_77)) { + x_81 = lean::alloc_cnstr(0, 1, 0); +} else { + x_81 = x_77; + lean::cnstr_set_tag(x_77, 0); +} +lean::cnstr_set(x_81, 0, x_52); +x_5 = x_81; +x_6 = x_78; +goto lbl_7; +} +} +else +{ +obj* x_83; obj* x_85; obj* x_87; obj* x_88; +lean::dec(x_52); +x_83 = lean::cnstr_get(x_65, 0); +x_85 = lean::cnstr_get(x_65, 1); +if (lean::is_exclusive(x_65)) { + x_87 = x_65; +} else { + lean::inc(x_83); + lean::inc(x_85); + lean::dec(x_65); + x_87 = lean::box(0); +} +if (lean::is_scalar(x_87)) { + x_88 = lean::alloc_cnstr(1, 2, 0); +} else { + x_88 = x_87; +} +lean::cnstr_set(x_88, 0, x_83); +lean::cnstr_set(x_88, 1, x_85); +return x_88; +} +} +else +{ +obj* x_91; obj* x_92; obj* x_93; obj* x_95; obj* x_96; obj* x_97; +lean::dec(x_0); +lean::inc(x_52); +x_91 = l_string_quote(x_52); +x_92 = l_lean_process__file___closed__2; +x_93 = lean::string_append(x_92, x_91); +lean::dec(x_91); +x_95 = l_lean_process__file___lambda__1___closed__7; +x_96 = lean::string_append(x_93, x_95); +x_97 = l_io_println___at_lean_process__file___spec__1(x_96, x_56); +lean::dec(x_96); +if (lean::obj_tag(x_97) == 0) +{ +obj* x_99; +x_99 = lean::cnstr_get(x_97, 0); +lean::inc(x_99); +if (lean::obj_tag(x_99) == 0) +{ +obj* x_102; obj* x_105; obj* x_107; obj* x_108; +lean::dec(x_52); +x_102 = lean::cnstr_get(x_97, 1); +lean::inc(x_102); +lean::dec(x_97); +x_105 = lean::cnstr_get(x_99, 0); +if (lean::is_exclusive(x_99)) { + x_107 = x_99; +} else { + lean::inc(x_105); + lean::dec(x_99); + x_107 = lean::box(0); +} +if (lean::is_scalar(x_107)) { + x_108 = lean::alloc_cnstr(0, 1, 0); +} else { + x_108 = x_107; +} +lean::cnstr_set(x_108, 0, x_105); +x_5 = x_108; +x_6 = x_102; +goto lbl_7; +} +else +{ +obj* x_109; obj* x_110; obj* x_113; +if (lean::is_exclusive(x_99)) { + lean::cnstr_release(x_99, 0); + x_109 = x_99; +} else { + lean::dec(x_99); + x_109 = lean::box(0); +} +x_110 = lean::cnstr_get(x_97, 1); +lean::inc(x_110); +lean::dec(x_97); +if (lean::is_scalar(x_109)) { + x_113 = lean::alloc_cnstr(0, 1, 0); +} else { + x_113 = x_109; + lean::cnstr_set_tag(x_109, 0); +} +lean::cnstr_set(x_113, 0, x_52); +x_5 = x_113; +x_6 = x_110; +goto lbl_7; +} +} +else +{ +obj* x_115; obj* x_117; obj* x_119; obj* x_120; +lean::dec(x_52); +x_115 = lean::cnstr_get(x_97, 0); +x_117 = lean::cnstr_get(x_97, 1); +if (lean::is_exclusive(x_97)) { + x_119 = x_97; +} else { + lean::inc(x_115); + lean::inc(x_117); + lean::dec(x_97); + x_119 = lean::box(0); +} +if (lean::is_scalar(x_119)) { + x_120 = lean::alloc_cnstr(1, 2, 0); +} else { + x_120 = x_119; +} +lean::cnstr_set(x_120, 0, x_115); +lean::cnstr_set(x_120, 1, x_117); +return x_120; } -lean::cnstr_set(x_67, 0, x_66); -lean::cnstr_set(x_67, 1, x_63); -return x_67; } } else { lean::dec(x_0); -if (lean::obj_tag(x_5) == 0) -{ -obj* x_70; obj* x_71; -lean::dec(x_5); -x_70 = l_lean_process__file___closed__1; -x_71 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_71, 0, x_70); -lean::cnstr_set(x_71, 1, x_6); -return x_71; -} -else -{ -obj* x_72; obj* x_74; obj* x_75; obj* x_76; -x_72 = lean::cnstr_get(x_5, 0); -if (lean::is_exclusive(x_5)) { - x_74 = x_5; -} else { - lean::inc(x_72); - lean::dec(x_5); - x_74 = lean::box(0); -} -if (lean::is_scalar(x_74)) { - x_75 = lean::alloc_cnstr(1, 1, 0); -} else { - x_75 = x_74; -} -lean::cnstr_set(x_75, 0, x_72); -x_76 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_76, 0, x_75); -lean::cnstr_set(x_76, 1, x_6); -return x_76; -} +x_5 = x_8; +x_6 = x_9; +goto lbl_7; } } } @@ -2462,12 +2846,12 @@ void initialize_init_lean_frontend() { initialize_init_io(); l_list_mmap_x_27___main___at_lean_run__frontend___spec__1___closed__1 = _init_l_list_mmap_x_27___main___at_lean_run__frontend___spec__1___closed__1(); lean::mark_persistent(l_list_mmap_x_27___main___at_lean_run__frontend___spec__1___closed__1); - l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__1 = _init_l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__1(); -lean::mark_persistent(l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__1); - l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__2 = _init_l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__2(); -lean::mark_persistent(l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__2); - l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__3 = _init_l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__3(); -lean::mark_persistent(l_io_prim_iterate___at_lean_run__frontend___spec__6___lambda__4___closed__3); + l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__1 = _init_l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__1(); +lean::mark_persistent(l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__1); + l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__2 = _init_l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__2(); +lean::mark_persistent(l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__2); + l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__3 = _init_l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__3(); +lean::mark_persistent(l_io_prim_iterate___at_lean_run__frontend___spec__5___lambda__4___closed__3); l_lean_run__frontend___closed__1 = _init_l_lean_run__frontend___closed__1(); lean::mark_persistent(l_lean_run__frontend___closed__1); l_lean_process__file___lambda__1___closed__1 = _init_l_lean_process__file___lambda__1___closed__1(); diff --git a/src/library/compiler/emit_cpp.cpp b/src/library/compiler/emit_cpp.cpp index 236cb58c56..06107e1077 100644 --- a/src/library/compiler/emit_cpp.cpp +++ b/src/library/compiler/emit_cpp.cpp @@ -1143,14 +1143,20 @@ static void emit_main_fn(std::ostream & out, environment const & env, module_nam out << " obj* n = lean::alloc_cnstr(1,2,0); lean::cnstr_set(n, 0, lean::mk_string(argv[i])); lean::cnstr_set(n, 1, in);\n"; out << " in = n;\n"; out << "}\n"; - out << "obj * r = " << g_lean_main << "(in, lean::box(0));\n"; + out << "obj * r = " << g_lean_main << "(in, lean::io_mk_world());\n"; } else { - out << "obj * r = " << g_lean_main << "(lean::box(0));\n"; + out << "obj * r = " << g_lean_main << "(lean::io_mk_world());\n"; } - out << "int ret = lean::unbox(lean::cnstr_get(r, 0));\n"; - out << "lean::dec(r);\n"; - out << "return ret;\n"; - out << "}\n"; + out << + "if (io_is_result_ok(r)) {\n" + " int ret = lean::unbox(io_get_result(r));\n" + " lean::dec_ref(r);\n" + " return ret;\n" + "} else {\n" + " lean::dec_ref(r);\n" + " return 1;\n" + "}\n" + "}\n"; } void emit_cpp(std::ostream & out, environment const & env, module_name const & m, list const & deps) { diff --git a/src/runtime/io.cpp b/src/runtime/io.cpp index bad8d978c3..760b4a4a6d 100644 --- a/src/runtime/io.cpp +++ b/src/runtime/io.cpp @@ -12,24 +12,33 @@ Author: Leonardo de Moura namespace lean { static obj_res const REAL_WORLD = box(0); -obj_res mk_io_result(obj_arg r) { - object * res = alloc_cnstr(0, 2, 0); - cnstr_set(res, 0, r); - cnstr_set(res, 1, REAL_WORLD); - return res; +obj_res set_io_result(obj_arg r, obj_arg a) { + if (is_exclusive(r)) { + cnstr_set(r, 0, a); + return r; + } else { + dec_ref(r); + object * new_r = alloc_cnstr(0, 2, 0); + cnstr_set(new_r, 0, a); + cnstr_set(new_r, 1, REAL_WORLD); + return new_r; + } +} +static obj_res option_of_io_result(obj_arg r) { + if (io_is_result_ok(r)) { + object * o = alloc_cnstr(1, 1, 0); + cnstr_set(o, 0, io_get_result(r)); + dec(r); + return o; + } else { + dec(r); + return box(0); + } } -/* `(r : α) → (except ε α × real_world)` */ -obj_res mk_ioe_result(obj_arg r) { - object * res = alloc_cnstr(1, 1, 0); - cnstr_set(res, 0, r); - return mk_io_result(res); -} - -extern "C" obj_res lean_io_prim_put_str(b_obj_arg s, obj_arg /* w */) { - // TODO(Leo): this is a temporary hack for testing - std::cout << string_to_std(s); - return mk_ioe_result(box(0)); +extern "C" obj_res lean_io_prim_put_str(b_obj_arg s, obj_arg r) { + std::cout << string_to_std(s); // TODO(Leo): use out handle + return set_io_result(r, box(0)); } extern "C" obj_res lean_io_prim_get_line(obj_arg /* w */) { @@ -67,18 +76,16 @@ extern "C" obj_res lean_io_prim_handle_get_line(b_obj_arg /* h */, obj_arg /* w lean_unreachable(); } -/* constant unsafe_io {α : Type} [inhabited α] (fn : io α) : α */ -extern "C" obj_res lean_io_unsafe(obj_arg, obj_arg, obj_arg fn) { - object * r = apply_1(fn, REAL_WORLD); - object * a = cnstr_get(r, 0); - inc(a); dec(r); - return a; +/* constant unsafe_io {α : Type} (fn : io α) : option α */ +extern "C" obj_res lean_io_unsafe(obj_arg, obj_arg fn) { + object * r = io_mk_world(); + return option_of_io_result(apply_1(fn, r)); } /* timeit {α : Type} (msg : @& string) (fn : io α) : io α */ -extern "C" obj_res lean_io_timeit(obj_arg, b_obj_arg msg, obj_arg fn, obj_arg w) { +extern "C" obj_res lean_io_timeit(obj_arg, b_obj_arg msg, obj_arg fn, obj_arg r) { auto start = std::chrono::steady_clock::now(); - object * r = apply_1(fn, w); + r = apply_1(fn, r); auto end = std::chrono::steady_clock::now(); auto diff = std::chrono::duration(end - start); std::ostream & out = std::cerr; // TODO(Leo): replace? @@ -92,9 +99,9 @@ extern "C" obj_res lean_io_timeit(obj_arg, b_obj_arg msg, obj_arg fn, obj_arg w) } /* allocprof {α : Type} (msg : string) (fn : io α) : io α */ -extern "C" obj_res lean_io_allocprof(obj_arg, b_obj_arg msg, obj_arg fn, obj_arg w) { +extern "C" obj_res lean_io_allocprof(obj_arg, b_obj_arg msg, obj_arg fn, obj_arg r) { std::ostream & out = std::cerr; // TODO(Leo): replace? allocprof prof(out, string_cstr(msg)); - return apply_1(fn, w); + return apply_1(fn, r); } } diff --git a/src/runtime/object.h b/src/runtime/object.h index c67ae649f9..455b789222 100644 --- a/src/runtime/object.h +++ b/src/runtime/object.h @@ -1437,6 +1437,18 @@ object * array_push(obj_arg a, obj_arg v); object * dbg_trace(obj_arg s, obj_arg fn); object * dbg_sleep(uint32 ms, obj_arg fn); +// ======================================= +// IO helper functions +inline obj_res io_mk_world() { + object * r = alloc_cnstr(0, 2, 0); + cnstr_set(r, 0, box(0)); + cnstr_set(r, 1, box(0)); + return r; +} +inline bool io_is_result_ok(b_obj_arg r) { return cnstr_tag(r) == 0; } +inline bool io_is_result_error(b_obj_arg r) { return cnstr_tag(r) == 1; } +inline b_obj_res io_get_result(b_obj_arg r) { lean_assert(io_is_result_ok(r)); return cnstr_get(r, 0); } + // ======================================= // Module initialization/finalization void initialize_object(); diff --git a/tests/compiler/append.lean b/tests/compiler/append.lean index d8f384d4f1..1c7da0b923 100644 --- a/tests/compiler/append.lean +++ b/tests/compiler/append.lean @@ -1,5 +1,5 @@ def main (xs : list string) : io uint32 := let ys1 := list.repeat 1 1000000 in let ys2 := list.repeat 2 1000000 in -io.println' (to_string (ys1 ++ ys2).length) *> +io.println (to_string (ys1 ++ ys2).length) *> pure 0 diff --git a/tests/compiler/array_test.lean b/tests/compiler/array_test.lean index 97cbc4b087..7e8def16d1 100644 --- a/tests/compiler/array_test.lean +++ b/tests/compiler/array_test.lean @@ -8,17 +8,17 @@ a def main : io uint32 := do let a : array nat := array.nil, - io.println' (to_string a), - io.println' (to_string a.sz), + io.println (to_string a), + io.println (to_string a.sz), let a := foo a, - io.println' (to_string a), + io.println (to_string a), let a := a.map (+10), - io.println' (to_string a), - io.println' (to_string a.sz), + io.println (to_string a), + io.println (to_string a.sz), let a1 := a.pop, let a2 := a.push 100, - io.println' (to_string a1), - io.println' (to_string a2), + io.println (to_string a1), + io.println (to_string a2), let a2 := a.pop, - io.println' (to_string a2), + io.println a2, pure 0 diff --git a/tests/compiler/expr.lean b/tests/compiler/expr.lean index 7319159a0e..9900ce40d1 100644 --- a/tests/compiler/expr.lean +++ b/tests/compiler/expr.lean @@ -3,6 +3,6 @@ open lean def main : io uint32 := let e := expr.app (expr.const `f []) (expr.const `a []) in -io.println' e.dbg_to_string *> -io.println' ("hash: " ++ to_string e.hash) *> +io.println e.dbg_to_string *> +io.println ("hash: " ++ to_string e.hash) *> pure 0 diff --git a/tests/compiler/map_big.lean b/tests/compiler/map_big.lean index 8067014471..4575d46455 100644 --- a/tests/compiler/map_big.lean +++ b/tests/compiler/map_big.lean @@ -4,5 +4,5 @@ xs.map (λ x, x :: ys) def main : io uint32 := let n := 100000 in -io.println' (to_string (f2 n (list.repeat 0 n)).length) *> +io.println (to_string (f2 n (list.repeat 0 n)).length) *> pure 0 diff --git a/tests/compiler/str.lean b/tests/compiler/str.lean index 189a637eff..8440830b3b 100644 --- a/tests/compiler/str.lean +++ b/tests/compiler/str.lean @@ -2,20 +2,20 @@ def show_chars : nat → string → string.utf8_pos → io unit | 0 _ _ := pure () | (n+1) s idx := unless (s.utf8_at_end idx) $ - io.println' (">> " ++ to_string (s.utf8_get idx)) *> + io.println (">> " ++ to_string (s.utf8_get idx)) *> show_chars n s (s.utf8_next idx) def main : io uint32 := let s₁ := "hello α_world_β" in let b := string.utf8_begin in let e := s₁.utf8_byte_size in -io.println' (s₁.extract b e) *> -io.println' (s₁.extract (b+2) e) *> -io.println' (s₁.extract (b+2) (e-1)) *> -io.println' (s₁.extract (b+2) (e-2)) *> -io.println' (s₁.extract (b+7) e) *> -io.println' (s₁.extract (b+8) e) *> -io.println' (to_string e) *> -io.println' (repr " aaa ".trim) *> +io.println (s₁.extract b e) *> +io.println (s₁.extract (b+2) e) *> +io.println (s₁.extract (b+2) (e-1)) *> +io.println (s₁.extract (b+2) (e-2)) *> +io.println (s₁.extract (b+7) e) *> +io.println (s₁.extract (b+8) e) *> +io.println (to_string e) *> +io.println (repr " aaa ".trim) *> show_chars s₁.utf8_byte_size.to_nat s₁ 0 *> pure 0 diff --git a/tests/compiler/t1.lean b/tests/compiler/t1.lean index 3c28b5fb49..45b548d849 100644 --- a/tests/compiler/t1.lean +++ b/tests/compiler/t1.lean @@ -1,3 +1,3 @@ def main (xs : list string) : io uint32 := -io.println' "hello world" *> +io.println "hello world" *> pure 0 diff --git a/tests/compiler/t2.lean b/tests/compiler/t2.lean index 5ed1a36d9e..8629375766 100644 --- a/tests/compiler/t2.lean +++ b/tests/compiler/t2.lean @@ -86,7 +86,7 @@ nest_aux n f n e def deriv (i : nat) (f : Expr) : io Expr := do let d := d "x" f, - io.println' (to_string (i+1) ++ " count: " ++ (to_string $ count d)), + io.println (to_string (i+1) ++ " count: " ++ (to_string $ count d)), pure d def main (xs : list string) : io uint32 := diff --git a/tests/compiler/thunk.lean b/tests/compiler/thunk.lean index 669afb3ac1..fa9c59d90b 100644 --- a/tests/compiler/thunk.lean +++ b/tests/compiler/thunk.lean @@ -6,5 +6,5 @@ def test (t : thunk nat) (n : nat) : nat := n.repeat (λ i r, t.get + r) 0 def main (xs : list string) : io uint32 := -io.println' (to_string (test (compute 1) 100000)) *> +io.println (to_string (test (compute 1) 100000)) *> pure 0 diff --git a/tests/compiler/uint_fold.lean b/tests/compiler/uint_fold.lean index 3b3ca1db21..ce137cb191 100644 --- a/tests/compiler/uint_fold.lean +++ b/tests/compiler/uint_fold.lean @@ -17,9 +17,9 @@ let x : uint8 := 100 in x + x + x def main : io uint32 := -io.println' (to_string (f 10 20)) *> -io.println' (to_string (f 0 0)) *> -io.println' (to_string (g 3 5)) *> -io.println' (to_string (g 0 6)) *> -io.println' (to_string foo) *> +io.println (to_string (f 10 20)) *> +io.println (to_string (f 0 0)) *> +io.println (to_string (g 3 5)) *> +io.println (to_string (g 0 6)) *> +io.println (to_string foo) *> pure 0 diff --git a/tests/playground/arith_eval_nat.lean b/tests/playground/arith_eval_nat.lean index a3554eba73..28fb6ddd70 100644 --- a/tests/playground/arith_eval_nat.lean +++ b/tests/playground/arith_eval_nat.lean @@ -15,5 +15,5 @@ def eval : Expr → nat | (Add l r) := eval l + eval r def main : io uint32 := -io.println' (to_string $ eval (mk_expr 26 1)) *> +io.println (to_string $ eval (mk_expr 26 1)) *> pure 0 diff --git a/tests/playground/arith_eval_uint32.lean b/tests/playground/arith_eval_uint32.lean index e78e69681e..57088ccfef 100644 --- a/tests/playground/arith_eval_uint32.lean +++ b/tests/playground/arith_eval_uint32.lean @@ -18,5 +18,5 @@ def eval : Expr → uint32 | (Add l r) := eval l + eval r def main : io uint32 := -io.println' (to_string $ eval (mk_expr 26 1)) *> +io.println (to_string $ eval (mk_expr 26 1)) *> pure 0 diff --git a/tests/playground/binarytrees.lean b/tests/playground/binarytrees.lean index c14f9c52bb..83eea62e69 100644 --- a/tests/playground/binarytrees.lean +++ b/tests/playground/binarytrees.lean @@ -19,7 +19,7 @@ def check : Tree → uint32 def minN := 4 -def out (s) (n : nat) (t : uint32) := io.println' (s ++ " of depth " ++ to_string n ++ "\t check: " ++ to_string t) +def out (s) (n : nat) (t : uint32) := io.println (s ++ " of depth " ++ to_string n ++ "\t check: " ++ to_string t) -- allocate and check lots of trees def sumT : uint32 -> uint32 -> uint32 -> uint32 diff --git a/tests/playground/deriv.lean b/tests/playground/deriv.lean index 19c17a52b3..ec253eadf2 100644 --- a/tests/playground/deriv.lean +++ b/tests/playground/deriv.lean @@ -86,7 +86,7 @@ nest_aux n f n e def deriv (i : nat) (f : Expr) : io Expr := do let d := d "x" f, - io.println' (to_string (i+1) ++ " count: " ++ (to_string $ count d)), + io.println (to_string (i+1) ++ " count: " ++ (to_string $ count d)), pure d def main (xs : list string) : io uint32 := diff --git a/tests/playground/expr_const_folding.lean b/tests/playground/expr_const_folding.lean index 155f20b77e..b25fbf9cd8 100644 --- a/tests/playground/expr_const_folding.lean +++ b/tests/playground/expr_const_folding.lean @@ -69,5 +69,5 @@ def main : io uint32 := let e := (mk_expr 23 1) in let v₁ := eval e in let v₂ := eval (const_folding (reassoc e)) in -io.println' (to_string v₁ ++ " " ++ to_string v₂) *> +io.println (to_string v₁ ++ " " ++ to_string v₂) *> pure 0 diff --git a/tests/playground/fix.lean b/tests/playground/fix.lean index 2f73d6ef66..b7a49f00f1 100644 --- a/tests/playground/fix.lean +++ b/tests/playground/fix.lean @@ -4,5 +4,5 @@ def foo (rec : nat → nat → nat) : nat → nat → nat def main (xs : list string) : io uint32 := let v := fix_2 foo (xs.head.to_nat) 10 in -io.println' (to_string v) *> +io.println (to_string v) *> pure 0 diff --git a/tests/playground/fix_1.lean b/tests/playground/fix_1.lean index 561b4afb88..672b470973 100644 --- a/tests/playground/fix_1.lean +++ b/tests/playground/fix_1.lean @@ -4,5 +4,5 @@ def foo (rec : nat → nat → nat) : nat → nat → nat def main (xs : list string) : io uint32 := let v := fix_1 foo (xs.head.to_nat) 10 in -io.println' (to_string v) *> +io.println (to_string v) *> pure 0 diff --git a/tests/playground/fix_with_tuples.lean b/tests/playground/fix_with_tuples.lean index a8e3da52a9..da3b26b274 100644 --- a/tests/playground/fix_with_tuples.lean +++ b/tests/playground/fix_with_tuples.lean @@ -4,5 +4,5 @@ def foo (rec : nat × nat → nat) : nat × nat → nat def main (xs : list string) : io uint32 := let v := fix foo (xs.head.to_nat, 10) in -io.println' (to_string v) *> +io.println (to_string v) *> pure 0 diff --git a/tests/playground/flat_parser.lean b/tests/playground/flat_parser.lean index d9a96a108f..f0b14996c0 100644 --- a/tests/playground/flat_parser.lean +++ b/tests/playground/flat_parser.lean @@ -325,10 +325,10 @@ many1' (str "--" *> take_until (λ c, c = '\n') *> any *> pure ()) end @[noinline] def test_flat_p (s : string) : io unit := -io.println' (lean.flat_parser.test_parser flat_p s) +io.println (lean.flat_parser.test_parser flat_p s) @[noinline] def test_parsec_p (s : string) : io unit := -io.println' (test_parsec parsec_p s) +io.println (test_parsec parsec_p s) def prof {α : Type} (msg : string) (p : io α) : io α := let msg₁ := "Time for '" ++ msg ++ "':" in diff --git a/tests/playground/gen.lean b/tests/playground/gen.lean index 9209b17f48..be639f9f2c 100644 --- a/tests/playground/gen.lean +++ b/tests/playground/gen.lean @@ -1,5 +1,5 @@ def main (xs : list string) : io uint32 := let n := xs.head.to_nat in -io.println' "prelude\ninductive bool : Type\n| ff : bool\n| tt : bool\n\n" *> -nat.mrepeat n (λ i, io.println' ("theorem x" ++ to_string i ++ " : bool := bool.tt")) *> +io.println "prelude\ninductive bool : Type\n| ff : bool\n| tt : bool\n\n" *> +nat.mrepeat n (λ i, io.println ("theorem x" ++ to_string i ++ " : bool := bool.tt")) *> pure 0 diff --git a/tests/playground/perf.lean b/tests/playground/perf.lean index bd5450285a..0b610c095a 100644 --- a/tests/playground/perf.lean +++ b/tests/playground/perf.lean @@ -9,7 +9,7 @@ def rep (n : nat) : nat := n.repeat (λ i r, h (g i n)) 0 def act (n : nat) : io unit := -io.println' (to_string (rep n)) +io.println (to_string (rep n)) def main : io uint32 := act 5000 *> pure 0 diff --git a/tests/playground/rbmap.lean b/tests/playground/rbmap.lean index 359e3dc0ce..03fe6102f6 100644 --- a/tests/playground/rbmap.lean +++ b/tests/playground/rbmap.lean @@ -70,5 +70,5 @@ mk_map_aux n Leaf def main (xs : list string) : io uint32 := let m := mk_map xs.head.to_nat in let v := fold (λ (k : nat) (v : bool) (r : nat), if v then r + 1 else r) m 0 in -io.println' (to_string v) *> +io.println (to_string v) *> pure 0 diff --git a/tests/playground/rbmap.library.lean b/tests/playground/rbmap.library.lean index 054cbdf68b..d51d983ff3 100644 --- a/tests/playground/rbmap.library.lean +++ b/tests/playground/rbmap.library.lean @@ -10,5 +10,5 @@ mk_map_aux n (mk_rbmap nat bool (<)) def main (xs : list string) : io uint32 := let m := mk_map xs.head.to_nat in let v := rbmap.fold (λ (k : nat) (v : bool) (r : nat), if v then r + 1 else r) m 0 in -io.println' (to_string v) *> +io.println (to_string v) *> pure 0 diff --git a/tests/playground/rbmap2.lean b/tests/playground/rbmap2.lean index 4fea0b36ae..65607d3860 100644 --- a/tests/playground/rbmap2.lean +++ b/tests/playground/rbmap2.lean @@ -229,5 +229,5 @@ mk_map_aux n 0 (tst.mk_rbmap nat bool (<)) def main (xs : list string) : io uint32 := let m := mk_map xs.head.to_nat in let v := tst.rbmap.fold (λ (k : nat) (v : bool) (r : nat), if v then r + 1 else r) m 0 in -io.println' (to_string v) *> +io.println (to_string v) *> pure 0 diff --git a/tests/playground/rbmap3.lean b/tests/playground/rbmap3.lean index 63bef12930..553cb2ecfc 100644 --- a/tests/playground/rbmap3.lean +++ b/tests/playground/rbmap3.lean @@ -260,5 +260,5 @@ mk_map_aux n (mk_rbmap nat bool (<)) def main (xs : list string) : io uint32 := let m := mk_map xs.head.to_nat in let v := rbmap.fold (λ (k : nat) (v : bool) (r : nat), if v then r + 1 else r) m 0 in -io.println' (to_string v) *> +io.println (to_string v) *> pure 0 diff --git a/tests/playground/task_test.lean b/tests/playground/task_test.lean index 79155860b1..78a3c12eea 100644 --- a/tests/playground/task_test.lean +++ b/tests/playground/task_test.lean @@ -16,5 +16,5 @@ def main (xs : list string) : io uint32 := let t1 := task.mk $ (λ _, f1 xs.head.to_nat) in let t2 := task.mk $ (λ _, f2 xs.head.to_nat) in dbg_sleep 1000 $ λ _, -io.println' (to_string t1.get ++ " " ++ to_string t2.get) *> +io.println (to_string t1.get ++ " " ++ to_string t2.get) *> pure 0 diff --git a/tests/playground/task_test2.lean b/tests/playground/task_test2.lean index 392502ca1f..05a6dfb32d 100644 --- a/tests/playground/task_test2.lean +++ b/tests/playground/task_test2.lean @@ -8,5 +8,5 @@ def main (xs : list string) : io uint32 := let ys := (list.repeat 1 xs.head.to_nat) in let ts : list (task nat) := (list.iota 10).map (λ i, task.mk $ λ _, run1 (i+1) xs.head.to_nat ys) in let ns : list nat := ts.map task.get in -io.println' (">> " ++ to_string ns) *> +io.println (">> " ++ to_string ns) *> pure 0 diff --git a/tests/playground/task_test3.lean b/tests/playground/task_test3.lean index 6ce856f06e..cf1d073afd 100644 --- a/tests/playground/task_test3.lean +++ b/tests/playground/task_test3.lean @@ -8,5 +8,5 @@ def main (xs : list string) : io uint32 := let ys := (list.repeat 1 xs.head.to_nat) in let ts : list (task nat) := (list.iota 10).map (λ i, task.mk $ λ _, run1 (i+1) xs.head.to_nat ys) in let ns : list nat := ts.map task.get in -io.println' (">> " ++ to_string ns) *> +io.println (">> " ++ to_string ns) *> pure 0 diff --git a/tests/playground/task_test4.lean b/tests/playground/task_test4.lean index 753f6a76bc..0b3e1e23c6 100644 --- a/tests/playground/task_test4.lean +++ b/tests/playground/task_test4.lean @@ -8,5 +8,5 @@ def main (xs : list string) : io uint32 := let ys := (list.repeat 1 xs.head.to_nat) in let ts : list (task nat) := (list.iota 10).map (λ i, task.mk $ λ _, run1 (i+1) xs.head.to_nat ys) in let ns : list nat := ts.map task.get in -io.println' (">> " ++ to_string ns) *> +io.println (">> " ++ to_string ns) *> pure 0 diff --git a/tests/playground/tst.lean b/tests/playground/tst.lean index 772ce183cf..149a7e3189 100644 --- a/tests/playground/tst.lean +++ b/tests/playground/tst.lean @@ -4,7 +4,7 @@ xs.foldl (+) 0 def perf (n : nat) : io unit := do v ← pure $ tst n, - io.println' ("result " ++ to_string v) + io.println ("result " ++ to_string v) def main (xs : list string) : io uint32 := timeit "tst" (perf xs.head.to_nat) *> diff --git a/tests/playground/uf1.lean b/tests/playground/uf1.lean index 540619440a..e2a96554f1 100644 --- a/tests/playground/uf1.lean +++ b/tests/playground/uf1.lean @@ -129,5 +129,5 @@ else do def main (xs : list string) : io uint32 := let n := xs.head.to_nat in match run (test n) with -| (except.ok v, s) := io.println' ("ok " ++ to_string v) *> pure 0 -| (except.error e, s) := io.println' ("Error : " ++ e) *> pure 1 +| (except.ok v, s) := io.println ("ok " ++ to_string v) *> pure 0 +| (except.error e, s) := io.println ("Error : " ++ e) *> pure 1 diff --git a/tests/playground/uf1_new.lean b/tests/playground/uf1_new.lean index 114bc6aaaa..c4f9b0e90a 100644 --- a/tests/playground/uf1_new.lean +++ b/tests/playground/uf1_new.lean @@ -122,5 +122,5 @@ else do def main (xs : list string) : io uint32 := let n := xs.head.to_nat in match run (test n) with -| (except.ok v, s) := io.println' ("ok " ++ to_string v) *> pure 0 -| (except.error e, s) := io.println' ("Error : " ++ e) *> pure 1 +| (except.ok v, s) := io.println ("ok " ++ to_string v) *> pure 0 +| (except.error e, s) := io.println ("Error : " ++ e) *> pure 1 diff --git a/tests/playground/unionfind1.lean b/tests/playground/unionfind1.lean index e213126b33..6a925395fd 100644 --- a/tests/playground/unionfind1.lean +++ b/tests/playground/unionfind1.lean @@ -128,5 +128,5 @@ else do def main (xs : list string) : io uint32 := let n := xs.head.to_nat in match run (test n) with -| (except.ok v, s) := io.println' ("ok " ++ to_string v) *> pure 0 -| (except.error e, s) := io.println' ("Error : " ++ e) *> pure 1 +| (except.ok v, s) := io.println ("ok " ++ to_string v) *> pure 0 +| (except.error e, s) := io.println ("Error : " ++ e) *> pure 1 diff --git a/tests/playground/unionfind2.lean b/tests/playground/unionfind2.lean index 38b7b5fe51..b586ca0ad1 100644 --- a/tests/playground/unionfind2.lean +++ b/tests/playground/unionfind2.lean @@ -122,5 +122,5 @@ else do def main (xs : list string) : io uint32 := let n := xs.head.to_nat in match run (test n) with -| (except.ok v, s) := io.println' ("ok " ++ to_string v) *> pure 0 -| (except.error e, s) := io.println' ("Error : " ++ e) *> pure 1 +| (except.ok v, s) := io.println ("ok " ++ to_string v) *> pure 0 +| (except.error e, s) := io.println ("Error : " ++ e) *> pure 1