/* 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 tsym226846 tsym226846;
typedef struct tidobj201015 tidobj201015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct ttypeseq226848 ttypeseq226848;
typedef struct ttype226852 ttype226852;
typedef struct TGenericSeq TGenericSeq;
typedef struct tscope226840 tscope226840;
typedef struct TY226947 TY226947;
typedef struct tinstantiation226836 tinstantiation226836;
typedef struct tstrtable226820 tstrtable226820;
typedef struct tsymseq226818 tsymseq226818;
typedef struct tident201021 tident201021;
typedef struct tlineinfo196539 tlineinfo196539;
typedef struct tnode226816 tnode226816;
typedef struct tloc226830 tloc226830;
typedef struct trope178009 trope178009;
typedef struct tlib226834 tlib226834;
typedef struct NimStringDesc NimStringDesc;
typedef struct tnodeseq226810 tnodeseq226810;
typedef struct TY86345 TY86345;
typedef struct tcell44733 tcell44733;
typedef struct tcellseq44749 tcellseq44749;
typedef struct tgcheap46816 tgcheap46816;
typedef struct tcellset44745 tcellset44745;
typedef struct tpagedesc44741 tpagedesc44741;
typedef struct tmemregion27010 tmemregion27010;
typedef struct tsmallchunk26240 tsmallchunk26240;
typedef struct tllchunk27004 tllchunk27004;
typedef struct tbigchunk26242 tbigchunk26242;
typedef struct tintset26217 tintset26217;
typedef struct ttrunk26213 ttrunk26213;
typedef struct tavlnode27008 tavlnode27008;
typedef struct tgcstat46814 tgcstat46814;
typedef struct toutercontext429022 toutercontext429022;
typedef struct tenv429020 tenv429020;
typedef struct intset223056 intset223056;
typedef struct ttrunk223052 ttrunk223052;
typedef struct ttrunkseq223054 ttrunkseq223054;
typedef struct tidnodetable226870 tidnodetable226870;
typedef struct tidnodepairseq226868 tidnodepairseq226868;
typedef struct tidnodepair226866 tidnodepair226866;
typedef struct tidtable226864 tidtable226864;
typedef struct tidpairseq226862 tidpairseq226862;
typedef struct tidpair226860 tidpair226860;
typedef struct titer429016 titer429016;
typedef struct TY226936 TY226936;
typedef struct tlistentry129022 tlistentry129022;
typedef struct tbasechunk26238 tbasechunk26238;
typedef struct tfreecell26230 tfreecell26230;
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  tidobj201015  {
  TNimObject Sup;
NI Id;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  tstrtable226820  {
NI Counter;
tsymseq226818* Data;
};
struct  tlineinfo196539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  tloc226830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype226852* T;
trope178009* R;
trope178009* Heaproot;
};
struct  tsym226846  {
  tidobj201015 Sup;
NU8 Kind;
union {
struct {ttypeseq226848* Typeinstcache;
tscope226840* Typscope;
} S1;
struct {TY226947* Procinstcache;
tscope226840* Scope;
} S2;
struct {TY226947* Usedgenerics;
tstrtable226820 Tab;
} S3;
struct {tsym226846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype226852* Typ;
tident201021* Name;
tlineinfo196539 Info;
tsym226846* Owner;
NU32 Flags;
tnode226816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc226830 Loc;
tlib226834* Annex;
tnode226816* Constraint;
};
struct  ttype226852  {
  tidobj201015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq226848* Sons;
tnode226816* N;
tsym226846* Owner;
tsym226846* Sym;
tsym226846* Destructor;
tsym226846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc226830 Loc;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  tnode226816  {
ttype226852* Typ;
tlineinfo196539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym226846* Sym;
} S4;
struct {tident201021* Ident;
} S5;
struct {tnodeseq226810* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
struct TY86345 {
NimStringDesc* Field0;
NI Field1;
};
struct  tcell44733  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq44749  {
NI Len;
NI Cap;
tcell44733** D;
};
struct  tcellset44745  {
NI Counter;
NI Max;
tpagedesc44741* Head;
tpagedesc44741** Data;
};
typedef tsmallchunk26240* TY27022[512];
typedef ttrunk26213* ttrunkbuckets26215[256];
struct  tintset26217  {
ttrunkbuckets26215 Data;
};
struct  tmemregion27010  {
NI Minlargeobj;
NI Maxlargeobj;
TY27022 Freesmallchunks;
tllchunk27004* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk26242* Freechunkslist;
tintset26217 Chunkstarts;
tavlnode27008* Root;
tavlnode27008* Deleted;
tavlnode27008* Last;
tavlnode27008* Freeavlnodes;
};
struct  tgcstat46814  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap46816  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq44749 Zct;
tcellseq44749 Decstack;
tcellset44745 Cycleroots;
tcellseq44749 Tempstack;
NI Recgclock;
tmemregion27010 Region;
tgcstat46814 Stat;
};
struct  intset223056  {
NI Counter;
NI Max;
ttrunk223052* Head;
ttrunkseq223054* Data;
};
struct  tidnodepair226866  {
tidobj201015* Key;
tnode226816* Val;
};
struct  tidnodetable226870  {
NI Counter;
tidnodepairseq226868* Data;
};
struct  tidpair226860  {
tidobj201015* Key;
TNimObject* Val;
};
struct  tidtable226864  {
NI Counter;
tidpairseq226862* Data;
};
struct  toutercontext429022  {
tsym226846* Fn;
tenv429020* Head;
intset223056 Capturedvars;
intset223056 Processed;
tidnodetable226870 Localstoaccess;
tidtable226864 Lambdastoenv;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tenv429020  {
  TNimObject Sup;
tnode226816* Attachednode;
tnode226816* Replacementnode;
tnode226816* Createdvar;
NIM_BOOL Createdvarcomesfromiter;
tsymseq226818* Capturedvars;
tenv429020* Up;
tenv429020* Next;
tsym226846* Upfield;
ttype226852* Obj;
tsym226846* Fn;
intset223056 Vars;
};
struct  tident201021  {
  tidobj201015 Sup;
NimStringDesc* S;
tident201021* Next;
NI H;
};
struct  titer429016  {
tsym226846* Fn;
tsym226846* Closureparam;
tsym226846* State;
tsym226846* Resultsym;
ttype226852* Obj;
};
struct  tscope226840  {
NI Depthlevel;
tstrtable226820 Symbols;
tnodeseq226810* Usingsyms;
tscope226840* Parent;
};
struct  tinstantiation226836  {
tsym226846* Sym;
ttypeseq226848* Concretetypes;
TY226936* Usedby;
};
struct  trope178009  {
  TNimObject Sup;
trope178009* Left;
trope178009* Right;
NI Length;
NimStringDesc* Data;
};
struct  tlistentry129022  {
  TNimObject Sup;
tlistentry129022* Prev;
tlistentry129022* Next;
};
struct  tlib226834  {
  tlistentry129022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope178009* Name;
tnode226816* Path;
};
typedef NI TY26220[8];
struct  tpagedesc44741  {
tpagedesc44741* Next;
NI Key;
TY26220 Bits;
};
struct  tbasechunk26238  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk26240  {
  tbasechunk26238 Sup;
tsmallchunk26240* Next;
tsmallchunk26240* Prev;
tfreecell26230* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk27004  {
NI Size;
NI Acc;
tllchunk27004* Next;
};
struct  tbigchunk26242  {
  tbasechunk26238 Sup;
tbigchunk26242* Next;
tbigchunk26242* Prev;
NI Align;
NF Data;
};
struct  ttrunk26213  {
ttrunk26213* Next;
NI Key;
TY26220 Bits;
};
typedef tavlnode27008* TY27014[2];
struct  tavlnode27008  {
TY27014 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  ttrunk223052  {
ttrunk223052* Next;
NI Key;
TY26220 Bits;
};
struct  tfreecell26230  {
tfreecell26230* Next;
NI Zerofield;
};
struct ttypeseq226848 {
  TGenericSeq Sup;
  ttype226852* data[SEQ_DECL_SIZE];
};
struct TY226947 {
  TGenericSeq Sup;
  tinstantiation226836* data[SEQ_DECL_SIZE];
};
struct tsymseq226818 {
  TGenericSeq Sup;
  tsym226846* data[SEQ_DECL_SIZE];
};
struct tnodeseq226810 {
  TGenericSeq Sup;
  tnode226816* data[SEQ_DECL_SIZE];
};
struct ttrunkseq223054 {
  TGenericSeq Sup;
  ttrunk223052* data[SEQ_DECL_SIZE];
};
struct tidnodepairseq226868 {
  TGenericSeq Sup;
  tidnodepair226866 data[SEQ_DECL_SIZE];
};
struct tidpairseq226862 {
  TGenericSeq Sup;
  tidpair226860 data[SEQ_DECL_SIZE];
};
struct TY226936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
static N_INLINE(NIM_BOOL, interestingvar_430039)(tsym226846* s);
N_NIMCALL(NIM_BOOL, isgenericroutine_233650)(tsym226846* s);
static N_INLINE(NI, len_227364)(tnode226816* n);
static N_INLINE(tnode226816*, HEX5BHEX5D_227698)(tnode226816* n, NI i);
N_NIMCALL(void, internalerror_199006)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_199126)(TY86345 x_199130);
N_NIMCALL(tnode226816*, newnodei_227138)(NU8 kind, tlineinfo196539 info);
N_NIMCALL(tsym226846*, copysym_227203)(tsym226846* s, NIM_BOOL keepid);
N_NIMCALL(tsym226846*, gethiddenparam_429238)(tsym226846* routine);
static N_INLINE(tnode226816*, lastson_227261)(tnode226816* n);
static N_INLINE(NI, sonslen_227249)(tnode226816* n);
N_NIMCALL(void, addvar_425053)(tnode226816* father, tnode226816* v);
N_NIMCALL(tnode226816*, newsymnode_227132)(tsym226846* sym);
N_NIMCALL(void, add_227498)(tnode226816* father, tnode226816* son);
N_NIMCALL(tnode226816*, newcall_429891)(tsym226846* a, tnode226816* b);
N_NIMCALL(tsym226846*, getsyssym_283054)(NimStringDesc* name);
N_NIMCALL(tnode226816*, newnodei_229007)(NU8 kind, tlineinfo196539 info, NI children);
N_NIMCALL(tnode226816*, newinttypenode_227103)(NU8 kind, NI64 intval, ttype226852* typ);
N_NIMCALL(ttype226852*, getsystype_283030)(NU8 kind);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(tcell44733*, usrtocell_48446)(void* usr);
static N_INLINE(void, rtladdzct_50004)(tcell44733* c);
N_NOINLINE(void, addzct_48417)(tcellseq44749* s, tcell44733* c);
N_NIMCALL(void, addson_227287)(tnode226816* father, tnode226816* son);
N_NIMCALL(tnode226816*, makeclosure_430949)(tsym226846* prc, tnode226816* env, tlineinfo196539 info);
N_NIMCALL(tnode226816*, newnodeit_227145)(NU8 kind, tlineinfo196539 info, ttype226852* typ);
N_NIMCALL(tsym226846*, skipgenericowner_233699)(tsym226846* s);
N_NIMCALL(toutercontext429022*, newoutercontext_429647)(tsym226846* fn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3175)(void* p, NI op);
N_NIMCALL(void, TMP3176)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initintset_223950)(intset223056* Result);
N_NIMCALL(void, initidnodetable_227181)(tidnodetable226870* x);
N_NIMCALL(void, initidtable_227167)(tidtable226864* x);
N_NIMCALL(tnode226816*, closurecreationpoint_431358)(tnode226816* n);
N_NIMCALL(tenv429020*, newenv_429675)(toutercontext429022* o, tenv429020* up, tnode226816* n, tsym226846* 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_50825)(tcell44733* c);
static N_INLINE(NIM_BOOL, canbecycleroot_48467)(tcell44733* c);
static N_INLINE(void, rtladdcycleroot_49229)(tcell44733* c);
N_NOINLINE(void, incl_45471)(tcellset44745* s, tcell44733* cell);
static N_INLINE(void, decref_50404)(tcell44733* c);
N_NIMCALL(tsym226846*, getenvparam_429349)(tsym226846* routine);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(ttype226852*, createenvobj_429082)(tsym226846* owner);
N_NIMCALL(ttype226852*, createobj_425304)(tsym226846* owner, tlineinfo196539 info);
N_NIMCALL(void, rawaddfield_425331)(ttype226852* obj, tsym226846* field);
N_NIMCALL(tsym226846*, createstatefield_429072)(tsym226846* iter);
N_NIMCALL(tsym226846*, newsym_227074)(NU8 symkind, tident201021* name, tsym226846* owner, tlineinfo196539 info);
N_NIMCALL(tident201021*, getident_201472)(NimStringDesc* identifier);
N_NIMCALL(ttype226852*, getstatetype_429049)(tsym226846* iter);
N_NIMCALL(tnode226816*, newintnode_227096)(NU8 kind, NI64 intval);
N_NIMCALL(ttype226852*, newtype_227083)(NU8 kind, tsym226846* owner);
N_NIMCALL(ttype226852*, nilorsysint_283070)(void);
N_NIMCALL(void, rawaddson_231562)(ttype226852* father, ttype226852* son);
N_NIMCALL(void, addparamstoenv_431386)(tsym226846* fn, tenv429020* env);
N_NIMCALL(void, internalerror_198987)(tlineinfo196539 info, NimStringDesc* errmsg);
N_NIMCALL(void, incl_223869)(intset223056* s, NI key);
N_NIMCALL(void, searchforinnerprocs_431541)(toutercontext429022* o, tnode226816* n, tenv429020* env);
N_NIMCALL(NIM_BOOL, isinnerproc_429902)(tsym226846* s, tsym226846* outerproc);
N_NIMCALL(NIM_BOOL, containsorincl_223916)(intset223056* s, NI key);
N_NIMCALL(tnode226816*, getbody_280269)(tsym226846* s);
N_NIMCALL(NI, gathervars_430721)(toutercontext429022* o, tenv429020* e, tnode226816* n);
N_NIMCALL(NIM_BOOL, capturevar_430433)(toutercontext429022* o, tenv429020* top, tsym226846* local, tlineinfo196539 info);
N_NIMCALL(NIM_BOOL, contains_223837)(intset223056* s, NI key);
static N_INLINE(NIM_BOOL, illegalcapture_430006)(tsym226846* s);
N_NIMCALL(ttype226852*, skiptypes_231245)(ttype226852* t, NU64 kinds);
N_NIMCALL(void, localerror_198955)(tlineinfo196539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(tsym226846*, createupfield_430421)(ttype226852* obj, ttype226852* fieldtype);
N_NIMCALL(void, addfield_425608)(ttype226852* obj, tsym226846* s);
N_NIMCALL(void, addclosureparam_429962)(tsym226846* fn, tenv429020* e);
N_NIMCALL(void, addhiddenparam_429147)(tsym226846* routine, tsym226846* param);
N_NIMCALL(TNimObject*, idtableget_236182)(tidtable226864 t, tidobj201015* key);
N_NIMCALL(void, idtableput_236196)(tidtable226864* t, tidobj201015* key, TNimObject* val);
N_NIMCALL(void, addcapturedvar_429818)(tenv429020* e, tsym226846* v);
N_NIMCALL(TGenericSeq*, incrSeq)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(tnode226816*, transforminnerproc_431192)(toutercontext429022* o, tenv429020* e, tnode226816* n);
N_NIMCALL(tnode226816*, getclosurevar_431015)(tenv429020* e);
N_NIMCALL(tnode226816*, newclosurecreationvar_430978)(tenv429020* e);
N_NIMCALL(void, inititer_429412)(tsym226846* iter, titer429016* Result);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(tsym226846*, newiterresult_429092)(tsym226846* iter);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, adduniquefield_425807)(ttype226852* obj, tsym226846* s);
N_NIMCALL(tnode226816*, indirectaccess_426848)(tnode226816* a, tsym226846* b, tlineinfo196539 info);
N_NIMCALL(tenv429020*, findenv_431042)(toutercontext429022* o, tsym226846* s);
N_NIMCALL(tnode226816*, nestedaccess_430076)(tenv429020* top, tsym226846* local);
N_NIMCALL(void, createenvironments_433610)(toutercontext429022* o);
N_NIMCALL(tnode226816*, generateclosurecreation_432308)(toutercontext429022* o, tenv429020* scope);
N_NIMCALL(tnode226816*, rawclosurecreation_432201)(toutercontext429022* o, tenv429020* scope, tnode226816* env);
N_NIMCALL(tnode226816*, newasgnstmt_432161)(tnode226816* le, tnode226816* ri, tlineinfo196539 info);
N_NIMCALL(tnode226816*, idnodetableget_236212)(tidnodetable226870 t, tidobj201015* key);
N_NIMCALL(void, idnodetableput_236219)(tidnodetable226870* t, tidobj201015* key, tnode226816* val);
N_NIMCALL(tnode226816*, transformouterprocbody_434214)(toutercontext429022* o, tnode226816* n, titer429016* it);
N_NIMCALL(tnode226816*, rawindirectaccess_425407)(tnode226816* a, tsym226846* field, tlineinfo196539 info);
N_NIMCALL(tnode226816*, transformouterproc_432483)(toutercontext429022* o, tnode226816* n, titer429016* it);
N_NIMCALL(void, excl_223884)(intset223056* s, NI key);
static N_INLINE(NIM_BOOL, interestingitervar_432446)(tsym226846* s);
N_NIMCALL(void, message_198976)(tlineinfo196539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(tnode226816*, liftitersym_433255)(tnode226816* n);
N_NIMCALL(tnode226816*, generateiterclosurecreation_432320)(toutercontext429022* o, tenv429020* env, tnode226816* scope);
N_NIMCALL(tnode226816*, transformouterconv_430882)(tnode226816* n);
N_NIMCALL(tnode226816*, generatethunk_430861)(tnode226816* prc, ttype226852* dest);
N_NIMCALL(tnode226816*, transformyield_432491)(toutercontext429022* c, tnode226816* n, titer429016* it);
N_NIMCALL(void, outerprocsons_433170)(toutercontext429022* o, tnode226816* n, titer429016* it);
N_NIMCALL(tnode226816*, transformreturn_433157)(toutercontext429022* c, tnode226816* n, titer429016* it);
N_NIMCALL(void, finishenvironments_433837)(toutercontext429022* o);
STRING_LITERAL(TMP3136, "compiler/lambdalifting.nim", 26);
NIM_CONST TY86345 TMP3135 = {((NimStringDesc*) &TMP3136),
999}
;
NIM_CONST TY86345 TMP3137 = {((NimStringDesc*) &TMP3136),
195}
;
STRING_LITERAL(TMP3138, "internalNew", 11);
STRING_LITERAL(TMP3177, ":envP", 5);
STRING_LITERAL(TMP3178, ":state", 6);
STRING_LITERAL(TMP3179, "liftLambdas: strange params", 27);
STRING_LITERAL(TMP3180, ":up", 3);
STRING_LITERAL(TMP3181, ":env", 4);
NIM_CONST TY86345 TMP3182 = {((NimStringDesc*) &TMP3136),
219}
;
STRING_LITERAL(TMP3183, ":result", 7);
NIM_CONST TY86345 TMP3189 = {((NimStringDesc*) &TMP3136),
469}
;
NIM_CONST TY86345 TMP3190 = {((NimStringDesc*) &TMP3136),
312}
;
NIM_CONST TY86345 TMP3191 = {((NimStringDesc*) &TMP3136),
319}
;
STRING_LITERAL(TMP3192, "searchForInnerProcs", 19);
extern tgcheap46816 gch_46844;
extern tnode226816* emptynode_227738;
extern NU8 gcmd_170120;
TNimType NTI429022; /* TOuterContext */
extern TNimType NTI226814; /* PSym */
extern TNimType NTI3211; /* RootObj */
TNimType NTI429020; /* TEnv */
extern TNimType NTI226808; /* PNode */
extern TNimType NTI138; /* bool */
extern TNimType NTI226818; /* TSymSeq */
extern TNimType NTI226812; /* PType */
extern TNimType NTI223056; /* IntSet */
TNimType NTI429018; /* PEnv */
extern TNimType NTI226870; /* TIdNodeTable */
extern TNimType NTI226864; /* TIdTable */
TNimType NTI429014; /* POuterContext */

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

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

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

N_NIMCALL(tsym226846*, gethiddenparam_429238)(tsym226846* routine) {
	tsym226846* result;
	tnode226816* params;
	tnode226816* hidden;
	result = 0;
	params = (*(*routine).Ast).kindU.S6.Sons->data[3];
	hidden = lastson_227261(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_199126(TMP3137);
		internalerror_199006(LOC7);
	}
	LA5: ;
	result = (*hidden).kindU.S4.Sym;
	return result;
}

N_NIMCALL(tnode226816*, newcall_429891)(tsym226846* a, tnode226816* b) {
	tnode226816* result;
	tnode226816* LOC1;
	result = 0;
	result = newnodei_227138(((NU8) 27), (*a).Info);
	LOC1 = 0;
	LOC1 = newsymnode_227132(a);
	add_227498(result, LOC1);
	add_227498(result, b);
	return result;
}

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

static N_INLINE(void, rtladdzct_50004)(tcell44733* c) {
	addzct_48417((&gch_46844.Zct), c);
}

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

N_NIMCALL(tnode226816*, makeclosure_430949)(tsym226846* prc, tnode226816* env, tlineinfo196539 info) {
	tnode226816* result;
	tnode226816* LOC1;
	result = 0;
	result = newnodeit_227145(((NU8) 154), info, (*prc).Typ);
	LOC1 = 0;
	LOC1 = newsymnode_227132(prc);
	add_227498(result, LOC1);
	{
		ttype226852* LOC6;
		tnode226816* LOC7;
		if (!(env == NIM_NIL)) goto LA4;
		LOC6 = 0;
		LOC6 = getsystype_283030(((NU8) 5));
		LOC7 = 0;
		LOC7 = newnodeit_227145(((NU8) 23), info, LOC6);
		add_227498(result, LOC7);
	}
	goto LA2;
	LA4: ;
	{
		add_227498(result, env);
	}
	LA2: ;
	return result;
}

N_NIMCALL(tnode226816*, liftforloop_435953)(tnode226816* body) {
	tnode226816* result;
	NI l;
	tnode226816* call;
	tsym226846* env;
	tnode226816* loopbody;
	tnode226816* whileloop;
	ttype226852* LOC23;
	tnode226816* v2;
	tnode226816* vpart;
	NU8 LOC24;
	tnode226816* bs;
	result = 0;
	l = len_227364(body);
	{
		NIM_BOOL LOC3;
		tnode226816* LOC5;
		NimStringDesc* LOC8;
		LOC3 = 0;
		LOC3 = ((*body).Kind == ((NU8) 94));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = HEX5BHEX5D_227698(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_199126(TMP3135);
		internalerror_199006(LOC8);
	}
	LA6: ;
	call = HEX5BHEX5D_227698(body, (NI64)(l - 2));
	result = newnodei_227138(((NU8) 115), (*body).Info);
	env = 0;
	{
		NIM_BOOL LOC11;
		tnode226816* LOC12;
		tnode226816* LOC14;
		tsym226846* iter;
		tnode226816* LOC17;
		tsym226846* LOC18;
		tnode226816* v;
		tnode226816* LOC19;
		tsym226846* LOC20;
		tnode226816* LOC21;
		tnode226816* LOC22;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = HEX5BHEX5D_227698(call, 0);
		LOC11 = ((*LOC12).Kind == ((NU8) 3));
		if (!(LOC11)) goto LA13;
		LOC14 = 0;
		LOC14 = HEX5BHEX5D_227698(call, 0);
		LOC11 = ((*(*LOC14).kindU.S4.Sym).Kind == ((NU8) 15));
		LA13: ;
		if (!LOC11) goto LA15;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_227698(call, 0);
		iter = (*LOC17).kindU.S4.Sym;
		LOC18 = 0;
		LOC18 = gethiddenparam_429238(iter);
		env = copysym_227203(LOC18, NIM_FALSE);
		v = newnodei_227138(((NU8) 99), (*body).Info);
		LOC19 = 0;
		LOC19 = newsymnode_227132(env);
		addvar_425053(v, LOC19);
		add_227498(result, v);
		LOC20 = 0;
		LOC20 = getsyssym_283054(((NimStringDesc*) &TMP3138));
		LOC21 = 0;
		LOC21 = newsymnode_227132(env);
		LOC22 = 0;
		LOC22 = newcall_429891(LOC20, LOC21);
		add_227498(result, LOC22);
	}
	LA15: ;
	loopbody = newnodei_229007(((NU8) 115), (*body).Info, 3);
	whileloop = newnodei_229007(((NU8) 96), (*body).Info, 2);
	LOC23 = 0;
	LOC23 = getsystype_283030(((NU8) 1));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.Sons->data[0]), newinttypenode_227103(((NU8) 6), IL64(1), LOC23));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.Sons->data[1]), loopbody);
	add_227498(result, whileloop);
	v2 = newnodei_227138(((NU8) 100), (*body).Info);
	LOC24 = 0;
	{
		if (!(l == 3)) goto LA27;
		LOC24 = ((NU8) 35);
	}
	goto LA25;
	LA27: ;
	{
		LOC24 = ((NU8) 36);
	}
	LA25: ;
	vpart = newnodei_227138(LOC24, (*body).Info);
	{
		NI i_436244;
		NI HEX3Atmp_436527;
		NI res_436530;
		i_436244 = 0;
		HEX3Atmp_436527 = 0;
		HEX3Atmp_436527 = (NI64)(l - 3);
		res_436530 = 0;
		{
			while (1) {
				tnode226816* LOC33;
				tnode226816* LOC34;
				if (!(res_436530 <= HEX3Atmp_436527)) goto LA32;
				i_436244 = res_436530;
				LOC33 = 0;
				LOC33 = HEX5BHEX5D_227698(body, i_436244);
				(*(*LOC33).kindU.S4.Sym).Kind = ((NU8) 9);
				LOC34 = 0;
				LOC34 = HEX5BHEX5D_227698(body, i_436244);
				addson_227287(vpart, LOC34);
				res_436530 += 1;
			} LA32: ;
		}
	}
	addson_227287(vpart, emptynode_227738);
	{
		tnode226816* LOC39;
		if (!!(env == 0)) goto LA37;
		LOC39 = 0;
		LOC39 = newsymnode_227132(env);
		asgnRefNoCycle((void**) (&(*call).kindU.S6.Sons->data[0]), makeclosure_430949((*(*call).kindU.S6.Sons->data[0]).kindU.S4.Sym, LOC39, (*body).Info));
	}
	LA37: ;
	addson_227287(vpart, call);
	addson_227287(v2, vpart);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.Sons->data[0]), v2);
	bs = newnodei_227138(((NU8) 157), (*body).Info);
	addson_227287(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_227698(body, (NI64)(l - 1)));
	return result;
}
N_NIMCALL(void, TMP3175)(void* p, NI op) {
	tenv429020* a;
	a = (tenv429020*)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, TMP3176)(void* p, NI op) {
	toutercontext429022* a;
	a = (toutercontext429022*)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(toutercontext429022*, newoutercontext_429647)(tsym226846* fn) {
	toutercontext429022* result;
	result = 0;
	result = (toutercontext429022*) newObj((&NTI429014), sizeof(toutercontext429022));
	asgnRefNoCycle((void**) (&(*result).Fn), fn);
	initintset_223950((&(*result).Capturedvars));
	initintset_223950((&(*result).Processed));
	initidnodetable_227181((&(*result).Localstoaccess));
	initidtable_227167((&(*result).Lambdastoenv));
	return result;
}

N_NIMCALL(tnode226816*, closurecreationpoint_431358)(tnode226816* n) {
	tnode226816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC6;
		tnode226816* LOC8;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*n).Kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC6 = 0;
		LOC6 = len_227364(n);
		LOC4 = (1 <= LOC6);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA7;
		LOC8 = 0;
		LOC8 = HEX5BHEX5D_227698(n, 0);
		LOC3 = ((*LOC8).Kind == ((NU8) 1));
		LA7: ;
		if (!LOC3) goto LA9;
		result = n;
	}
	goto LA1;
	LA9: ;
	{
		result = newnodei_227138(((NU8) 115), (*n).Info);
		add_227498(result, emptynode_227738);
		add_227498(result, n);
	}
	LA1: ;
	return result;
}

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

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

static N_INLINE(void, rtladdcycleroot_49229)(tcell44733* c) {
	{
		if (!!((((NI) ((NI)((*c).Refcount & 3))) == 3))) goto LA3;
		(*c).Refcount = (NI)((NI)((*c).Refcount & -4) | 3);
		incl_45471((&gch_46844.Cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_50825)(tcell44733* c) {
	(*c).Refcount = (NI)((NU64)((*c).Refcount) + (NU64)(8));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_48467(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_49229(c);
	}
	LA4: ;
}

static N_INLINE(void, decref_50404)(tcell44733* c) {
	{
		(*c).Refcount -= 8;
		if (!((NU64)((*c).Refcount) < (NU64)(8))) goto LA3;
		rtladdzct_50004(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_48467(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_49229(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tcell44733* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_48446(src);
		incref_50825(LOC5);
	}
	LA3: ;
	{
		tcell44733* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_48446((*dest));
		decref_50404(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(tsym226846*, getenvparam_429349)(tsym226846* routine) {
	tsym226846* result;
	tnode226816* params;
	tnode226816* hidden;
	result = 0;
	params = (*(*routine).Ast).kindU.S6.Sons->data[3];
	hidden = lastson_227261(params);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*hidden).Kind == ((NU8) 3));
		if (!(LOC3)) goto LA4;
		LOC3 = eqStrings((*(*(*hidden).kindU.S4.Sym).Name).S, ((NimStringDesc*) &TMP3177));
		LA4: ;
		if (!LOC3) goto LA5;
		result = (*hidden).kindU.S4.Sym;
	}
	LA5: ;
	return result;
}

N_NIMCALL(ttype226852*, getstatetype_429049)(tsym226846* iter) {
	ttype226852* result;
	tnode226816* n;
	tnode226816* LOC1;
	tnode226816* LOC2;
	ttype226852* inttype;
	result = 0;
	n = newnodei_227138(((NU8) 44), (*iter).Info);
	LOC1 = 0;
	LOC1 = newintnode_227096(((NU8) 6), IL64(-1));
	addson_227287(n, LOC1);
	LOC2 = 0;
	LOC2 = newintnode_227096(((NU8) 6), IL64(0));
	addson_227287(n, LOC2);
	result = newtype_227083(((NU8) 20), iter);
	asgnRefNoCycle((void**) (&(*result).N), n);
	inttype = nilorsysint_283070();
	{
		if (!inttype == 0) goto LA5;
		inttype = newtype_227083(((NU8) 31), iter);
	}
	LA5: ;
	rawaddson_231562(result, inttype);
	return result;
}

N_NIMCALL(tsym226846*, createstatefield_429072)(tsym226846* iter) {
	tsym226846* result;
	tident201021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_201472(((NimStringDesc*) &TMP3178));
	result = newsym_227074(((NU8) 19), LOC1, iter, (*iter).Info);
	asgnRefNoCycle((void**) (&(*result).Typ), getstatetype_429049(iter));
	return result;
}

N_NIMCALL(ttype226852*, createenvobj_429082)(tsym226846* owner) {
	ttype226852* result;
	tsym226846* LOC1;
	result = 0;
	result = createobj_425304(owner, (*owner).Info);
	LOC1 = 0;
	LOC1 = createstatefield_429072(owner);
	rawaddfield_425331(result, LOC1);
	return result;
}

N_NIMCALL(tenv429020*, newenv_429675)(toutercontext429022* o, tenv429020* up, tnode226816* n, tsym226846* owner) {
	tenv429020* result;
	result = 0;
	result = (tenv429020*) newObj((&NTI429018), sizeof(tenv429020));
	(*result).Sup.m_type = (&NTI429020);
	if ((*result).Capturedvars) nimGCunrefNoCycle((*result).Capturedvars);
	(*result).Capturedvars = (tsymseq226818*) newSeqRC1((&NTI226818), 0);
	asgnRef((void**) (&(*result).Up), up);
	asgnRefNoCycle((void**) (&(*result).Attachednode), n);
	asgnRefNoCycle((void**) (&(*result).Fn), owner);
	initintset_223950((&(*result).Vars));
	asgnRef((void**) (&(*result).Next), (*o).Head);
	asgnRef((void**) (&(*o).Head), result);
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		tsym226846* 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_429349(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_429082(owner));
	}
	LA15: ;
	return result;
}

N_NIMCALL(void, addparamstoenv_431386)(tsym226846* fn, tenv429020* env) {
	tnode226816* params;
	tnode226816* ast;
	params = (*(*fn).Typ).N;
	{
		NI i_431412;
		NI HEX3Atmp_431521;
		NI LOC2;
		NI res_431524;
		i_431412 = 0;
		HEX3Atmp_431521 = 0;
		LOC2 = 0;
		LOC2 = len_227364(params);
		HEX3Atmp_431521 = (LOC2 - 1);
		res_431524 = 1;
		{
			while (1) {
				tsym226846* param;
				if (!(res_431524 <= HEX3Atmp_431521)) goto LA4;
				i_431412 = res_431524;
				{
					if (!!(((*(*params).kindU.S6.Sons->data[i_431412]).Kind == ((NU8) 3)))) goto LA7;
					internalerror_198987((*params).Info, ((NimStringDesc*) &TMP3179));
				}
				LA7: ;
				param = (*(*params).kindU.S6.Sons->data[i_431412]).kindU.S4.Sym;
				incl_223869((&(*env).Vars), (*param).Sup.Id);
				res_431524 += 1;
			} LA4: ;
		}
	}
	ast = (*fn).Ast;
	{
		NIM_BOOL LOC11;
		NI LOC12;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = sonslen_227249(ast);
		LOC11 = (7 < LOC12);
		if (!(LOC11)) goto LA13;
		LOC11 = ((*(*ast).kindU.S6.Sons->data[7]).Kind == ((NU8) 3));
		LA13: ;
		if (!LOC11) goto LA14;
		incl_223869((&(*env).Vars), (*(*(*ast).kindU.S6.Sons->data[7]).kindU.S4.Sym).Sup.Id);
	}
	LA14: ;
}

N_NIMCALL(NIM_BOOL, isinnerproc_429902)(tsym226846* s, tsym226846* outerproc) {
	NIM_BOOL result;
	result = 0;
	{
		tsym226846* owner;
		if (!((110592 &(1<<(((*s).Kind)&31)))!=0)) goto LA3;
		owner = skipgenericowner_233699(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_430006)(tsym226846* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	ttype226852* LOC2;
	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = skiptypes_231245((*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(tsym226846*, createupfield_430421)(ttype226852* obj, ttype226852* fieldtype) {
	tsym226846* result;
	NI pos;
	tident201021* LOC1;
	result = 0;
	pos = len_227364((*obj).N);
	LOC1 = 0;
	LOC1 = getident_201472(((NimStringDesc*) &TMP3180));
	result = newsym_227074(((NU8) 19), LOC1, (*obj).Owner, (*(*obj).Owner).Info);
	asgnRefNoCycle((void**) (&(*result).Typ), newtype_227083(((NU8) 22), (*obj).Owner));
	(*result).Position = pos;
	rawaddson_231562((*result).Typ, fieldtype);
	addfield_425608(obj, result);
	return result;
}

N_NIMCALL(void, addhiddenparam_429147)(tsym226846* routine, tsym226846* param) {
	tnode226816* params;
	NI LOC1;
	tnode226816* LOC2;
	params = (*(*routine).Ast).kindU.S6.Sons->data[3];
	LOC1 = 0;
	LOC1 = len_227364(params);
	(*param).Position = (NI64)(LOC1 - 1);
	LOC2 = 0;
	LOC2 = newsymnode_227132(param);
	addson_227287(params, LOC2);
	(*(*routine).Typ).Flags |= ((NI32)1)<<((((NU8) 11))%(sizeof(NI32)*8));
}

N_NIMCALL(void, addclosureparam_429962)(tsym226846* fn, tenv429020* e) {
	tsym226846* cp;
	cp = getenvparam_429349(fn);
	{
		tident201021* LOC5;
		if (!(cp == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = getident_201472(((NimStringDesc*) &TMP3177));
		cp = newsym_227074(((NU8) 3), LOC5, fn, (*fn).Info);
		(*cp).Flags |= ((NI32)1)<<((((NU8) 2))%(sizeof(NI32)*8));
		asgnRefNoCycle((void**) (&(*cp).Typ), newtype_227083(((NU8) 22), fn));
		rawaddson_231562((*cp).Typ, (*e).Obj);
		addhiddenparam_429147(fn, cp);
	}
	LA3: ;
}

N_NIMCALL(void, addcapturedvar_429818)(tenv429020* e, tsym226846* v) {
	{
		tsym226846* x_429834;
		tsymseq226818* HEX3Atmp_429870;
		NI i_429873;
		NI l_429875;
		x_429834 = 0;
		HEX3Atmp_429870 = 0;
		HEX3Atmp_429870 = (*e).Capturedvars;
		i_429873 = 0;
		l_429875 = HEX3Atmp_429870->Sup.len;
		{
			while (1) {
				if (!(i_429873 < l_429875)) goto LA3;
				x_429834 = HEX3Atmp_429870->data[i_429873];
				{
					if (!(x_429834 == v)) goto LA6;
					goto BeforeRet;
				}
				LA6: ;
				i_429873 += 1;
			} LA3: ;
		}
	}
	(*e).Capturedvars = (tsymseq226818*) incrSeq(&((*e).Capturedvars)->Sup, sizeof(tsym226846*));
	asgnRefNoCycle((void**) (&(*e).Capturedvars->data[(*e).Capturedvars->Sup.len-1]), v);
	addfield_425608((*e).Obj, v);
	BeforeRet: ;
}

N_NIMCALL(NIM_BOOL, capturevar_430433)(toutercontext429022* o, tenv429020* top, tsym226846* local, tlineinfo196539 info) {
	NIM_BOOL result;
	tenv429020* it;
	result = 0;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				LOC5 = 0;
				LOC5 = contains_223837((&(*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_430006(local);
		if (LOC14) goto LA15;
		LOC14 = !(((257 &(1<<(((*(*(*top).Fn).Typ).Callconv)&15)))!=0));
		LA15: ;
		if (!LOC14) goto LA16;
		localerror_198955(info, ((NU16) 222), (*(*local).Name).S);
	}
	LA16: ;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA19;
			{
				NIM_BOOL LOC22;
				LOC22 = 0;
				LOC22 = contains_223837((&(*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_430421((*it).Obj, (*(*it).Up).Obj));
			}
			LA31: ;
			{
				tenv429020* 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_429962((*it).Fn, u);
				{
					tidobj201015* LOC43;
					TNimObject* LOC44;
					LOC43 = 0;
					LOC43 = &(*it).Fn->Sup;
					LOC44 = 0;
					LOC44 = idtableget_236182((*o).Lambdastoenv, LOC43);
					if (!(LOC44 == NIM_NIL)) goto LA45;
					{
						tidobj201015* LOC51;
						TNimObject* LOC52;
						if (!!((u == NIM_NIL))) goto LA49;
						LOC51 = 0;
						LOC51 = &(*it).Fn->Sup;
						LOC52 = 0;
						LOC52 = &u->Sup;
						idtableput_236196((&(*o).Lambdastoenv), LOC51, LOC52);
					}
					LA49: ;
				}
				LA45: ;
			}
			LA35: ;
			it = (*it).Up;
		} LA19: ;
	} LA18: ;
	incl_223869((&(*o).Capturedvars), (*local).Sup.Id);
	addcapturedvar_429818(it, local);
	result = NIM_TRUE;
	BeforeRet: ;
	return result;
}

N_NIMCALL(NI, gathervars_430721)(toutercontext429022* o, tenv429020* e, tnode226816* n) {
	NI result;
	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = 0;
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).Kind) {
	case ((NU8) 3):
	{
		tsym226846* s;
		s = (*n).kindU.S4.Sym;
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = interestingvar_430039(s);
			if (!(LOC8)) goto LA9;
			LOC8 = !(((*e).Fn == (*s).Owner));
			LA9: ;
			if (!LOC8) goto LA10;
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = capturevar_430433(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_430813;
			NI HEX3Atmp_430841;
			NI LOC20;
			NI res_430844;
			k_430813 = 0;
			HEX3Atmp_430841 = 0;
			LOC20 = 0;
			LOC20 = sonslen_227249(n);
			HEX3Atmp_430841 = (NI64)(LOC20 - 1);
			res_430844 = 0;
			{
				while (1) {
					NI LOC23;
					if (!(res_430844 <= HEX3Atmp_430841)) goto LA22;
					k_430813 = res_430844;
					LOC23 = 0;
					LOC23 = gathervars_430721(o, e, (*n).kindU.S6.Sons->data[k_430813]);
					result += LOC23;
					res_430844 += 1;
				} LA22: ;
			}
		}
	}
	break;
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(tsym226846*, newiterresult_429092)(tsym226846* iter) {
	tsym226846* result;
	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_227364((*iter).Ast);
		if (!(7 < LOC3)) goto LA4;
		result = (*(*(*iter).Ast).kindU.S6.Sons->data[7]).kindU.S4.Sym;
	}
	goto LA1;
	LA4: ;
	{
		tident201021* LOC7;
		tnode226816* LOC8;
		LOC7 = 0;
		LOC7 = getident_201472(((NimStringDesc*) &TMP3183));
		result = newsym_227074(((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_227132(result);
		add_227498((*iter).Ast, LOC8);
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, inititer_429412)(tsym226846* iter, titer429016* Result) {
	unsureAsgnRef((void**) (&(*Result).Fn), iter);
	{
		tsym226846* cp;
		tnode226816* LOC17;
		if (!((*iter).Kind == ((NU8) 15))) goto LA3;
		cp = getenvparam_429349(iter);
		{
			tident201021* LOC9;
			if (!(cp == NIM_NIL)) goto LA7;
			unsureAsgnRef((void**) (&(*Result).Obj), createenvobj_429082(iter));
			LOC9 = 0;
			LOC9 = getident_201472(((NimStringDesc*) &TMP3177));
			cp = newsym_227074(((NU8) 3), LOC9, iter, (*iter).Info);
			(*cp).Flags |= ((NI32)1)<<((((NU8) 2))%(sizeof(NI32)*8));
			asgnRefNoCycle((void**) (&(*cp).Typ), newtype_227083(((NU8) 22), iter));
			rawaddson_231562((*cp).Typ, (*Result).Obj);
			addhiddenparam_429147(iter, cp);
		}
		goto LA5;
		LA7: ;
		{
			unsureAsgnRef((void**) (&(*Result).Obj), (*(*cp).Typ).Sons->data[0]);
		}
		LA5: ;
		{
			NI LOC13;
			NimStringDesc* LOC16;
			LOC13 = 0;
			LOC13 = len_227364((*(*Result).Obj).N);
			if (!!((0 < LOC13))) goto LA14;
			LOC16 = 0;
			LOC16 = HEX24_199126(TMP3182);
			internalerror_199006(LOC16);
		}
		LA14: ;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_227698((*(*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_429092(iter));
		}
		LA20: ;
	}
	LA3: ;
}

N_NIMCALL(tnode226816*, newclosurecreationvar_430978)(tenv429020* e) {
	tnode226816* result;
	tsym226846* v;
	tident201021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_201472(((NimStringDesc*) &TMP3181));
	v = newsym_227074(((NU8) 8), LOC1, (*e).Fn, (*(*e).Attachednode).Info);
	(*v).Flags |= ((NI32)1)<<((((NU8) 21))%(sizeof(NI32)*8));
	asgnRefNoCycle((void**) (&(*v).Typ), newtype_227083(((NU8) 22), (*e).Fn));
	rawaddson_231562((*v).Typ, (*e).Obj);
	{
		titer429016 it;
		tnode226816* 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_429412((*e).Fn, (&it));
		adduniquefield_425807(it.Obj, v);
		LOC6 = 0;
		LOC6 = newsymnode_227132(it.Closureparam);
		result = indirectaccess_426848(LOC6, v, (*v).Info);
	}
	goto LA2;
	LA4: ;
	{
		result = newsymnode_227132(v);
	}
	LA2: ;
	return result;
}

N_NIMCALL(tnode226816*, getclosurevar_431015)(tenv429020* e) {
	tnode226816* result;
	result = 0;
	{
		if (!((*e).Createdvar == NIM_NIL)) goto LA3;
		result = newclosurecreationvar_430978(e);
		asgnRefNoCycle((void**) (&(*e).Createdvar), result);
	}
	goto LA1;
	LA3: ;
	{
		result = (*e).Createdvar;
	}
	LA1: ;
	return result;
}

N_NIMCALL(tenv429020*, findenv_431042)(toutercontext429022* o, tsym226846* s) {
	tenv429020* result;
	tenv429020* 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_199126(TMP3189);
		internalerror_199006(LOC13);
	}
	LA11: ;
	result = (*env).Up;
	{
		while (1) {
			if (!((*result).Fn == s)) goto LA15;
			result = (*result).Up;
		} LA15: ;
	}
	return result;
}

N_NIMCALL(tnode226816*, nestedaccess_430076)(tenv429020* top, tsym226846* local) {
	tnode226816* result;
	tenv429020* it;
	tsym226846* envparam;
	tnode226816* access;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_430039(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_223837((&(*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_429349((*top).Fn);
	{
		NimStringDesc* LOC23;
		if (!!(!(envparam == 0))) goto LA21;
		LOC23 = 0;
		LOC23 = HEX24_199126(TMP3190);
		internalerror_199006(LOC23);
	}
	LA21: ;
	access = newsymnode_227132(envparam);
	it = (*top).Up;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA25;
			{
				NIM_BOOL LOC28;
				LOC28 = 0;
				LOC28 = contains_223837((&(*it).Vars), (*local).Sup.Id);
				if (!LOC28) goto LA29;
				access = indirectaccess_426848(access, local, (*local).Info);
				result = access;
				goto BeforeRet;
			}
			LA29: ;
			{
				NimStringDesc* LOC35;
				if (!!(!(((*it).Upfield == NIM_NIL)))) goto LA33;
				LOC35 = 0;
				LOC35 = HEX24_199126(TMP3191);
				internalerror_199006(LOC35);
			}
			LA33: ;
			access = indirectaccess_426848(access, (*it).Upfield, (*local).Info);
			it = (*it).Up;
		} LA25: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode226816*, transforminnerproc_431192)(toutercontext429022* o, tenv429020* e, tnode226816* n) {
	tnode226816* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		tsym226846* s;
		s = (*n).kindU.S4.Sym;
		{
			tsym226846* LOC7;
			tnode226816* LOC8;
			if (!(s == (*e).Fn)) goto LA5;
			LOC7 = 0;
			LOC7 = getenvparam_429349(s);
			LOC8 = 0;
			LOC8 = newsymnode_227132(LOC7);
			result = makeclosure_430949(s, LOC8, (*n).Info);
		}
		goto LA3;
		LA5: ;
		{
			NIM_BOOL LOC10;
			tenv429020* LOC14;
			tnode226816* LOC15;
			LOC10 = 0;
			LOC10 = isinnerproc_429902(s, (*o).Fn);
			if (!(LOC10)) goto LA11;
			LOC10 = ((*(*s).Typ).Callconv == ((NU8) 8));
			LA11: ;
			if (!LOC10) goto LA12;
			LOC14 = 0;
			LOC14 = findenv_431042(o, s);
			LOC15 = 0;
			LOC15 = getclosurevar_431015(LOC14);
			result = makeclosure_430949(s, LOC15, (*n).Info);
		}
		goto LA3;
		LA12: ;
		{
			result = nestedaccess_430076(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_431290;
			NI HEX3Atmp_431338;
			NI LOC20;
			NI res_431341;
			j_431290 = 0;
			HEX3Atmp_431338 = 0;
			LOC20 = 0;
			LOC20 = sonslen_227249(n);
			HEX3Atmp_431338 = (NI64)(LOC20 - 1);
			res_431341 = 0;
			{
				while (1) {
					tnode226816* x;
					if (!(res_431341 <= HEX3Atmp_431338)) goto LA22;
					j_431290 = res_431341;
					x = transforminnerproc_431192(o, e, (*n).kindU.S6.Sons->data[j_431290]);
					{
						if (!!((x == NIM_NIL))) goto LA25;
						asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[j_431290]), x);
					}
					LA25: ;
					res_431341 += 1;
				} LA22: ;
			}
		}
	}
	break;
	}
	return result;
}

N_NIMCALL(void, searchforinnerprocs_431541)(toutercontext429022* o, tnode226816* n, tenv429020* 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):
	{
		tsym226846* fn;
		fn = (*n).kindU.S4.Sym;
		{
			NIM_BOOL LOC9;
			NIM_BOOL LOC11;
			tnode226816* body;
			tnode226816* ex;
			tenv429020* envb;
			NI capturedcounter;
			LOC9 = 0;
			LOC9 = isinnerproc_429902(fn, (*o).Fn);
			if (!(LOC9)) goto LA10;
			LOC11 = 0;
			LOC11 = containsorincl_223916((&(*o).Processed), (*fn).Sup.Id);
			LOC9 = !(LOC11);
			LA10: ;
			if (!LOC9) goto LA12;
			body = getbody_280269(fn);
			ex = closurecreationpoint_431358(body);
			envb = newenv_429675(o, env, ex, fn);
			addparamstoenv_431386(fn, envb);
			searchforinnerprocs_431541(o, body, envb);
			asgnRefNoCycle((void**) (&(*(*fn).Ast).kindU.S6.Sons->data[6]), ex);
			capturedcounter = gathervars_430721(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;
				{
					tidobj201015* LOC22;
					TNimObject* LOC23;
					tidobj201015* LOC26;
					TNimObject* LOC27;
					LOC22 = 0;
					LOC22 = &fn->Sup;
					LOC23 = 0;
					LOC23 = idtableget_236182((*o).Lambdastoenv, LOC22);
					if (!(LOC23 == NIM_NIL)) goto LA24;
					LOC26 = 0;
					LOC26 = &fn->Sup;
					LOC27 = 0;
					LOC27 = &env->Sup;
					idtableput_236196((&(*o).Lambdastoenv), LOC26, LOC27);
				}
				LA24: ;
				addclosureparam_429962(fn, env);
			}
			goto LA14;
			LA18: ;
			{
				tsym226846* LOC29;
				tnode226816* ti;
				LOC29 = 0;
				LOC29 = getenvparam_429349(fn);
				if (!!((LOC29 == NIM_NIL))) goto LA30;
				ti = transforminnerproc_431192(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_431541(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;
			tnode226816* ex;
			tenv429020* LOC50;
			if (!!(((*(*env).Fn).Kind == ((NU8) 15)))) goto LA44;
			LOC46 = 0;
			LOC46 = len_227364(n);
			body = (NI64)(LOC46 - 1);
			{
				NI i_431752;
				NI HEX3Atmp_432081;
				NI res_432084;
				i_431752 = 0;
				HEX3Atmp_432081 = 0;
				HEX3Atmp_432081 = (NI64)(body - 1);
				res_432084 = 0;
				{
					while (1) {
						if (!(res_432084 <= HEX3Atmp_432081)) goto LA49;
						i_431752 = res_432084;
						searchforinnerprocs_431541(o, (*n).kindU.S6.Sons->data[i_431752], env);
						res_432084 += 1;
					} LA49: ;
				}
			}
			ex = closurecreationpoint_431358((*n).kindU.S6.Sons->data[body]);
			LOC50 = 0;
			LOC50 = newenv_429675(o, env, ex, (*env).Fn);
			searchforinnerprocs_431541(o, (*n).kindU.S6.Sons->data[body], LOC50);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[body]), ex);
		}
		goto LA42;
		LA44: ;
		{
			{
				NI i_431822;
				NI HEX3Atmp_432087;
				NI LOC53;
				NI res_432090;
				i_431822 = 0;
				HEX3Atmp_432087 = 0;
				LOC53 = 0;
				LOC53 = sonslen_227249(n);
				HEX3Atmp_432087 = (NI64)(LOC53 - 1);
				res_432090 = 0;
				{
					while (1) {
						if (!(res_432090 <= HEX3Atmp_432087)) goto LA55;
						i_431822 = res_432090;
						searchforinnerprocs_431541(o, (*n).kindU.S6.Sons->data[i_431822], env);
						res_432090 += 1;
					} LA55: ;
				}
			}
		}
		LA42: ;
	}
	break;
	case ((NU8) 99):
	case ((NU8) 100):
	{
		{
			NI i_431849;
			NI HEX3Atmp_432099;
			NI LOC58;
			NI res_432102;
			i_431849 = 0;
			HEX3Atmp_432099 = 0;
			LOC58 = 0;
			LOC58 = sonslen_227249(n);
			HEX3Atmp_432099 = (NI64)(LOC58 - 1);
			res_432102 = 0;
			{
				while (1) {
					tnode226816* it;
					if (!(res_432102 <= HEX3Atmp_432099)) goto LA60;
					i_431849 = res_432102;
					it = (*n).kindU.S6.Sons->data[i_431849];
					{
						if (!((*it).Kind == ((NU8) 125))) goto LA63;
					}
					goto LA61;
					LA63: ;
					{
						NI l;
						if (!((*it).Kind == ((NU8) 35))) goto LA66;
						l = sonslen_227249(it);
						{
							if (!((*(*it).kindU.S6.Sons->data[0]).Kind == ((NU8) 3))) goto LA70;
							incl_223869((&(*env).Vars), (*(*(*it).kindU.S6.Sons->data[0]).kindU.S4.Sym).Sup.Id);
						}
						LA70: ;
						searchforinnerprocs_431541(o, (*it).kindU.S6.Sons->data[(NI64)(l - 1)], env);
					}
					goto LA61;
					LA66: ;
					{
						NI l;
						if (!((*it).Kind == ((NU8) 36))) goto LA73;
						l = sonslen_227249(it);
						{
							NI j_431972;
							NI HEX3Atmp_432094;
							NI res_432097;
							j_431972 = 0;
							HEX3Atmp_432094 = 0;
							HEX3Atmp_432094 = (NI64)(l - 3);
							res_432097 = 0;
							{
								while (1) {
									if (!(res_432097 <= HEX3Atmp_432094)) goto LA77;
									j_431972 = res_432097;
									{
										if (!((*(*it).kindU.S6.Sons->data[j_431972]).Kind == ((NU8) 3))) goto LA80;
										incl_223869((&(*env).Vars), (*(*(*it).kindU.S6.Sons->data[j_431972]).kindU.S4.Sym).Sup.Id);
									}
									LA80: ;
									res_432097 += 1;
								} LA77: ;
							}
						}
						searchforinnerprocs_431541(o, (*it).kindU.S6.Sons->data[(NI64)(l - 1)], env);
					}
					goto LA61;
					LA73: ;
					{
						internalerror_198987((*it).Info, ((NimStringDesc*) &TMP3192));
					}
					LA61: ;
					res_432102 += 1;
				} LA60: ;
			}
		}
	}
	break;
	case ((NU8) 154):
	{
		searchforinnerprocs_431541(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_432065;
			NI HEX3Atmp_432105;
			NI LOC87;
			NI res_432108;
			i_432065 = 0;
			HEX3Atmp_432105 = 0;
			LOC87 = 0;
			LOC87 = sonslen_227249(n);
			HEX3Atmp_432105 = (NI64)(LOC87 - 1);
			res_432108 = 0;
			{
				while (1) {
					if (!(res_432108 <= HEX3Atmp_432105)) goto LA89;
					i_432065 = res_432108;
					searchforinnerprocs_431541(o, (*n).kindU.S6.Sons->data[i_432065], env);
					res_432108 += 1;
				} LA89: ;
			}
		}
	}
	break;
	}
	BeforeRet: ;
}

N_NIMCALL(tnode226816*, newasgnstmt_432161)(tnode226816* le, tnode226816* ri, tlineinfo196539 info) {
	tnode226816* result;
	result = 0;
	result = newnodei_229007(((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(tnode226816*, rawclosurecreation_432201)(toutercontext429022* o, tenv429020* scope, tnode226816* env) {
	tnode226816* result;
	tsym226846* LOC5;
	tnode226816* LOC6;
	result = 0;
	result = newnodei_227138(((NU8) 115), (*env).Info);
	{
		tnode226816* v;
		if (!((*env).Kind == ((NU8) 3))) goto LA3;
		v = newnodei_227138(((NU8) 99), (*env).Info);
		addvar_425053(v, env);
		add_227498(result, v);
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = getsyssym_283054(((NimStringDesc*) &TMP3138));
	LOC6 = 0;
	LOC6 = newcall_429891(LOC5, env);
	add_227498(result, LOC6);
	{
		tsym226846* local_432229;
		tsymseq226818* HEX3Atmp_432287;
		NI i_432290;
		NI l_432292;
		local_432229 = 0;
		HEX3Atmp_432287 = 0;
		HEX3Atmp_432287 = (*scope).Capturedvars;
		i_432290 = 0;
		l_432292 = HEX3Atmp_432287->Sup.len;
		{
			while (1) {
				tnode226816* fieldaccess;
				tnode226816* existing;
				tidobj201015* LOC16;
				if (!(i_432290 < l_432292)) goto LA9;
				local_432229 = HEX3Atmp_432287->data[i_432290];
				fieldaccess = indirectaccess_426848(env, local_432229, (*env).Info);
				{
					tnode226816* LOC14;
					tnode226816* LOC15;
					if (!((*local_432229).Kind == ((NU8) 3))) goto LA12;
					LOC14 = 0;
					LOC14 = newsymnode_227132(local_432229);
					LOC15 = 0;
					LOC15 = newasgnstmt_432161(fieldaccess, LOC14, (*env).Info);
					add_227498(result, LOC15);
				}
				LA12: ;
				LOC16 = 0;
				LOC16 = &local_432229->Sup;
				existing = idnodetableget_236212((*o).Localstoaccess, LOC16);
				{
					tidobj201015* LOC21;
					if (!existing == 0) goto LA19;
					LOC21 = 0;
					LOC21 = &local_432229->Sup;
					idnodetableput_236219((&(*o).Localstoaccess), LOC21, fieldaccess);
				}
				goto LA17;
				LA19: ;
				{
					tnode226816* LOC23;
					LOC23 = 0;
					LOC23 = newasgnstmt_432161(fieldaccess, existing, (*env).Info);
					add_227498(result, LOC23);
				}
				LA17: ;
				i_432290 += 1;
			} LA9: ;
		}
	}
	{
		if (!!(((*scope).Upfield == NIM_NIL))) goto LA26;
		{
			tnode226816* LOC32;
			tsym226846* LOC33;
			tnode226816* LOC34;
			tnode226816* LOC35;
			if (!!(((*(*scope).Up).Fn == (*scope).Fn))) goto LA30;
			LOC32 = 0;
			LOC32 = indirectaccess_426848(env, (*scope).Upfield, (*env).Info);
			LOC33 = 0;
			LOC33 = getenvparam_429349((*scope).Fn);
			LOC34 = 0;
			LOC34 = newsymnode_227132(LOC33);
			LOC35 = 0;
			LOC35 = newasgnstmt_432161(LOC32, LOC34, (*env).Info);
			add_227498(result, LOC35);
		}
		goto LA28;
		LA30: ;
		{
			tnode226816* LOC37;
			tnode226816* LOC38;
			tnode226816* LOC39;
			LOC37 = 0;
			LOC37 = indirectaccess_426848(env, (*scope).Upfield, (*env).Info);
			LOC38 = 0;
			LOC38 = getclosurevar_431015((*scope).Up);
			LOC39 = 0;
			LOC39 = newasgnstmt_432161(LOC37, LOC38, (*env).Info);
			add_227498(result, LOC39);
		}
		LA28: ;
	}
	LA26: ;
	return result;
}

N_NIMCALL(tnode226816*, generateclosurecreation_432308)(toutercontext429022* o, tenv429020* scope) {
	tnode226816* result;
	tnode226816* env;
	result = 0;
	env = getclosurevar_431015(scope);
	result = rawclosurecreation_432201(o, scope, env);
	return result;
}

N_NIMCALL(void, createenvironments_433610)(toutercontext429022* o) {
	tenv429020* env;
	env = (*o).Head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				tnode226816* 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_432308(o, env));
				}
				LA11: ;
			}
			LA7: ;
			env = (*env).Next;
		} LA2: ;
	}
}

static N_INLINE(NIM_BOOL, interestingitervar_432446)(tsym226846* 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(tnode226816*, liftitersym_433255)(tnode226816* n) {
	tnode226816* result;
	tsym226846* iter;
	tsym226846* env;
	tsym226846* LOC1;
	tnode226816* v;
	tnode226816* LOC2;
	tnode226816* envasnode;
	tsym226846* LOC3;
	tnode226816* LOC4;
	tnode226816* LOC5;
	result = 0;
	iter = (*n).kindU.S4.Sym;
	result = newnodeit_227145(((NU8) 126), (*n).Info, (*n).Typ);
	LOC1 = 0;
	LOC1 = gethiddenparam_429238(iter);
	env = copysym_227203(LOC1, NIM_FALSE);
	(*env).Kind = ((NU8) 9);
	v = newnodei_227138(((NU8) 99), (*n).Info);
	LOC2 = 0;
	LOC2 = newsymnode_227132(env);
	addvar_425053(v, LOC2);
	add_227498(result, v);
	envasnode = newsymnode_227132(env);
	LOC3 = 0;
	LOC3 = getsyssym_283054(((NimStringDesc*) &TMP3138));
	LOC4 = 0;
	LOC4 = newcall_429891(LOC3, envasnode);
	add_227498(result, LOC4);
	LOC5 = 0;
	LOC5 = makeclosure_430949(iter, envasnode, (*n).Info);
	add_227498(result, LOC5);
	return result;
}

N_NIMCALL(tnode226816*, generateiterclosurecreation_432320)(toutercontext429022* o, tenv429020* env, tnode226816* scope) {
	tnode226816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		tnode226816* cc;
		tnode226816* insertpoint;
		LOC3 = 0;
		LOC3 = (*env).Createdvarcomesfromiter;
		if (LOC3) goto LA4;
		LOC3 = (*env).Createdvar == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = newclosurecreationvar_430978(env);
		cc = rawclosurecreation_432201(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: ;
		{
			{
				tnode226816* x_432401;
				x_432401 = 0;
				{
					NI i_432423;
					NI HEX3Atmp_432425;
					NI LOC14;
					NI res_432427;
					i_432423 = 0;
					HEX3Atmp_432425 = 0;
					LOC14 = 0;
					LOC14 = len_227364(cc);
					HEX3Atmp_432425 = (LOC14 - 1);
					res_432427 = 0;
					{
						while (1) {
							if (!(res_432427 <= HEX3Atmp_432425)) goto LA16;
							i_432423 = res_432427;
							x_432401 = (*cc).kindU.S6.Sons->data[i_432423];
							add_227498(insertpoint, x_432401);
							res_432427 += 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(tnode226816*, generatethunk_430861)(tnode226816* prc, ttype226852* dest) {
	tnode226816* result;
	tnode226816* conv;
	ttype226852* LOC5;
	tnode226816* LOC6;
	result = 0;
	{
		if (!(gcmd_170120 == ((NU8) 4))) goto LA3;
		result = prc;
		goto BeforeRet;
	}
	LA3: ;
	result = newnodeit_227145(((NU8) 154), (*prc).Info, dest);
	conv = newnodeit_227145(((NU8) 58), (*prc).Info, dest);
	add_227498(conv, emptynode_227738);
	add_227498(conv, prc);
	add_227498(result, conv);
	LOC5 = 0;
	LOC5 = getsystype_283030(((NU8) 5));
	LOC6 = 0;
	LOC6 = newnodeit_227145(((NU8) 23), (*prc).Info, LOC5);
	add_227498(result, LOC6);
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode226816*, transformouterconv_430882)(tnode226816* n) {
	tnode226816* result;
	ttype226852* dest;
	ttype226852* source;
	result = 0;
	dest = skiptypes_231245((*n).Typ, IL64(211106242013440));
	source = skiptypes_231245((*(*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_430861((*n).kindU.S6.Sons->data[1], dest);
		}
		LA9: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(tnode226816*, transformyield_432491)(toutercontext429022* c, tnode226816* n, titer429016* it) {
	tnode226816* result;
	NI64 stateno;
	tnode226816* stateasgnstmt;
	tnode226816* LOC1;
	tnode226816* LOC2;
	ttype226852* LOC3;
	tnode226816* LOC4;
	tnode226816* retstmt;
	tnode226816* statelabelstmt;
	ttype226852* LOC17;
	tnode226816* 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_227138(((NU8) 73), (*n).Info);
	LOC1 = 0;
	LOC1 = newsymnode_227132((*it).Closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_425407(LOC1, (*it).State, (*n).Info);
	add_227498(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_283030(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_227103(((NU8) 6), stateno, LOC3);
	add_227498(stateasgnstmt, LOC4);
	retstmt = newnodei_227138(((NU8) 109), (*n).Info);
	{
		tnode226816* a;
		tnode226816* retval;
		tnode226816* LOC9;
		tnode226816* LOC10;
		if (!!(((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 1)))) goto LA7;
		a = newnodei_227138(((NU8) 73), (*(*n).kindU.S6.Sons->data[0]).Info);
		retval = transformouterproc_432483(c, (*n).kindU.S6.Sons->data[0], it);
		LOC9 = 0;
		LOC9 = newsymnode_227132((*it).Resultsym);
		addson_227287(a, LOC9);
		LOC10 = 0;
		{
			if (!retval == 0) goto LA13;
			LOC10 = (*n).kindU.S6.Sons->data[0];
		}
		goto LA11;
		LA13: ;
		{
			LOC10 = retval;
		}
		LA11: ;
		addson_227287(a, LOC10);
		add_227498(retstmt, a);
	}
	goto LA5;
	LA7: ;
	{
		add_227498(retstmt, emptynode_227738);
	}
	LA5: ;
	statelabelstmt = newnodei_227138(((NU8) 156), (*n).Info);
	LOC17 = 0;
	LOC17 = getsystype_283030(((NU8) 31));
	LOC18 = 0;
	LOC18 = newinttypenode_227103(((NU8) 6), stateno, LOC17);
	add_227498(statelabelstmt, LOC18);
	result = newnodei_227138(((NU8) 115), (*n).Info);
	add_227498(result, stateasgnstmt);
	add_227498(result, retstmt);
	add_227498(result, statelabelstmt);
	return result;
}

N_NIMCALL(void, outerprocsons_433170)(toutercontext429022* o, tnode226816* n, titer429016* it) {
	{
		NI i_433187;
		NI HEX3Atmp_433235;
		NI LOC2;
		NI res_433238;
		i_433187 = 0;
		HEX3Atmp_433235 = 0;
		LOC2 = 0;
		LOC2 = sonslen_227249(n);
		HEX3Atmp_433235 = (NI64)(LOC2 - 1);
		res_433238 = 0;
		{
			while (1) {
				tnode226816* x;
				if (!(res_433238 <= HEX3Atmp_433235)) goto LA4;
				i_433187 = res_433238;
				x = transformouterproc_432483(o, (*n).kindU.S6.Sons->data[i_433187], it);
				{
					if (!!((x == NIM_NIL))) goto LA7;
					asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[i_433187]), x);
				}
				LA7: ;
				res_433238 += 1;
			} LA4: ;
		}
	}
}

N_NIMCALL(tnode226816*, transformreturn_433157)(toutercontext429022* c, tnode226816* n, titer429016* it) {
	tnode226816* result;
	tnode226816* stateasgnstmt;
	tnode226816* LOC1;
	tnode226816* LOC2;
	ttype226852* LOC3;
	tnode226816* LOC4;
	result = 0;
	result = newnodei_227138(((NU8) 115), (*n).Info);
	stateasgnstmt = newnodei_227138(((NU8) 73), (*n).Info);
	LOC1 = 0;
	LOC1 = newsymnode_227132((*it).Closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_425407(LOC1, (*it).State, (*n).Info);
	add_227498(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_283030(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_227103(((NU8) 6), IL64(-1), LOC3);
	add_227498(stateasgnstmt, LOC4);
	add_227498(result, stateasgnstmt);
	add_227498(result, n);
	return result;
}

N_NIMCALL(tnode226816*, transformouterproc_432483)(toutercontext429022* o, tnode226816* n, titer429016* it) {
	tnode226816* 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):
	{
		tsym226846* local;
		tenv429020* closure;
		tidobj201015* LOC36;
		TNimObject* LOC37;
		tidobj201015* LOC71;
		local = (*n).kindU.S4.Sym;
		{
			NIM_BOOL LOC11;
			tnode226816* body;
			tnode226816* newbody;
			titer429016 LOC15;
			LOC11 = 0;
			LOC11 = isinnerproc_429902(local, (*o).Fn);
			if (!(LOC11)) goto LA12;
			LOC11 = contains_223837((&(*o).Processed), (*local).Sup.Id);
			LA12: ;
			if (!LOC11) goto LA13;
			excl_223884((&(*o).Processed), (*local).Sup.Id);
			body = getbody_280269(local);
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_429412(local, (&LOC15));
			newbody = transformouterprocbody_434214(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_432446(local);
			LA24: ;
			LOC22 = LOC23;
			if (!(LOC22)) goto LA25;
			LOC22 = ((*it).Fn == (*local).Owner);
			LA25: ;
			if (!LOC22) goto LA26;
			{
				NIM_BOOL LOC30;
				tidobj201015* LOC33;
				LOC30 = 0;
				LOC30 = contains_223837((&(*o).Capturedvars), (*local).Sup.Id);
				if (!LOC30) goto LA31;
				LOC33 = 0;
				LOC33 = &local->Sup;
				result = idnodetableget_236212((*o).Localstoaccess, LOC33);
				goto BeforeRet;
			}
			goto LA28;
			LA31: ;
			{
				tnode226816* LOC35;
				adduniquefield_425807((*it).Obj, local);
				LOC35 = 0;
				LOC35 = newsymnode_227132((*it).Closureparam);
				result = indirectaccess_426848(LOC35, local, (*n).Info);
				goto BeforeRet;
			}
			LA28: ;
		}
		LA26: ;
		LOC36 = 0;
		LOC36 = &local->Sup;
		LOC37 = 0;
		LOC37 = idtableget_236182((*o).Lambdastoenv, LOC36);
		closure = ((tenv429020*) (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_198976((*n).Info, ((NU16) 25), (*(*local).Name).S);
			}
			LA46: ;
			{
				if (!closure == 0) goto LA50;
				result = liftitersym_433255(n);
				goto BeforeRet;
			}
			goto LA48;
			LA50: ;
			{
				tnode226816* createdvar;
				createdvar = generateiterclosurecreation_432320(o, closure, (*closure).Attachednode);
				result = makeclosure_430949(local, createdvar, (*n).Info);
				goto BeforeRet;
			}
			LA48: ;
		}
		LA40: ;
		{
			tnode226816* a;
			if (!!((closure == NIM_NIL))) goto LA55;
			a = (*closure).Createdvar;
			{
				if (!!((a == NIM_NIL))) goto LA59;
				result = makeclosure_430949(local, a, (*n).Info);
				goto BeforeRet;
			}
			goto LA57;
			LA59: ;
			{
				tnode226816* scope;
				tnode226816* 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_432308(o, closure));
				}
				LA64: ;
				x = (*closure).Createdvar;
				result = makeclosure_430949(local, x, (*n).Info);
				goto BeforeRet;
			}
			LA57: ;
		}
		LA55: ;
		{
			NIM_BOOL LOC68;
			LOC68 = 0;
			LOC68 = contains_223837((&(*o).Capturedvars), (*local).Sup.Id);
			if (!!(LOC68)) goto LA69;
			goto BeforeRet;
		}
		LA69: ;
		LOC71 = 0;
		LOC71 = &local->Sup;
		result = idnodetableget_236212((*o).Localstoaccess, LOC71);
	}
	break;
	case ((NU8) 51):
	case ((NU8) 84):
	case ((NU8) 52):
	{
		{
			if (!!(((*n).Typ == NIM_NIL))) goto LA75;
			result = transformouterproc_432483(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):
	{
		{
			tsym226846* 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;
				tnode226816* body;
				tnode226816* newbody;
				titer429016 LOC89;
				LOC85 = 0;
				LOC85 = isinnerproc_429902(local, (*o).Fn);
				if (!(LOC85)) goto LA86;
				LOC85 = contains_223837((&(*o).Processed), (*local).Sup.Id);
				LA86: ;
				if (!LOC85) goto LA87;
				excl_223884((&(*o).Processed), (*local).Sup.Id);
				body = getbody_280269(local);
				memset((void*)(&LOC89), 0, sizeof(LOC89));
				inititer_429412(local, (&LOC89));
				newbody = transformouterprocbody_434214(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):
	{
		tnode226816* x;
		x = transformouterproc_432483(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_430882(n);
	}
	break;
	case ((NU8) 104):
	{
		{
			if (!((*(*it).Fn).Kind == ((NU8) 15))) goto LA102;
			result = transformyield_432491(o, n, it);
		}
		goto LA100;
		LA102: ;
		{
			outerprocsons_433170(o, n, it);
		}
		LA100: ;
	}
	break;
	case ((NU8) 109):
	{
		{
			if (!((*(*it).Fn).Kind == ((NU8) 15))) goto LA108;
			result = transformreturn_433157(o, n, it);
		}
		goto LA106;
		LA108: ;
		{
			outerprocsons_433170(o, n, it);
		}
		LA106: ;
	}
	break;
	default:
	{
		outerprocsons_433170(o, n, it);
	}
	break;
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode226816*, transformouterprocbody_434214)(toutercontext429022* o, tnode226816* n, titer429016* it) {
	tnode226816* result;
	result = 0;
	{
		if (!(((*n).Flags &(1<<((((NU8) 7))&15)))!=0)) goto LA3;
		result = NIM_NIL;
	}
	goto LA1;
	LA3: ;
	{
		tnode226816* gs;
		tnode226816* LOC35;
		tnode226816* LOC36;
		tnode226816* state0;
		tnode226816* LOC37;
		tnode226816* newbody;
		tnode226816* stateasgnstmt;
		tnode226816* LOC43;
		tnode226816* LOC44;
		ttype226852* LOC45;
		tnode226816* 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_227364(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;
				tnode226816* LOC26;
				tnode226816* LOC28;
				NI LOC29;
				tnode226816* LOC31;
				tnode226816* LOC32;
				LOC21 = 0;
				LOC22 = 0;
				LOC23 = 0;
				LOC24 = 0;
				LOC24 = len_227364(n);
				LOC23 = (1 < LOC24);
				if (!(LOC23)) goto LA25;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_227698(n, 1);
				LOC23 = ((*LOC26).Kind == ((NU8) 115));
				LA25: ;
				LOC22 = LOC23;
				if (!(LOC22)) goto LA27;
				LOC28 = 0;
				LOC28 = HEX5BHEX5D_227698(n, 1);
				LOC29 = 0;
				LOC29 = len_227364(LOC28);
				LOC22 = (0 < LOC29);
				LA27: ;
				LOC21 = LOC22;
				if (!(LOC21)) goto LA30;
				LOC31 = 0;
				LOC31 = HEX5BHEX5D_227698(n, 1);
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_227698(LOC31, 0);
				LOC21 = ((*LOC32).Kind == ((NU8) 155));
				LA30: ;
				if (!LOC21) goto LA33;
				result = NIM_NIL;
				goto BeforeRet;
			}
			LA33: ;
		}
		LA13: ;
		result = newnodei_227138(((NU8) 115), (*(*it).Fn).Info);
		gs = newnodei_227138(((NU8) 155), (*(*it).Fn).Info);
		LOC35 = 0;
		LOC35 = newsymnode_227132((*it).Closureparam);
		LOC36 = 0;
		LOC36 = rawindirectaccess_425407(LOC35, (*it).State, (*(*it).Fn).Info);
		add_227498(gs, LOC36);
		add_227498(result, gs);
		state0 = newnodei_227138(((NU8) 156), (*(*it).Fn).Info);
		LOC37 = 0;
		LOC37 = newintnode_227096(((NU8) 6), IL64(0));
		add_227498(state0, LOC37);
		add_227498(result, state0);
		newbody = transformouterproc_432483(o, n, it);
		{
			if (!!((newbody == NIM_NIL))) goto LA40;
			add_227498(result, newbody);
		}
		goto LA38;
		LA40: ;
		{
			add_227498(result, n);
		}
		LA38: ;
		stateasgnstmt = newnodei_227138(((NU8) 73), (*(*it).Fn).Info);
		LOC43 = 0;
		LOC43 = newsymnode_227132((*it).Closureparam);
		LOC44 = 0;
		LOC44 = rawindirectaccess_425407(LOC43, (*it).State, (*(*it).Fn).Info);
		add_227498(stateasgnstmt, LOC44);
		LOC45 = 0;
		LOC45 = getsystype_283030(((NU8) 31));
		LOC46 = 0;
		LOC46 = newinttypenode_227103(((NU8) 6), IL64(-1), LOC45);
		add_227498(stateasgnstmt, LOC46);
		add_227498(result, stateasgnstmt);
		(*result).Flags |= ((NI16)1)<<((((NU8) 7))%(sizeof(NI16)*8));
	}
	goto LA1;
	LA6: ;
	{
		result = transformouterproc_432483(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_433837)(toutercontext429022* o) {
	tenv429020* env;
	env = (*o).Head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				tnode226816* 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(tnode226816*, liftlambdas_435871)(tsym226846* fn, tnode226816* body) {
	tnode226816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		tsym226846* LOC7;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*body).Kind == ((NU8) 1));
		if (LOC4) goto LA5;
		LOC4 = (gcmd_170120 == ((NU8) 4));
		LA5: ;
		LOC3 = LOC4;
		if (LOC3) goto LA6;
		LOC7 = 0;
		LOC7 = skipgenericowner_233699(fn);
		LOC3 = !(((*LOC7).Kind == ((NU8) 6)));
		LA6: ;
		if (!LOC3) goto LA8;
		result = body;
	}
	goto LA1;
	LA8: ;
	{
		toutercontext429022* o;
		tnode226816* ex;
		tenv429020* env;
		o = newoutercontext_429647(fn);
		ex = closurecreationpoint_431358(body);
		env = newenv_429675(o, NIM_NIL, ex, fn);
		addparamstoenv_431386(fn, env);
		searchforinnerprocs_431541(o, body, env);
		createenvironments_433610(o);
		{
			titer429016 LOC15;
			if (!((*fn).Kind == ((NU8) 15))) goto LA13;
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_429412(fn, (&LOC15));
			result = transformouterprocbody_434214(o, body, (&LOC15));
		}
		goto LA11;
		LA13: ;
		{
			titer429016 LOC17;
			tnode226816* LOC18;
			memset((void*)(&LOC17), 0, sizeof(LOC17));
			inititer_429412(fn, (&LOC17));
			LOC18 = 0;
			LOC18 = transformouterprocbody_434214(o, body, (&LOC17));
			result = ex;
		}
		LA11: ;
		finishenvironments_433837(o);
	}
	LA1: ;
	return result;
}

N_NIMCALL(tnode226816*, liftlambdasfortoplevel_435921)(tsym226846* module, tnode226816* body) {
	tnode226816* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*body).Kind == ((NU8) 1));
		if (LOC3) goto LA4;
		LOC3 = (gcmd_170120 == ((NU8) 4));
		LA4: ;
		if (!LOC3) goto LA5;
		result = body;
	}
	goto LA1;
	LA5: ;
	{
		toutercontext429022* o;
		tnode226816* ex;
		tenv429020* env;
		titer429016 LOC8;
		tnode226816* LOC9;
		o = newoutercontext_429647(module);
		ex = closurecreationpoint_431358(body);
		env = newenv_429675(o, NIM_NIL, ex, module);
		searchforinnerprocs_431541(o, body, env);
		createenvironments_433610(o);
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		inititer_429412(module, (&LOC8));
		LOC9 = 0;
		LOC9 = transformouterproc_432483(o, body, (&LOC8));
		finishenvironments_433837(o);
		result = ex;
	}
	LA1: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, HEX00_lambdaliftingInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, HEX00_lambdaliftingDatInit)(void) {
static TNimNode* TMP3173[6];
static TNimNode* TMP3174[11];
static TNimNode TMP945[19];
NTI429022.size = sizeof(toutercontext429022);
NTI429022.kind = 18;
NTI429022.base = 0;
TMP3173[0] = &TMP945[1];
TMP945[1].kind = 1;
TMP945[1].offset = offsetof(toutercontext429022, Fn);
TMP945[1].typ = (&NTI226814);
TMP945[1].name = "fn";
TMP3173[1] = &TMP945[2];
NTI429020.size = sizeof(tenv429020);
NTI429020.kind = 17;
NTI429020.base = (&NTI3211);
TMP3174[0] = &TMP945[4];
TMP945[4].kind = 1;
TMP945[4].offset = offsetof(tenv429020, Attachednode);
TMP945[4].typ = (&NTI226808);
TMP945[4].name = "attachedNode";
TMP3174[1] = &TMP945[5];
TMP945[5].kind = 1;
TMP945[5].offset = offsetof(tenv429020, Replacementnode);
TMP945[5].typ = (&NTI226808);
TMP945[5].name = "replacementNode";
TMP3174[2] = &TMP945[6];
TMP945[6].kind = 1;
TMP945[6].offset = offsetof(tenv429020, Createdvar);
TMP945[6].typ = (&NTI226808);
TMP945[6].name = "createdVar";
TMP3174[3] = &TMP945[7];
TMP945[7].kind = 1;
TMP945[7].offset = offsetof(tenv429020, Createdvarcomesfromiter);
TMP945[7].typ = (&NTI138);
TMP945[7].name = "createdVarComesFromIter";
TMP3174[4] = &TMP945[8];
TMP945[8].kind = 1;
TMP945[8].offset = offsetof(tenv429020, Capturedvars);
TMP945[8].typ = (&NTI226818);
TMP945[8].name = "capturedVars";
TMP3174[5] = &TMP945[9];
TMP945[9].kind = 1;
TMP945[9].offset = offsetof(tenv429020, Up);
TMP945[9].typ = (&NTI429018);
TMP945[9].name = "up";
TMP3174[6] = &TMP945[10];
TMP945[10].kind = 1;
TMP945[10].offset = offsetof(tenv429020, Next);
TMP945[10].typ = (&NTI429018);
TMP945[10].name = "next";
TMP3174[7] = &TMP945[11];
TMP945[11].kind = 1;
TMP945[11].offset = offsetof(tenv429020, Upfield);
TMP945[11].typ = (&NTI226814);
TMP945[11].name = "upField";
TMP3174[8] = &TMP945[12];
TMP945[12].kind = 1;
TMP945[12].offset = offsetof(tenv429020, Obj);
TMP945[12].typ = (&NTI226812);
TMP945[12].name = "obj";
TMP3174[9] = &TMP945[13];
TMP945[13].kind = 1;
TMP945[13].offset = offsetof(tenv429020, Fn);
TMP945[13].typ = (&NTI226814);
TMP945[13].name = "fn";
TMP3174[10] = &TMP945[14];
TMP945[14].kind = 1;
TMP945[14].offset = offsetof(tenv429020, Vars);
TMP945[14].typ = (&NTI223056);
TMP945[14].name = "vars";
TMP945[3].len = 11; TMP945[3].kind = 2; TMP945[3].sons = &TMP3174[0];
NTI429020.node = &TMP945[3];
NTI429018.size = sizeof(tenv429020*);
NTI429018.kind = 22;
NTI429018.base = (&NTI429020);
NTI429018.marker = TMP3175;
TMP945[2].kind = 1;
TMP945[2].offset = offsetof(toutercontext429022, Head);
TMP945[2].typ = (&NTI429018);
TMP945[2].name = "head";
TMP3173[2] = &TMP945[15];
TMP945[15].kind = 1;
TMP945[15].offset = offsetof(toutercontext429022, Capturedvars);
TMP945[15].typ = (&NTI223056);
TMP945[15].name = "capturedVars";
TMP3173[3] = &TMP945[16];
TMP945[16].kind = 1;
TMP945[16].offset = offsetof(toutercontext429022, Processed);
TMP945[16].typ = (&NTI223056);
TMP945[16].name = "processed";
TMP3173[4] = &TMP945[17];
TMP945[17].kind = 1;
TMP945[17].offset = offsetof(toutercontext429022, Localstoaccess);
TMP945[17].typ = (&NTI226870);
TMP945[17].name = "localsToAccess";
TMP3173[5] = &TMP945[18];
TMP945[18].kind = 1;
TMP945[18].offset = offsetof(toutercontext429022, Lambdastoenv);
TMP945[18].typ = (&NTI226864);
TMP945[18].name = "lambdasToEnv";
TMP945[0].len = 6; TMP945[0].kind = 2; TMP945[0].sons = &TMP3173[0];
NTI429022.node = &TMP945[0];
NTI429014.size = sizeof(toutercontext429022*);
NTI429014.kind = 22;
NTI429014.base = (&NTI429022);
NTI429014.marker = TMP3176;
}

