text: // Lean compiler output
  // Module: Init.Control.State
  // Imports: Init.Control.Basic Init.Control.Id Init.Control.Except
  #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_EXPORT lean_object* l_StateT_failure___rarg___boxed(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__7(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_set(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_run_x27(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_pure(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadFunctorStateT___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__3(lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_StateT_run_x27___rarg___closed__1;
  LEAN_EXPORT lean_object* l_StateT_modifyGet(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__5(lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_failure___rarg(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_tryFinally___rarg___lambda__1(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__4(lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_tryFinally(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instAlternativeStateT(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadLiftStateT___rarg(lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadFunctorStateT___rarg(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_bind___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_pure___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_orElse___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_set___rarg___boxed(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg(lean_object*);
  LEAN_EXPORT lean_object* l_StateT_tryFinally___rarg___lambda__2(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__6(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_orElse___rarg___lambda__1(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_map___rarg___lambda__1(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_get___rarg(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_run_x27___rarg___lambda__1(lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__1(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadExceptOfStateT___rarg___lambda__2(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_lift___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadExceptOfStateT___rarg(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__7(lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_run(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_run_x27___rarg___lambda__1___boxed(lean_object*);
  LEAN_EXPORT lean_object* l_StateT_monadControl(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__2(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_lift(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_bind(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadExceptOfStateT(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadLiftStateT(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__1(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_orElse___rarg___lambda__1___boxed(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadFunctorStateT(lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__3(lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_bind___rarg___lambda__1(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_set___rarg(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_instMonadStateOfStateT(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadExceptOfStateT___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_modifyGet___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg(lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__4(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_map(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_map___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_tryFinally___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__6(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__5(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_run_x27___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_failure(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadExceptOfStateT___rarg___lambda__3(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__8(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_run___rarg(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_instMonadStateOfStateT___rarg(lean_object*);
  LEAN_EXPORT lean_object* l_StateT_orElse(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_instAlternativeStateT___rarg(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_lift___rarg___lambda__1(lean_object*, lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_get(lean_object*, lean_object*);
  LEAN_EXPORT lean_object* l_StateT_run___rarg(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_apply_1(x_1, x_2);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_run(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; 
  x_4 = lean_alloc_closure((void*)(l_StateT_run___rarg), 2, 0);
  return x_4;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_run_x27___rarg___lambda__1(lean_object* x_1) {
  _start:
  {
  lean_object* x_2; 
  x_2 = lean_ctor_get(x_1, 0);
  lean_inc(x_2);
  return x_2;
  }
  }
  static lean_object* _init_l_StateT_run_x27___rarg___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_alloc_closure((void*)(l_StateT_run_x27___rarg___lambda__1___boxed), 1, 0);
  return x_1;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_run_x27___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; 
  x_5 = lean_ctor_get(x_1, 0);
  lean_inc(x_5);
  lean_dec(x_1);
  x_6 = lean_apply_1(x_3, x_4);
  x_7 = l_StateT_run_x27___rarg___closed__1;
  x_8 = lean_apply_4(x_5, lean_box(0), lean_box(0), x_7, x_6);
  return x_8;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_run_x27(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_run_x27___rarg), 4, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_run_x27___rarg___lambda__1___boxed(lean_object* x_1) {
  _start:
  {
  lean_object* x_2; 
  x_2 = l_StateT_run_x27___rarg___lambda__1(x_1);
  lean_dec(x_1);
  return x_2;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_pure___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; 
  x_5 = lean_ctor_get(x_1, 0);
  lean_inc(x_5);
  lean_dec(x_1);
  x_6 = lean_ctor_get(x_5, 1);
  lean_inc(x_6);
  lean_dec(x_5);
  x_7 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_7, 0, x_3);
  lean_ctor_set(x_7, 1, x_4);
  x_8 = lean_apply_2(x_6, lean_box(0), x_7);
  return x_8;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_pure(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_pure___rarg), 4, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_bind___rarg___lambda__1(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; lean_object* x_4; lean_object* x_5; 
  x_3 = lean_ctor_get(x_2, 0);
  lean_inc(x_3);
  x_4 = lean_ctor_get(x_2, 1);
  lean_inc(x_4);
  lean_dec(x_2);
  x_5 = lean_apply_2(x_1, x_3, x_4);
  return x_5;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_bind___rarg(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:
  {
  lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_7 = lean_ctor_get(x_1, 1);
  lean_inc(x_7);
  lean_dec(x_1);
  x_8 = lean_apply_1(x_4, x_6);
  x_9 = lean_alloc_closure((void*)(l_StateT_bind___rarg___lambda__1), 2, 1);
  lean_closure_set(x_9, 0, x_5);
  x_10 = lean_apply_4(x_7, lean_box(0), lean_box(0), x_8, x_9);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_bind(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_bind___rarg), 6, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_map___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  uint8_t x_4; 
  x_4 = !lean_is_exclusive(x_3);
  if (x_4 == 0)
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; 
  x_5 = lean_ctor_get(x_3, 0);
  x_6 = lean_ctor_get(x_1, 0);
  lean_inc(x_6);
  lean_dec(x_1);
  x_7 = lean_ctor_get(x_6, 1);
  lean_inc(x_7);
  lean_dec(x_6);
  x_8 = lean_apply_1(x_2, x_5);
  lean_ctor_set(x_3, 0, x_8);
  x_9 = lean_apply_2(x_7, lean_box(0), x_3);
  return x_9;
  }
  else
  {
  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; 
  x_10 = lean_ctor_get(x_3, 0);
  x_11 = lean_ctor_get(x_3, 1);
  lean_inc(x_11);
  lean_inc(x_10);
  lean_dec(x_3);
  x_12 = lean_ctor_get(x_1, 0);
  lean_inc(x_12);
  lean_dec(x_1);
  x_13 = lean_ctor_get(x_12, 1);
  lean_inc(x_13);
  lean_dec(x_12);
  x_14 = lean_apply_1(x_2, x_10);
  x_15 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_15, 0, x_14);
  lean_ctor_set(x_15, 1, x_11);
  x_16 = lean_apply_2(x_13, lean_box(0), x_15);
  return x_16;
  }
  }
  }
  LEAN_EXPORT lean_object* l_StateT_map___rarg(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:
  {
  lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_7 = lean_ctor_get(x_1, 1);
  lean_inc(x_7);
  x_8 = lean_apply_1(x_5, x_6);
  x_9 = lean_alloc_closure((void*)(l_StateT_map___rarg___lambda__1), 3, 2);
  lean_closure_set(x_9, 0, x_1);
  lean_closure_set(x_9, 1, x_4);
  x_10 = lean_apply_4(x_7, lean_box(0), lean_box(0), x_8, x_9);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_map(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_map___rarg), 6, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  uint8_t x_4; 
  x_4 = !lean_is_exclusive(x_3);
  if (x_4 == 0)
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; 
  x_5 = lean_ctor_get(x_3, 0);
  lean_dec(x_5);
  x_6 = lean_ctor_get(x_1, 0);
  lean_inc(x_6);
  lean_dec(x_1);
  x_7 = lean_ctor_get(x_6, 1);
  lean_inc(x_7);
  lean_dec(x_6);
  lean_ctor_set(x_3, 0, x_2);
  x_8 = lean_apply_2(x_7, lean_box(0), x_3);
  return x_8;
  }
  else
  {
  lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; 
  x_9 = lean_ctor_get(x_3, 1);
  lean_inc(x_9);
  lean_dec(x_3);
  x_10 = lean_ctor_get(x_1, 0);
  lean_inc(x_10);
  lean_dec(x_1);
  x_11 = lean_ctor_get(x_10, 1);
  lean_inc(x_11);
  lean_dec(x_10);
  x_12 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_12, 0, x_2);
  lean_ctor_set(x_12, 1, x_9);
  x_13 = lean_apply_2(x_11, lean_box(0), x_12);
  return x_13;
  }
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__2(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:
  {
  lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_7 = lean_ctor_get(x_1, 1);
  lean_inc(x_7);
  x_8 = lean_apply_1(x_5, x_6);
  x_9 = lean_alloc_closure((void*)(l_StateT_instMonadStateT___rarg___lambda__1), 3, 2);
  lean_closure_set(x_9, 0, x_1);
  lean_closure_set(x_9, 1, x_4);
  x_10 = lean_apply_4(x_7, lean_box(0), lean_box(0), x_8, x_9);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__3(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  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_box(0);
  x_8 = lean_apply_2(x_1, x_7, x_6);
  x_9 = lean_alloc_closure((void*)(l_StateT_map___rarg___lambda__1), 3, 2);
  lean_closure_set(x_9, 0, x_2);
  lean_closure_set(x_9, 1, x_5);
  x_10 = lean_apply_4(x_3, lean_box(0), lean_box(0), x_8, x_9);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__4(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:
  {
  lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_7 = lean_ctor_get(x_1, 1);
  lean_inc(x_7);
  x_8 = lean_apply_1(x_4, x_6);
  lean_inc(x_7);
  x_9 = lean_alloc_closure((void*)(l_StateT_instMonadStateT___rarg___lambda__3), 4, 3);
  lean_closure_set(x_9, 0, x_5);
  lean_closure_set(x_9, 1, x_1);
  lean_closure_set(x_9, 2, x_7);
  x_10 = lean_apply_4(x_7, lean_box(0), lean_box(0), x_8, x_9);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__5(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  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_box(0);
  x_8 = lean_apply_2(x_1, x_7, x_6);
  x_9 = lean_alloc_closure((void*)(l_StateT_instMonadStateT___rarg___lambda__1), 3, 2);
  lean_closure_set(x_9, 0, x_2);
  lean_closure_set(x_9, 1, x_5);
  x_10 = lean_apply_4(x_3, lean_box(0), lean_box(0), x_8, x_9);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__6(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:
  {
  lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_7 = lean_ctor_get(x_1, 1);
  lean_inc(x_7);
  x_8 = lean_apply_1(x_4, x_6);
  lean_inc(x_7);
  x_9 = lean_alloc_closure((void*)(l_StateT_instMonadStateT___rarg___lambda__5), 4, 3);
  lean_closure_set(x_9, 0, x_5);
  lean_closure_set(x_9, 1, x_1);
  lean_closure_set(x_9, 2, x_7);
  x_10 = lean_apply_4(x_7, lean_box(0), lean_box(0), x_8, x_9);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__7(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; lean_object* x_4; lean_object* x_5; 
  x_3 = lean_ctor_get(x_2, 1);
  lean_inc(x_3);
  lean_dec(x_2);
  x_4 = lean_box(0);
  x_5 = lean_apply_2(x_1, x_4, x_3);
  return x_5;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg___lambda__8(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:
  {
  lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_7 = lean_ctor_get(x_1, 1);
  lean_inc(x_7);
  lean_dec(x_1);
  x_8 = lean_apply_1(x_4, x_6);
  x_9 = lean_alloc_closure((void*)(l_StateT_instMonadStateT___rarg___lambda__7), 2, 1);
  lean_closure_set(x_9, 0, x_5);
  x_10 = lean_apply_4(x_7, lean_box(0), lean_box(0), x_8, x_9);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT___rarg(lean_object* x_1) {
  _start:
  {
  lean_object* x_2; 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_inc(x_1);
  x_2 = lean_alloc_closure((void*)(l_StateT_map___rarg), 6, 1);
  lean_closure_set(x_2, 0, x_1);
  lean_inc(x_1);
  x_3 = lean_alloc_closure((void*)(l_StateT_instMonadStateT___rarg___lambda__2), 6, 1);
  lean_closure_set(x_3, 0, x_1);
  x_4 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_4, 0, x_2);
  lean_ctor_set(x_4, 1, x_3);
  lean_inc(x_1);
  x_5 = lean_alloc_closure((void*)(l_StateT_pure___rarg), 4, 1);
  lean_closure_set(x_5, 0, x_1);
  lean_inc(x_1);
  x_6 = lean_alloc_closure((void*)(l_StateT_instMonadStateT___rarg___lambda__4), 6, 1);
  lean_closure_set(x_6, 0, x_1);
  lean_inc(x_1);
  x_7 = lean_alloc_closure((void*)(l_StateT_instMonadStateT___rarg___lambda__6), 6, 1);
  lean_closure_set(x_7, 0, x_1);
  lean_inc(x_1);
  x_8 = lean_alloc_closure((void*)(l_StateT_instMonadStateT___rarg___lambda__8), 6, 1);
  lean_closure_set(x_8, 0, x_1);
  x_9 = lean_alloc_ctor(0, 5, 0);
  lean_ctor_set(x_9, 0, x_4);
  lean_ctor_set(x_9, 1, x_5);
  lean_ctor_set(x_9, 2, x_6);
  lean_ctor_set(x_9, 3, x_7);
  lean_ctor_set(x_9, 4, x_8);
  x_10 = lean_alloc_closure((void*)(l_StateT_bind___rarg), 6, 1);
  lean_closure_set(x_10, 0, x_1);
  x_11 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_11, 0, x_9);
  lean_ctor_set(x_11, 1, x_10);
  return x_11;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadStateT(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_instMonadStateT___rarg), 1, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_orElse___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; lean_object* x_5; 
  x_4 = lean_box(0);
  x_5 = lean_apply_2(x_1, x_4, x_2);
  return x_5;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_orElse___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
  _start:
  {
  lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; 
  lean_inc(x_5);
  x_6 = lean_apply_1(x_3, x_5);
  x_7 = lean_alloc_closure((void*)(l_StateT_orElse___rarg___lambda__1___boxed), 3, 2);
  lean_closure_set(x_7, 0, x_4);
  lean_closure_set(x_7, 1, x_5);
  x_8 = lean_ctor_get(x_1, 2);
  lean_inc(x_8);
  lean_dec(x_1);
  x_9 = lean_apply_3(x_8, lean_box(0), x_6, x_7);
  return x_9;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_orElse(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_orElse___rarg), 5, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_orElse___rarg___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; 
  x_4 = l_StateT_orElse___rarg___lambda__1(x_1, x_2, x_3);
  lean_dec(x_3);
  return x_4;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_failure___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; lean_object* x_5; 
  x_4 = lean_ctor_get(x_1, 1);
  lean_inc(x_4);
  lean_dec(x_1);
  x_5 = lean_apply_1(x_4, lean_box(0));
  return x_5;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_failure(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_failure___rarg___boxed), 3, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_failure___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; 
  x_4 = l_StateT_failure___rarg(x_1, x_2, x_3);
  lean_dec(x_3);
  return x_4;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instAlternativeStateT___rarg(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; 
  x_3 = l_StateT_instMonadStateT___rarg(x_1);
  x_4 = lean_ctor_get(x_3, 0);
  lean_inc(x_4);
  lean_dec(x_3);
  lean_inc(x_2);
  x_5 = lean_alloc_closure((void*)(l_StateT_failure___rarg___boxed), 3, 1);
  lean_closure_set(x_5, 0, x_2);
  x_6 = lean_alloc_closure((void*)(l_StateT_orElse___rarg), 5, 1);
  lean_closure_set(x_6, 0, x_2);
  x_7 = lean_alloc_ctor(0, 3, 0);
  lean_ctor_set(x_7, 0, x_4);
  lean_ctor_set(x_7, 1, x_5);
  lean_ctor_set(x_7, 2, x_6);
  return x_7;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instAlternativeStateT(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_instAlternativeStateT___rarg), 2, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_get___rarg(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; 
  x_3 = lean_ctor_get(x_1, 0);
  lean_inc(x_3);
  lean_dec(x_1);
  x_4 = lean_ctor_get(x_3, 1);
  lean_inc(x_4);
  lean_dec(x_3);
  lean_inc(x_2);
  x_5 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_5, 0, x_2);
  lean_ctor_set(x_5, 1, x_2);
  x_6 = lean_apply_2(x_4, lean_box(0), x_5);
  return x_6;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_get(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_get___rarg), 2, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_set___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; 
  x_4 = lean_ctor_get(x_1, 0);
  lean_inc(x_4);
  lean_dec(x_1);
  x_5 = lean_ctor_get(x_4, 1);
  lean_inc(x_5);
  lean_dec(x_4);
  x_6 = lean_box(0);
  x_7 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_7, 0, x_6);
  lean_ctor_set(x_7, 1, x_2);
  x_8 = lean_apply_2(x_5, lean_box(0), x_7);
  return x_8;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_set(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_set___rarg___boxed), 3, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_set___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; 
  x_4 = l_StateT_set___rarg(x_1, x_2, x_3);
  lean_dec(x_3);
  return x_4;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_modifyGet___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; 
  x_5 = lean_ctor_get(x_1, 0);
  lean_inc(x_5);
  lean_dec(x_1);
  x_6 = lean_ctor_get(x_5, 1);
  lean_inc(x_6);
  lean_dec(x_5);
  x_7 = lean_apply_1(x_3, x_4);
  x_8 = lean_apply_2(x_6, lean_box(0), x_7);
  return x_8;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_modifyGet(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_modifyGet___rarg), 4, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_lift___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; 
  x_4 = lean_ctor_get(x_1, 0);
  lean_inc(x_4);
  lean_dec(x_1);
  x_5 = lean_ctor_get(x_4, 1);
  lean_inc(x_5);
  lean_dec(x_4);
  x_6 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_6, 0, x_3);
  lean_ctor_set(x_6, 1, x_2);
  x_7 = lean_apply_2(x_5, lean_box(0), x_6);
  return x_7;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_lift___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; 
  x_5 = lean_ctor_get(x_1, 1);
  lean_inc(x_5);
  x_6 = lean_alloc_closure((void*)(l_StateT_lift___rarg___lambda__1), 3, 2);
  lean_closure_set(x_6, 0, x_1);
  lean_closure_set(x_6, 1, x_4);
  x_7 = lean_apply_4(x_5, lean_box(0), lean_box(0), x_3, x_6);
  return x_7;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_lift(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_lift___rarg), 4, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadLiftStateT___rarg(lean_object* x_1) {
  _start:
  {
  lean_object* x_2; 
  x_2 = lean_alloc_closure((void*)(l_StateT_lift___rarg), 4, 1);
  lean_closure_set(x_2, 0, x_1);
  return x_2;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadLiftStateT(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_instMonadLiftStateT___rarg), 1, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadFunctorStateT___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; lean_object* x_5; 
  x_4 = lean_apply_1(x_2, x_3);
  x_5 = lean_apply_2(x_1, lean_box(0), x_4);
  return x_5;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadFunctorStateT(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; 
  x_5 = lean_alloc_closure((void*)(l_StateT_instMonadFunctorStateT___rarg), 3, 0);
  return x_5;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadFunctorStateT___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; 
  x_5 = l_StateT_instMonadFunctorStateT(x_1, x_2, x_3, x_4);
  lean_dec(x_3);
  return x_5;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadExceptOfStateT___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
  _start:
  {
  lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_6 = lean_ctor_get(x_1, 0);
  lean_inc(x_6);
  lean_dec(x_1);
  x_7 = lean_apply_2(x_6, lean_box(0), x_4);
  x_8 = lean_ctor_get(x_2, 1);
  lean_inc(x_8);
  x_9 = lean_alloc_closure((void*)(l_StateT_lift___rarg___lambda__1), 3, 2);
  lean_closure_set(x_9, 0, x_2);
  lean_closure_set(x_9, 1, x_5);
  x_10 = lean_apply_4(x_8, lean_box(0), lean_box(0), x_7, x_9);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadExceptOfStateT___rarg___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; 
  x_4 = lean_apply_2(x_1, x_3, x_2);
  return x_4;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadExceptOfStateT___rarg___lambda__3(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
  _start:
  {
  lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; 
  lean_inc(x_5);
  x_6 = lean_apply_1(x_3, x_5);
  x_7 = lean_alloc_closure((void*)(l_StateT_instMonadExceptOfStateT___rarg___lambda__2), 3, 2);
  lean_closure_set(x_7, 0, x_4);
  lean_closure_set(x_7, 1, x_5);
  x_8 = lean_ctor_get(x_1, 1);
  lean_inc(x_8);
  lean_dec(x_1);
  x_9 = lean_apply_3(x_8, lean_box(0), x_6, x_7);
  return x_9;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadExceptOfStateT___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; lean_object* x_5; lean_object* x_6; 
  lean_inc(x_3);
  x_4 = lean_alloc_closure((void*)(l_StateT_instMonadExceptOfStateT___rarg___lambda__1), 5, 2);
  lean_closure_set(x_4, 0, x_3);
  lean_closure_set(x_4, 1, x_1);
  x_5 = lean_alloc_closure((void*)(l_StateT_instMonadExceptOfStateT___rarg___lambda__3), 5, 1);
  lean_closure_set(x_5, 0, x_3);
  x_6 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_6, 0, x_4);
  lean_ctor_set(x_6, 1, x_5);
  return x_6;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_instMonadExceptOfStateT(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_instMonadExceptOfStateT___rarg), 3, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_instMonadStateOfStateT___rarg(lean_object* x_1) {
  _start:
  {
  lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; 
  lean_inc(x_1);
  x_2 = lean_alloc_closure((void*)(l_StateT_get___rarg), 2, 1);
  lean_closure_set(x_2, 0, x_1);
  lean_inc(x_1);
  x_3 = lean_alloc_closure((void*)(l_StateT_set___rarg___boxed), 3, 1);
  lean_closure_set(x_3, 0, x_1);
  x_4 = lean_alloc_closure((void*)(l_StateT_modifyGet___rarg), 4, 1);
  lean_closure_set(x_4, 0, x_1);
  x_5 = lean_alloc_ctor(0, 3, 0);
  lean_ctor_set(x_5, 0, x_2);
  lean_ctor_set(x_5, 1, x_3);
  lean_ctor_set(x_5, 2, x_4);
  return x_5;
  }
  }
  LEAN_EXPORT lean_object* l_instMonadStateOfStateT(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_instMonadStateOfStateT___rarg), 1, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; 
  x_4 = lean_apply_1(x_3, x_1);
  return x_4;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; lean_object* x_5; 
  x_4 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_4, 0, x_3);
  lean_ctor_set(x_4, 1, x_1);
  x_5 = lean_apply_2(x_2, lean_box(0), x_4);
  return x_5;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__3(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  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_alloc_closure((void*)(l_StateT_monadControl___rarg___lambda__1), 3, 1);
  lean_closure_set(x_7, 0, x_5);
  x_8 = lean_apply_1(x_1, x_7);
  x_9 = lean_alloc_closure((void*)(l_StateT_monadControl___rarg___lambda__2), 3, 2);
  lean_closure_set(x_9, 0, x_6);
  lean_closure_set(x_9, 1, x_2);
  x_10 = lean_apply_4(x_3, lean_box(0), lean_box(0), x_8, x_9);
  return x_10;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__4(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  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; 
  x_5 = lean_ctor_get(x_1, 1);
  lean_inc(x_5);
  x_6 = lean_ctor_get(x_1, 0);
  lean_inc(x_6);
  lean_dec(x_1);
  x_7 = lean_ctor_get(x_6, 1);
  lean_inc(x_7);
  lean_dec(x_6);
  lean_inc(x_4);
  x_8 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_8, 0, x_4);
  lean_ctor_set(x_8, 1, x_4);
  lean_inc(x_7);
  x_9 = lean_apply_2(x_7, lean_box(0), x_8);
  lean_inc(x_5);
  x_10 = lean_alloc_closure((void*)(l_StateT_monadControl___rarg___lambda__3), 4, 3);
  lean_closure_set(x_10, 0, x_3);
  lean_closure_set(x_10, 1, x_7);
  lean_closure_set(x_10, 2, x_5);
  x_11 = lean_apply_4(x_5, lean_box(0), lean_box(0), x_9, x_10);
  return x_11;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__5(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  uint8_t x_4; 
  x_4 = !lean_is_exclusive(x_3);
  if (x_4 == 0)
  {
  lean_object* x_5; lean_object* x_6; 
  x_5 = lean_ctor_get(x_3, 0);
  lean_dec(x_5);
  lean_ctor_set(x_3, 0, x_1);
  x_6 = lean_apply_2(x_2, lean_box(0), x_3);
  return x_6;
  }
  else
  {
  lean_object* x_7; lean_object* x_8; lean_object* x_9; 
  x_7 = lean_ctor_get(x_3, 1);
  lean_inc(x_7);
  lean_dec(x_3);
  x_8 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_8, 0, x_1);
  lean_ctor_set(x_8, 1, x_7);
  x_9 = lean_apply_2(x_2, lean_box(0), x_8);
  return x_9;
  }
  }
  }
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__6(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  lean_object* x_4; uint8_t x_5; 
  x_4 = lean_ctor_get(x_3, 0);
  lean_inc(x_4);
  lean_dec(x_3);
  x_5 = !lean_is_exclusive(x_4);
  if (x_5 == 0)
  {
  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; 
  x_6 = lean_ctor_get(x_4, 0);
  x_7 = lean_ctor_get(x_1, 0);
  lean_inc(x_7);
  lean_dec(x_1);
  x_8 = lean_ctor_get(x_7, 1);
  lean_inc(x_8);
  lean_dec(x_7);
  x_9 = lean_box(0);
  lean_ctor_set(x_4, 0, x_9);
  lean_inc(x_8);
  x_10 = lean_apply_2(x_8, lean_box(0), x_4);
  x_11 = lean_alloc_closure((void*)(l_StateT_monadControl___rarg___lambda__5), 3, 2);
  lean_closure_set(x_11, 0, x_6);
  lean_closure_set(x_11, 1, x_8);
  x_12 = lean_apply_4(x_2, lean_box(0), lean_box(0), x_10, x_11);
  return x_12;
  }
  else
  {
  lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; 
  x_13 = lean_ctor_get(x_4, 0);
  x_14 = lean_ctor_get(x_4, 1);
  lean_inc(x_14);
  lean_inc(x_13);
  lean_dec(x_4);
  x_15 = lean_ctor_get(x_1, 0);
  lean_inc(x_15);
  lean_dec(x_1);
  x_16 = lean_ctor_get(x_15, 1);
  lean_inc(x_16);
  lean_dec(x_15);
  x_17 = lean_box(0);
  x_18 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_18, 0, x_17);
  lean_ctor_set(x_18, 1, x_14);
  lean_inc(x_16);
  x_19 = lean_apply_2(x_16, lean_box(0), x_18);
  x_20 = lean_alloc_closure((void*)(l_StateT_monadControl___rarg___lambda__5), 3, 2);
  lean_closure_set(x_20, 0, x_13);
  lean_closure_set(x_20, 1, x_16);
  x_21 = lean_apply_4(x_2, lean_box(0), lean_box(0), x_19, x_20);
  return x_21;
  }
  }
  }
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg___lambda__7(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
  _start:
  {
  lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; 
  x_5 = lean_ctor_get(x_1, 1);
  lean_inc(x_5);
  lean_inc(x_1);
  x_6 = lean_alloc_closure((void*)(l_StateT_lift___rarg___lambda__1), 3, 2);
  lean_closure_set(x_6, 0, x_1);
  lean_closure_set(x_6, 1, x_4);
  lean_inc(x_5);
  x_7 = lean_apply_4(x_5, lean_box(0), lean_box(0), x_3, x_6);
  lean_inc(x_5);
  x_8 = lean_alloc_closure((void*)(l_StateT_monadControl___rarg___lambda__6), 3, 2);
  lean_closure_set(x_8, 0, x_1);
  lean_closure_set(x_8, 1, x_5);
  x_9 = lean_apply_4(x_5, lean_box(0), lean_box(0), x_7, x_8);
  return x_9;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_monadControl___rarg(lean_object* x_1) {
  _start:
  {
  lean_object* x_2; lean_object* x_3; lean_object* x_4; 
  lean_inc(x_1);
  x_2 = lean_alloc_closure((void*)(l_StateT_monadControl___rarg___lambda__4), 4, 1);
  lean_closure_set(x_2, 0, x_1);
  x_3 = lean_alloc_closure((void*)(l_StateT_monadControl___rarg___lambda__7), 4, 1);
  lean_closure_set(x_3, 0, x_1);
  x_4 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_4, 0, x_2);
  lean_ctor_set(x_4, 1, x_3);
  return x_4;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_monadControl(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_monadControl___rarg), 1, 0);
  return x_3;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_tryFinally___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
  _start:
  {
  if (lean_obj_tag(x_3) == 0)
  {
  lean_object* x_4; lean_object* x_5; 
  x_4 = lean_box(0);
  x_5 = lean_apply_2(x_1, x_4, x_2);
  return x_5;
  }
  else
  {
  uint8_t x_6; 
  lean_dec(x_2);
  x_6 = !lean_is_exclusive(x_3);
  if (x_6 == 0)
  {
  lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
  x_7 = lean_ctor_get(x_3, 0);
  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);
  lean_ctor_set(x_3, 0, x_8);
  x_10 = lean_apply_2(x_1, x_3, x_9);
  return x_10;
  }
  else
  {
  lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; 
  x_11 = lean_ctor_get(x_3, 0);
  lean_inc(x_11);
  lean_dec(x_3);
  x_12 = lean_ctor_get(x_11, 0);
  lean_inc(x_12);
  x_13 = lean_ctor_get(x_11, 1);
  lean_inc(x_13);
  lean_dec(x_11);
  x_14 = lean_alloc_ctor(1, 1, 0);
  lean_ctor_set(x_14, 0, x_12);
  x_15 = lean_apply_2(x_1, x_14, x_13);
  return x_15;
  }
  }
  }
  }
  LEAN_EXPORT lean_object* l_StateT_tryFinally___rarg___lambda__2(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; lean_object* x_4; uint8_t x_5; 
  x_3 = lean_ctor_get(x_2, 0);
  lean_inc(x_3);
  x_4 = lean_ctor_get(x_2, 1);
  lean_inc(x_4);
  lean_dec(x_2);
  x_5 = !lean_is_exclusive(x_3);
  if (x_5 == 0)
  {
  lean_object* x_6; lean_object* x_7; uint8_t x_8; 
  x_6 = lean_ctor_get(x_3, 0);
  x_7 = lean_ctor_get(x_3, 1);
  lean_dec(x_7);
  x_8 = !lean_is_exclusive(x_4);
  if (x_8 == 0)
  {
  lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; 
  x_9 = lean_ctor_get(x_4, 0);
  x_10 = lean_ctor_get(x_4, 1);
  x_11 = lean_ctor_get(x_1, 0);
  lean_inc(x_11);
  lean_dec(x_1);
  x_12 = lean_ctor_get(x_11, 1);
  lean_inc(x_12);
  lean_dec(x_11);
  lean_ctor_set(x_4, 1, x_9);
  lean_ctor_set(x_4, 0, x_6);
  lean_ctor_set(x_3, 1, x_10);
  lean_ctor_set(x_3, 0, x_4);
  x_13 = lean_apply_2(x_12, lean_box(0), x_3);
  return x_13;
  }
  else
  {
  lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; 
  x_14 = lean_ctor_get(x_4, 0);
  x_15 = lean_ctor_get(x_4, 1);
  lean_inc(x_15);
  lean_inc(x_14);
  lean_dec(x_4);
  x_16 = lean_ctor_get(x_1, 0);
  lean_inc(x_16);
  lean_dec(x_1);
  x_17 = lean_ctor_get(x_16, 1);
  lean_inc(x_17);
  lean_dec(x_16);
  x_18 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_18, 0, x_6);
  lean_ctor_set(x_18, 1, x_14);
  lean_ctor_set(x_3, 1, x_15);
  lean_ctor_set(x_3, 0, x_18);
  x_19 = lean_apply_2(x_17, lean_box(0), x_3);
  return x_19;
  }
  }
  else
  {
  lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; 
  x_20 = lean_ctor_get(x_3, 0);
  lean_inc(x_20);
  lean_dec(x_3);
  x_21 = lean_ctor_get(x_4, 0);
  lean_inc(x_21);
  x_22 = lean_ctor_get(x_4, 1);
  lean_inc(x_22);
  if (lean_is_exclusive(x_4)) {
   lean_ctor_release(x_4, 0);
   lean_ctor_release(x_4, 1);
   x_23 = x_4;
  } else {
   lean_dec_ref(x_4);
   x_23 = lean_box(0);
  }
  x_24 = lean_ctor_get(x_1, 0);
  lean_inc(x_24);
  lean_dec(x_1);
  x_25 = lean_ctor_get(x_24, 1);
  lean_inc(x_25);
  lean_dec(x_24);
  if (lean_is_scalar(x_23)) {
   x_26 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_26 = x_23;
  }
  lean_ctor_set(x_26, 0, x_20);
  lean_ctor_set(x_26, 1, x_21);
  x_27 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_27, 0, x_26);
  lean_ctor_set(x_27, 1, x_22);
  x_28 = lean_apply_2(x_25, lean_box(0), x_27);
  return x_28;
  }
  }
  }
  LEAN_EXPORT lean_object* l_StateT_tryFinally___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
  _start:
  {
  lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; 
  x_8 = lean_ctor_get(x_2, 1);
  lean_inc(x_8);
  lean_inc(x_7);
  x_9 = lean_apply_1(x_5, x_7);
  x_10 = lean_alloc_closure((void*)(l_StateT_tryFinally___rarg___lambda__1), 3, 2);
  lean_closure_set(x_10, 0, x_6);
  lean_closure_set(x_10, 1, x_7);
  x_11 = lean_apply_4(x_1, lean_box(0), lean_box(0), x_9, x_10);
  x_12 = lean_alloc_closure((void*)(l_StateT_tryFinally___rarg___lambda__2), 2, 1);
  lean_closure_set(x_12, 0, x_2);
  x_13 = lean_apply_4(x_8, lean_box(0), lean_box(0), x_11, x_12);
  return x_13;
  }
  }
  LEAN_EXPORT lean_object* l_StateT_tryFinally(lean_object* x_1, lean_object* x_2) {
  _start:
  {
  lean_object* x_3; 
  x_3 = lean_alloc_closure((void*)(l_StateT_tryFinally___rarg), 7, 0);
  return x_3;
  }
  }
  lean_object* initialize_Init_Control_Basic(lean_object*);
  lean_object* initialize_Init_Control_Id(lean_object*);
  lean_object* initialize_Init_Control_Except(lean_object*);
  static bool _G_initialized = false;
  LEAN_EXPORT lean_object* initialize_Init_Control_State(lean_object* w) {
  lean_object * res;
  if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
  _G_initialized = true;
  res = initialize_Init_Control_Basic(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Init_Control_Id(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Init_Control_Except(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  l_StateT_run_x27___rarg___closed__1 = _init_l_StateT_run_x27___rarg___closed__1();
  lean_mark_persistent(l_StateT_run_x27___rarg___closed__1);
  return lean_io_result_mk_ok(lean_box(0));
  }
  #ifdef __cplusplus
  }
  #endif
  