text: // Lean compiler output
  // Module: Lean.Eval
  // Imports: Init Lean.Environment
  #include <lean/lean.h>
  #if defined(__clang__)
  #pragma clang diagnostic ignored "-Wunused-parameter"
  #pragma clang diagnostic ignored "-Wunused-label"
  #elif defined(__GNUC__) && !defined(__CLANG__)
  #pragma GCC diagnostic ignored "-Wunused-parameter"
  #pragma GCC diagnostic ignored "-Wunused-label"
  #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
  #endif
  #ifdef __cplusplus
  extern "C" {
  #endif
  lean_object* l_Lean_instMetaEval(lean_object*);
  lean_object* lean_st_ref_get(lean_object*, lean_object*);
  lean_object* l_Lean_instMetaEval___rarg___lambda__1___boxed(lean_object*, lean_object*);
  lean_object* l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___lambda__2(lean_object*, lean_object*);
  static lean_object* l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__1;
  lean_object* l_Lean_instMetaEval___rarg(lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*);
  lean_object* l_Lean_runMetaEval___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* lean_get_set_stdout(lean_object*, lean_object*);
  static lean_object* l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__3;
  lean_object* l_EStateM_tryCatch___at_Lean_runEval___spec__2___rarg(lean_object*, lean_object*, lean_object*);
  lean_object* l_IO_withStdin___at_Lean_runMetaEval___spec__4(lean_object*, lean_object*, lean_object*);
  lean_object* l_IO_FS_Stream_ofBuffer(lean_object*);
  lean_object* lean_get_set_stderr(lean_object*, lean_object*);
  extern lean_object* l_ByteArray_empty;
  static lean_object* l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__2;
  lean_object* l_Lean_instMetaEval___rarg___lambda__1(lean_object*, lean_object*);
  lean_object* l_EStateM_bind___rarg(lean_object*, lean_object*, lean_object*);
  lean_object* l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___lambda__1(lean_object*, lean_object*);
  lean_object* lean_string_from_utf8_unchecked(lean_object*);
  lean_object* l_Lean_instMetaEval___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_IO_withStdout___at_Lean_runMetaEval___spec__3(lean_object*, lean_object*, lean_object*);
  lean_object* l_IO_mkRef___rarg(lean_object*, lean_object*);
  lean_object* l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1(lean_object*, lean_object*);
  lean_object* lean_get_set_stdin(lean_object*, lean_object*);
  lean_object* l_IO_withStderr___at_Lean_runMetaEval___spec__2(lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_runMetaEval(lean_object*);
  lean_object* l_Lean_instMetaEval___rarg___lambda__1(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_inc(x_1);
  return x_1;
  }
  }
  lean_object* l_Lean_instMetaEval___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, uint8_t x_5, lean_object* x_6) {
  _start:
  {
  lean_object* x_7; lean_object* x_8; lean_object* x_9; 
  x_7 = lean_alloc_closure((void*)(l_Lean_instMetaEval___rarg___lambda__1___boxed), 2, 1);
  lean_closure_set(x_7, 0, x_4);
  x_8 = lean_box(x_5);
  x_9 = lean_apply_3(x_1, x_7, x_8, x_6);
  if (lean_obj_tag(x_9) == 0)
  {
  uint8_t x_10; 
  x_10 = !lean_is_exclusive(x_9);
  if (x_10 == 0)
  {
  lean_object* x_11; 
  x_11 = lean_ctor_get(x_9, 0);
  lean_dec(x_11);
  lean_ctor_set(x_9, 0, x_2);
  return x_9;
  }
  else
  {
  lean_object* x_12; lean_object* x_13; 
  x_12 = lean_ctor_get(x_9, 1);
  lean_inc(x_12);
  lean_dec(x_9);
  x_13 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_13, 0, x_2);
  lean_ctor_set(x_13, 1, x_12);
  return x_13;
  }
  }
  else
  {
  uint8_t x_14; 
  lean_dec(x_2);
  x_14 = !lean_is_exclusive(x_9);
  if (x_14 == 0)
  {
  return x_9;
  }
  else
  {
  lean_object* x_15; lean_object* x_16; lean_object* x_17; 
  x_15 = lean_ctor_get(x_9, 0);
  x_16 = lean_ctor_get(x_9, 1);
  lean_inc(x_16);
  lean_inc(x_15);
  lean_dec(x_9);
  x_17 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_17, 0, x_15);
  lean_ctor_set(x_17, 1, x_16);
  return x_17;
  }
  }
  }
  }
  lean_object* l_Lean_instMetaEval(lean_object* x_1) {
  _start:
  {
  lean_object* x_2; 
  x_2 = lean_alloc_closure((void*)(l_Lean_instMetaEval___rarg___boxed), 6, 0);
  return x_2;
  }
  }
  lean_object* l_Lean_instMetaEval___rarg___lambda__1___boxed(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = l_Lean_instMetaEval___rarg___lambda__1(x_1, x_2);
  lean_dec(x_2);
  lean_dec(x_1);
  return x_3;
  }
  }
  lean_object* l_Lean_instMetaEval___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
  _start:
  {
  uint8_t x_7; lean_object* x_8; 
  x_7 = lean_unbox(x_5);
  lean_dec(x_5);
  x_8 = l_Lean_instMetaEval___rarg(x_1, x_2, x_3, x_4, x_7, x_6);
  lean_dec(x_3);
  return x_8;
  }
  }
  lean_object* l_IO_withStderr___at_Lean_runMetaEval___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; 
  x_4 = lean_get_set_stderr(x_1, x_3);
  if (lean_obj_tag(x_4) == 0)
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; 
  x_5 = lean_ctor_get(x_4, 0);
  lean_inc(x_5);
  x_6 = lean_ctor_get(x_4, 1);
  lean_inc(x_6);
  lean_dec(x_4);
  x_7 = lean_apply_1(x_2, x_6);
  if (lean_obj_tag(x_7) == 0)
  {
  lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_8 = lean_ctor_get(x_7, 0);
  lean_inc(x_8);
  x_9 = lean_ctor_get(x_7, 1);
  lean_inc(x_9);
  lean_dec(x_7);
  x_10 = lean_get_set_stderr(x_5, x_9);
  if (lean_obj_tag(x_10) == 0)
  {
  uint8_t x_11; 
  x_11 = !lean_is_exclusive(x_10);
  if (x_11 == 0)
  {
  lean_object* x_12; 
  x_12 = lean_ctor_get(x_10, 0);
  lean_dec(x_12);
  lean_ctor_set(x_10, 0, x_8);
  return x_10;
  }
  else
  {
  lean_object* x_13; lean_object* x_14; 
  x_13 = lean_ctor_get(x_10, 1);
  lean_inc(x_13);
  lean_dec(x_10);
  x_14 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_14, 0, x_8);
  lean_ctor_set(x_14, 1, x_13);
  return x_14;
  }
  }
  else
  {
  uint8_t x_15; 
  lean_dec(x_8);
  x_15 = !lean_is_exclusive(x_10);
  if (x_15 == 0)
  {
  return x_10;
  }
  else
  {
  lean_object* x_16; lean_object* x_17; lean_object* x_18; 
  x_16 = lean_ctor_get(x_10, 0);
  x_17 = lean_ctor_get(x_10, 1);
  lean_inc(x_17);
  lean_inc(x_16);
  lean_dec(x_10);
  x_18 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_18, 0, x_16);
  lean_ctor_set(x_18, 1, x_17);
  return x_18;
  }
  }
  }
  else
  {
  lean_object* x_19; lean_object* x_20; lean_object* x_21; 
  x_19 = lean_ctor_get(x_7, 0);
  lean_inc(x_19);
  x_20 = lean_ctor_get(x_7, 1);
  lean_inc(x_20);
  lean_dec(x_7);
  x_21 = lean_get_set_stderr(x_5, x_20);
  if (lean_obj_tag(x_21) == 0)
  {
  uint8_t x_22; 
  x_22 = !lean_is_exclusive(x_21);
  if (x_22 == 0)
  {
  lean_object* x_23; 
  x_23 = lean_ctor_get(x_21, 0);
  lean_dec(x_23);
  lean_ctor_set_tag(x_21, 1);
  lean_ctor_set(x_21, 0, x_19);
  return x_21;
  }
  else
  {
  lean_object* x_24; lean_object* x_25; 
  x_24 = lean_ctor_get(x_21, 1);
  lean_inc(x_24);
  lean_dec(x_21);
  x_25 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_25, 0, x_19);
  lean_ctor_set(x_25, 1, x_24);
  return x_25;
  }
  }
  else
  {
  uint8_t x_26; 
  lean_dec(x_19);
  x_26 = !lean_is_exclusive(x_21);
  if (x_26 == 0)
  {
  return x_21;
  }
  else
  {
  lean_object* x_27; lean_object* x_28; lean_object* x_29; 
  x_27 = lean_ctor_get(x_21, 0);
  x_28 = lean_ctor_get(x_21, 1);
  lean_inc(x_28);
  lean_inc(x_27);
  lean_dec(x_21);
  x_29 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_29, 0, x_27);
  lean_ctor_set(x_29, 1, x_28);
  return x_29;
  }
  }
  }
  }
  else
  {
  uint8_t x_30; 
  lean_dec(x_2);
  x_30 = !lean_is_exclusive(x_4);
  if (x_30 == 0)
  {
  return x_4;
  }
  else
  {
  lean_object* x_31; lean_object* x_32; lean_object* x_33; 
  x_31 = lean_ctor_get(x_4, 0);
  x_32 = lean_ctor_get(x_4, 1);
  lean_inc(x_32);
  lean_inc(x_31);
  lean_dec(x_4);
  x_33 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_33, 0, x_31);
  lean_ctor_set(x_33, 1, x_32);
  return x_33;
  }
  }
  }
  }
  lean_object* l_IO_withStdout___at_Lean_runMetaEval___spec__3(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; 
  x_4 = lean_get_set_stdout(x_1, x_3);
  if (lean_obj_tag(x_4) == 0)
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; 
  x_5 = lean_ctor_get(x_4, 0);
  lean_inc(x_5);
  x_6 = lean_ctor_get(x_4, 1);
  lean_inc(x_6);
  lean_dec(x_4);
  x_7 = lean_apply_1(x_2, x_6);
  if (lean_obj_tag(x_7) == 0)
  {
  lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_8 = lean_ctor_get(x_7, 0);
  lean_inc(x_8);
  x_9 = lean_ctor_get(x_7, 1);
  lean_inc(x_9);
  lean_dec(x_7);
  x_10 = lean_get_set_stdout(x_5, x_9);
  if (lean_obj_tag(x_10) == 0)
  {
  uint8_t x_11; 
  x_11 = !lean_is_exclusive(x_10);
  if (x_11 == 0)
  {
  lean_object* x_12; 
  x_12 = lean_ctor_get(x_10, 0);
  lean_dec(x_12);
  lean_ctor_set(x_10, 0, x_8);
  return x_10;
  }
  else
  {
  lean_object* x_13; lean_object* x_14; 
  x_13 = lean_ctor_get(x_10, 1);
  lean_inc(x_13);
  lean_dec(x_10);
  x_14 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_14, 0, x_8);
  lean_ctor_set(x_14, 1, x_13);
  return x_14;
  }
  }
  else
  {
  uint8_t x_15; 
  lean_dec(x_8);
  x_15 = !lean_is_exclusive(x_10);
  if (x_15 == 0)
  {
  return x_10;
  }
  else
  {
  lean_object* x_16; lean_object* x_17; lean_object* x_18; 
  x_16 = lean_ctor_get(x_10, 0);
  x_17 = lean_ctor_get(x_10, 1);
  lean_inc(x_17);
  lean_inc(x_16);
  lean_dec(x_10);
  x_18 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_18, 0, x_16);
  lean_ctor_set(x_18, 1, x_17);
  return x_18;
  }
  }
  }
  else
  {
  lean_object* x_19; lean_object* x_20; lean_object* x_21; 
  x_19 = lean_ctor_get(x_7, 0);
  lean_inc(x_19);
  x_20 = lean_ctor_get(x_7, 1);
  lean_inc(x_20);
  lean_dec(x_7);
  x_21 = lean_get_set_stdout(x_5, x_20);
  if (lean_obj_tag(x_21) == 0)
  {
  uint8_t x_22; 
  x_22 = !lean_is_exclusive(x_21);
  if (x_22 == 0)
  {
  lean_object* x_23; 
  x_23 = lean_ctor_get(x_21, 0);
  lean_dec(x_23);
  lean_ctor_set_tag(x_21, 1);
  lean_ctor_set(x_21, 0, x_19);
  return x_21;
  }
  else
  {
  lean_object* x_24; lean_object* x_25; 
  x_24 = lean_ctor_get(x_21, 1);
  lean_inc(x_24);
  lean_dec(x_21);
  x_25 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_25, 0, x_19);
  lean_ctor_set(x_25, 1, x_24);
  return x_25;
  }
  }
  else
  {
  uint8_t x_26; 
  lean_dec(x_19);
  x_26 = !lean_is_exclusive(x_21);
  if (x_26 == 0)
  {
  return x_21;
  }
  else
  {
  lean_object* x_27; lean_object* x_28; lean_object* x_29; 
  x_27 = lean_ctor_get(x_21, 0);
  x_28 = lean_ctor_get(x_21, 1);
  lean_inc(x_28);
  lean_inc(x_27);
  lean_dec(x_21);
  x_29 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_29, 0, x_27);
  lean_ctor_set(x_29, 1, x_28);
  return x_29;
  }
  }
  }
  }
  else
  {
  uint8_t x_30; 
  lean_dec(x_2);
  x_30 = !lean_is_exclusive(x_4);
  if (x_30 == 0)
  {
  return x_4;
  }
  else
  {
  lean_object* x_31; lean_object* x_32; lean_object* x_33; 
  x_31 = lean_ctor_get(x_4, 0);
  x_32 = lean_ctor_get(x_4, 1);
  lean_inc(x_32);
  lean_inc(x_31);
  lean_dec(x_4);
  x_33 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_33, 0, x_31);
  lean_ctor_set(x_33, 1, x_32);
  return x_33;
  }
  }
  }
  }
  lean_object* l_IO_withStdin___at_Lean_runMetaEval___spec__4(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; 
  x_4 = lean_get_set_stdin(x_1, x_3);
  if (lean_obj_tag(x_4) == 0)
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; 
  x_5 = lean_ctor_get(x_4, 0);
  lean_inc(x_5);
  x_6 = lean_ctor_get(x_4, 1);
  lean_inc(x_6);
  lean_dec(x_4);
  x_7 = lean_apply_1(x_2, x_6);
  if (lean_obj_tag(x_7) == 0)
  {
  lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_8 = lean_ctor_get(x_7, 0);
  lean_inc(x_8);
  x_9 = lean_ctor_get(x_7, 1);
  lean_inc(x_9);
  lean_dec(x_7);
  x_10 = lean_get_set_stdin(x_5, x_9);
  if (lean_obj_tag(x_10) == 0)
  {
  uint8_t x_11; 
  x_11 = !lean_is_exclusive(x_10);
  if (x_11 == 0)
  {
  lean_object* x_12; 
  x_12 = lean_ctor_get(x_10, 0);
  lean_dec(x_12);
  lean_ctor_set(x_10, 0, x_8);
  return x_10;
  }
  else
  {
  lean_object* x_13; lean_object* x_14; 
  x_13 = lean_ctor_get(x_10, 1);
  lean_inc(x_13);
  lean_dec(x_10);
  x_14 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_14, 0, x_8);
  lean_ctor_set(x_14, 1, x_13);
  return x_14;
  }
  }
  else
  {
  uint8_t x_15; 
  lean_dec(x_8);
  x_15 = !lean_is_exclusive(x_10);
  if (x_15 == 0)
  {
  return x_10;
  }
  else
  {
  lean_object* x_16; lean_object* x_17; lean_object* x_18; 
  x_16 = lean_ctor_get(x_10, 0);
  x_17 = lean_ctor_get(x_10, 1);
  lean_inc(x_17);
  lean_inc(x_16);
  lean_dec(x_10);
  x_18 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_18, 0, x_16);
  lean_ctor_set(x_18, 1, x_17);
  return x_18;
  }
  }
  }
  else
  {
  lean_object* x_19; lean_object* x_20; lean_object* x_21; 
  x_19 = lean_ctor_get(x_7, 0);
  lean_inc(x_19);
  x_20 = lean_ctor_get(x_7, 1);
  lean_inc(x_20);
  lean_dec(x_7);
  x_21 = lean_get_set_stdin(x_5, x_20);
  if (lean_obj_tag(x_21) == 0)
  {
  uint8_t x_22; 
  x_22 = !lean_is_exclusive(x_21);
  if (x_22 == 0)
  {
  lean_object* x_23; 
  x_23 = lean_ctor_get(x_21, 0);
  lean_dec(x_23);
  lean_ctor_set_tag(x_21, 1);
  lean_ctor_set(x_21, 0, x_19);
  return x_21;
  }
  else
  {
  lean_object* x_24; lean_object* x_25; 
  x_24 = lean_ctor_get(x_21, 1);
  lean_inc(x_24);
  lean_dec(x_21);
  x_25 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_25, 0, x_19);
  lean_ctor_set(x_25, 1, x_24);
  return x_25;
  }
  }
  else
  {
  uint8_t x_26; 
  lean_dec(x_19);
  x_26 = !lean_is_exclusive(x_21);
  if (x_26 == 0)
  {
  return x_21;
  }
  else
  {
  lean_object* x_27; lean_object* x_28; lean_object* x_29; 
  x_27 = lean_ctor_get(x_21, 0);
  x_28 = lean_ctor_get(x_21, 1);
  lean_inc(x_28);
  lean_inc(x_27);
  lean_dec(x_21);
  x_29 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_29, 0, x_27);
  lean_ctor_set(x_29, 1, x_28);
  return x_29;
  }
  }
  }
  }
  else
  {
  uint8_t x_30; 
  lean_dec(x_2);
  x_30 = !lean_is_exclusive(x_4);
  if (x_30 == 0)
  {
  return x_4;
  }
  else
  {
  lean_object* x_31; lean_object* x_32; lean_object* x_33; 
  x_31 = lean_ctor_get(x_4, 0);
  x_32 = lean_ctor_get(x_4, 1);
  lean_inc(x_32);
  lean_inc(x_31);
  lean_dec(x_4);
  x_33 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_33, 0, x_31);
  lean_ctor_set(x_33, 1, x_32);
  return x_33;
  }
  }
  }
  }
  lean_object* l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___lambda__1(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; lean_object* x_4; 
  x_3 = lean_alloc_ctor(1, 1, 0);
  lean_ctor_set(x_3, 0, x_1);
  x_4 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_4, 0, x_3);
  lean_ctor_set(x_4, 1, x_2);
  return x_4;
  }
  }
  lean_object* l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___lambda__2(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; lean_object* x_4; 
  x_3 = lean_alloc_ctor(0, 1, 0);
  lean_ctor_set(x_3, 0, x_1);
  x_4 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_4, 0, x_3);
  lean_ctor_set(x_4, 1, x_2);
  return x_4;
  }
  }
  static lean_object* _init_l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__1() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; lean_object* x_3; 
  x_1 = l_ByteArray_empty;
  x_2 = lean_unsigned_to_nat(0u);
  x_3 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_3, 0, x_1);
  lean_ctor_set(x_3, 1, x_2);
  return x_3;
  }
  }
  static lean_object* _init_l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__2() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_alloc_closure((void*)(l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___lambda__1), 2, 0);
  return x_1;
  }
  }
  static lean_object* _init_l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__3() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_alloc_closure((void*)(l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___lambda__2), 2, 0);
  return x_1;
  }
  }
  lean_object* l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; 
  x_3 = l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__1;
  x_4 = l_IO_mkRef___rarg(x_3, x_2);
  x_5 = lean_ctor_get(x_4, 0);
  lean_inc(x_5);
  x_6 = lean_ctor_get(x_4, 1);
  lean_inc(x_6);
  lean_dec(x_4);
  x_7 = l_IO_mkRef___rarg(x_3, x_6);
  x_8 = lean_ctor_get(x_7, 0);
  lean_inc(x_8);
  x_9 = lean_ctor_get(x_7, 1);
  lean_inc(x_9);
  lean_dec(x_7);
  x_10 = l_IO_FS_Stream_ofBuffer(x_5);
  lean_inc(x_8);
  x_11 = l_IO_FS_Stream_ofBuffer(x_8);
  x_12 = l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__2;
  x_13 = lean_alloc_closure((void*)(l_EStateM_bind___rarg), 3, 2);
  lean_closure_set(x_13, 0, x_1);
  lean_closure_set(x_13, 1, x_12);
  x_14 = l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__3;
  x_15 = lean_alloc_closure((void*)(l_EStateM_tryCatch___at_Lean_runEval___spec__2___rarg), 3, 2);
  lean_closure_set(x_15, 0, x_13);
  lean_closure_set(x_15, 1, x_14);
  lean_inc(x_11);
  x_16 = lean_alloc_closure((void*)(l_IO_withStderr___at_Lean_runMetaEval___spec__2), 3, 2);
  lean_closure_set(x_16, 0, x_11);
  lean_closure_set(x_16, 1, x_15);
  x_17 = lean_alloc_closure((void*)(l_IO_withStdout___at_Lean_runMetaEval___spec__3), 3, 2);
  lean_closure_set(x_17, 0, x_11);
  lean_closure_set(x_17, 1, x_16);
  x_18 = l_IO_withStdin___at_Lean_runMetaEval___spec__4(x_10, x_17, x_9);
  if (lean_obj_tag(x_18) == 0)
  {
  lean_object* x_19; lean_object* x_20; lean_object* x_21; uint8_t x_22; 
  x_19 = lean_ctor_get(x_18, 0);
  lean_inc(x_19);
  x_20 = lean_ctor_get(x_18, 1);
  lean_inc(x_20);
  lean_dec(x_18);
  x_21 = lean_st_ref_get(x_8, x_20);
  lean_dec(x_8);
  x_22 = !lean_is_exclusive(x_21);
  if (x_22 == 0)
  {
  lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; 
  x_23 = lean_ctor_get(x_21, 0);
  x_24 = lean_ctor_get(x_23, 0);
  lean_inc(x_24);
  lean_dec(x_23);
  x_25 = lean_string_from_utf8_unchecked(x_24);
  lean_dec(x_24);
  x_26 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_26, 0, x_25);
  lean_ctor_set(x_26, 1, x_19);
  lean_ctor_set(x_21, 0, x_26);
  return x_21;
  }
  else
  {
  lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; 
  x_27 = lean_ctor_get(x_21, 0);
  x_28 = lean_ctor_get(x_21, 1);
  lean_inc(x_28);
  lean_inc(x_27);
  lean_dec(x_21);
  x_29 = lean_ctor_get(x_27, 0);
  lean_inc(x_29);
  lean_dec(x_27);
  x_30 = lean_string_from_utf8_unchecked(x_29);
  lean_dec(x_29);
  x_31 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_31, 0, x_30);
  lean_ctor_set(x_31, 1, x_19);
  x_32 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_32, 0, x_31);
  lean_ctor_set(x_32, 1, x_28);
  return x_32;
  }
  }
  else
  {
  uint8_t x_33; 
  lean_dec(x_8);
  x_33 = !lean_is_exclusive(x_18);
  if (x_33 == 0)
  {
  return x_18;
  }
  else
  {
  lean_object* x_34; lean_object* x_35; lean_object* x_36; 
  x_34 = lean_ctor_get(x_18, 0);
  x_35 = lean_ctor_get(x_18, 1);
  lean_inc(x_35);
  lean_inc(x_34);
  lean_dec(x_18);
  x_36 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_36, 0, x_34);
  lean_ctor_set(x_36, 1, x_35);
  return x_36;
  }
  }
  }
  }
  lean_object* l_Lean_runMetaEval___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
  _start:
  {
  uint8_t x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; 
  x_6 = 0;
  x_7 = lean_box(x_6);
  x_8 = lean_apply_4(x_1, x_2, x_3, x_4, x_7);
  x_9 = l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1(x_8, x_5);
  return x_9;
  }
  }
  lean_object* l_Lean_runMetaEval(lean_object* x_1) {
  _start:
  {
  lean_object* x_2; 
  x_2 = lean_alloc_closure((void*)(l_Lean_runMetaEval___rarg), 5, 0);
  return x_2;
  }
  }
  lean_object* initialize_Init(lean_object*);
  lean_object* initialize_Lean_Environment(lean_object*);
  static bool _G_initialized = false;
  lean_object* initialize_Lean_Eval(lean_object* w) {
  lean_object * res;
  if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
  _G_initialized = true;
  res = initialize_Init(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Lean_Environment(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__1 = _init_l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__1();
  lean_mark_persistent(l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__1);
  l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__2 = _init_l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__2();
  lean_mark_persistent(l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__2);
  l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__3 = _init_l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__3();
  lean_mark_persistent(l_IO_FS_withIsolatedStreams___at_Lean_runMetaEval___spec__1___closed__3);
  return lean_io_result_mk_ok(lean_box(0));
  }
  #ifdef __cplusplus
  }
  #endif
  