diff --git a/library/init/lean/compiler/ir/emitc.lean b/library/init/lean/compiler/ir/emitc.lean index 746957c921..7a991f44b8 100644 --- a/library/init/lean/compiler/ir/emitc.lean +++ b/library/init/lean/compiler/ir/emitc.lean @@ -68,63 +68,29 @@ def toCType : IRType → String | IRType.tobject => "lean_object*" | IRType.irrelevant => "lean_object*" -def openNamespacesAux : Name → M Unit -| Name.anonymous => pure () -| Name.mkString p s => openNamespacesAux p *> emitLn ("namespace " ++ s ++ " {") -| n => throw ("invalid namespace '" ++ toString n ++ "'") - -def openNamespaces (n : Name) : M Unit := -openNamespacesAux n.getPrefix - -def openNamespacesFor (n : Name) : M Unit := -do env ← getEnv; - match getExportNameFor env n with - | none => pure () - | some n => openNamespaces n - -def closeNamespacesAux : Name → M Unit -| Name.anonymous => pure () -| Name.mkString p _ => emitLn "}" *> closeNamespacesAux p -| n => throw ("invalid namespace '" ++ toString n ++ "'") - -def closeNamespaces (n : Name) : M Unit := -closeNamespacesAux n.getPrefix - -def closeNamespacesFor (n : Name) : M Unit := -do env ← getEnv; - match getExportNameFor env n with - | none => pure () - | some n => closeNamespaces n - def throwInvalidExportName {α : Type} (n : Name) : M α := throw ("invalid export name '" ++ toString n ++ "'") -def toBaseCppName (n : Name) : M String := -do env ← getEnv; - match getExportNameFor env n with - | some (Name.mkString _ s) => pure s - | some _ => throwInvalidExportName n - | none => if n == `main then pure leanMainFn else pure n.mangle - def toCName (n : Name) : M String := do env ← getEnv; -- TODO: we should support simple export names only match getExportNameFor env n with - | some s => pure (s.toStringWithSep "::") - | none => if n == `main then pure leanMainFn else pure n.mangle + | some (Name.mkString Name.anonymous s) => pure s + | some _ => throwInvalidExportName n + | none => if n == `main then pure leanMainFn else pure n.mangle -def emitCppName (n : Name) : M Unit := +def emitCName (n : Name) : M Unit := toCName n >>= emit def toCInitName (n : Name) : M String := do env ← getEnv; -- TODO: we should support simple export names only match getExportNameFor env n with - | some (Name.mkString p s) => pure $ (Name.mkString p ("_init_" ++ s)).toStringWithSep "::" - | some _ => throwInvalidExportName n - | none => pure ("_init_" ++ n.mangle) + | some (Name.mkString Name.anonymous s) => pure $ "_init_" ++ s + | some _ => throwInvalidExportName n + | none => pure ("_init_" ++ n.mangle) -def emitCppInitName (n : Name) : M Unit := +def emitCInitName (n : Name) : M Unit := toCInitName n >>= emit def emitFnDeclAux (decl : Decl) (cppBaseName : String) (addExternForConsts : Bool) : M Unit := @@ -147,24 +113,15 @@ emitLn ";" def emitFnDecl (decl : Decl) (addExternForConsts : Bool) : M Unit := do -openNamespacesFor decl.name; -cppBaseName ← toBaseCppName decl.name; -emitFnDeclAux decl cppBaseName addExternForConsts; -closeNamespacesFor decl.name +cppBaseName ← toCName decl.name; +emitFnDeclAux decl cppBaseName addExternForConsts --- TODO: simple extern names only? -def cppQualifiedNameToName (s : String) : Name := -(s.split "::").foldl Name.mkString Name.anonymous - -def emitExternDeclAux (decl : Decl) (cppName : String) : M Unit := +def emitExternDeclAux (decl : Decl) (cNameStr : String) : M Unit := do -let qCppName := cppQualifiedNameToName cppName; -openNamespaces qCppName; +let cName := mkSimpleName cNameStr; env ← getEnv; let extC := isExternC env decl.name; -(Name.mkString _ qCppBaseName) ← pure qCppName | throw "invalid name"; -emitFnDeclAux decl qCppBaseName (!extC); -closeNamespaces qCppName +emitFnDeclAux decl cNameStr (!extC) def emitFnDecls : M Unit := do @@ -176,8 +133,8 @@ let usedDecls := usedDecls.toList; usedDecls.mfor $ fun n => do decl ← getDecl n; match getExternNameFor env `c decl.name with - | some cppName => emitExternDeclAux decl cppName - | none => emitFnDecl decl (!modDecls.contains n) + | some cName => emitExternDeclAux decl cName + | none => emitFnDecl decl (!modDecls.contains n) def emitMainFn : M Unit := do @@ -347,7 +304,7 @@ when (n != 1) (do emit ", "; emit n); emitLn ");" def emitDel (x : VarId) : M Unit := -do emit "lean_free_heap_obj("; emit x; emitLn ");" +do emit "lean_free_object("; emit x; emitLn ");" def emitSetTag (x : VarId) (i : Nat) : M Unit := do emit "lean_ctor_set_tag("; emit x; emit ", "; emit i; emitLn ");" @@ -469,13 +426,13 @@ match decl with match mkExternCall extData `c (toStringArgs ys) with | some c => emit c *> emitLn ";" | none => throw ("failed to emit extern application '" ++ toString f ++ "'") -| _ => do emitCppName f; when (ys.size > 0) (do emit "("; emitArgs ys; emit ")"); emitLn ";" +| _ => do emitCName f; when (ys.size > 0) (do emit "("; emitArgs ys; emit ")"); emitLn ";" def emitPartialApp (z : VarId) (f : FunId) (ys : Array Arg) : M Unit := do decl ← getDecl f; let arity := decl.params.size; -emitLhs z; emit "lean_alloc_closure((void*)("; emitCppName f; emit "), "; emit arity; emit ", "; emit ys.size; emitLn ");"; +emitLhs z; emit "lean_alloc_closure((void*)("; emitCName f; emit "), "; emit arity; emit ", "; emit ys.size; emitLn ");"; ys.size.mfor $ fun i => do { let y := ys.get i; emit "lean_closure_set("; emit z; emit ", "; emit i; emit ", "; emitArg y; emitLn ");" @@ -668,8 +625,7 @@ adaptReader (fun (ctx : Context) => { varMap := vMap, jpMap := jpMap, .. ctx }) unless (hasInitAttr env d.name) $ match d with | Decl.fdecl f xs t b => do - openNamespacesFor f; - baseName ← toBaseCppName f; + baseName ← toCName f; emit (toCType t); emit " "; if xs.size > 0 then do { emit baseName; @@ -694,8 +650,7 @@ unless (hasInitAttr env d.name) $ }; emitLn "_start:"; adaptReader (fun (ctx : Context) => { mainFn := f, mainParams := xs, .. ctx }) (emitFnBody b); - emitLn "}"; - closeNamespacesFor f + emitLn "}" | _ => pure () def emitDecl (d : Decl) : M Unit := @@ -715,20 +670,20 @@ do env ← getEnv; let n := d.name; if isIOUnitInitFn env n then do { - emit "w = "; emitCppName n; emitLn "(w);"; + emit "w = "; emitCName n; emitLn "(w);"; emitLn "if (lean_io_result_is_error(w)) return w;" } else when (d.params.size == 0) $ do { match getInitFnNameFor env d.name with | some initFn => do { - emit "w = "; emitCppName initFn; emitLn "(w);"; + emit "w = "; emitCName initFn; emitLn "(w);"; emitLn "if (lean_io_result_is_error(w)) return w;"; - emitCppName n; emitLn " = lean_io_result_get_value(w);" + emitCName n; emitLn " = lean_io_result_get_value(w);" } | _ => do { - emitCppName n; emit " = "; emitCppInitName n; emitLn "();" + emitCName n; emit " = "; emitCInitName n; emitLn "();" }; when d.resultType.isObj $ do { - emit "lean_mark_persistent("; emitCppName n; emitLn ");" + emit "lean_mark_persistent("; emitCName n; emitLn ");" } } diff --git a/src/stage0/init/lean/compiler/ir/emitc.cpp b/src/stage0/init/lean/compiler/ir/emitc.cpp index cc04daa492..62ad37916f 100644 --- a/src/stage0/init/lean/compiler/ir/emitc.cpp +++ b/src/stage0/init/lean/compiler/ir/emitc.cpp @@ -26,7 +26,7 @@ obj* l_Lean_IR_EmitC_isIf___boxed(obj*); obj* l_Lean_IR_EmitC_emitMainFn___closed__27; obj* l_Lean_IR_EmitC_toCInitName___boxed(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitFnBody(obj*, obj*, obj*); -obj* l_Lean_IR_EmitC_openNamespacesFor___boxed(obj*, obj*, obj*); +obj* l_Lean_IR_EmitC_toCName___closed__3; obj* l_List_mfor___main___at_Lean_IR_EmitC_emitLns___spec__1___rarg(obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitCtor___boxed(obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emit___rarg___boxed(obj*, obj*, obj*, obj*); @@ -65,7 +65,6 @@ obj* l_Lean_IR_EmitC_emitFileFooter___boxed(obj*, obj*); obj* l_Lean_IR_EmitC_emitDeclAux___closed__2; obj* l_Lean_IR_EmitC_emitCase___closed__1; obj* l_Lean_IR_EmitC_emitJmp___boxed(obj*, obj*, obj*, obj*); -obj* l_Lean_IR_EmitC_closeNamespacesFor___boxed(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitCtorScalarSize___closed__1; extern obj* l_Lean_IR_JoinPointId_HasToString___closed__1; obj* l_Lean_IR_EmitC_emitReset___boxed(obj*, obj*, obj*, obj*, obj*); @@ -79,12 +78,10 @@ obj* l_Lean_IR_EmitC_emitInc___closed__3; obj* l_Lean_IR_EmitC_emitDecl(obj*, obj*, obj*); obj* l_List_mfor___main___at_Lean_IR_EmitC_emitFnDecls___spec__5(obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitFileHeader___closed__23; -obj* l_Lean_IR_EmitC_emitCppInitName___boxed(obj*, obj*, obj*); extern obj* l_Char_quoteCore___closed__3; obj* l_Nat_mforAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3(obj*, obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_declareVars___boxed(obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_declareParams___boxed(obj*, obj*, obj*); -obj* l_Lean_IR_EmitC_emitCppInitName(obj*, obj*, obj*); obj* l_List_mfor___main___at_Lean_IR_EmitC_emitMainFn___spec__2___boxed(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitMainFn___closed__14; obj* l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(obj*, obj*, obj*, obj*, obj*); @@ -100,13 +97,11 @@ obj* l_Lean_IR_EmitC_emitMainFn___closed__38; obj* l_Lean_IR_EmitC_emitMainFn___closed__1; obj* l_Lean_IR_EmitC_emitNumLit___closed__3; obj* l_Lean_IR_EmitC_emitSSet___closed__5; -obj* l_Lean_IR_EmitC_openNamespacesAux___main___closed__3; obj* l_Lean_IR_EmitC_emitMainFnIfNeeded___boxed(obj*, obj*); obj* l_Array_mforAux___main___at_Lean_IR_EmitC_emitFileHeader___spec__1___boxed(obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitOffset(obj*, obj*, obj*, obj*); -obj* l_Lean_IR_EmitC_openNamespacesAux___main___boxed(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitFileHeader___closed__10; -obj* l_Lean_IR_EmitC_toBaseCppName___boxed(obj*, obj*, obj*); +obj* l_Lean_IR_EmitC_toCName___closed__2; obj* l_Nat_mforAux___main___at_Lean_IR_EmitC_emitCtorSetArgs___spec__1___boxed(obj*, obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitFileHeader___closed__6; obj* l_Lean_IR_EmitC_emitApp___closed__2; @@ -155,7 +150,6 @@ obj* l_Lean_IR_EmitC_emitFnDeclAux(obj*, obj*, uint8, obj*, obj*); obj* l_Lean_IR_EmitC_toCType___closed__2; uint8 l_Lean_IR_ExplicitBoxing_isBoxedName(obj*); obj* l_Lean_IR_EmitC_emitFileFooter___closed__2; -obj* l_Lean_IR_EmitC_openNamespacesAux(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitDeclAux(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_leanMainFn___closed__1; obj* l_Array_mforAux___main___at_Lean_IR_EmitC_emitCase___spec__1___boxed(obj*, obj*, obj*, obj*, obj*); @@ -201,7 +195,6 @@ obj* l_Lean_IR_EmitC_quoteString(obj*); obj* l_Nat_repr(obj*); obj* l_Lean_IR_EmitC_emitMainFn___boxed(obj*, obj*); extern obj* l_String_quote___closed__1; -obj* l_Lean_IR_EmitC_openNamespacesFor(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitPartialApp___boxed(obj*, obj*, obj*, obj*, obj*); uint8 l_Lean_hasInitAttr(obj*, obj*); obj* l_Lean_IR_EmitC_emitJPs___main(obj*, obj*, obj*, obj*); @@ -216,7 +209,6 @@ obj* l_Lean_IR_EmitC_emitNumLit___closed__1; obj* l_Nat_mforAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2___boxed(obj*, obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_toStringArgs___boxed(obj*); obj* l_Lean_IR_EmitC_emitInitFn(obj*, obj*); -obj* l_Lean_IR_EmitC_toBaseCppName(obj*, obj*, obj*); obj* l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_AltCore_body(obj*); obj* l_Lean_IR_EmitC_emitMainFn(obj*, obj*); @@ -236,8 +228,6 @@ obj* l_Lean_IR_EmitC_emitMainFn___closed__31; extern obj* l_Char_quoteCore___closed__2; obj* l_Lean_IR_EmitC_emitMainFn___closed__12; obj* l_Lean_IR_EmitC_emitMainFn___closed__15; -obj* l_Lean_IR_EmitC_openNamespaces___boxed(obj*, obj*, obj*); -obj* l_Lean_IR_EmitC_closeNamespacesFor(obj*, obj*, obj*); obj* lean_string_append(obj*, obj*); obj* l_Lean_IR_EmitC_emitIf___closed__2; obj* l_Lean_IR_EmitC_emitReset(obj*, obj*, obj*, obj*, obj*); @@ -259,12 +249,10 @@ obj* l_Lean_IR_EmitC_emitApp___closed__3; obj* l_HashMapImp_find___at_Lean_IR_EmitC_isObj___spec__1___boxed(obj*, obj*); extern obj* l_Option_HasRepr___rarg___closed__3; extern obj* l_Lean_IR_formatFnBody___main___closed__3; -obj* l_Lean_IR_EmitC_toBaseCppName___closed__1; uint8 lean_nat_dec_lt(obj*, obj*); obj* l_Lean_IR_EmitC_declareVar___closed__1; obj* l_Lean_IR_EmitC_emitFileHeader___closed__21; obj* l_Lean_IR_EmitC_emitMainFn___closed__36; -obj* l_Lean_IR_EmitC_toBaseCppName___closed__3; uint8 l_Lean_isExternC(obj*, obj*); obj* l_Lean_IR_EmitC_emitLns___at_Lean_IR_EmitC_emitMainFn___spec__1(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_main(obj*, obj*); @@ -276,19 +264,15 @@ obj* l_AssocList_find___main___at_Lean_IR_EmitC_isObj___spec__2___boxed(obj*, ob obj* l_Lean_IR_EmitC_emitFileHeader___closed__11; obj* l_AssocList_find___main___at_Lean_IR_EmitC_isObj___spec__2(obj*, obj*); extern obj* l_Char_HasRepr___closed__1; -obj* l_Lean_IR_EmitC_closeNamespacesAux___main___boxed(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitMainFn___closed__34; obj* l_List_mfor___main___at_Lean_IR_EmitC_emitFnDecls___spec__5___closed__1; obj* l_Lean_IR_EmitC_emitMainFn___closed__4; obj* l_Lean_IR_EmitC_emitNumLit___closed__4; -obj* l_Lean_Name_getPrefix(obj*); obj* l_Lean_IR_EmitC_emitArg(obj*, obj*, obj*); obj* l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__1___boxed(obj*, obj*); -obj* l_Lean_IR_EmitC_openNamespacesAux___main___closed__1; extern obj* l_Lean_IR_declMapExt; obj* l_Nat_mforAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2(obj*, obj*, obj*, obj*, obj*, obj*); obj* l_Array_fget(obj*, obj*, obj*); -obj* l_Lean_IR_EmitC_cppQualifiedNameToName(obj*); obj* l_Lean_IR_EmitC_emitCtorScalarSize___boxed(obj*, obj*, obj*, obj*); obj* lean_name_mk_string(obj*, obj*); obj* l_Array_mforAux___main___at_Lean_IR_EmitC_declareParams___spec__1(obj*, obj*, obj*, obj*); @@ -298,7 +282,6 @@ obj* l_Lean_IR_EmitC_emitMainFn___closed__39; obj* l_Array_mforAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__2; obj* l_Array_mforAux___main___at_Lean_IR_EmitC_emitCase___spec__1___closed__1; extern obj* l_Char_quoteCore___closed__5; -obj* l_List_foldl___main___at_Lean_moduleNameOfFileName___spec__1(obj*, obj*); obj* lean_nat_add(obj*, obj*); obj* l_Lean_IR_EmitC_throwUnknownVar(obj*); obj* l_Lean_IR_EmitC_emitMainFn___closed__13; @@ -311,10 +294,8 @@ extern obj* l_Prod_HasRepr___rarg___closed__1; obj* l_Lean_IR_EmitC_emitVDecl___boxed(obj*, obj*, obj*, obj*, obj*); extern obj* l_Lean_IR_paramInh; uint8 l_Array_isEmpty___rarg(obj*); -obj* l_Lean_IR_EmitC_closeNamespaces(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitArgs___boxed(obj*, obj*, obj*); obj* l_String_foldlAux___main___at_Lean_IR_EmitC_quoteString___spec__1(obj*, obj*, obj*, obj*); -obj* l_Lean_IR_EmitC_openNamespacesAux___main(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitMainFn___closed__32; obj* l_Lean_IR_EmitC_emitDec___closed__1; obj* l_Lean_IR_EmitC_emitMainFn___closed__10; @@ -376,10 +357,11 @@ obj* l_Nat_mforAux___main___at_Lean_IR_EmitC_emitReset___spec__1(obj*, obj*, obj obj* l_Lean_IR_EmitC_emitMainFn___closed__3; obj* l_Lean_IR_EmitC_emitUProj(obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitReuse___closed__1; +obj* l_Lean_IR_EmitC_emitCInitName(obj*, obj*, obj*); obj* l_HashMapImp_find___at_Lean_IR_EmitC_getJPParams___spec__1(obj*, obj*); +obj* l_Lean_IR_EmitC_emitDeclAux___closed__3; obj* l_Lean_IR_EmitC_emitFileHeader___closed__1; obj* l_Lean_IR_EmitC_emitArgs(obj*, obj*, obj*); -obj* l_Lean_IR_EmitC_openNamespaces(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitApp___boxed(obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitBlock___main___closed__1; obj* l_Lean_IR_EmitC_emitBoxFn(uint8, obj*, obj*); @@ -387,9 +369,7 @@ obj* l_Lean_IR_EmitC_emitFileFooter(obj*, obj*); obj* l_Lean_IR_EmitC_emitReset___closed__2; obj* l_List_mfor___main___at_Lean_IR_EmitC_emitLns___spec__1(obj*); extern obj* l_System_FilePath_dirName___closed__1; -obj* l_Lean_IR_EmitC_toBaseCppName___closed__2; obj* l_Lean_IR_EmitC_toCInitName(obj*, obj*, obj*); -obj* l_String_split(obj*, obj*); extern obj* l_Lean_closureMaxArgs; obj* l_List_mfor___main___at_Lean_IR_EmitC_emitLns___spec__1___rarg___boxed(obj*, obj*, obj*, obj*); obj* l_Lean_IR_Decl_name(obj*); @@ -407,9 +387,8 @@ obj* l_Lean_IR_findEnvDecl(obj*, obj*); obj* l_HashMapImp_find___at_Lean_IR_EmitC_getJPParams___spec__1___boxed(obj*, obj*); obj* l_Nat_mforAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1___closed__1; usize lean_usize_modn(usize, obj*); -obj* l_Lean_IR_EmitC_emitCppName___boxed(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_throwUnknownVar___rarg___boxed(obj*, obj*, obj*); -obj* l_Lean_IR_EmitC_emitExternDeclAux___closed__1; +obj* l_Lean_IR_EmitC_emitCName___boxed(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitSSet___closed__6; obj* l_Lean_IR_EmitC_emitMainFn___closed__28; obj* l_Lean_IR_EmitC_emitInitFn___closed__5; @@ -432,7 +411,6 @@ obj* l_Lean_IR_EmitC_emitFileHeader___closed__25; obj* l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__2(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitApp(obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitInitFn___closed__1; -obj* l_Lean_IR_EmitC_emitCppName(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_throwInvalidExportName(obj*); obj* l_Lean_IR_EmitC_emitMainFn___closed__8; obj* l_Array_get(obj*, obj*, obj*, obj*); @@ -440,6 +418,7 @@ obj* l_Array_mforAux___main___at_Lean_IR_EmitC_emitCase___spec__1(obj*, obj*, ob obj* l_Lean_IR_EmitC_emitReuse___closed__2; obj* l_Lean_IR_EmitC_toCType___boxed(obj*); obj* l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__3; +obj* l_Lean_IR_EmitC_emitCName(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1; obj* l_Lean_IR_EmitC_emitDec___boxed(obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emit___rarg(obj*, obj*, obj*, obj*); @@ -450,7 +429,6 @@ obj* l_Nat_mforAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1(obj*, obj* obj* l_Lean_IR_EmitC_emitFullApp___closed__1; obj* l_Lean_IR_EmitC_emitIf___closed__1; obj* l_Lean_Environment_imports(obj*); -obj* l_Lean_IR_EmitC_closeNamespacesAux___boxed(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_getJPParams(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_isTailCall(obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitExternDeclAux(obj*, obj*, obj*, obj*); @@ -468,10 +446,8 @@ obj* l_Lean_IR_EmitC_emitBoxFn___closed__3; obj* l_Lean_IR_EmitC_emitFullApp___boxed(obj*, obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitDeclInit___closed__1; obj* l_Lean_IR_EmitC_emitInitFn___boxed(obj*, obj*); -obj* l_Lean_IR_EmitC_closeNamespacesAux___main(obj*, obj*, obj*); uint8 lean_nat_dec_le(obj*, obj*); obj* l_Lean_IR_EmitC_emitInc(obj*, obj*, uint8, obj*, obj*); -obj* l_Lean_IR_EmitC_openNamespacesAux___main___closed__2; obj* l_Lean_IR_EmitC_emitLn___rarg___boxed(obj*, obj*, obj*, obj*); obj* l_Lean_IR_EmitC_getDecl___boxed(obj*, obj*, obj*); usize lean_usize_of_nat(obj*); @@ -480,7 +456,6 @@ obj* l_Lean_IR_EmitC_emitMainFn___closed__44; obj* l_List_mfor___main___at_Lean_IR_EmitC_emitFns___spec__1(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitLns(obj*); obj* l_Lean_IR_EmitC_emitInitFn___closed__6; -obj* l_Lean_IR_EmitC_closeNamespaces___boxed(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_emitFileHeader(obj*, obj*); obj* l_Lean_IR_EmitC_emitFnBody___main___closed__1; obj* lean_string_utf8_byte_size(obj*); @@ -494,7 +469,6 @@ obj* l_Lean_IR_EmitC_emitIf(obj*, obj*, obj*, obj*, obj*, obj*, obj*); obj* lean_uint32_to_nat(uint32); obj* l_Lean_IR_EmitC_argToCString___closed__1; obj* l_Lean_IR_EmitC_emitJmp___closed__1; -obj* l_Lean_IR_EmitC_closeNamespacesAux(obj*, obj*, obj*); obj* l_Lean_IR_EmitC_toCType___closed__6; obj* l_Lean_IR_EmitC_emitFileHeader___closed__24; obj* l_Lean_IR_EmitC_hasMainFn(obj*, obj*); @@ -546,6 +520,7 @@ obj* l_Lean_IR_EmitC_toCType___closed__1; obj* l_Lean_IR_EmitC_emitFileHeader___closed__5; obj* l_Lean_IR_EmitC_emitCase___closed__2; obj* l_Array_mforAux___main___at_Lean_IR_EmitC_emitCase___spec__1___closed__2; +obj* l_Lean_IR_EmitC_emitCInitName___boxed(obj*, obj*, obj*); extern obj* l_Unit_HasRepr___closed__1; obj* l_Lean_IR_EmitC_toStringArgs(obj*); obj* l_AssocList_find___main___at_Lean_IR_EmitC_getJPParams___spec__2(obj*, obj*); @@ -554,7 +529,6 @@ obj* l_Lean_IR_EmitC_emitNumLit(uint8, obj*, obj*, obj*); extern obj* l_String_splitAux___main___closed__1; obj* l_Lean_IR_EmitC_emitDel___closed__1; obj* l_Lean_IR_EmitC_emitDeclInit___closed__3; -obj* l_Lean_IR_EmitC_openNamespacesAux___boxed(obj*, obj*, obj*); obj* lean_ir_emit_c(obj*, obj*); obj* _init_l_Lean_IR_EmitC_leanMainFn___closed__1() { _start: @@ -1189,606 +1163,6 @@ x_3 = l_Lean_IR_EmitC_toCType(x_2); return x_3; } } -obj* _init_l_Lean_IR_EmitC_openNamespacesAux___main___closed__1() { -_start: -{ -obj* x_1; -x_1 = lean::mk_string("namespace "); -return x_1; -} -} -obj* _init_l_Lean_IR_EmitC_openNamespacesAux___main___closed__2() { -_start: -{ -obj* x_1; -x_1 = lean::mk_string(" {"); -return x_1; -} -} -obj* _init_l_Lean_IR_EmitC_openNamespacesAux___main___closed__3() { -_start: -{ -obj* x_1; -x_1 = lean::mk_string("invalid namespace '"); -return x_1; -} -} -obj* l_Lean_IR_EmitC_openNamespacesAux___main(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -switch (lean::obj_tag(x_1)) { -case 0: -{ -uint8 x_4; -x_4 = !lean::is_exclusive(x_3); -if (x_4 == 0) -{ -obj* x_5; obj* x_6; -x_5 = lean::cnstr_get(x_3, 0); -lean::dec(x_5); -x_6 = lean::box(0); -lean::cnstr_set(x_3, 0, x_6); -return x_3; -} -else -{ -obj* x_7; obj* x_8; obj* x_9; -x_7 = lean::cnstr_get(x_3, 1); -lean::inc(x_7); -lean::dec(x_3); -x_8 = lean::box(0); -x_9 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_9, 0, x_8); -lean::cnstr_set(x_9, 1, x_7); -return x_9; -} -} -case 1: -{ -obj* x_10; obj* x_11; obj* x_12; obj* x_13; obj* x_14; obj* x_15; obj* x_16; -x_10 = lean::cnstr_get(x_1, 0); -lean::inc(x_10); -x_11 = lean::cnstr_get(x_1, 1); -lean::inc(x_11); -lean::dec(x_1); -x_12 = l_Lean_IR_EmitC_openNamespacesAux___main___closed__1; -x_13 = lean_string_append(x_12, x_11); -lean::dec(x_11); -x_14 = l_Lean_IR_EmitC_openNamespacesAux___main___closed__2; -x_15 = lean_string_append(x_13, x_14); -x_16 = l_Lean_IR_EmitC_openNamespacesAux___main(x_10, x_2, x_3); -if (lean::obj_tag(x_16) == 0) -{ -uint8 x_17; -x_17 = !lean::is_exclusive(x_16); -if (x_17 == 0) -{ -obj* x_18; obj* x_19; obj* x_20; obj* x_21; obj* x_22; obj* x_23; -x_18 = lean::cnstr_get(x_16, 1); -x_19 = lean::cnstr_get(x_16, 0); -lean::dec(x_19); -x_20 = lean_string_append(x_18, x_15); -lean::dec(x_15); -x_21 = l_IO_println___rarg___closed__1; -x_22 = lean_string_append(x_20, x_21); -x_23 = lean::box(0); -lean::cnstr_set(x_16, 1, x_22); -lean::cnstr_set(x_16, 0, x_23); -return x_16; -} -else -{ -obj* x_24; obj* x_25; obj* x_26; obj* x_27; obj* x_28; obj* x_29; -x_24 = lean::cnstr_get(x_16, 1); -lean::inc(x_24); -lean::dec(x_16); -x_25 = lean_string_append(x_24, x_15); -lean::dec(x_15); -x_26 = l_IO_println___rarg___closed__1; -x_27 = lean_string_append(x_25, x_26); -x_28 = lean::box(0); -x_29 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_29, 0, x_28); -lean::cnstr_set(x_29, 1, x_27); -return x_29; -} -} -else -{ -uint8 x_30; -lean::dec(x_15); -x_30 = !lean::is_exclusive(x_16); -if (x_30 == 0) -{ -return x_16; -} -else -{ -obj* x_31; obj* x_32; obj* x_33; -x_31 = lean::cnstr_get(x_16, 0); -x_32 = lean::cnstr_get(x_16, 1); -lean::inc(x_32); -lean::inc(x_31); -lean::dec(x_16); -x_33 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_33, 0, x_31); -lean::cnstr_set(x_33, 1, x_32); -return x_33; -} -} -} -default: -{ -uint8 x_34; -x_34 = !lean::is_exclusive(x_3); -if (x_34 == 0) -{ -obj* x_35; obj* x_36; obj* x_37; obj* x_38; obj* x_39; obj* x_40; obj* x_41; -x_35 = lean::cnstr_get(x_3, 0); -lean::dec(x_35); -x_36 = l_System_FilePath_dirName___closed__1; -x_37 = l_Lean_Name_toStringWithSep___main(x_36, x_1); -x_38 = l_Lean_IR_EmitC_openNamespacesAux___main___closed__3; -x_39 = lean_string_append(x_38, x_37); -lean::dec(x_37); -x_40 = l_Char_HasRepr___closed__1; -x_41 = lean_string_append(x_39, x_40); -lean::cnstr_set_tag(x_3, 1); -lean::cnstr_set(x_3, 0, x_41); -return x_3; -} -else -{ -obj* x_42; obj* x_43; obj* x_44; obj* x_45; obj* x_46; obj* x_47; obj* x_48; obj* x_49; -x_42 = lean::cnstr_get(x_3, 1); -lean::inc(x_42); -lean::dec(x_3); -x_43 = l_System_FilePath_dirName___closed__1; -x_44 = l_Lean_Name_toStringWithSep___main(x_43, x_1); -x_45 = l_Lean_IR_EmitC_openNamespacesAux___main___closed__3; -x_46 = lean_string_append(x_45, x_44); -lean::dec(x_44); -x_47 = l_Char_HasRepr___closed__1; -x_48 = lean_string_append(x_46, x_47); -x_49 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_49, 0, x_48); -lean::cnstr_set(x_49, 1, x_42); -return x_49; -} -} -} -} -} -obj* l_Lean_IR_EmitC_openNamespacesAux___main___boxed(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_openNamespacesAux___main(x_1, x_2, x_3); -lean::dec(x_2); -return x_4; -} -} -obj* l_Lean_IR_EmitC_openNamespacesAux(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_openNamespacesAux___main(x_1, x_2, x_3); -return x_4; -} -} -obj* l_Lean_IR_EmitC_openNamespacesAux___boxed(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_openNamespacesAux(x_1, x_2, x_3); -lean::dec(x_2); -return x_4; -} -} -obj* l_Lean_IR_EmitC_openNamespaces(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; obj* x_5; -x_4 = l_Lean_Name_getPrefix(x_1); -x_5 = l_Lean_IR_EmitC_openNamespacesAux___main(x_4, x_2, x_3); -return x_5; -} -} -obj* l_Lean_IR_EmitC_openNamespaces___boxed(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_openNamespaces(x_1, x_2, x_3); -lean::dec(x_2); -lean::dec(x_1); -return x_4; -} -} -obj* l_Lean_IR_EmitC_openNamespacesFor(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_getEnv(x_2, x_3); -if (lean::obj_tag(x_4) == 0) -{ -uint8 x_5; -x_5 = !lean::is_exclusive(x_4); -if (x_5 == 0) -{ -obj* x_6; obj* x_7; obj* x_8; obj* x_9; obj* x_10; -x_6 = lean::cnstr_get(x_4, 0); -x_7 = lean::cnstr_get(x_4, 1); -x_8 = lean::box(0); -lean::inc(x_7); -lean::cnstr_set(x_4, 0, x_8); -x_9 = l_Lean_exportAttr; -x_10 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_9, x_6, x_1); -lean::dec(x_6); -if (lean::obj_tag(x_10) == 0) -{ -obj* x_11; -lean::dec(x_4); -x_11 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_11, 0, x_8); -lean::cnstr_set(x_11, 1, x_7); -return x_11; -} -else -{ -obj* x_12; obj* x_13; -lean::dec(x_7); -x_12 = lean::cnstr_get(x_10, 0); -lean::inc(x_12); -lean::dec(x_10); -x_13 = l_Lean_IR_EmitC_openNamespaces(x_12, x_2, x_4); -lean::dec(x_12); -return x_13; -} -} -else -{ -obj* x_14; obj* x_15; obj* x_16; obj* x_17; obj* x_18; obj* x_19; -x_14 = lean::cnstr_get(x_4, 0); -x_15 = lean::cnstr_get(x_4, 1); -lean::inc(x_15); -lean::inc(x_14); -lean::dec(x_4); -x_16 = lean::box(0); -lean::inc(x_15); -x_17 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_17, 0, x_16); -lean::cnstr_set(x_17, 1, x_15); -x_18 = l_Lean_exportAttr; -x_19 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_18, x_14, x_1); -lean::dec(x_14); -if (lean::obj_tag(x_19) == 0) -{ -obj* x_20; -lean::dec(x_17); -x_20 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_20, 0, x_16); -lean::cnstr_set(x_20, 1, x_15); -return x_20; -} -else -{ -obj* x_21; obj* x_22; -lean::dec(x_15); -x_21 = lean::cnstr_get(x_19, 0); -lean::inc(x_21); -lean::dec(x_19); -x_22 = l_Lean_IR_EmitC_openNamespaces(x_21, x_2, x_17); -lean::dec(x_21); -return x_22; -} -} -} -else -{ -uint8 x_23; -lean::dec(x_1); -x_23 = !lean::is_exclusive(x_4); -if (x_23 == 0) -{ -return x_4; -} -else -{ -obj* x_24; obj* x_25; obj* x_26; -x_24 = lean::cnstr_get(x_4, 0); -x_25 = lean::cnstr_get(x_4, 1); -lean::inc(x_25); -lean::inc(x_24); -lean::dec(x_4); -x_26 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_26, 0, x_24); -lean::cnstr_set(x_26, 1, x_25); -return x_26; -} -} -} -} -obj* l_Lean_IR_EmitC_openNamespacesFor___boxed(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_openNamespacesFor(x_1, x_2, x_3); -lean::dec(x_2); -return x_4; -} -} -obj* l_Lean_IR_EmitC_closeNamespacesAux___main(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -switch (lean::obj_tag(x_1)) { -case 0: -{ -uint8 x_4; -x_4 = !lean::is_exclusive(x_3); -if (x_4 == 0) -{ -obj* x_5; obj* x_6; -x_5 = lean::cnstr_get(x_3, 0); -lean::dec(x_5); -x_6 = lean::box(0); -lean::cnstr_set(x_3, 0, x_6); -return x_3; -} -else -{ -obj* x_7; obj* x_8; obj* x_9; -x_7 = lean::cnstr_get(x_3, 1); -lean::inc(x_7); -lean::dec(x_3); -x_8 = lean::box(0); -x_9 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_9, 0, x_8); -lean::cnstr_set(x_9, 1, x_7); -return x_9; -} -} -case 1: -{ -obj* x_10; uint8 x_11; -x_10 = lean::cnstr_get(x_1, 0); -lean::inc(x_10); -lean::dec(x_1); -x_11 = !lean::is_exclusive(x_3); -if (x_11 == 0) -{ -obj* x_12; obj* x_13; obj* x_14; obj* x_15; obj* x_16; obj* x_17; obj* x_18; -x_12 = lean::cnstr_get(x_3, 1); -x_13 = lean::cnstr_get(x_3, 0); -lean::dec(x_13); -x_14 = l_PersistentHashMap_Stats_toString___closed__5; -x_15 = lean_string_append(x_12, x_14); -x_16 = l_IO_println___rarg___closed__1; -x_17 = lean_string_append(x_15, x_16); -x_18 = lean::box(0); -lean::cnstr_set(x_3, 1, x_17); -lean::cnstr_set(x_3, 0, x_18); -x_1 = x_10; -goto _start; -} -else -{ -obj* x_20; obj* x_21; obj* x_22; obj* x_23; obj* x_24; obj* x_25; obj* x_26; -x_20 = lean::cnstr_get(x_3, 1); -lean::inc(x_20); -lean::dec(x_3); -x_21 = l_PersistentHashMap_Stats_toString___closed__5; -x_22 = lean_string_append(x_20, x_21); -x_23 = l_IO_println___rarg___closed__1; -x_24 = lean_string_append(x_22, x_23); -x_25 = lean::box(0); -x_26 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_26, 0, x_25); -lean::cnstr_set(x_26, 1, x_24); -x_1 = x_10; -x_3 = x_26; -goto _start; -} -} -default: -{ -uint8 x_28; -x_28 = !lean::is_exclusive(x_3); -if (x_28 == 0) -{ -obj* x_29; obj* x_30; obj* x_31; obj* x_32; obj* x_33; obj* x_34; obj* x_35; -x_29 = lean::cnstr_get(x_3, 0); -lean::dec(x_29); -x_30 = l_System_FilePath_dirName___closed__1; -x_31 = l_Lean_Name_toStringWithSep___main(x_30, x_1); -x_32 = l_Lean_IR_EmitC_openNamespacesAux___main___closed__3; -x_33 = lean_string_append(x_32, x_31); -lean::dec(x_31); -x_34 = l_Char_HasRepr___closed__1; -x_35 = lean_string_append(x_33, x_34); -lean::cnstr_set_tag(x_3, 1); -lean::cnstr_set(x_3, 0, x_35); -return x_3; -} -else -{ -obj* x_36; obj* x_37; obj* x_38; obj* x_39; obj* x_40; obj* x_41; obj* x_42; obj* x_43; -x_36 = lean::cnstr_get(x_3, 1); -lean::inc(x_36); -lean::dec(x_3); -x_37 = l_System_FilePath_dirName___closed__1; -x_38 = l_Lean_Name_toStringWithSep___main(x_37, x_1); -x_39 = l_Lean_IR_EmitC_openNamespacesAux___main___closed__3; -x_40 = lean_string_append(x_39, x_38); -lean::dec(x_38); -x_41 = l_Char_HasRepr___closed__1; -x_42 = lean_string_append(x_40, x_41); -x_43 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_43, 0, x_42); -lean::cnstr_set(x_43, 1, x_36); -return x_43; -} -} -} -} -} -obj* l_Lean_IR_EmitC_closeNamespacesAux___main___boxed(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_closeNamespacesAux___main(x_1, x_2, x_3); -lean::dec(x_2); -return x_4; -} -} -obj* l_Lean_IR_EmitC_closeNamespacesAux(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_closeNamespacesAux___main(x_1, x_2, x_3); -return x_4; -} -} -obj* l_Lean_IR_EmitC_closeNamespacesAux___boxed(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_closeNamespacesAux(x_1, x_2, x_3); -lean::dec(x_2); -return x_4; -} -} -obj* l_Lean_IR_EmitC_closeNamespaces(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; obj* x_5; -x_4 = l_Lean_Name_getPrefix(x_1); -x_5 = l_Lean_IR_EmitC_closeNamespacesAux___main(x_4, x_2, x_3); -return x_5; -} -} -obj* l_Lean_IR_EmitC_closeNamespaces___boxed(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_closeNamespaces(x_1, x_2, x_3); -lean::dec(x_2); -lean::dec(x_1); -return x_4; -} -} -obj* l_Lean_IR_EmitC_closeNamespacesFor(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_getEnv(x_2, x_3); -if (lean::obj_tag(x_4) == 0) -{ -uint8 x_5; -x_5 = !lean::is_exclusive(x_4); -if (x_5 == 0) -{ -obj* x_6; obj* x_7; obj* x_8; obj* x_9; obj* x_10; -x_6 = lean::cnstr_get(x_4, 0); -x_7 = lean::cnstr_get(x_4, 1); -x_8 = lean::box(0); -lean::inc(x_7); -lean::cnstr_set(x_4, 0, x_8); -x_9 = l_Lean_exportAttr; -x_10 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_9, x_6, x_1); -lean::dec(x_6); -if (lean::obj_tag(x_10) == 0) -{ -obj* x_11; -lean::dec(x_4); -x_11 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_11, 0, x_8); -lean::cnstr_set(x_11, 1, x_7); -return x_11; -} -else -{ -obj* x_12; obj* x_13; -lean::dec(x_7); -x_12 = lean::cnstr_get(x_10, 0); -lean::inc(x_12); -lean::dec(x_10); -x_13 = l_Lean_IR_EmitC_closeNamespaces(x_12, x_2, x_4); -lean::dec(x_12); -return x_13; -} -} -else -{ -obj* x_14; obj* x_15; obj* x_16; obj* x_17; obj* x_18; obj* x_19; -x_14 = lean::cnstr_get(x_4, 0); -x_15 = lean::cnstr_get(x_4, 1); -lean::inc(x_15); -lean::inc(x_14); -lean::dec(x_4); -x_16 = lean::box(0); -lean::inc(x_15); -x_17 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_17, 0, x_16); -lean::cnstr_set(x_17, 1, x_15); -x_18 = l_Lean_exportAttr; -x_19 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_18, x_14, x_1); -lean::dec(x_14); -if (lean::obj_tag(x_19) == 0) -{ -obj* x_20; -lean::dec(x_17); -x_20 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_20, 0, x_16); -lean::cnstr_set(x_20, 1, x_15); -return x_20; -} -else -{ -obj* x_21; obj* x_22; -lean::dec(x_15); -x_21 = lean::cnstr_get(x_19, 0); -lean::inc(x_21); -lean::dec(x_19); -x_22 = l_Lean_IR_EmitC_closeNamespaces(x_21, x_2, x_17); -lean::dec(x_21); -return x_22; -} -} -} -else -{ -uint8 x_23; -lean::dec(x_1); -x_23 = !lean::is_exclusive(x_4); -if (x_23 == 0) -{ -return x_4; -} -else -{ -obj* x_24; obj* x_25; obj* x_26; -x_24 = lean::cnstr_get(x_4, 0); -x_25 = lean::cnstr_get(x_4, 1); -lean::inc(x_25); -lean::inc(x_24); -lean::dec(x_4); -x_26 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_26, 0, x_24); -lean::cnstr_set(x_26, 1, x_25); -return x_26; -} -} -} -} -obj* l_Lean_IR_EmitC_closeNamespacesFor___boxed(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_closeNamespacesFor(x_1, x_2, x_3); -lean::dec(x_2); -return x_4; -} -} obj* _init_l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1() { _start: { @@ -1855,7 +1229,7 @@ lean::dec(x_2); return x_4; } } -obj* _init_l_Lean_IR_EmitC_toBaseCppName___closed__1() { +obj* _init_l_Lean_IR_EmitC_toCName___closed__1() { _start: { obj* x_1; @@ -1863,17 +1237,17 @@ x_1 = lean::mk_string("main"); return x_1; } } -obj* _init_l_Lean_IR_EmitC_toBaseCppName___closed__2() { +obj* _init_l_Lean_IR_EmitC_toCName___closed__2() { _start: { obj* x_1; obj* x_2; obj* x_3; x_1 = lean::box(0); -x_2 = l_Lean_IR_EmitC_toBaseCppName___closed__1; +x_2 = l_Lean_IR_EmitC_toCName___closed__1; x_3 = lean_name_mk_string(x_1, x_2); return x_3; } } -obj* _init_l_Lean_IR_EmitC_toBaseCppName___closed__3() { +obj* _init_l_Lean_IR_EmitC_toCName___closed__3() { _start: { obj* x_1; @@ -1881,7 +1255,7 @@ x_1 = lean::mk_string("l_"); return x_1; } } -obj* l_Lean_IR_EmitC_toBaseCppName(obj* x_1, obj* x_2, obj* x_3) { +obj* l_Lean_IR_EmitC_toCName(obj* x_1, obj* x_2, obj* x_3) { _start: { obj* x_4; @@ -1906,12 +1280,12 @@ if (lean::obj_tag(x_10) == 0) { obj* x_11; uint8 x_12; lean::dec(x_4); -x_11 = l_Lean_IR_EmitC_toBaseCppName___closed__2; +x_11 = l_Lean_IR_EmitC_toCName___closed__2; x_12 = lean_name_dec_eq(x_1, x_11); if (x_12 == 0) { obj* x_13; obj* x_14; obj* x_15; -x_13 = l_Lean_IR_EmitC_toBaseCppName___closed__3; +x_13 = l_Lean_IR_EmitC_toCName___closed__3; x_14 = l_Lean_Name_mangle(x_1, x_13); x_15 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_15, 0, x_14); @@ -1937,270 +1311,156 @@ lean::inc(x_18); lean::dec(x_10); if (lean::obj_tag(x_18) == 1) { -obj* x_19; obj* x_20; -lean::dec(x_4); -lean::dec(x_1); -x_19 = lean::cnstr_get(x_18, 1); +obj* x_19; obj* x_20; obj* x_21; uint8 x_22; +x_19 = lean::cnstr_get(x_18, 0); lean::inc(x_19); +x_20 = lean::cnstr_get(x_18, 1); +lean::inc(x_20); lean::dec(x_18); -x_20 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_20, 0, x_19); -lean::cnstr_set(x_20, 1, x_7); -return x_20; +x_21 = lean::box(0); +x_22 = lean_name_dec_eq(x_19, x_21); +lean::dec(x_19); +if (x_22 == 0) +{ +obj* x_23; +lean::dec(x_20); +lean::dec(x_7); +x_23 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_4); +return x_23; } else { -obj* x_21; +obj* x_24; +lean::dec(x_4); +lean::dec(x_1); +x_24 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_24, 0, x_20); +lean::cnstr_set(x_24, 1, x_7); +return x_24; +} +} +else +{ +obj* x_25; lean::dec(x_18); lean::dec(x_7); -x_21 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_4); -return x_21; +x_25 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_4); +return x_25; } } } else { -obj* x_22; obj* x_23; obj* x_24; obj* x_25; obj* x_26; obj* x_27; -x_22 = lean::cnstr_get(x_4, 0); -x_23 = lean::cnstr_get(x_4, 1); -lean::inc(x_23); -lean::inc(x_22); +obj* x_26; obj* x_27; obj* x_28; obj* x_29; obj* x_30; obj* x_31; +x_26 = lean::cnstr_get(x_4, 0); +x_27 = lean::cnstr_get(x_4, 1); +lean::inc(x_27); +lean::inc(x_26); lean::dec(x_4); -x_24 = lean::box(0); -lean::inc(x_23); -x_25 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_25, 0, x_24); -lean::cnstr_set(x_25, 1, x_23); -x_26 = l_Lean_exportAttr; +x_28 = lean::box(0); +lean::inc(x_27); +x_29 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_29, 0, x_28); +lean::cnstr_set(x_29, 1, x_27); +x_30 = l_Lean_exportAttr; lean::inc(x_1); -x_27 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_26, x_22, x_1); -lean::dec(x_22); -if (lean::obj_tag(x_27) == 0) +x_31 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_30, x_26, x_1); +lean::dec(x_26); +if (lean::obj_tag(x_31) == 0) { -obj* x_28; uint8 x_29; -lean::dec(x_25); -x_28 = l_Lean_IR_EmitC_toBaseCppName___closed__2; -x_29 = lean_name_dec_eq(x_1, x_28); -if (x_29 == 0) +obj* x_32; uint8 x_33; +lean::dec(x_29); +x_32 = l_Lean_IR_EmitC_toCName___closed__2; +x_33 = lean_name_dec_eq(x_1, x_32); +if (x_33 == 0) { -obj* x_30; obj* x_31; obj* x_32; -x_30 = l_Lean_IR_EmitC_toBaseCppName___closed__3; -x_31 = l_Lean_Name_mangle(x_1, x_30); -x_32 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_32, 0, x_31); -lean::cnstr_set(x_32, 1, x_23); -return x_32; +obj* x_34; obj* x_35; obj* x_36; +x_34 = l_Lean_IR_EmitC_toCName___closed__3; +x_35 = l_Lean_Name_mangle(x_1, x_34); +x_36 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_36, 0, x_35); +lean::cnstr_set(x_36, 1, x_27); +return x_36; } else { -obj* x_33; obj* x_34; +obj* x_37; obj* x_38; lean::dec(x_1); -x_33 = l_Lean_IR_EmitC_leanMainFn; -x_34 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_34, 0, x_33); -lean::cnstr_set(x_34, 1, x_23); -return x_34; -} -} -else -{ -obj* x_35; -x_35 = lean::cnstr_get(x_27, 0); -lean::inc(x_35); -lean::dec(x_27); -if (lean::obj_tag(x_35) == 1) -{ -obj* x_36; obj* x_37; -lean::dec(x_25); -lean::dec(x_1); -x_36 = lean::cnstr_get(x_35, 1); -lean::inc(x_36); -lean::dec(x_35); -x_37 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_37, 0, x_36); -lean::cnstr_set(x_37, 1, x_23); -return x_37; -} -else -{ -obj* x_38; -lean::dec(x_35); -lean::dec(x_23); -x_38 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_25); +x_37 = l_Lean_IR_EmitC_leanMainFn; +x_38 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_38, 0, x_37); +lean::cnstr_set(x_38, 1, x_27); return x_38; } } -} -} else { -uint8 x_39; -lean::dec(x_1); -x_39 = !lean::is_exclusive(x_4); -if (x_39 == 0) +obj* x_39; +x_39 = lean::cnstr_get(x_31, 0); +lean::inc(x_39); +lean::dec(x_31); +if (lean::obj_tag(x_39) == 1) { -return x_4; -} -else -{ -obj* x_40; obj* x_41; obj* x_42; -x_40 = lean::cnstr_get(x_4, 0); -x_41 = lean::cnstr_get(x_4, 1); -lean::inc(x_41); +obj* x_40; obj* x_41; obj* x_42; uint8 x_43; +x_40 = lean::cnstr_get(x_39, 0); lean::inc(x_40); +x_41 = lean::cnstr_get(x_39, 1); +lean::inc(x_41); +lean::dec(x_39); +x_42 = lean::box(0); +x_43 = lean_name_dec_eq(x_40, x_42); +lean::dec(x_40); +if (x_43 == 0) +{ +obj* x_44; +lean::dec(x_41); +lean::dec(x_27); +x_44 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_29); +return x_44; +} +else +{ +obj* x_45; +lean::dec(x_29); +lean::dec(x_1); +x_45 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_45, 0, x_41); +lean::cnstr_set(x_45, 1, x_27); +return x_45; +} +} +else +{ +obj* x_46; +lean::dec(x_39); +lean::dec(x_27); +x_46 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_29); +return x_46; +} +} +} +} +else +{ +uint8 x_47; +lean::dec(x_1); +x_47 = !lean::is_exclusive(x_4); +if (x_47 == 0) +{ +return x_4; +} +else +{ +obj* x_48; obj* x_49; obj* x_50; +x_48 = lean::cnstr_get(x_4, 0); +x_49 = lean::cnstr_get(x_4, 1); +lean::inc(x_49); +lean::inc(x_48); lean::dec(x_4); -x_42 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_42, 0, x_40); -lean::cnstr_set(x_42, 1, x_41); -return x_42; -} -} -} -} -obj* l_Lean_IR_EmitC_toBaseCppName___boxed(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_toBaseCppName(x_1, x_2, x_3); -lean::dec(x_2); -return x_4; -} -} -obj* _init_l_Lean_IR_EmitC_toCName___closed__1() { -_start: -{ -obj* x_1; -x_1 = lean::mk_string("::"); -return x_1; -} -} -obj* l_Lean_IR_EmitC_toCName(obj* x_1, obj* x_2, obj* x_3) { -_start: -{ -obj* x_4; -x_4 = l_Lean_IR_EmitC_getEnv(x_2, x_3); -if (lean::obj_tag(x_4) == 0) -{ -uint8 x_5; -x_5 = !lean::is_exclusive(x_4); -if (x_5 == 0) -{ -obj* x_6; obj* x_7; obj* x_8; -x_6 = lean::cnstr_get(x_4, 0); -x_7 = l_Lean_exportAttr; -lean::inc(x_1); -x_8 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_7, x_6, x_1); -lean::dec(x_6); -if (lean::obj_tag(x_8) == 0) -{ -obj* x_9; uint8 x_10; -x_9 = l_Lean_IR_EmitC_toBaseCppName___closed__2; -x_10 = lean_name_dec_eq(x_1, x_9); -if (x_10 == 0) -{ -obj* x_11; obj* x_12; -x_11 = l_Lean_IR_EmitC_toBaseCppName___closed__3; -x_12 = l_Lean_Name_mangle(x_1, x_11); -lean::cnstr_set(x_4, 0, x_12); -return x_4; -} -else -{ -obj* x_13; -lean::dec(x_1); -x_13 = l_Lean_IR_EmitC_leanMainFn; -lean::cnstr_set(x_4, 0, x_13); -return x_4; -} -} -else -{ -obj* x_14; obj* x_15; obj* x_16; -lean::dec(x_1); -x_14 = lean::cnstr_get(x_8, 0); -lean::inc(x_14); -lean::dec(x_8); -x_15 = l_Lean_IR_EmitC_toCName___closed__1; -x_16 = l_Lean_Name_toStringWithSep___main(x_15, x_14); -lean::cnstr_set(x_4, 0, x_16); -return x_4; -} -} -else -{ -obj* x_17; obj* x_18; obj* x_19; obj* x_20; -x_17 = lean::cnstr_get(x_4, 0); -x_18 = lean::cnstr_get(x_4, 1); -lean::inc(x_18); -lean::inc(x_17); -lean::dec(x_4); -x_19 = l_Lean_exportAttr; -lean::inc(x_1); -x_20 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_19, x_17, x_1); -lean::dec(x_17); -if (lean::obj_tag(x_20) == 0) -{ -obj* x_21; uint8 x_22; -x_21 = l_Lean_IR_EmitC_toBaseCppName___closed__2; -x_22 = lean_name_dec_eq(x_1, x_21); -if (x_22 == 0) -{ -obj* x_23; obj* x_24; obj* x_25; -x_23 = l_Lean_IR_EmitC_toBaseCppName___closed__3; -x_24 = l_Lean_Name_mangle(x_1, x_23); -x_25 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_25, 0, x_24); -lean::cnstr_set(x_25, 1, x_18); -return x_25; -} -else -{ -obj* x_26; obj* x_27; -lean::dec(x_1); -x_26 = l_Lean_IR_EmitC_leanMainFn; -x_27 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_27, 0, x_26); -lean::cnstr_set(x_27, 1, x_18); -return x_27; -} -} -else -{ -obj* x_28; obj* x_29; obj* x_30; obj* x_31; -lean::dec(x_1); -x_28 = lean::cnstr_get(x_20, 0); -lean::inc(x_28); -lean::dec(x_20); -x_29 = l_Lean_IR_EmitC_toCName___closed__1; -x_30 = l_Lean_Name_toStringWithSep___main(x_29, x_28); -x_31 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_31, 0, x_30); -lean::cnstr_set(x_31, 1, x_18); -return x_31; -} -} -} -else -{ -uint8 x_32; -lean::dec(x_1); -x_32 = !lean::is_exclusive(x_4); -if (x_32 == 0) -{ -return x_4; -} -else -{ -obj* x_33; obj* x_34; obj* x_35; -x_33 = lean::cnstr_get(x_4, 0); -x_34 = lean::cnstr_get(x_4, 1); -lean::inc(x_34); -lean::inc(x_33); -lean::dec(x_4); -x_35 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_35, 0, x_33); -lean::cnstr_set(x_35, 1, x_34); -return x_35; +x_50 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_50, 0, x_48); +lean::cnstr_set(x_50, 1, x_49); +return x_50; } } } @@ -2214,7 +1474,7 @@ lean::dec(x_2); return x_4; } } -obj* l_Lean_IR_EmitC_emitCppName(obj* x_1, obj* x_2, obj* x_3) { +obj* l_Lean_IR_EmitC_emitCName(obj* x_1, obj* x_2, obj* x_3) { _start: { obj* x_4; @@ -2276,11 +1536,11 @@ return x_18; } } } -obj* l_Lean_IR_EmitC_emitCppName___boxed(obj* x_1, obj* x_2, obj* x_3) { +obj* l_Lean_IR_EmitC_emitCName___boxed(obj* x_1, obj* x_2, obj* x_3) { _start: { obj* x_4; -x_4 = l_Lean_IR_EmitC_emitCppName(x_1, x_2, x_3); +x_4 = l_Lean_IR_EmitC_emitCName(x_1, x_2, x_3); lean::dec(x_2); return x_4; } @@ -2318,7 +1578,7 @@ if (lean::obj_tag(x_10) == 0) { obj* x_11; obj* x_12; obj* x_13; obj* x_14; obj* x_15; lean::dec(x_4); -x_11 = l_Lean_IR_EmitC_toBaseCppName___closed__3; +x_11 = l_Lean_IR_EmitC_toCName___closed__3; x_12 = l_Lean_Name_mangle(x_1, x_11); x_13 = l_Lean_IR_EmitC_toCInitName___closed__1; x_14 = lean_string_append(x_13, x_12); @@ -2336,25 +1596,37 @@ lean::inc(x_16); lean::dec(x_10); if (lean::obj_tag(x_16) == 1) { -obj* x_17; obj* x_18; obj* x_19; obj* x_20; obj* x_21; obj* x_22; obj* x_23; obj* x_24; -lean::dec(x_4); -lean::dec(x_1); +obj* x_17; obj* x_18; obj* x_19; uint8 x_20; x_17 = lean::cnstr_get(x_16, 0); lean::inc(x_17); x_18 = lean::cnstr_get(x_16, 1); lean::inc(x_18); lean::dec(x_16); -x_19 = l_Lean_IR_EmitC_toCInitName___closed__1; -x_20 = lean_string_append(x_19, x_18); +x_19 = lean::box(0); +x_20 = lean_name_dec_eq(x_17, x_19); +lean::dec(x_17); +if (x_20 == 0) +{ +obj* x_21; +lean::dec(x_18); +lean::dec(x_7); +x_21 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_4); +return x_21; +} +else +{ +obj* x_22; obj* x_23; obj* x_24; +lean::dec(x_4); +lean::dec(x_1); +x_22 = l_Lean_IR_EmitC_toCInitName___closed__1; +x_23 = lean_string_append(x_22, x_18); lean::dec(x_18); -x_21 = lean_name_mk_string(x_17, x_20); -x_22 = l_Lean_IR_EmitC_toCName___closed__1; -x_23 = l_Lean_Name_toStringWithSep___main(x_22, x_21); x_24 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_24, 0, x_23); lean::cnstr_set(x_24, 1, x_7); return x_24; } +} else { obj* x_25; @@ -2386,7 +1658,7 @@ if (lean::obj_tag(x_31) == 0) { obj* x_32; obj* x_33; obj* x_34; obj* x_35; obj* x_36; lean::dec(x_29); -x_32 = l_Lean_IR_EmitC_toBaseCppName___closed__3; +x_32 = l_Lean_IR_EmitC_toCName___closed__3; x_33 = l_Lean_Name_mangle(x_1, x_32); x_34 = l_Lean_IR_EmitC_toCInitName___closed__1; x_35 = lean_string_append(x_34, x_33); @@ -2404,25 +1676,37 @@ lean::inc(x_37); lean::dec(x_31); if (lean::obj_tag(x_37) == 1) { -obj* x_38; obj* x_39; obj* x_40; obj* x_41; obj* x_42; obj* x_43; obj* x_44; obj* x_45; -lean::dec(x_29); -lean::dec(x_1); +obj* x_38; obj* x_39; obj* x_40; uint8 x_41; x_38 = lean::cnstr_get(x_37, 0); lean::inc(x_38); x_39 = lean::cnstr_get(x_37, 1); lean::inc(x_39); lean::dec(x_37); -x_40 = l_Lean_IR_EmitC_toCInitName___closed__1; -x_41 = lean_string_append(x_40, x_39); +x_40 = lean::box(0); +x_41 = lean_name_dec_eq(x_38, x_40); +lean::dec(x_38); +if (x_41 == 0) +{ +obj* x_42; +lean::dec(x_39); +lean::dec(x_27); +x_42 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_29); +return x_42; +} +else +{ +obj* x_43; obj* x_44; obj* x_45; +lean::dec(x_29); +lean::dec(x_1); +x_43 = l_Lean_IR_EmitC_toCInitName___closed__1; +x_44 = lean_string_append(x_43, x_39); lean::dec(x_39); -x_42 = lean_name_mk_string(x_38, x_41); -x_43 = l_Lean_IR_EmitC_toCName___closed__1; -x_44 = l_Lean_Name_toStringWithSep___main(x_43, x_42); x_45 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_45, 0, x_44); lean::cnstr_set(x_45, 1, x_27); return x_45; } +} else { obj* x_46; @@ -2468,7 +1752,7 @@ lean::dec(x_2); return x_4; } } -obj* l_Lean_IR_EmitC_emitCppInitName(obj* x_1, obj* x_2, obj* x_3) { +obj* l_Lean_IR_EmitC_emitCInitName(obj* x_1, obj* x_2, obj* x_3) { _start: { obj* x_4; @@ -2530,11 +1814,11 @@ return x_18; } } } -obj* l_Lean_IR_EmitC_emitCppInitName___boxed(obj* x_1, obj* x_2, obj* x_3) { +obj* l_Lean_IR_EmitC_emitCInitName___boxed(obj* x_1, obj* x_2, obj* x_3) { _start: { obj* x_4; -x_4 = l_Lean_IR_EmitC_emitCppInitName(x_1, x_2, x_3); +x_4 = l_Lean_IR_EmitC_emitCInitName(x_1, x_2, x_3); lean::dec(x_2); return x_4; } @@ -2906,8 +2190,7 @@ _start: { obj* x_5; obj* x_6; x_5 = l_Lean_IR_Decl_name(x_1); -lean::inc(x_5); -x_6 = l_Lean_IR_EmitC_openNamespacesFor(x_5, x_3, x_4); +x_6 = l_Lean_IR_EmitC_toCName(x_5, x_3, x_4); if (lean::obj_tag(x_6) == 0) { uint8 x_7; @@ -2916,292 +2199,49 @@ if (x_7 == 0) { obj* x_8; obj* x_9; obj* x_10; x_8 = lean::cnstr_get(x_6, 0); -lean::dec(x_8); x_9 = lean::box(0); lean::cnstr_set(x_6, 0, x_9); -lean::inc(x_5); -x_10 = l_Lean_IR_EmitC_toBaseCppName(x_5, x_3, x_6); -if (lean::obj_tag(x_10) == 0) -{ -uint8 x_11; -x_11 = !lean::is_exclusive(x_10); -if (x_11 == 0) -{ -obj* x_12; obj* x_13; -x_12 = lean::cnstr_get(x_10, 0); -lean::cnstr_set(x_10, 0, x_9); -x_13 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_12, x_2, x_3, x_10); -lean::dec(x_12); -if (lean::obj_tag(x_13) == 0) -{ -uint8 x_14; -x_14 = !lean::is_exclusive(x_13); -if (x_14 == 0) -{ -obj* x_15; obj* x_16; -x_15 = lean::cnstr_get(x_13, 0); -lean::dec(x_15); -lean::cnstr_set(x_13, 0, x_9); -x_16 = l_Lean_IR_EmitC_closeNamespacesFor(x_5, x_3, x_13); -return x_16; -} -else -{ -obj* x_17; obj* x_18; obj* x_19; -x_17 = lean::cnstr_get(x_13, 1); -lean::inc(x_17); -lean::dec(x_13); -x_18 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_18, 0, x_9); -lean::cnstr_set(x_18, 1, x_17); -x_19 = l_Lean_IR_EmitC_closeNamespacesFor(x_5, x_3, x_18); -return x_19; -} -} -else -{ -uint8 x_20; -lean::dec(x_5); -x_20 = !lean::is_exclusive(x_13); -if (x_20 == 0) -{ -return x_13; -} -else -{ -obj* x_21; obj* x_22; obj* x_23; -x_21 = lean::cnstr_get(x_13, 0); -x_22 = lean::cnstr_get(x_13, 1); -lean::inc(x_22); -lean::inc(x_21); -lean::dec(x_13); -x_23 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_23, 0, x_21); -lean::cnstr_set(x_23, 1, x_22); -return x_23; -} -} -} -else -{ -obj* x_24; obj* x_25; obj* x_26; obj* x_27; -x_24 = lean::cnstr_get(x_10, 0); -x_25 = lean::cnstr_get(x_10, 1); -lean::inc(x_25); -lean::inc(x_24); -lean::dec(x_10); -x_26 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_26, 0, x_9); -lean::cnstr_set(x_26, 1, x_25); -x_27 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_24, x_2, x_3, x_26); -lean::dec(x_24); -if (lean::obj_tag(x_27) == 0) -{ -obj* x_28; obj* x_29; obj* x_30; obj* x_31; -x_28 = lean::cnstr_get(x_27, 1); -lean::inc(x_28); -if (lean::is_exclusive(x_27)) { - lean::cnstr_release(x_27, 0); - lean::cnstr_release(x_27, 1); - x_29 = x_27; -} else { - lean::dec_ref(x_27); - x_29 = lean::box(0); -} -if (lean::is_scalar(x_29)) { - x_30 = lean::alloc_cnstr(0, 2, 0); -} else { - x_30 = x_29; -} -lean::cnstr_set(x_30, 0, x_9); -lean::cnstr_set(x_30, 1, x_28); -x_31 = l_Lean_IR_EmitC_closeNamespacesFor(x_5, x_3, x_30); -return x_31; -} -else -{ -obj* x_32; obj* x_33; obj* x_34; obj* x_35; -lean::dec(x_5); -x_32 = lean::cnstr_get(x_27, 0); -lean::inc(x_32); -x_33 = lean::cnstr_get(x_27, 1); -lean::inc(x_33); -if (lean::is_exclusive(x_27)) { - lean::cnstr_release(x_27, 0); - lean::cnstr_release(x_27, 1); - x_34 = x_27; -} else { - lean::dec_ref(x_27); - x_34 = lean::box(0); -} -if (lean::is_scalar(x_34)) { - x_35 = lean::alloc_cnstr(1, 2, 0); -} else { - x_35 = x_34; -} -lean::cnstr_set(x_35, 0, x_32); -lean::cnstr_set(x_35, 1, x_33); -return x_35; -} -} -} -else -{ -uint8 x_36; -lean::dec(x_5); -x_36 = !lean::is_exclusive(x_10); -if (x_36 == 0) -{ +x_10 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_8, x_2, x_3, x_6); +lean::dec(x_8); return x_10; } else { -obj* x_37; obj* x_38; obj* x_39; -x_37 = lean::cnstr_get(x_10, 0); -x_38 = lean::cnstr_get(x_10, 1); -lean::inc(x_38); -lean::inc(x_37); -lean::dec(x_10); -x_39 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_39, 0, x_37); -lean::cnstr_set(x_39, 1, x_38); -return x_39; -} -} -} -else -{ -obj* x_40; obj* x_41; obj* x_42; obj* x_43; -x_40 = lean::cnstr_get(x_6, 1); -lean::inc(x_40); +obj* x_11; obj* x_12; obj* x_13; obj* x_14; obj* x_15; +x_11 = lean::cnstr_get(x_6, 0); +x_12 = lean::cnstr_get(x_6, 1); +lean::inc(x_12); +lean::inc(x_11); lean::dec(x_6); -x_41 = lean::box(0); -x_42 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_42, 0, x_41); -lean::cnstr_set(x_42, 1, x_40); -lean::inc(x_5); -x_43 = l_Lean_IR_EmitC_toBaseCppName(x_5, x_3, x_42); -if (lean::obj_tag(x_43) == 0) -{ -obj* x_44; obj* x_45; obj* x_46; obj* x_47; obj* x_48; -x_44 = lean::cnstr_get(x_43, 0); -lean::inc(x_44); -x_45 = lean::cnstr_get(x_43, 1); -lean::inc(x_45); -if (lean::is_exclusive(x_43)) { - lean::cnstr_release(x_43, 0); - lean::cnstr_release(x_43, 1); - x_46 = x_43; -} else { - lean::dec_ref(x_43); - x_46 = lean::box(0); -} -if (lean::is_scalar(x_46)) { - x_47 = lean::alloc_cnstr(0, 2, 0); -} else { - x_47 = x_46; -} -lean::cnstr_set(x_47, 0, x_41); -lean::cnstr_set(x_47, 1, x_45); -x_48 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_44, x_2, x_3, x_47); -lean::dec(x_44); -if (lean::obj_tag(x_48) == 0) -{ -obj* x_49; obj* x_50; obj* x_51; obj* x_52; -x_49 = lean::cnstr_get(x_48, 1); -lean::inc(x_49); -if (lean::is_exclusive(x_48)) { - lean::cnstr_release(x_48, 0); - lean::cnstr_release(x_48, 1); - x_50 = x_48; -} else { - lean::dec_ref(x_48); - x_50 = lean::box(0); -} -if (lean::is_scalar(x_50)) { - x_51 = lean::alloc_cnstr(0, 2, 0); -} else { - x_51 = x_50; -} -lean::cnstr_set(x_51, 0, x_41); -lean::cnstr_set(x_51, 1, x_49); -x_52 = l_Lean_IR_EmitC_closeNamespacesFor(x_5, x_3, x_51); -return x_52; -} -else -{ -obj* x_53; obj* x_54; obj* x_55; obj* x_56; -lean::dec(x_5); -x_53 = lean::cnstr_get(x_48, 0); -lean::inc(x_53); -x_54 = lean::cnstr_get(x_48, 1); -lean::inc(x_54); -if (lean::is_exclusive(x_48)) { - lean::cnstr_release(x_48, 0); - lean::cnstr_release(x_48, 1); - x_55 = x_48; -} else { - lean::dec_ref(x_48); - x_55 = lean::box(0); -} -if (lean::is_scalar(x_55)) { - x_56 = lean::alloc_cnstr(1, 2, 0); -} else { - x_56 = x_55; -} -lean::cnstr_set(x_56, 0, x_53); -lean::cnstr_set(x_56, 1, x_54); -return x_56; +x_13 = lean::box(0); +x_14 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_14, 0, x_13); +lean::cnstr_set(x_14, 1, x_12); +x_15 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_11, x_2, x_3, x_14); +lean::dec(x_11); +return x_15; } } else { -obj* x_57; obj* x_58; obj* x_59; obj* x_60; -lean::dec(x_5); -x_57 = lean::cnstr_get(x_43, 0); -lean::inc(x_57); -x_58 = lean::cnstr_get(x_43, 1); -lean::inc(x_58); -if (lean::is_exclusive(x_43)) { - lean::cnstr_release(x_43, 0); - lean::cnstr_release(x_43, 1); - x_59 = x_43; -} else { - lean::dec_ref(x_43); - x_59 = lean::box(0); -} -if (lean::is_scalar(x_59)) { - x_60 = lean::alloc_cnstr(1, 2, 0); -} else { - x_60 = x_59; -} -lean::cnstr_set(x_60, 0, x_57); -lean::cnstr_set(x_60, 1, x_58); -return x_60; -} -} -} -else -{ -uint8 x_61; -lean::dec(x_5); -x_61 = !lean::is_exclusive(x_6); -if (x_61 == 0) +uint8 x_16; +x_16 = !lean::is_exclusive(x_6); +if (x_16 == 0) { return x_6; } else { -obj* x_62; obj* x_63; obj* x_64; -x_62 = lean::cnstr_get(x_6, 0); -x_63 = lean::cnstr_get(x_6, 1); -lean::inc(x_63); -lean::inc(x_62); +obj* x_17; obj* x_18; obj* x_19; +x_17 = lean::cnstr_get(x_6, 0); +x_18 = lean::cnstr_get(x_6, 1); +lean::inc(x_18); +lean::inc(x_17); lean::dec(x_6); -x_64 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_64, 0, x_62); -lean::cnstr_set(x_64, 1, x_63); -return x_64; +x_19 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_19, 0, x_17); +lean::cnstr_set(x_19, 1, x_18); +return x_19; } } } @@ -3218,586 +2258,90 @@ lean::dec(x_1); return x_6; } } -obj* l_Lean_IR_EmitC_cppQualifiedNameToName(obj* x_1) { -_start: -{ -obj* x_2; obj* x_3; obj* x_4; obj* x_5; -x_2 = l_Lean_IR_EmitC_toCName___closed__1; -x_3 = l_String_split(x_1, x_2); -x_4 = lean::box(0); -x_5 = l_List_foldl___main___at_Lean_moduleNameOfFileName___spec__1(x_4, x_3); -return x_5; -} -} -obj* _init_l_Lean_IR_EmitC_emitExternDeclAux___closed__1() { -_start: -{ -obj* x_1; -x_1 = lean::mk_string("invalid name"); -return x_1; -} -} obj* l_Lean_IR_EmitC_emitExternDeclAux(obj* x_1, obj* x_2, obj* x_3, obj* x_4) { _start: { -obj* x_5; obj* x_6; -x_5 = l_Lean_IR_EmitC_cppQualifiedNameToName(x_2); -x_6 = l_Lean_IR_EmitC_openNamespaces(x_5, x_3, x_4); -if (lean::obj_tag(x_6) == 0) +obj* x_5; +x_5 = l_Lean_IR_EmitC_getEnv(x_3, x_4); +if (lean::obj_tag(x_5) == 0) { -uint8 x_7; -x_7 = !lean::is_exclusive(x_6); -if (x_7 == 0) +uint8 x_6; +x_6 = !lean::is_exclusive(x_5); +if (x_6 == 0) { -obj* x_8; obj* x_9; obj* x_10; -x_8 = lean::cnstr_get(x_6, 0); -lean::dec(x_8); -x_9 = lean::box(0); -lean::cnstr_set(x_6, 0, x_9); -x_10 = l_Lean_IR_EmitC_getEnv(x_3, x_6); -if (lean::obj_tag(x_10) == 0) +obj* x_7; obj* x_8; obj* x_9; uint8 x_10; +x_7 = lean::cnstr_get(x_5, 0); +x_8 = lean::box(0); +lean::cnstr_set(x_5, 0, x_8); +x_9 = l_Lean_IR_Decl_name(x_1); +x_10 = l_Lean_isExternC(x_7, x_9); +lean::dec(x_7); +if (x_10 == 0) { -if (lean::obj_tag(x_5) == 1) -{ -uint8 x_11; -x_11 = !lean::is_exclusive(x_10); -if (x_11 == 0) -{ -obj* x_12; obj* x_13; obj* x_14; uint8 x_15; -x_12 = lean::cnstr_get(x_10, 0); -x_13 = lean::cnstr_get(x_5, 1); -lean::inc(x_13); -x_14 = l_Lean_IR_Decl_name(x_1); -x_15 = l_Lean_isExternC(x_12, x_14); -lean::dec(x_12); -lean::cnstr_set(x_10, 0, x_9); -if (x_15 == 0) -{ -uint8 x_16; obj* x_17; -x_16 = 1; -x_17 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_13, x_16, x_3, x_10); -lean::dec(x_13); -if (lean::obj_tag(x_17) == 0) -{ -uint8 x_18; -x_18 = !lean::is_exclusive(x_17); -if (x_18 == 0) -{ -obj* x_19; obj* x_20; -x_19 = lean::cnstr_get(x_17, 0); -lean::dec(x_19); -lean::cnstr_set(x_17, 0, x_9); -x_20 = l_Lean_IR_EmitC_closeNamespaces(x_5, x_3, x_17); -lean::dec(x_5); -return x_20; +uint8 x_11; obj* x_12; +x_11 = 1; +x_12 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_2, x_11, x_3, x_5); +return x_12; } else { -obj* x_21; obj* x_22; obj* x_23; -x_21 = lean::cnstr_get(x_17, 1); -lean::inc(x_21); -lean::dec(x_17); -x_22 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_22, 0, x_9); -lean::cnstr_set(x_22, 1, x_21); -x_23 = l_Lean_IR_EmitC_closeNamespaces(x_5, x_3, x_22); -lean::dec(x_5); -return x_23; +uint8 x_13; obj* x_14; +x_13 = 0; +x_14 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_2, x_13, x_3, x_5); +return x_14; } } else { -uint8 x_24; +obj* x_15; obj* x_16; obj* x_17; obj* x_18; obj* x_19; uint8 x_20; +x_15 = lean::cnstr_get(x_5, 0); +x_16 = lean::cnstr_get(x_5, 1); +lean::inc(x_16); +lean::inc(x_15); lean::dec(x_5); -x_24 = !lean::is_exclusive(x_17); -if (x_24 == 0) +x_17 = lean::box(0); +x_18 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_18, 0, x_17); +lean::cnstr_set(x_18, 1, x_16); +x_19 = l_Lean_IR_Decl_name(x_1); +x_20 = l_Lean_isExternC(x_15, x_19); +lean::dec(x_15); +if (x_20 == 0) { -return x_17; +uint8 x_21; obj* x_22; +x_21 = 1; +x_22 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_2, x_21, x_3, x_18); +return x_22; } else { -obj* x_25; obj* x_26; obj* x_27; -x_25 = lean::cnstr_get(x_17, 0); -x_26 = lean::cnstr_get(x_17, 1); +uint8 x_23; obj* x_24; +x_23 = 0; +x_24 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_2, x_23, x_3, x_18); +return x_24; +} +} +} +else +{ +uint8 x_25; +x_25 = !lean::is_exclusive(x_5); +if (x_25 == 0) +{ +return x_5; +} +else +{ +obj* x_26; obj* x_27; obj* x_28; +x_26 = lean::cnstr_get(x_5, 0); +x_27 = lean::cnstr_get(x_5, 1); +lean::inc(x_27); lean::inc(x_26); -lean::inc(x_25); -lean::dec(x_17); -x_27 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_27, 0, x_25); -lean::cnstr_set(x_27, 1, x_26); -return x_27; -} -} -} -else -{ -uint8 x_28; obj* x_29; -x_28 = 0; -x_29 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_13, x_28, x_3, x_10); -lean::dec(x_13); -if (lean::obj_tag(x_29) == 0) -{ -uint8 x_30; -x_30 = !lean::is_exclusive(x_29); -if (x_30 == 0) -{ -obj* x_31; obj* x_32; -x_31 = lean::cnstr_get(x_29, 0); -lean::dec(x_31); -lean::cnstr_set(x_29, 0, x_9); -x_32 = l_Lean_IR_EmitC_closeNamespaces(x_5, x_3, x_29); lean::dec(x_5); -return x_32; -} -else -{ -obj* x_33; obj* x_34; obj* x_35; -x_33 = lean::cnstr_get(x_29, 1); -lean::inc(x_33); -lean::dec(x_29); -x_34 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_34, 0, x_9); -lean::cnstr_set(x_34, 1, x_33); -x_35 = l_Lean_IR_EmitC_closeNamespaces(x_5, x_3, x_34); -lean::dec(x_5); -return x_35; -} -} -else -{ -uint8 x_36; -lean::dec(x_5); -x_36 = !lean::is_exclusive(x_29); -if (x_36 == 0) -{ -return x_29; -} -else -{ -obj* x_37; obj* x_38; obj* x_39; -x_37 = lean::cnstr_get(x_29, 0); -x_38 = lean::cnstr_get(x_29, 1); -lean::inc(x_38); -lean::inc(x_37); -lean::dec(x_29); -x_39 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_39, 0, x_37); -lean::cnstr_set(x_39, 1, x_38); -return x_39; -} -} -} -} -else -{ -obj* x_40; obj* x_41; obj* x_42; obj* x_43; uint8 x_44; obj* x_45; -x_40 = lean::cnstr_get(x_10, 0); -x_41 = lean::cnstr_get(x_10, 1); -lean::inc(x_41); -lean::inc(x_40); -lean::dec(x_10); -x_42 = lean::cnstr_get(x_5, 1); -lean::inc(x_42); -x_43 = l_Lean_IR_Decl_name(x_1); -x_44 = l_Lean_isExternC(x_40, x_43); -lean::dec(x_40); -x_45 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_45, 0, x_9); -lean::cnstr_set(x_45, 1, x_41); -if (x_44 == 0) -{ -uint8 x_46; obj* x_47; -x_46 = 1; -x_47 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_42, x_46, x_3, x_45); -lean::dec(x_42); -if (lean::obj_tag(x_47) == 0) -{ -obj* x_48; obj* x_49; obj* x_50; obj* x_51; -x_48 = lean::cnstr_get(x_47, 1); -lean::inc(x_48); -if (lean::is_exclusive(x_47)) { - lean::cnstr_release(x_47, 0); - lean::cnstr_release(x_47, 1); - x_49 = x_47; -} else { - lean::dec_ref(x_47); - x_49 = lean::box(0); -} -if (lean::is_scalar(x_49)) { - x_50 = lean::alloc_cnstr(0, 2, 0); -} else { - x_50 = x_49; -} -lean::cnstr_set(x_50, 0, x_9); -lean::cnstr_set(x_50, 1, x_48); -x_51 = l_Lean_IR_EmitC_closeNamespaces(x_5, x_3, x_50); -lean::dec(x_5); -return x_51; -} -else -{ -obj* x_52; obj* x_53; obj* x_54; obj* x_55; -lean::dec(x_5); -x_52 = lean::cnstr_get(x_47, 0); -lean::inc(x_52); -x_53 = lean::cnstr_get(x_47, 1); -lean::inc(x_53); -if (lean::is_exclusive(x_47)) { - lean::cnstr_release(x_47, 0); - lean::cnstr_release(x_47, 1); - x_54 = x_47; -} else { - lean::dec_ref(x_47); - x_54 = lean::box(0); -} -if (lean::is_scalar(x_54)) { - x_55 = lean::alloc_cnstr(1, 2, 0); -} else { - x_55 = x_54; -} -lean::cnstr_set(x_55, 0, x_52); -lean::cnstr_set(x_55, 1, x_53); -return x_55; -} -} -else -{ -uint8 x_56; obj* x_57; -x_56 = 0; -x_57 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_42, x_56, x_3, x_45); -lean::dec(x_42); -if (lean::obj_tag(x_57) == 0) -{ -obj* x_58; obj* x_59; obj* x_60; obj* x_61; -x_58 = lean::cnstr_get(x_57, 1); -lean::inc(x_58); -if (lean::is_exclusive(x_57)) { - lean::cnstr_release(x_57, 0); - lean::cnstr_release(x_57, 1); - x_59 = x_57; -} else { - lean::dec_ref(x_57); - x_59 = lean::box(0); -} -if (lean::is_scalar(x_59)) { - x_60 = lean::alloc_cnstr(0, 2, 0); -} else { - x_60 = x_59; -} -lean::cnstr_set(x_60, 0, x_9); -lean::cnstr_set(x_60, 1, x_58); -x_61 = l_Lean_IR_EmitC_closeNamespaces(x_5, x_3, x_60); -lean::dec(x_5); -return x_61; -} -else -{ -obj* x_62; obj* x_63; obj* x_64; obj* x_65; -lean::dec(x_5); -x_62 = lean::cnstr_get(x_57, 0); -lean::inc(x_62); -x_63 = lean::cnstr_get(x_57, 1); -lean::inc(x_63); -if (lean::is_exclusive(x_57)) { - lean::cnstr_release(x_57, 0); - lean::cnstr_release(x_57, 1); - x_64 = x_57; -} else { - lean::dec_ref(x_57); - x_64 = lean::box(0); -} -if (lean::is_scalar(x_64)) { - x_65 = lean::alloc_cnstr(1, 2, 0); -} else { - x_65 = x_64; -} -lean::cnstr_set(x_65, 0, x_62); -lean::cnstr_set(x_65, 1, x_63); -return x_65; -} -} -} -} -else -{ -uint8 x_66; -lean::dec(x_5); -x_66 = !lean::is_exclusive(x_10); -if (x_66 == 0) -{ -obj* x_67; obj* x_68; -x_67 = lean::cnstr_get(x_10, 0); -lean::dec(x_67); -x_68 = l_Lean_IR_EmitC_emitExternDeclAux___closed__1; -lean::cnstr_set_tag(x_10, 1); -lean::cnstr_set(x_10, 0, x_68); -return x_10; -} -else -{ -obj* x_69; obj* x_70; obj* x_71; -x_69 = lean::cnstr_get(x_10, 1); -lean::inc(x_69); -lean::dec(x_10); -x_70 = l_Lean_IR_EmitC_emitExternDeclAux___closed__1; -x_71 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_71, 0, x_70); -lean::cnstr_set(x_71, 1, x_69); -return x_71; -} -} -} -else -{ -uint8 x_72; -lean::dec(x_5); -x_72 = !lean::is_exclusive(x_10); -if (x_72 == 0) -{ -return x_10; -} -else -{ -obj* x_73; obj* x_74; obj* x_75; -x_73 = lean::cnstr_get(x_10, 0); -x_74 = lean::cnstr_get(x_10, 1); -lean::inc(x_74); -lean::inc(x_73); -lean::dec(x_10); -x_75 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_75, 0, x_73); -lean::cnstr_set(x_75, 1, x_74); -return x_75; -} -} -} -else -{ -obj* x_76; obj* x_77; obj* x_78; obj* x_79; -x_76 = lean::cnstr_get(x_6, 1); -lean::inc(x_76); -lean::dec(x_6); -x_77 = lean::box(0); -x_78 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_78, 0, x_77); -lean::cnstr_set(x_78, 1, x_76); -x_79 = l_Lean_IR_EmitC_getEnv(x_3, x_78); -if (lean::obj_tag(x_79) == 0) -{ -if (lean::obj_tag(x_5) == 1) -{ -obj* x_80; obj* x_81; obj* x_82; obj* x_83; obj* x_84; uint8 x_85; obj* x_86; -x_80 = lean::cnstr_get(x_79, 0); -lean::inc(x_80); -x_81 = lean::cnstr_get(x_79, 1); -lean::inc(x_81); -if (lean::is_exclusive(x_79)) { - lean::cnstr_release(x_79, 0); - lean::cnstr_release(x_79, 1); - x_82 = x_79; -} else { - lean::dec_ref(x_79); - x_82 = lean::box(0); -} -x_83 = lean::cnstr_get(x_5, 1); -lean::inc(x_83); -x_84 = l_Lean_IR_Decl_name(x_1); -x_85 = l_Lean_isExternC(x_80, x_84); -lean::dec(x_80); -if (lean::is_scalar(x_82)) { - x_86 = lean::alloc_cnstr(0, 2, 0); -} else { - x_86 = x_82; -} -lean::cnstr_set(x_86, 0, x_77); -lean::cnstr_set(x_86, 1, x_81); -if (x_85 == 0) -{ -uint8 x_87; obj* x_88; -x_87 = 1; -x_88 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_83, x_87, x_3, x_86); -lean::dec(x_83); -if (lean::obj_tag(x_88) == 0) -{ -obj* x_89; obj* x_90; obj* x_91; obj* x_92; -x_89 = lean::cnstr_get(x_88, 1); -lean::inc(x_89); -if (lean::is_exclusive(x_88)) { - lean::cnstr_release(x_88, 0); - lean::cnstr_release(x_88, 1); - x_90 = x_88; -} else { - lean::dec_ref(x_88); - x_90 = lean::box(0); -} -if (lean::is_scalar(x_90)) { - x_91 = lean::alloc_cnstr(0, 2, 0); -} else { - x_91 = x_90; -} -lean::cnstr_set(x_91, 0, x_77); -lean::cnstr_set(x_91, 1, x_89); -x_92 = l_Lean_IR_EmitC_closeNamespaces(x_5, x_3, x_91); -lean::dec(x_5); -return x_92; -} -else -{ -obj* x_93; obj* x_94; obj* x_95; obj* x_96; -lean::dec(x_5); -x_93 = lean::cnstr_get(x_88, 0); -lean::inc(x_93); -x_94 = lean::cnstr_get(x_88, 1); -lean::inc(x_94); -if (lean::is_exclusive(x_88)) { - lean::cnstr_release(x_88, 0); - lean::cnstr_release(x_88, 1); - x_95 = x_88; -} else { - lean::dec_ref(x_88); - x_95 = lean::box(0); -} -if (lean::is_scalar(x_95)) { - x_96 = lean::alloc_cnstr(1, 2, 0); -} else { - x_96 = x_95; -} -lean::cnstr_set(x_96, 0, x_93); -lean::cnstr_set(x_96, 1, x_94); -return x_96; -} -} -else -{ -uint8 x_97; obj* x_98; -x_97 = 0; -x_98 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_83, x_97, x_3, x_86); -lean::dec(x_83); -if (lean::obj_tag(x_98) == 0) -{ -obj* x_99; obj* x_100; obj* x_101; obj* x_102; -x_99 = lean::cnstr_get(x_98, 1); -lean::inc(x_99); -if (lean::is_exclusive(x_98)) { - lean::cnstr_release(x_98, 0); - lean::cnstr_release(x_98, 1); - x_100 = x_98; -} else { - lean::dec_ref(x_98); - x_100 = lean::box(0); -} -if (lean::is_scalar(x_100)) { - x_101 = lean::alloc_cnstr(0, 2, 0); -} else { - x_101 = x_100; -} -lean::cnstr_set(x_101, 0, x_77); -lean::cnstr_set(x_101, 1, x_99); -x_102 = l_Lean_IR_EmitC_closeNamespaces(x_5, x_3, x_101); -lean::dec(x_5); -return x_102; -} -else -{ -obj* x_103; obj* x_104; obj* x_105; obj* x_106; -lean::dec(x_5); -x_103 = lean::cnstr_get(x_98, 0); -lean::inc(x_103); -x_104 = lean::cnstr_get(x_98, 1); -lean::inc(x_104); -if (lean::is_exclusive(x_98)) { - lean::cnstr_release(x_98, 0); - lean::cnstr_release(x_98, 1); - x_105 = x_98; -} else { - lean::dec_ref(x_98); - x_105 = lean::box(0); -} -if (lean::is_scalar(x_105)) { - x_106 = lean::alloc_cnstr(1, 2, 0); -} else { - x_106 = x_105; -} -lean::cnstr_set(x_106, 0, x_103); -lean::cnstr_set(x_106, 1, x_104); -return x_106; -} -} -} -else -{ -obj* x_107; obj* x_108; obj* x_109; obj* x_110; -lean::dec(x_5); -x_107 = lean::cnstr_get(x_79, 1); -lean::inc(x_107); -if (lean::is_exclusive(x_79)) { - lean::cnstr_release(x_79, 0); - lean::cnstr_release(x_79, 1); - x_108 = x_79; -} else { - lean::dec_ref(x_79); - x_108 = lean::box(0); -} -x_109 = l_Lean_IR_EmitC_emitExternDeclAux___closed__1; -if (lean::is_scalar(x_108)) { - x_110 = lean::alloc_cnstr(1, 2, 0); -} else { - x_110 = x_108; - lean::cnstr_set_tag(x_110, 1); -} -lean::cnstr_set(x_110, 0, x_109); -lean::cnstr_set(x_110, 1, x_107); -return x_110; -} -} -else -{ -obj* x_111; obj* x_112; obj* x_113; obj* x_114; -lean::dec(x_5); -x_111 = lean::cnstr_get(x_79, 0); -lean::inc(x_111); -x_112 = lean::cnstr_get(x_79, 1); -lean::inc(x_112); -if (lean::is_exclusive(x_79)) { - lean::cnstr_release(x_79, 0); - lean::cnstr_release(x_79, 1); - x_113 = x_79; -} else { - lean::dec_ref(x_79); - x_113 = lean::box(0); -} -if (lean::is_scalar(x_113)) { - x_114 = lean::alloc_cnstr(1, 2, 0); -} else { - x_114 = x_113; -} -lean::cnstr_set(x_114, 0, x_111); -lean::cnstr_set(x_114, 1, x_112); -return x_114; -} -} -} -else -{ -uint8 x_115; -lean::dec(x_5); -x_115 = !lean::is_exclusive(x_6); -if (x_115 == 0) -{ -return x_6; -} -else -{ -obj* x_116; obj* x_117; obj* x_118; -x_116 = lean::cnstr_get(x_6, 0); -x_117 = lean::cnstr_get(x_6, 1); -lean::inc(x_117); -lean::inc(x_116); -lean::dec(x_6); -x_118 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_118, 0, x_116); -lean::cnstr_set(x_118, 1, x_117); -return x_118; +x_28 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_28, 0, x_26); +lean::cnstr_set(x_28, 1, x_27); +return x_28; } } } @@ -3808,6 +2352,7 @@ _start: obj* x_5; x_5 = l_Lean_IR_EmitC_emitExternDeclAux(x_1, x_2, x_3, x_4); lean::dec(x_3); +lean::dec(x_2); lean::dec(x_1); return x_5; } @@ -4093,6 +2638,7 @@ x_46 = lean::cnstr_get(x_20, 0); lean::inc(x_46); lean::dec(x_20); x_47 = l_Lean_IR_EmitC_emitExternDeclAux(x_16, x_46, x_4, x_14); +lean::dec(x_46); lean::dec(x_16); if (lean::obj_tag(x_47) == 0) { @@ -4288,6 +2834,7 @@ x_86 = lean::cnstr_get(x_64, 0); lean::inc(x_86); lean::dec(x_64); x_87 = l_Lean_IR_EmitC_emitExternDeclAux(x_58, x_86, x_4, x_61); +lean::dec(x_86); lean::dec(x_58); if (lean::obj_tag(x_87) == 0) { @@ -5059,7 +3606,7 @@ obj* l_Lean_IR_EmitC_emitMainFn(obj* x_1, obj* x_2) { _start: { obj* x_3; obj* x_4; -x_3 = l_Lean_IR_EmitC_toBaseCppName___closed__2; +x_3 = l_Lean_IR_EmitC_toCName___closed__2; x_4 = l_Lean_IR_EmitC_getDecl(x_3, x_1, x_2); if (lean::obj_tag(x_4) == 0) { @@ -6720,7 +5267,7 @@ x_3 = lean::cnstr_get(x_2, 0); x_4 = lean::cnstr_get(x_2, 1); x_5 = l_List_foldr___main___at_Lean_IR_EmitC_hasMainFn___spec__1(x_1, x_4); x_6 = l_Lean_IR_Decl_name(x_3); -x_7 = l_Lean_IR_EmitC_toBaseCppName___closed__2; +x_7 = l_Lean_IR_EmitC_toCName___closed__2; x_8 = lean_name_dec_eq(x_6, x_7); lean::dec(x_6); if (x_8 == 0) @@ -10441,7 +8988,7 @@ obj* _init_l_Lean_IR_EmitC_emitDel___closed__1() { _start: { obj* x_1; -x_1 = lean::mk_string("lean_free_heap_obj("); +x_1 = lean::mk_string("lean_free_object("); return x_1; } } @@ -15401,7 +13948,7 @@ obj* x_13; obj* x_14; x_13 = lean::cnstr_get(x_10, 0); lean::dec(x_13); lean::cnstr_set(x_10, 0, x_9); -x_14 = l_Lean_IR_EmitC_emitCppName(x_2, x_4, x_10); +x_14 = l_Lean_IR_EmitC_emitCName(x_2, x_4, x_10); if (lean::obj_tag(x_14) == 0) { uint8 x_15; @@ -15615,7 +14162,7 @@ lean::dec(x_10); x_80 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_80, 0, x_9); lean::cnstr_set(x_80, 1, x_79); -x_81 = l_Lean_IR_EmitC_emitCppName(x_2, x_4, x_80); +x_81 = l_Lean_IR_EmitC_emitCName(x_2, x_4, x_80); if (lean::obj_tag(x_81) == 0) { obj* x_82; obj* x_83; obj* x_84; obj* x_85; uint8 x_86; @@ -15902,7 +14449,7 @@ if (lean::is_scalar(x_161)) { } lean::cnstr_set(x_162, 0, x_156); lean::cnstr_set(x_162, 1, x_160); -x_163 = l_Lean_IR_EmitC_emitCppName(x_2, x_4, x_162); +x_163 = l_Lean_IR_EmitC_emitCName(x_2, x_4, x_162); if (lean::obj_tag(x_163) == 0) { obj* x_164; obj* x_165; obj* x_166; obj* x_167; uint8 x_168; @@ -16440,7 +14987,7 @@ x_16 = l_Lean_IR_EmitC_emitPartialApp___closed__1; x_17 = lean_string_append(x_14, x_16); lean::cnstr_set(x_12, 1, x_17); lean::cnstr_set(x_12, 0, x_9); -x_18 = l_Lean_IR_EmitC_emitCppName(x_2, x_4, x_12); +x_18 = l_Lean_IR_EmitC_emitCName(x_2, x_4, x_12); if (lean::obj_tag(x_18) == 0) { uint8 x_19; @@ -16541,7 +15088,7 @@ x_58 = lean_string_append(x_56, x_57); x_59 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_59, 0, x_9); lean::cnstr_set(x_59, 1, x_58); -x_60 = l_Lean_IR_EmitC_emitCppName(x_2, x_4, x_59); +x_60 = l_Lean_IR_EmitC_emitCName(x_2, x_4, x_59); if (lean::obj_tag(x_60) == 0) { obj* x_61; obj* x_62; obj* x_63; obj* x_64; obj* x_65; obj* x_66; obj* x_67; obj* x_68; obj* x_69; obj* x_70; obj* x_71; obj* x_72; obj* x_73; obj* x_74; obj* x_75; obj* x_76; obj* x_77; @@ -16677,7 +15224,7 @@ if (lean::is_scalar(x_94)) { } lean::cnstr_set(x_97, 0, x_88); lean::cnstr_set(x_97, 1, x_96); -x_98 = l_Lean_IR_EmitC_emitCppName(x_2, x_4, x_97); +x_98 = l_Lean_IR_EmitC_emitCName(x_2, x_4, x_97); if (lean::obj_tag(x_98) == 0) { obj* x_99; obj* x_100; obj* x_101; obj* x_102; obj* x_103; obj* x_104; obj* x_105; obj* x_106; obj* x_107; obj* x_108; obj* x_109; obj* x_110; obj* x_111; obj* x_112; obj* x_113; obj* x_114; obj* x_115; @@ -20574,7 +19121,7 @@ obj* _init_l_Lean_IR_EmitC_emitBlock___main___closed__2() { _start: { obj* x_1; -x_1 = lean::mk_string("lean_unreachable();"); +x_1 = lean::mk_string("lean_panic_unreachable();"); return x_1; } } @@ -22880,7 +21427,7 @@ obj* _init_l_Lean_IR_EmitC_emitDeclAux___closed__1() { _start: { obj* x_1; -x_1 = lean::mk_string("_start:"); +x_1 = lean::mk_string(" {"); return x_1; } } @@ -22888,6 +21435,14 @@ obj* _init_l_Lean_IR_EmitC_emitDeclAux___closed__2() { _start: { obj* x_1; +x_1 = lean::mk_string("_start:"); +return x_1; +} +} +obj* _init_l_Lean_IR_EmitC_emitDeclAux___closed__3() { +_start: +{ +obj* x_1; x_1 = lean::mk_string("lean_object** _args"); return x_1; } @@ -22921,19 +21476,19 @@ lean::inc(x_12); x_13 = l_Lean_hasInitAttr(x_6, x_12); if (x_13 == 0) { -uint8 x_412; -x_412 = 0; -x_14 = x_412; -goto block_411; +uint8 x_276; +x_276 = 0; +x_14 = x_276; +goto block_275; } else { -uint8 x_413; -x_413 = 1; -x_14 = x_413; -goto block_411; +uint8 x_277; +x_277 = 1; +x_14 = x_277; +goto block_275; } -block_411: +block_275: { if (x_14 == 0) { @@ -22966,677 +21521,106 @@ lean::inc(x_20); lean::cnstr_set(x_2, 3, x_11); lean::cnstr_set(x_2, 2, x_10); lean::inc(x_15); -x_24 = l_Lean_IR_EmitC_openNamespacesFor(x_15, x_2, x_4); +x_24 = l_Lean_IR_EmitC_toCName(x_15, x_2, x_4); if (lean::obj_tag(x_24) == 0) { -uint8 x_25; -x_25 = !lean::is_exclusive(x_24); -if (x_25 == 0) -{ -obj* x_26; obj* x_27; -x_26 = lean::cnstr_get(x_24, 0); -lean::dec(x_26); -lean::cnstr_set(x_24, 0, x_8); -lean::inc(x_15); -x_27 = l_Lean_IR_EmitC_toBaseCppName(x_15, x_2, x_24); -if (lean::obj_tag(x_27) == 0) -{ -obj* x_28; obj* x_29; obj* x_30; obj* x_31; obj* x_32; obj* x_33; obj* x_34; obj* x_35; obj* x_36; obj* x_140; uint8 x_141; -x_28 = lean::cnstr_get(x_27, 0); -lean::inc(x_28); -x_29 = lean::cnstr_get(x_27, 1); -lean::inc(x_29); -if (lean::is_exclusive(x_27)) { - lean::cnstr_release(x_27, 0); - lean::cnstr_release(x_27, 1); - x_30 = x_27; +obj* x_25; obj* x_26; obj* x_27; obj* x_28; obj* x_29; obj* x_30; obj* x_31; obj* x_32; obj* x_33; obj* x_130; uint8 x_131; +x_25 = lean::cnstr_get(x_24, 0); +lean::inc(x_25); +x_26 = lean::cnstr_get(x_24, 1); +lean::inc(x_26); +if (lean::is_exclusive(x_24)) { + lean::cnstr_release(x_24, 0); + lean::cnstr_release(x_24, 1); + x_27 = x_24; } else { - lean::dec_ref(x_27); - x_30 = lean::box(0); + lean::dec_ref(x_24); + x_27 = lean::box(0); } -x_31 = l_Lean_IR_EmitC_toCType(x_17); -x_32 = lean_string_append(x_29, x_31); -lean::dec(x_31); -x_33 = l_Lean_Format_flatten___main___closed__1; -x_34 = lean_string_append(x_32, x_33); -x_35 = lean_array_get_size(x_16); -x_140 = lean::mk_nat_obj(0u); -x_141 = lean_nat_dec_lt(x_140, x_35); -if (x_141 == 0) -{ -obj* x_142; obj* x_143; obj* x_144; obj* x_145; obj* x_146; -x_142 = l_Lean_IR_EmitC_toCInitName___closed__1; -x_143 = lean_string_append(x_142, x_28); +x_28 = l_Lean_IR_EmitC_toCType(x_17); +x_29 = lean_string_append(x_26, x_28); lean::dec(x_28); -x_144 = l_Unit_HasRepr___closed__1; +x_30 = l_Lean_Format_flatten___main___closed__1; +x_31 = lean_string_append(x_29, x_30); +x_32 = lean_array_get_size(x_16); +x_130 = lean::mk_nat_obj(0u); +x_131 = lean_nat_dec_lt(x_130, x_32); +if (x_131 == 0) +{ +obj* x_132; obj* x_133; obj* x_134; obj* x_135; obj* x_136; +x_132 = l_Lean_IR_EmitC_toCInitName___closed__1; +x_133 = lean_string_append(x_132, x_25); +lean::dec(x_25); +x_134 = l_Unit_HasRepr___closed__1; +x_135 = lean_string_append(x_133, x_134); +x_136 = lean_string_append(x_31, x_135); +lean::dec(x_135); +x_33 = x_136; +goto block_129; +} +else +{ +obj* x_137; obj* x_138; obj* x_139; obj* x_140; obj* x_141; obj* x_151; uint8 x_152; +x_137 = lean_string_append(x_31, x_25); +lean::dec(x_25); +x_138 = l_Prod_HasRepr___rarg___closed__1; +x_139 = lean_string_append(x_137, x_138); +lean::inc(x_139); +x_140 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_140, 0, x_8); +lean::cnstr_set(x_140, 1, x_139); +x_151 = l_Lean_closureMaxArgs; +x_152 = lean_nat_dec_lt(x_151, x_32); +if (x_152 == 0) +{ +lean::dec(x_139); +x_141 = x_8; +goto block_150; +} +else +{ +uint8 x_153; +x_153 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_12); +if (x_153 == 0) +{ +lean::dec(x_139); +x_141 = x_8; +goto block_150; +} +else +{ +obj* x_154; obj* x_155; obj* x_156; obj* x_157; +lean::dec(x_140); +x_154 = l_Lean_IR_EmitC_emitDeclAux___closed__3; +x_155 = lean_string_append(x_139, x_154); +x_156 = l_Option_HasRepr___rarg___closed__3; +x_157 = lean_string_append(x_155, x_156); +x_33 = x_157; +goto block_129; +} +} +block_150: +{ +obj* x_142; +lean::dec(x_141); +lean::inc(x_32); +x_142 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(x_16, x_32, x_32, x_2, x_140); +if (lean::obj_tag(x_142) == 0) +{ +obj* x_143; obj* x_144; obj* x_145; +x_143 = lean::cnstr_get(x_142, 1); +lean::inc(x_143); +lean::dec(x_142); +x_144 = l_Option_HasRepr___rarg___closed__3; x_145 = lean_string_append(x_143, x_144); -x_146 = lean_string_append(x_34, x_145); -lean::dec(x_145); -x_36 = x_146; -goto block_139; +x_33 = x_145; +goto block_129; } else { -obj* x_147; obj* x_148; obj* x_149; obj* x_150; obj* x_151; obj* x_161; uint8 x_162; -x_147 = lean_string_append(x_34, x_28); -lean::dec(x_28); -x_148 = l_Prod_HasRepr___rarg___closed__1; -x_149 = lean_string_append(x_147, x_148); -lean::inc(x_149); -x_150 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_150, 0, x_8); -lean::cnstr_set(x_150, 1, x_149); -x_161 = l_Lean_closureMaxArgs; -x_162 = lean_nat_dec_lt(x_161, x_35); -if (x_162 == 0) -{ -lean::dec(x_149); -x_151 = x_8; -goto block_160; -} -else -{ -uint8 x_163; -x_163 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_12); -if (x_163 == 0) -{ -lean::dec(x_149); -x_151 = x_8; -goto block_160; -} -else -{ -obj* x_164; obj* x_165; obj* x_166; obj* x_167; -lean::dec(x_150); -x_164 = l_Lean_IR_EmitC_emitDeclAux___closed__2; -x_165 = lean_string_append(x_149, x_164); -x_166 = l_Option_HasRepr___rarg___closed__3; -x_167 = lean_string_append(x_165, x_166); -x_36 = x_167; -goto block_139; -} -} -block_160: -{ -obj* x_152; -lean::dec(x_151); -lean::inc(x_35); -x_152 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(x_16, x_35, x_35, x_2, x_150); -if (lean::obj_tag(x_152) == 0) -{ -obj* x_153; obj* x_154; obj* x_155; -x_153 = lean::cnstr_get(x_152, 1); -lean::inc(x_153); -lean::dec(x_152); -x_154 = l_Option_HasRepr___rarg___closed__3; -x_155 = lean_string_append(x_153, x_154); -x_36 = x_155; -goto block_139; -} -else -{ -uint8 x_156; -lean::dec(x_35); -lean::dec(x_30); -lean::dec(x_2); -lean::dec(x_21); -lean::dec(x_20); -lean::dec(x_18); -lean::dec(x_16); -lean::dec(x_15); -lean::dec(x_12); -lean::dec(x_11); -lean::dec(x_10); -x_156 = !lean::is_exclusive(x_152); -if (x_156 == 0) -{ -return x_152; -} -else -{ -obj* x_157; obj* x_158; obj* x_159; -x_157 = lean::cnstr_get(x_152, 0); -x_158 = lean::cnstr_get(x_152, 1); -lean::inc(x_158); -lean::inc(x_157); -lean::dec(x_152); -x_159 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_159, 0, x_157); -lean::cnstr_set(x_159, 1, x_158); -return x_159; -} -} -} -} -block_139: -{ -obj* x_37; obj* x_38; obj* x_39; obj* x_40; obj* x_41; obj* x_42; uint8 x_43; -x_37 = l_Lean_IR_EmitC_openNamespacesAux___main___closed__2; -x_38 = lean_string_append(x_36, x_37); -x_39 = l_IO_println___rarg___closed__1; -x_40 = lean_string_append(x_38, x_39); -lean::inc(x_40); -if (lean::is_scalar(x_30)) { - x_41 = lean::alloc_cnstr(0, 2, 0); -} else { - x_41 = x_30; -} -lean::cnstr_set(x_41, 0, x_8); -lean::cnstr_set(x_41, 1, x_40); -x_42 = l_Lean_closureMaxArgs; -x_43 = lean_nat_dec_lt(x_42, x_35); -if (x_43 == 0) -{ -obj* x_44; obj* x_45; obj* x_46; obj* x_47; obj* x_48; obj* x_49; -lean::dec(x_41); -lean::dec(x_35); -lean::dec(x_12); -x_44 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_45 = lean_string_append(x_40, x_44); -x_46 = lean_string_append(x_45, x_39); -x_47 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_47, 0, x_8); -lean::cnstr_set(x_47, 1, x_46); -lean::inc(x_15); -x_48 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_48, 0, x_20); -lean::cnstr_set(x_48, 1, x_21); -lean::cnstr_set(x_48, 2, x_10); -lean::cnstr_set(x_48, 3, x_11); -lean::cnstr_set(x_48, 4, x_15); -lean::cnstr_set(x_48, 5, x_16); -x_49 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_48, x_47); -if (lean::obj_tag(x_49) == 0) -{ -uint8 x_50; -x_50 = !lean::is_exclusive(x_49); -if (x_50 == 0) -{ -obj* x_51; obj* x_52; obj* x_53; obj* x_54; obj* x_55; obj* x_56; -x_51 = lean::cnstr_get(x_49, 1); -x_52 = lean::cnstr_get(x_49, 0); -lean::dec(x_52); -x_53 = l_PersistentHashMap_Stats_toString___closed__5; -x_54 = lean_string_append(x_51, x_53); -x_55 = lean_string_append(x_54, x_39); -lean::cnstr_set(x_49, 1, x_55); -lean::cnstr_set(x_49, 0, x_8); -x_56 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_2, x_49); -lean::dec(x_2); -return x_56; -} -else -{ -obj* x_57; obj* x_58; obj* x_59; obj* x_60; obj* x_61; obj* x_62; -x_57 = lean::cnstr_get(x_49, 1); -lean::inc(x_57); -lean::dec(x_49); -x_58 = l_PersistentHashMap_Stats_toString___closed__5; -x_59 = lean_string_append(x_57, x_58); -x_60 = lean_string_append(x_59, x_39); -x_61 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_61, 0, x_8); -lean::cnstr_set(x_61, 1, x_60); -x_62 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_2, x_61); -lean::dec(x_2); -return x_62; -} -} -else -{ -uint8 x_63; -lean::dec(x_2); -lean::dec(x_15); -x_63 = !lean::is_exclusive(x_49); -if (x_63 == 0) -{ -return x_49; -} -else -{ -obj* x_64; obj* x_65; obj* x_66; -x_64 = lean::cnstr_get(x_49, 0); -x_65 = lean::cnstr_get(x_49, 1); -lean::inc(x_65); -lean::inc(x_64); -lean::dec(x_49); -x_66 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_66, 0, x_64); -lean::cnstr_set(x_66, 1, x_65); -return x_66; -} -} -} -else -{ -uint8 x_67; -x_67 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_12); -lean::dec(x_12); -if (x_67 == 0) -{ -obj* x_68; obj* x_69; obj* x_70; obj* x_71; obj* x_72; obj* x_73; -lean::dec(x_41); -lean::dec(x_35); -x_68 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_69 = lean_string_append(x_40, x_68); -x_70 = lean_string_append(x_69, x_39); -x_71 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_71, 0, x_8); -lean::cnstr_set(x_71, 1, x_70); -lean::inc(x_15); -x_72 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_72, 0, x_20); -lean::cnstr_set(x_72, 1, x_21); -lean::cnstr_set(x_72, 2, x_10); -lean::cnstr_set(x_72, 3, x_11); -lean::cnstr_set(x_72, 4, x_15); -lean::cnstr_set(x_72, 5, x_16); -x_73 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_72, x_71); -if (lean::obj_tag(x_73) == 0) -{ -uint8 x_74; -x_74 = !lean::is_exclusive(x_73); -if (x_74 == 0) -{ -obj* x_75; obj* x_76; obj* x_77; obj* x_78; obj* x_79; obj* x_80; -x_75 = lean::cnstr_get(x_73, 1); -x_76 = lean::cnstr_get(x_73, 0); -lean::dec(x_76); -x_77 = l_PersistentHashMap_Stats_toString___closed__5; -x_78 = lean_string_append(x_75, x_77); -x_79 = lean_string_append(x_78, x_39); -lean::cnstr_set(x_73, 1, x_79); -lean::cnstr_set(x_73, 0, x_8); -x_80 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_2, x_73); -lean::dec(x_2); -return x_80; -} -else -{ -obj* x_81; obj* x_82; obj* x_83; obj* x_84; obj* x_85; obj* x_86; -x_81 = lean::cnstr_get(x_73, 1); -lean::inc(x_81); -lean::dec(x_73); -x_82 = l_PersistentHashMap_Stats_toString___closed__5; -x_83 = lean_string_append(x_81, x_82); -x_84 = lean_string_append(x_83, x_39); -x_85 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_85, 0, x_8); -lean::cnstr_set(x_85, 1, x_84); -x_86 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_2, x_85); -lean::dec(x_2); -return x_86; -} -} -else -{ -uint8 x_87; -lean::dec(x_2); -lean::dec(x_15); -x_87 = !lean::is_exclusive(x_73); -if (x_87 == 0) -{ -return x_73; -} -else -{ -obj* x_88; obj* x_89; obj* x_90; -x_88 = lean::cnstr_get(x_73, 0); -x_89 = lean::cnstr_get(x_73, 1); -lean::inc(x_89); -lean::inc(x_88); -lean::dec(x_73); -x_90 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_90, 0, x_88); -lean::cnstr_set(x_90, 1, x_89); -return x_90; -} -} -} -else -{ -obj* x_91; -lean::dec(x_40); -lean::inc(x_35); -x_91 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(x_16, x_35, x_35, x_2, x_41); -lean::dec(x_35); -if (lean::obj_tag(x_91) == 0) -{ -uint8 x_92; -x_92 = !lean::is_exclusive(x_91); -if (x_92 == 0) -{ -obj* x_93; obj* x_94; obj* x_95; obj* x_96; obj* x_97; obj* x_98; obj* x_99; -x_93 = lean::cnstr_get(x_91, 1); -x_94 = lean::cnstr_get(x_91, 0); -lean::dec(x_94); -x_95 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_96 = lean_string_append(x_93, x_95); -x_97 = lean_string_append(x_96, x_39); -lean::cnstr_set(x_91, 1, x_97); -lean::cnstr_set(x_91, 0, x_8); -lean::inc(x_15); -x_98 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_98, 0, x_20); -lean::cnstr_set(x_98, 1, x_21); -lean::cnstr_set(x_98, 2, x_10); -lean::cnstr_set(x_98, 3, x_11); -lean::cnstr_set(x_98, 4, x_15); -lean::cnstr_set(x_98, 5, x_16); -x_99 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_98, x_91); -if (lean::obj_tag(x_99) == 0) -{ -uint8 x_100; -x_100 = !lean::is_exclusive(x_99); -if (x_100 == 0) -{ -obj* x_101; obj* x_102; obj* x_103; obj* x_104; obj* x_105; obj* x_106; -x_101 = lean::cnstr_get(x_99, 1); -x_102 = lean::cnstr_get(x_99, 0); -lean::dec(x_102); -x_103 = l_PersistentHashMap_Stats_toString___closed__5; -x_104 = lean_string_append(x_101, x_103); -x_105 = lean_string_append(x_104, x_39); -lean::cnstr_set(x_99, 1, x_105); -lean::cnstr_set(x_99, 0, x_8); -x_106 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_2, x_99); -lean::dec(x_2); -return x_106; -} -else -{ -obj* x_107; obj* x_108; obj* x_109; obj* x_110; obj* x_111; obj* x_112; -x_107 = lean::cnstr_get(x_99, 1); -lean::inc(x_107); -lean::dec(x_99); -x_108 = l_PersistentHashMap_Stats_toString___closed__5; -x_109 = lean_string_append(x_107, x_108); -x_110 = lean_string_append(x_109, x_39); -x_111 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_111, 0, x_8); -lean::cnstr_set(x_111, 1, x_110); -x_112 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_2, x_111); -lean::dec(x_2); -return x_112; -} -} -else -{ -uint8 x_113; -lean::dec(x_2); -lean::dec(x_15); -x_113 = !lean::is_exclusive(x_99); -if (x_113 == 0) -{ -return x_99; -} -else -{ -obj* x_114; obj* x_115; obj* x_116; -x_114 = lean::cnstr_get(x_99, 0); -x_115 = lean::cnstr_get(x_99, 1); -lean::inc(x_115); -lean::inc(x_114); -lean::dec(x_99); -x_116 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_116, 0, x_114); -lean::cnstr_set(x_116, 1, x_115); -return x_116; -} -} -} -else -{ -obj* x_117; obj* x_118; obj* x_119; obj* x_120; obj* x_121; obj* x_122; obj* x_123; -x_117 = lean::cnstr_get(x_91, 1); -lean::inc(x_117); -lean::dec(x_91); -x_118 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_119 = lean_string_append(x_117, x_118); -x_120 = lean_string_append(x_119, x_39); -x_121 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_121, 0, x_8); -lean::cnstr_set(x_121, 1, x_120); -lean::inc(x_15); -x_122 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_122, 0, x_20); -lean::cnstr_set(x_122, 1, x_21); -lean::cnstr_set(x_122, 2, x_10); -lean::cnstr_set(x_122, 3, x_11); -lean::cnstr_set(x_122, 4, x_15); -lean::cnstr_set(x_122, 5, x_16); -x_123 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_122, x_121); -if (lean::obj_tag(x_123) == 0) -{ -obj* x_124; obj* x_125; obj* x_126; obj* x_127; obj* x_128; obj* x_129; obj* x_130; -x_124 = lean::cnstr_get(x_123, 1); -lean::inc(x_124); -if (lean::is_exclusive(x_123)) { - lean::cnstr_release(x_123, 0); - lean::cnstr_release(x_123, 1); - x_125 = x_123; -} else { - lean::dec_ref(x_123); - x_125 = lean::box(0); -} -x_126 = l_PersistentHashMap_Stats_toString___closed__5; -x_127 = lean_string_append(x_124, x_126); -x_128 = lean_string_append(x_127, x_39); -if (lean::is_scalar(x_125)) { - x_129 = lean::alloc_cnstr(0, 2, 0); -} else { - x_129 = x_125; -} -lean::cnstr_set(x_129, 0, x_8); -lean::cnstr_set(x_129, 1, x_128); -x_130 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_2, x_129); -lean::dec(x_2); -return x_130; -} -else -{ -obj* x_131; obj* x_132; obj* x_133; obj* x_134; -lean::dec(x_2); -lean::dec(x_15); -x_131 = lean::cnstr_get(x_123, 0); -lean::inc(x_131); -x_132 = lean::cnstr_get(x_123, 1); -lean::inc(x_132); -if (lean::is_exclusive(x_123)) { - lean::cnstr_release(x_123, 0); - lean::cnstr_release(x_123, 1); - x_133 = x_123; -} else { - lean::dec_ref(x_123); - x_133 = lean::box(0); -} -if (lean::is_scalar(x_133)) { - x_134 = lean::alloc_cnstr(1, 2, 0); -} else { - x_134 = x_133; -} -lean::cnstr_set(x_134, 0, x_131); -lean::cnstr_set(x_134, 1, x_132); -return x_134; -} -} -} -else -{ -uint8 x_135; -lean::dec(x_2); -lean::dec(x_21); -lean::dec(x_20); -lean::dec(x_18); -lean::dec(x_16); -lean::dec(x_15); -lean::dec(x_11); -lean::dec(x_10); -x_135 = !lean::is_exclusive(x_91); -if (x_135 == 0) -{ -return x_91; -} -else -{ -obj* x_136; obj* x_137; obj* x_138; -x_136 = lean::cnstr_get(x_91, 0); -x_137 = lean::cnstr_get(x_91, 1); -lean::inc(x_137); -lean::inc(x_136); -lean::dec(x_91); -x_138 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_138, 0, x_136); -lean::cnstr_set(x_138, 1, x_137); -return x_138; -} -} -} -} -} -} -else -{ -uint8 x_168; -lean::dec(x_2); -lean::dec(x_21); -lean::dec(x_20); -lean::dec(x_18); -lean::dec(x_16); -lean::dec(x_15); -lean::dec(x_12); -lean::dec(x_11); -lean::dec(x_10); -x_168 = !lean::is_exclusive(x_27); -if (x_168 == 0) -{ -return x_27; -} -else -{ -obj* x_169; obj* x_170; obj* x_171; -x_169 = lean::cnstr_get(x_27, 0); -x_170 = lean::cnstr_get(x_27, 1); -lean::inc(x_170); -lean::inc(x_169); +uint8 x_146; +lean::dec(x_32); lean::dec(x_27); -x_171 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_171, 0, x_169); -lean::cnstr_set(x_171, 1, x_170); -return x_171; -} -} -} -else -{ -obj* x_172; obj* x_173; obj* x_174; -x_172 = lean::cnstr_get(x_24, 1); -lean::inc(x_172); -lean::dec(x_24); -x_173 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_173, 0, x_8); -lean::cnstr_set(x_173, 1, x_172); -lean::inc(x_15); -x_174 = l_Lean_IR_EmitC_toBaseCppName(x_15, x_2, x_173); -if (lean::obj_tag(x_174) == 0) -{ -obj* x_175; obj* x_176; obj* x_177; obj* x_178; obj* x_179; obj* x_180; obj* x_181; obj* x_182; obj* x_183; obj* x_251; uint8 x_252; -x_175 = lean::cnstr_get(x_174, 0); -lean::inc(x_175); -x_176 = lean::cnstr_get(x_174, 1); -lean::inc(x_176); -if (lean::is_exclusive(x_174)) { - lean::cnstr_release(x_174, 0); - lean::cnstr_release(x_174, 1); - x_177 = x_174; -} else { - lean::dec_ref(x_174); - x_177 = lean::box(0); -} -x_178 = l_Lean_IR_EmitC_toCType(x_17); -x_179 = lean_string_append(x_176, x_178); -lean::dec(x_178); -x_180 = l_Lean_Format_flatten___main___closed__1; -x_181 = lean_string_append(x_179, x_180); -x_182 = lean_array_get_size(x_16); -x_251 = lean::mk_nat_obj(0u); -x_252 = lean_nat_dec_lt(x_251, x_182); -if (x_252 == 0) -{ -obj* x_253; obj* x_254; obj* x_255; obj* x_256; obj* x_257; -x_253 = l_Lean_IR_EmitC_toCInitName___closed__1; -x_254 = lean_string_append(x_253, x_175); -lean::dec(x_175); -x_255 = l_Unit_HasRepr___closed__1; -x_256 = lean_string_append(x_254, x_255); -x_257 = lean_string_append(x_181, x_256); -lean::dec(x_256); -x_183 = x_257; -goto block_250; -} -else -{ -obj* x_258; obj* x_259; obj* x_260; obj* x_261; obj* x_262; obj* x_272; uint8 x_273; -x_258 = lean_string_append(x_181, x_175); -lean::dec(x_175); -x_259 = l_Prod_HasRepr___rarg___closed__1; -x_260 = lean_string_append(x_258, x_259); -lean::inc(x_260); -x_261 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_261, 0, x_8); -lean::cnstr_set(x_261, 1, x_260); -x_272 = l_Lean_closureMaxArgs; -x_273 = lean_nat_dec_lt(x_272, x_182); -if (x_273 == 0) -{ -lean::dec(x_260); -x_262 = x_8; -goto block_271; -} -else -{ -uint8 x_274; -x_274 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_12); -if (x_274 == 0) -{ -lean::dec(x_260); -x_262 = x_8; -goto block_271; -} -else -{ -obj* x_275; obj* x_276; obj* x_277; obj* x_278; -lean::dec(x_261); -x_275 = l_Lean_IR_EmitC_emitDeclAux___closed__2; -x_276 = lean_string_append(x_260, x_275); -x_277 = l_Option_HasRepr___rarg___closed__3; -x_278 = lean_string_append(x_276, x_277); -x_183 = x_278; -goto block_250; -} -} -block_271: -{ -obj* x_263; -lean::dec(x_262); -lean::inc(x_182); -x_263 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(x_16, x_182, x_182, x_2, x_261); -if (lean::obj_tag(x_263) == 0) -{ -obj* x_264; obj* x_265; obj* x_266; -x_264 = lean::cnstr_get(x_263, 1); -lean::inc(x_264); -lean::dec(x_263); -x_265 = l_Option_HasRepr___rarg___closed__3; -x_266 = lean_string_append(x_264, x_265); -x_183 = x_266; -goto block_250; -} -else -{ -obj* x_267; obj* x_268; obj* x_269; obj* x_270; -lean::dec(x_182); -lean::dec(x_177); lean::dec(x_2); lean::dec(x_21); lean::dec(x_20); @@ -23646,297 +21630,360 @@ lean::dec(x_15); lean::dec(x_12); lean::dec(x_11); lean::dec(x_10); -x_267 = lean::cnstr_get(x_263, 0); -lean::inc(x_267); -x_268 = lean::cnstr_get(x_263, 1); -lean::inc(x_268); -if (lean::is_exclusive(x_263)) { - lean::cnstr_release(x_263, 0); - lean::cnstr_release(x_263, 1); - x_269 = x_263; -} else { - lean::dec_ref(x_263); - x_269 = lean::box(0); -} -if (lean::is_scalar(x_269)) { - x_270 = lean::alloc_cnstr(1, 2, 0); -} else { - x_270 = x_269; -} -lean::cnstr_set(x_270, 0, x_267); -lean::cnstr_set(x_270, 1, x_268); -return x_270; -} -} -} -block_250: +x_146 = !lean::is_exclusive(x_142); +if (x_146 == 0) { -obj* x_184; obj* x_185; obj* x_186; obj* x_187; obj* x_188; obj* x_189; uint8 x_190; -x_184 = l_Lean_IR_EmitC_openNamespacesAux___main___closed__2; -x_185 = lean_string_append(x_183, x_184); -x_186 = l_IO_println___rarg___closed__1; -x_187 = lean_string_append(x_185, x_186); -lean::inc(x_187); -if (lean::is_scalar(x_177)) { - x_188 = lean::alloc_cnstr(0, 2, 0); -} else { - x_188 = x_177; +return x_142; } -lean::cnstr_set(x_188, 0, x_8); -lean::cnstr_set(x_188, 1, x_187); -x_189 = l_Lean_closureMaxArgs; -x_190 = lean_nat_dec_lt(x_189, x_182); -if (x_190 == 0) +else { -obj* x_191; obj* x_192; obj* x_193; obj* x_194; obj* x_195; obj* x_196; -lean::dec(x_188); -lean::dec(x_182); +obj* x_147; obj* x_148; obj* x_149; +x_147 = lean::cnstr_get(x_142, 0); +x_148 = lean::cnstr_get(x_142, 1); +lean::inc(x_148); +lean::inc(x_147); +lean::dec(x_142); +x_149 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_149, 0, x_147); +lean::cnstr_set(x_149, 1, x_148); +return x_149; +} +} +} +} +block_129: +{ +obj* x_34; obj* x_35; obj* x_36; obj* x_37; obj* x_38; obj* x_39; uint8 x_40; +x_34 = l_Lean_IR_EmitC_emitDeclAux___closed__1; +x_35 = lean_string_append(x_33, x_34); +x_36 = l_IO_println___rarg___closed__1; +x_37 = lean_string_append(x_35, x_36); +lean::inc(x_37); +if (lean::is_scalar(x_27)) { + x_38 = lean::alloc_cnstr(0, 2, 0); +} else { + x_38 = x_27; +} +lean::cnstr_set(x_38, 0, x_8); +lean::cnstr_set(x_38, 1, x_37); +x_39 = l_Lean_closureMaxArgs; +x_40 = lean_nat_dec_lt(x_39, x_32); +if (x_40 == 0) +{ +obj* x_41; obj* x_42; obj* x_43; obj* x_44; obj* x_45; obj* x_46; +lean::dec(x_38); +lean::dec(x_32); +lean::dec(x_2); lean::dec(x_12); -x_191 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_192 = lean_string_append(x_187, x_191); -x_193 = lean_string_append(x_192, x_186); -x_194 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_194, 0, x_8); -lean::cnstr_set(x_194, 1, x_193); -lean::inc(x_15); -x_195 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_195, 0, x_20); -lean::cnstr_set(x_195, 1, x_21); -lean::cnstr_set(x_195, 2, x_10); -lean::cnstr_set(x_195, 3, x_11); -lean::cnstr_set(x_195, 4, x_15); -lean::cnstr_set(x_195, 5, x_16); -x_196 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_195, x_194); -if (lean::obj_tag(x_196) == 0) +x_41 = l_Lean_IR_EmitC_emitDeclAux___closed__2; +x_42 = lean_string_append(x_37, x_41); +x_43 = lean_string_append(x_42, x_36); +x_44 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_44, 0, x_8); +lean::cnstr_set(x_44, 1, x_43); +x_45 = lean::alloc_cnstr(0, 6, 0); +lean::cnstr_set(x_45, 0, x_20); +lean::cnstr_set(x_45, 1, x_21); +lean::cnstr_set(x_45, 2, x_10); +lean::cnstr_set(x_45, 3, x_11); +lean::cnstr_set(x_45, 4, x_15); +lean::cnstr_set(x_45, 5, x_16); +x_46 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_45, x_44); +if (lean::obj_tag(x_46) == 0) { -obj* x_197; obj* x_198; obj* x_199; obj* x_200; obj* x_201; obj* x_202; obj* x_203; -x_197 = lean::cnstr_get(x_196, 1); -lean::inc(x_197); -if (lean::is_exclusive(x_196)) { - lean::cnstr_release(x_196, 0); - lean::cnstr_release(x_196, 1); - x_198 = x_196; -} else { - lean::dec_ref(x_196); - x_198 = lean::box(0); -} -x_199 = l_PersistentHashMap_Stats_toString___closed__5; -x_200 = lean_string_append(x_197, x_199); -x_201 = lean_string_append(x_200, x_186); -if (lean::is_scalar(x_198)) { - x_202 = lean::alloc_cnstr(0, 2, 0); -} else { - x_202 = x_198; -} -lean::cnstr_set(x_202, 0, x_8); -lean::cnstr_set(x_202, 1, x_201); -x_203 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_2, x_202); -lean::dec(x_2); -return x_203; +uint8 x_47; +x_47 = !lean::is_exclusive(x_46); +if (x_47 == 0) +{ +obj* x_48; obj* x_49; obj* x_50; obj* x_51; obj* x_52; +x_48 = lean::cnstr_get(x_46, 1); +x_49 = lean::cnstr_get(x_46, 0); +lean::dec(x_49); +x_50 = l_PersistentHashMap_Stats_toString___closed__5; +x_51 = lean_string_append(x_48, x_50); +x_52 = lean_string_append(x_51, x_36); +lean::cnstr_set(x_46, 1, x_52); +lean::cnstr_set(x_46, 0, x_8); +return x_46; } else { -obj* x_204; obj* x_205; obj* x_206; obj* x_207; -lean::dec(x_2); -lean::dec(x_15); -x_204 = lean::cnstr_get(x_196, 0); -lean::inc(x_204); -x_205 = lean::cnstr_get(x_196, 1); -lean::inc(x_205); -if (lean::is_exclusive(x_196)) { - lean::cnstr_release(x_196, 0); - lean::cnstr_release(x_196, 1); - x_206 = x_196; -} else { - lean::dec_ref(x_196); - x_206 = lean::box(0); -} -if (lean::is_scalar(x_206)) { - x_207 = lean::alloc_cnstr(1, 2, 0); -} else { - x_207 = x_206; -} -lean::cnstr_set(x_207, 0, x_204); -lean::cnstr_set(x_207, 1, x_205); -return x_207; +obj* x_53; obj* x_54; obj* x_55; obj* x_56; obj* x_57; +x_53 = lean::cnstr_get(x_46, 1); +lean::inc(x_53); +lean::dec(x_46); +x_54 = l_PersistentHashMap_Stats_toString___closed__5; +x_55 = lean_string_append(x_53, x_54); +x_56 = lean_string_append(x_55, x_36); +x_57 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_57, 0, x_8); +lean::cnstr_set(x_57, 1, x_56); +return x_57; } } else { -uint8 x_208; -x_208 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_12); +uint8 x_58; +x_58 = !lean::is_exclusive(x_46); +if (x_58 == 0) +{ +return x_46; +} +else +{ +obj* x_59; obj* x_60; obj* x_61; +x_59 = lean::cnstr_get(x_46, 0); +x_60 = lean::cnstr_get(x_46, 1); +lean::inc(x_60); +lean::inc(x_59); +lean::dec(x_46); +x_61 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_61, 0, x_59); +lean::cnstr_set(x_61, 1, x_60); +return x_61; +} +} +} +else +{ +uint8 x_62; +x_62 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_12); lean::dec(x_12); -if (x_208 == 0) +if (x_62 == 0) { -obj* x_209; obj* x_210; obj* x_211; obj* x_212; obj* x_213; obj* x_214; -lean::dec(x_188); -lean::dec(x_182); -x_209 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_210 = lean_string_append(x_187, x_209); -x_211 = lean_string_append(x_210, x_186); -x_212 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_212, 0, x_8); -lean::cnstr_set(x_212, 1, x_211); -lean::inc(x_15); -x_213 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_213, 0, x_20); -lean::cnstr_set(x_213, 1, x_21); -lean::cnstr_set(x_213, 2, x_10); -lean::cnstr_set(x_213, 3, x_11); -lean::cnstr_set(x_213, 4, x_15); -lean::cnstr_set(x_213, 5, x_16); -x_214 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_213, x_212); -if (lean::obj_tag(x_214) == 0) -{ -obj* x_215; obj* x_216; obj* x_217; obj* x_218; obj* x_219; obj* x_220; obj* x_221; -x_215 = lean::cnstr_get(x_214, 1); -lean::inc(x_215); -if (lean::is_exclusive(x_214)) { - lean::cnstr_release(x_214, 0); - lean::cnstr_release(x_214, 1); - x_216 = x_214; -} else { - lean::dec_ref(x_214); - x_216 = lean::box(0); -} -x_217 = l_PersistentHashMap_Stats_toString___closed__5; -x_218 = lean_string_append(x_215, x_217); -x_219 = lean_string_append(x_218, x_186); -if (lean::is_scalar(x_216)) { - x_220 = lean::alloc_cnstr(0, 2, 0); -} else { - x_220 = x_216; -} -lean::cnstr_set(x_220, 0, x_8); -lean::cnstr_set(x_220, 1, x_219); -x_221 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_2, x_220); +obj* x_63; obj* x_64; obj* x_65; obj* x_66; obj* x_67; obj* x_68; +lean::dec(x_38); +lean::dec(x_32); lean::dec(x_2); -return x_221; +x_63 = l_Lean_IR_EmitC_emitDeclAux___closed__2; +x_64 = lean_string_append(x_37, x_63); +x_65 = lean_string_append(x_64, x_36); +x_66 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_66, 0, x_8); +lean::cnstr_set(x_66, 1, x_65); +x_67 = lean::alloc_cnstr(0, 6, 0); +lean::cnstr_set(x_67, 0, x_20); +lean::cnstr_set(x_67, 1, x_21); +lean::cnstr_set(x_67, 2, x_10); +lean::cnstr_set(x_67, 3, x_11); +lean::cnstr_set(x_67, 4, x_15); +lean::cnstr_set(x_67, 5, x_16); +x_68 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_67, x_66); +if (lean::obj_tag(x_68) == 0) +{ +uint8 x_69; +x_69 = !lean::is_exclusive(x_68); +if (x_69 == 0) +{ +obj* x_70; obj* x_71; obj* x_72; obj* x_73; obj* x_74; +x_70 = lean::cnstr_get(x_68, 1); +x_71 = lean::cnstr_get(x_68, 0); +lean::dec(x_71); +x_72 = l_PersistentHashMap_Stats_toString___closed__5; +x_73 = lean_string_append(x_70, x_72); +x_74 = lean_string_append(x_73, x_36); +lean::cnstr_set(x_68, 1, x_74); +lean::cnstr_set(x_68, 0, x_8); +return x_68; } else { -obj* x_222; obj* x_223; obj* x_224; obj* x_225; -lean::dec(x_2); -lean::dec(x_15); -x_222 = lean::cnstr_get(x_214, 0); -lean::inc(x_222); -x_223 = lean::cnstr_get(x_214, 1); -lean::inc(x_223); -if (lean::is_exclusive(x_214)) { - lean::cnstr_release(x_214, 0); - lean::cnstr_release(x_214, 1); - x_224 = x_214; -} else { - lean::dec_ref(x_214); - x_224 = lean::box(0); -} -if (lean::is_scalar(x_224)) { - x_225 = lean::alloc_cnstr(1, 2, 0); -} else { - x_225 = x_224; -} -lean::cnstr_set(x_225, 0, x_222); -lean::cnstr_set(x_225, 1, x_223); -return x_225; +obj* x_75; obj* x_76; obj* x_77; obj* x_78; obj* x_79; +x_75 = lean::cnstr_get(x_68, 1); +lean::inc(x_75); +lean::dec(x_68); +x_76 = l_PersistentHashMap_Stats_toString___closed__5; +x_77 = lean_string_append(x_75, x_76); +x_78 = lean_string_append(x_77, x_36); +x_79 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_79, 0, x_8); +lean::cnstr_set(x_79, 1, x_78); +return x_79; } } else { -obj* x_226; -lean::dec(x_187); -lean::inc(x_182); -x_226 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(x_16, x_182, x_182, x_2, x_188); -lean::dec(x_182); -if (lean::obj_tag(x_226) == 0) +uint8 x_80; +x_80 = !lean::is_exclusive(x_68); +if (x_80 == 0) { -obj* x_227; obj* x_228; obj* x_229; obj* x_230; obj* x_231; obj* x_232; obj* x_233; obj* x_234; -x_227 = lean::cnstr_get(x_226, 1); -lean::inc(x_227); -if (lean::is_exclusive(x_226)) { - lean::cnstr_release(x_226, 0); - lean::cnstr_release(x_226, 1); - x_228 = x_226; -} else { - lean::dec_ref(x_226); - x_228 = lean::box(0); -} -x_229 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_230 = lean_string_append(x_227, x_229); -x_231 = lean_string_append(x_230, x_186); -if (lean::is_scalar(x_228)) { - x_232 = lean::alloc_cnstr(0, 2, 0); -} else { - x_232 = x_228; -} -lean::cnstr_set(x_232, 0, x_8); -lean::cnstr_set(x_232, 1, x_231); -lean::inc(x_15); -x_233 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_233, 0, x_20); -lean::cnstr_set(x_233, 1, x_21); -lean::cnstr_set(x_233, 2, x_10); -lean::cnstr_set(x_233, 3, x_11); -lean::cnstr_set(x_233, 4, x_15); -lean::cnstr_set(x_233, 5, x_16); -x_234 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_233, x_232); -if (lean::obj_tag(x_234) == 0) -{ -obj* x_235; obj* x_236; obj* x_237; obj* x_238; obj* x_239; obj* x_240; obj* x_241; -x_235 = lean::cnstr_get(x_234, 1); -lean::inc(x_235); -if (lean::is_exclusive(x_234)) { - lean::cnstr_release(x_234, 0); - lean::cnstr_release(x_234, 1); - x_236 = x_234; -} else { - lean::dec_ref(x_234); - x_236 = lean::box(0); -} -x_237 = l_PersistentHashMap_Stats_toString___closed__5; -x_238 = lean_string_append(x_235, x_237); -x_239 = lean_string_append(x_238, x_186); -if (lean::is_scalar(x_236)) { - x_240 = lean::alloc_cnstr(0, 2, 0); -} else { - x_240 = x_236; -} -lean::cnstr_set(x_240, 0, x_8); -lean::cnstr_set(x_240, 1, x_239); -x_241 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_2, x_240); -lean::dec(x_2); -return x_241; +return x_68; } else { -obj* x_242; obj* x_243; obj* x_244; obj* x_245; -lean::dec(x_2); -lean::dec(x_15); -x_242 = lean::cnstr_get(x_234, 0); -lean::inc(x_242); -x_243 = lean::cnstr_get(x_234, 1); -lean::inc(x_243); -if (lean::is_exclusive(x_234)) { - lean::cnstr_release(x_234, 0); - lean::cnstr_release(x_234, 1); - x_244 = x_234; -} else { - lean::dec_ref(x_234); - x_244 = lean::box(0); +obj* x_81; obj* x_82; obj* x_83; +x_81 = lean::cnstr_get(x_68, 0); +x_82 = lean::cnstr_get(x_68, 1); +lean::inc(x_82); +lean::inc(x_81); +lean::dec(x_68); +x_83 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_83, 0, x_81); +lean::cnstr_set(x_83, 1, x_82); +return x_83; } -if (lean::is_scalar(x_244)) { - x_245 = lean::alloc_cnstr(1, 2, 0); -} else { - x_245 = x_244; -} -lean::cnstr_set(x_245, 0, x_242); -lean::cnstr_set(x_245, 1, x_243); -return x_245; } } else { -obj* x_246; obj* x_247; obj* x_248; obj* x_249; +obj* x_84; +lean::dec(x_37); +lean::inc(x_32); +x_84 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(x_16, x_32, x_32, x_2, x_38); lean::dec(x_2); +lean::dec(x_32); +if (lean::obj_tag(x_84) == 0) +{ +uint8 x_85; +x_85 = !lean::is_exclusive(x_84); +if (x_85 == 0) +{ +obj* x_86; obj* x_87; obj* x_88; obj* x_89; obj* x_90; obj* x_91; obj* x_92; +x_86 = lean::cnstr_get(x_84, 1); +x_87 = lean::cnstr_get(x_84, 0); +lean::dec(x_87); +x_88 = l_Lean_IR_EmitC_emitDeclAux___closed__2; +x_89 = lean_string_append(x_86, x_88); +x_90 = lean_string_append(x_89, x_36); +lean::cnstr_set(x_84, 1, x_90); +lean::cnstr_set(x_84, 0, x_8); +x_91 = lean::alloc_cnstr(0, 6, 0); +lean::cnstr_set(x_91, 0, x_20); +lean::cnstr_set(x_91, 1, x_21); +lean::cnstr_set(x_91, 2, x_10); +lean::cnstr_set(x_91, 3, x_11); +lean::cnstr_set(x_91, 4, x_15); +lean::cnstr_set(x_91, 5, x_16); +x_92 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_91, x_84); +if (lean::obj_tag(x_92) == 0) +{ +uint8 x_93; +x_93 = !lean::is_exclusive(x_92); +if (x_93 == 0) +{ +obj* x_94; obj* x_95; obj* x_96; obj* x_97; obj* x_98; +x_94 = lean::cnstr_get(x_92, 1); +x_95 = lean::cnstr_get(x_92, 0); +lean::dec(x_95); +x_96 = l_PersistentHashMap_Stats_toString___closed__5; +x_97 = lean_string_append(x_94, x_96); +x_98 = lean_string_append(x_97, x_36); +lean::cnstr_set(x_92, 1, x_98); +lean::cnstr_set(x_92, 0, x_8); +return x_92; +} +else +{ +obj* x_99; obj* x_100; obj* x_101; obj* x_102; obj* x_103; +x_99 = lean::cnstr_get(x_92, 1); +lean::inc(x_99); +lean::dec(x_92); +x_100 = l_PersistentHashMap_Stats_toString___closed__5; +x_101 = lean_string_append(x_99, x_100); +x_102 = lean_string_append(x_101, x_36); +x_103 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_103, 0, x_8); +lean::cnstr_set(x_103, 1, x_102); +return x_103; +} +} +else +{ +uint8 x_104; +x_104 = !lean::is_exclusive(x_92); +if (x_104 == 0) +{ +return x_92; +} +else +{ +obj* x_105; obj* x_106; obj* x_107; +x_105 = lean::cnstr_get(x_92, 0); +x_106 = lean::cnstr_get(x_92, 1); +lean::inc(x_106); +lean::inc(x_105); +lean::dec(x_92); +x_107 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_107, 0, x_105); +lean::cnstr_set(x_107, 1, x_106); +return x_107; +} +} +} +else +{ +obj* x_108; obj* x_109; obj* x_110; obj* x_111; obj* x_112; obj* x_113; obj* x_114; +x_108 = lean::cnstr_get(x_84, 1); +lean::inc(x_108); +lean::dec(x_84); +x_109 = l_Lean_IR_EmitC_emitDeclAux___closed__2; +x_110 = lean_string_append(x_108, x_109); +x_111 = lean_string_append(x_110, x_36); +x_112 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_112, 0, x_8); +lean::cnstr_set(x_112, 1, x_111); +x_113 = lean::alloc_cnstr(0, 6, 0); +lean::cnstr_set(x_113, 0, x_20); +lean::cnstr_set(x_113, 1, x_21); +lean::cnstr_set(x_113, 2, x_10); +lean::cnstr_set(x_113, 3, x_11); +lean::cnstr_set(x_113, 4, x_15); +lean::cnstr_set(x_113, 5, x_16); +x_114 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_113, x_112); +if (lean::obj_tag(x_114) == 0) +{ +obj* x_115; obj* x_116; obj* x_117; obj* x_118; obj* x_119; obj* x_120; +x_115 = lean::cnstr_get(x_114, 1); +lean::inc(x_115); +if (lean::is_exclusive(x_114)) { + lean::cnstr_release(x_114, 0); + lean::cnstr_release(x_114, 1); + x_116 = x_114; +} else { + lean::dec_ref(x_114); + x_116 = lean::box(0); +} +x_117 = l_PersistentHashMap_Stats_toString___closed__5; +x_118 = lean_string_append(x_115, x_117); +x_119 = lean_string_append(x_118, x_36); +if (lean::is_scalar(x_116)) { + x_120 = lean::alloc_cnstr(0, 2, 0); +} else { + x_120 = x_116; +} +lean::cnstr_set(x_120, 0, x_8); +lean::cnstr_set(x_120, 1, x_119); +return x_120; +} +else +{ +obj* x_121; obj* x_122; obj* x_123; obj* x_124; +x_121 = lean::cnstr_get(x_114, 0); +lean::inc(x_121); +x_122 = lean::cnstr_get(x_114, 1); +lean::inc(x_122); +if (lean::is_exclusive(x_114)) { + lean::cnstr_release(x_114, 0); + lean::cnstr_release(x_114, 1); + x_123 = x_114; +} else { + lean::dec_ref(x_114); + x_123 = lean::box(0); +} +if (lean::is_scalar(x_123)) { + x_124 = lean::alloc_cnstr(1, 2, 0); +} else { + x_124 = x_123; +} +lean::cnstr_set(x_124, 0, x_121); +lean::cnstr_set(x_124, 1, x_122); +return x_124; +} +} +} +else +{ +uint8 x_125; lean::dec(x_21); lean::dec(x_20); lean::dec(x_18); @@ -23944,26 +21991,24 @@ lean::dec(x_16); lean::dec(x_15); lean::dec(x_11); lean::dec(x_10); -x_246 = lean::cnstr_get(x_226, 0); -lean::inc(x_246); -x_247 = lean::cnstr_get(x_226, 1); -lean::inc(x_247); -if (lean::is_exclusive(x_226)) { - lean::cnstr_release(x_226, 0); - lean::cnstr_release(x_226, 1); - x_248 = x_226; -} else { - lean::dec_ref(x_226); - x_248 = lean::box(0); +x_125 = !lean::is_exclusive(x_84); +if (x_125 == 0) +{ +return x_84; } -if (lean::is_scalar(x_248)) { - x_249 = lean::alloc_cnstr(1, 2, 0); -} else { - x_249 = x_248; +else +{ +obj* x_126; obj* x_127; obj* x_128; +x_126 = lean::cnstr_get(x_84, 0); +x_127 = lean::cnstr_get(x_84, 1); +lean::inc(x_127); +lean::inc(x_126); +lean::dec(x_84); +x_128 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_128, 0, x_126); +lean::cnstr_set(x_128, 1, x_127); +return x_128; } -lean::cnstr_set(x_249, 0, x_246); -lean::cnstr_set(x_249, 1, x_247); -return x_249; } } } @@ -23971,7 +22016,7 @@ return x_249; } else { -obj* x_279; obj* x_280; obj* x_281; obj* x_282; +uint8 x_158; lean::dec(x_2); lean::dec(x_21); lean::dec(x_20); @@ -23981,398 +22026,907 @@ lean::dec(x_15); lean::dec(x_12); lean::dec(x_11); lean::dec(x_10); -x_279 = lean::cnstr_get(x_174, 0); -lean::inc(x_279); -x_280 = lean::cnstr_get(x_174, 1); -lean::inc(x_280); -if (lean::is_exclusive(x_174)) { - lean::cnstr_release(x_174, 0); - lean::cnstr_release(x_174, 1); - x_281 = x_174; -} else { - lean::dec_ref(x_174); - x_281 = lean::box(0); -} -if (lean::is_scalar(x_281)) { - x_282 = lean::alloc_cnstr(1, 2, 0); -} else { - x_282 = x_281; -} -lean::cnstr_set(x_282, 0, x_279); -lean::cnstr_set(x_282, 1, x_280); -return x_282; -} -} -} -else -{ -uint8 x_283; -lean::dec(x_2); -lean::dec(x_21); -lean::dec(x_20); -lean::dec(x_18); -lean::dec(x_16); -lean::dec(x_15); -lean::dec(x_12); -lean::dec(x_11); -lean::dec(x_10); -x_283 = !lean::is_exclusive(x_24); -if (x_283 == 0) +x_158 = !lean::is_exclusive(x_24); +if (x_158 == 0) { return x_24; } else { -obj* x_284; obj* x_285; obj* x_286; -x_284 = lean::cnstr_get(x_24, 0); -x_285 = lean::cnstr_get(x_24, 1); -lean::inc(x_285); -lean::inc(x_284); +obj* x_159; obj* x_160; obj* x_161; +x_159 = lean::cnstr_get(x_24, 0); +x_160 = lean::cnstr_get(x_24, 1); +lean::inc(x_160); +lean::inc(x_159); lean::dec(x_24); -x_286 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_286, 0, x_284); -lean::cnstr_set(x_286, 1, x_285); -return x_286; +x_161 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_161, 0, x_159); +lean::cnstr_set(x_161, 1, x_160); +return x_161; } } } else { -obj* x_287; obj* x_288; obj* x_289; obj* x_290; obj* x_291; obj* x_292; -x_287 = lean::cnstr_get(x_2, 0); -x_288 = lean::cnstr_get(x_2, 1); -x_289 = lean::cnstr_get(x_2, 4); -x_290 = lean::cnstr_get(x_2, 5); -lean::inc(x_290); -lean::inc(x_289); -lean::inc(x_288); -lean::inc(x_287); +obj* x_162; obj* x_163; obj* x_164; obj* x_165; obj* x_166; obj* x_167; +x_162 = lean::cnstr_get(x_2, 0); +x_163 = lean::cnstr_get(x_2, 1); +x_164 = lean::cnstr_get(x_2, 4); +x_165 = lean::cnstr_get(x_2, 5); +lean::inc(x_165); +lean::inc(x_164); +lean::inc(x_163); +lean::inc(x_162); lean::dec(x_2); lean::inc(x_11); lean::inc(x_10); -lean::inc(x_288); -lean::inc(x_287); -x_291 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_291, 0, x_287); -lean::cnstr_set(x_291, 1, x_288); -lean::cnstr_set(x_291, 2, x_10); -lean::cnstr_set(x_291, 3, x_11); -lean::cnstr_set(x_291, 4, x_289); -lean::cnstr_set(x_291, 5, x_290); +lean::inc(x_163); +lean::inc(x_162); +x_166 = lean::alloc_cnstr(0, 6, 0); +lean::cnstr_set(x_166, 0, x_162); +lean::cnstr_set(x_166, 1, x_163); +lean::cnstr_set(x_166, 2, x_10); +lean::cnstr_set(x_166, 3, x_11); +lean::cnstr_set(x_166, 4, x_164); +lean::cnstr_set(x_166, 5, x_165); lean::inc(x_15); -x_292 = l_Lean_IR_EmitC_openNamespacesFor(x_15, x_291, x_4); -if (lean::obj_tag(x_292) == 0) +x_167 = l_Lean_IR_EmitC_toCName(x_15, x_166, x_4); +if (lean::obj_tag(x_167) == 0) { -obj* x_293; obj* x_294; obj* x_295; obj* x_296; -x_293 = lean::cnstr_get(x_292, 1); -lean::inc(x_293); -if (lean::is_exclusive(x_292)) { - lean::cnstr_release(x_292, 0); - lean::cnstr_release(x_292, 1); - x_294 = x_292; +obj* x_168; obj* x_169; obj* x_170; obj* x_171; obj* x_172; obj* x_173; obj* x_174; obj* x_175; obj* x_176; obj* x_241; uint8 x_242; +x_168 = lean::cnstr_get(x_167, 0); +lean::inc(x_168); +x_169 = lean::cnstr_get(x_167, 1); +lean::inc(x_169); +if (lean::is_exclusive(x_167)) { + lean::cnstr_release(x_167, 0); + lean::cnstr_release(x_167, 1); + x_170 = x_167; } else { - lean::dec_ref(x_292); - x_294 = lean::box(0); + lean::dec_ref(x_167); + x_170 = lean::box(0); } -if (lean::is_scalar(x_294)) { - x_295 = lean::alloc_cnstr(0, 2, 0); -} else { - x_295 = x_294; -} -lean::cnstr_set(x_295, 0, x_8); -lean::cnstr_set(x_295, 1, x_293); -lean::inc(x_15); -x_296 = l_Lean_IR_EmitC_toBaseCppName(x_15, x_291, x_295); -if (lean::obj_tag(x_296) == 0) +x_171 = l_Lean_IR_EmitC_toCType(x_17); +x_172 = lean_string_append(x_169, x_171); +lean::dec(x_171); +x_173 = l_Lean_Format_flatten___main___closed__1; +x_174 = lean_string_append(x_172, x_173); +x_175 = lean_array_get_size(x_16); +x_241 = lean::mk_nat_obj(0u); +x_242 = lean_nat_dec_lt(x_241, x_175); +if (x_242 == 0) { -obj* x_297; obj* x_298; obj* x_299; obj* x_300; obj* x_301; obj* x_302; obj* x_303; obj* x_304; obj* x_305; obj* x_373; uint8 x_374; -x_297 = lean::cnstr_get(x_296, 0); -lean::inc(x_297); -x_298 = lean::cnstr_get(x_296, 1); -lean::inc(x_298); -if (lean::is_exclusive(x_296)) { - lean::cnstr_release(x_296, 0); - lean::cnstr_release(x_296, 1); - x_299 = x_296; -} else { - lean::dec_ref(x_296); - x_299 = lean::box(0); -} -x_300 = l_Lean_IR_EmitC_toCType(x_17); -x_301 = lean_string_append(x_298, x_300); -lean::dec(x_300); -x_302 = l_Lean_Format_flatten___main___closed__1; -x_303 = lean_string_append(x_301, x_302); -x_304 = lean_array_get_size(x_16); -x_373 = lean::mk_nat_obj(0u); -x_374 = lean_nat_dec_lt(x_373, x_304); -if (x_374 == 0) -{ -obj* x_375; obj* x_376; obj* x_377; obj* x_378; obj* x_379; -x_375 = l_Lean_IR_EmitC_toCInitName___closed__1; -x_376 = lean_string_append(x_375, x_297); -lean::dec(x_297); -x_377 = l_Unit_HasRepr___closed__1; -x_378 = lean_string_append(x_376, x_377); -x_379 = lean_string_append(x_303, x_378); -lean::dec(x_378); -x_305 = x_379; -goto block_372; +obj* x_243; obj* x_244; obj* x_245; obj* x_246; obj* x_247; +x_243 = l_Lean_IR_EmitC_toCInitName___closed__1; +x_244 = lean_string_append(x_243, x_168); +lean::dec(x_168); +x_245 = l_Unit_HasRepr___closed__1; +x_246 = lean_string_append(x_244, x_245); +x_247 = lean_string_append(x_174, x_246); +lean::dec(x_246); +x_176 = x_247; +goto block_240; } else { -obj* x_380; obj* x_381; obj* x_382; obj* x_383; obj* x_384; obj* x_394; uint8 x_395; -x_380 = lean_string_append(x_303, x_297); -lean::dec(x_297); -x_381 = l_Prod_HasRepr___rarg___closed__1; -x_382 = lean_string_append(x_380, x_381); -lean::inc(x_382); -x_383 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_383, 0, x_8); -lean::cnstr_set(x_383, 1, x_382); -x_394 = l_Lean_closureMaxArgs; -x_395 = lean_nat_dec_lt(x_394, x_304); -if (x_395 == 0) +obj* x_248; obj* x_249; obj* x_250; obj* x_251; obj* x_252; obj* x_262; uint8 x_263; +x_248 = lean_string_append(x_174, x_168); +lean::dec(x_168); +x_249 = l_Prod_HasRepr___rarg___closed__1; +x_250 = lean_string_append(x_248, x_249); +lean::inc(x_250); +x_251 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_251, 0, x_8); +lean::cnstr_set(x_251, 1, x_250); +x_262 = l_Lean_closureMaxArgs; +x_263 = lean_nat_dec_lt(x_262, x_175); +if (x_263 == 0) { -lean::dec(x_382); -x_384 = x_8; -goto block_393; +lean::dec(x_250); +x_252 = x_8; +goto block_261; } else { -uint8 x_396; -x_396 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_12); -if (x_396 == 0) +uint8 x_264; +x_264 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_12); +if (x_264 == 0) { -lean::dec(x_382); -x_384 = x_8; -goto block_393; +lean::dec(x_250); +x_252 = x_8; +goto block_261; } else { -obj* x_397; obj* x_398; obj* x_399; obj* x_400; -lean::dec(x_383); -x_397 = l_Lean_IR_EmitC_emitDeclAux___closed__2; -x_398 = lean_string_append(x_382, x_397); -x_399 = l_Option_HasRepr___rarg___closed__3; -x_400 = lean_string_append(x_398, x_399); -x_305 = x_400; -goto block_372; +obj* x_265; obj* x_266; obj* x_267; obj* x_268; +lean::dec(x_251); +x_265 = l_Lean_IR_EmitC_emitDeclAux___closed__3; +x_266 = lean_string_append(x_250, x_265); +x_267 = l_Option_HasRepr___rarg___closed__3; +x_268 = lean_string_append(x_266, x_267); +x_176 = x_268; +goto block_240; } } -block_393: +block_261: { -obj* x_385; -lean::dec(x_384); -lean::inc(x_304); -x_385 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(x_16, x_304, x_304, x_291, x_383); -if (lean::obj_tag(x_385) == 0) +obj* x_253; +lean::dec(x_252); +lean::inc(x_175); +x_253 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(x_16, x_175, x_175, x_166, x_251); +if (lean::obj_tag(x_253) == 0) { -obj* x_386; obj* x_387; obj* x_388; -x_386 = lean::cnstr_get(x_385, 1); -lean::inc(x_386); -lean::dec(x_385); -x_387 = l_Option_HasRepr___rarg___closed__3; -x_388 = lean_string_append(x_386, x_387); -x_305 = x_388; -goto block_372; +obj* x_254; obj* x_255; obj* x_256; +x_254 = lean::cnstr_get(x_253, 1); +lean::inc(x_254); +lean::dec(x_253); +x_255 = l_Option_HasRepr___rarg___closed__3; +x_256 = lean_string_append(x_254, x_255); +x_176 = x_256; +goto block_240; } else { -obj* x_389; obj* x_390; obj* x_391; obj* x_392; -lean::dec(x_304); -lean::dec(x_299); -lean::dec(x_291); -lean::dec(x_288); -lean::dec(x_287); +obj* x_257; obj* x_258; obj* x_259; obj* x_260; +lean::dec(x_175); +lean::dec(x_170); +lean::dec(x_166); +lean::dec(x_163); +lean::dec(x_162); lean::dec(x_18); lean::dec(x_16); lean::dec(x_15); lean::dec(x_12); lean::dec(x_11); lean::dec(x_10); -x_389 = lean::cnstr_get(x_385, 0); -lean::inc(x_389); -x_390 = lean::cnstr_get(x_385, 1); -lean::inc(x_390); -if (lean::is_exclusive(x_385)) { - lean::cnstr_release(x_385, 0); - lean::cnstr_release(x_385, 1); - x_391 = x_385; +x_257 = lean::cnstr_get(x_253, 0); +lean::inc(x_257); +x_258 = lean::cnstr_get(x_253, 1); +lean::inc(x_258); +if (lean::is_exclusive(x_253)) { + lean::cnstr_release(x_253, 0); + lean::cnstr_release(x_253, 1); + x_259 = x_253; } else { - lean::dec_ref(x_385); - x_391 = lean::box(0); + lean::dec_ref(x_253); + x_259 = lean::box(0); } -if (lean::is_scalar(x_391)) { - x_392 = lean::alloc_cnstr(1, 2, 0); +if (lean::is_scalar(x_259)) { + x_260 = lean::alloc_cnstr(1, 2, 0); } else { - x_392 = x_391; + x_260 = x_259; } -lean::cnstr_set(x_392, 0, x_389); -lean::cnstr_set(x_392, 1, x_390); -return x_392; +lean::cnstr_set(x_260, 0, x_257); +lean::cnstr_set(x_260, 1, x_258); +return x_260; } } } -block_372: +block_240: { -obj* x_306; obj* x_307; obj* x_308; obj* x_309; obj* x_310; obj* x_311; uint8 x_312; -x_306 = l_Lean_IR_EmitC_openNamespacesAux___main___closed__2; -x_307 = lean_string_append(x_305, x_306); -x_308 = l_IO_println___rarg___closed__1; -x_309 = lean_string_append(x_307, x_308); -lean::inc(x_309); -if (lean::is_scalar(x_299)) { - x_310 = lean::alloc_cnstr(0, 2, 0); +obj* x_177; obj* x_178; obj* x_179; obj* x_180; obj* x_181; obj* x_182; uint8 x_183; +x_177 = l_Lean_IR_EmitC_emitDeclAux___closed__1; +x_178 = lean_string_append(x_176, x_177); +x_179 = l_IO_println___rarg___closed__1; +x_180 = lean_string_append(x_178, x_179); +lean::inc(x_180); +if (lean::is_scalar(x_170)) { + x_181 = lean::alloc_cnstr(0, 2, 0); } else { - x_310 = x_299; + x_181 = x_170; } -lean::cnstr_set(x_310, 0, x_8); -lean::cnstr_set(x_310, 1, x_309); -x_311 = l_Lean_closureMaxArgs; -x_312 = lean_nat_dec_lt(x_311, x_304); -if (x_312 == 0) +lean::cnstr_set(x_181, 0, x_8); +lean::cnstr_set(x_181, 1, x_180); +x_182 = l_Lean_closureMaxArgs; +x_183 = lean_nat_dec_lt(x_182, x_175); +if (x_183 == 0) { -obj* x_313; obj* x_314; obj* x_315; obj* x_316; obj* x_317; obj* x_318; -lean::dec(x_310); -lean::dec(x_304); +obj* x_184; obj* x_185; obj* x_186; obj* x_187; obj* x_188; obj* x_189; +lean::dec(x_181); +lean::dec(x_175); +lean::dec(x_166); lean::dec(x_12); -x_313 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_314 = lean_string_append(x_309, x_313); -x_315 = lean_string_append(x_314, x_308); -x_316 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_316, 0, x_8); -lean::cnstr_set(x_316, 1, x_315); -lean::inc(x_15); -x_317 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_317, 0, x_287); -lean::cnstr_set(x_317, 1, x_288); -lean::cnstr_set(x_317, 2, x_10); -lean::cnstr_set(x_317, 3, x_11); -lean::cnstr_set(x_317, 4, x_15); -lean::cnstr_set(x_317, 5, x_16); -x_318 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_317, x_316); -if (lean::obj_tag(x_318) == 0) +x_184 = l_Lean_IR_EmitC_emitDeclAux___closed__2; +x_185 = lean_string_append(x_180, x_184); +x_186 = lean_string_append(x_185, x_179); +x_187 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_187, 0, x_8); +lean::cnstr_set(x_187, 1, x_186); +x_188 = lean::alloc_cnstr(0, 6, 0); +lean::cnstr_set(x_188, 0, x_162); +lean::cnstr_set(x_188, 1, x_163); +lean::cnstr_set(x_188, 2, x_10); +lean::cnstr_set(x_188, 3, x_11); +lean::cnstr_set(x_188, 4, x_15); +lean::cnstr_set(x_188, 5, x_16); +x_189 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_188, x_187); +if (lean::obj_tag(x_189) == 0) { -obj* x_319; obj* x_320; obj* x_321; obj* x_322; obj* x_323; obj* x_324; obj* x_325; -x_319 = lean::cnstr_get(x_318, 1); -lean::inc(x_319); -if (lean::is_exclusive(x_318)) { - lean::cnstr_release(x_318, 0); - lean::cnstr_release(x_318, 1); - x_320 = x_318; +obj* x_190; obj* x_191; obj* x_192; obj* x_193; obj* x_194; obj* x_195; +x_190 = lean::cnstr_get(x_189, 1); +lean::inc(x_190); +if (lean::is_exclusive(x_189)) { + lean::cnstr_release(x_189, 0); + lean::cnstr_release(x_189, 1); + x_191 = x_189; } else { - lean::dec_ref(x_318); - x_320 = lean::box(0); + lean::dec_ref(x_189); + x_191 = lean::box(0); } -x_321 = l_PersistentHashMap_Stats_toString___closed__5; -x_322 = lean_string_append(x_319, x_321); -x_323 = lean_string_append(x_322, x_308); -if (lean::is_scalar(x_320)) { - x_324 = lean::alloc_cnstr(0, 2, 0); +x_192 = l_PersistentHashMap_Stats_toString___closed__5; +x_193 = lean_string_append(x_190, x_192); +x_194 = lean_string_append(x_193, x_179); +if (lean::is_scalar(x_191)) { + x_195 = lean::alloc_cnstr(0, 2, 0); } else { - x_324 = x_320; + x_195 = x_191; } -lean::cnstr_set(x_324, 0, x_8); -lean::cnstr_set(x_324, 1, x_323); -x_325 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_291, x_324); -lean::dec(x_291); -return x_325; +lean::cnstr_set(x_195, 0, x_8); +lean::cnstr_set(x_195, 1, x_194); +return x_195; } else { -obj* x_326; obj* x_327; obj* x_328; obj* x_329; -lean::dec(x_291); +obj* x_196; obj* x_197; obj* x_198; obj* x_199; +x_196 = lean::cnstr_get(x_189, 0); +lean::inc(x_196); +x_197 = lean::cnstr_get(x_189, 1); +lean::inc(x_197); +if (lean::is_exclusive(x_189)) { + lean::cnstr_release(x_189, 0); + lean::cnstr_release(x_189, 1); + x_198 = x_189; +} else { + lean::dec_ref(x_189); + x_198 = lean::box(0); +} +if (lean::is_scalar(x_198)) { + x_199 = lean::alloc_cnstr(1, 2, 0); +} else { + x_199 = x_198; +} +lean::cnstr_set(x_199, 0, x_196); +lean::cnstr_set(x_199, 1, x_197); +return x_199; +} +} +else +{ +uint8 x_200; +x_200 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_12); +lean::dec(x_12); +if (x_200 == 0) +{ +obj* x_201; obj* x_202; obj* x_203; obj* x_204; obj* x_205; obj* x_206; +lean::dec(x_181); +lean::dec(x_175); +lean::dec(x_166); +x_201 = l_Lean_IR_EmitC_emitDeclAux___closed__2; +x_202 = lean_string_append(x_180, x_201); +x_203 = lean_string_append(x_202, x_179); +x_204 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_204, 0, x_8); +lean::cnstr_set(x_204, 1, x_203); +x_205 = lean::alloc_cnstr(0, 6, 0); +lean::cnstr_set(x_205, 0, x_162); +lean::cnstr_set(x_205, 1, x_163); +lean::cnstr_set(x_205, 2, x_10); +lean::cnstr_set(x_205, 3, x_11); +lean::cnstr_set(x_205, 4, x_15); +lean::cnstr_set(x_205, 5, x_16); +x_206 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_205, x_204); +if (lean::obj_tag(x_206) == 0) +{ +obj* x_207; obj* x_208; obj* x_209; obj* x_210; obj* x_211; obj* x_212; +x_207 = lean::cnstr_get(x_206, 1); +lean::inc(x_207); +if (lean::is_exclusive(x_206)) { + lean::cnstr_release(x_206, 0); + lean::cnstr_release(x_206, 1); + x_208 = x_206; +} else { + lean::dec_ref(x_206); + x_208 = lean::box(0); +} +x_209 = l_PersistentHashMap_Stats_toString___closed__5; +x_210 = lean_string_append(x_207, x_209); +x_211 = lean_string_append(x_210, x_179); +if (lean::is_scalar(x_208)) { + x_212 = lean::alloc_cnstr(0, 2, 0); +} else { + x_212 = x_208; +} +lean::cnstr_set(x_212, 0, x_8); +lean::cnstr_set(x_212, 1, x_211); +return x_212; +} +else +{ +obj* x_213; obj* x_214; obj* x_215; obj* x_216; +x_213 = lean::cnstr_get(x_206, 0); +lean::inc(x_213); +x_214 = lean::cnstr_get(x_206, 1); +lean::inc(x_214); +if (lean::is_exclusive(x_206)) { + lean::cnstr_release(x_206, 0); + lean::cnstr_release(x_206, 1); + x_215 = x_206; +} else { + lean::dec_ref(x_206); + x_215 = lean::box(0); +} +if (lean::is_scalar(x_215)) { + x_216 = lean::alloc_cnstr(1, 2, 0); +} else { + x_216 = x_215; +} +lean::cnstr_set(x_216, 0, x_213); +lean::cnstr_set(x_216, 1, x_214); +return x_216; +} +} +else +{ +obj* x_217; +lean::dec(x_180); +lean::inc(x_175); +x_217 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(x_16, x_175, x_175, x_166, x_181); +lean::dec(x_166); +lean::dec(x_175); +if (lean::obj_tag(x_217) == 0) +{ +obj* x_218; obj* x_219; obj* x_220; obj* x_221; obj* x_222; obj* x_223; obj* x_224; obj* x_225; +x_218 = lean::cnstr_get(x_217, 1); +lean::inc(x_218); +if (lean::is_exclusive(x_217)) { + lean::cnstr_release(x_217, 0); + lean::cnstr_release(x_217, 1); + x_219 = x_217; +} else { + lean::dec_ref(x_217); + x_219 = lean::box(0); +} +x_220 = l_Lean_IR_EmitC_emitDeclAux___closed__2; +x_221 = lean_string_append(x_218, x_220); +x_222 = lean_string_append(x_221, x_179); +if (lean::is_scalar(x_219)) { + x_223 = lean::alloc_cnstr(0, 2, 0); +} else { + x_223 = x_219; +} +lean::cnstr_set(x_223, 0, x_8); +lean::cnstr_set(x_223, 1, x_222); +x_224 = lean::alloc_cnstr(0, 6, 0); +lean::cnstr_set(x_224, 0, x_162); +lean::cnstr_set(x_224, 1, x_163); +lean::cnstr_set(x_224, 2, x_10); +lean::cnstr_set(x_224, 3, x_11); +lean::cnstr_set(x_224, 4, x_15); +lean::cnstr_set(x_224, 5, x_16); +x_225 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_224, x_223); +if (lean::obj_tag(x_225) == 0) +{ +obj* x_226; obj* x_227; obj* x_228; obj* x_229; obj* x_230; obj* x_231; +x_226 = lean::cnstr_get(x_225, 1); +lean::inc(x_226); +if (lean::is_exclusive(x_225)) { + lean::cnstr_release(x_225, 0); + lean::cnstr_release(x_225, 1); + x_227 = x_225; +} else { + lean::dec_ref(x_225); + x_227 = lean::box(0); +} +x_228 = l_PersistentHashMap_Stats_toString___closed__5; +x_229 = lean_string_append(x_226, x_228); +x_230 = lean_string_append(x_229, x_179); +if (lean::is_scalar(x_227)) { + x_231 = lean::alloc_cnstr(0, 2, 0); +} else { + x_231 = x_227; +} +lean::cnstr_set(x_231, 0, x_8); +lean::cnstr_set(x_231, 1, x_230); +return x_231; +} +else +{ +obj* x_232; obj* x_233; obj* x_234; obj* x_235; +x_232 = lean::cnstr_get(x_225, 0); +lean::inc(x_232); +x_233 = lean::cnstr_get(x_225, 1); +lean::inc(x_233); +if (lean::is_exclusive(x_225)) { + lean::cnstr_release(x_225, 0); + lean::cnstr_release(x_225, 1); + x_234 = x_225; +} else { + lean::dec_ref(x_225); + x_234 = lean::box(0); +} +if (lean::is_scalar(x_234)) { + x_235 = lean::alloc_cnstr(1, 2, 0); +} else { + x_235 = x_234; +} +lean::cnstr_set(x_235, 0, x_232); +lean::cnstr_set(x_235, 1, x_233); +return x_235; +} +} +else +{ +obj* x_236; obj* x_237; obj* x_238; obj* x_239; +lean::dec(x_163); +lean::dec(x_162); +lean::dec(x_18); +lean::dec(x_16); lean::dec(x_15); -x_326 = lean::cnstr_get(x_318, 0); -lean::inc(x_326); -x_327 = lean::cnstr_get(x_318, 1); -lean::inc(x_327); -if (lean::is_exclusive(x_318)) { - lean::cnstr_release(x_318, 0); - lean::cnstr_release(x_318, 1); - x_328 = x_318; +lean::dec(x_11); +lean::dec(x_10); +x_236 = lean::cnstr_get(x_217, 0); +lean::inc(x_236); +x_237 = lean::cnstr_get(x_217, 1); +lean::inc(x_237); +if (lean::is_exclusive(x_217)) { + lean::cnstr_release(x_217, 0); + lean::cnstr_release(x_217, 1); + x_238 = x_217; } else { - lean::dec_ref(x_318); - x_328 = lean::box(0); + lean::dec_ref(x_217); + x_238 = lean::box(0); } -if (lean::is_scalar(x_328)) { - x_329 = lean::alloc_cnstr(1, 2, 0); +if (lean::is_scalar(x_238)) { + x_239 = lean::alloc_cnstr(1, 2, 0); } else { - x_329 = x_328; + x_239 = x_238; +} +lean::cnstr_set(x_239, 0, x_236); +lean::cnstr_set(x_239, 1, x_237); +return x_239; +} +} } -lean::cnstr_set(x_329, 0, x_326); -lean::cnstr_set(x_329, 1, x_327); -return x_329; } } else { -uint8 x_330; -x_330 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_12); +obj* x_269; obj* x_270; obj* x_271; obj* x_272; +lean::dec(x_166); +lean::dec(x_163); +lean::dec(x_162); +lean::dec(x_18); +lean::dec(x_16); +lean::dec(x_15); lean::dec(x_12); -if (x_330 == 0) -{ -obj* x_331; obj* x_332; obj* x_333; obj* x_334; obj* x_335; obj* x_336; -lean::dec(x_310); -lean::dec(x_304); -x_331 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_332 = lean_string_append(x_309, x_331); -x_333 = lean_string_append(x_332, x_308); -x_334 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_334, 0, x_8); -lean::cnstr_set(x_334, 1, x_333); -lean::inc(x_15); -x_335 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_335, 0, x_287); -lean::cnstr_set(x_335, 1, x_288); -lean::cnstr_set(x_335, 2, x_10); -lean::cnstr_set(x_335, 3, x_11); -lean::cnstr_set(x_335, 4, x_15); -lean::cnstr_set(x_335, 5, x_16); -x_336 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_335, x_334); -if (lean::obj_tag(x_336) == 0) -{ -obj* x_337; obj* x_338; obj* x_339; obj* x_340; obj* x_341; obj* x_342; obj* x_343; -x_337 = lean::cnstr_get(x_336, 1); -lean::inc(x_337); -if (lean::is_exclusive(x_336)) { - lean::cnstr_release(x_336, 0); - lean::cnstr_release(x_336, 1); - x_338 = x_336; +lean::dec(x_11); +lean::dec(x_10); +x_269 = lean::cnstr_get(x_167, 0); +lean::inc(x_269); +x_270 = lean::cnstr_get(x_167, 1); +lean::inc(x_270); +if (lean::is_exclusive(x_167)) { + lean::cnstr_release(x_167, 0); + lean::cnstr_release(x_167, 1); + x_271 = x_167; } else { - lean::dec_ref(x_336); - x_338 = lean::box(0); + lean::dec_ref(x_167); + x_271 = lean::box(0); } -x_339 = l_PersistentHashMap_Stats_toString___closed__5; -x_340 = lean_string_append(x_337, x_339); -x_341 = lean_string_append(x_340, x_308); -if (lean::is_scalar(x_338)) { - x_342 = lean::alloc_cnstr(0, 2, 0); +if (lean::is_scalar(x_271)) { + x_272 = lean::alloc_cnstr(1, 2, 0); } else { - x_342 = x_338; + x_272 = x_271; } -lean::cnstr_set(x_342, 0, x_8); -lean::cnstr_set(x_342, 1, x_341); -x_343 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_291, x_342); +lean::cnstr_set(x_272, 0, x_269); +lean::cnstr_set(x_272, 1, x_270); +return x_272; +} +} +} +else +{ +obj* x_273; +lean::dec(x_12); +lean::dec(x_11); +lean::dec(x_10); +lean::dec(x_4); +lean::dec(x_2); +lean::dec(x_1); +x_273 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_273, 0, x_8); +lean::cnstr_set(x_273, 1, x_7); +return x_273; +} +} +else +{ +obj* x_274; +lean::dec(x_12); +lean::dec(x_11); +lean::dec(x_10); +lean::dec(x_4); +lean::dec(x_2); +lean::dec(x_1); +x_274 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_274, 0, x_8); +lean::cnstr_set(x_274, 1, x_7); +return x_274; +} +} +} +else +{ +obj* x_278; obj* x_279; obj* x_280; obj* x_281; obj* x_282; obj* x_283; obj* x_284; obj* x_285; uint8 x_286; uint8 x_287; +x_278 = lean::cnstr_get(x_4, 0); +x_279 = lean::cnstr_get(x_4, 1); +lean::inc(x_279); +lean::inc(x_278); +lean::dec(x_4); +x_280 = lean::box(0); +lean::inc(x_279); +x_281 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_281, 0, x_280); +lean::cnstr_set(x_281, 1, x_279); +lean::inc(x_1); +x_282 = l_Lean_IR_mkVarJPMaps(x_1); +x_283 = lean::cnstr_get(x_282, 0); +lean::inc(x_283); +x_284 = lean::cnstr_get(x_282, 1); +lean::inc(x_284); +lean::dec(x_282); +x_285 = l_Lean_IR_Decl_name(x_1); +lean::inc(x_285); +x_286 = l_Lean_hasInitAttr(x_278, x_285); +if (x_286 == 0) +{ +uint8 x_407; +x_407 = 0; +x_287 = x_407; +goto block_406; +} +else +{ +uint8 x_408; +x_408 = 1; +x_287 = x_408; +goto block_406; +} +block_406: +{ +if (x_287 == 0) +{ +if (lean::obj_tag(x_1) == 0) +{ +obj* x_288; obj* x_289; uint8 x_290; obj* x_291; obj* x_292; obj* x_293; obj* x_294; obj* x_295; obj* x_296; obj* x_297; obj* x_298; +lean::dec(x_279); +x_288 = lean::cnstr_get(x_1, 0); +lean::inc(x_288); +x_289 = lean::cnstr_get(x_1, 1); +lean::inc(x_289); +x_290 = lean::cnstr_get_uint8(x_1, sizeof(void*)*3); +x_291 = lean::cnstr_get(x_1, 2); +lean::inc(x_291); +lean::dec(x_1); +x_292 = lean::cnstr_get(x_2, 0); +lean::inc(x_292); +x_293 = lean::cnstr_get(x_2, 1); +lean::inc(x_293); +x_294 = lean::cnstr_get(x_2, 4); +lean::inc(x_294); +x_295 = lean::cnstr_get(x_2, 5); +lean::inc(x_295); +if (lean::is_exclusive(x_2)) { + lean::cnstr_release(x_2, 0); + lean::cnstr_release(x_2, 1); + lean::cnstr_release(x_2, 2); + lean::cnstr_release(x_2, 3); + lean::cnstr_release(x_2, 4); + lean::cnstr_release(x_2, 5); + x_296 = x_2; +} else { + lean::dec_ref(x_2); + x_296 = lean::box(0); +} +lean::inc(x_284); +lean::inc(x_283); +lean::inc(x_293); +lean::inc(x_292); +if (lean::is_scalar(x_296)) { + x_297 = lean::alloc_cnstr(0, 6, 0); +} else { + x_297 = x_296; +} +lean::cnstr_set(x_297, 0, x_292); +lean::cnstr_set(x_297, 1, x_293); +lean::cnstr_set(x_297, 2, x_283); +lean::cnstr_set(x_297, 3, x_284); +lean::cnstr_set(x_297, 4, x_294); +lean::cnstr_set(x_297, 5, x_295); +lean::inc(x_288); +x_298 = l_Lean_IR_EmitC_toCName(x_288, x_297, x_281); +if (lean::obj_tag(x_298) == 0) +{ +obj* x_299; obj* x_300; obj* x_301; obj* x_302; obj* x_303; obj* x_304; obj* x_305; obj* x_306; obj* x_307; obj* x_372; uint8 x_373; +x_299 = lean::cnstr_get(x_298, 0); +lean::inc(x_299); +x_300 = lean::cnstr_get(x_298, 1); +lean::inc(x_300); +if (lean::is_exclusive(x_298)) { + lean::cnstr_release(x_298, 0); + lean::cnstr_release(x_298, 1); + x_301 = x_298; +} else { + lean::dec_ref(x_298); + x_301 = lean::box(0); +} +x_302 = l_Lean_IR_EmitC_toCType(x_290); +x_303 = lean_string_append(x_300, x_302); +lean::dec(x_302); +x_304 = l_Lean_Format_flatten___main___closed__1; +x_305 = lean_string_append(x_303, x_304); +x_306 = lean_array_get_size(x_289); +x_372 = lean::mk_nat_obj(0u); +x_373 = lean_nat_dec_lt(x_372, x_306); +if (x_373 == 0) +{ +obj* x_374; obj* x_375; obj* x_376; obj* x_377; obj* x_378; +x_374 = l_Lean_IR_EmitC_toCInitName___closed__1; +x_375 = lean_string_append(x_374, x_299); +lean::dec(x_299); +x_376 = l_Unit_HasRepr___closed__1; +x_377 = lean_string_append(x_375, x_376); +x_378 = lean_string_append(x_305, x_377); +lean::dec(x_377); +x_307 = x_378; +goto block_371; +} +else +{ +obj* x_379; obj* x_380; obj* x_381; obj* x_382; obj* x_383; obj* x_393; uint8 x_394; +x_379 = lean_string_append(x_305, x_299); +lean::dec(x_299); +x_380 = l_Prod_HasRepr___rarg___closed__1; +x_381 = lean_string_append(x_379, x_380); +lean::inc(x_381); +x_382 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_382, 0, x_280); +lean::cnstr_set(x_382, 1, x_381); +x_393 = l_Lean_closureMaxArgs; +x_394 = lean_nat_dec_lt(x_393, x_306); +if (x_394 == 0) +{ +lean::dec(x_381); +x_383 = x_280; +goto block_392; +} +else +{ +uint8 x_395; +x_395 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_285); +if (x_395 == 0) +{ +lean::dec(x_381); +x_383 = x_280; +goto block_392; +} +else +{ +obj* x_396; obj* x_397; obj* x_398; obj* x_399; +lean::dec(x_382); +x_396 = l_Lean_IR_EmitC_emitDeclAux___closed__3; +x_397 = lean_string_append(x_381, x_396); +x_398 = l_Option_HasRepr___rarg___closed__3; +x_399 = lean_string_append(x_397, x_398); +x_307 = x_399; +goto block_371; +} +} +block_392: +{ +obj* x_384; +lean::dec(x_383); +lean::inc(x_306); +x_384 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(x_289, x_306, x_306, x_297, x_382); +if (lean::obj_tag(x_384) == 0) +{ +obj* x_385; obj* x_386; obj* x_387; +x_385 = lean::cnstr_get(x_384, 1); +lean::inc(x_385); +lean::dec(x_384); +x_386 = l_Option_HasRepr___rarg___closed__3; +x_387 = lean_string_append(x_385, x_386); +x_307 = x_387; +goto block_371; +} +else +{ +obj* x_388; obj* x_389; obj* x_390; obj* x_391; +lean::dec(x_306); +lean::dec(x_301); +lean::dec(x_297); +lean::dec(x_293); +lean::dec(x_292); lean::dec(x_291); +lean::dec(x_289); +lean::dec(x_288); +lean::dec(x_285); +lean::dec(x_284); +lean::dec(x_283); +x_388 = lean::cnstr_get(x_384, 0); +lean::inc(x_388); +x_389 = lean::cnstr_get(x_384, 1); +lean::inc(x_389); +if (lean::is_exclusive(x_384)) { + lean::cnstr_release(x_384, 0); + lean::cnstr_release(x_384, 1); + x_390 = x_384; +} else { + lean::dec_ref(x_384); + x_390 = lean::box(0); +} +if (lean::is_scalar(x_390)) { + x_391 = lean::alloc_cnstr(1, 2, 0); +} else { + x_391 = x_390; +} +lean::cnstr_set(x_391, 0, x_388); +lean::cnstr_set(x_391, 1, x_389); +return x_391; +} +} +} +block_371: +{ +obj* x_308; obj* x_309; obj* x_310; obj* x_311; obj* x_312; obj* x_313; uint8 x_314; +x_308 = l_Lean_IR_EmitC_emitDeclAux___closed__1; +x_309 = lean_string_append(x_307, x_308); +x_310 = l_IO_println___rarg___closed__1; +x_311 = lean_string_append(x_309, x_310); +lean::inc(x_311); +if (lean::is_scalar(x_301)) { + x_312 = lean::alloc_cnstr(0, 2, 0); +} else { + x_312 = x_301; +} +lean::cnstr_set(x_312, 0, x_280); +lean::cnstr_set(x_312, 1, x_311); +x_313 = l_Lean_closureMaxArgs; +x_314 = lean_nat_dec_lt(x_313, x_306); +if (x_314 == 0) +{ +obj* x_315; obj* x_316; obj* x_317; obj* x_318; obj* x_319; obj* x_320; +lean::dec(x_312); +lean::dec(x_306); +lean::dec(x_297); +lean::dec(x_285); +x_315 = l_Lean_IR_EmitC_emitDeclAux___closed__2; +x_316 = lean_string_append(x_311, x_315); +x_317 = lean_string_append(x_316, x_310); +x_318 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_318, 0, x_280); +lean::cnstr_set(x_318, 1, x_317); +x_319 = lean::alloc_cnstr(0, 6, 0); +lean::cnstr_set(x_319, 0, x_292); +lean::cnstr_set(x_319, 1, x_293); +lean::cnstr_set(x_319, 2, x_283); +lean::cnstr_set(x_319, 3, x_284); +lean::cnstr_set(x_319, 4, x_288); +lean::cnstr_set(x_319, 5, x_289); +x_320 = l_Lean_IR_EmitC_emitFnBody___main(x_291, x_319, x_318); +if (lean::obj_tag(x_320) == 0) +{ +obj* x_321; obj* x_322; obj* x_323; obj* x_324; obj* x_325; obj* x_326; +x_321 = lean::cnstr_get(x_320, 1); +lean::inc(x_321); +if (lean::is_exclusive(x_320)) { + lean::cnstr_release(x_320, 0); + lean::cnstr_release(x_320, 1); + x_322 = x_320; +} else { + lean::dec_ref(x_320); + x_322 = lean::box(0); +} +x_323 = l_PersistentHashMap_Stats_toString___closed__5; +x_324 = lean_string_append(x_321, x_323); +x_325 = lean_string_append(x_324, x_310); +if (lean::is_scalar(x_322)) { + x_326 = lean::alloc_cnstr(0, 2, 0); +} else { + x_326 = x_322; +} +lean::cnstr_set(x_326, 0, x_280); +lean::cnstr_set(x_326, 1, x_325); +return x_326; +} +else +{ +obj* x_327; obj* x_328; obj* x_329; obj* x_330; +x_327 = lean::cnstr_get(x_320, 0); +lean::inc(x_327); +x_328 = lean::cnstr_get(x_320, 1); +lean::inc(x_328); +if (lean::is_exclusive(x_320)) { + lean::cnstr_release(x_320, 0); + lean::cnstr_release(x_320, 1); + x_329 = x_320; +} else { + lean::dec_ref(x_320); + x_329 = lean::box(0); +} +if (lean::is_scalar(x_329)) { + x_330 = lean::alloc_cnstr(1, 2, 0); +} else { + x_330 = x_329; +} +lean::cnstr_set(x_330, 0, x_327); +lean::cnstr_set(x_330, 1, x_328); +return x_330; +} +} +else +{ +uint8 x_331; +x_331 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_285); +lean::dec(x_285); +if (x_331 == 0) +{ +obj* x_332; obj* x_333; obj* x_334; obj* x_335; obj* x_336; obj* x_337; +lean::dec(x_312); +lean::dec(x_306); +lean::dec(x_297); +x_332 = l_Lean_IR_EmitC_emitDeclAux___closed__2; +x_333 = lean_string_append(x_311, x_332); +x_334 = lean_string_append(x_333, x_310); +x_335 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_335, 0, x_280); +lean::cnstr_set(x_335, 1, x_334); +x_336 = lean::alloc_cnstr(0, 6, 0); +lean::cnstr_set(x_336, 0, x_292); +lean::cnstr_set(x_336, 1, x_293); +lean::cnstr_set(x_336, 2, x_283); +lean::cnstr_set(x_336, 3, x_284); +lean::cnstr_set(x_336, 4, x_288); +lean::cnstr_set(x_336, 5, x_289); +x_337 = l_Lean_IR_EmitC_emitFnBody___main(x_291, x_336, x_335); +if (lean::obj_tag(x_337) == 0) +{ +obj* x_338; obj* x_339; obj* x_340; obj* x_341; obj* x_342; obj* x_343; +x_338 = lean::cnstr_get(x_337, 1); +lean::inc(x_338); +if (lean::is_exclusive(x_337)) { + lean::cnstr_release(x_337, 0); + lean::cnstr_release(x_337, 1); + x_339 = x_337; +} else { + lean::dec_ref(x_337); + x_339 = lean::box(0); +} +x_340 = l_PersistentHashMap_Stats_toString___closed__5; +x_341 = lean_string_append(x_338, x_340); +x_342 = lean_string_append(x_341, x_310); +if (lean::is_scalar(x_339)) { + x_343 = lean::alloc_cnstr(0, 2, 0); +} else { + x_343 = x_339; +} +lean::cnstr_set(x_343, 0, x_280); +lean::cnstr_set(x_343, 1, x_342); return x_343; } else { obj* x_344; obj* x_345; obj* x_346; obj* x_347; -lean::dec(x_291); -lean::dec(x_15); -x_344 = lean::cnstr_get(x_336, 0); +x_344 = lean::cnstr_get(x_337, 0); lean::inc(x_344); -x_345 = lean::cnstr_get(x_336, 1); +x_345 = lean::cnstr_get(x_337, 1); lean::inc(x_345); -if (lean::is_exclusive(x_336)) { - lean::cnstr_release(x_336, 0); - lean::cnstr_release(x_336, 1); - x_346 = x_336; +if (lean::is_exclusive(x_337)) { + lean::cnstr_release(x_337, 0); + lean::cnstr_release(x_337, 1); + x_346 = x_337; } else { - lean::dec_ref(x_336); + lean::dec_ref(x_337); x_346 = lean::box(0); } if (lean::is_scalar(x_346)) { @@ -24388,10 +22942,11 @@ return x_347; else { obj* x_348; -lean::dec(x_309); -lean::inc(x_304); -x_348 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(x_16, x_304, x_304, x_291, x_310); -lean::dec(x_304); +lean::dec(x_311); +lean::inc(x_306); +x_348 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(x_289, x_306, x_306, x_297, x_312); +lean::dec(x_297); +lean::dec(x_306); if (lean::obj_tag(x_348) == 0) { obj* x_349; obj* x_350; obj* x_351; obj* x_352; obj* x_353; obj* x_354; obj* x_355; obj* x_356; @@ -24405,28 +22960,27 @@ if (lean::is_exclusive(x_348)) { lean::dec_ref(x_348); x_350 = lean::box(0); } -x_351 = l_Lean_IR_EmitC_emitDeclAux___closed__1; +x_351 = l_Lean_IR_EmitC_emitDeclAux___closed__2; x_352 = lean_string_append(x_349, x_351); -x_353 = lean_string_append(x_352, x_308); +x_353 = lean_string_append(x_352, x_310); if (lean::is_scalar(x_350)) { x_354 = lean::alloc_cnstr(0, 2, 0); } else { x_354 = x_350; } -lean::cnstr_set(x_354, 0, x_8); +lean::cnstr_set(x_354, 0, x_280); lean::cnstr_set(x_354, 1, x_353); -lean::inc(x_15); x_355 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_355, 0, x_287); -lean::cnstr_set(x_355, 1, x_288); -lean::cnstr_set(x_355, 2, x_10); -lean::cnstr_set(x_355, 3, x_11); -lean::cnstr_set(x_355, 4, x_15); -lean::cnstr_set(x_355, 5, x_16); -x_356 = l_Lean_IR_EmitC_emitFnBody___main(x_18, x_355, x_354); +lean::cnstr_set(x_355, 0, x_292); +lean::cnstr_set(x_355, 1, x_293); +lean::cnstr_set(x_355, 2, x_283); +lean::cnstr_set(x_355, 3, x_284); +lean::cnstr_set(x_355, 4, x_288); +lean::cnstr_set(x_355, 5, x_289); +x_356 = l_Lean_IR_EmitC_emitFnBody___main(x_291, x_355, x_354); if (lean::obj_tag(x_356) == 0) { -obj* x_357; obj* x_358; obj* x_359; obj* x_360; obj* x_361; obj* x_362; obj* x_363; +obj* x_357; obj* x_358; obj* x_359; obj* x_360; obj* x_361; obj* x_362; x_357 = lean::cnstr_get(x_356, 1); lean::inc(x_357); if (lean::is_exclusive(x_356)) { @@ -24439,76 +22993,71 @@ if (lean::is_exclusive(x_356)) { } x_359 = l_PersistentHashMap_Stats_toString___closed__5; x_360 = lean_string_append(x_357, x_359); -x_361 = lean_string_append(x_360, x_308); +x_361 = lean_string_append(x_360, x_310); if (lean::is_scalar(x_358)) { x_362 = lean::alloc_cnstr(0, 2, 0); } else { x_362 = x_358; } -lean::cnstr_set(x_362, 0, x_8); +lean::cnstr_set(x_362, 0, x_280); lean::cnstr_set(x_362, 1, x_361); -x_363 = l_Lean_IR_EmitC_closeNamespacesFor(x_15, x_291, x_362); -lean::dec(x_291); -return x_363; +return x_362; } else { -obj* x_364; obj* x_365; obj* x_366; obj* x_367; -lean::dec(x_291); -lean::dec(x_15); -x_364 = lean::cnstr_get(x_356, 0); +obj* x_363; obj* x_364; obj* x_365; obj* x_366; +x_363 = lean::cnstr_get(x_356, 0); +lean::inc(x_363); +x_364 = lean::cnstr_get(x_356, 1); lean::inc(x_364); -x_365 = lean::cnstr_get(x_356, 1); -lean::inc(x_365); if (lean::is_exclusive(x_356)) { lean::cnstr_release(x_356, 0); lean::cnstr_release(x_356, 1); - x_366 = x_356; + x_365 = x_356; } else { lean::dec_ref(x_356); - x_366 = lean::box(0); + x_365 = lean::box(0); } -if (lean::is_scalar(x_366)) { - x_367 = lean::alloc_cnstr(1, 2, 0); +if (lean::is_scalar(x_365)) { + x_366 = lean::alloc_cnstr(1, 2, 0); } else { - x_367 = x_366; + x_366 = x_365; } -lean::cnstr_set(x_367, 0, x_364); -lean::cnstr_set(x_367, 1, x_365); -return x_367; +lean::cnstr_set(x_366, 0, x_363); +lean::cnstr_set(x_366, 1, x_364); +return x_366; } } else { -obj* x_368; obj* x_369; obj* x_370; obj* x_371; +obj* x_367; obj* x_368; obj* x_369; obj* x_370; +lean::dec(x_293); +lean::dec(x_292); lean::dec(x_291); +lean::dec(x_289); lean::dec(x_288); -lean::dec(x_287); -lean::dec(x_18); -lean::dec(x_16); -lean::dec(x_15); -lean::dec(x_11); -lean::dec(x_10); -x_368 = lean::cnstr_get(x_348, 0); +lean::dec(x_284); +lean::dec(x_283); +x_367 = lean::cnstr_get(x_348, 0); +lean::inc(x_367); +x_368 = lean::cnstr_get(x_348, 1); lean::inc(x_368); -x_369 = lean::cnstr_get(x_348, 1); -lean::inc(x_369); if (lean::is_exclusive(x_348)) { lean::cnstr_release(x_348, 0); lean::cnstr_release(x_348, 1); - x_370 = x_348; + x_369 = x_348; } else { lean::dec_ref(x_348); - x_370 = lean::box(0); + x_369 = lean::box(0); } -if (lean::is_scalar(x_370)) { - x_371 = lean::alloc_cnstr(1, 2, 0); +if (lean::is_scalar(x_369)) { + x_370 = lean::alloc_cnstr(1, 2, 0); } else { - x_371 = x_370; + x_370 = x_369; } -lean::cnstr_set(x_371, 0, x_368); -lean::cnstr_set(x_371, 1, x_369); -return x_371; +lean::cnstr_set(x_370, 0, x_367); +lean::cnstr_set(x_370, 1, x_368); +return x_370; } } } @@ -24516,769 +23065,92 @@ return x_371; } else { -obj* x_401; obj* x_402; obj* x_403; obj* x_404; +obj* x_400; obj* x_401; obj* x_402; obj* x_403; +lean::dec(x_297); +lean::dec(x_293); +lean::dec(x_292); lean::dec(x_291); +lean::dec(x_289); lean::dec(x_288); -lean::dec(x_287); -lean::dec(x_18); -lean::dec(x_16); -lean::dec(x_15); -lean::dec(x_12); -lean::dec(x_11); -lean::dec(x_10); -x_401 = lean::cnstr_get(x_296, 0); +lean::dec(x_285); +lean::dec(x_284); +lean::dec(x_283); +x_400 = lean::cnstr_get(x_298, 0); +lean::inc(x_400); +x_401 = lean::cnstr_get(x_298, 1); lean::inc(x_401); -x_402 = lean::cnstr_get(x_296, 1); -lean::inc(x_402); -if (lean::is_exclusive(x_296)) { - lean::cnstr_release(x_296, 0); - lean::cnstr_release(x_296, 1); - x_403 = x_296; +if (lean::is_exclusive(x_298)) { + lean::cnstr_release(x_298, 0); + lean::cnstr_release(x_298, 1); + x_402 = x_298; } else { - lean::dec_ref(x_296); - x_403 = lean::box(0); + lean::dec_ref(x_298); + x_402 = lean::box(0); } -if (lean::is_scalar(x_403)) { - x_404 = lean::alloc_cnstr(1, 2, 0); +if (lean::is_scalar(x_402)) { + x_403 = lean::alloc_cnstr(1, 2, 0); } else { - x_404 = x_403; + x_403 = x_402; } -lean::cnstr_set(x_404, 0, x_401); -lean::cnstr_set(x_404, 1, x_402); +lean::cnstr_set(x_403, 0, x_400); +lean::cnstr_set(x_403, 1, x_401); +return x_403; +} +} +else +{ +obj* x_404; +lean::dec(x_285); +lean::dec(x_284); +lean::dec(x_283); +lean::dec(x_281); +lean::dec(x_2); +lean::dec(x_1); +x_404 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_404, 0, x_280); +lean::cnstr_set(x_404, 1, x_279); return x_404; } } else { -obj* x_405; obj* x_406; obj* x_407; obj* x_408; -lean::dec(x_291); -lean::dec(x_288); -lean::dec(x_287); -lean::dec(x_18); -lean::dec(x_16); -lean::dec(x_15); -lean::dec(x_12); -lean::dec(x_11); -lean::dec(x_10); -x_405 = lean::cnstr_get(x_292, 0); -lean::inc(x_405); -x_406 = lean::cnstr_get(x_292, 1); -lean::inc(x_406); -if (lean::is_exclusive(x_292)) { - lean::cnstr_release(x_292, 0); - lean::cnstr_release(x_292, 1); - x_407 = x_292; -} else { - lean::dec_ref(x_292); - x_407 = lean::box(0); -} -if (lean::is_scalar(x_407)) { - x_408 = lean::alloc_cnstr(1, 2, 0); -} else { - x_408 = x_407; -} -lean::cnstr_set(x_408, 0, x_405); -lean::cnstr_set(x_408, 1, x_406); -return x_408; -} -} -} -else -{ -obj* x_409; -lean::dec(x_12); -lean::dec(x_11); -lean::dec(x_10); -lean::dec(x_4); +obj* x_405; +lean::dec(x_285); +lean::dec(x_284); +lean::dec(x_283); +lean::dec(x_281); lean::dec(x_2); lean::dec(x_1); -x_409 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_409, 0, x_8); -lean::cnstr_set(x_409, 1, x_7); -return x_409; +x_405 = lean::alloc_cnstr(0, 2, 0); +lean::cnstr_set(x_405, 0, x_280); +lean::cnstr_set(x_405, 1, x_279); +return x_405; +} +} } } else { -obj* x_410; -lean::dec(x_12); -lean::dec(x_11); -lean::dec(x_10); -lean::dec(x_4); +uint8 x_409; lean::dec(x_2); lean::dec(x_1); -x_410 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_410, 0, x_8); -lean::cnstr_set(x_410, 1, x_7); -return x_410; -} -} -} -else -{ -obj* x_414; obj* x_415; obj* x_416; obj* x_417; obj* x_418; obj* x_419; obj* x_420; obj* x_421; uint8 x_422; uint8 x_423; -x_414 = lean::cnstr_get(x_4, 0); -x_415 = lean::cnstr_get(x_4, 1); -lean::inc(x_415); -lean::inc(x_414); -lean::dec(x_4); -x_416 = lean::box(0); -lean::inc(x_415); -x_417 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_417, 0, x_416); -lean::cnstr_set(x_417, 1, x_415); -lean::inc(x_1); -x_418 = l_Lean_IR_mkVarJPMaps(x_1); -x_419 = lean::cnstr_get(x_418, 0); -lean::inc(x_419); -x_420 = lean::cnstr_get(x_418, 1); -lean::inc(x_420); -lean::dec(x_418); -x_421 = l_Lean_IR_Decl_name(x_1); -lean::inc(x_421); -x_422 = l_Lean_hasInitAttr(x_414, x_421); -if (x_422 == 0) -{ -uint8 x_554; -x_554 = 0; -x_423 = x_554; -goto block_553; -} -else -{ -uint8 x_555; -x_555 = 1; -x_423 = x_555; -goto block_553; -} -block_553: -{ -if (x_423 == 0) -{ -if (lean::obj_tag(x_1) == 0) -{ -obj* x_424; obj* x_425; uint8 x_426; obj* x_427; obj* x_428; obj* x_429; obj* x_430; obj* x_431; obj* x_432; obj* x_433; obj* x_434; -lean::dec(x_415); -x_424 = lean::cnstr_get(x_1, 0); -lean::inc(x_424); -x_425 = lean::cnstr_get(x_1, 1); -lean::inc(x_425); -x_426 = lean::cnstr_get_uint8(x_1, sizeof(void*)*3); -x_427 = lean::cnstr_get(x_1, 2); -lean::inc(x_427); -lean::dec(x_1); -x_428 = lean::cnstr_get(x_2, 0); -lean::inc(x_428); -x_429 = lean::cnstr_get(x_2, 1); -lean::inc(x_429); -x_430 = lean::cnstr_get(x_2, 4); -lean::inc(x_430); -x_431 = lean::cnstr_get(x_2, 5); -lean::inc(x_431); -if (lean::is_exclusive(x_2)) { - lean::cnstr_release(x_2, 0); - lean::cnstr_release(x_2, 1); - lean::cnstr_release(x_2, 2); - lean::cnstr_release(x_2, 3); - lean::cnstr_release(x_2, 4); - lean::cnstr_release(x_2, 5); - x_432 = x_2; -} else { - lean::dec_ref(x_2); - x_432 = lean::box(0); -} -lean::inc(x_420); -lean::inc(x_419); -lean::inc(x_429); -lean::inc(x_428); -if (lean::is_scalar(x_432)) { - x_433 = lean::alloc_cnstr(0, 6, 0); -} else { - x_433 = x_432; -} -lean::cnstr_set(x_433, 0, x_428); -lean::cnstr_set(x_433, 1, x_429); -lean::cnstr_set(x_433, 2, x_419); -lean::cnstr_set(x_433, 3, x_420); -lean::cnstr_set(x_433, 4, x_430); -lean::cnstr_set(x_433, 5, x_431); -lean::inc(x_424); -x_434 = l_Lean_IR_EmitC_openNamespacesFor(x_424, x_433, x_417); -if (lean::obj_tag(x_434) == 0) -{ -obj* x_435; obj* x_436; obj* x_437; obj* x_438; -x_435 = lean::cnstr_get(x_434, 1); -lean::inc(x_435); -if (lean::is_exclusive(x_434)) { - lean::cnstr_release(x_434, 0); - lean::cnstr_release(x_434, 1); - x_436 = x_434; -} else { - lean::dec_ref(x_434); - x_436 = lean::box(0); -} -if (lean::is_scalar(x_436)) { - x_437 = lean::alloc_cnstr(0, 2, 0); -} else { - x_437 = x_436; -} -lean::cnstr_set(x_437, 0, x_416); -lean::cnstr_set(x_437, 1, x_435); -lean::inc(x_424); -x_438 = l_Lean_IR_EmitC_toBaseCppName(x_424, x_433, x_437); -if (lean::obj_tag(x_438) == 0) -{ -obj* x_439; obj* x_440; obj* x_441; obj* x_442; obj* x_443; obj* x_444; obj* x_445; obj* x_446; obj* x_447; obj* x_515; uint8 x_516; -x_439 = lean::cnstr_get(x_438, 0); -lean::inc(x_439); -x_440 = lean::cnstr_get(x_438, 1); -lean::inc(x_440); -if (lean::is_exclusive(x_438)) { - lean::cnstr_release(x_438, 0); - lean::cnstr_release(x_438, 1); - x_441 = x_438; -} else { - lean::dec_ref(x_438); - x_441 = lean::box(0); -} -x_442 = l_Lean_IR_EmitC_toCType(x_426); -x_443 = lean_string_append(x_440, x_442); -lean::dec(x_442); -x_444 = l_Lean_Format_flatten___main___closed__1; -x_445 = lean_string_append(x_443, x_444); -x_446 = lean_array_get_size(x_425); -x_515 = lean::mk_nat_obj(0u); -x_516 = lean_nat_dec_lt(x_515, x_446); -if (x_516 == 0) -{ -obj* x_517; obj* x_518; obj* x_519; obj* x_520; obj* x_521; -x_517 = l_Lean_IR_EmitC_toCInitName___closed__1; -x_518 = lean_string_append(x_517, x_439); -lean::dec(x_439); -x_519 = l_Unit_HasRepr___closed__1; -x_520 = lean_string_append(x_518, x_519); -x_521 = lean_string_append(x_445, x_520); -lean::dec(x_520); -x_447 = x_521; -goto block_514; -} -else -{ -obj* x_522; obj* x_523; obj* x_524; obj* x_525; obj* x_526; obj* x_536; uint8 x_537; -x_522 = lean_string_append(x_445, x_439); -lean::dec(x_439); -x_523 = l_Prod_HasRepr___rarg___closed__1; -x_524 = lean_string_append(x_522, x_523); -lean::inc(x_524); -x_525 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_525, 0, x_416); -lean::cnstr_set(x_525, 1, x_524); -x_536 = l_Lean_closureMaxArgs; -x_537 = lean_nat_dec_lt(x_536, x_446); -if (x_537 == 0) -{ -lean::dec(x_524); -x_526 = x_416; -goto block_535; -} -else -{ -uint8 x_538; -x_538 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_421); -if (x_538 == 0) -{ -lean::dec(x_524); -x_526 = x_416; -goto block_535; -} -else -{ -obj* x_539; obj* x_540; obj* x_541; obj* x_542; -lean::dec(x_525); -x_539 = l_Lean_IR_EmitC_emitDeclAux___closed__2; -x_540 = lean_string_append(x_524, x_539); -x_541 = l_Option_HasRepr___rarg___closed__3; -x_542 = lean_string_append(x_540, x_541); -x_447 = x_542; -goto block_514; -} -} -block_535: -{ -obj* x_527; -lean::dec(x_526); -lean::inc(x_446); -x_527 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(x_425, x_446, x_446, x_433, x_525); -if (lean::obj_tag(x_527) == 0) -{ -obj* x_528; obj* x_529; obj* x_530; -x_528 = lean::cnstr_get(x_527, 1); -lean::inc(x_528); -lean::dec(x_527); -x_529 = l_Option_HasRepr___rarg___closed__3; -x_530 = lean_string_append(x_528, x_529); -x_447 = x_530; -goto block_514; -} -else -{ -obj* x_531; obj* x_532; obj* x_533; obj* x_534; -lean::dec(x_446); -lean::dec(x_441); -lean::dec(x_433); -lean::dec(x_429); -lean::dec(x_428); -lean::dec(x_427); -lean::dec(x_425); -lean::dec(x_424); -lean::dec(x_421); -lean::dec(x_420); -lean::dec(x_419); -x_531 = lean::cnstr_get(x_527, 0); -lean::inc(x_531); -x_532 = lean::cnstr_get(x_527, 1); -lean::inc(x_532); -if (lean::is_exclusive(x_527)) { - lean::cnstr_release(x_527, 0); - lean::cnstr_release(x_527, 1); - x_533 = x_527; -} else { - lean::dec_ref(x_527); - x_533 = lean::box(0); -} -if (lean::is_scalar(x_533)) { - x_534 = lean::alloc_cnstr(1, 2, 0); -} else { - x_534 = x_533; -} -lean::cnstr_set(x_534, 0, x_531); -lean::cnstr_set(x_534, 1, x_532); -return x_534; -} -} -} -block_514: -{ -obj* x_448; obj* x_449; obj* x_450; obj* x_451; obj* x_452; obj* x_453; uint8 x_454; -x_448 = l_Lean_IR_EmitC_openNamespacesAux___main___closed__2; -x_449 = lean_string_append(x_447, x_448); -x_450 = l_IO_println___rarg___closed__1; -x_451 = lean_string_append(x_449, x_450); -lean::inc(x_451); -if (lean::is_scalar(x_441)) { - x_452 = lean::alloc_cnstr(0, 2, 0); -} else { - x_452 = x_441; -} -lean::cnstr_set(x_452, 0, x_416); -lean::cnstr_set(x_452, 1, x_451); -x_453 = l_Lean_closureMaxArgs; -x_454 = lean_nat_dec_lt(x_453, x_446); -if (x_454 == 0) -{ -obj* x_455; obj* x_456; obj* x_457; obj* x_458; obj* x_459; obj* x_460; -lean::dec(x_452); -lean::dec(x_446); -lean::dec(x_421); -x_455 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_456 = lean_string_append(x_451, x_455); -x_457 = lean_string_append(x_456, x_450); -x_458 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_458, 0, x_416); -lean::cnstr_set(x_458, 1, x_457); -lean::inc(x_424); -x_459 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_459, 0, x_428); -lean::cnstr_set(x_459, 1, x_429); -lean::cnstr_set(x_459, 2, x_419); -lean::cnstr_set(x_459, 3, x_420); -lean::cnstr_set(x_459, 4, x_424); -lean::cnstr_set(x_459, 5, x_425); -x_460 = l_Lean_IR_EmitC_emitFnBody___main(x_427, x_459, x_458); -if (lean::obj_tag(x_460) == 0) -{ -obj* x_461; obj* x_462; obj* x_463; obj* x_464; obj* x_465; obj* x_466; obj* x_467; -x_461 = lean::cnstr_get(x_460, 1); -lean::inc(x_461); -if (lean::is_exclusive(x_460)) { - lean::cnstr_release(x_460, 0); - lean::cnstr_release(x_460, 1); - x_462 = x_460; -} else { - lean::dec_ref(x_460); - x_462 = lean::box(0); -} -x_463 = l_PersistentHashMap_Stats_toString___closed__5; -x_464 = lean_string_append(x_461, x_463); -x_465 = lean_string_append(x_464, x_450); -if (lean::is_scalar(x_462)) { - x_466 = lean::alloc_cnstr(0, 2, 0); -} else { - x_466 = x_462; -} -lean::cnstr_set(x_466, 0, x_416); -lean::cnstr_set(x_466, 1, x_465); -x_467 = l_Lean_IR_EmitC_closeNamespacesFor(x_424, x_433, x_466); -lean::dec(x_433); -return x_467; -} -else -{ -obj* x_468; obj* x_469; obj* x_470; obj* x_471; -lean::dec(x_433); -lean::dec(x_424); -x_468 = lean::cnstr_get(x_460, 0); -lean::inc(x_468); -x_469 = lean::cnstr_get(x_460, 1); -lean::inc(x_469); -if (lean::is_exclusive(x_460)) { - lean::cnstr_release(x_460, 0); - lean::cnstr_release(x_460, 1); - x_470 = x_460; -} else { - lean::dec_ref(x_460); - x_470 = lean::box(0); -} -if (lean::is_scalar(x_470)) { - x_471 = lean::alloc_cnstr(1, 2, 0); -} else { - x_471 = x_470; -} -lean::cnstr_set(x_471, 0, x_468); -lean::cnstr_set(x_471, 1, x_469); -return x_471; -} -} -else -{ -uint8 x_472; -x_472 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_421); -lean::dec(x_421); -if (x_472 == 0) -{ -obj* x_473; obj* x_474; obj* x_475; obj* x_476; obj* x_477; obj* x_478; -lean::dec(x_452); -lean::dec(x_446); -x_473 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_474 = lean_string_append(x_451, x_473); -x_475 = lean_string_append(x_474, x_450); -x_476 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_476, 0, x_416); -lean::cnstr_set(x_476, 1, x_475); -lean::inc(x_424); -x_477 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_477, 0, x_428); -lean::cnstr_set(x_477, 1, x_429); -lean::cnstr_set(x_477, 2, x_419); -lean::cnstr_set(x_477, 3, x_420); -lean::cnstr_set(x_477, 4, x_424); -lean::cnstr_set(x_477, 5, x_425); -x_478 = l_Lean_IR_EmitC_emitFnBody___main(x_427, x_477, x_476); -if (lean::obj_tag(x_478) == 0) -{ -obj* x_479; obj* x_480; obj* x_481; obj* x_482; obj* x_483; obj* x_484; obj* x_485; -x_479 = lean::cnstr_get(x_478, 1); -lean::inc(x_479); -if (lean::is_exclusive(x_478)) { - lean::cnstr_release(x_478, 0); - lean::cnstr_release(x_478, 1); - x_480 = x_478; -} else { - lean::dec_ref(x_478); - x_480 = lean::box(0); -} -x_481 = l_PersistentHashMap_Stats_toString___closed__5; -x_482 = lean_string_append(x_479, x_481); -x_483 = lean_string_append(x_482, x_450); -if (lean::is_scalar(x_480)) { - x_484 = lean::alloc_cnstr(0, 2, 0); -} else { - x_484 = x_480; -} -lean::cnstr_set(x_484, 0, x_416); -lean::cnstr_set(x_484, 1, x_483); -x_485 = l_Lean_IR_EmitC_closeNamespacesFor(x_424, x_433, x_484); -lean::dec(x_433); -return x_485; -} -else -{ -obj* x_486; obj* x_487; obj* x_488; obj* x_489; -lean::dec(x_433); -lean::dec(x_424); -x_486 = lean::cnstr_get(x_478, 0); -lean::inc(x_486); -x_487 = lean::cnstr_get(x_478, 1); -lean::inc(x_487); -if (lean::is_exclusive(x_478)) { - lean::cnstr_release(x_478, 0); - lean::cnstr_release(x_478, 1); - x_488 = x_478; -} else { - lean::dec_ref(x_478); - x_488 = lean::box(0); -} -if (lean::is_scalar(x_488)) { - x_489 = lean::alloc_cnstr(1, 2, 0); -} else { - x_489 = x_488; -} -lean::cnstr_set(x_489, 0, x_486); -lean::cnstr_set(x_489, 1, x_487); -return x_489; -} -} -else -{ -obj* x_490; -lean::dec(x_451); -lean::inc(x_446); -x_490 = l_Nat_mforAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(x_425, x_446, x_446, x_433, x_452); -lean::dec(x_446); -if (lean::obj_tag(x_490) == 0) -{ -obj* x_491; obj* x_492; obj* x_493; obj* x_494; obj* x_495; obj* x_496; obj* x_497; obj* x_498; -x_491 = lean::cnstr_get(x_490, 1); -lean::inc(x_491); -if (lean::is_exclusive(x_490)) { - lean::cnstr_release(x_490, 0); - lean::cnstr_release(x_490, 1); - x_492 = x_490; -} else { - lean::dec_ref(x_490); - x_492 = lean::box(0); -} -x_493 = l_Lean_IR_EmitC_emitDeclAux___closed__1; -x_494 = lean_string_append(x_491, x_493); -x_495 = lean_string_append(x_494, x_450); -if (lean::is_scalar(x_492)) { - x_496 = lean::alloc_cnstr(0, 2, 0); -} else { - x_496 = x_492; -} -lean::cnstr_set(x_496, 0, x_416); -lean::cnstr_set(x_496, 1, x_495); -lean::inc(x_424); -x_497 = lean::alloc_cnstr(0, 6, 0); -lean::cnstr_set(x_497, 0, x_428); -lean::cnstr_set(x_497, 1, x_429); -lean::cnstr_set(x_497, 2, x_419); -lean::cnstr_set(x_497, 3, x_420); -lean::cnstr_set(x_497, 4, x_424); -lean::cnstr_set(x_497, 5, x_425); -x_498 = l_Lean_IR_EmitC_emitFnBody___main(x_427, x_497, x_496); -if (lean::obj_tag(x_498) == 0) -{ -obj* x_499; obj* x_500; obj* x_501; obj* x_502; obj* x_503; obj* x_504; obj* x_505; -x_499 = lean::cnstr_get(x_498, 1); -lean::inc(x_499); -if (lean::is_exclusive(x_498)) { - lean::cnstr_release(x_498, 0); - lean::cnstr_release(x_498, 1); - x_500 = x_498; -} else { - lean::dec_ref(x_498); - x_500 = lean::box(0); -} -x_501 = l_PersistentHashMap_Stats_toString___closed__5; -x_502 = lean_string_append(x_499, x_501); -x_503 = lean_string_append(x_502, x_450); -if (lean::is_scalar(x_500)) { - x_504 = lean::alloc_cnstr(0, 2, 0); -} else { - x_504 = x_500; -} -lean::cnstr_set(x_504, 0, x_416); -lean::cnstr_set(x_504, 1, x_503); -x_505 = l_Lean_IR_EmitC_closeNamespacesFor(x_424, x_433, x_504); -lean::dec(x_433); -return x_505; -} -else -{ -obj* x_506; obj* x_507; obj* x_508; obj* x_509; -lean::dec(x_433); -lean::dec(x_424); -x_506 = lean::cnstr_get(x_498, 0); -lean::inc(x_506); -x_507 = lean::cnstr_get(x_498, 1); -lean::inc(x_507); -if (lean::is_exclusive(x_498)) { - lean::cnstr_release(x_498, 0); - lean::cnstr_release(x_498, 1); - x_508 = x_498; -} else { - lean::dec_ref(x_498); - x_508 = lean::box(0); -} -if (lean::is_scalar(x_508)) { - x_509 = lean::alloc_cnstr(1, 2, 0); -} else { - x_509 = x_508; -} -lean::cnstr_set(x_509, 0, x_506); -lean::cnstr_set(x_509, 1, x_507); -return x_509; -} -} -else -{ -obj* x_510; obj* x_511; obj* x_512; obj* x_513; -lean::dec(x_433); -lean::dec(x_429); -lean::dec(x_428); -lean::dec(x_427); -lean::dec(x_425); -lean::dec(x_424); -lean::dec(x_420); -lean::dec(x_419); -x_510 = lean::cnstr_get(x_490, 0); -lean::inc(x_510); -x_511 = lean::cnstr_get(x_490, 1); -lean::inc(x_511); -if (lean::is_exclusive(x_490)) { - lean::cnstr_release(x_490, 0); - lean::cnstr_release(x_490, 1); - x_512 = x_490; -} else { - lean::dec_ref(x_490); - x_512 = lean::box(0); -} -if (lean::is_scalar(x_512)) { - x_513 = lean::alloc_cnstr(1, 2, 0); -} else { - x_513 = x_512; -} -lean::cnstr_set(x_513, 0, x_510); -lean::cnstr_set(x_513, 1, x_511); -return x_513; -} -} -} -} -} -else -{ -obj* x_543; obj* x_544; obj* x_545; obj* x_546; -lean::dec(x_433); -lean::dec(x_429); -lean::dec(x_428); -lean::dec(x_427); -lean::dec(x_425); -lean::dec(x_424); -lean::dec(x_421); -lean::dec(x_420); -lean::dec(x_419); -x_543 = lean::cnstr_get(x_438, 0); -lean::inc(x_543); -x_544 = lean::cnstr_get(x_438, 1); -lean::inc(x_544); -if (lean::is_exclusive(x_438)) { - lean::cnstr_release(x_438, 0); - lean::cnstr_release(x_438, 1); - x_545 = x_438; -} else { - lean::dec_ref(x_438); - x_545 = lean::box(0); -} -if (lean::is_scalar(x_545)) { - x_546 = lean::alloc_cnstr(1, 2, 0); -} else { - x_546 = x_545; -} -lean::cnstr_set(x_546, 0, x_543); -lean::cnstr_set(x_546, 1, x_544); -return x_546; -} -} -else -{ -obj* x_547; obj* x_548; obj* x_549; obj* x_550; -lean::dec(x_433); -lean::dec(x_429); -lean::dec(x_428); -lean::dec(x_427); -lean::dec(x_425); -lean::dec(x_424); -lean::dec(x_421); -lean::dec(x_420); -lean::dec(x_419); -x_547 = lean::cnstr_get(x_434, 0); -lean::inc(x_547); -x_548 = lean::cnstr_get(x_434, 1); -lean::inc(x_548); -if (lean::is_exclusive(x_434)) { - lean::cnstr_release(x_434, 0); - lean::cnstr_release(x_434, 1); - x_549 = x_434; -} else { - lean::dec_ref(x_434); - x_549 = lean::box(0); -} -if (lean::is_scalar(x_549)) { - x_550 = lean::alloc_cnstr(1, 2, 0); -} else { - x_550 = x_549; -} -lean::cnstr_set(x_550, 0, x_547); -lean::cnstr_set(x_550, 1, x_548); -return x_550; -} -} -else -{ -obj* x_551; -lean::dec(x_421); -lean::dec(x_420); -lean::dec(x_419); -lean::dec(x_417); -lean::dec(x_2); -lean::dec(x_1); -x_551 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_551, 0, x_416); -lean::cnstr_set(x_551, 1, x_415); -return x_551; -} -} -else -{ -obj* x_552; -lean::dec(x_421); -lean::dec(x_420); -lean::dec(x_419); -lean::dec(x_417); -lean::dec(x_2); -lean::dec(x_1); -x_552 = lean::alloc_cnstr(0, 2, 0); -lean::cnstr_set(x_552, 0, x_416); -lean::cnstr_set(x_552, 1, x_415); -return x_552; -} -} -} -} -else -{ -uint8 x_556; -lean::dec(x_2); -lean::dec(x_1); -x_556 = !lean::is_exclusive(x_4); -if (x_556 == 0) +x_409 = !lean::is_exclusive(x_4); +if (x_409 == 0) { return x_4; } else { -obj* x_557; obj* x_558; obj* x_559; -x_557 = lean::cnstr_get(x_4, 0); -x_558 = lean::cnstr_get(x_4, 1); -lean::inc(x_558); -lean::inc(x_557); +obj* x_410; obj* x_411; obj* x_412; +x_410 = lean::cnstr_get(x_4, 0); +x_411 = lean::cnstr_get(x_4, 1); +lean::inc(x_411); +lean::inc(x_410); lean::dec(x_4); -x_559 = lean::alloc_cnstr(1, 2, 0); -lean::cnstr_set(x_559, 0, x_557); -lean::cnstr_set(x_559, 1, x_558); -return x_559; +x_412 = lean::alloc_cnstr(1, 2, 0); +lean::cnstr_set(x_412, 0, x_410); +lean::cnstr_set(x_412, 1, x_411); +return x_412; } } } @@ -25608,7 +23480,7 @@ if (lean::obj_tag(x_16) == 0) obj* x_17; lean::dec(x_7); lean::inc(x_9); -x_17 = l_Lean_IR_EmitC_emitCppName(x_9, x_2, x_4); +x_17 = l_Lean_IR_EmitC_emitCName(x_9, x_2, x_4); if (lean::obj_tag(x_17) == 0) { uint8 x_18; @@ -25624,7 +23496,7 @@ x_22 = lean_string_append(x_19, x_21); lean::cnstr_set(x_17, 1, x_22); lean::cnstr_set(x_17, 0, x_8); lean::inc(x_9); -x_23 = l_Lean_IR_EmitC_emitCppInitName(x_9, x_2, x_17); +x_23 = l_Lean_IR_EmitC_emitCInitName(x_9, x_2, x_17); if (lean::obj_tag(x_23) == 0) { uint8 x_24; @@ -25655,7 +23527,7 @@ x_33 = l_Lean_IR_EmitC_emitDeclInit___closed__2; x_34 = lean_string_append(x_30, x_33); lean::cnstr_set(x_23, 1, x_34); lean::cnstr_set(x_23, 0, x_8); -x_35 = l_Lean_IR_EmitC_emitCppName(x_9, x_2, x_23); +x_35 = l_Lean_IR_EmitC_emitCName(x_9, x_2, x_23); if (lean::obj_tag(x_35) == 0) { uint8 x_36; @@ -25741,7 +23613,7 @@ x_60 = lean_string_append(x_55, x_59); x_61 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_61, 0, x_8); lean::cnstr_set(x_61, 1, x_60); -x_62 = l_Lean_IR_EmitC_emitCppName(x_9, x_2, x_61); +x_62 = l_Lean_IR_EmitC_emitCName(x_9, x_2, x_61); if (lean::obj_tag(x_62) == 0) { obj* x_63; obj* x_64; obj* x_65; obj* x_66; obj* x_67; obj* x_68; @@ -25830,7 +23702,7 @@ x_80 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_80, 0, x_8); lean::cnstr_set(x_80, 1, x_79); lean::inc(x_9); -x_81 = l_Lean_IR_EmitC_emitCppInitName(x_9, x_2, x_80); +x_81 = l_Lean_IR_EmitC_emitCInitName(x_9, x_2, x_80); if (lean::obj_tag(x_81) == 0) { obj* x_82; obj* x_83; obj* x_84; obj* x_85; obj* x_86; obj* x_87; uint8 x_88; uint8 x_89; @@ -25875,7 +23747,7 @@ if (lean::is_scalar(x_83)) { } lean::cnstr_set(x_93, 0, x_8); lean::cnstr_set(x_93, 1, x_92); -x_94 = l_Lean_IR_EmitC_emitCppName(x_9, x_2, x_93); +x_94 = l_Lean_IR_EmitC_emitCName(x_9, x_2, x_93); if (lean::obj_tag(x_94) == 0) { obj* x_95; obj* x_96; obj* x_97; obj* x_98; obj* x_99; obj* x_100; @@ -25990,7 +23862,7 @@ x_115 = lean_string_append(x_7, x_114); x_116 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_116, 0, x_8); lean::cnstr_set(x_116, 1, x_115); -x_117 = l_Lean_IR_EmitC_emitCppName(x_113, x_2, x_116); +x_117 = l_Lean_IR_EmitC_emitCName(x_113, x_2, x_116); if (lean::obj_tag(x_117) == 0) { uint8 x_118; @@ -26011,7 +23883,7 @@ x_127 = lean_string_append(x_126, x_123); lean::cnstr_set(x_117, 1, x_127); lean::cnstr_set(x_117, 0, x_8); lean::inc(x_9); -x_128 = l_Lean_IR_EmitC_emitCppName(x_9, x_2, x_117); +x_128 = l_Lean_IR_EmitC_emitCName(x_9, x_2, x_117); if (lean::obj_tag(x_128) == 0) { uint8 x_129; @@ -26041,7 +23913,7 @@ x_137 = l_Lean_IR_EmitC_emitDeclInit___closed__2; x_138 = lean_string_append(x_134, x_137); lean::cnstr_set(x_128, 1, x_138); lean::cnstr_set(x_128, 0, x_8); -x_139 = l_Lean_IR_EmitC_emitCppName(x_9, x_2, x_128); +x_139 = l_Lean_IR_EmitC_emitCName(x_9, x_2, x_128); if (lean::obj_tag(x_139) == 0) { uint8 x_140; @@ -26126,7 +23998,7 @@ x_163 = lean_string_append(x_158, x_162); x_164 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_164, 0, x_8); lean::cnstr_set(x_164, 1, x_163); -x_165 = l_Lean_IR_EmitC_emitCppName(x_9, x_2, x_164); +x_165 = l_Lean_IR_EmitC_emitCName(x_9, x_2, x_164); if (lean::obj_tag(x_165) == 0) { obj* x_166; obj* x_167; obj* x_168; obj* x_169; obj* x_170; obj* x_171; @@ -26220,7 +24092,7 @@ x_188 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_188, 0, x_8); lean::cnstr_set(x_188, 1, x_187); lean::inc(x_9); -x_189 = l_Lean_IR_EmitC_emitCppName(x_9, x_2, x_188); +x_189 = l_Lean_IR_EmitC_emitCName(x_9, x_2, x_188); if (lean::obj_tag(x_189) == 0) { obj* x_190; obj* x_191; obj* x_192; obj* x_193; obj* x_194; uint8 x_195; uint8 x_196; @@ -26264,7 +24136,7 @@ if (lean::is_scalar(x_191)) { } lean::cnstr_set(x_200, 0, x_8); lean::cnstr_set(x_200, 1, x_199); -x_201 = l_Lean_IR_EmitC_emitCppName(x_9, x_2, x_200); +x_201 = l_Lean_IR_EmitC_emitCName(x_9, x_2, x_200); if (lean::obj_tag(x_201) == 0) { obj* x_202; obj* x_203; obj* x_204; obj* x_205; obj* x_206; obj* x_207; @@ -26379,7 +24251,7 @@ x_221 = lean_string_append(x_7, x_220); x_222 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_222, 0, x_8); lean::cnstr_set(x_222, 1, x_221); -x_223 = l_Lean_IR_EmitC_emitCppName(x_9, x_2, x_222); +x_223 = l_Lean_IR_EmitC_emitCName(x_9, x_2, x_222); if (lean::obj_tag(x_223) == 0) { uint8 x_224; @@ -26490,7 +24362,7 @@ if (lean::obj_tag(x_258) == 0) obj* x_259; lean::dec(x_248); lean::inc(x_251); -x_259 = l_Lean_IR_EmitC_emitCppName(x_251, x_2, x_250); +x_259 = l_Lean_IR_EmitC_emitCName(x_251, x_2, x_250); if (lean::obj_tag(x_259) == 0) { obj* x_260; obj* x_261; obj* x_262; obj* x_263; obj* x_264; obj* x_265; @@ -26514,7 +24386,7 @@ if (lean::is_scalar(x_261)) { lean::cnstr_set(x_264, 0, x_249); lean::cnstr_set(x_264, 1, x_263); lean::inc(x_251); -x_265 = l_Lean_IR_EmitC_emitCppInitName(x_251, x_2, x_264); +x_265 = l_Lean_IR_EmitC_emitCInitName(x_251, x_2, x_264); if (lean::obj_tag(x_265) == 0) { obj* x_266; obj* x_267; obj* x_268; obj* x_269; obj* x_270; obj* x_271; uint8 x_272; uint8 x_273; @@ -26559,7 +24431,7 @@ if (lean::is_scalar(x_267)) { } lean::cnstr_set(x_277, 0, x_249); lean::cnstr_set(x_277, 1, x_276); -x_278 = l_Lean_IR_EmitC_emitCppName(x_251, x_2, x_277); +x_278 = l_Lean_IR_EmitC_emitCName(x_251, x_2, x_277); if (lean::obj_tag(x_278) == 0) { obj* x_279; obj* x_280; obj* x_281; obj* x_282; obj* x_283; obj* x_284; @@ -26675,7 +24547,7 @@ x_299 = lean_string_append(x_248, x_298); x_300 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_300, 0, x_249); lean::cnstr_set(x_300, 1, x_299); -x_301 = l_Lean_IR_EmitC_emitCppName(x_297, x_2, x_300); +x_301 = l_Lean_IR_EmitC_emitCName(x_297, x_2, x_300); if (lean::obj_tag(x_301) == 0) { obj* x_302; obj* x_303; obj* x_304; obj* x_305; obj* x_306; obj* x_307; obj* x_308; obj* x_309; obj* x_310; obj* x_311; obj* x_312; @@ -26704,7 +24576,7 @@ if (lean::is_scalar(x_303)) { lean::cnstr_set(x_311, 0, x_249); lean::cnstr_set(x_311, 1, x_310); lean::inc(x_251); -x_312 = l_Lean_IR_EmitC_emitCppName(x_251, x_2, x_311); +x_312 = l_Lean_IR_EmitC_emitCName(x_251, x_2, x_311); if (lean::obj_tag(x_312) == 0) { obj* x_313; obj* x_314; obj* x_315; obj* x_316; obj* x_317; uint8 x_318; uint8 x_319; @@ -26748,7 +24620,7 @@ if (lean::is_scalar(x_314)) { } lean::cnstr_set(x_323, 0, x_249); lean::cnstr_set(x_323, 1, x_322); -x_324 = l_Lean_IR_EmitC_emitCppName(x_251, x_2, x_323); +x_324 = l_Lean_IR_EmitC_emitCName(x_251, x_2, x_323); if (lean::obj_tag(x_324) == 0) { obj* x_325; obj* x_326; obj* x_327; obj* x_328; obj* x_329; obj* x_330; @@ -26864,7 +24736,7 @@ x_344 = lean_string_append(x_248, x_343); x_345 = lean::alloc_cnstr(0, 2, 0); lean::cnstr_set(x_345, 0, x_249); lean::cnstr_set(x_345, 1, x_344); -x_346 = l_Lean_IR_EmitC_emitCppName(x_251, x_2, x_345); +x_346 = l_Lean_IR_EmitC_emitCName(x_251, x_2, x_345); if (lean::obj_tag(x_346) == 0) { obj* x_347; obj* x_348; obj* x_349; obj* x_350; obj* x_351; obj* x_352; obj* x_353; obj* x_354; obj* x_355; obj* x_356; @@ -29358,28 +27230,18 @@ l_Lean_IR_EmitC_toCType___closed__6 = _init_l_Lean_IR_EmitC_toCType___closed__6( lean::mark_persistent(l_Lean_IR_EmitC_toCType___closed__6); l_Lean_IR_EmitC_toCType___closed__7 = _init_l_Lean_IR_EmitC_toCType___closed__7(); lean::mark_persistent(l_Lean_IR_EmitC_toCType___closed__7); -l_Lean_IR_EmitC_openNamespacesAux___main___closed__1 = _init_l_Lean_IR_EmitC_openNamespacesAux___main___closed__1(); -lean::mark_persistent(l_Lean_IR_EmitC_openNamespacesAux___main___closed__1); -l_Lean_IR_EmitC_openNamespacesAux___main___closed__2 = _init_l_Lean_IR_EmitC_openNamespacesAux___main___closed__2(); -lean::mark_persistent(l_Lean_IR_EmitC_openNamespacesAux___main___closed__2); -l_Lean_IR_EmitC_openNamespacesAux___main___closed__3 = _init_l_Lean_IR_EmitC_openNamespacesAux___main___closed__3(); -lean::mark_persistent(l_Lean_IR_EmitC_openNamespacesAux___main___closed__3); l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1 = _init_l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1(); lean::mark_persistent(l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1); -l_Lean_IR_EmitC_toBaseCppName___closed__1 = _init_l_Lean_IR_EmitC_toBaseCppName___closed__1(); -lean::mark_persistent(l_Lean_IR_EmitC_toBaseCppName___closed__1); -l_Lean_IR_EmitC_toBaseCppName___closed__2 = _init_l_Lean_IR_EmitC_toBaseCppName___closed__2(); -lean::mark_persistent(l_Lean_IR_EmitC_toBaseCppName___closed__2); -l_Lean_IR_EmitC_toBaseCppName___closed__3 = _init_l_Lean_IR_EmitC_toBaseCppName___closed__3(); -lean::mark_persistent(l_Lean_IR_EmitC_toBaseCppName___closed__3); l_Lean_IR_EmitC_toCName___closed__1 = _init_l_Lean_IR_EmitC_toCName___closed__1(); lean::mark_persistent(l_Lean_IR_EmitC_toCName___closed__1); +l_Lean_IR_EmitC_toCName___closed__2 = _init_l_Lean_IR_EmitC_toCName___closed__2(); +lean::mark_persistent(l_Lean_IR_EmitC_toCName___closed__2); +l_Lean_IR_EmitC_toCName___closed__3 = _init_l_Lean_IR_EmitC_toCName___closed__3(); +lean::mark_persistent(l_Lean_IR_EmitC_toCName___closed__3); l_Lean_IR_EmitC_toCInitName___closed__1 = _init_l_Lean_IR_EmitC_toCInitName___closed__1(); lean::mark_persistent(l_Lean_IR_EmitC_toCInitName___closed__1); l_Lean_IR_EmitC_emitFnDeclAux___closed__1 = _init_l_Lean_IR_EmitC_emitFnDeclAux___closed__1(); lean::mark_persistent(l_Lean_IR_EmitC_emitFnDeclAux___closed__1); -l_Lean_IR_EmitC_emitExternDeclAux___closed__1 = _init_l_Lean_IR_EmitC_emitExternDeclAux___closed__1(); -lean::mark_persistent(l_Lean_IR_EmitC_emitExternDeclAux___closed__1); l_List_mfor___main___at_Lean_IR_EmitC_emitFnDecls___spec__5___closed__1 = _init_l_List_mfor___main___at_Lean_IR_EmitC_emitFnDecls___spec__5___closed__1(); lean::mark_persistent(l_List_mfor___main___at_Lean_IR_EmitC_emitFnDecls___spec__5___closed__1); l_List_mfor___main___at_Lean_IR_EmitC_emitFnDecls___spec__5___closed__2 = _init_l_List_mfor___main___at_Lean_IR_EmitC_emitFnDecls___spec__5___closed__2(); @@ -29712,6 +27574,8 @@ l_Lean_IR_EmitC_emitDeclAux___closed__1 = _init_l_Lean_IR_EmitC_emitDeclAux___cl lean::mark_persistent(l_Lean_IR_EmitC_emitDeclAux___closed__1); l_Lean_IR_EmitC_emitDeclAux___closed__2 = _init_l_Lean_IR_EmitC_emitDeclAux___closed__2(); lean::mark_persistent(l_Lean_IR_EmitC_emitDeclAux___closed__2); +l_Lean_IR_EmitC_emitDeclAux___closed__3 = _init_l_Lean_IR_EmitC_emitDeclAux___closed__3(); +lean::mark_persistent(l_Lean_IR_EmitC_emitDeclAux___closed__3); l_Lean_IR_EmitC_emitDecl___closed__1 = _init_l_Lean_IR_EmitC_emitDecl___closed__1(); lean::mark_persistent(l_Lean_IR_EmitC_emitDecl___closed__1); l_Lean_IR_EmitC_emitDeclInit___closed__1 = _init_l_Lean_IR_EmitC_emitDeclInit___closed__1();