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

#include <string.h>
typedef struct tsym225846 tsym225846;
typedef struct tidobj200015 tidobj200015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct ttypeseq225848 ttypeseq225848;
typedef struct ttype225852 ttype225852;
typedef struct TGenericSeq TGenericSeq;
typedef struct tscope225840 tscope225840;
typedef struct TY225947 TY225947;
typedef struct tinstantiation225836 tinstantiation225836;
typedef struct tstrtable225820 tstrtable225820;
typedef struct tsymseq225818 tsymseq225818;
typedef struct tident200021 tident200021;
typedef struct tlineinfo195539 tlineinfo195539;
typedef struct tnode225816 tnode225816;
typedef struct tloc225830 tloc225830;
typedef struct trope177009 trope177009;
typedef struct tlib225834 tlib225834;
typedef struct NimStringDesc NimStringDesc;
typedef struct tnodeseq225810 tnodeseq225810;
typedef struct TY84945 TY84945;
typedef struct tcell45135 tcell45135;
typedef struct tcellseq45151 tcellseq45151;
typedef struct tgcheap47216 tgcheap47216;
typedef struct tcellset45147 tcellset45147;
typedef struct tpagedesc45143 tpagedesc45143;
typedef struct tmemregion27410 tmemregion27410;
typedef struct tsmallchunk26640 tsmallchunk26640;
typedef struct tllchunk27404 tllchunk27404;
typedef struct tbigchunk26642 tbigchunk26642;
typedef struct tintset26617 tintset26617;
typedef struct ttrunk26613 ttrunk26613;
typedef struct tavlnode27408 tavlnode27408;
typedef struct tgcstat47214 tgcstat47214;
typedef struct toutercontext428022 toutercontext428022;
typedef struct tenv428020 tenv428020;
typedef struct intset222056 intset222056;
typedef struct ttrunk222052 ttrunk222052;
typedef struct ttrunkseq222054 ttrunkseq222054;
typedef struct tidnodetable225870 tidnodetable225870;
typedef struct tidnodepairseq225868 tidnodepairseq225868;
typedef struct tidnodepair225866 tidnodepair225866;
typedef struct tidtable225864 tidtable225864;
typedef struct tidpairseq225862 tidpairseq225862;
typedef struct tidpair225860 tidpair225860;
typedef struct titer428016 titer428016;
typedef struct TY225936 TY225936;
typedef struct tlistentry127022 tlistentry127022;
typedef struct tbasechunk26638 tbasechunk26638;
typedef struct tfreecell26630 tfreecell26630;
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  tidobj200015  {
  TNimObject Sup;
NI Id;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  tstrtable225820  {
NI Counter;
tsymseq225818* Data;
};
struct  tlineinfo195539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  tloc225830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype225852* T;
trope177009* R;
trope177009* Heaproot;
};
struct  tsym225846  {
  tidobj200015 Sup;
NU8 Kind;
union {
struct {ttypeseq225848* Typeinstcache;
tscope225840* Typscope;
} S1;
struct {TY225947* Procinstcache;
tscope225840* Scope;
} S2;
struct {TY225947* Usedgenerics;
tstrtable225820 Tab;
} S3;
struct {tsym225846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype225852* Typ;
tident200021* Name;
tlineinfo195539 Info;
tsym225846* Owner;
NU32 Flags;
tnode225816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc225830 Loc;
tlib225834* Annex;
tnode225816* Constraint;
};
struct  ttype225852  {
  tidobj200015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq225848* Sons;
tnode225816* N;
tsym225846* Owner;
tsym225846* Sym;
tsym225846* Destructor;
tsym225846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc225830 Loc;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  tnode225816  {
ttype225852* Typ;
tlineinfo195539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym225846* Sym;
} S4;
struct {tident200021* Ident;
} S5;
struct {tnodeseq225810* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
struct TY84945 {
NimStringDesc* Field0;
NI Field1;
};
struct  tcell45135  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq45151  {
NI Len;
NI Cap;
tcell45135** D;
};
struct  tcellset45147  {
NI Counter;
NI Max;
tpagedesc45143* Head;
tpagedesc45143** Data;
};
typedef tsmallchunk26640* TY27422[512];
typedef ttrunk26613* ttrunkbuckets26615[256];
struct  tintset26617  {
ttrunkbuckets26615 Data;
};
struct  tmemregion27410  {
NI Minlargeobj;
NI Maxlargeobj;
TY27422 Freesmallchunks;
tllchunk27404* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk26642* Freechunkslist;
tintset26617 Chunkstarts;
tavlnode27408* Root;
tavlnode27408* Deleted;
tavlnode27408* Last;
tavlnode27408* Freeavlnodes;
};
struct  tgcstat47214  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap47216  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq45151 Zct;
tcellseq45151 Decstack;
tcellset45147 Cycleroots;
tcellseq45151 Tempstack;
NI Recgclock;
tmemregion27410 Region;
tgcstat47214 Stat;
};
struct  intset222056  {
NI Counter;
NI Max;
ttrunk222052* Head;
ttrunkseq222054* Data;
};
struct  tidnodepair225866  {
tidobj200015* Key;
tnode225816* Val;
};
struct  tidnodetable225870  {
NI Counter;
tidnodepairseq225868* Data;
};
struct  tidpair225860  {
tidobj200015* Key;
TNimObject* Val;
};
struct  tidtable225864  {
NI Counter;
tidpairseq225862* Data;
};
struct  toutercontext428022  {
tsym225846* Fn;
tenv428020* Head;
intset222056 Capturedvars;
intset222056 Processed;
tidnodetable225870 Localstoaccess;
tidtable225864 Lambdastoenv;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tenv428020  {
  TNimObject Sup;
tnode225816* Attachednode;
tnode225816* Replacementnode;
tnode225816* Createdvar;
NIM_BOOL Createdvarcomesfromiter;
tsymseq225818* Capturedvars;
tenv428020* Up;
tenv428020* Next;
tsym225846* Upfield;
ttype225852* Obj;
tsym225846* Fn;
intset222056 Vars;
};
struct  tident200021  {
  tidobj200015 Sup;
NimStringDesc* S;
tident200021* Next;
NI H;
};
struct  titer428016  {
tsym225846* Fn;
tsym225846* Closureparam;
tsym225846* State;
tsym225846* Resultsym;
ttype225852* Obj;
};
struct  tscope225840  {
NI Depthlevel;
tstrtable225820 Symbols;
tnodeseq225810* Usingsyms;
tscope225840* Parent;
};
struct  tinstantiation225836  {
tsym225846* Sym;
ttypeseq225848* Concretetypes;
TY225936* Usedby;
};
struct  trope177009  {
  TNimObject Sup;
trope177009* Left;
trope177009* Right;
NI Length;
NimStringDesc* Data;
};
struct  tlistentry127022  {
  TNimObject Sup;
tlistentry127022* Prev;
tlistentry127022* Next;
};
struct  tlib225834  {
  tlistentry127022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope177009* Name;
tnode225816* Path;
};
typedef NI TY26620[16];
struct  tpagedesc45143  {
tpagedesc45143* Next;
NI Key;
TY26620 Bits;
};
struct  tbasechunk26638  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk26640  {
  tbasechunk26638 Sup;
tsmallchunk26640* Next;
tsmallchunk26640* Prev;
tfreecell26630* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk27404  {
NI Size;
NI Acc;
tllchunk27404* Next;
};
struct  tbigchunk26642  {
  tbasechunk26638 Sup;
tbigchunk26642* Next;
tbigchunk26642* Prev;
NI Align;
NF Data;
};
struct  ttrunk26613  {
ttrunk26613* Next;
NI Key;
TY26620 Bits;
};
typedef tavlnode27408* TY27414[2];
struct  tavlnode27408  {
TY27414 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  ttrunk222052  {
ttrunk222052* Next;
NI Key;
TY26620 Bits;
};
struct  tfreecell26630  {
tfreecell26630* Next;
NI Zerofield;
};
struct ttypeseq225848 {
  TGenericSeq Sup;
  ttype225852* data[SEQ_DECL_SIZE];
};
struct TY225947 {
  TGenericSeq Sup;
  tinstantiation225836* data[SEQ_DECL_SIZE];
};
struct tsymseq225818 {
  TGenericSeq Sup;
  tsym225846* data[SEQ_DECL_SIZE];
};
struct tnodeseq225810 {
  TGenericSeq Sup;
  tnode225816* data[SEQ_DECL_SIZE];
};
struct ttrunkseq222054 {
  TGenericSeq Sup;
  ttrunk222052* data[SEQ_DECL_SIZE];
};
struct tidnodepairseq225868 {
  TGenericSeq Sup;
  tidnodepair225866 data[SEQ_DECL_SIZE];
};
struct tidpairseq225862 {
  TGenericSeq Sup;
  tidpair225860 data[SEQ_DECL_SIZE];
};
struct TY225936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
static N_INLINE(NIM_BOOL, interestingvar_429039)(tsym225846* s);
N_NIMCALL(NIM_BOOL, isgenericroutine_232649)(tsym225846* s);
static N_INLINE(NI, len_226364)(tnode225816* n);
static N_INLINE(tnode225816*, HEX5BHEX5D_226698)(tnode225816* n, NI i);
N_NIMCALL(void, internalerror_198006)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_198126)(TY84945 x_198130);
N_NIMCALL(tnode225816*, newnodei_226138)(NU8 kind, tlineinfo195539 info);
N_NIMCALL(tsym225846*, copysym_226203)(tsym225846* s, NIM_BOOL keepid);
N_NIMCALL(tsym225846*, gethiddenparam_428238)(tsym225846* routine);
static N_INLINE(tnode225816*, lastson_226261)(tnode225816* n);
static N_INLINE(NI, sonslen_226249)(tnode225816* n);
N_NIMCALL(void, addvar_424053)(tnode225816* father, tnode225816* v);
N_NIMCALL(tnode225816*, newsymnode_226132)(tsym225846* sym);
N_NIMCALL(void, add_226498)(tnode225816* father, tnode225816* son);
N_NIMCALL(tnode225816*, newcall_428891)(tsym225846* a, tnode225816* b);
N_NIMCALL(tsym225846*, getsyssym_282054)(NimStringDesc* name);
N_NIMCALL(tnode225816*, newnodei_228007)(NU8 kind, tlineinfo195539 info, NI children);
N_NIMCALL(tnode225816*, newinttypenode_226103)(NU8 kind, NI64 intval, ttype225852* typ);
N_NIMCALL(ttype225852*, getsystype_282030)(NU8 kind);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(tcell45135*, usrtocell_48846)(void* usr);
static N_INLINE(void, rtladdzct_50404)(tcell45135* c);
N_NOINLINE(void, addzct_48817)(tcellseq45151* s, tcell45135* c);
N_NIMCALL(void, addson_226287)(tnode225816* father, tnode225816* son);
N_NIMCALL(tnode225816*, makeclosure_429949)(tsym225846* prc, tnode225816* env, tlineinfo195539 info);
N_NIMCALL(tnode225816*, newnodeit_226145)(NU8 kind, tlineinfo195539 info, ttype225852* typ);
N_NIMCALL(tsym225846*, skipgenericowner_232698)(tsym225846* s);
N_NIMCALL(toutercontext428022*, newoutercontext_428647)(tsym225846* fn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3174)(void* p, NI op);
N_NIMCALL(void, TMP3175)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initintset_222950)(intset222056* Result);
N_NIMCALL(void, initidnodetable_226181)(tidnodetable225870* x);
N_NIMCALL(void, initidtable_226167)(tidtable225864* x);
N_NIMCALL(tnode225816*, closurecreationpoint_430358)(tnode225816* n);
N_NIMCALL(tenv428020*, newenv_428675)(toutercontext428022* o, tenv428020* up, tnode225816* n, tsym225846* 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_51225)(tcell45135* c);
static N_INLINE(NIM_BOOL, canbecycleroot_48867)(tcell45135* c);
static N_INLINE(void, rtladdcycleroot_49629)(tcell45135* c);
N_NOINLINE(void, incl_45871)(tcellset45147* s, tcell45135* cell);
static N_INLINE(void, decref_50804)(tcell45135* c);
N_NIMCALL(tsym225846*, getenvparam_428349)(tsym225846* routine);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(ttype225852*, createenvobj_428082)(tsym225846* owner);
N_NIMCALL(ttype225852*, createobj_424304)(tsym225846* owner, tlineinfo195539 info);
N_NIMCALL(void, rawaddfield_424331)(ttype225852* obj, tsym225846* field);
N_NIMCALL(tsym225846*, createstatefield_428072)(tsym225846* iter);
N_NIMCALL(tsym225846*, newsym_226074)(NU8 symkind, tident200021* name, tsym225846* owner, tlineinfo195539 info);
N_NIMCALL(tident200021*, getident_200472)(NimStringDesc* identifier);
N_NIMCALL(ttype225852*, getstatetype_428049)(tsym225846* iter);
N_NIMCALL(tnode225816*, newintnode_226096)(NU8 kind, NI64 intval);
N_NIMCALL(ttype225852*, newtype_226083)(NU8 kind, tsym225846* owner);
N_NIMCALL(ttype225852*, nilorsysint_282070)(void);
N_NIMCALL(void, rawaddson_230562)(ttype225852* father, ttype225852* son);
N_NIMCALL(void, addparamstoenv_430386)(tsym225846* fn, tenv428020* env);
N_NIMCALL(void, internalerror_197987)(tlineinfo195539 info, NimStringDesc* errmsg);
N_NIMCALL(void, incl_222869)(intset222056* s, NI key);
N_NIMCALL(void, searchforinnerprocs_430541)(toutercontext428022* o, tnode225816* n, tenv428020* env);
N_NIMCALL(NIM_BOOL, isinnerproc_428902)(tsym225846* s, tsym225846* outerproc);
N_NIMCALL(NIM_BOOL, containsorincl_222916)(intset222056* s, NI key);
N_NIMCALL(tnode225816*, getbody_279270)(tsym225846* s);
N_NIMCALL(NI, gathervars_429721)(toutercontext428022* o, tenv428020* e, tnode225816* n);
N_NIMCALL(NIM_BOOL, capturevar_429433)(toutercontext428022* o, tenv428020* top, tsym225846* local, tlineinfo195539 info);
N_NIMCALL(NIM_BOOL, contains_222837)(intset222056 s, NI key);
static N_INLINE(NIM_BOOL, illegalcapture_429006)(tsym225846* s);
N_NIMCALL(ttype225852*, skiptypes_230245)(ttype225852* t, NU64 kinds);
N_NIMCALL(void, localerror_197955)(tlineinfo195539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(tsym225846*, createupfield_429421)(ttype225852* obj, ttype225852* fieldtype);
N_NIMCALL(void, addfield_424608)(ttype225852* obj, tsym225846* s);
N_NIMCALL(void, addclosureparam_428962)(tsym225846* fn, tenv428020* e);
N_NIMCALL(void, addhiddenparam_428147)(tsym225846* routine, tsym225846* param);
N_NIMCALL(TNimObject*, idtableget_235182)(tidtable225864 t, tidobj200015* key);
N_NIMCALL(void, idtableput_235196)(tidtable225864* t, tidobj200015* key, TNimObject* val);
N_NIMCALL(void, addcapturedvar_428818)(tenv428020* e, tsym225846* v);
N_NIMCALL(TGenericSeq*, incrSeq)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(tnode225816*, transforminnerproc_430192)(toutercontext428022* o, tenv428020* e, tnode225816* n);
N_NIMCALL(tnode225816*, getclosurevar_430015)(tenv428020* e);
N_NIMCALL(tnode225816*, newclosurecreationvar_429978)(tenv428020* e);
N_NIMCALL(void, inititer_428412)(tsym225846* iter, titer428016* Result);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(tsym225846*, newiterresult_428092)(tsym225846* iter);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, adduniquefield_424807)(ttype225852* obj, tsym225846* s);
N_NIMCALL(tnode225816*, indirectaccess_425848)(tnode225816* a, tsym225846* b, tlineinfo195539 info);
N_NIMCALL(tenv428020*, findenv_430042)(toutercontext428022* o, tsym225846* s);
N_NIMCALL(tnode225816*, nestedaccess_429076)(tenv428020* top, tsym225846* local);
N_NIMCALL(void, createenvironments_432610)(toutercontext428022* o);
N_NIMCALL(tnode225816*, generateclosurecreation_431308)(toutercontext428022* o, tenv428020* scope);
N_NIMCALL(tnode225816*, rawclosurecreation_431201)(toutercontext428022* o, tenv428020* scope, tnode225816* env);
N_NIMCALL(tnode225816*, newasgnstmt_431161)(tnode225816* le, tnode225816* ri, tlineinfo195539 info);
N_NIMCALL(tnode225816*, idnodetableget_235212)(tidnodetable225870 t, tidobj200015* key);
N_NIMCALL(void, idnodetableput_235219)(tidnodetable225870* t, tidobj200015* key, tnode225816* val);
N_NIMCALL(tnode225816*, transformouterprocbody_433214)(toutercontext428022* o, tnode225816* n, titer428016* it);
N_NIMCALL(tnode225816*, rawindirectaccess_424407)(tnode225816* a, tsym225846* field, tlineinfo195539 info);
N_NIMCALL(tnode225816*, transformouterproc_431483)(toutercontext428022* o, tnode225816* n, titer428016* it);
N_NIMCALL(void, excl_222884)(intset222056* s, NI key);
static N_INLINE(NIM_BOOL, interestingitervar_431446)(tsym225846* s);
N_NIMCALL(void, message_197976)(tlineinfo195539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(tnode225816*, liftitersym_432255)(tnode225816* n);
N_NIMCALL(tnode225816*, generateiterclosurecreation_431320)(toutercontext428022* o, tenv428020* env, tnode225816* scope);
N_NIMCALL(tnode225816*, transformouterconv_429882)(tnode225816* n);
N_NIMCALL(tnode225816*, generatethunk_429861)(tnode225816* prc, ttype225852* dest);
N_NIMCALL(tnode225816*, transformyield_431491)(toutercontext428022* c, tnode225816* n, titer428016* it);
N_NIMCALL(void, outerprocsons_432170)(toutercontext428022* o, tnode225816* n, titer428016* it);
N_NIMCALL(tnode225816*, transformreturn_432157)(toutercontext428022* c, tnode225816* n, titer428016* it);
N_NIMCALL(void, finishenvironments_432837)(toutercontext428022* o);
STRING_LITERAL(TMP3135, "compiler/lambdalifting.nim", 26);
NIM_CONST TY84945 TMP3134 = {((NimStringDesc*) &TMP3135),
999}
;
NIM_CONST TY84945 TMP3136 = {((NimStringDesc*) &TMP3135),
195}
;
STRING_LITERAL(TMP3137, "internalNew", 11);
STRING_LITERAL(TMP3176, ":envP", 5);
STRING_LITERAL(TMP3177, ":state", 6);
STRING_LITERAL(TMP3178, "liftLambdas: strange params", 27);
STRING_LITERAL(TMP3179, ":up", 3);
STRING_LITERAL(TMP3180, ":env", 4);
NIM_CONST TY84945 TMP3181 = {((NimStringDesc*) &TMP3135),
219}
;
STRING_LITERAL(TMP3182, ":result", 7);
NIM_CONST TY84945 TMP3188 = {((NimStringDesc*) &TMP3135),
469}
;
NIM_CONST TY84945 TMP3189 = {((NimStringDesc*) &TMP3135),
312}
;
NIM_CONST TY84945 TMP3190 = {((NimStringDesc*) &TMP3135),
319}
;
STRING_LITERAL(TMP3191, "searchForInnerProcs", 19);
extern tgcheap47216 gch_47244;
extern tnode225816* emptynode_226738;
extern NU8 gcmd_169120;
TNimType NTI428022; /* TOuterContext */
extern TNimType NTI225814; /* PSym */
extern TNimType NTI3211; /* RootObj */
TNimType NTI428020; /* TEnv */
extern TNimType NTI225808; /* PNode */
extern TNimType NTI138; /* bool */
extern TNimType NTI225818; /* TSymSeq */
extern TNimType NTI225812; /* PType */
extern TNimType NTI222056; /* IntSet */
TNimType NTI428018; /* PEnv */
extern TNimType NTI225870; /* TIdNodeTable */
extern TNimType NTI225864; /* TIdTable */
TNimType NTI428014; /* POuterContext */

static N_INLINE(NIM_BOOL, interestingvar_429039)(tsym225846* 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_429685)(tsym225846* s, tsym225846* owner) {
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_429039(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_232649(owner);
			LOC11 = !(LOC13);
			LA12: ;
			if (!LOC11) goto LA14;
			(*(*owner).Typ).Callconv = ((NU8) 8);
		}
		LA14: ;
	}
	LA7: ;
}

static N_INLINE(NI, len_226364)(tnode225816* 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(tnode225816*, HEX5BHEX5D_226698)(tnode225816* n, NI i) {
	tnode225816* result;
	result = 0;
	result = (*n).kindU.S6.Sons->data[i];
	return result;
}

static N_INLINE(NI, sonslen_226249)(tnode225816* 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(tnode225816*, lastson_226261)(tnode225816* n) {
	tnode225816* result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = sonslen_226249(n);
	result = (*n).kindU.S6.Sons->data[(NI32)(LOC1 - 1)];
	return result;
}

N_NIMCALL(tsym225846*, gethiddenparam_428238)(tsym225846* routine) {
	tsym225846* result;
	tnode225816* params;
	tnode225816* hidden;
	result = 0;
	params = (*(*routine).Ast).kindU.S6.Sons->data[3];
	hidden = lastson_226261(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_198126(TMP3136);
		internalerror_198006(LOC7);
	}
	LA5: ;
	result = (*hidden).kindU.S4.Sym;
	return result;
}

N_NIMCALL(tnode225816*, newcall_428891)(tsym225846* a, tnode225816* b) {
	tnode225816* result;
	tnode225816* LOC1;
	result = 0;
	result = newnodei_226138(((NU8) 27), (*a).Info);
	LOC1 = 0;
	LOC1 = newsymnode_226132(a);
	add_226498(result, LOC1);
	add_226498(result, b);
	return result;
}

static N_INLINE(tcell45135*, usrtocell_48846)(void* usr) {
	tcell45135* result;
	result = 0;
	result = ((tcell45135*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(tcell45135))))));
	return result;
}

static N_INLINE(void, rtladdzct_50404)(tcell45135* c) {
	addzct_48817((&gch_47244.Zct), c);
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		tcell45135* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_48846(src);
		(*c).Refcount += 8;
	}
	LA3: ;
	{
		tcell45135* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_48846((*dest));
		{
			(*c).Refcount -= 8;
			if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA11;
			rtladdzct_50404(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(tnode225816*, makeclosure_429949)(tsym225846* prc, tnode225816* env, tlineinfo195539 info) {
	tnode225816* result;
	tnode225816* LOC1;
	result = 0;
	result = newnodeit_226145(((NU8) 154), info, (*prc).Typ);
	LOC1 = 0;
	LOC1 = newsymnode_226132(prc);
	add_226498(result, LOC1);
	{
		ttype225852* LOC6;
		tnode225816* LOC7;
		if (!(env == NIM_NIL)) goto LA4;
		LOC6 = 0;
		LOC6 = getsystype_282030(((NU8) 5));
		LOC7 = 0;
		LOC7 = newnodeit_226145(((NU8) 23), info, LOC6);
		add_226498(result, LOC7);
	}
	goto LA2;
	LA4: ;
	{
		add_226498(result, env);
	}
	LA2: ;
	return result;
}

N_NIMCALL(tnode225816*, liftforloop_434953)(tnode225816* body) {
	tnode225816* result;
	NI l;
	tnode225816* call;
	tsym225846* env;
	tnode225816* loopbody;
	tnode225816* whileloop;
	ttype225852* LOC23;
	tnode225816* v2;
	tnode225816* vpart;
	NU8 LOC24;
	tnode225816* bs;
	result = 0;
	l = len_226364(body);
	{
		NIM_BOOL LOC3;
		tnode225816* LOC5;
		NimStringDesc* LOC8;
		LOC3 = 0;
		LOC3 = ((*body).Kind == ((NU8) 94));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = HEX5BHEX5D_226698(body, (NI32)(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_198126(TMP3134);
		internalerror_198006(LOC8);
	}
	LA6: ;
	call = HEX5BHEX5D_226698(body, (NI32)(l - 2));
	result = newnodei_226138(((NU8) 115), (*body).Info);
	env = 0;
	{
		NIM_BOOL LOC11;
		tnode225816* LOC12;
		tnode225816* LOC14;
		tsym225846* iter;
		tnode225816* LOC17;
		tsym225846* LOC18;
		tnode225816* v;
		tnode225816* LOC19;
		tsym225846* LOC20;
		tnode225816* LOC21;
		tnode225816* LOC22;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = HEX5BHEX5D_226698(call, 0);
		LOC11 = ((*LOC12).Kind == ((NU8) 3));
		if (!(LOC11)) goto LA13;
		LOC14 = 0;
		LOC14 = HEX5BHEX5D_226698(call, 0);
		LOC11 = ((*(*LOC14).kindU.S4.Sym).Kind == ((NU8) 15));
		LA13: ;
		if (!LOC11) goto LA15;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_226698(call, 0);
		iter = (*LOC17).kindU.S4.Sym;
		LOC18 = 0;
		LOC18 = gethiddenparam_428238(iter);
		env = copysym_226203(LOC18, NIM_FALSE);
		v = newnodei_226138(((NU8) 99), (*body).Info);
		LOC19 = 0;
		LOC19 = newsymnode_226132(env);
		addvar_424053(v, LOC19);
		add_226498(result, v);
		LOC20 = 0;
		LOC20 = getsyssym_282054(((NimStringDesc*) &TMP3137));
		LOC21 = 0;
		LOC21 = newsymnode_226132(env);
		LOC22 = 0;
		LOC22 = newcall_428891(LOC20, LOC21);
		add_226498(result, LOC22);
	}
	LA15: ;
	loopbody = newnodei_228007(((NU8) 115), (*body).Info, 3);
	whileloop = newnodei_228007(((NU8) 96), (*body).Info, 2);
	LOC23 = 0;
	LOC23 = getsystype_282030(((NU8) 1));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.Sons->data[0]), newinttypenode_226103(((NU8) 6), IL64(1), LOC23));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.Sons->data[1]), loopbody);
	add_226498(result, whileloop);
	v2 = newnodei_226138(((NU8) 100), (*body).Info);
	LOC24 = 0;
	{
		if (!(l == 3)) goto LA27;
		LOC24 = ((NU8) 35);
	}
	goto LA25;
	LA27: ;
	{
		LOC24 = ((NU8) 36);
	}
	LA25: ;
	vpart = newnodei_226138(LOC24, (*body).Info);
	{
		NI i_435244;
		NI HEX3Atmp_435527;
		NI res_435530;
		i_435244 = 0;
		HEX3Atmp_435527 = 0;
		HEX3Atmp_435527 = (NI32)(l - 3);
		res_435530 = 0;
		{
			while (1) {
				tnode225816* LOC33;
				tnode225816* LOC34;
				if (!(res_435530 <= HEX3Atmp_435527)) goto LA32;
				i_435244 = res_435530;
				LOC33 = 0;
				LOC33 = HEX5BHEX5D_226698(body, i_435244);
				(*(*LOC33).kindU.S4.Sym).Kind = ((NU8) 9);
				LOC34 = 0;
				LOC34 = HEX5BHEX5D_226698(body, i_435244);
				addson_226287(vpart, LOC34);
				res_435530 += 1;
			} LA32: ;
		}
	}
	addson_226287(vpart, emptynode_226738);
	{
		tnode225816* LOC39;
		if (!!(env == 0)) goto LA37;
		LOC39 = 0;
		LOC39 = newsymnode_226132(env);
		asgnRefNoCycle((void**) (&(*call).kindU.S6.Sons->data[0]), makeclosure_429949((*(*call).kindU.S6.Sons->data[0]).kindU.S4.Sym, LOC39, (*body).Info));
	}
	LA37: ;
	addson_226287(vpart, call);
	addson_226287(v2, vpart);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.Sons->data[0]), v2);
	bs = newnodei_226138(((NU8) 157), (*body).Info);
	addson_226287(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_226698(body, (NI32)(l - 1)));
	return result;
}
N_NIMCALL(void, TMP3174)(void* p, NI op) {
	tenv428020* a;
	a = (tenv428020*)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, TMP3175)(void* p, NI op) {
	toutercontext428022* a;
	a = (toutercontext428022*)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(toutercontext428022*, newoutercontext_428647)(tsym225846* fn) {
	toutercontext428022* result;
	result = 0;
	result = (toutercontext428022*) newObj((&NTI428014), sizeof(toutercontext428022));
	asgnRefNoCycle((void**) (&(*result).Fn), fn);
	initintset_222950((&(*result).Capturedvars));
	initintset_222950((&(*result).Processed));
	initidnodetable_226181((&(*result).Localstoaccess));
	initidtable_226167((&(*result).Lambdastoenv));
	return result;
}

N_NIMCALL(tnode225816*, closurecreationpoint_430358)(tnode225816* n) {
	tnode225816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC6;
		tnode225816* LOC8;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*n).Kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC6 = 0;
		LOC6 = len_226364(n);
		LOC4 = (1 <= LOC6);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA7;
		LOC8 = 0;
		LOC8 = HEX5BHEX5D_226698(n, 0);
		LOC3 = ((*LOC8).Kind == ((NU8) 1));
		LA7: ;
		if (!LOC3) goto LA9;
		result = n;
	}
	goto LA1;
	LA9: ;
	{
		result = newnodei_226138(((NU8) 115), (*n).Info);
		add_226498(result, emptynode_226738);
		add_226498(result, n);
	}
	LA1: ;
	return result;
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tcell45135* c;
	c = usrtocell_48846(p);
	{
		(*c).Refcount -= 8;
		if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA3;
		rtladdzct_50404(c);
	}
	LA3: ;
}

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

static N_INLINE(void, rtladdcycleroot_49629)(tcell45135* c) {
	{
		if (!!((((NI) ((NI)((*c).Refcount & 3))) == 3))) goto LA3;
		(*c).Refcount = (NI)((NI)((*c).Refcount & -4) | 3);
		incl_45871((&gch_47244.Cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_51225)(tcell45135* c) {
	(*c).Refcount = (NI)((NU32)((*c).Refcount) + (NU32)(8));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_48867(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_49629(c);
	}
	LA4: ;
}

static N_INLINE(void, decref_50804)(tcell45135* c) {
	{
		(*c).Refcount -= 8;
		if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA3;
		rtladdzct_50404(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_48867(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_49629(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tcell45135* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_48846(src);
		incref_51225(LOC5);
	}
	LA3: ;
	{
		tcell45135* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_48846((*dest));
		decref_50804(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)), (NI32)((*a).Sup.len * 1));
	LOC11 = (LOC13 == ((NI32) 0));
	LA12: ;
	result = LOC11;
	goto BeforeRet;
	BeforeRet: ;
	return result;
}

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

N_NIMCALL(ttype225852*, getstatetype_428049)(tsym225846* iter) {
	ttype225852* result;
	tnode225816* n;
	tnode225816* LOC1;
	tnode225816* LOC2;
	ttype225852* inttype;
	result = 0;
	n = newnodei_226138(((NU8) 44), (*iter).Info);
	LOC1 = 0;
	LOC1 = newintnode_226096(((NU8) 6), IL64(-1));
	addson_226287(n, LOC1);
	LOC2 = 0;
	LOC2 = newintnode_226096(((NU8) 6), IL64(0));
	addson_226287(n, LOC2);
	result = newtype_226083(((NU8) 20), iter);
	asgnRefNoCycle((void**) (&(*result).N), n);
	inttype = nilorsysint_282070();
	{
		if (!inttype == 0) goto LA5;
		inttype = newtype_226083(((NU8) 31), iter);
	}
	LA5: ;
	rawaddson_230562(result, inttype);
	return result;
}

N_NIMCALL(tsym225846*, createstatefield_428072)(tsym225846* iter) {
	tsym225846* result;
	tident200021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_200472(((NimStringDesc*) &TMP3177));
	result = newsym_226074(((NU8) 19), LOC1, iter, (*iter).Info);
	asgnRefNoCycle((void**) (&(*result).Typ), getstatetype_428049(iter));
	return result;
}

N_NIMCALL(ttype225852*, createenvobj_428082)(tsym225846* owner) {
	ttype225852* result;
	tsym225846* LOC1;
	result = 0;
	result = createobj_424304(owner, (*owner).Info);
	LOC1 = 0;
	LOC1 = createstatefield_428072(owner);
	rawaddfield_424331(result, LOC1);
	return result;
}

N_NIMCALL(tenv428020*, newenv_428675)(toutercontext428022* o, tenv428020* up, tnode225816* n, tsym225846* owner) {
	tenv428020* result;
	result = 0;
	result = (tenv428020*) newObj((&NTI428018), sizeof(tenv428020));
	(*result).Sup.m_type = (&NTI428020);
	if ((*result).Capturedvars) nimGCunrefNoCycle((*result).Capturedvars);
	(*result).Capturedvars = (tsymseq225818*) newSeqRC1((&NTI225818), 0);
	asgnRef((void**) (&(*result).Up), up);
	asgnRefNoCycle((void**) (&(*result).Attachednode), n);
	asgnRefNoCycle((void**) (&(*result).Fn), owner);
	initintset_222950((&(*result).Vars));
	asgnRef((void**) (&(*result).Next), (*o).Head);
	asgnRef((void**) (&(*o).Head), result);
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		tsym225846* 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_428349(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_428082(owner));
	}
	LA15: ;
	return result;
}

N_NIMCALL(void, addparamstoenv_430386)(tsym225846* fn, tenv428020* env) {
	tnode225816* params;
	tnode225816* ast;
	params = (*(*fn).Typ).N;
	{
		NI i_430412;
		NI HEX3Atmp_430521;
		NI LOC2;
		NI res_430524;
		i_430412 = 0;
		HEX3Atmp_430521 = 0;
		LOC2 = 0;
		LOC2 = len_226364(params);
		HEX3Atmp_430521 = (LOC2 - 1);
		res_430524 = 1;
		{
			while (1) {
				tsym225846* param;
				if (!(res_430524 <= HEX3Atmp_430521)) goto LA4;
				i_430412 = res_430524;
				{
					if (!!(((*(*params).kindU.S6.Sons->data[i_430412]).Kind == ((NU8) 3)))) goto LA7;
					internalerror_197987((*params).Info, ((NimStringDesc*) &TMP3178));
				}
				LA7: ;
				param = (*(*params).kindU.S6.Sons->data[i_430412]).kindU.S4.Sym;
				incl_222869((&(*env).Vars), (*param).Sup.Id);
				res_430524 += 1;
			} LA4: ;
		}
	}
	ast = (*fn).Ast;
	{
		NIM_BOOL LOC11;
		NI LOC12;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = sonslen_226249(ast);
		LOC11 = (7 < LOC12);
		if (!(LOC11)) goto LA13;
		LOC11 = ((*(*ast).kindU.S6.Sons->data[7]).Kind == ((NU8) 3));
		LA13: ;
		if (!LOC11) goto LA14;
		incl_222869((&(*env).Vars), (*(*(*ast).kindU.S6.Sons->data[7]).kindU.S4.Sym).Sup.Id);
	}
	LA14: ;
}

N_NIMCALL(NIM_BOOL, isinnerproc_428902)(tsym225846* s, tsym225846* outerproc) {
	NIM_BOOL result;
	result = 0;
	{
		tsym225846* owner;
		if (!((110592 &(1<<(((*s).Kind)&31)))!=0)) goto LA3;
		owner = skipgenericowner_232698(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_429006)(tsym225846* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	ttype225852* LOC2;
	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = skiptypes_230245((*s).Typ, IL64(211106232576256));
	LOC1 = ((*LOC2).Kind == ((NU8) 23) || (*LOC2).Kind == ((NU8) 27) || (*LOC2).Kind == ((NU8) 48));
	if (LOC1) goto LA3;
	LOC1 = ((*s).Kind == ((NU8) 11));
	LA3: ;
	result = LOC1;
	return result;
}

N_NIMCALL(tsym225846*, createupfield_429421)(ttype225852* obj, ttype225852* fieldtype) {
	tsym225846* result;
	NI pos;
	tident200021* LOC1;
	result = 0;
	pos = len_226364((*obj).N);
	LOC1 = 0;
	LOC1 = getident_200472(((NimStringDesc*) &TMP3179));
	result = newsym_226074(((NU8) 19), LOC1, (*obj).Owner, (*(*obj).Owner).Info);
	asgnRefNoCycle((void**) (&(*result).Typ), newtype_226083(((NU8) 22), (*obj).Owner));
	(*result).Position = pos;
	rawaddson_230562((*result).Typ, fieldtype);
	addfield_424608(obj, result);
	return result;
}

N_NIMCALL(void, addhiddenparam_428147)(tsym225846* routine, tsym225846* param) {
	tnode225816* params;
	NI LOC1;
	tnode225816* LOC2;
	params = (*(*routine).Ast).kindU.S6.Sons->data[3];
	LOC1 = 0;
	LOC1 = len_226364(params);
	(*param).Position = (NI32)(LOC1 - 1);
	LOC2 = 0;
	LOC2 = newsymnode_226132(param);
	addson_226287(params, LOC2);
	(*(*routine).Typ).Flags |= ((NI32)1)<<((((NU8) 11))%(sizeof(NI32)*8));
}

N_NIMCALL(void, addclosureparam_428962)(tsym225846* fn, tenv428020* e) {
	tsym225846* cp;
	cp = getenvparam_428349(fn);
	{
		tident200021* LOC5;
		if (!(cp == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = getident_200472(((NimStringDesc*) &TMP3176));
		cp = newsym_226074(((NU8) 3), LOC5, fn, (*fn).Info);
		(*cp).Flags |= ((NI32)1)<<((((NU8) 2))%(sizeof(NI32)*8));
		asgnRefNoCycle((void**) (&(*cp).Typ), newtype_226083(((NU8) 22), fn));
		rawaddson_230562((*cp).Typ, (*e).Obj);
		addhiddenparam_428147(fn, cp);
	}
	LA3: ;
}

N_NIMCALL(void, addcapturedvar_428818)(tenv428020* e, tsym225846* v) {
	{
		tsym225846* x_428834;
		tsymseq225818* HEX3Atmp_428870;
		NI i_428873;
		NI l_428875;
		x_428834 = 0;
		HEX3Atmp_428870 = 0;
		HEX3Atmp_428870 = (*e).Capturedvars;
		i_428873 = 0;
		l_428875 = HEX3Atmp_428870->Sup.len;
		{
			while (1) {
				if (!(i_428873 < l_428875)) goto LA3;
				x_428834 = HEX3Atmp_428870->data[i_428873];
				{
					if (!(x_428834 == v)) goto LA6;
					goto BeforeRet;
				}
				LA6: ;
				i_428873 += 1;
			} LA3: ;
		}
	}
	(*e).Capturedvars = (tsymseq225818*) incrSeq(&((*e).Capturedvars)->Sup, sizeof(tsym225846*));
	asgnRefNoCycle((void**) (&(*e).Capturedvars->data[(*e).Capturedvars->Sup.len-1]), v);
	addfield_424608((*e).Obj, v);
	BeforeRet: ;
}

N_NIMCALL(NIM_BOOL, capturevar_429433)(toutercontext428022* o, tenv428020* top, tsym225846* local, tlineinfo195539 info) {
	NIM_BOOL result;
	tenv428020* it;
	result = 0;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				LOC5 = 0;
				LOC5 = contains_222837((*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_429006(local);
		if (LOC14) goto LA15;
		LOC14 = !(((257 &(1<<(((*(*(*top).Fn).Typ).Callconv)&15)))!=0));
		LA15: ;
		if (!LOC14) goto LA16;
		localerror_197955(info, ((NU16) 222), (*(*local).Name).S);
	}
	LA16: ;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA19;
			{
				NIM_BOOL LOC22;
				LOC22 = 0;
				LOC22 = contains_222837((*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_429421((*it).Obj, (*(*it).Up).Obj));
			}
			LA31: ;
			{
				tenv428020* 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_428962((*it).Fn, u);
				{
					tidobj200015* LOC43;
					TNimObject* LOC44;
					LOC43 = 0;
					LOC43 = &(*it).Fn->Sup;
					LOC44 = 0;
					LOC44 = idtableget_235182((*o).Lambdastoenv, LOC43);
					if (!(LOC44 == NIM_NIL)) goto LA45;
					{
						tidobj200015* LOC51;
						TNimObject* LOC52;
						if (!!((u == NIM_NIL))) goto LA49;
						LOC51 = 0;
						LOC51 = &(*it).Fn->Sup;
						LOC52 = 0;
						LOC52 = &u->Sup;
						idtableput_235196((&(*o).Lambdastoenv), LOC51, LOC52);
					}
					LA49: ;
				}
				LA45: ;
			}
			LA35: ;
			it = (*it).Up;
		} LA19: ;
	} LA18: ;
	incl_222869((&(*o).Capturedvars), (*local).Sup.Id);
	addcapturedvar_428818(it, local);
	result = NIM_TRUE;
	BeforeRet: ;
	return result;
}

N_NIMCALL(NI, gathervars_429721)(toutercontext428022* o, tenv428020* e, tnode225816* n) {
	NI result;
	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = 0;
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).Kind) {
	case ((NU8) 3):
	{
		tsym225846* s;
		s = (*n).kindU.S4.Sym;
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = interestingvar_429039(s);
			if (!(LOC8)) goto LA9;
			LOC8 = !(((*e).Fn == (*s).Owner));
			LA9: ;
			if (!LOC8) goto LA10;
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = capturevar_429433(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_429813;
			NI HEX3Atmp_429841;
			NI LOC20;
			NI res_429844;
			k_429813 = 0;
			HEX3Atmp_429841 = 0;
			LOC20 = 0;
			LOC20 = sonslen_226249(n);
			HEX3Atmp_429841 = (NI32)(LOC20 - 1);
			res_429844 = 0;
			{
				while (1) {
					NI LOC23;
					if (!(res_429844 <= HEX3Atmp_429841)) goto LA22;
					k_429813 = res_429844;
					LOC23 = 0;
					LOC23 = gathervars_429721(o, e, (*n).kindU.S6.Sons->data[k_429813]);
					result += LOC23;
					res_429844 += 1;
				} LA22: ;
			}
		}
	}
	break;
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(tsym225846*, newiterresult_428092)(tsym225846* iter) {
	tsym225846* result;
	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_226364((*iter).Ast);
		if (!(7 < LOC3)) goto LA4;
		result = (*(*(*iter).Ast).kindU.S6.Sons->data[7]).kindU.S4.Sym;
	}
	goto LA1;
	LA4: ;
	{
		tident200021* LOC7;
		tnode225816* LOC8;
		LOC7 = 0;
		LOC7 = getident_200472(((NimStringDesc*) &TMP3182));
		result = newsym_226074(((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_226132(result);
		add_226498((*iter).Ast, LOC8);
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, inititer_428412)(tsym225846* iter, titer428016* Result) {
	unsureAsgnRef((void**) (&(*Result).Fn), iter);
	{
		tsym225846* cp;
		tnode225816* LOC17;
		if (!((*iter).Kind == ((NU8) 15))) goto LA3;
		cp = getenvparam_428349(iter);
		{
			tident200021* LOC9;
			if (!(cp == NIM_NIL)) goto LA7;
			unsureAsgnRef((void**) (&(*Result).Obj), createenvobj_428082(iter));
			LOC9 = 0;
			LOC9 = getident_200472(((NimStringDesc*) &TMP3176));
			cp = newsym_226074(((NU8) 3), LOC9, iter, (*iter).Info);
			(*cp).Flags |= ((NI32)1)<<((((NU8) 2))%(sizeof(NI32)*8));
			asgnRefNoCycle((void**) (&(*cp).Typ), newtype_226083(((NU8) 22), iter));
			rawaddson_230562((*cp).Typ, (*Result).Obj);
			addhiddenparam_428147(iter, cp);
		}
		goto LA5;
		LA7: ;
		{
			unsureAsgnRef((void**) (&(*Result).Obj), (*(*cp).Typ).Sons->data[0]);
		}
		LA5: ;
		{
			NI LOC13;
			NimStringDesc* LOC16;
			LOC13 = 0;
			LOC13 = len_226364((*(*Result).Obj).N);
			if (!!((0 < LOC13))) goto LA14;
			LOC16 = 0;
			LOC16 = HEX24_198126(TMP3181);
			internalerror_198006(LOC16);
		}
		LA14: ;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_226698((*(*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_428092(iter));
		}
		LA20: ;
	}
	LA3: ;
}

N_NIMCALL(tnode225816*, newclosurecreationvar_429978)(tenv428020* e) {
	tnode225816* result;
	tsym225846* v;
	tident200021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_200472(((NimStringDesc*) &TMP3180));
	v = newsym_226074(((NU8) 8), LOC1, (*e).Fn, (*(*e).Attachednode).Info);
	(*v).Flags |= ((NI32)1)<<((((NU8) 21))%(sizeof(NI32)*8));
	asgnRefNoCycle((void**) (&(*v).Typ), newtype_226083(((NU8) 22), (*e).Fn));
	rawaddson_230562((*v).Typ, (*e).Obj);
	{
		titer428016 it;
		tnode225816* 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_428412((*e).Fn, (&it));
		adduniquefield_424807(it.Obj, v);
		LOC6 = 0;
		LOC6 = newsymnode_226132(it.Closureparam);
		result = indirectaccess_425848(LOC6, v, (*v).Info);
	}
	goto LA2;
	LA4: ;
	{
		result = newsymnode_226132(v);
	}
	LA2: ;
	return result;
}

N_NIMCALL(tnode225816*, getclosurevar_430015)(tenv428020* e) {
	tnode225816* result;
	result = 0;
	{
		if (!((*e).Createdvar == NIM_NIL)) goto LA3;
		result = newclosurecreationvar_429978(e);
		asgnRefNoCycle((void**) (&(*e).Createdvar), result);
	}
	goto LA1;
	LA3: ;
	{
		result = (*e).Createdvar;
	}
	LA1: ;
	return result;
}

N_NIMCALL(tenv428020*, findenv_430042)(toutercontext428022* o, tsym225846* s) {
	tenv428020* result;
	tenv428020* 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_198126(TMP3188);
		internalerror_198006(LOC13);
	}
	LA11: ;
	result = (*env).Up;
	{
		while (1) {
			if (!((*result).Fn == s)) goto LA15;
			result = (*result).Up;
		} LA15: ;
	}
	return result;
}

N_NIMCALL(tnode225816*, nestedaccess_429076)(tenv428020* top, tsym225846* local) {
	tnode225816* result;
	tenv428020* it;
	tsym225846* envparam;
	tnode225816* access;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_429039(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_222837((*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_428349((*top).Fn);
	{
		NimStringDesc* LOC23;
		if (!!(!(envparam == 0))) goto LA21;
		LOC23 = 0;
		LOC23 = HEX24_198126(TMP3189);
		internalerror_198006(LOC23);
	}
	LA21: ;
	access = newsymnode_226132(envparam);
	it = (*top).Up;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA25;
			{
				NIM_BOOL LOC28;
				LOC28 = 0;
				LOC28 = contains_222837((*it).Vars, (*local).Sup.Id);
				if (!LOC28) goto LA29;
				access = indirectaccess_425848(access, local, (*local).Info);
				result = access;
				goto BeforeRet;
			}
			LA29: ;
			{
				NimStringDesc* LOC35;
				if (!!(!(((*it).Upfield == NIM_NIL)))) goto LA33;
				LOC35 = 0;
				LOC35 = HEX24_198126(TMP3190);
				internalerror_198006(LOC35);
			}
			LA33: ;
			access = indirectaccess_425848(access, (*it).Upfield, (*local).Info);
			it = (*it).Up;
		} LA25: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode225816*, transforminnerproc_430192)(toutercontext428022* o, tenv428020* e, tnode225816* n) {
	tnode225816* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		tsym225846* s;
		s = (*n).kindU.S4.Sym;
		{
			tsym225846* LOC7;
			tnode225816* LOC8;
			if (!(s == (*e).Fn)) goto LA5;
			LOC7 = 0;
			LOC7 = getenvparam_428349(s);
			LOC8 = 0;
			LOC8 = newsymnode_226132(LOC7);
			result = makeclosure_429949(s, LOC8, (*n).Info);
		}
		goto LA3;
		LA5: ;
		{
			NIM_BOOL LOC10;
			tenv428020* LOC14;
			tnode225816* LOC15;
			LOC10 = 0;
			LOC10 = isinnerproc_428902(s, (*o).Fn);
			if (!(LOC10)) goto LA11;
			LOC10 = ((*(*s).Typ).Callconv == ((NU8) 8));
			LA11: ;
			if (!LOC10) goto LA12;
			LOC14 = 0;
			LOC14 = findenv_430042(o, s);
			LOC15 = 0;
			LOC15 = getclosurevar_430015(LOC14);
			result = makeclosure_429949(s, LOC15, (*n).Info);
		}
		goto LA3;
		LA12: ;
		{
			result = nestedaccess_429076(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_430290;
			NI HEX3Atmp_430338;
			NI LOC20;
			NI res_430341;
			j_430290 = 0;
			HEX3Atmp_430338 = 0;
			LOC20 = 0;
			LOC20 = sonslen_226249(n);
			HEX3Atmp_430338 = (NI32)(LOC20 - 1);
			res_430341 = 0;
			{
				while (1) {
					tnode225816* x;
					if (!(res_430341 <= HEX3Atmp_430338)) goto LA22;
					j_430290 = res_430341;
					x = transforminnerproc_430192(o, e, (*n).kindU.S6.Sons->data[j_430290]);
					{
						if (!!((x == NIM_NIL))) goto LA25;
						asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[j_430290]), x);
					}
					LA25: ;
					res_430341 += 1;
				} LA22: ;
			}
		}
	}
	break;
	}
	return result;
}

N_NIMCALL(void, searchforinnerprocs_430541)(toutercontext428022* o, tnode225816* n, tenv428020* 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):
	{
		tsym225846* fn;
		fn = (*n).kindU.S4.Sym;
		{
			NIM_BOOL LOC9;
			NIM_BOOL LOC11;
			tnode225816* body;
			tnode225816* ex;
			tenv428020* envb;
			NI capturedcounter;
			LOC9 = 0;
			LOC9 = isinnerproc_428902(fn, (*o).Fn);
			if (!(LOC9)) goto LA10;
			LOC11 = 0;
			LOC11 = containsorincl_222916((&(*o).Processed), (*fn).Sup.Id);
			LOC9 = !(LOC11);
			LA10: ;
			if (!LOC9) goto LA12;
			body = getbody_279270(fn);
			ex = closurecreationpoint_430358(body);
			envb = newenv_428675(o, env, ex, fn);
			addparamstoenv_430386(fn, envb);
			searchforinnerprocs_430541(o, body, envb);
			asgnRefNoCycle((void**) (&(*(*fn).Ast).kindU.S6.Sons->data[6]), ex);
			capturedcounter = gathervars_429721(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;
				{
					tidobj200015* LOC22;
					TNimObject* LOC23;
					tidobj200015* LOC26;
					TNimObject* LOC27;
					LOC22 = 0;
					LOC22 = &fn->Sup;
					LOC23 = 0;
					LOC23 = idtableget_235182((*o).Lambdastoenv, LOC22);
					if (!(LOC23 == NIM_NIL)) goto LA24;
					LOC26 = 0;
					LOC26 = &fn->Sup;
					LOC27 = 0;
					LOC27 = &env->Sup;
					idtableput_235196((&(*o).Lambdastoenv), LOC26, LOC27);
				}
				LA24: ;
				addclosureparam_428962(fn, env);
			}
			goto LA14;
			LA18: ;
			{
				tsym225846* LOC29;
				tnode225816* ti;
				LOC29 = 0;
				LOC29 = getenvparam_428349(fn);
				if (!!((LOC29 == NIM_NIL))) goto LA30;
				ti = transforminnerproc_430192(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_430541(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;
			tnode225816* ex;
			tenv428020* LOC50;
			if (!!(((*(*env).Fn).Kind == ((NU8) 15)))) goto LA44;
			LOC46 = 0;
			LOC46 = len_226364(n);
			body = (NI32)(LOC46 - 1);
			{
				NI i_430752;
				NI HEX3Atmp_431081;
				NI res_431084;
				i_430752 = 0;
				HEX3Atmp_431081 = 0;
				HEX3Atmp_431081 = (NI32)(body - 1);
				res_431084 = 0;
				{
					while (1) {
						if (!(res_431084 <= HEX3Atmp_431081)) goto LA49;
						i_430752 = res_431084;
						searchforinnerprocs_430541(o, (*n).kindU.S6.Sons->data[i_430752], env);
						res_431084 += 1;
					} LA49: ;
				}
			}
			ex = closurecreationpoint_430358((*n).kindU.S6.Sons->data[body]);
			LOC50 = 0;
			LOC50 = newenv_428675(o, env, ex, (*env).Fn);
			searchforinnerprocs_430541(o, (*n).kindU.S6.Sons->data[body], LOC50);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[body]), ex);
		}
		goto LA42;
		LA44: ;
		{
			{
				NI i_430822;
				NI HEX3Atmp_431087;
				NI LOC53;
				NI res_431090;
				i_430822 = 0;
				HEX3Atmp_431087 = 0;
				LOC53 = 0;
				LOC53 = sonslen_226249(n);
				HEX3Atmp_431087 = (NI32)(LOC53 - 1);
				res_431090 = 0;
				{
					while (1) {
						if (!(res_431090 <= HEX3Atmp_431087)) goto LA55;
						i_430822 = res_431090;
						searchforinnerprocs_430541(o, (*n).kindU.S6.Sons->data[i_430822], env);
						res_431090 += 1;
					} LA55: ;
				}
			}
		}
		LA42: ;
	}
	break;
	case ((NU8) 99):
	case ((NU8) 100):
	{
		{
			NI i_430849;
			NI HEX3Atmp_431099;
			NI LOC58;
			NI res_431102;
			i_430849 = 0;
			HEX3Atmp_431099 = 0;
			LOC58 = 0;
			LOC58 = sonslen_226249(n);
			HEX3Atmp_431099 = (NI32)(LOC58 - 1);
			res_431102 = 0;
			{
				while (1) {
					tnode225816* it;
					if (!(res_431102 <= HEX3Atmp_431099)) goto LA60;
					i_430849 = res_431102;
					it = (*n).kindU.S6.Sons->data[i_430849];
					{
						if (!((*it).Kind == ((NU8) 125))) goto LA63;
					}
					goto LA61;
					LA63: ;
					{
						NI l;
						if (!((*it).Kind == ((NU8) 35))) goto LA66;
						l = sonslen_226249(it);
						{
							if (!((*(*it).kindU.S6.Sons->data[0]).Kind == ((NU8) 3))) goto LA70;
							incl_222869((&(*env).Vars), (*(*(*it).kindU.S6.Sons->data[0]).kindU.S4.Sym).Sup.Id);
						}
						LA70: ;
						searchforinnerprocs_430541(o, (*it).kindU.S6.Sons->data[(NI32)(l - 1)], env);
					}
					goto LA61;
					LA66: ;
					{
						NI l;
						if (!((*it).Kind == ((NU8) 36))) goto LA73;
						l = sonslen_226249(it);
						{
							NI j_430972;
							NI HEX3Atmp_431094;
							NI res_431097;
							j_430972 = 0;
							HEX3Atmp_431094 = 0;
							HEX3Atmp_431094 = (NI32)(l - 3);
							res_431097 = 0;
							{
								while (1) {
									if (!(res_431097 <= HEX3Atmp_431094)) goto LA77;
									j_430972 = res_431097;
									{
										if (!((*(*it).kindU.S6.Sons->data[j_430972]).Kind == ((NU8) 3))) goto LA80;
										incl_222869((&(*env).Vars), (*(*(*it).kindU.S6.Sons->data[j_430972]).kindU.S4.Sym).Sup.Id);
									}
									LA80: ;
									res_431097 += 1;
								} LA77: ;
							}
						}
						searchforinnerprocs_430541(o, (*it).kindU.S6.Sons->data[(NI32)(l - 1)], env);
					}
					goto LA61;
					LA73: ;
					{
						internalerror_197987((*it).Info, ((NimStringDesc*) &TMP3191));
					}
					LA61: ;
					res_431102 += 1;
				} LA60: ;
			}
		}
	}
	break;
	case ((NU8) 154):
	{
		searchforinnerprocs_430541(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_431065;
			NI HEX3Atmp_431105;
			NI LOC87;
			NI res_431108;
			i_431065 = 0;
			HEX3Atmp_431105 = 0;
			LOC87 = 0;
			LOC87 = sonslen_226249(n);
			HEX3Atmp_431105 = (NI32)(LOC87 - 1);
			res_431108 = 0;
			{
				while (1) {
					if (!(res_431108 <= HEX3Atmp_431105)) goto LA89;
					i_431065 = res_431108;
					searchforinnerprocs_430541(o, (*n).kindU.S6.Sons->data[i_431065], env);
					res_431108 += 1;
				} LA89: ;
			}
		}
	}
	break;
	}
	BeforeRet: ;
}

N_NIMCALL(tnode225816*, newasgnstmt_431161)(tnode225816* le, tnode225816* ri, tlineinfo195539 info) {
	tnode225816* result;
	result = 0;
	result = newnodei_228007(((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(tnode225816*, rawclosurecreation_431201)(toutercontext428022* o, tenv428020* scope, tnode225816* env) {
	tnode225816* result;
	tsym225846* LOC5;
	tnode225816* LOC6;
	result = 0;
	result = newnodei_226138(((NU8) 115), (*env).Info);
	{
		tnode225816* v;
		if (!((*env).Kind == ((NU8) 3))) goto LA3;
		v = newnodei_226138(((NU8) 99), (*env).Info);
		addvar_424053(v, env);
		add_226498(result, v);
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = getsyssym_282054(((NimStringDesc*) &TMP3137));
	LOC6 = 0;
	LOC6 = newcall_428891(LOC5, env);
	add_226498(result, LOC6);
	{
		tsym225846* local_431229;
		tsymseq225818* HEX3Atmp_431287;
		NI i_431290;
		NI l_431292;
		local_431229 = 0;
		HEX3Atmp_431287 = 0;
		HEX3Atmp_431287 = (*scope).Capturedvars;
		i_431290 = 0;
		l_431292 = HEX3Atmp_431287->Sup.len;
		{
			while (1) {
				tnode225816* fieldaccess;
				tnode225816* existing;
				tidobj200015* LOC16;
				if (!(i_431290 < l_431292)) goto LA9;
				local_431229 = HEX3Atmp_431287->data[i_431290];
				fieldaccess = indirectaccess_425848(env, local_431229, (*env).Info);
				{
					tnode225816* LOC14;
					tnode225816* LOC15;
					if (!((*local_431229).Kind == ((NU8) 3))) goto LA12;
					LOC14 = 0;
					LOC14 = newsymnode_226132(local_431229);
					LOC15 = 0;
					LOC15 = newasgnstmt_431161(fieldaccess, LOC14, (*env).Info);
					add_226498(result, LOC15);
				}
				LA12: ;
				LOC16 = 0;
				LOC16 = &local_431229->Sup;
				existing = idnodetableget_235212((*o).Localstoaccess, LOC16);
				{
					tidobj200015* LOC21;
					if (!existing == 0) goto LA19;
					LOC21 = 0;
					LOC21 = &local_431229->Sup;
					idnodetableput_235219((&(*o).Localstoaccess), LOC21, fieldaccess);
				}
				goto LA17;
				LA19: ;
				{
					tnode225816* LOC23;
					LOC23 = 0;
					LOC23 = newasgnstmt_431161(fieldaccess, existing, (*env).Info);
					add_226498(result, LOC23);
				}
				LA17: ;
				i_431290 += 1;
			} LA9: ;
		}
	}
	{
		if (!!(((*scope).Upfield == NIM_NIL))) goto LA26;
		{
			tnode225816* LOC32;
			tsym225846* LOC33;
			tnode225816* LOC34;
			tnode225816* LOC35;
			if (!!(((*(*scope).Up).Fn == (*scope).Fn))) goto LA30;
			LOC32 = 0;
			LOC32 = indirectaccess_425848(env, (*scope).Upfield, (*env).Info);
			LOC33 = 0;
			LOC33 = getenvparam_428349((*scope).Fn);
			LOC34 = 0;
			LOC34 = newsymnode_226132(LOC33);
			LOC35 = 0;
			LOC35 = newasgnstmt_431161(LOC32, LOC34, (*env).Info);
			add_226498(result, LOC35);
		}
		goto LA28;
		LA30: ;
		{
			tnode225816* LOC37;
			tnode225816* LOC38;
			tnode225816* LOC39;
			LOC37 = 0;
			LOC37 = indirectaccess_425848(env, (*scope).Upfield, (*env).Info);
			LOC38 = 0;
			LOC38 = getclosurevar_430015((*scope).Up);
			LOC39 = 0;
			LOC39 = newasgnstmt_431161(LOC37, LOC38, (*env).Info);
			add_226498(result, LOC39);
		}
		LA28: ;
	}
	LA26: ;
	return result;
}

N_NIMCALL(tnode225816*, generateclosurecreation_431308)(toutercontext428022* o, tenv428020* scope) {
	tnode225816* result;
	tnode225816* env;
	result = 0;
	env = getclosurevar_430015(scope);
	result = rawclosurecreation_431201(o, scope, env);
	return result;
}

N_NIMCALL(void, createenvironments_432610)(toutercontext428022* o) {
	tenv428020* env;
	env = (*o).Head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				tnode225816* 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_431308(o, env));
				}
				LA11: ;
			}
			LA7: ;
			env = (*env).Next;
		} LA2: ;
	}
}

static N_INLINE(NIM_BOOL, interestingitervar_431446)(tsym225846* 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(tnode225816*, liftitersym_432255)(tnode225816* n) {
	tnode225816* result;
	tsym225846* iter;
	tsym225846* env;
	tsym225846* LOC1;
	tnode225816* v;
	tnode225816* LOC2;
	tnode225816* envasnode;
	tsym225846* LOC3;
	tnode225816* LOC4;
	tnode225816* LOC5;
	result = 0;
	iter = (*n).kindU.S4.Sym;
	result = newnodeit_226145(((NU8) 126), (*n).Info, (*n).Typ);
	LOC1 = 0;
	LOC1 = gethiddenparam_428238(iter);
	env = copysym_226203(LOC1, NIM_FALSE);
	(*env).Kind = ((NU8) 9);
	v = newnodei_226138(((NU8) 99), (*n).Info);
	LOC2 = 0;
	LOC2 = newsymnode_226132(env);
	addvar_424053(v, LOC2);
	add_226498(result, v);
	envasnode = newsymnode_226132(env);
	LOC3 = 0;
	LOC3 = getsyssym_282054(((NimStringDesc*) &TMP3137));
	LOC4 = 0;
	LOC4 = newcall_428891(LOC3, envasnode);
	add_226498(result, LOC4);
	LOC5 = 0;
	LOC5 = makeclosure_429949(iter, envasnode, (*n).Info);
	add_226498(result, LOC5);
	return result;
}

N_NIMCALL(tnode225816*, generateiterclosurecreation_431320)(toutercontext428022* o, tenv428020* env, tnode225816* scope) {
	tnode225816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		tnode225816* cc;
		tnode225816* insertpoint;
		LOC3 = 0;
		LOC3 = (*env).Createdvarcomesfromiter;
		if (LOC3) goto LA4;
		LOC3 = (*env).Createdvar == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = newclosurecreationvar_429978(env);
		cc = rawclosurecreation_431201(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: ;
		{
			{
				tnode225816* x_431401;
				x_431401 = 0;
				{
					NI i_431423;
					NI HEX3Atmp_431425;
					NI LOC14;
					NI res_431427;
					i_431423 = 0;
					HEX3Atmp_431425 = 0;
					LOC14 = 0;
					LOC14 = len_226364(cc);
					HEX3Atmp_431425 = (LOC14 - 1);
					res_431427 = 0;
					{
						while (1) {
							if (!(res_431427 <= HEX3Atmp_431425)) goto LA16;
							i_431423 = res_431427;
							x_431401 = (*cc).kindU.S6.Sons->data[i_431423];
							add_226498(insertpoint, x_431401);
							res_431427 += 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(tnode225816*, generatethunk_429861)(tnode225816* prc, ttype225852* dest) {
	tnode225816* result;
	tnode225816* conv;
	ttype225852* LOC5;
	tnode225816* LOC6;
	result = 0;
	{
		if (!(gcmd_169120 == ((NU8) 4))) goto LA3;
		result = prc;
		goto BeforeRet;
	}
	LA3: ;
	result = newnodeit_226145(((NU8) 154), (*prc).Info, dest);
	conv = newnodeit_226145(((NU8) 58), (*prc).Info, dest);
	add_226498(conv, emptynode_226738);
	add_226498(conv, prc);
	add_226498(result, conv);
	LOC5 = 0;
	LOC5 = getsystype_282030(((NU8) 5));
	LOC6 = 0;
	LOC6 = newnodeit_226145(((NU8) 23), (*prc).Info, LOC5);
	add_226498(result, LOC6);
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode225816*, transformouterconv_429882)(tnode225816* n) {
	tnode225816* result;
	ttype225852* dest;
	ttype225852* source;
	result = 0;
	dest = skiptypes_230245((*n).Typ, IL64(211106242013440));
	source = skiptypes_230245((*(*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_429861((*n).kindU.S6.Sons->data[1], dest);
		}
		LA9: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(tnode225816*, transformyield_431491)(toutercontext428022* c, tnode225816* n, titer428016* it) {
	tnode225816* result;
	NI64 stateno;
	tnode225816* stateasgnstmt;
	tnode225816* LOC1;
	tnode225816* LOC2;
	ttype225852* LOC3;
	tnode225816* LOC4;
	tnode225816* retstmt;
	tnode225816* statelabelstmt;
	ttype225852* LOC17;
	tnode225816* 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_226138(((NU8) 73), (*n).Info);
	LOC1 = 0;
	LOC1 = newsymnode_226132((*it).Closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_424407(LOC1, (*it).State, (*n).Info);
	add_226498(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_282030(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_226103(((NU8) 6), stateno, LOC3);
	add_226498(stateasgnstmt, LOC4);
	retstmt = newnodei_226138(((NU8) 109), (*n).Info);
	{
		tnode225816* a;
		tnode225816* retval;
		tnode225816* LOC9;
		tnode225816* LOC10;
		if (!!(((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 1)))) goto LA7;
		a = newnodei_226138(((NU8) 73), (*(*n).kindU.S6.Sons->data[0]).Info);
		retval = transformouterproc_431483(c, (*n).kindU.S6.Sons->data[0], it);
		LOC9 = 0;
		LOC9 = newsymnode_226132((*it).Resultsym);
		addson_226287(a, LOC9);
		LOC10 = 0;
		{
			if (!retval == 0) goto LA13;
			LOC10 = (*n).kindU.S6.Sons->data[0];
		}
		goto LA11;
		LA13: ;
		{
			LOC10 = retval;
		}
		LA11: ;
		addson_226287(a, LOC10);
		add_226498(retstmt, a);
	}
	goto LA5;
	LA7: ;
	{
		add_226498(retstmt, emptynode_226738);
	}
	LA5: ;
	statelabelstmt = newnodei_226138(((NU8) 156), (*n).Info);
	LOC17 = 0;
	LOC17 = getsystype_282030(((NU8) 31));
	LOC18 = 0;
	LOC18 = newinttypenode_226103(((NU8) 6), stateno, LOC17);
	add_226498(statelabelstmt, LOC18);
	result = newnodei_226138(((NU8) 115), (*n).Info);
	add_226498(result, stateasgnstmt);
	add_226498(result, retstmt);
	add_226498(result, statelabelstmt);
	return result;
}

N_NIMCALL(void, outerprocsons_432170)(toutercontext428022* o, tnode225816* n, titer428016* it) {
	{
		NI i_432187;
		NI HEX3Atmp_432235;
		NI LOC2;
		NI res_432238;
		i_432187 = 0;
		HEX3Atmp_432235 = 0;
		LOC2 = 0;
		LOC2 = sonslen_226249(n);
		HEX3Atmp_432235 = (NI32)(LOC2 - 1);
		res_432238 = 0;
		{
			while (1) {
				tnode225816* x;
				if (!(res_432238 <= HEX3Atmp_432235)) goto LA4;
				i_432187 = res_432238;
				x = transformouterproc_431483(o, (*n).kindU.S6.Sons->data[i_432187], it);
				{
					if (!!((x == NIM_NIL))) goto LA7;
					asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[i_432187]), x);
				}
				LA7: ;
				res_432238 += 1;
			} LA4: ;
		}
	}
}

N_NIMCALL(tnode225816*, transformreturn_432157)(toutercontext428022* c, tnode225816* n, titer428016* it) {
	tnode225816* result;
	tnode225816* stateasgnstmt;
	tnode225816* LOC1;
	tnode225816* LOC2;
	ttype225852* LOC3;
	tnode225816* LOC4;
	result = 0;
	result = newnodei_226138(((NU8) 115), (*n).Info);
	stateasgnstmt = newnodei_226138(((NU8) 73), (*n).Info);
	LOC1 = 0;
	LOC1 = newsymnode_226132((*it).Closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_424407(LOC1, (*it).State, (*n).Info);
	add_226498(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_282030(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_226103(((NU8) 6), IL64(-1), LOC3);
	add_226498(stateasgnstmt, LOC4);
	add_226498(result, stateasgnstmt);
	add_226498(result, n);
	return result;
}

N_NIMCALL(tnode225816*, transformouterproc_431483)(toutercontext428022* o, tnode225816* n, titer428016* it) {
	tnode225816* 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):
	{
		tsym225846* local;
		tenv428020* closure;
		tidobj200015* LOC36;
		TNimObject* LOC37;
		tidobj200015* LOC71;
		local = (*n).kindU.S4.Sym;
		{
			NIM_BOOL LOC11;
			tnode225816* body;
			tnode225816* newbody;
			titer428016 LOC15;
			LOC11 = 0;
			LOC11 = isinnerproc_428902(local, (*o).Fn);
			if (!(LOC11)) goto LA12;
			LOC11 = contains_222837((*o).Processed, (*local).Sup.Id);
			LA12: ;
			if (!LOC11) goto LA13;
			excl_222884((&(*o).Processed), (*local).Sup.Id);
			body = getbody_279270(local);
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_428412(local, (&LOC15));
			newbody = transformouterprocbody_433214(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_431446(local);
			LA24: ;
			LOC22 = LOC23;
			if (!(LOC22)) goto LA25;
			LOC22 = ((*it).Fn == (*local).Owner);
			LA25: ;
			if (!LOC22) goto LA26;
			{
				NIM_BOOL LOC30;
				tidobj200015* LOC33;
				LOC30 = 0;
				LOC30 = contains_222837((*o).Capturedvars, (*local).Sup.Id);
				if (!LOC30) goto LA31;
				LOC33 = 0;
				LOC33 = &local->Sup;
				result = idnodetableget_235212((*o).Localstoaccess, LOC33);
				goto BeforeRet;
			}
			goto LA28;
			LA31: ;
			{
				tnode225816* LOC35;
				adduniquefield_424807((*it).Obj, local);
				LOC35 = 0;
				LOC35 = newsymnode_226132((*it).Closureparam);
				result = indirectaccess_425848(LOC35, local, (*n).Info);
				goto BeforeRet;
			}
			LA28: ;
		}
		LA26: ;
		LOC36 = 0;
		LOC36 = &local->Sup;
		LOC37 = 0;
		LOC37 = idtableget_235182((*o).Lambdastoenv, LOC36);
		closure = ((tenv428020*) (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_197976((*n).Info, ((NU16) 25), (*(*local).Name).S);
			}
			LA46: ;
			{
				if (!closure == 0) goto LA50;
				result = liftitersym_432255(n);
				goto BeforeRet;
			}
			goto LA48;
			LA50: ;
			{
				tnode225816* createdvar;
				createdvar = generateiterclosurecreation_431320(o, closure, (*closure).Attachednode);
				result = makeclosure_429949(local, createdvar, (*n).Info);
				goto BeforeRet;
			}
			LA48: ;
		}
		LA40: ;
		{
			tnode225816* a;
			if (!!((closure == NIM_NIL))) goto LA55;
			a = (*closure).Createdvar;
			{
				if (!!((a == NIM_NIL))) goto LA59;
				result = makeclosure_429949(local, a, (*n).Info);
				goto BeforeRet;
			}
			goto LA57;
			LA59: ;
			{
				tnode225816* scope;
				tnode225816* 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_431308(o, closure));
				}
				LA64: ;
				x = (*closure).Createdvar;
				result = makeclosure_429949(local, x, (*n).Info);
				goto BeforeRet;
			}
			LA57: ;
		}
		LA55: ;
		{
			NIM_BOOL LOC68;
			LOC68 = 0;
			LOC68 = contains_222837((*o).Capturedvars, (*local).Sup.Id);
			if (!!(LOC68)) goto LA69;
			goto BeforeRet;
		}
		LA69: ;
		LOC71 = 0;
		LOC71 = &local->Sup;
		result = idnodetableget_235212((*o).Localstoaccess, LOC71);
	}
	break;
	case ((NU8) 51):
	case ((NU8) 84):
	case ((NU8) 52):
	{
		{
			if (!!(((*n).Typ == NIM_NIL))) goto LA75;
			result = transformouterproc_431483(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):
	{
		{
			tsym225846* 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;
				tnode225816* body;
				tnode225816* newbody;
				titer428016 LOC89;
				LOC85 = 0;
				LOC85 = isinnerproc_428902(local, (*o).Fn);
				if (!(LOC85)) goto LA86;
				LOC85 = contains_222837((*o).Processed, (*local).Sup.Id);
				LA86: ;
				if (!LOC85) goto LA87;
				excl_222884((&(*o).Processed), (*local).Sup.Id);
				body = getbody_279270(local);
				memset((void*)(&LOC89), 0, sizeof(LOC89));
				inititer_428412(local, (&LOC89));
				newbody = transformouterprocbody_433214(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):
	{
		tnode225816* x;
		x = transformouterproc_431483(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_429882(n);
	}
	break;
	case ((NU8) 104):
	{
		{
			if (!((*(*it).Fn).Kind == ((NU8) 15))) goto LA102;
			result = transformyield_431491(o, n, it);
		}
		goto LA100;
		LA102: ;
		{
			outerprocsons_432170(o, n, it);
		}
		LA100: ;
	}
	break;
	case ((NU8) 109):
	{
		{
			if (!((*(*it).Fn).Kind == ((NU8) 15))) goto LA108;
			result = transformreturn_432157(o, n, it);
		}
		goto LA106;
		LA108: ;
		{
			outerprocsons_432170(o, n, it);
		}
		LA106: ;
	}
	break;
	default:
	{
		outerprocsons_432170(o, n, it);
	}
	break;
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode225816*, transformouterprocbody_433214)(toutercontext428022* o, tnode225816* n, titer428016* it) {
	tnode225816* result;
	result = 0;
	{
		if (!(((*n).Flags &(1<<((((NU8) 7))&15)))!=0)) goto LA3;
		result = NIM_NIL;
	}
	goto LA1;
	LA3: ;
	{
		tnode225816* gs;
		tnode225816* LOC35;
		tnode225816* LOC36;
		tnode225816* state0;
		tnode225816* LOC37;
		tnode225816* newbody;
		tnode225816* stateasgnstmt;
		tnode225816* LOC43;
		tnode225816* LOC44;
		ttype225852* LOC45;
		tnode225816* 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_226364(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;
				tnode225816* LOC26;
				tnode225816* LOC28;
				NI LOC29;
				tnode225816* LOC31;
				tnode225816* LOC32;
				LOC21 = 0;
				LOC22 = 0;
				LOC23 = 0;
				LOC24 = 0;
				LOC24 = len_226364(n);
				LOC23 = (1 < LOC24);
				if (!(LOC23)) goto LA25;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_226698(n, 1);
				LOC23 = ((*LOC26).Kind == ((NU8) 115));
				LA25: ;
				LOC22 = LOC23;
				if (!(LOC22)) goto LA27;
				LOC28 = 0;
				LOC28 = HEX5BHEX5D_226698(n, 1);
				LOC29 = 0;
				LOC29 = len_226364(LOC28);
				LOC22 = (0 < LOC29);
				LA27: ;
				LOC21 = LOC22;
				if (!(LOC21)) goto LA30;
				LOC31 = 0;
				LOC31 = HEX5BHEX5D_226698(n, 1);
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_226698(LOC31, 0);
				LOC21 = ((*LOC32).Kind == ((NU8) 155));
				LA30: ;
				if (!LOC21) goto LA33;
				result = NIM_NIL;
				goto BeforeRet;
			}
			LA33: ;
		}
		LA13: ;
		result = newnodei_226138(((NU8) 115), (*(*it).Fn).Info);
		gs = newnodei_226138(((NU8) 155), (*(*it).Fn).Info);
		LOC35 = 0;
		LOC35 = newsymnode_226132((*it).Closureparam);
		LOC36 = 0;
		LOC36 = rawindirectaccess_424407(LOC35, (*it).State, (*(*it).Fn).Info);
		add_226498(gs, LOC36);
		add_226498(result, gs);
		state0 = newnodei_226138(((NU8) 156), (*(*it).Fn).Info);
		LOC37 = 0;
		LOC37 = newintnode_226096(((NU8) 6), IL64(0));
		add_226498(state0, LOC37);
		add_226498(result, state0);
		newbody = transformouterproc_431483(o, n, it);
		{
			if (!!((newbody == NIM_NIL))) goto LA40;
			add_226498(result, newbody);
		}
		goto LA38;
		LA40: ;
		{
			add_226498(result, n);
		}
		LA38: ;
		stateasgnstmt = newnodei_226138(((NU8) 73), (*(*it).Fn).Info);
		LOC43 = 0;
		LOC43 = newsymnode_226132((*it).Closureparam);
		LOC44 = 0;
		LOC44 = rawindirectaccess_424407(LOC43, (*it).State, (*(*it).Fn).Info);
		add_226498(stateasgnstmt, LOC44);
		LOC45 = 0;
		LOC45 = getsystype_282030(((NU8) 31));
		LOC46 = 0;
		LOC46 = newinttypenode_226103(((NU8) 6), IL64(-1), LOC45);
		add_226498(stateasgnstmt, LOC46);
		add_226498(result, stateasgnstmt);
		(*result).Flags |= ((NI16)1)<<((((NU8) 7))%(sizeof(NI16)*8));
	}
	goto LA1;
	LA6: ;
	{
		result = transformouterproc_431483(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_432837)(toutercontext428022* o) {
	tenv428020* env;
	env = (*o).Head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				tnode225816* 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(tnode225816*, liftlambdas_434871)(tsym225846* fn, tnode225816* body) {
	tnode225816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		tsym225846* LOC7;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*body).Kind == ((NU8) 1));
		if (LOC4) goto LA5;
		LOC4 = (gcmd_169120 == ((NU8) 4));
		LA5: ;
		LOC3 = LOC4;
		if (LOC3) goto LA6;
		LOC7 = 0;
		LOC7 = skipgenericowner_232698(fn);
		LOC3 = !(((*LOC7).Kind == ((NU8) 6)));
		LA6: ;
		if (!LOC3) goto LA8;
		result = body;
	}
	goto LA1;
	LA8: ;
	{
		toutercontext428022* o;
		tnode225816* ex;
		tenv428020* env;
		o = newoutercontext_428647(fn);
		ex = closurecreationpoint_430358(body);
		env = newenv_428675(o, NIM_NIL, ex, fn);
		addparamstoenv_430386(fn, env);
		searchforinnerprocs_430541(o, body, env);
		createenvironments_432610(o);
		{
			titer428016 LOC15;
			if (!((*fn).Kind == ((NU8) 15))) goto LA13;
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_428412(fn, (&LOC15));
			result = transformouterprocbody_433214(o, body, (&LOC15));
		}
		goto LA11;
		LA13: ;
		{
			titer428016 LOC17;
			tnode225816* LOC18;
			memset((void*)(&LOC17), 0, sizeof(LOC17));
			inititer_428412(fn, (&LOC17));
			LOC18 = 0;
			LOC18 = transformouterprocbody_433214(o, body, (&LOC17));
			result = ex;
		}
		LA11: ;
		finishenvironments_432837(o);
	}
	LA1: ;
	return result;
}

N_NIMCALL(tnode225816*, liftlambdasfortoplevel_434921)(tsym225846* module, tnode225816* body) {
	tnode225816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*body).Kind == ((NU8) 1));
		if (LOC3) goto LA4;
		LOC3 = (gcmd_169120 == ((NU8) 4));
		LA4: ;
		if (!LOC3) goto LA5;
		result = body;
	}
	goto LA1;
	LA5: ;
	{
		toutercontext428022* o;
		tnode225816* ex;
		tenv428020* env;
		titer428016 LOC8;
		tnode225816* LOC9;
		o = newoutercontext_428647(module);
		ex = closurecreationpoint_430358(body);
		env = newenv_428675(o, NIM_NIL, ex, module);
		searchforinnerprocs_430541(o, body, env);
		createenvironments_432610(o);
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		inititer_428412(module, (&LOC8));
		LOC9 = 0;
		LOC9 = transformouterproc_431483(o, body, (&LOC8));
		finishenvironments_432837(o);
		result = ex;
	}
	LA1: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, HEX00_lambdaliftingInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, HEX00_lambdaliftingDatInit)(void) {
static TNimNode* TMP3172[6];
static TNimNode* TMP3173[11];
static TNimNode TMP932[19];
NTI428022.size = sizeof(toutercontext428022);
NTI428022.kind = 18;
NTI428022.base = 0;
TMP3172[0] = &TMP932[1];
TMP932[1].kind = 1;
TMP932[1].offset = offsetof(toutercontext428022, Fn);
TMP932[1].typ = (&NTI225814);
TMP932[1].name = "fn";
TMP3172[1] = &TMP932[2];
NTI428020.size = sizeof(tenv428020);
NTI428020.kind = 17;
NTI428020.base = (&NTI3211);
TMP3173[0] = &TMP932[4];
TMP932[4].kind = 1;
TMP932[4].offset = offsetof(tenv428020, Attachednode);
TMP932[4].typ = (&NTI225808);
TMP932[4].name = "attachedNode";
TMP3173[1] = &TMP932[5];
TMP932[5].kind = 1;
TMP932[5].offset = offsetof(tenv428020, Replacementnode);
TMP932[5].typ = (&NTI225808);
TMP932[5].name = "replacementNode";
TMP3173[2] = &TMP932[6];
TMP932[6].kind = 1;
TMP932[6].offset = offsetof(tenv428020, Createdvar);
TMP932[6].typ = (&NTI225808);
TMP932[6].name = "createdVar";
TMP3173[3] = &TMP932[7];
TMP932[7].kind = 1;
TMP932[7].offset = offsetof(tenv428020, Createdvarcomesfromiter);
TMP932[7].typ = (&NTI138);
TMP932[7].name = "createdVarComesFromIter";
TMP3173[4] = &TMP932[8];
TMP932[8].kind = 1;
TMP932[8].offset = offsetof(tenv428020, Capturedvars);
TMP932[8].typ = (&NTI225818);
TMP932[8].name = "capturedVars";
TMP3173[5] = &TMP932[9];
TMP932[9].kind = 1;
TMP932[9].offset = offsetof(tenv428020, Up);
TMP932[9].typ = (&NTI428018);
TMP932[9].name = "up";
TMP3173[6] = &TMP932[10];
TMP932[10].kind = 1;
TMP932[10].offset = offsetof(tenv428020, Next);
TMP932[10].typ = (&NTI428018);
TMP932[10].name = "next";
TMP3173[7] = &TMP932[11];
TMP932[11].kind = 1;
TMP932[11].offset = offsetof(tenv428020, Upfield);
TMP932[11].typ = (&NTI225814);
TMP932[11].name = "upField";
TMP3173[8] = &TMP932[12];
TMP932[12].kind = 1;
TMP932[12].offset = offsetof(tenv428020, Obj);
TMP932[12].typ = (&NTI225812);
TMP932[12].name = "obj";
TMP3173[9] = &TMP932[13];
TMP932[13].kind = 1;
TMP932[13].offset = offsetof(tenv428020, Fn);
TMP932[13].typ = (&NTI225814);
TMP932[13].name = "fn";
TMP3173[10] = &TMP932[14];
TMP932[14].kind = 1;
TMP932[14].offset = offsetof(tenv428020, Vars);
TMP932[14].typ = (&NTI222056);
TMP932[14].name = "vars";
TMP932[3].len = 11; TMP932[3].kind = 2; TMP932[3].sons = &TMP3173[0];
NTI428020.node = &TMP932[3];
NTI428018.size = sizeof(tenv428020*);
NTI428018.kind = 22;
NTI428018.base = (&NTI428020);
NTI428018.marker = TMP3174;
TMP932[2].kind = 1;
TMP932[2].offset = offsetof(toutercontext428022, Head);
TMP932[2].typ = (&NTI428018);
TMP932[2].name = "head";
TMP3172[2] = &TMP932[15];
TMP932[15].kind = 1;
TMP932[15].offset = offsetof(toutercontext428022, Capturedvars);
TMP932[15].typ = (&NTI222056);
TMP932[15].name = "capturedVars";
TMP3172[3] = &TMP932[16];
TMP932[16].kind = 1;
TMP932[16].offset = offsetof(toutercontext428022, Processed);
TMP932[16].typ = (&NTI222056);
TMP932[16].name = "processed";
TMP3172[4] = &TMP932[17];
TMP932[17].kind = 1;
TMP932[17].offset = offsetof(toutercontext428022, Localstoaccess);
TMP932[17].typ = (&NTI225870);
TMP932[17].name = "localsToAccess";
TMP3172[5] = &TMP932[18];
TMP932[18].kind = 1;
TMP932[18].offset = offsetof(toutercontext428022, Lambdastoenv);
TMP932[18].typ = (&NTI225864);
TMP932[18].name = "lambdasToEnv";
TMP932[0].len = 6; TMP932[0].kind = 2; TMP932[0].sons = &TMP3172[0];
NTI428022.node = &TMP932[0];
NTI428014.size = sizeof(toutercontext428022*);
NTI428014.kind = 22;
NTI428014.base = (&NTI428022);
NTI428014.marker = TMP3175;
}

