/* Generated by Nim Compiler v0.10.2 */
/*   (c) 2014 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 64
#include "nimbase.h"

#include <string.h>
typedef struct tsym224846 tsym224846;
typedef struct tidobj199015 tidobj199015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct ttypeseq224848 ttypeseq224848;
typedef struct ttype224852 ttype224852;
typedef struct TGenericSeq TGenericSeq;
typedef struct tscope224840 tscope224840;
typedef struct TY224947 TY224947;
typedef struct tinstantiation224836 tinstantiation224836;
typedef struct tstrtable224820 tstrtable224820;
typedef struct tsymseq224818 tsymseq224818;
typedef struct tident199021 tident199021;
typedef struct tlineinfo194539 tlineinfo194539;
typedef struct tnode224816 tnode224816;
typedef struct tloc224830 tloc224830;
typedef struct trope176009 trope176009;
typedef struct tlib224834 tlib224834;
typedef struct NimStringDesc NimStringDesc;
typedef struct tnodeseq224810 tnodeseq224810;
typedef struct TY84745 TY84745;
typedef struct tcell44935 tcell44935;
typedef struct tcellseq44951 tcellseq44951;
typedef struct tgcheap47016 tgcheap47016;
typedef struct tcellset44947 tcellset44947;
typedef struct tpagedesc44943 tpagedesc44943;
typedef struct tmemregion27210 tmemregion27210;
typedef struct tsmallchunk26440 tsmallchunk26440;
typedef struct tllchunk27204 tllchunk27204;
typedef struct tbigchunk26442 tbigchunk26442;
typedef struct tintset26417 tintset26417;
typedef struct ttrunk26413 ttrunk26413;
typedef struct tavlnode27208 tavlnode27208;
typedef struct tgcstat47014 tgcstat47014;
typedef struct toutercontext427022 toutercontext427022;
typedef struct tenv427020 tenv427020;
typedef struct intset221056 intset221056;
typedef struct ttrunk221052 ttrunk221052;
typedef struct ttrunkseq221054 ttrunkseq221054;
typedef struct tidnodetable224870 tidnodetable224870;
typedef struct tidnodepairseq224868 tidnodepairseq224868;
typedef struct tidnodepair224866 tidnodepair224866;
typedef struct tidtable224864 tidtable224864;
typedef struct tidpairseq224862 tidpairseq224862;
typedef struct tidpair224860 tidpair224860;
typedef struct titer427016 titer427016;
typedef struct TY224936 TY224936;
typedef struct tlistentry126022 tlistentry126022;
typedef struct tbasechunk26438 tbasechunk26438;
typedef struct tfreecell26430 tfreecell26430;
typedef N_NIMCALL_PTR(void, TY3089) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3094) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3089 marker;
TY3094 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  tidobj199015  {
  TNimObject Sup;
NI Id;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  tstrtable224820  {
NI Counter;
tsymseq224818* Data;
};
struct  tlineinfo194539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  tloc224830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype224852* T;
trope176009* R;
trope176009* Heaproot;
};
struct  tsym224846  {
  tidobj199015 Sup;
NU8 Kind;
union {
struct {ttypeseq224848* Typeinstcache;
tscope224840* Typscope;
} S1;
struct {TY224947* Procinstcache;
tscope224840* Scope;
} S2;
struct {TY224947* Usedgenerics;
tstrtable224820 Tab;
} S3;
struct {tsym224846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype224852* Typ;
tident199021* Name;
tlineinfo194539 Info;
tsym224846* Owner;
NU32 Flags;
tnode224816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc224830 Loc;
tlib224834* Annex;
tnode224816* Constraint;
};
struct  ttype224852  {
  tidobj199015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq224848* Sons;
tnode224816* N;
tsym224846* Owner;
tsym224846* Sym;
tsym224846* Destructor;
tsym224846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc224830 Loc;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  tnode224816  {
ttype224852* Typ;
tlineinfo194539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym224846* Sym;
} S4;
struct {tident199021* Ident;
} S5;
struct {tnodeseq224810* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
struct TY84745 {
NimStringDesc* Field0;
NI Field1;
};
struct  tcell44935  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq44951  {
NI Len;
NI Cap;
tcell44935** D;
};
struct  tcellset44947  {
NI Counter;
NI Max;
tpagedesc44943* Head;
tpagedesc44943** Data;
};
typedef tsmallchunk26440* TY27222[512];
typedef ttrunk26413* ttrunkbuckets26415[256];
struct  tintset26417  {
ttrunkbuckets26415 Data;
};
struct  tmemregion27210  {
NI Minlargeobj;
NI Maxlargeobj;
TY27222 Freesmallchunks;
tllchunk27204* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk26442* Freechunkslist;
tintset26417 Chunkstarts;
tavlnode27208* Root;
tavlnode27208* Deleted;
tavlnode27208* Last;
tavlnode27208* Freeavlnodes;
};
struct  tgcstat47014  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap47016  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq44951 Zct;
tcellseq44951 Decstack;
tcellset44947 Cycleroots;
tcellseq44951 Tempstack;
NI Recgclock;
tmemregion27210 Region;
tgcstat47014 Stat;
};
struct  intset221056  {
NI Counter;
NI Max;
ttrunk221052* Head;
ttrunkseq221054* Data;
};
struct  tidnodepair224866  {
tidobj199015* Key;
tnode224816* Val;
};
struct  tidnodetable224870  {
NI Counter;
tidnodepairseq224868* Data;
};
struct  tidpair224860  {
tidobj199015* Key;
TNimObject* Val;
};
struct  tidtable224864  {
NI Counter;
tidpairseq224862* Data;
};
struct  toutercontext427022  {
tsym224846* Fn;
tenv427020* Head;
intset221056 Capturedvars;
intset221056 Processed;
tidnodetable224870 Localstoaccess;
tidtable224864 Lambdastoenv;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tenv427020  {
  TNimObject Sup;
tnode224816* Attachednode;
tnode224816* Replacementnode;
tnode224816* Createdvar;
NIM_BOOL Createdvarcomesfromiter;
tsymseq224818* Capturedvars;
tenv427020* Up;
tenv427020* Next;
tsym224846* Upfield;
ttype224852* Obj;
tsym224846* Fn;
intset221056 Vars;
};
struct  tident199021  {
  tidobj199015 Sup;
NimStringDesc* S;
tident199021* Next;
NI H;
};
struct  titer427016  {
tsym224846* Fn;
tsym224846* Closureparam;
tsym224846* State;
tsym224846* Resultsym;
ttype224852* Obj;
};
struct  tscope224840  {
NI Depthlevel;
tstrtable224820 Symbols;
tnodeseq224810* Usingsyms;
tscope224840* Parent;
};
struct  tinstantiation224836  {
tsym224846* Sym;
ttypeseq224848* Concretetypes;
TY224936* Usedby;
};
struct  trope176009  {
  TNimObject Sup;
trope176009* Left;
trope176009* Right;
NI Length;
NimStringDesc* Data;
};
struct  tlistentry126022  {
  TNimObject Sup;
tlistentry126022* Prev;
tlistentry126022* Next;
};
struct  tlib224834  {
  tlistentry126022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope176009* Name;
tnode224816* Path;
};
typedef NI TY26420[8];
struct  tpagedesc44943  {
tpagedesc44943* Next;
NI Key;
TY26420 Bits;
};
struct  tbasechunk26438  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk26440  {
  tbasechunk26438 Sup;
tsmallchunk26440* Next;
tsmallchunk26440* Prev;
tfreecell26430* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk27204  {
NI Size;
NI Acc;
tllchunk27204* Next;
};
struct  tbigchunk26442  {
  tbasechunk26438 Sup;
tbigchunk26442* Next;
tbigchunk26442* Prev;
NI Align;
NF Data;
};
struct  ttrunk26413  {
ttrunk26413* Next;
NI Key;
TY26420 Bits;
};
typedef tavlnode27208* TY27214[2];
struct  tavlnode27208  {
TY27214 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  ttrunk221052  {
ttrunk221052* Next;
NI Key;
TY26420 Bits;
};
struct  tfreecell26430  {
tfreecell26430* Next;
NI Zerofield;
};
struct ttypeseq224848 {
  TGenericSeq Sup;
  ttype224852* data[SEQ_DECL_SIZE];
};
struct TY224947 {
  TGenericSeq Sup;
  tinstantiation224836* data[SEQ_DECL_SIZE];
};
struct tsymseq224818 {
  TGenericSeq Sup;
  tsym224846* data[SEQ_DECL_SIZE];
};
struct tnodeseq224810 {
  TGenericSeq Sup;
  tnode224816* data[SEQ_DECL_SIZE];
};
struct ttrunkseq221054 {
  TGenericSeq Sup;
  ttrunk221052* data[SEQ_DECL_SIZE];
};
struct tidnodepairseq224868 {
  TGenericSeq Sup;
  tidnodepair224866 data[SEQ_DECL_SIZE];
};
struct tidpairseq224862 {
  TGenericSeq Sup;
  tidpair224860 data[SEQ_DECL_SIZE];
};
struct TY224936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
static N_INLINE(NIM_BOOL, interestingvar_428039)(tsym224846* s);
N_NIMCALL(NIM_BOOL, isgenericroutine_231650)(tsym224846* s);
static N_INLINE(NI, len_225364)(tnode224816* n);
static N_INLINE(tnode224816*, HEX5BHEX5D_225698)(tnode224816* n, NI i);
N_NIMCALL(void, internalerror_197006)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_197126)(TY84745 x_197130);
N_NIMCALL(tnode224816*, newnodei_225138)(NU8 kind, tlineinfo194539 info);
N_NIMCALL(tsym224846*, copysym_225203)(tsym224846* s, NIM_BOOL keepid);
N_NIMCALL(tsym224846*, gethiddenparam_427238)(tsym224846* routine);
static N_INLINE(tnode224816*, lastson_225261)(tnode224816* n);
static N_INLINE(NI, sonslen_225249)(tnode224816* n);
N_NIMCALL(void, addvar_423053)(tnode224816* father, tnode224816* v);
N_NIMCALL(tnode224816*, newsymnode_225132)(tsym224846* sym);
N_NIMCALL(void, add_225498)(tnode224816* father, tnode224816* son);
N_NIMCALL(tnode224816*, newcall_427891)(tsym224846* a, tnode224816* b);
N_NIMCALL(tsym224846*, getsyssym_281054)(NimStringDesc* name);
N_NIMCALL(tnode224816*, newnodei_227007)(NU8 kind, tlineinfo194539 info, NI children);
N_NIMCALL(tnode224816*, newinttypenode_225103)(NU8 kind, NI64 intval, ttype224852* typ);
N_NIMCALL(ttype224852*, getsystype_281030)(NU8 kind);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(tcell44935*, usrtocell_48646)(void* usr);
static N_INLINE(void, rtladdzct_50204)(tcell44935* c);
N_NOINLINE(void, addzct_48617)(tcellseq44951* s, tcell44935* c);
N_NIMCALL(void, addson_225287)(tnode224816* father, tnode224816* son);
N_NIMCALL(tnode224816*, makeclosure_428949)(tsym224846* prc, tnode224816* env, tlineinfo194539 info);
N_NIMCALL(tnode224816*, newnodeit_225145)(NU8 kind, tlineinfo194539 info, ttype224852* typ);
N_NIMCALL(tsym224846*, skipgenericowner_231699)(tsym224846* s);
N_NIMCALL(toutercontext427022*, newoutercontext_427647)(tsym224846* fn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3177)(void* p, NI op);
N_NIMCALL(void, TMP3178)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initintset_221950)(intset221056* Result);
N_NIMCALL(void, initidnodetable_225181)(tidnodetable224870* x);
N_NIMCALL(void, initidtable_225167)(tidtable224864* x);
N_NIMCALL(tnode224816*, closurecreationpoint_429358)(tnode224816* n);
N_NIMCALL(tenv427020*, newenv_427675)(toutercontext427022* o, tenv427020* up, tnode224816* n, tsym224846* owner);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incref_51025)(tcell44935* c);
static N_INLINE(NIM_BOOL, canbecycleroot_48667)(tcell44935* c);
static N_INLINE(void, rtladdcycleroot_49429)(tcell44935* c);
N_NOINLINE(void, incl_45671)(tcellset44947* s, tcell44935* cell);
static N_INLINE(void, decref_50604)(tcell44935* c);
N_NIMCALL(tsym224846*, getenvparam_427349)(tsym224846* routine);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(ttype224852*, createenvobj_427082)(tsym224846* owner);
N_NIMCALL(ttype224852*, createobj_423304)(tsym224846* owner, tlineinfo194539 info);
N_NIMCALL(void, rawaddfield_423331)(ttype224852* obj, tsym224846* field);
N_NIMCALL(tsym224846*, createstatefield_427072)(tsym224846* iter);
N_NIMCALL(tsym224846*, newsym_225074)(NU8 symkind, tident199021* name, tsym224846* owner, tlineinfo194539 info);
N_NIMCALL(tident199021*, getident_199472)(NimStringDesc* identifier);
N_NIMCALL(ttype224852*, getstatetype_427049)(tsym224846* iter);
N_NIMCALL(tnode224816*, newintnode_225096)(NU8 kind, NI64 intval);
N_NIMCALL(ttype224852*, newtype_225083)(NU8 kind, tsym224846* owner);
N_NIMCALL(ttype224852*, nilorsysint_281070)(void);
N_NIMCALL(void, rawaddson_229562)(ttype224852* father, ttype224852* son);
N_NIMCALL(void, addparamstoenv_429386)(tsym224846* fn, tenv427020* env);
N_NIMCALL(void, internalerror_196987)(tlineinfo194539 info, NimStringDesc* errmsg);
N_NIMCALL(void, incl_221869)(intset221056* s, NI key);
N_NIMCALL(void, searchforinnerprocs_429541)(toutercontext427022* o, tnode224816* n, tenv427020* env);
N_NIMCALL(NIM_BOOL, isinnerproc_427902)(tsym224846* s, tsym224846* outerproc);
N_NIMCALL(NIM_BOOL, containsorincl_221916)(intset221056* s, NI key);
N_NIMCALL(tnode224816*, getbody_278269)(tsym224846* s);
N_NIMCALL(NI, gathervars_428721)(toutercontext427022* o, tenv427020* e, tnode224816* n);
N_NIMCALL(NIM_BOOL, capturevar_428433)(toutercontext427022* o, tenv427020* top, tsym224846* local, tlineinfo194539 info);
N_NIMCALL(NIM_BOOL, contains_221837)(intset221056* s, NI key);
static N_INLINE(NIM_BOOL, illegalcapture_428006)(tsym224846* s);
N_NIMCALL(ttype224852*, skiptypes_229245)(ttype224852* t, NU64 kinds);
N_NIMCALL(void, localerror_196955)(tlineinfo194539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(tsym224846*, createupfield_428421)(ttype224852* obj, ttype224852* fieldtype);
N_NIMCALL(void, addfield_423608)(ttype224852* obj, tsym224846* s);
N_NIMCALL(void, addclosureparam_427962)(tsym224846* fn, tenv427020* e);
N_NIMCALL(void, addhiddenparam_427147)(tsym224846* routine, tsym224846* param);
N_NIMCALL(TNimObject*, idtableget_234182)(tidtable224864 t, tidobj199015* key);
N_NIMCALL(void, idtableput_234196)(tidtable224864* t, tidobj199015* key, TNimObject* val);
N_NIMCALL(void, addcapturedvar_427818)(tenv427020* e, tsym224846* v);
N_NIMCALL(TGenericSeq*, incrSeq)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(tnode224816*, transforminnerproc_429192)(toutercontext427022* o, tenv427020* e, tnode224816* n);
N_NIMCALL(tnode224816*, getclosurevar_429015)(tenv427020* e);
N_NIMCALL(tnode224816*, newclosurecreationvar_428978)(tenv427020* e);
N_NIMCALL(void, inititer_427412)(tsym224846* iter, titer427016* Result);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(tsym224846*, newiterresult_427092)(tsym224846* iter);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, adduniquefield_423807)(ttype224852* obj, tsym224846* s);
N_NIMCALL(tnode224816*, indirectaccess_424848)(tnode224816* a, tsym224846* b, tlineinfo194539 info);
N_NIMCALL(tenv427020*, findenv_429042)(toutercontext427022* o, tsym224846* s);
N_NIMCALL(tnode224816*, nestedaccess_428076)(tenv427020* top, tsym224846* local);
N_NIMCALL(void, createenvironments_431610)(toutercontext427022* o);
N_NIMCALL(tnode224816*, generateclosurecreation_430308)(toutercontext427022* o, tenv427020* scope);
N_NIMCALL(tnode224816*, rawclosurecreation_430201)(toutercontext427022* o, tenv427020* scope, tnode224816* env);
N_NIMCALL(tnode224816*, newasgnstmt_430161)(tnode224816* le, tnode224816* ri, tlineinfo194539 info);
N_NIMCALL(tnode224816*, idnodetableget_234212)(tidnodetable224870 t, tidobj199015* key);
N_NIMCALL(void, idnodetableput_234219)(tidnodetable224870* t, tidobj199015* key, tnode224816* val);
N_NIMCALL(tnode224816*, transformouterprocbody_432214)(toutercontext427022* o, tnode224816* n, titer427016* it);
N_NIMCALL(tnode224816*, rawindirectaccess_423407)(tnode224816* a, tsym224846* field, tlineinfo194539 info);
N_NIMCALL(tnode224816*, transformouterproc_430483)(toutercontext427022* o, tnode224816* n, titer427016* it);
N_NIMCALL(void, excl_221884)(intset221056* s, NI key);
static N_INLINE(NIM_BOOL, interestingitervar_430446)(tsym224846* s);
N_NIMCALL(void, message_196976)(tlineinfo194539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(tnode224816*, liftitersym_431255)(tnode224816* n);
N_NIMCALL(tnode224816*, generateiterclosurecreation_430320)(toutercontext427022* o, tenv427020* env, tnode224816* scope);
N_NIMCALL(tnode224816*, transformouterconv_428882)(tnode224816* n);
N_NIMCALL(tnode224816*, generatethunk_428861)(tnode224816* prc, ttype224852* dest);
N_NIMCALL(tnode224816*, transformyield_430491)(toutercontext427022* c, tnode224816* n, titer427016* it);
N_NIMCALL(void, outerprocsons_431170)(toutercontext427022* o, tnode224816* n, titer427016* it);
N_NIMCALL(tnode224816*, transformreturn_431157)(toutercontext427022* c, tnode224816* n, titer427016* it);
N_NIMCALL(void, finishenvironments_431837)(toutercontext427022* o);
STRING_LITERAL(TMP3138, "compiler/lambdalifting.nim", 26);
NIM_CONST TY84745 TMP3137 = {((NimStringDesc*) &TMP3138),
999}
;
NIM_CONST TY84745 TMP3139 = {((NimStringDesc*) &TMP3138),
195}
;
STRING_LITERAL(TMP3140, "internalNew", 11);
STRING_LITERAL(TMP3179, ":envP", 5);
STRING_LITERAL(TMP3180, ":state", 6);
STRING_LITERAL(TMP3181, "liftLambdas: strange params", 27);
STRING_LITERAL(TMP3182, ":up", 3);
STRING_LITERAL(TMP3183, ":env", 4);
NIM_CONST TY84745 TMP3184 = {((NimStringDesc*) &TMP3138),
219}
;
STRING_LITERAL(TMP3185, ":result", 7);
NIM_CONST TY84745 TMP3191 = {((NimStringDesc*) &TMP3138),
469}
;
NIM_CONST TY84745 TMP3192 = {((NimStringDesc*) &TMP3138),
312}
;
NIM_CONST TY84745 TMP3193 = {((NimStringDesc*) &TMP3138),
319}
;
STRING_LITERAL(TMP3194, "searchForInnerProcs", 19);
extern tgcheap47016 gch_47044;
extern tnode224816* emptynode_225738;
extern NU8 gcmd_168120;
TNimType NTI427022; /* TOuterContext */
extern TNimType NTI224814; /* PSym */
extern TNimType NTI3211; /* RootObj */
TNimType NTI427020; /* TEnv */
extern TNimType NTI224808; /* PNode */
extern TNimType NTI138; /* bool */
extern TNimType NTI224818; /* TSymSeq */
extern TNimType NTI224812; /* PType */
extern TNimType NTI221056; /* IntSet */
TNimType NTI427018; /* PEnv */
extern TNimType NTI224870; /* TIdNodeTable */
extern TNimType NTI224864; /* TIdTable */
TNimType NTI427014; /* POuterContext */

static N_INLINE(NIM_BOOL, interestingvar_428039)(tsym224846* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = ((2100008 &(1<<(((*s).Kind)&31)))!=0);
	if (!(LOC1)) goto LA2;
	LOC1 = !((((*s).Flags &(1<<((((NU8) 3))&31)))!=0));
	LA2: ;
	result = LOC1;
	return result;
}

N_NIMCALL(void, semcapturesym_428685)(tsym224846* s, tsym224846* owner) {
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_428039(s);
		if (!(LOC4)) goto LA5;
		LOC4 = !(((*owner).Sup.Id == (*(*s).Owner).Sup.Id));
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA6;
		LOC3 = !(((*s).Kind == ((NU8) 11)));
		LA6: ;
		if (!LOC3) goto LA7;
		{
			NIM_BOOL LOC11;
			NIM_BOOL LOC13;
			LOC11 = 0;
			LOC11 = !(((*owner).Typ == NIM_NIL));
			if (!(LOC11)) goto LA12;
			LOC13 = 0;
			LOC13 = isgenericroutine_231650(owner);
			LOC11 = !(LOC13);
			LA12: ;
			if (!LOC11) goto LA14;
			(*(*owner).Typ).Callconv = ((NU8) 8);
		}
		LA14: ;
	}
	LA7: ;
}

static N_INLINE(NI, len_225364)(tnode224816* n) {
	NI result;
	result = 0;
	{
		if (!(*n).kindU.S6.Sons == 0) goto LA3;
		result = 0;
	}
	goto LA1;
	LA3: ;
	{
		result = (*n).kindU.S6.Sons->Sup.len;
	}
	LA1: ;
	return result;
}

static N_INLINE(tnode224816*, HEX5BHEX5D_225698)(tnode224816* n, NI i) {
	tnode224816* result;
	result = 0;
	result = (*n).kindU.S6.Sons->data[i];
	return result;
}

static N_INLINE(NI, sonslen_225249)(tnode224816* n) {
	NI result;
	result = 0;
	{
		if (!(*n).kindU.S6.Sons == 0) goto LA3;
		result = 0;
	}
	goto LA1;
	LA3: ;
	{
		result = (*n).kindU.S6.Sons->Sup.len;
	}
	LA1: ;
	return result;
}

static N_INLINE(tnode224816*, lastson_225261)(tnode224816* n) {
	tnode224816* result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = sonslen_225249(n);
	result = (*n).kindU.S6.Sons->data[(NI64)(LOC1 - 1)];
	return result;
}

N_NIMCALL(tsym224846*, gethiddenparam_427238)(tsym224846* routine) {
	tsym224846* result;
	tnode224816* params;
	tnode224816* hidden;
	result = 0;
	params = (*(*routine).Ast).kindU.S6.Sons->data[3];
	hidden = lastson_225261(params);
	{
		NIM_BOOL LOC3;
		NimStringDesc* LOC7;
		LOC3 = 0;
		LOC3 = ((*hidden).Kind == ((NU8) 3));
		if (!(LOC3)) goto LA4;
		LOC3 = ((*(*hidden).kindU.S4.Sym).Kind == ((NU8) 3));
		LA4: ;
		if (!!(LOC3)) goto LA5;
		LOC7 = 0;
		LOC7 = HEX24_197126(TMP3139);
		internalerror_197006(LOC7);
	}
	LA5: ;
	result = (*hidden).kindU.S4.Sym;
	return result;
}

N_NIMCALL(tnode224816*, newcall_427891)(tsym224846* a, tnode224816* b) {
	tnode224816* result;
	tnode224816* LOC1;
	result = 0;
	result = newnodei_225138(((NU8) 27), (*a).Info);
	LOC1 = 0;
	LOC1 = newsymnode_225132(a);
	add_225498(result, LOC1);
	add_225498(result, b);
	return result;
}

static N_INLINE(tcell44935*, usrtocell_48646)(void* usr) {
	tcell44935* result;
	result = 0;
	result = ((tcell44935*) ((NI)((NU64)(((NI) (usr))) - (NU64)(((NI)sizeof(tcell44935))))));
	return result;
}

static N_INLINE(void, rtladdzct_50204)(tcell44935* c) {
	addzct_48617((&gch_47044.Zct), c);
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		tcell44935* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_48646(src);
		(*c).Refcount += 8;
	}
	LA3: ;
	{
		tcell44935* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_48646((*dest));
		{
			(*c).Refcount -= 8;
			if (!((NU64)((*c).Refcount) < (NU64)(8))) goto LA11;
			rtladdzct_50204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(tnode224816*, makeclosure_428949)(tsym224846* prc, tnode224816* env, tlineinfo194539 info) {
	tnode224816* result;
	tnode224816* LOC1;
	result = 0;
	result = newnodeit_225145(((NU8) 154), info, (*prc).Typ);
	LOC1 = 0;
	LOC1 = newsymnode_225132(prc);
	add_225498(result, LOC1);
	{
		ttype224852* LOC6;
		tnode224816* LOC7;
		if (!(env == NIM_NIL)) goto LA4;
		LOC6 = 0;
		LOC6 = getsystype_281030(((NU8) 5));
		LOC7 = 0;
		LOC7 = newnodeit_225145(((NU8) 23), info, LOC6);
		add_225498(result, LOC7);
	}
	goto LA2;
	LA4: ;
	{
		add_225498(result, env);
	}
	LA2: ;
	return result;
}

N_NIMCALL(tnode224816*, liftforloop_433953)(tnode224816* body) {
	tnode224816* result;
	NI l;
	tnode224816* call;
	tsym224846* env;
	tnode224816* loopbody;
	tnode224816* whileloop;
	ttype224852* LOC23;
	tnode224816* v2;
	tnode224816* vpart;
	NU8 LOC24;
	tnode224816* bs;
	result = 0;
	l = len_225364(body);
	{
		NIM_BOOL LOC3;
		tnode224816* LOC5;
		NimStringDesc* LOC8;
		LOC3 = 0;
		LOC3 = ((*body).Kind == ((NU8) 94));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = HEX5BHEX5D_225698(body, (NI64)(l - 2));
		LOC3 = ((*LOC5).Kind == ((NU8) 27) || (*LOC5).Kind == ((NU8) 29) || (*LOC5).Kind == ((NU8) 30) || (*LOC5).Kind == ((NU8) 31) || (*LOC5).Kind == ((NU8) 26) || (*LOC5).Kind == ((NU8) 28) || (*LOC5).Kind == ((NU8) 32));
		LA4: ;
		if (!!(LOC3)) goto LA6;
		LOC8 = 0;
		LOC8 = HEX24_197126(TMP3137);
		internalerror_197006(LOC8);
	}
	LA6: ;
	call = HEX5BHEX5D_225698(body, (NI64)(l - 2));
	result = newnodei_225138(((NU8) 115), (*body).Info);
	env = 0;
	{
		NIM_BOOL LOC11;
		tnode224816* LOC12;
		tnode224816* LOC14;
		tsym224846* iter;
		tnode224816* LOC17;
		tsym224846* LOC18;
		tnode224816* v;
		tnode224816* LOC19;
		tsym224846* LOC20;
		tnode224816* LOC21;
		tnode224816* LOC22;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = HEX5BHEX5D_225698(call, 0);
		LOC11 = ((*LOC12).Kind == ((NU8) 3));
		if (!(LOC11)) goto LA13;
		LOC14 = 0;
		LOC14 = HEX5BHEX5D_225698(call, 0);
		LOC11 = ((*(*LOC14).kindU.S4.Sym).Kind == ((NU8) 15));
		LA13: ;
		if (!LOC11) goto LA15;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_225698(call, 0);
		iter = (*LOC17).kindU.S4.Sym;
		LOC18 = 0;
		LOC18 = gethiddenparam_427238(iter);
		env = copysym_225203(LOC18, NIM_FALSE);
		v = newnodei_225138(((NU8) 99), (*body).Info);
		LOC19 = 0;
		LOC19 = newsymnode_225132(env);
		addvar_423053(v, LOC19);
		add_225498(result, v);
		LOC20 = 0;
		LOC20 = getsyssym_281054(((NimStringDesc*) &TMP3140));
		LOC21 = 0;
		LOC21 = newsymnode_225132(env);
		LOC22 = 0;
		LOC22 = newcall_427891(LOC20, LOC21);
		add_225498(result, LOC22);
	}
	LA15: ;
	loopbody = newnodei_227007(((NU8) 115), (*body).Info, 3);
	whileloop = newnodei_227007(((NU8) 96), (*body).Info, 2);
	LOC23 = 0;
	LOC23 = getsystype_281030(((NU8) 1));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.Sons->data[0]), newinttypenode_225103(((NU8) 6), IL64(1), LOC23));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.Sons->data[1]), loopbody);
	add_225498(result, whileloop);
	v2 = newnodei_225138(((NU8) 100), (*body).Info);
	LOC24 = 0;
	{
		if (!(l == 3)) goto LA27;
		LOC24 = ((NU8) 35);
	}
	goto LA25;
	LA27: ;
	{
		LOC24 = ((NU8) 36);
	}
	LA25: ;
	vpart = newnodei_225138(LOC24, (*body).Info);
	{
		NI i_434244;
		NI HEX3Atmp_434527;
		NI res_434530;
		i_434244 = 0;
		HEX3Atmp_434527 = 0;
		HEX3Atmp_434527 = (NI64)(l - 3);
		res_434530 = 0;
		{
			while (1) {
				tnode224816* LOC33;
				tnode224816* LOC34;
				if (!(res_434530 <= HEX3Atmp_434527)) goto LA32;
				i_434244 = res_434530;
				LOC33 = 0;
				LOC33 = HEX5BHEX5D_225698(body, i_434244);
				(*(*LOC33).kindU.S4.Sym).Kind = ((NU8) 9);
				LOC34 = 0;
				LOC34 = HEX5BHEX5D_225698(body, i_434244);
				addson_225287(vpart, LOC34);
				res_434530 += 1;
			} LA32: ;
		}
	}
	addson_225287(vpart, emptynode_225738);
	{
		tnode224816* LOC39;
		if (!!(env == 0)) goto LA37;
		LOC39 = 0;
		LOC39 = newsymnode_225132(env);
		asgnRefNoCycle((void**) (&(*call).kindU.S6.Sons->data[0]), makeclosure_428949((*(*call).kindU.S6.Sons->data[0]).kindU.S4.Sym, LOC39, (*body).Info));
	}
	LA37: ;
	addson_225287(vpart, call);
	addson_225287(v2, vpart);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.Sons->data[0]), v2);
	bs = newnodei_225138(((NU8) 157), (*body).Info);
	addson_225287(bs, (*call).kindU.S6.Sons->data[0]);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.Sons->data[1]), bs);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.Sons->data[2]), HEX5BHEX5D_225698(body, (NI64)(l - 1)));
	return result;
}
N_NIMCALL(void, TMP3177)(void* p, NI op) {
	tenv427020* a;
	a = (tenv427020*)p;
	nimGCvisit((void*)(*a).Attachednode, op);
	nimGCvisit((void*)(*a).Replacementnode, op);
	nimGCvisit((void*)(*a).Createdvar, op);
	nimGCvisit((void*)(*a).Capturedvars, op);
	nimGCvisit((void*)(*a).Up, op);
	nimGCvisit((void*)(*a).Next, op);
	nimGCvisit((void*)(*a).Upfield, op);
	nimGCvisit((void*)(*a).Obj, op);
	nimGCvisit((void*)(*a).Fn, op);
	nimGCvisit((void*)(*a).Vars.Head, op);
	nimGCvisit((void*)(*a).Vars.Data, op);
}
N_NIMCALL(void, TMP3178)(void* p, NI op) {
	toutercontext427022* a;
	a = (toutercontext427022*)p;
	nimGCvisit((void*)(*a).Fn, op);
	nimGCvisit((void*)(*a).Head, op);
	nimGCvisit((void*)(*a).Capturedvars.Head, op);
	nimGCvisit((void*)(*a).Capturedvars.Data, op);
	nimGCvisit((void*)(*a).Processed.Head, op);
	nimGCvisit((void*)(*a).Processed.Data, op);
	nimGCvisit((void*)(*a).Localstoaccess.Data, op);
	nimGCvisit((void*)(*a).Lambdastoenv.Data, op);
}

N_NIMCALL(toutercontext427022*, newoutercontext_427647)(tsym224846* fn) {
	toutercontext427022* result;
	result = 0;
	result = (toutercontext427022*) newObj((&NTI427014), sizeof(toutercontext427022));
	asgnRefNoCycle((void**) (&(*result).Fn), fn);
	initintset_221950((&(*result).Capturedvars));
	initintset_221950((&(*result).Processed));
	initidnodetable_225181((&(*result).Localstoaccess));
	initidtable_225167((&(*result).Lambdastoenv));
	return result;
}

N_NIMCALL(tnode224816*, closurecreationpoint_429358)(tnode224816* n) {
	tnode224816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC6;
		tnode224816* LOC8;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*n).Kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC6 = 0;
		LOC6 = len_225364(n);
		LOC4 = (1 <= LOC6);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA7;
		LOC8 = 0;
		LOC8 = HEX5BHEX5D_225698(n, 0);
		LOC3 = ((*LOC8).Kind == ((NU8) 1));
		LA7: ;
		if (!LOC3) goto LA9;
		result = n;
	}
	goto LA1;
	LA9: ;
	{
		result = newnodei_225138(((NU8) 115), (*n).Info);
		add_225498(result, emptynode_225738);
		add_225498(result, n);
	}
	LA1: ;
	return result;
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tcell44935* c;
	c = usrtocell_48646(p);
	{
		(*c).Refcount -= 8;
		if (!((NU64)((*c).Refcount) < (NU64)(8))) goto LA3;
		rtladdzct_50204(c);
	}
	LA3: ;
}

static N_INLINE(NIM_BOOL, canbecycleroot_48667)(tcell44935* c) {
	NIM_BOOL result;
	result = 0;
	result = !((((*(*c).Typ).flags &(1<<((((NU8) 1))&7)))!=0));
	return result;
}

static N_INLINE(void, rtladdcycleroot_49429)(tcell44935* c) {
	{
		if (!!((((NI) ((NI)((*c).Refcount & 3))) == 3))) goto LA3;
		(*c).Refcount = (NI)((NI)((*c).Refcount & -4) | 3);
		incl_45671((&gch_47044.Cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_51025)(tcell44935* c) {
	(*c).Refcount = (NI)((NU64)((*c).Refcount) + (NU64)(8));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_48667(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_49429(c);
	}
	LA4: ;
}

static N_INLINE(void, decref_50604)(tcell44935* c) {
	{
		(*c).Refcount -= 8;
		if (!((NU64)((*c).Refcount) < (NU64)(8))) goto LA3;
		rtladdzct_50204(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_48667(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_49429(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tcell44935* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_48646(src);
		incref_51025(LOC5);
	}
	LA3: ;
	{
		tcell44935* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_48646((*dest));
		decref_50604(LOC10);
	}
	LA8: ;
	(*dest) = src;
}

static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b) {
	NIM_BOOL result;
	NIM_BOOL LOC11;
	int LOC13;
	result = 0;
	{
		if (!(a == b)) goto LA3;
		result = NIM_TRUE;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = (a == NIM_NIL);
		if (LOC7) goto LA8;
		LOC7 = (b == NIM_NIL);
		LA8: ;
		if (!LOC7) goto LA9;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA9: ;
	LOC11 = 0;
	LOC11 = ((*a).Sup.len == (*b).Sup.len);
	if (!(LOC11)) goto LA12;
	LOC13 = 0;
	LOC13 = memcmp(((NCSTRING) ((*a).data)), ((NCSTRING) ((*b).data)), (NI64)((*a).Sup.len * 1));
	LOC11 = (LOC13 == ((NI32) 0));
	LA12: ;
	result = LOC11;
	goto BeforeRet;
	BeforeRet: ;
	return result;
}

N_NIMCALL(tsym224846*, getenvparam_427349)(tsym224846* routine) {
	tsym224846* result;
	tnode224816* params;
	tnode224816* hidden;
	result = 0;
	params = (*(*routine).Ast).kindU.S6.Sons->data[3];
	hidden = lastson_225261(params);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*hidden).Kind == ((NU8) 3));
		if (!(LOC3)) goto LA4;
		LOC3 = eqStrings((*(*(*hidden).kindU.S4.Sym).Name).S, ((NimStringDesc*) &TMP3179));
		LA4: ;
		if (!LOC3) goto LA5;
		result = (*hidden).kindU.S4.Sym;
	}
	LA5: ;
	return result;
}

N_NIMCALL(ttype224852*, getstatetype_427049)(tsym224846* iter) {
	ttype224852* result;
	tnode224816* n;
	tnode224816* LOC1;
	tnode224816* LOC2;
	ttype224852* inttype;
	result = 0;
	n = newnodei_225138(((NU8) 44), (*iter).Info);
	LOC1 = 0;
	LOC1 = newintnode_225096(((NU8) 6), IL64(-1));
	addson_225287(n, LOC1);
	LOC2 = 0;
	LOC2 = newintnode_225096(((NU8) 6), IL64(0));
	addson_225287(n, LOC2);
	result = newtype_225083(((NU8) 20), iter);
	asgnRefNoCycle((void**) (&(*result).N), n);
	inttype = nilorsysint_281070();
	{
		if (!inttype == 0) goto LA5;
		inttype = newtype_225083(((NU8) 31), iter);
	}
	LA5: ;
	rawaddson_229562(result, inttype);
	return result;
}

N_NIMCALL(tsym224846*, createstatefield_427072)(tsym224846* iter) {
	tsym224846* result;
	tident199021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_199472(((NimStringDesc*) &TMP3180));
	result = newsym_225074(((NU8) 19), LOC1, iter, (*iter).Info);
	asgnRefNoCycle((void**) (&(*result).Typ), getstatetype_427049(iter));
	return result;
}

N_NIMCALL(ttype224852*, createenvobj_427082)(tsym224846* owner) {
	ttype224852* result;
	tsym224846* LOC1;
	result = 0;
	result = createobj_423304(owner, (*owner).Info);
	LOC1 = 0;
	LOC1 = createstatefield_427072(owner);
	rawaddfield_423331(result, LOC1);
	return result;
}

N_NIMCALL(tenv427020*, newenv_427675)(toutercontext427022* o, tenv427020* up, tnode224816* n, tsym224846* owner) {
	tenv427020* result;
	result = 0;
	result = (tenv427020*) newObj((&NTI427018), sizeof(tenv427020));
	(*result).Sup.m_type = (&NTI427020);
	if ((*result).Capturedvars) nimGCunrefNoCycle((*result).Capturedvars);
	(*result).Capturedvars = (tsymseq224818*) newSeqRC1((&NTI224818), 0);
	asgnRef((void**) (&(*result).Up), up);
	asgnRefNoCycle((void**) (&(*result).Attachednode), n);
	asgnRefNoCycle((void**) (&(*result).Fn), owner);
	initintset_221950((&(*result).Vars));
	asgnRef((void**) (&(*result).Next), (*o).Head);
	asgnRef((void**) (&(*o).Head), result);
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		tsym224846* param;
		LOC3 = 0;
		LOC3 = !(((*owner).Kind == ((NU8) 6)));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = (up == NIM_NIL);
		if (LOC5) goto LA6;
		LOC5 = !(((*up).Fn == owner));
		LA6: ;
		LOC3 = LOC5;
		LA4: ;
		if (!LOC3) goto LA7;
		param = getenvparam_427349(owner);
		{
			if (!!((param == NIM_NIL))) goto LA11;
			asgnRefNoCycle((void**) (&(*result).Obj), (*(*param).Typ).Sons->data[0]);
		}
		LA11: ;
	}
	LA7: ;
	{
		if (!(*result).Obj == 0) goto LA15;
		asgnRefNoCycle((void**) (&(*result).Obj), createenvobj_427082(owner));
	}
	LA15: ;
	return result;
}

N_NIMCALL(void, addparamstoenv_429386)(tsym224846* fn, tenv427020* env) {
	tnode224816* params;
	tnode224816* ast;
	params = (*(*fn).Typ).N;
	{
		NI i_429412;
		NI HEX3Atmp_429521;
		NI LOC2;
		NI res_429524;
		i_429412 = 0;
		HEX3Atmp_429521 = 0;
		LOC2 = 0;
		LOC2 = len_225364(params);
		HEX3Atmp_429521 = (LOC2 - 1);
		res_429524 = 1;
		{
			while (1) {
				tsym224846* param;
				if (!(res_429524 <= HEX3Atmp_429521)) goto LA4;
				i_429412 = res_429524;
				{
					if (!!(((*(*params).kindU.S6.Sons->data[i_429412]).Kind == ((NU8) 3)))) goto LA7;
					internalerror_196987((*params).Info, ((NimStringDesc*) &TMP3181));
				}
				LA7: ;
				param = (*(*params).kindU.S6.Sons->data[i_429412]).kindU.S4.Sym;
				incl_221869((&(*env).Vars), (*param).Sup.Id);
				res_429524 += 1;
			} LA4: ;
		}
	}
	ast = (*fn).Ast;
	{
		NIM_BOOL LOC11;
		NI LOC12;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = sonslen_225249(ast);
		LOC11 = (7 < LOC12);
		if (!(LOC11)) goto LA13;
		LOC11 = ((*(*ast).kindU.S6.Sons->data[7]).Kind == ((NU8) 3));
		LA13: ;
		if (!LOC11) goto LA14;
		incl_221869((&(*env).Vars), (*(*(*ast).kindU.S6.Sons->data[7]).kindU.S4.Sym).Sup.Id);
	}
	LA14: ;
}

N_NIMCALL(NIM_BOOL, isinnerproc_427902)(tsym224846* s, tsym224846* outerproc) {
	NIM_BOOL result;
	result = 0;
	{
		tsym224846* owner;
		if (!((110592 &(1<<(((*s).Kind)&31)))!=0)) goto LA3;
		owner = skipgenericowner_231699(s);
		{
			while (1) {
				{
					if (!owner == 0) goto LA9;
					result = NIM_FALSE;
					goto BeforeRet;
				}
				LA9: ;
				{
					if (!(owner == outerproc)) goto LA13;
					result = NIM_TRUE;
					goto BeforeRet;
				}
				LA13: ;
				owner = (*owner).Owner;
			}
		}
	}
	LA3: ;
	BeforeRet: ;
	return result;
}

static N_INLINE(NIM_BOOL, illegalcapture_428006)(tsym224846* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	ttype224852* LOC2;
	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = skiptypes_229245((*s).Typ, IL64(211106232576256));
	LOC1 = ((IL64(281475119316992) &(IL64(1)<<(((*LOC2).Kind)&IL64(63))))!=0);
	if (LOC1) goto LA3;
	LOC1 = ((*s).Kind == ((NU8) 11));
	LA3: ;
	result = LOC1;
	return result;
}

N_NIMCALL(tsym224846*, createupfield_428421)(ttype224852* obj, ttype224852* fieldtype) {
	tsym224846* result;
	NI pos;
	tident199021* LOC1;
	result = 0;
	pos = len_225364((*obj).N);
	LOC1 = 0;
	LOC1 = getident_199472(((NimStringDesc*) &TMP3182));
	result = newsym_225074(((NU8) 19), LOC1, (*obj).Owner, (*(*obj).Owner).Info);
	asgnRefNoCycle((void**) (&(*result).Typ), newtype_225083(((NU8) 22), (*obj).Owner));
	(*result).Position = pos;
	rawaddson_229562((*result).Typ, fieldtype);
	addfield_423608(obj, result);
	return result;
}

N_NIMCALL(void, addhiddenparam_427147)(tsym224846* routine, tsym224846* param) {
	tnode224816* params;
	NI LOC1;
	tnode224816* LOC2;
	params = (*(*routine).Ast).kindU.S6.Sons->data[3];
	LOC1 = 0;
	LOC1 = len_225364(params);
	(*param).Position = (NI64)(LOC1 - 1);
	LOC2 = 0;
	LOC2 = newsymnode_225132(param);
	addson_225287(params, LOC2);
	(*(*routine).Typ).Flags |= ((NI32)1)<<((((NU8) 11))%(sizeof(NI32)*8));
}

N_NIMCALL(void, addclosureparam_427962)(tsym224846* fn, tenv427020* e) {
	tsym224846* cp;
	cp = getenvparam_427349(fn);
	{
		tident199021* LOC5;
		if (!(cp == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = getident_199472(((NimStringDesc*) &TMP3179));
		cp = newsym_225074(((NU8) 3), LOC5, fn, (*fn).Info);
		(*cp).Flags |= ((NI32)1)<<((((NU8) 2))%(sizeof(NI32)*8));
		asgnRefNoCycle((void**) (&(*cp).Typ), newtype_225083(((NU8) 22), fn));
		rawaddson_229562((*cp).Typ, (*e).Obj);
		addhiddenparam_427147(fn, cp);
	}
	LA3: ;
}

N_NIMCALL(void, addcapturedvar_427818)(tenv427020* e, tsym224846* v) {
	{
		tsym224846* x_427834;
		tsymseq224818* HEX3Atmp_427870;
		NI i_427873;
		NI l_427875;
		x_427834 = 0;
		HEX3Atmp_427870 = 0;
		HEX3Atmp_427870 = (*e).Capturedvars;
		i_427873 = 0;
		l_427875 = HEX3Atmp_427870->Sup.len;
		{
			while (1) {
				if (!(i_427873 < l_427875)) goto LA3;
				x_427834 = HEX3Atmp_427870->data[i_427873];
				{
					if (!(x_427834 == v)) goto LA6;
					goto BeforeRet;
				}
				LA6: ;
				i_427873 += 1;
			} LA3: ;
		}
	}
	(*e).Capturedvars = (tsymseq224818*) incrSeq(&((*e).Capturedvars)->Sup, sizeof(tsym224846*));
	asgnRefNoCycle((void**) (&(*e).Capturedvars->data[(*e).Capturedvars->Sup.len-1]), v);
	addfield_423608((*e).Obj, v);
	BeforeRet: ;
}

N_NIMCALL(NIM_BOOL, capturevar_428433)(toutercontext427022* o, tenv427020* top, tsym224846* local, tlineinfo194539 info) {
	NIM_BOOL result;
	tenv427020* it;
	result = 0;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				LOC5 = 0;
				LOC5 = contains_221837((&(*it).Vars), (*local).Sup.Id);
				if (!LOC5) goto LA6;
				goto LA1;
			}
			LA6: ;
			it = (*it).Up;
		} LA2: ;
	} LA1: ;
	{
		if (!(it == NIM_NIL)) goto LA10;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA10: ;
	{
		NIM_BOOL LOC14;
		LOC14 = 0;
		LOC14 = illegalcapture_428006(local);
		if (LOC14) goto LA15;
		LOC14 = !(((257 &(1<<(((*(*(*top).Fn).Typ).Callconv)&15)))!=0));
		LA15: ;
		if (!LOC14) goto LA16;
		localerror_196955(info, ((NU16) 222), (*(*local).Name).S);
	}
	LA16: ;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA19;
			{
				NIM_BOOL LOC22;
				LOC22 = 0;
				LOC22 = contains_221837((&(*it).Vars), (*local).Sup.Id);
				if (!LOC22) goto LA23;
				goto LA18;
			}
			LA23: ;
			{
				NIM_BOOL LOC27;
				NIM_BOOL LOC28;
				LOC27 = 0;
				LOC28 = 0;
				LOC28 = ((*it).Upfield == NIM_NIL);
				if (!(LOC28)) goto LA29;
				LOC28 = !(((*it).Up == NIM_NIL));
				LA29: ;
				LOC27 = LOC28;
				if (!(LOC27)) goto LA30;
				LOC27 = !(((*it).Fn == (*top).Fn));
				LA30: ;
				if (!LOC27) goto LA31;
				asgnRefNoCycle((void**) (&(*it).Upfield), createupfield_428421((*it).Obj, (*(*it).Up).Obj));
			}
			LA31: ;
			{
				tenv427020* u;
				if (!!(((*it).Fn == (*local).Owner))) goto LA35;
				(*(*(*it).Fn).Typ).Callconv = ((NU8) 8);
				(*(*(*it).Fn).Typ).Flags |= ((NI32)1)<<((((NU8) 11))%(sizeof(NI32)*8));
				u = (*it).Up;
				{
					while (1) {
						NIM_BOOL LOC39;
						LOC39 = 0;
						LOC39 = !((u == NIM_NIL));
						if (!(LOC39)) goto LA40;
						LOC39 = ((*u).Fn == (*it).Fn);
						LA40: ;
						if (!LOC39) goto LA38;
						u = (*u).Up;
					} LA38: ;
				}
				addclosureparam_427962((*it).Fn, u);
				{
					tidobj199015* LOC43;
					TNimObject* LOC44;
					LOC43 = 0;
					LOC43 = &(*it).Fn->Sup;
					LOC44 = 0;
					LOC44 = idtableget_234182((*o).Lambdastoenv, LOC43);
					if (!(LOC44 == NIM_NIL)) goto LA45;
					{
						tidobj199015* LOC51;
						TNimObject* LOC52;
						if (!!((u == NIM_NIL))) goto LA49;
						LOC51 = 0;
						LOC51 = &(*it).Fn->Sup;
						LOC52 = 0;
						LOC52 = &u->Sup;
						idtableput_234196((&(*o).Lambdastoenv), LOC51, LOC52);
					}
					LA49: ;
				}
				LA45: ;
			}
			LA35: ;
			it = (*it).Up;
		} LA19: ;
	} LA18: ;
	incl_221869((&(*o).Capturedvars), (*local).Sup.Id);
	addcapturedvar_427818(it, local);
	result = NIM_TRUE;
	BeforeRet: ;
	return result;
}

N_NIMCALL(NI, gathervars_428721)(toutercontext427022* o, tenv427020* e, tnode224816* n) {
	NI result;
	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = 0;
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).Kind) {
	case ((NU8) 3):
	{
		tsym224846* s;
		s = (*n).kindU.S4.Sym;
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = interestingvar_428039(s);
			if (!(LOC8)) goto LA9;
			LOC8 = !(((*e).Fn == (*s).Owner));
			LA9: ;
			if (!LOC8) goto LA10;
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = capturevar_428433(o, e, s, (*n).Info);
				if (!LOC14) goto LA15;
				result = 1;
			}
			LA15: ;
		}
		LA10: ;
	}
	break;
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	case ((NU8) 154):
	case ((NU8) 79):
	case ((NU8) 80):
	case ((NU8) 81):
	case ((NU8) 82):
	case ((NU8) 83):
	case ((NU8) 98):
	{
	}
	break;
	default:
	{
		{
			NI k_428813;
			NI HEX3Atmp_428841;
			NI LOC20;
			NI res_428844;
			k_428813 = 0;
			HEX3Atmp_428841 = 0;
			LOC20 = 0;
			LOC20 = sonslen_225249(n);
			HEX3Atmp_428841 = (NI64)(LOC20 - 1);
			res_428844 = 0;
			{
				while (1) {
					NI LOC23;
					if (!(res_428844 <= HEX3Atmp_428841)) goto LA22;
					k_428813 = res_428844;
					LOC23 = 0;
					LOC23 = gathervars_428721(o, e, (*n).kindU.S6.Sons->data[k_428813]);
					result += LOC23;
					res_428844 += 1;
				} LA22: ;
			}
		}
	}
	break;
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(tsym224846*, newiterresult_427092)(tsym224846* iter) {
	tsym224846* result;
	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_225364((*iter).Ast);
		if (!(7 < LOC3)) goto LA4;
		result = (*(*(*iter).Ast).kindU.S6.Sons->data[7]).kindU.S4.Sym;
	}
	goto LA1;
	LA4: ;
	{
		tident199021* LOC7;
		tnode224816* LOC8;
		LOC7 = 0;
		LOC7 = getident_199472(((NimStringDesc*) &TMP3185));
		result = newsym_225074(((NU8) 11), LOC7, iter, (*iter).Info);
		asgnRefNoCycle((void**) (&(*result).Typ), (*(*iter).Typ).Sons->data[0]);
		(*result).Flags |= ((NI32)1)<<((((NU8) 0))%(sizeof(NI32)*8));
		LOC8 = 0;
		LOC8 = newsymnode_225132(result);
		add_225498((*iter).Ast, LOC8);
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, inititer_427412)(tsym224846* iter, titer427016* Result) {
	unsureAsgnRef((void**) (&(*Result).Fn), iter);
	{
		tsym224846* cp;
		tnode224816* LOC17;
		if (!((*iter).Kind == ((NU8) 15))) goto LA3;
		cp = getenvparam_427349(iter);
		{
			tident199021* LOC9;
			if (!(cp == NIM_NIL)) goto LA7;
			unsureAsgnRef((void**) (&(*Result).Obj), createenvobj_427082(iter));
			LOC9 = 0;
			LOC9 = getident_199472(((NimStringDesc*) &TMP3179));
			cp = newsym_225074(((NU8) 3), LOC9, iter, (*iter).Info);
			(*cp).Flags |= ((NI32)1)<<((((NU8) 2))%(sizeof(NI32)*8));
			asgnRefNoCycle((void**) (&(*cp).Typ), newtype_225083(((NU8) 22), iter));
			rawaddson_229562((*cp).Typ, (*Result).Obj);
			addhiddenparam_427147(iter, cp);
		}
		goto LA5;
		LA7: ;
		{
			unsureAsgnRef((void**) (&(*Result).Obj), (*(*cp).Typ).Sons->data[0]);
		}
		LA5: ;
		{
			NI LOC13;
			NimStringDesc* LOC16;
			LOC13 = 0;
			LOC13 = len_225364((*(*Result).Obj).N);
			if (!!((0 < LOC13))) goto LA14;
			LOC16 = 0;
			LOC16 = HEX24_197126(TMP3184);
			internalerror_197006(LOC16);
		}
		LA14: ;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_225698((*(*Result).Obj).N, 0);
		unsureAsgnRef((void**) (&(*Result).State), (*LOC17).kindU.S4.Sym);
		unsureAsgnRef((void**) (&(*Result).Closureparam), cp);
		{
			if (!!(((*(*iter).Typ).Sons->data[0] == NIM_NIL))) goto LA20;
			unsureAsgnRef((void**) (&(*Result).Resultsym), newiterresult_427092(iter));
		}
		LA20: ;
	}
	LA3: ;
}

N_NIMCALL(tnode224816*, newclosurecreationvar_428978)(tenv427020* e) {
	tnode224816* result;
	tsym224846* v;
	tident199021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_199472(((NimStringDesc*) &TMP3183));
	v = newsym_225074(((NU8) 8), LOC1, (*e).Fn, (*(*e).Attachednode).Info);
	(*v).Flags |= ((NI32)1)<<((((NU8) 21))%(sizeof(NI32)*8));
	asgnRefNoCycle((void**) (&(*v).Typ), newtype_225083(((NU8) 22), (*e).Fn));
	rawaddson_229562((*v).Typ, (*e).Obj);
	{
		titer427016 it;
		tnode224816* LOC6;
		if (!((*(*e).Fn).Kind == ((NU8) 15))) goto LA4;
		memset((void*)(&it), 0, sizeof(it));
		chckNil((void*)(&it));
		memset((void*)(&it), 0, sizeof(it));
		inititer_427412((*e).Fn, (&it));
		adduniquefield_423807(it.Obj, v);
		LOC6 = 0;
		LOC6 = newsymnode_225132(it.Closureparam);
		result = indirectaccess_424848(LOC6, v, (*v).Info);
	}
	goto LA2;
	LA4: ;
	{
		result = newsymnode_225132(v);
	}
	LA2: ;
	return result;
}

N_NIMCALL(tnode224816*, getclosurevar_429015)(tenv427020* e) {
	tnode224816* result;
	result = 0;
	{
		if (!((*e).Createdvar == NIM_NIL)) goto LA3;
		result = newclosurecreationvar_428978(e);
		asgnRefNoCycle((void**) (&(*e).Createdvar), result);
	}
	goto LA1;
	LA3: ;
	{
		result = (*e).Createdvar;
	}
	LA1: ;
	return result;
}

N_NIMCALL(tenv427020*, findenv_429042)(toutercontext427022* o, tsym224846* s) {
	tenv427020* result;
	tenv427020* env;
	result = 0;
	env = (*o).Head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				if (!((*env).Fn == s)) goto LA5;
				goto LA1;
			}
			LA5: ;
			env = (*env).Next;
		} LA2: ;
	} LA1: ;
	{
		NIM_BOOL LOC9;
		NimStringDesc* LOC13;
		LOC9 = 0;
		LOC9 = !((env == NIM_NIL));
		if (!(LOC9)) goto LA10;
		LOC9 = !(((*env).Up == NIM_NIL));
		LA10: ;
		if (!!(LOC9)) goto LA11;
		LOC13 = 0;
		LOC13 = HEX24_197126(TMP3191);
		internalerror_197006(LOC13);
	}
	LA11: ;
	result = (*env).Up;
	{
		while (1) {
			if (!((*result).Fn == s)) goto LA15;
			result = (*result).Up;
		} LA15: ;
	}
	return result;
}

N_NIMCALL(tnode224816*, nestedaccess_428076)(tenv427020* top, tsym224846* local) {
	tnode224816* result;
	tenv427020* it;
	tsym224846* envparam;
	tnode224816* access;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_428039(local);
		LOC3 = !(LOC4);
		if (LOC3) goto LA5;
		LOC3 = ((*top).Fn == (*local).Owner);
		LA5: ;
		if (!LOC3) goto LA6;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA6: ;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA9;
			{
				NIM_BOOL LOC12;
				LOC12 = 0;
				LOC12 = contains_221837((&(*it).Vars), (*local).Sup.Id);
				if (!LOC12) goto LA13;
				goto LA8;
			}
			LA13: ;
			it = (*it).Up;
		} LA9: ;
	} LA8: ;
	{
		if (!(it == NIM_NIL)) goto LA17;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA17: ;
	envparam = getenvparam_427349((*top).Fn);
	{
		NimStringDesc* LOC23;
		if (!!(!(envparam == 0))) goto LA21;
		LOC23 = 0;
		LOC23 = HEX24_197126(TMP3192);
		internalerror_197006(LOC23);
	}
	LA21: ;
	access = newsymnode_225132(envparam);
	it = (*top).Up;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA25;
			{
				NIM_BOOL LOC28;
				LOC28 = 0;
				LOC28 = contains_221837((&(*it).Vars), (*local).Sup.Id);
				if (!LOC28) goto LA29;
				access = indirectaccess_424848(access, local, (*local).Info);
				result = access;
				goto BeforeRet;
			}
			LA29: ;
			{
				NimStringDesc* LOC35;
				if (!!(!(((*it).Upfield == NIM_NIL)))) goto LA33;
				LOC35 = 0;
				LOC35 = HEX24_197126(TMP3193);
				internalerror_197006(LOC35);
			}
			LA33: ;
			access = indirectaccess_424848(access, (*it).Upfield, (*local).Info);
			it = (*it).Up;
		} LA25: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode224816*, transforminnerproc_429192)(toutercontext427022* o, tenv427020* e, tnode224816* n) {
	tnode224816* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		tsym224846* s;
		s = (*n).kindU.S4.Sym;
		{
			tsym224846* LOC7;
			tnode224816* LOC8;
			if (!(s == (*e).Fn)) goto LA5;
			LOC7 = 0;
			LOC7 = getenvparam_427349(s);
			LOC8 = 0;
			LOC8 = newsymnode_225132(LOC7);
			result = makeclosure_428949(s, LOC8, (*n).Info);
		}
		goto LA3;
		LA5: ;
		{
			NIM_BOOL LOC10;
			tenv427020* LOC14;
			tnode224816* LOC15;
			LOC10 = 0;
			LOC10 = isinnerproc_427902(s, (*o).Fn);
			if (!(LOC10)) goto LA11;
			LOC10 = ((*(*s).Typ).Callconv == ((NU8) 8));
			LA11: ;
			if (!LOC10) goto LA12;
			LOC14 = 0;
			LOC14 = findenv_429042(o, s);
			LOC15 = 0;
			LOC15 = getclosurevar_429015(LOC14);
			result = makeclosure_428949(s, LOC15, (*n).Info);
		}
		goto LA3;
		LA12: ;
		{
			result = nestedaccess_428076(e, (*n).kindU.S4.Sym);
		}
		LA3: ;
	}
	break;
	case ((NU8) 79):
	case ((NU8) 80):
	case ((NU8) 81):
	case ((NU8) 82):
	case ((NU8) 83):
	case ((NU8) 51):
	case ((NU8) 84):
	case ((NU8) 154):
	case ((NU8) 52):
	{
	}
	break;
	default:
	{
		{
			NI j_429290;
			NI HEX3Atmp_429338;
			NI LOC20;
			NI res_429341;
			j_429290 = 0;
			HEX3Atmp_429338 = 0;
			LOC20 = 0;
			LOC20 = sonslen_225249(n);
			HEX3Atmp_429338 = (NI64)(LOC20 - 1);
			res_429341 = 0;
			{
				while (1) {
					tnode224816* x;
					if (!(res_429341 <= HEX3Atmp_429338)) goto LA22;
					j_429290 = res_429341;
					x = transforminnerproc_429192(o, e, (*n).kindU.S6.Sons->data[j_429290]);
					{
						if (!!((x == NIM_NIL))) goto LA25;
						asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[j_429290]), x);
					}
					LA25: ;
					res_429341 += 1;
				} LA22: ;
			}
		}
	}
	break;
	}
	return result;
}

N_NIMCALL(void, searchforinnerprocs_429541)(toutercontext427022* o, tnode224816* n, tenv427020* env) {
	{
		if (!(n == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).Kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		tsym224846* fn;
		fn = (*n).kindU.S4.Sym;
		{
			NIM_BOOL LOC9;
			NIM_BOOL LOC11;
			tnode224816* body;
			tnode224816* ex;
			tenv427020* envb;
			NI capturedcounter;
			LOC9 = 0;
			LOC9 = isinnerproc_427902(fn, (*o).Fn);
			if (!(LOC9)) goto LA10;
			LOC11 = 0;
			LOC11 = containsorincl_221916((&(*o).Processed), (*fn).Sup.Id);
			LOC9 = !(LOC11);
			LA10: ;
			if (!LOC9) goto LA12;
			body = getbody_278269(fn);
			ex = closurecreationpoint_429358(body);
			envb = newenv_427675(o, env, ex, fn);
			addparamstoenv_429386(fn, envb);
			searchforinnerprocs_429541(o, body, envb);
			asgnRefNoCycle((void**) (&(*(*fn).Ast).kindU.S6.Sons->data[6]), ex);
			capturedcounter = gathervars_428721(o, envb, body);
			{
				NIM_BOOL LOC16;
				LOC16 = 0;
				LOC16 = (capturedcounter == 0);
				if (!(LOC16)) goto LA17;
				LOC16 = ((*(*fn).Typ).Callconv == ((NU8) 8));
				LA17: ;
				if (!LOC16) goto LA18;
				{
					tidobj199015* LOC22;
					TNimObject* LOC23;
					tidobj199015* LOC26;
					TNimObject* LOC27;
					LOC22 = 0;
					LOC22 = &fn->Sup;
					LOC23 = 0;
					LOC23 = idtableget_234182((*o).Lambdastoenv, LOC22);
					if (!(LOC23 == NIM_NIL)) goto LA24;
					LOC26 = 0;
					LOC26 = &fn->Sup;
					LOC27 = 0;
					LOC27 = &env->Sup;
					idtableput_234196((&(*o).Lambdastoenv), LOC26, LOC27);
				}
				LA24: ;
				addclosureparam_427962(fn, env);
			}
			goto LA14;
			LA18: ;
			{
				tsym224846* LOC29;
				tnode224816* ti;
				LOC29 = 0;
				LOC29 = getenvparam_427349(fn);
				if (!!((LOC29 == NIM_NIL))) goto LA30;
				ti = transforminnerproc_429192(o, envb, body);
				{
					if (!!((ti == NIM_NIL))) goto LA34;
					asgnRefNoCycle((void**) (&(*(*fn).Ast).kindU.S6.Sons->data[6]), ti);
				}
				LA34: ;
			}
			goto LA14;
			LA30: ;
			LA14: ;
		}
		LA12: ;
	}
	break;
	case ((NU8) 51):
	case ((NU8) 84):
	case ((NU8) 52):
	{
		{
			if (!!(((*n).Typ == NIM_NIL))) goto LA39;
			searchforinnerprocs_429541(o, (*n).kindU.S6.Sons->data[0], env);
		}
		LA39: ;
	}
	break;
	case ((NU8) 96):
	case ((NU8) 94):
	case ((NU8) 95):
	case ((NU8) 112):
	{
		{
			NI body;
			NI LOC46;
			tnode224816* ex;
			tenv427020* LOC50;
			if (!!(((*(*env).Fn).Kind == ((NU8) 15)))) goto LA44;
			LOC46 = 0;
			LOC46 = len_225364(n);
			body = (NI64)(LOC46 - 1);
			{
				NI i_429752;
				NI HEX3Atmp_430081;
				NI res_430084;
				i_429752 = 0;
				HEX3Atmp_430081 = 0;
				HEX3Atmp_430081 = (NI64)(body - 1);
				res_430084 = 0;
				{
					while (1) {
						if (!(res_430084 <= HEX3Atmp_430081)) goto LA49;
						i_429752 = res_430084;
						searchforinnerprocs_429541(o, (*n).kindU.S6.Sons->data[i_429752], env);
						res_430084 += 1;
					} LA49: ;
				}
			}
			ex = closurecreationpoint_429358((*n).kindU.S6.Sons->data[body]);
			LOC50 = 0;
			LOC50 = newenv_427675(o, env, ex, (*env).Fn);
			searchforinnerprocs_429541(o, (*n).kindU.S6.Sons->data[body], LOC50);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[body]), ex);
		}
		goto LA42;
		LA44: ;
		{
			{
				NI i_429822;
				NI HEX3Atmp_430087;
				NI LOC53;
				NI res_430090;
				i_429822 = 0;
				HEX3Atmp_430087 = 0;
				LOC53 = 0;
				LOC53 = sonslen_225249(n);
				HEX3Atmp_430087 = (NI64)(LOC53 - 1);
				res_430090 = 0;
				{
					while (1) {
						if (!(res_430090 <= HEX3Atmp_430087)) goto LA55;
						i_429822 = res_430090;
						searchforinnerprocs_429541(o, (*n).kindU.S6.Sons->data[i_429822], env);
						res_430090 += 1;
					} LA55: ;
				}
			}
		}
		LA42: ;
	}
	break;
	case ((NU8) 99):
	case ((NU8) 100):
	{
		{
			NI i_429849;
			NI HEX3Atmp_430099;
			NI LOC58;
			NI res_430102;
			i_429849 = 0;
			HEX3Atmp_430099 = 0;
			LOC58 = 0;
			LOC58 = sonslen_225249(n);
			HEX3Atmp_430099 = (NI64)(LOC58 - 1);
			res_430102 = 0;
			{
				while (1) {
					tnode224816* it;
					if (!(res_430102 <= HEX3Atmp_430099)) goto LA60;
					i_429849 = res_430102;
					it = (*n).kindU.S6.Sons->data[i_429849];
					{
						if (!((*it).Kind == ((NU8) 125))) goto LA63;
					}
					goto LA61;
					LA63: ;
					{
						NI l;
						if (!((*it).Kind == ((NU8) 35))) goto LA66;
						l = sonslen_225249(it);
						{
							if (!((*(*it).kindU.S6.Sons->data[0]).Kind == ((NU8) 3))) goto LA70;
							incl_221869((&(*env).Vars), (*(*(*it).kindU.S6.Sons->data[0]).kindU.S4.Sym).Sup.Id);
						}
						LA70: ;
						searchforinnerprocs_429541(o, (*it).kindU.S6.Sons->data[(NI64)(l - 1)], env);
					}
					goto LA61;
					LA66: ;
					{
						NI l;
						if (!((*it).Kind == ((NU8) 36))) goto LA73;
						l = sonslen_225249(it);
						{
							NI j_429972;
							NI HEX3Atmp_430094;
							NI res_430097;
							j_429972 = 0;
							HEX3Atmp_430094 = 0;
							HEX3Atmp_430094 = (NI64)(l - 3);
							res_430097 = 0;
							{
								while (1) {
									if (!(res_430097 <= HEX3Atmp_430094)) goto LA77;
									j_429972 = res_430097;
									{
										if (!((*(*it).kindU.S6.Sons->data[j_429972]).Kind == ((NU8) 3))) goto LA80;
										incl_221869((&(*env).Vars), (*(*(*it).kindU.S6.Sons->data[j_429972]).kindU.S4.Sym).Sup.Id);
									}
									LA80: ;
									res_430097 += 1;
								} LA77: ;
							}
						}
						searchforinnerprocs_429541(o, (*it).kindU.S6.Sons->data[(NI64)(l - 1)], env);
					}
					goto LA61;
					LA73: ;
					{
						internalerror_196987((*it).Info, ((NimStringDesc*) &TMP3194));
					}
					LA61: ;
					res_430102 += 1;
				} LA60: ;
			}
		}
	}
	break;
	case ((NU8) 154):
	{
		searchforinnerprocs_429541(o, (*n).kindU.S6.Sons->data[0], env);
	}
	break;
	case ((NU8) 79):
	case ((NU8) 80):
	case ((NU8) 81):
	case ((NU8) 82):
	case ((NU8) 83):
	case ((NU8) 98):
	{
	}
	break;
	default:
	{
		{
			NI i_430065;
			NI HEX3Atmp_430105;
			NI LOC87;
			NI res_430108;
			i_430065 = 0;
			HEX3Atmp_430105 = 0;
			LOC87 = 0;
			LOC87 = sonslen_225249(n);
			HEX3Atmp_430105 = (NI64)(LOC87 - 1);
			res_430108 = 0;
			{
				while (1) {
					if (!(res_430108 <= HEX3Atmp_430105)) goto LA89;
					i_430065 = res_430108;
					searchforinnerprocs_429541(o, (*n).kindU.S6.Sons->data[i_430065], env);
					res_430108 += 1;
				} LA89: ;
			}
		}
	}
	break;
	}
	BeforeRet: ;
}

N_NIMCALL(tnode224816*, newasgnstmt_430161)(tnode224816* le, tnode224816* ri, tlineinfo194539 info) {
	tnode224816* result;
	result = 0;
	result = newnodei_227007(((NU8) 73), info, 2);
	asgnRefNoCycle((void**) (&(*result).kindU.S6.Sons->data[0]), le);
	asgnRefNoCycle((void**) (&(*result).kindU.S6.Sons->data[1]), ri);
	return result;
}

N_NIMCALL(tnode224816*, rawclosurecreation_430201)(toutercontext427022* o, tenv427020* scope, tnode224816* env) {
	tnode224816* result;
	tsym224846* LOC5;
	tnode224816* LOC6;
	result = 0;
	result = newnodei_225138(((NU8) 115), (*env).Info);
	{
		tnode224816* v;
		if (!((*env).Kind == ((NU8) 3))) goto LA3;
		v = newnodei_225138(((NU8) 99), (*env).Info);
		addvar_423053(v, env);
		add_225498(result, v);
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = getsyssym_281054(((NimStringDesc*) &TMP3140));
	LOC6 = 0;
	LOC6 = newcall_427891(LOC5, env);
	add_225498(result, LOC6);
	{
		tsym224846* local_430229;
		tsymseq224818* HEX3Atmp_430287;
		NI i_430290;
		NI l_430292;
		local_430229 = 0;
		HEX3Atmp_430287 = 0;
		HEX3Atmp_430287 = (*scope).Capturedvars;
		i_430290 = 0;
		l_430292 = HEX3Atmp_430287->Sup.len;
		{
			while (1) {
				tnode224816* fieldaccess;
				tnode224816* existing;
				tidobj199015* LOC16;
				if (!(i_430290 < l_430292)) goto LA9;
				local_430229 = HEX3Atmp_430287->data[i_430290];
				fieldaccess = indirectaccess_424848(env, local_430229, (*env).Info);
				{
					tnode224816* LOC14;
					tnode224816* LOC15;
					if (!((*local_430229).Kind == ((NU8) 3))) goto LA12;
					LOC14 = 0;
					LOC14 = newsymnode_225132(local_430229);
					LOC15 = 0;
					LOC15 = newasgnstmt_430161(fieldaccess, LOC14, (*env).Info);
					add_225498(result, LOC15);
				}
				LA12: ;
				LOC16 = 0;
				LOC16 = &local_430229->Sup;
				existing = idnodetableget_234212((*o).Localstoaccess, LOC16);
				{
					tidobj199015* LOC21;
					if (!existing == 0) goto LA19;
					LOC21 = 0;
					LOC21 = &local_430229->Sup;
					idnodetableput_234219((&(*o).Localstoaccess), LOC21, fieldaccess);
				}
				goto LA17;
				LA19: ;
				{
					tnode224816* LOC23;
					LOC23 = 0;
					LOC23 = newasgnstmt_430161(fieldaccess, existing, (*env).Info);
					add_225498(result, LOC23);
				}
				LA17: ;
				i_430290 += 1;
			} LA9: ;
		}
	}
	{
		if (!!(((*scope).Upfield == NIM_NIL))) goto LA26;
		{
			tnode224816* LOC32;
			tsym224846* LOC33;
			tnode224816* LOC34;
			tnode224816* LOC35;
			if (!!(((*(*scope).Up).Fn == (*scope).Fn))) goto LA30;
			LOC32 = 0;
			LOC32 = indirectaccess_424848(env, (*scope).Upfield, (*env).Info);
			LOC33 = 0;
			LOC33 = getenvparam_427349((*scope).Fn);
			LOC34 = 0;
			LOC34 = newsymnode_225132(LOC33);
			LOC35 = 0;
			LOC35 = newasgnstmt_430161(LOC32, LOC34, (*env).Info);
			add_225498(result, LOC35);
		}
		goto LA28;
		LA30: ;
		{
			tnode224816* LOC37;
			tnode224816* LOC38;
			tnode224816* LOC39;
			LOC37 = 0;
			LOC37 = indirectaccess_424848(env, (*scope).Upfield, (*env).Info);
			LOC38 = 0;
			LOC38 = getclosurevar_429015((*scope).Up);
			LOC39 = 0;
			LOC39 = newasgnstmt_430161(LOC37, LOC38, (*env).Info);
			add_225498(result, LOC39);
		}
		LA28: ;
	}
	LA26: ;
	return result;
}

N_NIMCALL(tnode224816*, generateclosurecreation_430308)(toutercontext427022* o, tenv427020* scope) {
	tnode224816* result;
	tnode224816* env;
	result = 0;
	env = getclosurevar_429015(scope);
	result = rawclosurecreation_430201(o, scope, env);
	return result;
}

N_NIMCALL(void, createenvironments_431610)(toutercontext427022* o) {
	tenv427020* env;
	env = (*o).Head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				tnode224816* scope;
				LOC5 = 0;
				LOC5 = (0 < (*env).Capturedvars->Sup.len);
				if (LOC5) goto LA6;
				LOC5 = !(((*env).Upfield == NIM_NIL));
				LA6: ;
				if (!LOC5) goto LA7;
				scope = (*env).Attachednode;
				{
					if (!((*(*scope).kindU.S6.Sons->data[0]).Kind == ((NU8) 1))) goto LA11;
					asgnRefNoCycle((void**) (&(*env).Replacementnode), generateclosurecreation_430308(o, env));
				}
				LA11: ;
			}
			LA7: ;
			env = (*env).Next;
		} LA2: ;
	}
}

static N_INLINE(NIM_BOOL, interestingitervar_430446)(tsym224846* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = ((2097952 &(1<<(((*s).Kind)&31)))!=0);
	if (!(LOC1)) goto LA2;
	LOC1 = !((((*s).Flags &(1<<((((NU8) 3))&31)))!=0));
	LA2: ;
	result = LOC1;
	return result;
}

N_NIMCALL(tnode224816*, liftitersym_431255)(tnode224816* n) {
	tnode224816* result;
	tsym224846* iter;
	tsym224846* env;
	tsym224846* LOC1;
	tnode224816* v;
	tnode224816* LOC2;
	tnode224816* envasnode;
	tsym224846* LOC3;
	tnode224816* LOC4;
	tnode224816* LOC5;
	result = 0;
	iter = (*n).kindU.S4.Sym;
	result = newnodeit_225145(((NU8) 126), (*n).Info, (*n).Typ);
	LOC1 = 0;
	LOC1 = gethiddenparam_427238(iter);
	env = copysym_225203(LOC1, NIM_FALSE);
	(*env).Kind = ((NU8) 9);
	v = newnodei_225138(((NU8) 99), (*n).Info);
	LOC2 = 0;
	LOC2 = newsymnode_225132(env);
	addvar_423053(v, LOC2);
	add_225498(result, v);
	envasnode = newsymnode_225132(env);
	LOC3 = 0;
	LOC3 = getsyssym_281054(((NimStringDesc*) &TMP3140));
	LOC4 = 0;
	LOC4 = newcall_427891(LOC3, envasnode);
	add_225498(result, LOC4);
	LOC5 = 0;
	LOC5 = makeclosure_428949(iter, envasnode, (*n).Info);
	add_225498(result, LOC5);
	return result;
}

N_NIMCALL(tnode224816*, generateiterclosurecreation_430320)(toutercontext427022* o, tenv427020* env, tnode224816* scope) {
	tnode224816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		tnode224816* cc;
		tnode224816* insertpoint;
		LOC3 = 0;
		LOC3 = (*env).Createdvarcomesfromiter;
		if (LOC3) goto LA4;
		LOC3 = (*env).Createdvar == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = newclosurecreationvar_428978(env);
		cc = rawclosurecreation_430201(o, env, result);
		insertpoint = (*scope).kindU.S6.Sons->data[0];
		{
			if (!((*insertpoint).Kind == ((NU8) 1))) goto LA9;
			asgnRefNoCycle((void**) (&(*scope).kindU.S6.Sons->data[0]), cc);
		}
		goto LA7;
		LA9: ;
		{
			{
				tnode224816* x_430401;
				x_430401 = 0;
				{
					NI i_430423;
					NI HEX3Atmp_430425;
					NI LOC14;
					NI res_430427;
					i_430423 = 0;
					HEX3Atmp_430425 = 0;
					LOC14 = 0;
					LOC14 = len_225364(cc);
					HEX3Atmp_430425 = (LOC14 - 1);
					res_430427 = 0;
					{
						while (1) {
							if (!(res_430427 <= HEX3Atmp_430425)) goto LA16;
							i_430423 = res_430427;
							x_430401 = (*cc).kindU.S6.Sons->data[i_430423];
							add_225498(insertpoint, x_430401);
							res_430427 += 1;
						} LA16: ;
					}
				}
			}
		}
		LA7: ;
		{
			if (!((*env).Createdvar == NIM_NIL)) goto LA19;
			asgnRefNoCycle((void**) (&(*env).Createdvar), result);
		}
		LA19: ;
	}
	goto LA1;
	LA5: ;
	{
		result = (*env).Createdvar;
	}
	LA1: ;
	(*env).Createdvarcomesfromiter = NIM_TRUE;
	return result;
}

N_NIMCALL(tnode224816*, generatethunk_428861)(tnode224816* prc, ttype224852* dest) {
	tnode224816* result;
	tnode224816* conv;
	ttype224852* LOC5;
	tnode224816* LOC6;
	result = 0;
	{
		if (!(gcmd_168120 == ((NU8) 4))) goto LA3;
		result = prc;
		goto BeforeRet;
	}
	LA3: ;
	result = newnodeit_225145(((NU8) 154), (*prc).Info, dest);
	conv = newnodeit_225145(((NU8) 58), (*prc).Info, dest);
	add_225498(conv, emptynode_225738);
	add_225498(conv, prc);
	add_225498(result, conv);
	LOC5 = 0;
	LOC5 = getsystype_281030(((NU8) 5));
	LOC6 = 0;
	LOC6 = newnodeit_225145(((NU8) 23), (*prc).Info, LOC5);
	add_225498(result, LOC6);
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode224816*, transformouterconv_428882)(tnode224816* n) {
	tnode224816* result;
	ttype224852* dest;
	ttype224852* source;
	result = 0;
	dest = skiptypes_229245((*n).Typ, IL64(211106242013440));
	source = skiptypes_229245((*(*n).kindU.S6.Sons->data[1]).Typ, IL64(211106242013440));
	{
		if (!((*dest).Kind == ((NU8) 25))) goto LA3;
		{
			NIM_BOOL LOC7;
			LOC7 = 0;
			LOC7 = ((*dest).Callconv == ((NU8) 8));
			if (!(LOC7)) goto LA8;
			LOC7 = ((*source).Callconv == ((NU8) 0));
			LA8: ;
			if (!LOC7) goto LA9;
			result = generatethunk_428861((*n).kindU.S6.Sons->data[1], dest);
		}
		LA9: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(tnode224816*, transformyield_430491)(toutercontext427022* c, tnode224816* n, titer427016* it) {
	tnode224816* result;
	NI64 stateno;
	tnode224816* stateasgnstmt;
	tnode224816* LOC1;
	tnode224816* LOC2;
	ttype224852* LOC3;
	tnode224816* LOC4;
	tnode224816* retstmt;
	tnode224816* statelabelstmt;
	ttype224852* LOC17;
	tnode224816* LOC18;
	result = 0;
	(*(*(*(*(*it).State).Typ).N).kindU.S6.Sons->data[1]).kindU.S1.Intval += 1;
	stateno = (*(*(*(*(*it).State).Typ).N).kindU.S6.Sons->data[1]).kindU.S1.Intval;
	stateasgnstmt = newnodei_225138(((NU8) 73), (*n).Info);
	LOC1 = 0;
	LOC1 = newsymnode_225132((*it).Closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_423407(LOC1, (*it).State, (*n).Info);
	add_225498(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_281030(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_225103(((NU8) 6), stateno, LOC3);
	add_225498(stateasgnstmt, LOC4);
	retstmt = newnodei_225138(((NU8) 109), (*n).Info);
	{
		tnode224816* a;
		tnode224816* retval;
		tnode224816* LOC9;
		tnode224816* LOC10;
		if (!!(((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 1)))) goto LA7;
		a = newnodei_225138(((NU8) 73), (*(*n).kindU.S6.Sons->data[0]).Info);
		retval = transformouterproc_430483(c, (*n).kindU.S6.Sons->data[0], it);
		LOC9 = 0;
		LOC9 = newsymnode_225132((*it).Resultsym);
		addson_225287(a, LOC9);
		LOC10 = 0;
		{
			if (!retval == 0) goto LA13;
			LOC10 = (*n).kindU.S6.Sons->data[0];
		}
		goto LA11;
		LA13: ;
		{
			LOC10 = retval;
		}
		LA11: ;
		addson_225287(a, LOC10);
		add_225498(retstmt, a);
	}
	goto LA5;
	LA7: ;
	{
		add_225498(retstmt, emptynode_225738);
	}
	LA5: ;
	statelabelstmt = newnodei_225138(((NU8) 156), (*n).Info);
	LOC17 = 0;
	LOC17 = getsystype_281030(((NU8) 31));
	LOC18 = 0;
	LOC18 = newinttypenode_225103(((NU8) 6), stateno, LOC17);
	add_225498(statelabelstmt, LOC18);
	result = newnodei_225138(((NU8) 115), (*n).Info);
	add_225498(result, stateasgnstmt);
	add_225498(result, retstmt);
	add_225498(result, statelabelstmt);
	return result;
}

N_NIMCALL(void, outerprocsons_431170)(toutercontext427022* o, tnode224816* n, titer427016* it) {
	{
		NI i_431187;
		NI HEX3Atmp_431235;
		NI LOC2;
		NI res_431238;
		i_431187 = 0;
		HEX3Atmp_431235 = 0;
		LOC2 = 0;
		LOC2 = sonslen_225249(n);
		HEX3Atmp_431235 = (NI64)(LOC2 - 1);
		res_431238 = 0;
		{
			while (1) {
				tnode224816* x;
				if (!(res_431238 <= HEX3Atmp_431235)) goto LA4;
				i_431187 = res_431238;
				x = transformouterproc_430483(o, (*n).kindU.S6.Sons->data[i_431187], it);
				{
					if (!!((x == NIM_NIL))) goto LA7;
					asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[i_431187]), x);
				}
				LA7: ;
				res_431238 += 1;
			} LA4: ;
		}
	}
}

N_NIMCALL(tnode224816*, transformreturn_431157)(toutercontext427022* c, tnode224816* n, titer427016* it) {
	tnode224816* result;
	tnode224816* stateasgnstmt;
	tnode224816* LOC1;
	tnode224816* LOC2;
	ttype224852* LOC3;
	tnode224816* LOC4;
	result = 0;
	result = newnodei_225138(((NU8) 115), (*n).Info);
	stateasgnstmt = newnodei_225138(((NU8) 73), (*n).Info);
	LOC1 = 0;
	LOC1 = newsymnode_225132((*it).Closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_423407(LOC1, (*it).State, (*n).Info);
	add_225498(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_281030(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_225103(((NU8) 6), IL64(-1), LOC3);
	add_225498(stateasgnstmt, LOC4);
	add_225498(result, stateasgnstmt);
	add_225498(result, n);
	return result;
}

N_NIMCALL(tnode224816*, transformouterproc_430483)(toutercontext427022* o, tnode224816* n, titer427016* it) {
	tnode224816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (n == NIM_NIL);
		if (LOC3) goto LA4;
		LOC3 = (((*n).Flags &(1<<((((NU8) 7))&15)))!=0);
		LA4: ;
		if (!LOC3) goto LA5;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA5: ;
	switch ((*n).Kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		tsym224846* local;
		tenv427020* closure;
		tidobj199015* LOC36;
		TNimObject* LOC37;
		tidobj199015* LOC71;
		local = (*n).kindU.S4.Sym;
		{
			NIM_BOOL LOC11;
			tnode224816* body;
			tnode224816* newbody;
			titer427016 LOC15;
			LOC11 = 0;
			LOC11 = isinnerproc_427902(local, (*o).Fn);
			if (!(LOC11)) goto LA12;
			LOC11 = contains_221837((&(*o).Processed), (*local).Sup.Id);
			LA12: ;
			if (!LOC11) goto LA13;
			excl_221884((&(*o).Processed), (*local).Sup.Id);
			body = getbody_278269(local);
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_427412(local, (&LOC15));
			newbody = transformouterprocbody_432214(o, body, (&LOC15));
			{
				if (!!((newbody == NIM_NIL))) goto LA18;
				asgnRefNoCycle((void**) (&(*(*local).Ast).kindU.S6.Sons->data[6]), newbody);
			}
			LA18: ;
		}
		LA13: ;
		{
			NIM_BOOL LOC22;
			NIM_BOOL LOC23;
			LOC22 = 0;
			LOC23 = 0;
			LOC23 = ((*(*it).Fn).Kind == ((NU8) 15));
			if (!(LOC23)) goto LA24;
			LOC23 = interestingitervar_430446(local);
			LA24: ;
			LOC22 = LOC23;
			if (!(LOC22)) goto LA25;
			LOC22 = ((*it).Fn == (*local).Owner);
			LA25: ;
			if (!LOC22) goto LA26;
			{
				NIM_BOOL LOC30;
				tidobj199015* LOC33;
				LOC30 = 0;
				LOC30 = contains_221837((&(*o).Capturedvars), (*local).Sup.Id);
				if (!LOC30) goto LA31;
				LOC33 = 0;
				LOC33 = &local->Sup;
				result = idnodetableget_234212((*o).Localstoaccess, LOC33);
				goto BeforeRet;
			}
			goto LA28;
			LA31: ;
			{
				tnode224816* LOC35;
				adduniquefield_423807((*it).Obj, local);
				LOC35 = 0;
				LOC35 = newsymnode_225132((*it).Closureparam);
				result = indirectaccess_424848(LOC35, local, (*n).Info);
				goto BeforeRet;
			}
			LA28: ;
		}
		LA26: ;
		LOC36 = 0;
		LOC36 = &local->Sup;
		LOC37 = 0;
		LOC37 = idtableget_234182((*o).Lambdastoenv, LOC36);
		closure = ((tenv427020*) (LOC37));
		{
			if (!((*local).Kind == ((NU8) 15))) goto LA40;
			{
				NIM_BOOL LOC44;
				LOC44 = 0;
				LOC44 = (local == (*o).Fn);
				if (LOC44) goto LA45;
				LOC44 = (local == (*it).Fn);
				LA45: ;
				if (!LOC44) goto LA46;
				message_196976((*n).Info, ((NU16) 25), (*(*local).Name).S);
			}
			LA46: ;
			{
				if (!closure == 0) goto LA50;
				result = liftitersym_431255(n);
				goto BeforeRet;
			}
			goto LA48;
			LA50: ;
			{
				tnode224816* createdvar;
				createdvar = generateiterclosurecreation_430320(o, closure, (*closure).Attachednode);
				result = makeclosure_428949(local, createdvar, (*n).Info);
				goto BeforeRet;
			}
			LA48: ;
		}
		LA40: ;
		{
			tnode224816* a;
			if (!!((closure == NIM_NIL))) goto LA55;
			a = (*closure).Createdvar;
			{
				if (!!((a == NIM_NIL))) goto LA59;
				result = makeclosure_428949(local, a, (*n).Info);
				goto BeforeRet;
			}
			goto LA57;
			LA59: ;
			{
				tnode224816* scope;
				tnode224816* x;
				scope = (*closure).Attachednode;
				{
					if (!((*(*scope).kindU.S6.Sons->data[0]).Kind == ((NU8) 1))) goto LA64;
					asgnRefNoCycle((void**) (&(*scope).kindU.S6.Sons->data[0]), generateclosurecreation_430308(o, closure));
				}
				LA64: ;
				x = (*closure).Createdvar;
				result = makeclosure_428949(local, x, (*n).Info);
				goto BeforeRet;
			}
			LA57: ;
		}
		LA55: ;
		{
			NIM_BOOL LOC68;
			LOC68 = 0;
			LOC68 = contains_221837((&(*o).Capturedvars), (*local).Sup.Id);
			if (!!(LOC68)) goto LA69;
			goto BeforeRet;
		}
		LA69: ;
		LOC71 = 0;
		LOC71 = &local->Sup;
		result = idnodetableget_234212((*o).Localstoaccess, LOC71);
	}
	break;
	case ((NU8) 51):
	case ((NU8) 84):
	case ((NU8) 52):
	{
		{
			if (!!(((*n).Typ == NIM_NIL))) goto LA75;
			result = transformouterproc_430483(o, (*n).kindU.S6.Sons->data[0], it);
		}
		LA75: ;
	}
	break;
	case ((NU8) 79):
	case ((NU8) 80):
	case ((NU8) 81):
	case ((NU8) 82):
	case ((NU8) 83):
	{
	}
	break;
	case ((NU8) 154):
	{
		{
			tsym224846* local;
			if (!((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 3))) goto LA81;
			local = (*(*n).kindU.S6.Sons->data[0]).kindU.S4.Sym;
			{
				NIM_BOOL LOC85;
				tnode224816* body;
				tnode224816* newbody;
				titer427016 LOC89;
				LOC85 = 0;
				LOC85 = isinnerproc_427902(local, (*o).Fn);
				if (!(LOC85)) goto LA86;
				LOC85 = contains_221837((&(*o).Processed), (*local).Sup.Id);
				LA86: ;
				if (!LOC85) goto LA87;
				excl_221884((&(*o).Processed), (*local).Sup.Id);
				body = getbody_278269(local);
				memset((void*)(&LOC89), 0, sizeof(LOC89));
				inititer_427412(local, (&LOC89));
				newbody = transformouterprocbody_432214(o, body, (&LOC89));
				{
					if (!!((newbody == NIM_NIL))) goto LA92;
					asgnRefNoCycle((void**) (&(*(*local).Ast).kindU.S6.Sons->data[6]), newbody);
				}
				LA92: ;
			}
			LA87: ;
		}
		LA81: ;
	}
	break;
	case ((NU8) 58):
	case ((NU8) 59):
	case ((NU8) 60):
	{
		tnode224816* x;
		x = transformouterproc_430483(o, (*n).kindU.S6.Sons->data[1], it);
		{
			if (!!((x == NIM_NIL))) goto LA97;
			asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[1]), x);
		}
		LA97: ;
		result = transformouterconv_428882(n);
	}
	break;
	case ((NU8) 104):
	{
		{
			if (!((*(*it).Fn).Kind == ((NU8) 15))) goto LA102;
			result = transformyield_430491(o, n, it);
		}
		goto LA100;
		LA102: ;
		{
			outerprocsons_431170(o, n, it);
		}
		LA100: ;
	}
	break;
	case ((NU8) 109):
	{
		{
			if (!((*(*it).Fn).Kind == ((NU8) 15))) goto LA108;
			result = transformreturn_431157(o, n, it);
		}
		goto LA106;
		LA108: ;
		{
			outerprocsons_431170(o, n, it);
		}
		LA106: ;
	}
	break;
	default:
	{
		outerprocsons_431170(o, n, it);
	}
	break;
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode224816*, transformouterprocbody_432214)(toutercontext427022* o, tnode224816* n, titer427016* it) {
	tnode224816* result;
	result = 0;
	{
		if (!(((*n).Flags &(1<<((((NU8) 7))&15)))!=0)) goto LA3;
		result = NIM_NIL;
	}
	goto LA1;
	LA3: ;
	{
		tnode224816* gs;
		tnode224816* LOC35;
		tnode224816* LOC36;
		tnode224816* state0;
		tnode224816* LOC37;
		tnode224816* newbody;
		tnode224816* stateasgnstmt;
		tnode224816* LOC43;
		tnode224816* LOC44;
		ttype224852* LOC45;
		tnode224816* LOC46;
		if (!((*(*it).Fn).Kind == ((NU8) 15))) goto LA6;
		{
			NIM_BOOL LOC10;
			NI LOC12;
			LOC10 = 0;
			LOC10 = ((*n).Kind == ((NU8) 115));
			if (!(LOC10)) goto LA11;
			LOC12 = 0;
			LOC12 = len_225364(n);
			LOC10 = (0 < LOC12);
			LA11: ;
			if (!LOC10) goto LA13;
			{
				if (!((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 155))) goto LA17;
				result = NIM_NIL;
				goto BeforeRet;
			}
			LA17: ;
			{
				NIM_BOOL LOC21;
				NIM_BOOL LOC22;
				NIM_BOOL LOC23;
				NI LOC24;
				tnode224816* LOC26;
				tnode224816* LOC28;
				NI LOC29;
				tnode224816* LOC31;
				tnode224816* LOC32;
				LOC21 = 0;
				LOC22 = 0;
				LOC23 = 0;
				LOC24 = 0;
				LOC24 = len_225364(n);
				LOC23 = (1 < LOC24);
				if (!(LOC23)) goto LA25;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_225698(n, 1);
				LOC23 = ((*LOC26).Kind == ((NU8) 115));
				LA25: ;
				LOC22 = LOC23;
				if (!(LOC22)) goto LA27;
				LOC28 = 0;
				LOC28 = HEX5BHEX5D_225698(n, 1);
				LOC29 = 0;
				LOC29 = len_225364(LOC28);
				LOC22 = (0 < LOC29);
				LA27: ;
				LOC21 = LOC22;
				if (!(LOC21)) goto LA30;
				LOC31 = 0;
				LOC31 = HEX5BHEX5D_225698(n, 1);
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_225698(LOC31, 0);
				LOC21 = ((*LOC32).Kind == ((NU8) 155));
				LA30: ;
				if (!LOC21) goto LA33;
				result = NIM_NIL;
				goto BeforeRet;
			}
			LA33: ;
		}
		LA13: ;
		result = newnodei_225138(((NU8) 115), (*(*it).Fn).Info);
		gs = newnodei_225138(((NU8) 155), (*(*it).Fn).Info);
		LOC35 = 0;
		LOC35 = newsymnode_225132((*it).Closureparam);
		LOC36 = 0;
		LOC36 = rawindirectaccess_423407(LOC35, (*it).State, (*(*it).Fn).Info);
		add_225498(gs, LOC36);
		add_225498(result, gs);
		state0 = newnodei_225138(((NU8) 156), (*(*it).Fn).Info);
		LOC37 = 0;
		LOC37 = newintnode_225096(((NU8) 6), IL64(0));
		add_225498(state0, LOC37);
		add_225498(result, state0);
		newbody = transformouterproc_430483(o, n, it);
		{
			if (!!((newbody == NIM_NIL))) goto LA40;
			add_225498(result, newbody);
		}
		goto LA38;
		LA40: ;
		{
			add_225498(result, n);
		}
		LA38: ;
		stateasgnstmt = newnodei_225138(((NU8) 73), (*(*it).Fn).Info);
		LOC43 = 0;
		LOC43 = newsymnode_225132((*it).Closureparam);
		LOC44 = 0;
		LOC44 = rawindirectaccess_423407(LOC43, (*it).State, (*(*it).Fn).Info);
		add_225498(stateasgnstmt, LOC44);
		LOC45 = 0;
		LOC45 = getsystype_281030(((NU8) 31));
		LOC46 = 0;
		LOC46 = newinttypenode_225103(((NU8) 6), IL64(-1), LOC45);
		add_225498(stateasgnstmt, LOC46);
		add_225498(result, stateasgnstmt);
		(*result).Flags |= ((NI16)1)<<((((NU8) 7))%(sizeof(NI16)*8));
	}
	goto LA1;
	LA6: ;
	{
		result = transformouterproc_430483(o, n, it);
		{
			if (!!((result == NIM_NIL))) goto LA50;
			(*result).Flags |= ((NI16)1)<<((((NU8) 7))%(sizeof(NI16)*8));
		}
		LA50: ;
	}
	LA1: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(void, finishenvironments_431837)(toutercontext427022* o) {
	tenv427020* env;
	env = (*o).Head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				tnode224816* scope;
				if (!!(((*env).Replacementnode == NIM_NIL))) goto LA5;
				scope = (*env).Attachednode;
				{
					if (!((*(*scope).kindU.S6.Sons->data[0]).Kind == ((NU8) 1))) goto LA9;
					asgnRefNoCycle((void**) (&(*scope).kindU.S6.Sons->data[0]), (*env).Replacementnode);
				}
				LA9: ;
			}
			LA5: ;
			env = (*env).Next;
		} LA2: ;
	}
}

N_NIMCALL(tnode224816*, liftlambdas_433871)(tsym224846* fn, tnode224816* body) {
	tnode224816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		tsym224846* LOC7;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*body).Kind == ((NU8) 1));
		if (LOC4) goto LA5;
		LOC4 = (gcmd_168120 == ((NU8) 4));
		LA5: ;
		LOC3 = LOC4;
		if (LOC3) goto LA6;
		LOC7 = 0;
		LOC7 = skipgenericowner_231699(fn);
		LOC3 = !(((*LOC7).Kind == ((NU8) 6)));
		LA6: ;
		if (!LOC3) goto LA8;
		result = body;
	}
	goto LA1;
	LA8: ;
	{
		toutercontext427022* o;
		tnode224816* ex;
		tenv427020* env;
		o = newoutercontext_427647(fn);
		ex = closurecreationpoint_429358(body);
		env = newenv_427675(o, NIM_NIL, ex, fn);
		addparamstoenv_429386(fn, env);
		searchforinnerprocs_429541(o, body, env);
		createenvironments_431610(o);
		{
			titer427016 LOC15;
			if (!((*fn).Kind == ((NU8) 15))) goto LA13;
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_427412(fn, (&LOC15));
			result = transformouterprocbody_432214(o, body, (&LOC15));
		}
		goto LA11;
		LA13: ;
		{
			titer427016 LOC17;
			tnode224816* LOC18;
			memset((void*)(&LOC17), 0, sizeof(LOC17));
			inititer_427412(fn, (&LOC17));
			LOC18 = 0;
			LOC18 = transformouterprocbody_432214(o, body, (&LOC17));
			result = ex;
		}
		LA11: ;
		finishenvironments_431837(o);
	}
	LA1: ;
	return result;
}

N_NIMCALL(tnode224816*, liftlambdasfortoplevel_433921)(tsym224846* module, tnode224816* body) {
	tnode224816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*body).Kind == ((NU8) 1));
		if (LOC3) goto LA4;
		LOC3 = (gcmd_168120 == ((NU8) 4));
		LA4: ;
		if (!LOC3) goto LA5;
		result = body;
	}
	goto LA1;
	LA5: ;
	{
		toutercontext427022* o;
		tnode224816* ex;
		tenv427020* env;
		titer427016 LOC8;
		tnode224816* LOC9;
		o = newoutercontext_427647(module);
		ex = closurecreationpoint_429358(body);
		env = newenv_427675(o, NIM_NIL, ex, module);
		searchforinnerprocs_429541(o, body, env);
		createenvironments_431610(o);
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		inititer_427412(module, (&LOC8));
		LOC9 = 0;
		LOC9 = transformouterproc_430483(o, body, (&LOC8));
		finishenvironments_431837(o);
		result = ex;
	}
	LA1: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, HEX00_lambdaliftingInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, HEX00_lambdaliftingDatInit)(void) {
static TNimNode* TMP3175[6];
static TNimNode* TMP3176[11];
static TNimNode TMP932[19];
NTI427022.size = sizeof(toutercontext427022);
NTI427022.kind = 18;
NTI427022.base = 0;
TMP3175[0] = &TMP932[1];
TMP932[1].kind = 1;
TMP932[1].offset = offsetof(toutercontext427022, Fn);
TMP932[1].typ = (&NTI224814);
TMP932[1].name = "fn";
TMP3175[1] = &TMP932[2];
NTI427020.size = sizeof(tenv427020);
NTI427020.kind = 17;
NTI427020.base = (&NTI3211);
TMP3176[0] = &TMP932[4];
TMP932[4].kind = 1;
TMP932[4].offset = offsetof(tenv427020, Attachednode);
TMP932[4].typ = (&NTI224808);
TMP932[4].name = "attachedNode";
TMP3176[1] = &TMP932[5];
TMP932[5].kind = 1;
TMP932[5].offset = offsetof(tenv427020, Replacementnode);
TMP932[5].typ = (&NTI224808);
TMP932[5].name = "replacementNode";
TMP3176[2] = &TMP932[6];
TMP932[6].kind = 1;
TMP932[6].offset = offsetof(tenv427020, Createdvar);
TMP932[6].typ = (&NTI224808);
TMP932[6].name = "createdVar";
TMP3176[3] = &TMP932[7];
TMP932[7].kind = 1;
TMP932[7].offset = offsetof(tenv427020, Createdvarcomesfromiter);
TMP932[7].typ = (&NTI138);
TMP932[7].name = "createdVarComesFromIter";
TMP3176[4] = &TMP932[8];
TMP932[8].kind = 1;
TMP932[8].offset = offsetof(tenv427020, Capturedvars);
TMP932[8].typ = (&NTI224818);
TMP932[8].name = "capturedVars";
TMP3176[5] = &TMP932[9];
TMP932[9].kind = 1;
TMP932[9].offset = offsetof(tenv427020, Up);
TMP932[9].typ = (&NTI427018);
TMP932[9].name = "up";
TMP3176[6] = &TMP932[10];
TMP932[10].kind = 1;
TMP932[10].offset = offsetof(tenv427020, Next);
TMP932[10].typ = (&NTI427018);
TMP932[10].name = "next";
TMP3176[7] = &TMP932[11];
TMP932[11].kind = 1;
TMP932[11].offset = offsetof(tenv427020, Upfield);
TMP932[11].typ = (&NTI224814);
TMP932[11].name = "upField";
TMP3176[8] = &TMP932[12];
TMP932[12].kind = 1;
TMP932[12].offset = offsetof(tenv427020, Obj);
TMP932[12].typ = (&NTI224812);
TMP932[12].name = "obj";
TMP3176[9] = &TMP932[13];
TMP932[13].kind = 1;
TMP932[13].offset = offsetof(tenv427020, Fn);
TMP932[13].typ = (&NTI224814);
TMP932[13].name = "fn";
TMP3176[10] = &TMP932[14];
TMP932[14].kind = 1;
TMP932[14].offset = offsetof(tenv427020, Vars);
TMP932[14].typ = (&NTI221056);
TMP932[14].name = "vars";
TMP932[3].len = 11; TMP932[3].kind = 2; TMP932[3].sons = &TMP3176[0];
NTI427020.node = &TMP932[3];
NTI427018.size = sizeof(tenv427020*);
NTI427018.kind = 22;
NTI427018.base = (&NTI427020);
NTI427018.marker = TMP3177;
TMP932[2].kind = 1;
TMP932[2].offset = offsetof(toutercontext427022, Head);
TMP932[2].typ = (&NTI427018);
TMP932[2].name = "head";
TMP3175[2] = &TMP932[15];
TMP932[15].kind = 1;
TMP932[15].offset = offsetof(toutercontext427022, Capturedvars);
TMP932[15].typ = (&NTI221056);
TMP932[15].name = "capturedVars";
TMP3175[3] = &TMP932[16];
TMP932[16].kind = 1;
TMP932[16].offset = offsetof(toutercontext427022, Processed);
TMP932[16].typ = (&NTI221056);
TMP932[16].name = "processed";
TMP3175[4] = &TMP932[17];
TMP932[17].kind = 1;
TMP932[17].offset = offsetof(toutercontext427022, Localstoaccess);
TMP932[17].typ = (&NTI224870);
TMP932[17].name = "localsToAccess";
TMP3175[5] = &TMP932[18];
TMP932[18].kind = 1;
TMP932[18].offset = offsetof(toutercontext427022, Lambdastoenv);
TMP932[18].typ = (&NTI224864);
TMP932[18].name = "lambdasToEnv";
TMP932[0].len = 6; TMP932[0].kind = 2; TMP932[0].sons = &TMP3175[0];
NTI427022.node = &TMP932[0];
NTI427014.size = sizeof(toutercontext427022*);
NTI427014.kind = 22;
NTI427014.base = (&NTI427022);
NTI427014.marker = TMP3178;
}

