text: // Lean compiler output
  // Module: Lean.Meta.Tactic.Replace
  // Imports: Init Lean.Util.ForEachExpr Lean.Meta.AppBuilder Lean.Meta.MatchUtil Lean.Meta.Tactic.Util Lean.Meta.Tactic.Revert Lean.Meta.Tactic.Intro Lean.Meta.Tactic.Clear Lean.Meta.Tactic.Assert
  #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_Meta_replaceTargetDefEq(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_change___lambda__2___closed__3;
  lean_object* l_Lean_Expr_mvarId_x21(lean_object*);
  lean_object* l_Lean_stringToMessageData(lean_object*);
  lean_object* lean_mk_empty_array_with_capacity(lean_object*);
  lean_object* l_Lean_LocalDecl_userName(lean_object*);
  lean_object* lean_name_mk_string(lean_object*, lean_object*);
  lean_object* l_Std_HashMapImp_find_x3f___at_Lean_Meta_ToHide_visitVisibleExpr_visit___spec__1(lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_change___lambda__2___closed__5;
  lean_object* l_Lean_Meta_saveState___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_getMVarTag(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* lean_st_ref_get(lean_object*, lean_object*);
  lean_object* lean_array_push(lean_object*, lean_object*);
  lean_object* lean_array_get_size(lean_object*);
  static lean_object* l_Lean_Meta_change___lambda__2___closed__2;
  static lean_object* l_Lean_Meta_changeLocalDecl___lambda__1___closed__4;
  lean_object* l_Lean_Meta_modifyTarget___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_mkEqMP(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_changeLocalDecl___closed__3;
  static lean_object* l_Lean_Meta_change___lambda__2___closed__4;
  lean_object* l_Lean_Meta_replaceLocalDecl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_replaceLocalDeclDefEq___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_replaceTargetDefEq___closed__2;
  lean_object* l_Lean_mkAppN(lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_replaceTargetEq___lambda__1___closed__3;
  static lean_object* l_Lean_Meta_changeLocalDecl___closed__2;
  static lean_object* l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__4;
  lean_object* l_Std_HashMap_insert___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_change___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_change___lambda__2___closed__1;
  lean_object* l_Lean_Meta_replaceTargetDefEq___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_changeLocalDecl___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_change___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_replaceTargetEq___lambda__1___closed__5;
  static lean_object* l_Lean_Meta_changeLocalDecl___closed__1;
  lean_object* l_Lean_Meta_replaceTargetEq(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_change___lambda__2___closed__6;
  lean_object* l_Lean_Meta_getMVarType(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* lean_st_ref_take(lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_replaceLocalDecl_findMaxFVar___closed__1;
  lean_object* l_Lean_Meta_modifyTargetEqLHS___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_replaceLocalDecl_findMaxFVar___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Expr_fvarId_x21(lean_object*);
  lean_object* l_Std_mkHashMapImp___rarg(lean_object*);
  lean_object* l_Lean_Meta_clear(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_change___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_changeLocalDecl___lambda__1___closed__1;
  lean_object* l_Std_PersistentArray_set___rarg(lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_changeLocalDecl___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_replaceTargetDefEq___closed__1;
  lean_object* lean_st_mk_ref(lean_object*, lean_object*);
  extern lean_object* l_Lean_Expr_instHashableExpr;
  lean_object* l_Lean_Meta_revert(lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_change___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_replaceTargetEq___lambda__1___closed__1;
  lean_object* l_Lean_Meta_replaceLocalDeclDefEq___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_getLocalInstances(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_introNCore(lean_object*, lean_object*, lean_object*, uint8_t, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Std_PersistentHashMap_insert___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_mkFVar(lean_object*);
  uint8_t l_Lean_Expr_Data_binderInfo(uint64_t);
  lean_object* l_Lean_Meta_SavedState_restore(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_LocalDecl_fvarId(lean_object*);
  static lean_object* l_Lean_Meta_replaceTargetEq___lambda__1___closed__2;
  lean_object* l_Lean_Meta_matchEq_x3f(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_mkFreshExprMVarAt(lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_throwTacticEx___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__3;
  lean_object* l_Lean_Meta_assignExprMVar(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  extern lean_object* l_Lean_instBEqFVarId;
  lean_object* l_Lean_Meta_changeLocalDecl(lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_LocalDecl_index(lean_object*);
  lean_object* l_Lean_Meta_checkNotAssigned(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_getLocalDecl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  uint8_t lean_expr_eqv(lean_object*, lean_object*);
  lean_object* l_Lean_Meta_change___lambda__2(lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_replaceLocalDecl___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_changeLocalDecl___lambda__1___closed__2;
  lean_object* l_Lean_Meta_replaceLocalDeclDefEq(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_getLevel(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_modifyTarget(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* lean_st_ref_set(lean_object*, lean_object*, lean_object*);
  uint8_t l_Lean_Expr_isFVar(lean_object*);
  lean_object* l_Lean_mkForall(lean_object*, uint8_t, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_isExprDefEq(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_mkLet(lean_object*, lean_object*, lean_object*, lean_object*, uint8_t);
  lean_object* l_Lean_Meta_getMVarDecl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  extern lean_object* l_Lean_instHashableFVarId;
  lean_object* l_Lean_Meta_change(lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_replaceTargetEq___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  extern lean_object* l_Lean_Expr_instBEqExpr;
  static lean_object* l_Lean_Meta_replaceTargetEq___closed__1;
  lean_object* l_Lean_Meta_replaceLocalDecl_findMaxFVar(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_Meta_assertAfter(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_LocalDecl_setType(lean_object*, lean_object*);
  lean_object* l_Lean_Meta_mkExpectedTypeHint(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_changeLocalDecl___lambda__1___closed__5;
  static lean_object* l_Lean_Meta_replaceTargetEq___closed__2;
  static lean_object* l_Lean_Meta_modifyTarget___closed__2;
  lean_object* l_Lean_Meta_mkFreshExprSyntheticOpaqueMVar(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_changeLocalDecl___lambda__1___closed__3;
  lean_object* lean_local_ctx_find(lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_modifyTarget___closed__1;
  static lean_object* l_Lean_Meta_replaceTargetEq___lambda__1___closed__4;
  lean_object* l_Lean_Meta_mkEq(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_indentExpr(lean_object*);
  uint8_t l_Lean_Expr_hasFVar(lean_object*);
  lean_object* l_Lean_Meta_modifyTargetEqLHS(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  lean_object* l_Lean_mkConst(lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__2;
  lean_object* l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__1;
  uint8_t lean_nat_dec_lt(lean_object*, lean_object*);
  lean_object* l_Lean_Meta_changeLocalDecl___lambda__1(lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
  static lean_object* _init_l_Lean_Meta_replaceTargetEq___lambda__1___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("Eq");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_replaceTargetEq___lambda__1___closed__2() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; lean_object* x_3; 
  x_1 = lean_box(0);
  x_2 = l_Lean_Meta_replaceTargetEq___lambda__1___closed__1;
  x_3 = lean_name_mk_string(x_1, x_2);
  return x_3;
  }
  }
  static lean_object* _init_l_Lean_Meta_replaceTargetEq___lambda__1___closed__3() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("mpr");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_replaceTargetEq___lambda__1___closed__4() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; lean_object* x_3; 
  x_1 = l_Lean_Meta_replaceTargetEq___lambda__1___closed__2;
  x_2 = l_Lean_Meta_replaceTargetEq___lambda__1___closed__3;
  x_3 = lean_name_mk_string(x_1, x_2);
  return x_3;
  }
  }
  static lean_object* _init_l_Lean_Meta_replaceTargetEq___lambda__1___closed__5() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; 
  x_1 = lean_unsigned_to_nat(4u);
  x_2 = lean_mk_empty_array_with_capacity(x_1);
  return x_2;
  }
  }
  lean_object* l_Lean_Meta_replaceTargetEq___lambda__1(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, lean_object* x_8, lean_object* x_9) {
  _start:
  {
  lean_object* x_10; 
  lean_inc(x_6);
  lean_inc(x_1);
  x_10 = l_Lean_Meta_checkNotAssigned(x_1, x_2, x_5, x_6, x_7, x_8, x_9);
  if (lean_obj_tag(x_10) == 0)
  {
  lean_object* x_11; lean_object* x_12; 
  x_11 = lean_ctor_get(x_10, 1);
  lean_inc(x_11);
  lean_dec(x_10);
  lean_inc(x_1);
  x_12 = l_Lean_Meta_getMVarTag(x_1, x_5, x_6, x_7, x_8, x_11);
  if (lean_obj_tag(x_12) == 0)
  {
  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_13 = lean_ctor_get(x_12, 0);
  lean_inc(x_13);
  x_14 = lean_ctor_get(x_12, 1);
  lean_inc(x_14);
  lean_dec(x_12);
  lean_inc(x_5);
  lean_inc(x_3);
  x_15 = l_Lean_Meta_mkFreshExprSyntheticOpaqueMVar(x_3, x_13, x_5, x_6, x_7, x_8, x_14);
  x_16 = lean_ctor_get(x_15, 0);
  lean_inc(x_16);
  x_17 = lean_ctor_get(x_15, 1);
  lean_inc(x_17);
  lean_dec(x_15);
  lean_inc(x_1);
  x_18 = l_Lean_Meta_getMVarType(x_1, x_5, x_6, x_7, x_8, x_17);
  if (lean_obj_tag(x_18) == 0)
  {
  lean_object* x_19; lean_object* x_20; lean_object* x_21; 
  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);
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_19);
  x_21 = l_Lean_Meta_getLevel(x_19, x_5, x_6, x_7, x_8, x_20);
  if (lean_obj_tag(x_21) == 0)
  {
  lean_object* x_22; lean_object* x_23; lean_object* x_24; 
  x_22 = lean_ctor_get(x_21, 0);
  lean_inc(x_22);
  x_23 = lean_ctor_get(x_21, 1);
  lean_inc(x_23);
  lean_dec(x_21);
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_3);
  lean_inc(x_19);
  x_24 = l_Lean_Meta_mkEq(x_19, x_3, x_5, x_6, x_7, x_8, x_23);
  if (lean_obj_tag(x_24) == 0)
  {
  lean_object* x_25; lean_object* x_26; lean_object* x_27; 
  x_25 = lean_ctor_get(x_24, 0);
  lean_inc(x_25);
  x_26 = lean_ctor_get(x_24, 1);
  lean_inc(x_26);
  lean_dec(x_24);
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_4);
  x_27 = l_Lean_Meta_mkExpectedTypeHint(x_4, x_25, x_5, x_6, x_7, x_8, x_26);
  if (lean_obj_tag(x_27) == 0)
  {
  lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; uint8_t x_40; 
  x_28 = lean_ctor_get(x_27, 1);
  lean_inc(x_28);
  lean_dec(x_27);
  x_29 = lean_box(0);
  x_30 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_30, 0, x_22);
  lean_ctor_set(x_30, 1, x_29);
  x_31 = l_Lean_Meta_replaceTargetEq___lambda__1___closed__4;
  x_32 = l_Lean_mkConst(x_31, x_30);
  x_33 = l_Lean_Meta_replaceTargetEq___lambda__1___closed__5;
  x_34 = lean_array_push(x_33, x_19);
  x_35 = lean_array_push(x_34, x_3);
  x_36 = lean_array_push(x_35, x_4);
  lean_inc(x_16);
  x_37 = lean_array_push(x_36, x_16);
  x_38 = l_Lean_mkAppN(x_32, x_37);
  x_39 = l_Lean_Meta_assignExprMVar(x_1, x_38, x_5, x_6, x_7, x_8, x_28);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  x_40 = !lean_is_exclusive(x_39);
  if (x_40 == 0)
  {
  lean_object* x_41; lean_object* x_42; 
  x_41 = lean_ctor_get(x_39, 0);
  lean_dec(x_41);
  x_42 = l_Lean_Expr_mvarId_x21(x_16);
  lean_dec(x_16);
  lean_ctor_set(x_39, 0, x_42);
  return x_39;
  }
  else
  {
  lean_object* x_43; lean_object* x_44; lean_object* x_45; 
  x_43 = lean_ctor_get(x_39, 1);
  lean_inc(x_43);
  lean_dec(x_39);
  x_44 = l_Lean_Expr_mvarId_x21(x_16);
  lean_dec(x_16);
  x_45 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_45, 0, x_44);
  lean_ctor_set(x_45, 1, x_43);
  return x_45;
  }
  }
  else
  {
  uint8_t x_46; 
  lean_dec(x_22);
  lean_dec(x_19);
  lean_dec(x_16);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_46 = !lean_is_exclusive(x_27);
  if (x_46 == 0)
  {
  return x_27;
  }
  else
  {
  lean_object* x_47; lean_object* x_48; lean_object* x_49; 
  x_47 = lean_ctor_get(x_27, 0);
  x_48 = lean_ctor_get(x_27, 1);
  lean_inc(x_48);
  lean_inc(x_47);
  lean_dec(x_27);
  x_49 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_49, 0, x_47);
  lean_ctor_set(x_49, 1, x_48);
  return x_49;
  }
  }
  }
  else
  {
  uint8_t x_50; 
  lean_dec(x_22);
  lean_dec(x_19);
  lean_dec(x_16);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_50 = !lean_is_exclusive(x_24);
  if (x_50 == 0)
  {
  return x_24;
  }
  else
  {
  lean_object* x_51; lean_object* x_52; lean_object* x_53; 
  x_51 = lean_ctor_get(x_24, 0);
  x_52 = lean_ctor_get(x_24, 1);
  lean_inc(x_52);
  lean_inc(x_51);
  lean_dec(x_24);
  x_53 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_53, 0, x_51);
  lean_ctor_set(x_53, 1, x_52);
  return x_53;
  }
  }
  }
  else
  {
  uint8_t x_54; 
  lean_dec(x_19);
  lean_dec(x_16);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_54 = !lean_is_exclusive(x_21);
  if (x_54 == 0)
  {
  return x_21;
  }
  else
  {
  lean_object* x_55; lean_object* x_56; lean_object* x_57; 
  x_55 = lean_ctor_get(x_21, 0);
  x_56 = lean_ctor_get(x_21, 1);
  lean_inc(x_56);
  lean_inc(x_55);
  lean_dec(x_21);
  x_57 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_57, 0, x_55);
  lean_ctor_set(x_57, 1, x_56);
  return x_57;
  }
  }
  }
  else
  {
  uint8_t x_58; 
  lean_dec(x_16);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_58 = !lean_is_exclusive(x_18);
  if (x_58 == 0)
  {
  return x_18;
  }
  else
  {
  lean_object* x_59; lean_object* x_60; lean_object* x_61; 
  x_59 = lean_ctor_get(x_18, 0);
  x_60 = lean_ctor_get(x_18, 1);
  lean_inc(x_60);
  lean_inc(x_59);
  lean_dec(x_18);
  x_61 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_61, 0, x_59);
  lean_ctor_set(x_61, 1, x_60);
  return x_61;
  }
  }
  }
  else
  {
  uint8_t x_62; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_62 = !lean_is_exclusive(x_12);
  if (x_62 == 0)
  {
  return x_12;
  }
  else
  {
  lean_object* x_63; lean_object* x_64; lean_object* x_65; 
  x_63 = lean_ctor_get(x_12, 0);
  x_64 = lean_ctor_get(x_12, 1);
  lean_inc(x_64);
  lean_inc(x_63);
  lean_dec(x_12);
  x_65 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_65, 0, x_63);
  lean_ctor_set(x_65, 1, x_64);
  return x_65;
  }
  }
  }
  else
  {
  uint8_t x_66; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_66 = !lean_is_exclusive(x_10);
  if (x_66 == 0)
  {
  return x_10;
  }
  else
  {
  lean_object* x_67; lean_object* x_68; lean_object* x_69; 
  x_67 = lean_ctor_get(x_10, 0);
  x_68 = lean_ctor_get(x_10, 1);
  lean_inc(x_68);
  lean_inc(x_67);
  lean_dec(x_10);
  x_69 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_69, 0, x_67);
  lean_ctor_set(x_69, 1, x_68);
  return x_69;
  }
  }
  }
  }
  static lean_object* _init_l_Lean_Meta_replaceTargetEq___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("replaceTarget");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_replaceTargetEq___closed__2() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; lean_object* x_3; 
  x_1 = lean_box(0);
  x_2 = l_Lean_Meta_replaceTargetEq___closed__1;
  x_3 = lean_name_mk_string(x_1, x_2);
  return x_3;
  }
  }
  lean_object* l_Lean_Meta_replaceTargetEq(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, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; lean_object* x_10; lean_object* x_11; 
  x_9 = l_Lean_Meta_replaceTargetEq___closed__2;
  lean_inc(x_1);
  x_10 = lean_alloc_closure((void*)(l_Lean_Meta_replaceTargetEq___lambda__1), 9, 4);
  lean_closure_set(x_10, 0, x_1);
  lean_closure_set(x_10, 1, x_9);
  lean_closure_set(x_10, 2, x_2);
  lean_closure_set(x_10, 3, x_3);
  x_11 = l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(x_1, x_10, x_4, x_5, x_6, x_7, x_8);
  return x_11;
  }
  }
  lean_object* l_Lean_Meta_replaceTargetDefEq___lambda__1(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, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; 
  lean_inc(x_5);
  lean_inc(x_1);
  x_9 = l_Lean_Meta_checkNotAssigned(x_1, x_2, x_4, x_5, x_6, x_7, x_8);
  if (lean_obj_tag(x_9) == 0)
  {
  lean_object* x_10; lean_object* x_11; 
  x_10 = lean_ctor_get(x_9, 1);
  lean_inc(x_10);
  lean_dec(x_9);
  lean_inc(x_1);
  x_11 = l_Lean_Meta_getMVarType(x_1, x_4, x_5, x_6, x_7, x_10);
  if (lean_obj_tag(x_11) == 0)
  {
  uint8_t x_12; 
  x_12 = !lean_is_exclusive(x_11);
  if (x_12 == 0)
  {
  lean_object* x_13; lean_object* x_14; uint8_t x_15; 
  x_13 = lean_ctor_get(x_11, 0);
  x_14 = lean_ctor_get(x_11, 1);
  x_15 = lean_expr_eqv(x_13, x_3);
  if (x_15 == 0)
  {
  lean_object* x_16; 
  lean_free_object(x_11);
  lean_inc(x_1);
  x_16 = l_Lean_Meta_getMVarTag(x_1, x_4, x_5, x_6, x_7, x_14);
  if (lean_obj_tag(x_16) == 0)
  {
  lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; 
  x_17 = lean_ctor_get(x_16, 0);
  lean_inc(x_17);
  x_18 = lean_ctor_get(x_16, 1);
  lean_inc(x_18);
  lean_dec(x_16);
  lean_inc(x_4);
  x_19 = l_Lean_Meta_mkFreshExprSyntheticOpaqueMVar(x_3, x_17, x_4, x_5, x_6, x_7, x_18);
  x_20 = lean_ctor_get(x_19, 0);
  lean_inc(x_20);
  x_21 = lean_ctor_get(x_19, 1);
  lean_inc(x_21);
  lean_dec(x_19);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_4);
  lean_inc(x_20);
  x_22 = l_Lean_Meta_mkExpectedTypeHint(x_20, x_13, x_4, x_5, x_6, x_7, x_21);
  if (lean_obj_tag(x_22) == 0)
  {
  lean_object* x_23; lean_object* x_24; uint8_t x_25; 
  x_23 = lean_ctor_get(x_22, 1);
  lean_inc(x_23);
  lean_dec(x_22);
  lean_inc(x_20);
  x_24 = l_Lean_Meta_assignExprMVar(x_1, x_20, x_4, x_5, x_6, x_7, x_23);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  x_25 = !lean_is_exclusive(x_24);
  if (x_25 == 0)
  {
  lean_object* x_26; lean_object* x_27; 
  x_26 = lean_ctor_get(x_24, 0);
  lean_dec(x_26);
  x_27 = l_Lean_Expr_mvarId_x21(x_20);
  lean_dec(x_20);
  lean_ctor_set(x_24, 0, x_27);
  return x_24;
  }
  else
  {
  lean_object* x_28; lean_object* x_29; lean_object* x_30; 
  x_28 = lean_ctor_get(x_24, 1);
  lean_inc(x_28);
  lean_dec(x_24);
  x_29 = l_Lean_Expr_mvarId_x21(x_20);
  lean_dec(x_20);
  x_30 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_30, 0, x_29);
  lean_ctor_set(x_30, 1, x_28);
  return x_30;
  }
  }
  else
  {
  uint8_t x_31; 
  lean_dec(x_20);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_1);
  x_31 = !lean_is_exclusive(x_22);
  if (x_31 == 0)
  {
  return x_22;
  }
  else
  {
  lean_object* x_32; lean_object* x_33; lean_object* x_34; 
  x_32 = lean_ctor_get(x_22, 0);
  x_33 = lean_ctor_get(x_22, 1);
  lean_inc(x_33);
  lean_inc(x_32);
  lean_dec(x_22);
  x_34 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_34, 0, x_32);
  lean_ctor_set(x_34, 1, x_33);
  return x_34;
  }
  }
  }
  else
  {
  uint8_t x_35; 
  lean_dec(x_13);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_35 = !lean_is_exclusive(x_16);
  if (x_35 == 0)
  {
  return x_16;
  }
  else
  {
  lean_object* x_36; lean_object* x_37; lean_object* x_38; 
  x_36 = lean_ctor_get(x_16, 0);
  x_37 = lean_ctor_get(x_16, 1);
  lean_inc(x_37);
  lean_inc(x_36);
  lean_dec(x_16);
  x_38 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_38, 0, x_36);
  lean_ctor_set(x_38, 1, x_37);
  return x_38;
  }
  }
  }
  else
  {
  lean_dec(x_13);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_ctor_set(x_11, 0, x_1);
  return x_11;
  }
  }
  else
  {
  lean_object* x_39; lean_object* x_40; uint8_t x_41; 
  x_39 = lean_ctor_get(x_11, 0);
  x_40 = lean_ctor_get(x_11, 1);
  lean_inc(x_40);
  lean_inc(x_39);
  lean_dec(x_11);
  x_41 = lean_expr_eqv(x_39, x_3);
  if (x_41 == 0)
  {
  lean_object* x_42; 
  lean_inc(x_1);
  x_42 = l_Lean_Meta_getMVarTag(x_1, x_4, x_5, x_6, x_7, x_40);
  if (lean_obj_tag(x_42) == 0)
  {
  lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; 
  x_43 = lean_ctor_get(x_42, 0);
  lean_inc(x_43);
  x_44 = lean_ctor_get(x_42, 1);
  lean_inc(x_44);
  lean_dec(x_42);
  lean_inc(x_4);
  x_45 = l_Lean_Meta_mkFreshExprSyntheticOpaqueMVar(x_3, x_43, x_4, x_5, x_6, x_7, x_44);
  x_46 = lean_ctor_get(x_45, 0);
  lean_inc(x_46);
  x_47 = lean_ctor_get(x_45, 1);
  lean_inc(x_47);
  lean_dec(x_45);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_4);
  lean_inc(x_46);
  x_48 = l_Lean_Meta_mkExpectedTypeHint(x_46, x_39, x_4, x_5, x_6, x_7, x_47);
  if (lean_obj_tag(x_48) == 0)
  {
  lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; 
  x_49 = lean_ctor_get(x_48, 1);
  lean_inc(x_49);
  lean_dec(x_48);
  lean_inc(x_46);
  x_50 = l_Lean_Meta_assignExprMVar(x_1, x_46, x_4, x_5, x_6, x_7, x_49);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  x_51 = lean_ctor_get(x_50, 1);
  lean_inc(x_51);
  if (lean_is_exclusive(x_50)) {
   lean_ctor_release(x_50, 0);
   lean_ctor_release(x_50, 1);
   x_52 = x_50;
  } else {
   lean_dec_ref(x_50);
   x_52 = lean_box(0);
  }
  x_53 = l_Lean_Expr_mvarId_x21(x_46);
  lean_dec(x_46);
  if (lean_is_scalar(x_52)) {
   x_54 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_54 = x_52;
  }
  lean_ctor_set(x_54, 0, x_53);
  lean_ctor_set(x_54, 1, x_51);
  return x_54;
  }
  else
  {
  lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; 
  lean_dec(x_46);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_1);
  x_55 = lean_ctor_get(x_48, 0);
  lean_inc(x_55);
  x_56 = lean_ctor_get(x_48, 1);
  lean_inc(x_56);
  if (lean_is_exclusive(x_48)) {
   lean_ctor_release(x_48, 0);
   lean_ctor_release(x_48, 1);
   x_57 = x_48;
  } else {
   lean_dec_ref(x_48);
   x_57 = lean_box(0);
  }
  if (lean_is_scalar(x_57)) {
   x_58 = lean_alloc_ctor(1, 2, 0);
  } else {
   x_58 = x_57;
  }
  lean_ctor_set(x_58, 0, x_55);
  lean_ctor_set(x_58, 1, x_56);
  return x_58;
  }
  }
  else
  {
  lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; 
  lean_dec(x_39);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_59 = lean_ctor_get(x_42, 0);
  lean_inc(x_59);
  x_60 = lean_ctor_get(x_42, 1);
  lean_inc(x_60);
  if (lean_is_exclusive(x_42)) {
   lean_ctor_release(x_42, 0);
   lean_ctor_release(x_42, 1);
   x_61 = x_42;
  } else {
   lean_dec_ref(x_42);
   x_61 = lean_box(0);
  }
  if (lean_is_scalar(x_61)) {
   x_62 = lean_alloc_ctor(1, 2, 0);
  } else {
   x_62 = x_61;
  }
  lean_ctor_set(x_62, 0, x_59);
  lean_ctor_set(x_62, 1, x_60);
  return x_62;
  }
  }
  else
  {
  lean_object* x_63; 
  lean_dec(x_39);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  x_63 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_63, 0, x_1);
  lean_ctor_set(x_63, 1, x_40);
  return x_63;
  }
  }
  }
  else
  {
  uint8_t x_64; 
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_64 = !lean_is_exclusive(x_11);
  if (x_64 == 0)
  {
  return x_11;
  }
  else
  {
  lean_object* x_65; lean_object* x_66; lean_object* x_67; 
  x_65 = lean_ctor_get(x_11, 0);
  x_66 = lean_ctor_get(x_11, 1);
  lean_inc(x_66);
  lean_inc(x_65);
  lean_dec(x_11);
  x_67 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_67, 0, x_65);
  lean_ctor_set(x_67, 1, x_66);
  return x_67;
  }
  }
  }
  else
  {
  uint8_t x_68; 
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_68 = !lean_is_exclusive(x_9);
  if (x_68 == 0)
  {
  return x_9;
  }
  else
  {
  lean_object* x_69; lean_object* x_70; lean_object* x_71; 
  x_69 = lean_ctor_get(x_9, 0);
  x_70 = lean_ctor_get(x_9, 1);
  lean_inc(x_70);
  lean_inc(x_69);
  lean_dec(x_9);
  x_71 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_71, 0, x_69);
  lean_ctor_set(x_71, 1, x_70);
  return x_71;
  }
  }
  }
  }
  static lean_object* _init_l_Lean_Meta_replaceTargetDefEq___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("change");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_replaceTargetDefEq___closed__2() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; lean_object* x_3; 
  x_1 = lean_box(0);
  x_2 = l_Lean_Meta_replaceTargetDefEq___closed__1;
  x_3 = lean_name_mk_string(x_1, x_2);
  return x_3;
  }
  }
  lean_object* l_Lean_Meta_replaceTargetDefEq(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; 
  x_8 = l_Lean_Meta_replaceTargetDefEq___closed__2;
  lean_inc(x_1);
  x_9 = lean_alloc_closure((void*)(l_Lean_Meta_replaceTargetDefEq___lambda__1), 8, 3);
  lean_closure_set(x_9, 0, x_1);
  lean_closure_set(x_9, 1, x_8);
  lean_closure_set(x_9, 2, x_2);
  x_10 = l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(x_1, x_9, x_3, x_4, x_5, x_6, x_7);
  return x_10;
  }
  }
  lean_object* l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(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, lean_object* x_8) {
  _start:
  {
  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; 
  x_9 = lean_st_ref_get(x_7, x_8);
  x_10 = lean_ctor_get(x_9, 1);
  lean_inc(x_10);
  lean_dec(x_9);
  x_11 = lean_st_ref_get(x_2, x_10);
  x_12 = lean_ctor_get(x_11, 0);
  lean_inc(x_12);
  x_13 = lean_ctor_get(x_11, 1);
  lean_inc(x_13);
  if (lean_is_exclusive(x_11)) {
   lean_ctor_release(x_11, 0);
   lean_ctor_release(x_11, 1);
   x_14 = x_11;
  } else {
   lean_dec_ref(x_11);
   x_14 = lean_box(0);
  }
  lean_inc(x_1);
  x_15 = l_Std_HashMapImp_find_x3f___at_Lean_Meta_ToHide_visitVisibleExpr_visit___spec__1(x_12, x_1);
  if (lean_obj_tag(x_15) == 0)
  {
  lean_object* x_16; uint8_t x_37; lean_object* x_38; uint8_t x_91; 
  x_91 = l_Lean_Expr_isFVar(x_1);
  if (x_91 == 0)
  {
  uint8_t x_92; 
  x_92 = l_Lean_Expr_hasFVar(x_1);
  x_37 = x_92;
  x_38 = x_13;
  goto block_90;
  }
  else
  {
  lean_object* x_93; lean_object* x_94; 
  x_93 = l_Lean_Expr_fvarId_x21(x_1);
  lean_inc(x_4);
  x_94 = l_Lean_Meta_getLocalDecl(x_93, x_4, x_5, x_6, x_7, x_13);
  if (lean_obj_tag(x_94) == 0)
  {
  lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100; lean_object* x_101; lean_object* x_102; lean_object* x_103; uint8_t x_104; 
  x_95 = lean_ctor_get(x_94, 0);
  lean_inc(x_95);
  x_96 = lean_ctor_get(x_94, 1);
  lean_inc(x_96);
  lean_dec(x_94);
  x_97 = lean_st_ref_get(x_7, x_96);
  x_98 = lean_ctor_get(x_97, 1);
  lean_inc(x_98);
  lean_dec(x_97);
  x_99 = lean_st_ref_take(x_3, x_98);
  x_100 = lean_ctor_get(x_99, 0);
  lean_inc(x_100);
  x_101 = lean_ctor_get(x_99, 1);
  lean_inc(x_101);
  lean_dec(x_99);
  x_102 = l_Lean_LocalDecl_index(x_100);
  x_103 = l_Lean_LocalDecl_index(x_95);
  x_104 = lean_nat_dec_lt(x_102, x_103);
  lean_dec(x_103);
  lean_dec(x_102);
  if (x_104 == 0)
  {
  lean_object* x_105; lean_object* x_106; uint8_t x_107; 
  lean_dec(x_95);
  x_105 = lean_st_ref_set(x_3, x_100, x_101);
  x_106 = lean_ctor_get(x_105, 1);
  lean_inc(x_106);
  lean_dec(x_105);
  x_107 = 0;
  x_37 = x_107;
  x_38 = x_106;
  goto block_90;
  }
  else
  {
  lean_object* x_108; lean_object* x_109; uint8_t x_110; 
  lean_dec(x_100);
  x_108 = lean_st_ref_set(x_3, x_95, x_101);
  x_109 = lean_ctor_get(x_108, 1);
  lean_inc(x_109);
  lean_dec(x_108);
  x_110 = 0;
  x_37 = x_110;
  x_38 = x_109;
  goto block_90;
  }
  }
  else
  {
  uint8_t x_111; 
  lean_dec(x_14);
  lean_dec(x_4);
  x_111 = !lean_is_exclusive(x_94);
  if (x_111 == 0)
  {
  x_16 = x_94;
  goto block_36;
  }
  else
  {
  lean_object* x_112; lean_object* x_113; lean_object* x_114; 
  x_112 = lean_ctor_get(x_94, 0);
  x_113 = lean_ctor_get(x_94, 1);
  lean_inc(x_113);
  lean_inc(x_112);
  lean_dec(x_94);
  x_114 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_114, 0, x_112);
  lean_ctor_set(x_114, 1, x_113);
  x_16 = x_114;
  goto block_36;
  }
  }
  }
  block_36:
  {
  if (lean_obj_tag(x_16) == 0)
  {
  lean_object* x_17; lean_object* x_18; lean_object* x_19; 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; uint8_t x_28; 
  x_17 = lean_ctor_get(x_16, 0);
  lean_inc(x_17);
  x_18 = lean_ctor_get(x_16, 1);
  lean_inc(x_18);
  lean_dec(x_16);
  x_19 = lean_st_ref_get(x_7, x_18);
  x_20 = lean_ctor_get(x_19, 1);
  lean_inc(x_20);
  lean_dec(x_19);
  x_21 = lean_st_ref_take(x_2, x_20);
  x_22 = lean_ctor_get(x_21, 0);
  lean_inc(x_22);
  x_23 = lean_ctor_get(x_21, 1);
  lean_inc(x_23);
  lean_dec(x_21);
  x_24 = l_Lean_Expr_instBEqExpr;
  x_25 = l_Lean_Expr_instHashableExpr;
  lean_inc(x_17);
  x_26 = l_Std_HashMap_insert___rarg(x_24, x_25, x_22, x_1, x_17);
  x_27 = lean_st_ref_set(x_2, x_26, x_23);
  x_28 = !lean_is_exclusive(x_27);
  if (x_28 == 0)
  {
  lean_object* x_29; 
  x_29 = lean_ctor_get(x_27, 0);
  lean_dec(x_29);
  lean_ctor_set(x_27, 0, x_17);
  return x_27;
  }
  else
  {
  lean_object* x_30; lean_object* x_31; 
  x_30 = lean_ctor_get(x_27, 1);
  lean_inc(x_30);
  lean_dec(x_27);
  x_31 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_31, 0, x_17);
  lean_ctor_set(x_31, 1, x_30);
  return x_31;
  }
  }
  else
  {
  uint8_t x_32; 
  lean_dec(x_1);
  x_32 = !lean_is_exclusive(x_16);
  if (x_32 == 0)
  {
  return x_16;
  }
  else
  {
  lean_object* x_33; lean_object* x_34; lean_object* x_35; 
  x_33 = lean_ctor_get(x_16, 0);
  x_34 = lean_ctor_get(x_16, 1);
  lean_inc(x_34);
  lean_inc(x_33);
  lean_dec(x_16);
  x_35 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_35, 0, x_33);
  lean_ctor_set(x_35, 1, x_34);
  return x_35;
  }
  }
  }
  block_90:
  {
  if (x_37 == 0)
  {
  lean_object* x_39; lean_object* x_40; 
  lean_dec(x_4);
  x_39 = lean_box(0);
  if (lean_is_scalar(x_14)) {
   x_40 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_40 = x_14;
  }
  lean_ctor_set(x_40, 0, x_39);
  lean_ctor_set(x_40, 1, x_38);
  x_16 = x_40;
  goto block_36;
  }
  else
  {
  switch (lean_obj_tag(x_1)) {
  case 5:
  {
  lean_object* x_41; lean_object* x_42; lean_object* x_43; 
  lean_dec(x_14);
  x_41 = lean_ctor_get(x_1, 0);
  lean_inc(x_41);
  x_42 = lean_ctor_get(x_1, 1);
  lean_inc(x_42);
  lean_inc(x_4);
  x_43 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_41, x_2, x_3, x_4, x_5, x_6, x_7, x_38);
  if (lean_obj_tag(x_43) == 0)
  {
  lean_object* x_44; lean_object* x_45; 
  x_44 = lean_ctor_get(x_43, 1);
  lean_inc(x_44);
  lean_dec(x_43);
  x_45 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_42, x_2, x_3, x_4, x_5, x_6, x_7, x_44);
  x_16 = x_45;
  goto block_36;
  }
  else
  {
  uint8_t x_46; 
  lean_dec(x_42);
  lean_dec(x_4);
  x_46 = !lean_is_exclusive(x_43);
  if (x_46 == 0)
  {
  x_16 = x_43;
  goto block_36;
  }
  else
  {
  lean_object* x_47; lean_object* x_48; lean_object* x_49; 
  x_47 = lean_ctor_get(x_43, 0);
  x_48 = lean_ctor_get(x_43, 1);
  lean_inc(x_48);
  lean_inc(x_47);
  lean_dec(x_43);
  x_49 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_49, 0, x_47);
  lean_ctor_set(x_49, 1, x_48);
  x_16 = x_49;
  goto block_36;
  }
  }
  }
  case 6:
  {
  lean_object* x_50; lean_object* x_51; lean_object* x_52; 
  lean_dec(x_14);
  x_50 = lean_ctor_get(x_1, 1);
  lean_inc(x_50);
  x_51 = lean_ctor_get(x_1, 2);
  lean_inc(x_51);
  lean_inc(x_4);
  x_52 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_50, x_2, x_3, x_4, x_5, x_6, x_7, x_38);
  if (lean_obj_tag(x_52) == 0)
  {
  lean_object* x_53; lean_object* x_54; 
  x_53 = lean_ctor_get(x_52, 1);
  lean_inc(x_53);
  lean_dec(x_52);
  x_54 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_51, x_2, x_3, x_4, x_5, x_6, x_7, x_53);
  x_16 = x_54;
  goto block_36;
  }
  else
  {
  uint8_t x_55; 
  lean_dec(x_51);
  lean_dec(x_4);
  x_55 = !lean_is_exclusive(x_52);
  if (x_55 == 0)
  {
  x_16 = x_52;
  goto block_36;
  }
  else
  {
  lean_object* x_56; lean_object* x_57; lean_object* x_58; 
  x_56 = lean_ctor_get(x_52, 0);
  x_57 = lean_ctor_get(x_52, 1);
  lean_inc(x_57);
  lean_inc(x_56);
  lean_dec(x_52);
  x_58 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_58, 0, x_56);
  lean_ctor_set(x_58, 1, x_57);
  x_16 = x_58;
  goto block_36;
  }
  }
  }
  case 7:
  {
  lean_object* x_59; lean_object* x_60; lean_object* x_61; 
  lean_dec(x_14);
  x_59 = lean_ctor_get(x_1, 1);
  lean_inc(x_59);
  x_60 = lean_ctor_get(x_1, 2);
  lean_inc(x_60);
  lean_inc(x_4);
  x_61 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_59, x_2, x_3, x_4, x_5, x_6, x_7, x_38);
  if (lean_obj_tag(x_61) == 0)
  {
  lean_object* x_62; lean_object* x_63; 
  x_62 = lean_ctor_get(x_61, 1);
  lean_inc(x_62);
  lean_dec(x_61);
  x_63 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_60, x_2, x_3, x_4, x_5, x_6, x_7, x_62);
  x_16 = x_63;
  goto block_36;
  }
  else
  {
  uint8_t x_64; 
  lean_dec(x_60);
  lean_dec(x_4);
  x_64 = !lean_is_exclusive(x_61);
  if (x_64 == 0)
  {
  x_16 = x_61;
  goto block_36;
  }
  else
  {
  lean_object* x_65; lean_object* x_66; lean_object* x_67; 
  x_65 = lean_ctor_get(x_61, 0);
  x_66 = lean_ctor_get(x_61, 1);
  lean_inc(x_66);
  lean_inc(x_65);
  lean_dec(x_61);
  x_67 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_67, 0, x_65);
  lean_ctor_set(x_67, 1, x_66);
  x_16 = x_67;
  goto block_36;
  }
  }
  }
  case 8:
  {
  lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; 
  lean_dec(x_14);
  x_68 = lean_ctor_get(x_1, 1);
  lean_inc(x_68);
  x_69 = lean_ctor_get(x_1, 2);
  lean_inc(x_69);
  x_70 = lean_ctor_get(x_1, 3);
  lean_inc(x_70);
  lean_inc(x_4);
  x_71 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_68, x_2, x_3, x_4, x_5, x_6, x_7, x_38);
  if (lean_obj_tag(x_71) == 0)
  {
  lean_object* x_72; lean_object* x_73; 
  x_72 = lean_ctor_get(x_71, 1);
  lean_inc(x_72);
  lean_dec(x_71);
  lean_inc(x_4);
  x_73 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_69, x_2, x_3, x_4, x_5, x_6, x_7, x_72);
  if (lean_obj_tag(x_73) == 0)
  {
  lean_object* x_74; lean_object* x_75; 
  x_74 = lean_ctor_get(x_73, 1);
  lean_inc(x_74);
  lean_dec(x_73);
  x_75 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_70, x_2, x_3, x_4, x_5, x_6, x_7, x_74);
  x_16 = x_75;
  goto block_36;
  }
  else
  {
  uint8_t x_76; 
  lean_dec(x_70);
  lean_dec(x_4);
  x_76 = !lean_is_exclusive(x_73);
  if (x_76 == 0)
  {
  x_16 = x_73;
  goto block_36;
  }
  else
  {
  lean_object* x_77; lean_object* x_78; lean_object* x_79; 
  x_77 = lean_ctor_get(x_73, 0);
  x_78 = lean_ctor_get(x_73, 1);
  lean_inc(x_78);
  lean_inc(x_77);
  lean_dec(x_73);
  x_79 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_79, 0, x_77);
  lean_ctor_set(x_79, 1, x_78);
  x_16 = x_79;
  goto block_36;
  }
  }
  }
  else
  {
  uint8_t x_80; 
  lean_dec(x_70);
  lean_dec(x_69);
  lean_dec(x_4);
  x_80 = !lean_is_exclusive(x_71);
  if (x_80 == 0)
  {
  x_16 = x_71;
  goto block_36;
  }
  else
  {
  lean_object* x_81; lean_object* x_82; lean_object* x_83; 
  x_81 = lean_ctor_get(x_71, 0);
  x_82 = lean_ctor_get(x_71, 1);
  lean_inc(x_82);
  lean_inc(x_81);
  lean_dec(x_71);
  x_83 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_83, 0, x_81);
  lean_ctor_set(x_83, 1, x_82);
  x_16 = x_83;
  goto block_36;
  }
  }
  }
  case 10:
  {
  lean_object* x_84; lean_object* x_85; 
  lean_dec(x_14);
  x_84 = lean_ctor_get(x_1, 1);
  lean_inc(x_84);
  x_85 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_84, x_2, x_3, x_4, x_5, x_6, x_7, x_38);
  x_16 = x_85;
  goto block_36;
  }
  case 11:
  {
  lean_object* x_86; lean_object* x_87; 
  lean_dec(x_14);
  x_86 = lean_ctor_get(x_1, 2);
  lean_inc(x_86);
  x_87 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_86, x_2, x_3, x_4, x_5, x_6, x_7, x_38);
  x_16 = x_87;
  goto block_36;
  }
  default: 
  {
  lean_object* x_88; lean_object* x_89; 
  lean_dec(x_4);
  x_88 = lean_box(0);
  if (lean_is_scalar(x_14)) {
   x_89 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_89 = x_14;
  }
  lean_ctor_set(x_89, 0, x_88);
  lean_ctor_set(x_89, 1, x_38);
  x_16 = x_89;
  goto block_36;
  }
  }
  }
  }
  }
  else
  {
  lean_object* x_115; lean_object* x_116; 
  lean_dec(x_4);
  lean_dec(x_1);
  x_115 = lean_ctor_get(x_15, 0);
  lean_inc(x_115);
  lean_dec(x_15);
  if (lean_is_scalar(x_14)) {
   x_116 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_116 = x_14;
  }
  lean_ctor_set(x_116, 0, x_115);
  lean_ctor_set(x_116, 1, x_13);
  return x_116;
  }
  }
  }
  static lean_object* _init_l_Lean_Meta_replaceLocalDecl_findMaxFVar___closed__1() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; 
  x_1 = lean_unsigned_to_nat(0u);
  x_2 = l_Std_mkHashMapImp___rarg(x_1);
  return x_2;
  }
  }
  lean_object* l_Lean_Meta_replaceLocalDecl_findMaxFVar(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; lean_object* x_14; 
  x_8 = lean_st_ref_get(x_6, x_7);
  x_9 = lean_ctor_get(x_8, 1);
  lean_inc(x_9);
  lean_dec(x_8);
  x_10 = l_Lean_Meta_replaceLocalDecl_findMaxFVar___closed__1;
  x_11 = lean_st_mk_ref(x_10, x_9);
  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 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_1, x_12, x_2, x_3, x_4, x_5, x_6, x_13);
  if (lean_obj_tag(x_14) == 0)
  {
  lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; uint8_t x_20; 
  x_15 = lean_ctor_get(x_14, 0);
  lean_inc(x_15);
  x_16 = lean_ctor_get(x_14, 1);
  lean_inc(x_16);
  lean_dec(x_14);
  x_17 = lean_st_ref_get(x_6, x_16);
  x_18 = lean_ctor_get(x_17, 1);
  lean_inc(x_18);
  lean_dec(x_17);
  x_19 = lean_st_ref_get(x_12, x_18);
  lean_dec(x_12);
  x_20 = !lean_is_exclusive(x_19);
  if (x_20 == 0)
  {
  lean_object* x_21; 
  x_21 = lean_ctor_get(x_19, 0);
  lean_dec(x_21);
  lean_ctor_set(x_19, 0, x_15);
  return x_19;
  }
  else
  {
  lean_object* x_22; lean_object* x_23; 
  x_22 = lean_ctor_get(x_19, 1);
  lean_inc(x_22);
  lean_dec(x_19);
  x_23 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_23, 0, x_15);
  lean_ctor_set(x_23, 1, x_22);
  return x_23;
  }
  }
  else
  {
  uint8_t x_24; 
  lean_dec(x_12);
  x_24 = !lean_is_exclusive(x_14);
  if (x_24 == 0)
  {
  return x_14;
  }
  else
  {
  lean_object* x_25; lean_object* x_26; lean_object* x_27; 
  x_25 = lean_ctor_get(x_14, 0);
  x_26 = lean_ctor_get(x_14, 1);
  lean_inc(x_26);
  lean_inc(x_25);
  lean_dec(x_14);
  x_27 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_27, 0, x_25);
  lean_ctor_set(x_27, 1, x_26);
  return x_27;
  }
  }
  }
  }
  lean_object* l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1___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, lean_object* x_7, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; 
  x_9 = l_Lean_ForEachExpr_visit___at_Lean_Meta_replaceLocalDecl_findMaxFVar___spec__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_3);
  lean_dec(x_2);
  return x_9;
  }
  }
  lean_object* l_Lean_Meta_replaceLocalDecl_findMaxFVar___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, lean_object* x_7) {
  _start:
  {
  lean_object* x_8; 
  x_8 = l_Lean_Meta_replaceLocalDecl_findMaxFVar(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_2);
  return x_8;
  }
  }
  lean_object* l_Lean_Meta_replaceLocalDecl___lambda__1(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, lean_object* x_8, lean_object* x_9) {
  _start:
  {
  lean_object* x_10; 
  lean_inc(x_5);
  lean_inc(x_1);
  x_10 = l_Lean_Meta_getLocalDecl(x_1, x_5, x_6, x_7, x_8, x_9);
  if (lean_obj_tag(x_10) == 0)
  {
  lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; 
  x_11 = lean_ctor_get(x_10, 0);
  lean_inc(x_11);
  x_12 = lean_ctor_get(x_10, 1);
  lean_inc(x_12);
  lean_dec(x_10);
  lean_inc(x_1);
  x_13 = l_Lean_mkFVar(x_1);
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  x_14 = l_Lean_Meta_mkEqMP(x_2, x_13, x_5, x_6, x_7, x_8, x_12);
  if (lean_obj_tag(x_14) == 0)
  {
  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; lean_object* x_22; 
  x_15 = lean_ctor_get(x_14, 0);
  lean_inc(x_15);
  x_16 = lean_ctor_get(x_14, 1);
  lean_inc(x_16);
  lean_dec(x_14);
  x_17 = lean_st_ref_get(x_8, x_16);
  x_18 = lean_ctor_get(x_17, 1);
  lean_inc(x_18);
  lean_dec(x_17);
  lean_inc(x_11);
  x_19 = lean_st_mk_ref(x_11, x_18);
  x_20 = lean_ctor_get(x_19, 0);
  lean_inc(x_20);
  x_21 = lean_ctor_get(x_19, 1);
  lean_inc(x_21);
  lean_dec(x_19);
  lean_inc(x_5);
  lean_inc(x_3);
  x_22 = l_Lean_Meta_replaceLocalDecl_findMaxFVar(x_3, x_20, x_5, x_6, x_7, x_8, x_21);
  if (lean_obj_tag(x_22) == 0)
  {
  lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; 
  x_23 = lean_ctor_get(x_22, 1);
  lean_inc(x_23);
  lean_dec(x_22);
  x_24 = lean_st_ref_get(x_8, x_23);
  x_25 = lean_ctor_get(x_24, 1);
  lean_inc(x_25);
  lean_dec(x_24);
  x_26 = lean_st_ref_get(x_20, x_25);
  lean_dec(x_20);
  x_27 = lean_ctor_get(x_26, 0);
  lean_inc(x_27);
  x_28 = lean_ctor_get(x_26, 1);
  lean_inc(x_28);
  lean_dec(x_26);
  x_29 = l_Lean_LocalDecl_fvarId(x_27);
  lean_dec(x_27);
  x_30 = l_Lean_LocalDecl_userName(x_11);
  lean_dec(x_11);
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  x_31 = l_Lean_Meta_assertAfter(x_4, x_29, x_30, x_3, x_15, x_5, x_6, x_7, x_8, x_28);
  if (lean_obj_tag(x_31) == 0)
  {
  lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; 
  x_32 = lean_ctor_get(x_31, 0);
  lean_inc(x_32);
  x_33 = lean_ctor_get(x_31, 1);
  lean_inc(x_33);
  lean_dec(x_31);
  x_34 = lean_ctor_get(x_32, 0);
  lean_inc(x_34);
  x_35 = lean_ctor_get(x_32, 1);
  lean_inc(x_35);
  x_36 = lean_ctor_get(x_32, 2);
  lean_inc(x_36);
  x_37 = l_Lean_Meta_saveState___rarg(x_6, x_7, x_8, x_33);
  x_38 = lean_ctor_get(x_37, 0);
  lean_inc(x_38);
  x_39 = lean_ctor_get(x_37, 1);
  lean_inc(x_39);
  lean_dec(x_37);
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  x_40 = l_Lean_Meta_clear(x_35, x_1, x_5, x_6, x_7, x_8, x_39);
  if (lean_obj_tag(x_40) == 0)
  {
  uint8_t x_41; 
  lean_dec(x_38);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  x_41 = !lean_is_exclusive(x_32);
  if (x_41 == 0)
  {
  lean_object* x_42; lean_object* x_43; lean_object* x_44; uint8_t x_45; 
  x_42 = lean_ctor_get(x_32, 2);
  lean_dec(x_42);
  x_43 = lean_ctor_get(x_32, 1);
  lean_dec(x_43);
  x_44 = lean_ctor_get(x_32, 0);
  lean_dec(x_44);
  x_45 = !lean_is_exclusive(x_40);
  if (x_45 == 0)
  {
  lean_object* x_46; 
  x_46 = lean_ctor_get(x_40, 0);
  lean_ctor_set(x_32, 1, x_46);
  lean_ctor_set(x_40, 0, x_32);
  return x_40;
  }
  else
  {
  lean_object* x_47; lean_object* x_48; lean_object* x_49; 
  x_47 = lean_ctor_get(x_40, 0);
  x_48 = lean_ctor_get(x_40, 1);
  lean_inc(x_48);
  lean_inc(x_47);
  lean_dec(x_40);
  lean_ctor_set(x_32, 1, x_47);
  x_49 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_49, 0, x_32);
  lean_ctor_set(x_49, 1, x_48);
  return x_49;
  }
  }
  else
  {
  lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; 
  lean_dec(x_32);
  x_50 = lean_ctor_get(x_40, 0);
  lean_inc(x_50);
  x_51 = lean_ctor_get(x_40, 1);
  lean_inc(x_51);
  if (lean_is_exclusive(x_40)) {
   lean_ctor_release(x_40, 0);
   lean_ctor_release(x_40, 1);
   x_52 = x_40;
  } else {
   lean_dec_ref(x_40);
   x_52 = lean_box(0);
  }
  x_53 = lean_alloc_ctor(0, 3, 0);
  lean_ctor_set(x_53, 0, x_34);
  lean_ctor_set(x_53, 1, x_50);
  lean_ctor_set(x_53, 2, x_36);
  if (lean_is_scalar(x_52)) {
   x_54 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_54 = x_52;
  }
  lean_ctor_set(x_54, 0, x_53);
  lean_ctor_set(x_54, 1, x_51);
  return x_54;
  }
  }
  else
  {
  lean_object* x_55; lean_object* x_56; uint8_t x_57; 
  lean_dec(x_36);
  lean_dec(x_34);
  x_55 = lean_ctor_get(x_40, 1);
  lean_inc(x_55);
  lean_dec(x_40);
  x_56 = l_Lean_Meta_SavedState_restore(x_38, x_5, x_6, x_7, x_8, x_55);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_38);
  x_57 = !lean_is_exclusive(x_56);
  if (x_57 == 0)
  {
  lean_object* x_58; 
  x_58 = lean_ctor_get(x_56, 0);
  lean_dec(x_58);
  lean_ctor_set(x_56, 0, x_32);
  return x_56;
  }
  else
  {
  lean_object* x_59; lean_object* x_60; 
  x_59 = lean_ctor_get(x_56, 1);
  lean_inc(x_59);
  lean_dec(x_56);
  x_60 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_60, 0, x_32);
  lean_ctor_set(x_60, 1, x_59);
  return x_60;
  }
  }
  }
  else
  {
  uint8_t x_61; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_1);
  x_61 = !lean_is_exclusive(x_31);
  if (x_61 == 0)
  {
  return x_31;
  }
  else
  {
  lean_object* x_62; lean_object* x_63; lean_object* x_64; 
  x_62 = lean_ctor_get(x_31, 0);
  x_63 = lean_ctor_get(x_31, 1);
  lean_inc(x_63);
  lean_inc(x_62);
  lean_dec(x_31);
  x_64 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_64, 0, x_62);
  lean_ctor_set(x_64, 1, x_63);
  return x_64;
  }
  }
  }
  else
  {
  uint8_t x_65; 
  lean_dec(x_20);
  lean_dec(x_15);
  lean_dec(x_11);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_65 = !lean_is_exclusive(x_22);
  if (x_65 == 0)
  {
  return x_22;
  }
  else
  {
  lean_object* x_66; lean_object* x_67; lean_object* x_68; 
  x_66 = lean_ctor_get(x_22, 0);
  x_67 = lean_ctor_get(x_22, 1);
  lean_inc(x_67);
  lean_inc(x_66);
  lean_dec(x_22);
  x_68 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_68, 0, x_66);
  lean_ctor_set(x_68, 1, x_67);
  return x_68;
  }
  }
  }
  else
  {
  uint8_t x_69; 
  lean_dec(x_11);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_69 = !lean_is_exclusive(x_14);
  if (x_69 == 0)
  {
  return x_14;
  }
  else
  {
  lean_object* x_70; lean_object* x_71; lean_object* x_72; 
  x_70 = lean_ctor_get(x_14, 0);
  x_71 = lean_ctor_get(x_14, 1);
  lean_inc(x_71);
  lean_inc(x_70);
  lean_dec(x_14);
  x_72 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_72, 0, x_70);
  lean_ctor_set(x_72, 1, x_71);
  return x_72;
  }
  }
  }
  else
  {
  uint8_t x_73; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_2);
  lean_dec(x_1);
  x_73 = !lean_is_exclusive(x_10);
  if (x_73 == 0)
  {
  return x_10;
  }
  else
  {
  lean_object* x_74; lean_object* x_75; lean_object* x_76; 
  x_74 = lean_ctor_get(x_10, 0);
  x_75 = lean_ctor_get(x_10, 1);
  lean_inc(x_75);
  lean_inc(x_74);
  lean_dec(x_10);
  x_76 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_76, 0, x_74);
  lean_ctor_set(x_76, 1, x_75);
  return x_76;
  }
  }
  }
  }
  lean_object* l_Lean_Meta_replaceLocalDecl(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, lean_object* x_8, lean_object* x_9) {
  _start:
  {
  lean_object* x_10; lean_object* x_11; 
  lean_inc(x_1);
  x_10 = lean_alloc_closure((void*)(l_Lean_Meta_replaceLocalDecl___lambda__1), 9, 4);
  lean_closure_set(x_10, 0, x_2);
  lean_closure_set(x_10, 1, x_4);
  lean_closure_set(x_10, 2, x_3);
  lean_closure_set(x_10, 3, x_1);
  x_11 = l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(x_1, x_10, x_5, x_6, x_7, x_8, x_9);
  return x_11;
  }
  }
  lean_object* l_Lean_Meta_replaceLocalDeclDefEq___lambda__1(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, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; 
  lean_inc(x_1);
  x_9 = l_Lean_Meta_getMVarDecl(x_1, x_4, x_5, x_6, x_7, x_8);
  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; lean_object* x_12; lean_object* x_13; uint8_t x_14; 
  x_11 = lean_ctor_get(x_9, 0);
  x_12 = lean_ctor_get(x_9, 1);
  x_13 = lean_ctor_get(x_11, 2);
  lean_inc(x_13);
  x_14 = lean_expr_eqv(x_2, x_13);
  if (x_14 == 0)
  {
  lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; 
  lean_free_object(x_9);
  x_15 = lean_ctor_get(x_4, 1);
  lean_inc(x_15);
  x_16 = l_Lean_Meta_getLocalInstances(x_4, x_5, x_6, x_7, x_12);
  x_17 = lean_ctor_get(x_15, 0);
  lean_inc(x_17);
  x_18 = lean_ctor_get(x_15, 1);
  lean_inc(x_18);
  lean_inc(x_15);
  x_19 = lean_local_ctx_find(x_15, x_3);
  if (lean_obj_tag(x_19) == 0)
  {
  lean_object* x_20; lean_object* x_21; uint8_t 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; uint8_t x_29; 
  lean_dec(x_18);
  lean_dec(x_17);
  lean_dec(x_2);
  x_20 = lean_ctor_get(x_16, 0);
  lean_inc(x_20);
  x_21 = lean_ctor_get(x_16, 1);
  lean_inc(x_21);
  lean_dec(x_16);
  x_22 = lean_ctor_get_uint8(x_11, sizeof(void*)*7);
  x_23 = lean_ctor_get(x_11, 0);
  lean_inc(x_23);
  lean_dec(x_11);
  x_24 = lean_unsigned_to_nat(0u);
  x_25 = l_Lean_Meta_mkFreshExprMVarAt(x_15, x_20, x_13, x_22, x_23, x_24, x_4, x_5, x_6, x_7, x_21);
  x_26 = lean_ctor_get(x_25, 0);
  lean_inc(x_26);
  x_27 = lean_ctor_get(x_25, 1);
  lean_inc(x_27);
  lean_dec(x_25);
  lean_inc(x_26);
  x_28 = l_Lean_Meta_assignExprMVar(x_1, x_26, x_4, x_5, x_6, x_7, x_27);
  lean_dec(x_4);
  x_29 = !lean_is_exclusive(x_28);
  if (x_29 == 0)
  {
  lean_object* x_30; lean_object* x_31; 
  x_30 = lean_ctor_get(x_28, 0);
  lean_dec(x_30);
  x_31 = l_Lean_Expr_mvarId_x21(x_26);
  lean_dec(x_26);
  lean_ctor_set(x_28, 0, x_31);
  return x_28;
  }
  else
  {
  lean_object* x_32; lean_object* x_33; lean_object* x_34; 
  x_32 = lean_ctor_get(x_28, 1);
  lean_inc(x_32);
  lean_dec(x_28);
  x_33 = l_Lean_Expr_mvarId_x21(x_26);
  lean_dec(x_26);
  x_34 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_34, 0, x_33);
  lean_ctor_set(x_34, 1, x_32);
  return x_34;
  }
  }
  else
  {
  uint8_t x_35; 
  x_35 = !lean_is_exclusive(x_15);
  if (x_35 == 0)
  {
  lean_object* x_36; lean_object* x_37; uint8_t x_38; 
  x_36 = lean_ctor_get(x_15, 1);
  lean_dec(x_36);
  x_37 = lean_ctor_get(x_15, 0);
  lean_dec(x_37);
  x_38 = !lean_is_exclusive(x_19);
  if (x_38 == 0)
  {
  lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; uint8_t x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; uint8_t x_56; 
  x_39 = lean_ctor_get(x_19, 0);
  x_40 = lean_ctor_get(x_16, 0);
  lean_inc(x_40);
  x_41 = lean_ctor_get(x_16, 1);
  lean_inc(x_41);
  lean_dec(x_16);
  x_42 = l_Lean_LocalDecl_setType(x_39, x_2);
  x_43 = l_Lean_LocalDecl_fvarId(x_42);
  x_44 = l_Lean_instBEqFVarId;
  x_45 = l_Lean_instHashableFVarId;
  lean_inc(x_42);
  x_46 = l_Std_PersistentHashMap_insert___rarg(x_44, x_45, x_17, x_43, x_42);
  x_47 = l_Lean_LocalDecl_index(x_42);
  lean_ctor_set(x_19, 0, x_42);
  x_48 = l_Std_PersistentArray_set___rarg(x_18, x_47, x_19);
  lean_dec(x_47);
  lean_ctor_set(x_15, 1, x_48);
  lean_ctor_set(x_15, 0, x_46);
  x_49 = lean_ctor_get_uint8(x_11, sizeof(void*)*7);
  x_50 = lean_ctor_get(x_11, 0);
  lean_inc(x_50);
  lean_dec(x_11);
  x_51 = lean_unsigned_to_nat(0u);
  x_52 = l_Lean_Meta_mkFreshExprMVarAt(x_15, x_40, x_13, x_49, x_50, x_51, x_4, x_5, x_6, x_7, x_41);
  x_53 = lean_ctor_get(x_52, 0);
  lean_inc(x_53);
  x_54 = lean_ctor_get(x_52, 1);
  lean_inc(x_54);
  lean_dec(x_52);
  lean_inc(x_53);
  x_55 = l_Lean_Meta_assignExprMVar(x_1, x_53, x_4, x_5, x_6, x_7, x_54);
  lean_dec(x_4);
  x_56 = !lean_is_exclusive(x_55);
  if (x_56 == 0)
  {
  lean_object* x_57; lean_object* x_58; 
  x_57 = lean_ctor_get(x_55, 0);
  lean_dec(x_57);
  x_58 = l_Lean_Expr_mvarId_x21(x_53);
  lean_dec(x_53);
  lean_ctor_set(x_55, 0, x_58);
  return x_55;
  }
  else
  {
  lean_object* x_59; lean_object* x_60; lean_object* x_61; 
  x_59 = lean_ctor_get(x_55, 1);
  lean_inc(x_59);
  lean_dec(x_55);
  x_60 = l_Lean_Expr_mvarId_x21(x_53);
  lean_dec(x_53);
  x_61 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_61, 0, x_60);
  lean_ctor_set(x_61, 1, x_59);
  return x_61;
  }
  }
  else
  {
  lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72; uint8_t x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83; 
  x_62 = lean_ctor_get(x_19, 0);
  lean_inc(x_62);
  lean_dec(x_19);
  x_63 = lean_ctor_get(x_16, 0);
  lean_inc(x_63);
  x_64 = lean_ctor_get(x_16, 1);
  lean_inc(x_64);
  lean_dec(x_16);
  x_65 = l_Lean_LocalDecl_setType(x_62, x_2);
  x_66 = l_Lean_LocalDecl_fvarId(x_65);
  x_67 = l_Lean_instBEqFVarId;
  x_68 = l_Lean_instHashableFVarId;
  lean_inc(x_65);
  x_69 = l_Std_PersistentHashMap_insert___rarg(x_67, x_68, x_17, x_66, x_65);
  x_70 = l_Lean_LocalDecl_index(x_65);
  x_71 = lean_alloc_ctor(1, 1, 0);
  lean_ctor_set(x_71, 0, x_65);
  x_72 = l_Std_PersistentArray_set___rarg(x_18, x_70, x_71);
  lean_dec(x_70);
  lean_ctor_set(x_15, 1, x_72);
  lean_ctor_set(x_15, 0, x_69);
  x_73 = lean_ctor_get_uint8(x_11, sizeof(void*)*7);
  x_74 = lean_ctor_get(x_11, 0);
  lean_inc(x_74);
  lean_dec(x_11);
  x_75 = lean_unsigned_to_nat(0u);
  x_76 = l_Lean_Meta_mkFreshExprMVarAt(x_15, x_63, x_13, x_73, x_74, x_75, x_4, x_5, x_6, x_7, x_64);
  x_77 = lean_ctor_get(x_76, 0);
  lean_inc(x_77);
  x_78 = lean_ctor_get(x_76, 1);
  lean_inc(x_78);
  lean_dec(x_76);
  lean_inc(x_77);
  x_79 = l_Lean_Meta_assignExprMVar(x_1, x_77, x_4, x_5, x_6, x_7, x_78);
  lean_dec(x_4);
  x_80 = lean_ctor_get(x_79, 1);
  lean_inc(x_80);
  if (lean_is_exclusive(x_79)) {
   lean_ctor_release(x_79, 0);
   lean_ctor_release(x_79, 1);
   x_81 = x_79;
  } else {
   lean_dec_ref(x_79);
   x_81 = lean_box(0);
  }
  x_82 = l_Lean_Expr_mvarId_x21(x_77);
  lean_dec(x_77);
  if (lean_is_scalar(x_81)) {
   x_83 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_83 = x_81;
  }
  lean_ctor_set(x_83, 0, x_82);
  lean_ctor_set(x_83, 1, x_80);
  return x_83;
  }
  }
  else
  {
  lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95; lean_object* x_96; uint8_t x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100; lean_object* x_101; lean_object* x_102; lean_object* x_103; lean_object* x_104; lean_object* x_105; lean_object* x_106; lean_object* x_107; 
  lean_dec(x_15);
  x_84 = lean_ctor_get(x_19, 0);
  lean_inc(x_84);
  if (lean_is_exclusive(x_19)) {
   lean_ctor_release(x_19, 0);
   x_85 = x_19;
  } else {
   lean_dec_ref(x_19);
   x_85 = lean_box(0);
  }
  x_86 = lean_ctor_get(x_16, 0);
  lean_inc(x_86);
  x_87 = lean_ctor_get(x_16, 1);
  lean_inc(x_87);
  lean_dec(x_16);
  x_88 = l_Lean_LocalDecl_setType(x_84, x_2);
  x_89 = l_Lean_LocalDecl_fvarId(x_88);
  x_90 = l_Lean_instBEqFVarId;
  x_91 = l_Lean_instHashableFVarId;
  lean_inc(x_88);
  x_92 = l_Std_PersistentHashMap_insert___rarg(x_90, x_91, x_17, x_89, x_88);
  x_93 = l_Lean_LocalDecl_index(x_88);
  if (lean_is_scalar(x_85)) {
   x_94 = lean_alloc_ctor(1, 1, 0);
  } else {
   x_94 = x_85;
  }
  lean_ctor_set(x_94, 0, x_88);
  x_95 = l_Std_PersistentArray_set___rarg(x_18, x_93, x_94);
  lean_dec(x_93);
  x_96 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_96, 0, x_92);
  lean_ctor_set(x_96, 1, x_95);
  x_97 = lean_ctor_get_uint8(x_11, sizeof(void*)*7);
  x_98 = lean_ctor_get(x_11, 0);
  lean_inc(x_98);
  lean_dec(x_11);
  x_99 = lean_unsigned_to_nat(0u);
  x_100 = l_Lean_Meta_mkFreshExprMVarAt(x_96, x_86, x_13, x_97, x_98, x_99, x_4, x_5, x_6, x_7, x_87);
  x_101 = lean_ctor_get(x_100, 0);
  lean_inc(x_101);
  x_102 = lean_ctor_get(x_100, 1);
  lean_inc(x_102);
  lean_dec(x_100);
  lean_inc(x_101);
  x_103 = l_Lean_Meta_assignExprMVar(x_1, x_101, x_4, x_5, x_6, x_7, x_102);
  lean_dec(x_4);
  x_104 = lean_ctor_get(x_103, 1);
  lean_inc(x_104);
  if (lean_is_exclusive(x_103)) {
   lean_ctor_release(x_103, 0);
   lean_ctor_release(x_103, 1);
   x_105 = x_103;
  } else {
   lean_dec_ref(x_103);
   x_105 = lean_box(0);
  }
  x_106 = l_Lean_Expr_mvarId_x21(x_101);
  lean_dec(x_101);
  if (lean_is_scalar(x_105)) {
   x_107 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_107 = x_105;
  }
  lean_ctor_set(x_107, 0, x_106);
  lean_ctor_set(x_107, 1, x_104);
  return x_107;
  }
  }
  }
  else
  {
  lean_dec(x_13);
  lean_dec(x_11);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_2);
  lean_ctor_set(x_9, 0, x_1);
  return x_9;
  }
  }
  else
  {
  lean_object* x_108; lean_object* x_109; lean_object* x_110; uint8_t x_111; 
  x_108 = lean_ctor_get(x_9, 0);
  x_109 = lean_ctor_get(x_9, 1);
  lean_inc(x_109);
  lean_inc(x_108);
  lean_dec(x_9);
  x_110 = lean_ctor_get(x_108, 2);
  lean_inc(x_110);
  x_111 = lean_expr_eqv(x_2, x_110);
  if (x_111 == 0)
  {
  lean_object* x_112; lean_object* x_113; lean_object* x_114; lean_object* x_115; lean_object* x_116; 
  x_112 = lean_ctor_get(x_4, 1);
  lean_inc(x_112);
  x_113 = l_Lean_Meta_getLocalInstances(x_4, x_5, x_6, x_7, x_109);
  x_114 = lean_ctor_get(x_112, 0);
  lean_inc(x_114);
  x_115 = lean_ctor_get(x_112, 1);
  lean_inc(x_115);
  lean_inc(x_112);
  x_116 = lean_local_ctx_find(x_112, x_3);
  if (lean_obj_tag(x_116) == 0)
  {
  lean_object* x_117; lean_object* x_118; uint8_t x_119; lean_object* x_120; lean_object* x_121; lean_object* x_122; lean_object* x_123; lean_object* x_124; lean_object* x_125; lean_object* x_126; lean_object* x_127; lean_object* x_128; lean_object* x_129; 
  lean_dec(x_115);
  lean_dec(x_114);
  lean_dec(x_2);
  x_117 = lean_ctor_get(x_113, 0);
  lean_inc(x_117);
  x_118 = lean_ctor_get(x_113, 1);
  lean_inc(x_118);
  lean_dec(x_113);
  x_119 = lean_ctor_get_uint8(x_108, sizeof(void*)*7);
  x_120 = lean_ctor_get(x_108, 0);
  lean_inc(x_120);
  lean_dec(x_108);
  x_121 = lean_unsigned_to_nat(0u);
  x_122 = l_Lean_Meta_mkFreshExprMVarAt(x_112, x_117, x_110, x_119, x_120, x_121, x_4, x_5, x_6, x_7, x_118);
  x_123 = lean_ctor_get(x_122, 0);
  lean_inc(x_123);
  x_124 = lean_ctor_get(x_122, 1);
  lean_inc(x_124);
  lean_dec(x_122);
  lean_inc(x_123);
  x_125 = l_Lean_Meta_assignExprMVar(x_1, x_123, x_4, x_5, x_6, x_7, x_124);
  lean_dec(x_4);
  x_126 = lean_ctor_get(x_125, 1);
  lean_inc(x_126);
  if (lean_is_exclusive(x_125)) {
   lean_ctor_release(x_125, 0);
   lean_ctor_release(x_125, 1);
   x_127 = x_125;
  } else {
   lean_dec_ref(x_125);
   x_127 = lean_box(0);
  }
  x_128 = l_Lean_Expr_mvarId_x21(x_123);
  lean_dec(x_123);
  if (lean_is_scalar(x_127)) {
   x_129 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_129 = x_127;
  }
  lean_ctor_set(x_129, 0, x_128);
  lean_ctor_set(x_129, 1, x_126);
  return x_129;
  }
  else
  {
  lean_object* x_130; lean_object* x_131; lean_object* x_132; lean_object* x_133; lean_object* x_134; lean_object* x_135; lean_object* x_136; lean_object* x_137; lean_object* x_138; lean_object* x_139; lean_object* x_140; lean_object* x_141; lean_object* x_142; lean_object* x_143; uint8_t x_144; lean_object* x_145; lean_object* x_146; lean_object* x_147; lean_object* x_148; lean_object* x_149; lean_object* x_150; lean_object* x_151; lean_object* x_152; lean_object* x_153; lean_object* x_154; 
  if (lean_is_exclusive(x_112)) {
   lean_ctor_release(x_112, 0);
   lean_ctor_release(x_112, 1);
   x_130 = x_112;
  } else {
   lean_dec_ref(x_112);
   x_130 = lean_box(0);
  }
  x_131 = lean_ctor_get(x_116, 0);
  lean_inc(x_131);
  if (lean_is_exclusive(x_116)) {
   lean_ctor_release(x_116, 0);
   x_132 = x_116;
  } else {
   lean_dec_ref(x_116);
   x_132 = lean_box(0);
  }
  x_133 = lean_ctor_get(x_113, 0);
  lean_inc(x_133);
  x_134 = lean_ctor_get(x_113, 1);
  lean_inc(x_134);
  lean_dec(x_113);
  x_135 = l_Lean_LocalDecl_setType(x_131, x_2);
  x_136 = l_Lean_LocalDecl_fvarId(x_135);
  x_137 = l_Lean_instBEqFVarId;
  x_138 = l_Lean_instHashableFVarId;
  lean_inc(x_135);
  x_139 = l_Std_PersistentHashMap_insert___rarg(x_137, x_138, x_114, x_136, x_135);
  x_140 = l_Lean_LocalDecl_index(x_135);
  if (lean_is_scalar(x_132)) {
   x_141 = lean_alloc_ctor(1, 1, 0);
  } else {
   x_141 = x_132;
  }
  lean_ctor_set(x_141, 0, x_135);
  x_142 = l_Std_PersistentArray_set___rarg(x_115, x_140, x_141);
  lean_dec(x_140);
  if (lean_is_scalar(x_130)) {
   x_143 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_143 = x_130;
  }
  lean_ctor_set(x_143, 0, x_139);
  lean_ctor_set(x_143, 1, x_142);
  x_144 = lean_ctor_get_uint8(x_108, sizeof(void*)*7);
  x_145 = lean_ctor_get(x_108, 0);
  lean_inc(x_145);
  lean_dec(x_108);
  x_146 = lean_unsigned_to_nat(0u);
  x_147 = l_Lean_Meta_mkFreshExprMVarAt(x_143, x_133, x_110, x_144, x_145, x_146, x_4, x_5, x_6, x_7, x_134);
  x_148 = lean_ctor_get(x_147, 0);
  lean_inc(x_148);
  x_149 = lean_ctor_get(x_147, 1);
  lean_inc(x_149);
  lean_dec(x_147);
  lean_inc(x_148);
  x_150 = l_Lean_Meta_assignExprMVar(x_1, x_148, x_4, x_5, x_6, x_7, x_149);
  lean_dec(x_4);
  x_151 = lean_ctor_get(x_150, 1);
  lean_inc(x_151);
  if (lean_is_exclusive(x_150)) {
   lean_ctor_release(x_150, 0);
   lean_ctor_release(x_150, 1);
   x_152 = x_150;
  } else {
   lean_dec_ref(x_150);
   x_152 = lean_box(0);
  }
  x_153 = l_Lean_Expr_mvarId_x21(x_148);
  lean_dec(x_148);
  if (lean_is_scalar(x_152)) {
   x_154 = lean_alloc_ctor(0, 2, 0);
  } else {
   x_154 = x_152;
  }
  lean_ctor_set(x_154, 0, x_153);
  lean_ctor_set(x_154, 1, x_151);
  return x_154;
  }
  }
  else
  {
  lean_object* x_155; 
  lean_dec(x_110);
  lean_dec(x_108);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_2);
  x_155 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_155, 0, x_1);
  lean_ctor_set(x_155, 1, x_109);
  return x_155;
  }
  }
  }
  else
  {
  uint8_t x_156; 
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_2);
  lean_dec(x_1);
  x_156 = !lean_is_exclusive(x_9);
  if (x_156 == 0)
  {
  return x_9;
  }
  else
  {
  lean_object* x_157; lean_object* x_158; lean_object* x_159; 
  x_157 = lean_ctor_get(x_9, 0);
  x_158 = lean_ctor_get(x_9, 1);
  lean_inc(x_158);
  lean_inc(x_157);
  lean_dec(x_9);
  x_159 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_159, 0, x_157);
  lean_ctor_set(x_159, 1, x_158);
  return x_159;
  }
  }
  }
  }
  lean_object* l_Lean_Meta_replaceLocalDeclDefEq(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, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; lean_object* x_10; 
  lean_inc(x_1);
  x_9 = lean_alloc_closure((void*)(l_Lean_Meta_replaceLocalDeclDefEq___lambda__1___boxed), 8, 3);
  lean_closure_set(x_9, 0, x_1);
  lean_closure_set(x_9, 1, x_3);
  lean_closure_set(x_9, 2, x_2);
  x_10 = l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(x_1, x_9, x_4, x_5, x_6, x_7, x_8);
  return x_10;
  }
  }
  lean_object* l_Lean_Meta_replaceLocalDeclDefEq___lambda__1___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, lean_object* x_7, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; 
  x_9 = l_Lean_Meta_replaceLocalDeclDefEq___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  return x_9;
  }
  }
  lean_object* l_Lean_Meta_change___lambda__1(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, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; 
  x_9 = l_Lean_Meta_replaceTargetDefEq(x_1, x_2, x_4, x_5, x_6, x_7, x_8);
  return x_9;
  }
  }
  static lean_object* _init_l_Lean_Meta_change___lambda__2___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("given type");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_change___lambda__2___closed__2() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; 
  x_1 = l_Lean_Meta_change___lambda__2___closed__1;
  x_2 = l_Lean_stringToMessageData(x_1);
  return x_2;
  }
  }
  static lean_object* _init_l_Lean_Meta_change___lambda__2___closed__3() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("\nis not definitionally equal to");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_change___lambda__2___closed__4() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; 
  x_1 = l_Lean_Meta_change___lambda__2___closed__3;
  x_2 = l_Lean_stringToMessageData(x_1);
  return x_2;
  }
  }
  static lean_object* _init_l_Lean_Meta_change___lambda__2___closed__5() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_change___lambda__2___closed__6() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; 
  x_1 = l_Lean_Meta_change___lambda__2___closed__5;
  x_2 = l_Lean_stringToMessageData(x_1);
  return x_2;
  }
  }
  lean_object* l_Lean_Meta_change___lambda__2(lean_object* x_1, lean_object* x_2, uint8_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; 
  lean_inc(x_1);
  x_9 = l_Lean_Meta_getMVarType(x_1, x_4, x_5, x_6, x_7, x_8);
  if (lean_obj_tag(x_9) == 0)
  {
  if (x_3 == 0)
  {
  lean_object* x_10; lean_object* x_11; 
  x_10 = lean_ctor_get(x_9, 1);
  lean_inc(x_10);
  lean_dec(x_9);
  x_11 = l_Lean_Meta_replaceTargetDefEq(x_1, x_2, x_4, x_5, x_6, x_7, x_10);
  return x_11;
  }
  else
  {
  lean_object* x_12; lean_object* x_13; lean_object* x_14; 
  x_12 = lean_ctor_get(x_9, 0);
  lean_inc(x_12);
  x_13 = lean_ctor_get(x_9, 1);
  lean_inc(x_13);
  lean_dec(x_9);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_4);
  lean_inc(x_2);
  lean_inc(x_12);
  x_14 = l_Lean_Meta_isExprDefEq(x_12, x_2, x_4, x_5, x_6, x_7, x_13);
  if (lean_obj_tag(x_14) == 0)
  {
  lean_object* x_15; uint8_t x_16; 
  x_15 = lean_ctor_get(x_14, 0);
  lean_inc(x_15);
  x_16 = lean_unbox(x_15);
  lean_dec(x_15);
  if (x_16 == 0)
  {
  lean_object* x_17; lean_object* x_18; lean_object* x_19; 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; lean_object* x_29; uint8_t x_30; 
  x_17 = lean_ctor_get(x_14, 1);
  lean_inc(x_17);
  lean_dec(x_14);
  x_18 = l_Lean_indentExpr(x_2);
  x_19 = l_Lean_Meta_change___lambda__2___closed__2;
  x_20 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_20, 0, x_19);
  lean_ctor_set(x_20, 1, x_18);
  x_21 = l_Lean_Meta_change___lambda__2___closed__4;
  x_22 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_22, 0, x_20);
  lean_ctor_set(x_22, 1, x_21);
  x_23 = l_Lean_indentExpr(x_12);
  x_24 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_24, 0, x_22);
  lean_ctor_set(x_24, 1, x_23);
  x_25 = l_Lean_Meta_change___lambda__2___closed__6;
  x_26 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_26, 0, x_24);
  lean_ctor_set(x_26, 1, x_25);
  x_27 = l_Lean_Meta_replaceTargetDefEq___closed__2;
  x_28 = lean_box(0);
  x_29 = l_Lean_Meta_throwTacticEx___rarg(x_27, x_1, x_26, x_28, x_4, x_5, x_6, x_7, x_17);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_4);
  x_30 = !lean_is_exclusive(x_29);
  if (x_30 == 0)
  {
  return x_29;
  }
  else
  {
  lean_object* x_31; lean_object* x_32; lean_object* x_33; 
  x_31 = lean_ctor_get(x_29, 0);
  x_32 = lean_ctor_get(x_29, 1);
  lean_inc(x_32);
  lean_inc(x_31);
  lean_dec(x_29);
  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;
  }
  }
  else
  {
  lean_object* x_34; lean_object* x_35; 
  lean_dec(x_12);
  x_34 = lean_ctor_get(x_14, 1);
  lean_inc(x_34);
  lean_dec(x_14);
  x_35 = l_Lean_Meta_replaceTargetDefEq(x_1, x_2, x_4, x_5, x_6, x_7, x_34);
  return x_35;
  }
  }
  else
  {
  uint8_t x_36; 
  lean_dec(x_12);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_2);
  lean_dec(x_1);
  x_36 = !lean_is_exclusive(x_14);
  if (x_36 == 0)
  {
  return x_14;
  }
  else
  {
  lean_object* x_37; lean_object* x_38; lean_object* x_39; 
  x_37 = lean_ctor_get(x_14, 0);
  x_38 = lean_ctor_get(x_14, 1);
  lean_inc(x_38);
  lean_inc(x_37);
  lean_dec(x_14);
  x_39 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_39, 0, x_37);
  lean_ctor_set(x_39, 1, x_38);
  return x_39;
  }
  }
  }
  }
  else
  {
  uint8_t x_40; 
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_2);
  lean_dec(x_1);
  x_40 = !lean_is_exclusive(x_9);
  if (x_40 == 0)
  {
  return x_9;
  }
  else
  {
  lean_object* x_41; lean_object* x_42; lean_object* x_43; 
  x_41 = lean_ctor_get(x_9, 0);
  x_42 = lean_ctor_get(x_9, 1);
  lean_inc(x_42);
  lean_inc(x_41);
  lean_dec(x_9);
  x_43 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_43, 0, x_41);
  lean_ctor_set(x_43, 1, x_42);
  return x_43;
  }
  }
  }
  }
  lean_object* l_Lean_Meta_change(lean_object* x_1, lean_object* x_2, uint8_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; lean_object* x_10; lean_object* x_11; 
  x_9 = lean_box(x_3);
  lean_inc(x_1);
  x_10 = lean_alloc_closure((void*)(l_Lean_Meta_change___lambda__2___boxed), 8, 3);
  lean_closure_set(x_10, 0, x_1);
  lean_closure_set(x_10, 1, x_2);
  lean_closure_set(x_10, 2, x_9);
  x_11 = l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(x_1, x_10, x_4, x_5, x_6, x_7, x_8);
  return x_11;
  }
  }
  lean_object* l_Lean_Meta_change___lambda__1___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, lean_object* x_7, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; 
  x_9 = l_Lean_Meta_change___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
  lean_dec(x_3);
  return x_9;
  }
  }
  lean_object* l_Lean_Meta_change___lambda__2___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, lean_object* x_7, lean_object* x_8) {
  _start:
  {
  uint8_t x_9; lean_object* x_10; 
  x_9 = lean_unbox(x_3);
  lean_dec(x_3);
  x_10 = l_Lean_Meta_change___lambda__2(x_1, x_2, x_9, x_4, x_5, x_6, x_7, x_8);
  return x_10;
  }
  }
  lean_object* l_Lean_Meta_change___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, lean_object* x_7, lean_object* x_8) {
  _start:
  {
  uint8_t x_9; lean_object* x_10; 
  x_9 = lean_unbox(x_3);
  lean_dec(x_3);
  x_10 = l_Lean_Meta_change(x_1, x_2, x_9, x_4, x_5, x_6, x_7, x_8);
  return x_10;
  }
  }
  static lean_object* _init_l_Lean_Meta_changeLocalDecl___lambda__1___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("changeHypothesis");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_changeLocalDecl___lambda__1___closed__2() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; lean_object* x_3; 
  x_1 = lean_box(0);
  x_2 = l_Lean_Meta_changeLocalDecl___lambda__1___closed__1;
  x_3 = lean_name_mk_string(x_1, x_2);
  return x_3;
  }
  }
  static lean_object* _init_l_Lean_Meta_changeLocalDecl___lambda__1___closed__3() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("unexpected auxiliary target");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_changeLocalDecl___lambda__1___closed__4() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; 
  x_1 = l_Lean_Meta_changeLocalDecl___lambda__1___closed__3;
  x_2 = lean_alloc_ctor(2, 1, 0);
  lean_ctor_set(x_2, 0, x_1);
  return x_2;
  }
  }
  static lean_object* _init_l_Lean_Meta_changeLocalDecl___lambda__1___closed__5() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; 
  x_1 = l_Lean_Meta_changeLocalDecl___lambda__1___closed__4;
  x_2 = lean_alloc_ctor(0, 1, 0);
  lean_ctor_set(x_2, 0, x_1);
  return x_2;
  }
  }
  lean_object* l_Lean_Meta_changeLocalDecl___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, uint8_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
  _start:
  {
  lean_object* x_10; 
  lean_inc(x_1);
  x_10 = l_Lean_Meta_getMVarType(x_1, x_5, x_6, x_7, x_8, x_9);
  if (lean_obj_tag(x_10) == 0)
  {
  lean_object* x_11; 
  x_11 = lean_ctor_get(x_10, 0);
  lean_inc(x_11);
  switch (lean_obj_tag(x_11)) {
  case 7:
  {
  lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; uint64_t x_16; uint8_t x_17; 
  x_12 = lean_ctor_get(x_10, 1);
  lean_inc(x_12);
  lean_dec(x_10);
  x_13 = lean_ctor_get(x_11, 0);
  lean_inc(x_13);
  x_14 = lean_ctor_get(x_11, 1);
  lean_inc(x_14);
  x_15 = lean_ctor_get(x_11, 2);
  lean_inc(x_15);
  x_16 = lean_ctor_get_uint64(x_11, sizeof(void*)*3);
  lean_dec(x_11);
  if (x_4 == 0)
  {
  uint8_t x_70; 
  x_70 = 0;
  x_17 = x_70;
  goto block_69;
  }
  else
  {
  uint8_t x_71; 
  x_71 = 1;
  x_17 = x_71;
  goto block_69;
  }
  block_69:
  {
  lean_object* x_18; 
  if (x_17 == 0)
  {
  lean_dec(x_14);
  x_18 = x_12;
  goto block_43;
  }
  else
  {
  lean_object* x_44; 
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_14);
  lean_inc(x_2);
  x_44 = l_Lean_Meta_isExprDefEq(x_2, x_14, x_5, x_6, x_7, x_8, x_12);
  if (lean_obj_tag(x_44) == 0)
  {
  lean_object* x_45; uint8_t x_46; 
  x_45 = lean_ctor_get(x_44, 0);
  lean_inc(x_45);
  x_46 = lean_unbox(x_45);
  lean_dec(x_45);
  if (x_46 == 0)
  {
  lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; uint8_t x_60; 
  lean_dec(x_15);
  lean_dec(x_13);
  lean_dec(x_3);
  x_47 = lean_ctor_get(x_44, 1);
  lean_inc(x_47);
  lean_dec(x_44);
  x_48 = l_Lean_indentExpr(x_2);
  x_49 = l_Lean_Meta_change___lambda__2___closed__2;
  x_50 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_50, 0, x_49);
  lean_ctor_set(x_50, 1, x_48);
  x_51 = l_Lean_Meta_change___lambda__2___closed__4;
  x_52 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_52, 0, x_50);
  lean_ctor_set(x_52, 1, x_51);
  x_53 = l_Lean_indentExpr(x_14);
  x_54 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_54, 0, x_52);
  lean_ctor_set(x_54, 1, x_53);
  x_55 = l_Lean_Meta_change___lambda__2___closed__6;
  x_56 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_56, 0, x_54);
  lean_ctor_set(x_56, 1, x_55);
  x_57 = l_Lean_Meta_changeLocalDecl___lambda__1___closed__2;
  x_58 = lean_box(0);
  x_59 = l_Lean_Meta_throwTacticEx___rarg(x_57, x_1, x_56, x_58, x_5, x_6, x_7, x_8, x_47);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_5);
  x_60 = !lean_is_exclusive(x_59);
  if (x_60 == 0)
  {
  return x_59;
  }
  else
  {
  lean_object* x_61; lean_object* x_62; lean_object* x_63; 
  x_61 = lean_ctor_get(x_59, 0);
  x_62 = lean_ctor_get(x_59, 1);
  lean_inc(x_62);
  lean_inc(x_61);
  lean_dec(x_59);
  x_63 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_63, 0, x_61);
  lean_ctor_set(x_63, 1, x_62);
  return x_63;
  }
  }
  else
  {
  lean_object* x_64; 
  lean_dec(x_14);
  x_64 = lean_ctor_get(x_44, 1);
  lean_inc(x_64);
  lean_dec(x_44);
  x_18 = x_64;
  goto block_43;
  }
  }
  else
  {
  uint8_t x_65; 
  lean_dec(x_15);
  lean_dec(x_14);
  lean_dec(x_13);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_3);
  lean_dec(x_2);
  lean_dec(x_1);
  x_65 = !lean_is_exclusive(x_44);
  if (x_65 == 0)
  {
  return x_44;
  }
  else
  {
  lean_object* x_66; lean_object* x_67; lean_object* x_68; 
  x_66 = lean_ctor_get(x_44, 0);
  x_67 = lean_ctor_get(x_44, 1);
  lean_inc(x_67);
  lean_inc(x_66);
  lean_dec(x_44);
  x_68 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_68, 0, x_66);
  lean_ctor_set(x_68, 1, x_67);
  return x_68;
  }
  }
  }
  block_43:
  {
  uint8_t x_19; lean_object* x_20; lean_object* x_21; 
  x_19 = (uint8_t)((x_16 << 24) >> 61);
  x_20 = l_Lean_mkForall(x_13, x_19, x_2, x_15);
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  x_21 = l_Lean_Meta_replaceTargetDefEq(x_1, x_20, x_5, x_6, x_7, x_8, x_18);
  if (lean_obj_tag(x_21) == 0)
  {
  lean_object* x_22; lean_object* x_23; lean_object* x_24; uint8_t x_25; uint8_t x_26; lean_object* x_27; 
  x_22 = lean_ctor_get(x_21, 0);
  lean_inc(x_22);
  x_23 = lean_ctor_get(x_21, 1);
  lean_inc(x_23);
  lean_dec(x_21);
  x_24 = lean_box(0);
  x_25 = 0;
  x_26 = 1;
  x_27 = l_Lean_Meta_introNCore(x_22, x_3, x_24, x_25, x_26, x_5, x_6, x_7, x_8, x_23);
  if (lean_obj_tag(x_27) == 0)
  {
  uint8_t x_28; 
  x_28 = !lean_is_exclusive(x_27);
  if (x_28 == 0)
  {
  lean_object* x_29; lean_object* x_30; 
  x_29 = lean_ctor_get(x_27, 0);
  x_30 = lean_ctor_get(x_29, 1);
  lean_inc(x_30);
  lean_dec(x_29);
  lean_ctor_set(x_27, 0, x_30);
  return x_27;
  }
  else
  {
  lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; 
  x_31 = lean_ctor_get(x_27, 0);
  x_32 = lean_ctor_get(x_27, 1);
  lean_inc(x_32);
  lean_inc(x_31);
  lean_dec(x_27);
  x_33 = lean_ctor_get(x_31, 1);
  lean_inc(x_33);
  lean_dec(x_31);
  x_34 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_34, 0, x_33);
  lean_ctor_set(x_34, 1, x_32);
  return x_34;
  }
  }
  else
  {
  uint8_t x_35; 
  x_35 = !lean_is_exclusive(x_27);
  if (x_35 == 0)
  {
  return x_27;
  }
  else
  {
  lean_object* x_36; lean_object* x_37; lean_object* x_38; 
  x_36 = lean_ctor_get(x_27, 0);
  x_37 = lean_ctor_get(x_27, 1);
  lean_inc(x_37);
  lean_inc(x_36);
  lean_dec(x_27);
  x_38 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_38, 0, x_36);
  lean_ctor_set(x_38, 1, x_37);
  return x_38;
  }
  }
  }
  else
  {
  uint8_t x_39; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_3);
  x_39 = !lean_is_exclusive(x_21);
  if (x_39 == 0)
  {
  return x_21;
  }
  else
  {
  lean_object* x_40; lean_object* x_41; lean_object* x_42; 
  x_40 = lean_ctor_get(x_21, 0);
  x_41 = lean_ctor_get(x_21, 1);
  lean_inc(x_41);
  lean_inc(x_40);
  lean_dec(x_21);
  x_42 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_42, 0, x_40);
  lean_ctor_set(x_42, 1, x_41);
  return x_42;
  }
  }
  }
  }
  }
  case 8:
  {
  lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; uint8_t x_77; 
  x_72 = lean_ctor_get(x_10, 1);
  lean_inc(x_72);
  lean_dec(x_10);
  x_73 = lean_ctor_get(x_11, 0);
  lean_inc(x_73);
  x_74 = lean_ctor_get(x_11, 1);
  lean_inc(x_74);
  x_75 = lean_ctor_get(x_11, 2);
  lean_inc(x_75);
  x_76 = lean_ctor_get(x_11, 3);
  lean_inc(x_76);
  lean_dec(x_11);
  if (x_4 == 0)
  {
  uint8_t x_129; 
  x_129 = 0;
  x_77 = x_129;
  goto block_128;
  }
  else
  {
  uint8_t x_130; 
  x_130 = 1;
  x_77 = x_130;
  goto block_128;
  }
  block_128:
  {
  lean_object* x_78; 
  if (x_77 == 0)
  {
  lean_dec(x_74);
  x_78 = x_72;
  goto block_102;
  }
  else
  {
  lean_object* x_103; 
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_74);
  lean_inc(x_2);
  x_103 = l_Lean_Meta_isExprDefEq(x_2, x_74, x_5, x_6, x_7, x_8, x_72);
  if (lean_obj_tag(x_103) == 0)
  {
  lean_object* x_104; uint8_t x_105; 
  x_104 = lean_ctor_get(x_103, 0);
  lean_inc(x_104);
  x_105 = lean_unbox(x_104);
  lean_dec(x_104);
  if (x_105 == 0)
  {
  lean_object* x_106; lean_object* x_107; lean_object* x_108; lean_object* x_109; lean_object* x_110; lean_object* x_111; lean_object* x_112; lean_object* x_113; lean_object* x_114; lean_object* x_115; lean_object* x_116; lean_object* x_117; lean_object* x_118; uint8_t x_119; 
  lean_dec(x_76);
  lean_dec(x_75);
  lean_dec(x_73);
  lean_dec(x_3);
  x_106 = lean_ctor_get(x_103, 1);
  lean_inc(x_106);
  lean_dec(x_103);
  x_107 = l_Lean_indentExpr(x_2);
  x_108 = l_Lean_Meta_change___lambda__2___closed__2;
  x_109 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_109, 0, x_108);
  lean_ctor_set(x_109, 1, x_107);
  x_110 = l_Lean_Meta_change___lambda__2___closed__4;
  x_111 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_111, 0, x_109);
  lean_ctor_set(x_111, 1, x_110);
  x_112 = l_Lean_indentExpr(x_74);
  x_113 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_113, 0, x_111);
  lean_ctor_set(x_113, 1, x_112);
  x_114 = l_Lean_Meta_change___lambda__2___closed__6;
  x_115 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_115, 0, x_113);
  lean_ctor_set(x_115, 1, x_114);
  x_116 = l_Lean_Meta_changeLocalDecl___lambda__1___closed__2;
  x_117 = lean_box(0);
  x_118 = l_Lean_Meta_throwTacticEx___rarg(x_116, x_1, x_115, x_117, x_5, x_6, x_7, x_8, x_106);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_5);
  x_119 = !lean_is_exclusive(x_118);
  if (x_119 == 0)
  {
  return x_118;
  }
  else
  {
  lean_object* x_120; lean_object* x_121; lean_object* x_122; 
  x_120 = lean_ctor_get(x_118, 0);
  x_121 = lean_ctor_get(x_118, 1);
  lean_inc(x_121);
  lean_inc(x_120);
  lean_dec(x_118);
  x_122 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_122, 0, x_120);
  lean_ctor_set(x_122, 1, x_121);
  return x_122;
  }
  }
  else
  {
  lean_object* x_123; 
  lean_dec(x_74);
  x_123 = lean_ctor_get(x_103, 1);
  lean_inc(x_123);
  lean_dec(x_103);
  x_78 = x_123;
  goto block_102;
  }
  }
  else
  {
  uint8_t x_124; 
  lean_dec(x_76);
  lean_dec(x_75);
  lean_dec(x_74);
  lean_dec(x_73);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_3);
  lean_dec(x_2);
  lean_dec(x_1);
  x_124 = !lean_is_exclusive(x_103);
  if (x_124 == 0)
  {
  return x_103;
  }
  else
  {
  lean_object* x_125; lean_object* x_126; lean_object* x_127; 
  x_125 = lean_ctor_get(x_103, 0);
  x_126 = lean_ctor_get(x_103, 1);
  lean_inc(x_126);
  lean_inc(x_125);
  lean_dec(x_103);
  x_127 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_127, 0, x_125);
  lean_ctor_set(x_127, 1, x_126);
  return x_127;
  }
  }
  }
  block_102:
  {
  uint8_t x_79; lean_object* x_80; lean_object* x_81; 
  x_79 = 0;
  x_80 = l_Lean_mkLet(x_73, x_2, x_75, x_76, x_79);
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  x_81 = l_Lean_Meta_replaceTargetDefEq(x_1, x_80, x_5, x_6, x_7, x_8, x_78);
  if (lean_obj_tag(x_81) == 0)
  {
  lean_object* x_82; lean_object* x_83; lean_object* x_84; uint8_t x_85; lean_object* x_86; 
  x_82 = lean_ctor_get(x_81, 0);
  lean_inc(x_82);
  x_83 = lean_ctor_get(x_81, 1);
  lean_inc(x_83);
  lean_dec(x_81);
  x_84 = lean_box(0);
  x_85 = 1;
  x_86 = l_Lean_Meta_introNCore(x_82, x_3, x_84, x_79, x_85, x_5, x_6, x_7, x_8, x_83);
  if (lean_obj_tag(x_86) == 0)
  {
  uint8_t x_87; 
  x_87 = !lean_is_exclusive(x_86);
  if (x_87 == 0)
  {
  lean_object* x_88; lean_object* x_89; 
  x_88 = lean_ctor_get(x_86, 0);
  x_89 = lean_ctor_get(x_88, 1);
  lean_inc(x_89);
  lean_dec(x_88);
  lean_ctor_set(x_86, 0, x_89);
  return x_86;
  }
  else
  {
  lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93; 
  x_90 = lean_ctor_get(x_86, 0);
  x_91 = lean_ctor_get(x_86, 1);
  lean_inc(x_91);
  lean_inc(x_90);
  lean_dec(x_86);
  x_92 = lean_ctor_get(x_90, 1);
  lean_inc(x_92);
  lean_dec(x_90);
  x_93 = lean_alloc_ctor(0, 2, 0);
  lean_ctor_set(x_93, 0, x_92);
  lean_ctor_set(x_93, 1, x_91);
  return x_93;
  }
  }
  else
  {
  uint8_t x_94; 
  x_94 = !lean_is_exclusive(x_86);
  if (x_94 == 0)
  {
  return x_86;
  }
  else
  {
  lean_object* x_95; lean_object* x_96; lean_object* x_97; 
  x_95 = lean_ctor_get(x_86, 0);
  x_96 = lean_ctor_get(x_86, 1);
  lean_inc(x_96);
  lean_inc(x_95);
  lean_dec(x_86);
  x_97 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_97, 0, x_95);
  lean_ctor_set(x_97, 1, x_96);
  return x_97;
  }
  }
  }
  else
  {
  uint8_t x_98; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_3);
  x_98 = !lean_is_exclusive(x_81);
  if (x_98 == 0)
  {
  return x_81;
  }
  else
  {
  lean_object* x_99; lean_object* x_100; lean_object* x_101; 
  x_99 = lean_ctor_get(x_81, 0);
  x_100 = lean_ctor_get(x_81, 1);
  lean_inc(x_100);
  lean_inc(x_99);
  lean_dec(x_81);
  x_101 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_101, 0, x_99);
  lean_ctor_set(x_101, 1, x_100);
  return x_101;
  }
  }
  }
  }
  }
  default: 
  {
  lean_object* x_131; lean_object* x_132; lean_object* x_133; lean_object* x_134; lean_object* x_135; 
  lean_dec(x_11);
  lean_dec(x_3);
  lean_dec(x_2);
  x_131 = lean_ctor_get(x_10, 1);
  lean_inc(x_131);
  lean_dec(x_10);
  x_132 = l_Lean_Meta_changeLocalDecl___lambda__1___closed__2;
  x_133 = l_Lean_Meta_changeLocalDecl___lambda__1___closed__5;
  x_134 = lean_box(0);
  x_135 = l_Lean_Meta_throwTacticEx___rarg(x_132, x_1, x_133, x_134, x_5, x_6, x_7, x_8, x_131);
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_5);
  return x_135;
  }
  }
  }
  else
  {
  uint8_t x_136; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_3);
  lean_dec(x_2);
  lean_dec(x_1);
  x_136 = !lean_is_exclusive(x_10);
  if (x_136 == 0)
  {
  return x_10;
  }
  else
  {
  lean_object* x_137; lean_object* x_138; lean_object* x_139; 
  x_137 = lean_ctor_get(x_10, 0);
  x_138 = lean_ctor_get(x_10, 1);
  lean_inc(x_138);
  lean_inc(x_137);
  lean_dec(x_10);
  x_139 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_139, 0, x_137);
  lean_ctor_set(x_139, 1, x_138);
  return x_139;
  }
  }
  }
  }
  static lean_object* _init_l_Lean_Meta_changeLocalDecl___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("changeLocalDecl");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_changeLocalDecl___closed__2() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; lean_object* x_3; 
  x_1 = lean_box(0);
  x_2 = l_Lean_Meta_changeLocalDecl___closed__1;
  x_3 = lean_name_mk_string(x_1, x_2);
  return x_3;
  }
  }
  static lean_object* _init_l_Lean_Meta_changeLocalDecl___closed__3() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; 
  x_1 = lean_unsigned_to_nat(1u);
  x_2 = lean_mk_empty_array_with_capacity(x_1);
  return x_2;
  }
  }
  lean_object* l_Lean_Meta_changeLocalDecl(lean_object* x_1, lean_object* x_2, lean_object* x_3, uint8_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
  _start:
  {
  lean_object* x_10; lean_object* x_11; 
  x_10 = l_Lean_Meta_changeLocalDecl___closed__2;
  lean_inc(x_6);
  lean_inc(x_1);
  x_11 = l_Lean_Meta_checkNotAssigned(x_1, x_10, x_5, x_6, x_7, x_8, x_9);
  if (lean_obj_tag(x_11) == 0)
  {
  lean_object* x_12; lean_object* x_13; lean_object* x_14; uint8_t x_15; lean_object* x_16; 
  x_12 = lean_ctor_get(x_11, 1);
  lean_inc(x_12);
  lean_dec(x_11);
  x_13 = l_Lean_Meta_changeLocalDecl___closed__3;
  x_14 = lean_array_push(x_13, x_2);
  x_15 = 1;
  lean_inc(x_8);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  x_16 = l_Lean_Meta_revert(x_1, x_14, x_15, x_5, x_6, x_7, x_8, x_12);
  if (lean_obj_tag(x_16) == 0)
  {
  lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; 
  x_17 = lean_ctor_get(x_16, 0);
  lean_inc(x_17);
  x_18 = lean_ctor_get(x_16, 1);
  lean_inc(x_18);
  lean_dec(x_16);
  x_19 = lean_ctor_get(x_17, 0);
  lean_inc(x_19);
  x_20 = lean_ctor_get(x_17, 1);
  lean_inc(x_20);
  lean_dec(x_17);
  x_21 = lean_array_get_size(x_19);
  lean_dec(x_19);
  x_22 = lean_box(x_4);
  lean_inc(x_20);
  x_23 = lean_alloc_closure((void*)(l_Lean_Meta_changeLocalDecl___lambda__1___boxed), 9, 4);
  lean_closure_set(x_23, 0, x_20);
  lean_closure_set(x_23, 1, x_3);
  lean_closure_set(x_23, 2, x_21);
  lean_closure_set(x_23, 3, x_22);
  x_24 = l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(x_20, x_23, x_5, x_6, x_7, x_8, x_18);
  return x_24;
  }
  else
  {
  uint8_t x_25; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_3);
  x_25 = !lean_is_exclusive(x_16);
  if (x_25 == 0)
  {
  return x_16;
  }
  else
  {
  lean_object* x_26; lean_object* x_27; lean_object* x_28; 
  x_26 = lean_ctor_get(x_16, 0);
  x_27 = lean_ctor_get(x_16, 1);
  lean_inc(x_27);
  lean_inc(x_26);
  lean_dec(x_16);
  x_28 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_28, 0, x_26);
  lean_ctor_set(x_28, 1, x_27);
  return x_28;
  }
  }
  }
  else
  {
  uint8_t x_29; 
  lean_dec(x_8);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_3);
  lean_dec(x_2);
  lean_dec(x_1);
  x_29 = !lean_is_exclusive(x_11);
  if (x_29 == 0)
  {
  return x_11;
  }
  else
  {
  lean_object* x_30; lean_object* x_31; lean_object* x_32; 
  x_30 = lean_ctor_get(x_11, 0);
  x_31 = lean_ctor_get(x_11, 1);
  lean_inc(x_31);
  lean_inc(x_30);
  lean_dec(x_11);
  x_32 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_32, 0, x_30);
  lean_ctor_set(x_32, 1, x_31);
  return x_32;
  }
  }
  }
  }
  lean_object* l_Lean_Meta_changeLocalDecl___lambda__1___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, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
  _start:
  {
  uint8_t x_10; lean_object* x_11; 
  x_10 = lean_unbox(x_4);
  lean_dec(x_4);
  x_11 = l_Lean_Meta_changeLocalDecl___lambda__1(x_1, x_2, x_3, x_10, x_5, x_6, x_7, x_8, x_9);
  return x_11;
  }
  }
  lean_object* l_Lean_Meta_changeLocalDecl___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, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
  _start:
  {
  uint8_t x_10; lean_object* x_11; 
  x_10 = lean_unbox(x_4);
  lean_dec(x_4);
  x_11 = l_Lean_Meta_changeLocalDecl(x_1, x_2, x_3, x_10, x_5, x_6, x_7, x_8, x_9);
  return x_11;
  }
  }
  lean_object* l_Lean_Meta_modifyTarget___lambda__1(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, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; 
  lean_inc(x_5);
  lean_inc(x_1);
  x_9 = l_Lean_Meta_checkNotAssigned(x_1, x_2, x_4, x_5, x_6, x_7, x_8);
  if (lean_obj_tag(x_9) == 0)
  {
  lean_object* x_10; lean_object* x_11; 
  x_10 = lean_ctor_get(x_9, 1);
  lean_inc(x_10);
  lean_dec(x_9);
  lean_inc(x_1);
  x_11 = l_Lean_Meta_getMVarType(x_1, x_4, x_5, x_6, x_7, x_10);
  if (lean_obj_tag(x_11) == 0)
  {
  lean_object* x_12; lean_object* x_13; lean_object* x_14; 
  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);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_4);
  x_14 = lean_apply_6(x_3, x_12, x_4, x_5, x_6, x_7, x_13);
  if (lean_obj_tag(x_14) == 0)
  {
  lean_object* x_15; lean_object* x_16; uint8_t x_17; lean_object* x_18; 
  x_15 = lean_ctor_get(x_14, 0);
  lean_inc(x_15);
  x_16 = lean_ctor_get(x_14, 1);
  lean_inc(x_16);
  lean_dec(x_14);
  x_17 = 0;
  x_18 = l_Lean_Meta_change(x_1, x_15, x_17, x_4, x_5, x_6, x_7, x_16);
  return x_18;
  }
  else
  {
  uint8_t x_19; 
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_1);
  x_19 = !lean_is_exclusive(x_14);
  if (x_19 == 0)
  {
  return x_14;
  }
  else
  {
  lean_object* x_20; lean_object* x_21; lean_object* x_22; 
  x_20 = lean_ctor_get(x_14, 0);
  x_21 = lean_ctor_get(x_14, 1);
  lean_inc(x_21);
  lean_inc(x_20);
  lean_dec(x_14);
  x_22 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_22, 0, x_20);
  lean_ctor_set(x_22, 1, x_21);
  return x_22;
  }
  }
  }
  else
  {
  uint8_t x_23; 
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_23 = !lean_is_exclusive(x_11);
  if (x_23 == 0)
  {
  return x_11;
  }
  else
  {
  lean_object* x_24; lean_object* x_25; lean_object* x_26; 
  x_24 = lean_ctor_get(x_11, 0);
  x_25 = lean_ctor_get(x_11, 1);
  lean_inc(x_25);
  lean_inc(x_24);
  lean_dec(x_11);
  x_26 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_26, 0, x_24);
  lean_ctor_set(x_26, 1, x_25);
  return x_26;
  }
  }
  }
  else
  {
  uint8_t x_27; 
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_1);
  x_27 = !lean_is_exclusive(x_9);
  if (x_27 == 0)
  {
  return x_9;
  }
  else
  {
  lean_object* x_28; lean_object* x_29; lean_object* x_30; 
  x_28 = lean_ctor_get(x_9, 0);
  x_29 = lean_ctor_get(x_9, 1);
  lean_inc(x_29);
  lean_inc(x_28);
  lean_dec(x_9);
  x_30 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_30, 0, x_28);
  lean_ctor_set(x_30, 1, x_29);
  return x_30;
  }
  }
  }
  }
  static lean_object* _init_l_Lean_Meta_modifyTarget___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("modifyTarget");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_modifyTarget___closed__2() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; lean_object* x_3; 
  x_1 = lean_box(0);
  x_2 = l_Lean_Meta_modifyTarget___closed__1;
  x_3 = lean_name_mk_string(x_1, x_2);
  return x_3;
  }
  }
  lean_object* l_Lean_Meta_modifyTarget(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; 
  x_8 = l_Lean_Meta_modifyTarget___closed__2;
  lean_inc(x_1);
  x_9 = lean_alloc_closure((void*)(l_Lean_Meta_modifyTarget___lambda__1), 8, 3);
  lean_closure_set(x_9, 0, x_1);
  lean_closure_set(x_9, 1, x_8);
  lean_closure_set(x_9, 2, x_2);
  x_10 = l_Lean_Meta_withMVarContext___at___private_Lean_Meta_SynthInstance_0__Lean_Meta_synthPendingImp___spec__1___rarg(x_1, x_9, x_3, x_4, x_5, x_6, x_7);
  return x_10;
  }
  }
  static lean_object* _init_l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__1() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("modifyTargetEqLHS");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__2() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; lean_object* x_3; 
  x_1 = lean_box(0);
  x_2 = l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__1;
  x_3 = lean_name_mk_string(x_1, x_2);
  return x_3;
  }
  }
  static lean_object* _init_l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__3() {
  _start:
  {
  lean_object* x_1; 
  x_1 = lean_mk_string("equality expected");
  return x_1;
  }
  }
  static lean_object* _init_l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__4() {
  _start:
  {
  lean_object* x_1; lean_object* x_2; 
  x_1 = l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__3;
  x_2 = l_Lean_stringToMessageData(x_1);
  return x_2;
  }
  }
  lean_object* l_Lean_Meta_modifyTargetEqLHS___lambda__1(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, lean_object* x_8) {
  _start:
  {
  lean_object* x_9; 
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_4);
  lean_inc(x_3);
  x_9 = l_Lean_Meta_matchEq_x3f(x_3, x_4, x_5, x_6, x_7, x_8);
  if (lean_obj_tag(x_9) == 0)
  {
  lean_object* x_10; 
  x_10 = lean_ctor_get(x_9, 0);
  lean_inc(x_10);
  if (lean_obj_tag(x_10) == 0)
  {
  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; lean_object* x_19; 
  lean_dec(x_2);
  x_11 = lean_ctor_get(x_9, 1);
  lean_inc(x_11);
  lean_dec(x_9);
  x_12 = l_Lean_indentExpr(x_3);
  x_13 = l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__4;
  x_14 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_14, 0, x_13);
  lean_ctor_set(x_14, 1, x_12);
  x_15 = l_Lean_Meta_change___lambda__2___closed__6;
  x_16 = lean_alloc_ctor(10, 2, 0);
  lean_ctor_set(x_16, 0, x_14);
  lean_ctor_set(x_16, 1, x_15);
  x_17 = l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__2;
  x_18 = lean_box(0);
  x_19 = l_Lean_Meta_throwTacticEx___rarg(x_17, x_1, x_16, x_18, x_4, x_5, x_6, x_7, x_11);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_4);
  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_dec(x_3);
  lean_dec(x_1);
  x_20 = lean_ctor_get(x_10, 0);
  lean_inc(x_20);
  lean_dec(x_10);
  x_21 = lean_ctor_get(x_20, 1);
  lean_inc(x_21);
  lean_dec(x_20);
  x_22 = lean_ctor_get(x_9, 1);
  lean_inc(x_22);
  lean_dec(x_9);
  x_23 = lean_ctor_get(x_21, 0);
  lean_inc(x_23);
  x_24 = lean_ctor_get(x_21, 1);
  lean_inc(x_24);
  lean_dec(x_21);
  lean_inc(x_7);
  lean_inc(x_6);
  lean_inc(x_5);
  lean_inc(x_4);
  x_25 = lean_apply_6(x_2, x_23, x_4, x_5, x_6, x_7, x_22);
  if (lean_obj_tag(x_25) == 0)
  {
  lean_object* x_26; lean_object* x_27; lean_object* x_28; 
  x_26 = lean_ctor_get(x_25, 0);
  lean_inc(x_26);
  x_27 = lean_ctor_get(x_25, 1);
  lean_inc(x_27);
  lean_dec(x_25);
  x_28 = l_Lean_Meta_mkEq(x_26, x_24, x_4, x_5, x_6, x_7, x_27);
  return x_28;
  }
  else
  {
  uint8_t x_29; 
  lean_dec(x_24);
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  x_29 = !lean_is_exclusive(x_25);
  if (x_29 == 0)
  {
  return x_25;
  }
  else
  {
  lean_object* x_30; lean_object* x_31; lean_object* x_32; 
  x_30 = lean_ctor_get(x_25, 0);
  x_31 = lean_ctor_get(x_25, 1);
  lean_inc(x_31);
  lean_inc(x_30);
  lean_dec(x_25);
  x_32 = lean_alloc_ctor(1, 2, 0);
  lean_ctor_set(x_32, 0, x_30);
  lean_ctor_set(x_32, 1, x_31);
  return x_32;
  }
  }
  }
  }
  else
  {
  uint8_t x_33; 
  lean_dec(x_7);
  lean_dec(x_6);
  lean_dec(x_5);
  lean_dec(x_4);
  lean_dec(x_3);
  lean_dec(x_2);
  lean_dec(x_1);
  x_33 = !lean_is_exclusive(x_9);
  if (x_33 == 0)
  {
  return x_9;
  }
  else
  {
  lean_object* x_34; lean_object* x_35; lean_object* x_36; 
  x_34 = lean_ctor_get(x_9, 0);
  x_35 = lean_ctor_get(x_9, 1);
  lean_inc(x_35);
  lean_inc(x_34);
  lean_dec(x_9);
  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_Meta_modifyTargetEqLHS(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_inc(x_1);
  x_8 = lean_alloc_closure((void*)(l_Lean_Meta_modifyTargetEqLHS___lambda__1), 8, 2);
  lean_closure_set(x_8, 0, x_1);
  lean_closure_set(x_8, 1, x_2);
  x_9 = l_Lean_Meta_modifyTarget(x_1, x_8, x_3, x_4, x_5, x_6, x_7);
  return x_9;
  }
  }
  lean_object* initialize_Init(lean_object*);
  lean_object* initialize_Lean_Util_ForEachExpr(lean_object*);
  lean_object* initialize_Lean_Meta_AppBuilder(lean_object*);
  lean_object* initialize_Lean_Meta_MatchUtil(lean_object*);
  lean_object* initialize_Lean_Meta_Tactic_Util(lean_object*);
  lean_object* initialize_Lean_Meta_Tactic_Revert(lean_object*);
  lean_object* initialize_Lean_Meta_Tactic_Intro(lean_object*);
  lean_object* initialize_Lean_Meta_Tactic_Clear(lean_object*);
  lean_object* initialize_Lean_Meta_Tactic_Assert(lean_object*);
  static bool _G_initialized = false;
  lean_object* initialize_Lean_Meta_Tactic_Replace(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_Util_ForEachExpr(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Lean_Meta_AppBuilder(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Lean_Meta_MatchUtil(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Lean_Meta_Tactic_Util(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Lean_Meta_Tactic_Revert(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Lean_Meta_Tactic_Intro(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Lean_Meta_Tactic_Clear(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  res = initialize_Lean_Meta_Tactic_Assert(lean_io_mk_world());
  if (lean_io_result_is_error(res)) return res;
  lean_dec_ref(res);
  l_Lean_Meta_replaceTargetEq___lambda__1___closed__1 = _init_l_Lean_Meta_replaceTargetEq___lambda__1___closed__1();
  lean_mark_persistent(l_Lean_Meta_replaceTargetEq___lambda__1___closed__1);
  l_Lean_Meta_replaceTargetEq___lambda__1___closed__2 = _init_l_Lean_Meta_replaceTargetEq___lambda__1___closed__2();
  lean_mark_persistent(l_Lean_Meta_replaceTargetEq___lambda__1___closed__2);
  l_Lean_Meta_replaceTargetEq___lambda__1___closed__3 = _init_l_Lean_Meta_replaceTargetEq___lambda__1___closed__3();
  lean_mark_persistent(l_Lean_Meta_replaceTargetEq___lambda__1___closed__3);
  l_Lean_Meta_replaceTargetEq___lambda__1___closed__4 = _init_l_Lean_Meta_replaceTargetEq___lambda__1___closed__4();
  lean_mark_persistent(l_Lean_Meta_replaceTargetEq___lambda__1___closed__4);
  l_Lean_Meta_replaceTargetEq___lambda__1___closed__5 = _init_l_Lean_Meta_replaceTargetEq___lambda__1___closed__5();
  lean_mark_persistent(l_Lean_Meta_replaceTargetEq___lambda__1___closed__5);
  l_Lean_Meta_replaceTargetEq___closed__1 = _init_l_Lean_Meta_replaceTargetEq___closed__1();
  lean_mark_persistent(l_Lean_Meta_replaceTargetEq___closed__1);
  l_Lean_Meta_replaceTargetEq___closed__2 = _init_l_Lean_Meta_replaceTargetEq___closed__2();
  lean_mark_persistent(l_Lean_Meta_replaceTargetEq___closed__2);
  l_Lean_Meta_replaceTargetDefEq___closed__1 = _init_l_Lean_Meta_replaceTargetDefEq___closed__1();
  lean_mark_persistent(l_Lean_Meta_replaceTargetDefEq___closed__1);
  l_Lean_Meta_replaceTargetDefEq___closed__2 = _init_l_Lean_Meta_replaceTargetDefEq___closed__2();
  lean_mark_persistent(l_Lean_Meta_replaceTargetDefEq___closed__2);
  l_Lean_Meta_replaceLocalDecl_findMaxFVar___closed__1 = _init_l_Lean_Meta_replaceLocalDecl_findMaxFVar___closed__1();
  lean_mark_persistent(l_Lean_Meta_replaceLocalDecl_findMaxFVar___closed__1);
  l_Lean_Meta_change___lambda__2___closed__1 = _init_l_Lean_Meta_change___lambda__2___closed__1();
  lean_mark_persistent(l_Lean_Meta_change___lambda__2___closed__1);
  l_Lean_Meta_change___lambda__2___closed__2 = _init_l_Lean_Meta_change___lambda__2___closed__2();
  lean_mark_persistent(l_Lean_Meta_change___lambda__2___closed__2);
  l_Lean_Meta_change___lambda__2___closed__3 = _init_l_Lean_Meta_change___lambda__2___closed__3();
  lean_mark_persistent(l_Lean_Meta_change___lambda__2___closed__3);
  l_Lean_Meta_change___lambda__2___closed__4 = _init_l_Lean_Meta_change___lambda__2___closed__4();
  lean_mark_persistent(l_Lean_Meta_change___lambda__2___closed__4);
  l_Lean_Meta_change___lambda__2___closed__5 = _init_l_Lean_Meta_change___lambda__2___closed__5();
  lean_mark_persistent(l_Lean_Meta_change___lambda__2___closed__5);
  l_Lean_Meta_change___lambda__2___closed__6 = _init_l_Lean_Meta_change___lambda__2___closed__6();
  lean_mark_persistent(l_Lean_Meta_change___lambda__2___closed__6);
  l_Lean_Meta_changeLocalDecl___lambda__1___closed__1 = _init_l_Lean_Meta_changeLocalDecl___lambda__1___closed__1();
  lean_mark_persistent(l_Lean_Meta_changeLocalDecl___lambda__1___closed__1);
  l_Lean_Meta_changeLocalDecl___lambda__1___closed__2 = _init_l_Lean_Meta_changeLocalDecl___lambda__1___closed__2();
  lean_mark_persistent(l_Lean_Meta_changeLocalDecl___lambda__1___closed__2);
  l_Lean_Meta_changeLocalDecl___lambda__1___closed__3 = _init_l_Lean_Meta_changeLocalDecl___lambda__1___closed__3();
  lean_mark_persistent(l_Lean_Meta_changeLocalDecl___lambda__1___closed__3);
  l_Lean_Meta_changeLocalDecl___lambda__1___closed__4 = _init_l_Lean_Meta_changeLocalDecl___lambda__1___closed__4();
  lean_mark_persistent(l_Lean_Meta_changeLocalDecl___lambda__1___closed__4);
  l_Lean_Meta_changeLocalDecl___lambda__1___closed__5 = _init_l_Lean_Meta_changeLocalDecl___lambda__1___closed__5();
  lean_mark_persistent(l_Lean_Meta_changeLocalDecl___lambda__1___closed__5);
  l_Lean_Meta_changeLocalDecl___closed__1 = _init_l_Lean_Meta_changeLocalDecl___closed__1();
  lean_mark_persistent(l_Lean_Meta_changeLocalDecl___closed__1);
  l_Lean_Meta_changeLocalDecl___closed__2 = _init_l_Lean_Meta_changeLocalDecl___closed__2();
  lean_mark_persistent(l_Lean_Meta_changeLocalDecl___closed__2);
  l_Lean_Meta_changeLocalDecl___closed__3 = _init_l_Lean_Meta_changeLocalDecl___closed__3();
  lean_mark_persistent(l_Lean_Meta_changeLocalDecl___closed__3);
  l_Lean_Meta_modifyTarget___closed__1 = _init_l_Lean_Meta_modifyTarget___closed__1();
  lean_mark_persistent(l_Lean_Meta_modifyTarget___closed__1);
  l_Lean_Meta_modifyTarget___closed__2 = _init_l_Lean_Meta_modifyTarget___closed__2();
  lean_mark_persistent(l_Lean_Meta_modifyTarget___closed__2);
  l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__1 = _init_l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__1();
  lean_mark_persistent(l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__1);
  l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__2 = _init_l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__2();
  lean_mark_persistent(l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__2);
  l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__3 = _init_l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__3();
  lean_mark_persistent(l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__3);
  l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__4 = _init_l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__4();
  lean_mark_persistent(l_Lean_Meta_modifyTargetEqLHS___lambda__1___closed__4);
  return lean_io_result_mk_ok(lean_box(0));
  }
  #ifdef __cplusplus
  }
  #endif
  