/* Generated by Nim Compiler v0.12.0 */
/*   (c) 2015 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 32

#include "nimbase.h"
#include <string.h>
typedef struct Tsym227841 Tsym227841;
typedef struct Tidobj200015 Tidobj200015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq227843 Ttypeseq227843;
typedef struct Tscope227835 Tscope227835;
typedef struct TY227944 TY227944;
typedef struct Tstrtable227813 Tstrtable227813;
typedef struct Tsymseq227811 Tsymseq227811;
typedef struct Ttype227847 Ttype227847;
typedef struct Tident200021 Tident200021;
typedef struct Tlineinfo192352 Tlineinfo192352;
typedef struct Tnode227809 Tnode227809;
typedef struct Tloc227823 Tloc227823;
typedef struct Ropeobj178009 Ropeobj178009;
typedef struct Tlib227827 Tlib227827;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tnodeseq227803 Tnodeseq227803;
typedef struct TY92759 TY92759;
typedef struct Cell48946 Cell48946;
typedef struct Cellseq48962 Cellseq48962;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48958 Cellset48958;
typedef struct Pagedesc48954 Pagedesc48954;
typedef struct Memregion30890 Memregion30890;
typedef struct Smallchunk30842 Smallchunk30842;
typedef struct Llchunk30884 Llchunk30884;
typedef struct Bigchunk30844 Bigchunk30844;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30888 Avlnode30888;
typedef struct Gcstat51014 Gcstat51014;
typedef struct Toutercontext408022 Toutercontext408022;
typedef struct Tenv408020 Tenv408020;
typedef struct Intset224056 Intset224056;
typedef struct Trunk224052 Trunk224052;
typedef struct Trunkseq224054 Trunkseq224054;
typedef struct Tidnodetable227865 Tidnodetable227865;
typedef struct Tidnodepairseq227863 Tidnodepairseq227863;
typedef struct Tidtable227859 Tidtable227859;
typedef struct Tidpairseq227857 Tidpairseq227857;
typedef struct Titer408016 Titer408016;
typedef struct Tinstantiation227831 Tinstantiation227831;
typedef struct Tlistentry143022 Tlistentry143022;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef struct Tidnodepair227861 Tidnodepair227861;
typedef struct Tidpair227855 Tidpair227855;
typedef struct TY227932 TY227932;
typedef N_NIMCALL_PTR(void, TY3889) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3894) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3889 marker;
TY3894 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj200015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable227813  {
NI counter;
Tsymseq227811* data;
};
struct  Tlineinfo192352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc227823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype227847* t;
Ropeobj178009* r;
Ropeobj178009* heaproot;
};
struct  Tsym227841  {
  Tidobj200015 Sup;
NU8 kind;
union{
struct {Ttypeseq227843* typeinstcache;
Tscope227835* typscope;
} S1;
struct {TY227944* procinstcache;
Tsym227841* gcunsafetyreason;
} S2;
struct {TY227944* usedgenerics;
Tstrtable227813 tab;
} S3;
struct {Tsym227841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype227847* typ;
Tident200021* name;
Tlineinfo192352 info;
Tsym227841* owner;
NU32 flags;
Tnode227809* ast;
NU32 options;
NI position;
NI offset;
Tloc227823 loc;
Tlib227827* annex;
Tnode227809* constraint;
};
struct  Ttype227847  {
  Tidobj200015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq227843* sons;
Tnode227809* n;
Tsym227841* owner;
Tsym227841* sym;
Tsym227841* destructor;
Tsym227841* deepcopy;
Tsym227841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc227823 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode227809  {
Ttype227847* typ;
Tlineinfo192352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym227841* sym;
} S4;
struct {Tident200021* ident;
} S5;
struct {Tnodeseq227803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct TY92759 {
NimStringDesc* Field0;
NI Field1;
};
struct  Cell48946  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48962  {
NI len;
NI cap;
Cell48946** d;
};
struct  Cellset48958  {
NI counter;
NI max;
Pagedesc48954* head;
Pagedesc48954** data;
};
typedef Smallchunk30842* TY30905[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30890  {
NI minlargeobj;
NI maxlargeobj;
TY30905 freesmallchunks;
Llchunk30884* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30844* freechunkslist;
Intset30817 chunkstarts;
Avlnode30888* root;
Avlnode30888* deleted;
Avlnode30888* last;
Avlnode30888* freeavlnodes;
};
struct  Gcstat51014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap51018  {
Gcstack51016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq48962 zct;
Cellseq48962 decstack;
Cellset48958 cycleroots;
Cellseq48962 tempstack;
NI recgclock;
Memregion30890 region;
Gcstat51014 stat;
};
struct  Intset224056  {
NI counter;
NI max;
Trunk224052* head;
Trunkseq224054* data;
};
struct  Tidnodetable227865  {
NI counter;
Tidnodepairseq227863* data;
};
struct  Tidtable227859  {
NI counter;
Tidpairseq227857* data;
};
struct  Toutercontext408022  {
Tsym227841* fn;
Tenv408020* head;
Intset224056 capturedvars;
Intset224056 processed;
Tidnodetable227865 localstoaccess;
Tidtable227859 lambdastoenv;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tenv408020  {
  TNimObject Sup;
Tnode227809* attachednode;
Tnode227809* replacementnode;
Tnode227809* createdvar;
NIM_BOOL createdvarcomesfromiter;
Tsymseq227811* capturedvars;
Tenv408020* up;
Tenv408020* next;
Tsym227841* upfield;
Ttype227847* obj;
Tsym227841* fn;
Intset224056 vars;
};
struct  Tident200021  {
  Tidobj200015 Sup;
NimStringDesc* s;
Tident200021* next;
NI h;
};
struct  Titer408016  {
Tsym227841* fn;
Tsym227841* closureparam;
Tsym227841* state;
Tsym227841* resultsym;
Ttype227847* obj;
};
struct  Tscope227835  {
NI depthlevel;
Tstrtable227813 symbols;
Tnodeseq227803* usingsyms;
Tscope227835* parent;
};
struct  Ropeobj178009  {
  TNimObject Sup;
Ropeobj178009* left;
Ropeobj178009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry143022  {
  TNimObject Sup;
Tlistentry143022* prev;
Tlistentry143022* next;
};
struct  Tlib227827  {
  Tlistentry143022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj178009* name;
Tnode227809* path;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30821[16];
struct  Pagedesc48954  {
Pagedesc48954* next;
NI key;
TY30821 bits;
};
struct  Basechunk30840  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30842  {
  Basechunk30840 Sup;
Smallchunk30842* next;
Smallchunk30842* prev;
Freecell30832* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30884  {
NI size;
NI acc;
Llchunk30884* next;
};
struct  Bigchunk30844  {
  Basechunk30840 Sup;
Bigchunk30844* next;
Bigchunk30844* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30821 bits;
};
typedef Avlnode30888* TY30895[2];
struct  Avlnode30888  {
TY30895 link;
NI key;
NI upperbound;
NI level;
};
struct  Trunk224052  {
Trunk224052* next;
NI key;
TY30821 bits;
};
struct  Tidnodepair227861  {
Tidobj200015* key;
Tnode227809* val;
};
struct  Tidpair227855  {
Tidobj200015* key;
TNimObject* val;
};
struct  Tinstantiation227831  {
Tsym227841* sym;
Ttypeseq227843* concretetypes;
TY227932* usedby;
NI compilesid;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct Tsymseq227811 {
  TGenericSeq Sup;
  Tsym227841* data[SEQ_DECL_SIZE];
};
struct Ttypeseq227843 {
  TGenericSeq Sup;
  Ttype227847* data[SEQ_DECL_SIZE];
};
struct TY227944 {
  TGenericSeq Sup;
  Tinstantiation227831* data[SEQ_DECL_SIZE];
};
struct Tnodeseq227803 {
  TGenericSeq Sup;
  Tnode227809* data[SEQ_DECL_SIZE];
};
struct Trunkseq224054 {
  TGenericSeq Sup;
  Trunk224052* data[SEQ_DECL_SIZE];
};
struct Tidnodepairseq227863 {
  TGenericSeq Sup;
  Tidnodepair227861 data[SEQ_DECL_SIZE];
};
struct Tidpairseq227857 {
  TGenericSeq Sup;
  Tidpair227855 data[SEQ_DECL_SIZE];
};
struct TY227932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
static N_INLINE(NIM_BOOL, interestingvar_409406)(Tsym227841* s);
N_NIMCALL(NIM_BOOL, isgenericroutine_232650)(Tsym227841* s);
static N_INLINE(NI, len_228098)(Tnode227809* n);
static N_INLINE(Tnode227809*, HEX5BHEX5D_228244)(Tnode227809* n, NI i);
N_NIMCALL(void, localerror_198139)(Tlineinfo192352 info, NimStringDesc* arg);
N_NIMCALL(Tnode227809*, newnodei_229351)(NU8 kind, Tlineinfo192352 info);
N_NIMCALL(Tsym227841*, copysym_230607)(Tsym227841* s, NIM_BOOL keepid);
N_NIMCALL(Tsym227841*, gethiddenparam_408407)(Tsym227841* routine);
N_NIMCALL(Tnode227809*, lastson_230406)(Tnode227809* n);
N_NIMCALL(void, internalerror_198191)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_198279)(TY92759 x);
N_NIMCALL(void, addvar_404047)(Tnode227809* father, Tnode227809* v);
N_NIMCALL(Tnode227809*, newsymnode_229325)(Tsym227841* sym);
N_NIMCALL(void, add_228165)(Tnode227809* father, Tnode227809* son);
N_NIMCALL(Tnode227809*, newcall_409272)(Tsym227841* a, Tnode227809* b);
N_NIMCALL(Tsym227841*, getsyssym_276077)(NimStringDesc* name);
N_NIMCALL(Tnode227809*, newnodei_229407)(NU8 kind, Tlineinfo192352 info, NI children);
N_NIMCALL(Tnode227809*, newinttypenode_228620)(NU8 kind, NI64 intval, Ttype227847* typ);
N_NIMCALL(Ttype227847*, getsystype_276190)(NU8 kind);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell48946*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48946* c);
N_NOINLINE(void, addzct_52617)(Cellseq48962* s, Cell48946* c);
N_NIMCALL(void, addson_229819)(Tnode227809* father, Tnode227809* son);
N_NIMCALL(Tnode227809*, makeclosure_410034)(Tsym227841* prc, Tnode227809* env, Tlineinfo192352 info);
N_NIMCALL(Tnode227809*, newnodeit_229807)(NU8 kind, Tlineinfo192352 info, Ttype227847* typ);
N_NIMCALL(Tsym227841*, skipgenericowner_232694)(Tsym227841* s);
N_NIMCALL(Toutercontext408022*, newoutercontext_409029)(Tsym227841* fn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3448)(void* p, NI op);
N_NIMCALL(void, TMP3449)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initintset_224927)(Intset224056* Result);
N_NIMCALL(void, initidnodetable_231127)(Tidnodetable227865* x);
N_NIMCALL(void, initidtable_231057)(Tidtable227859* x);
N_NIMCALL(Tnode227809*, closurecreationpoint_410312)(Tnode227809* n);
N_NIMCALL(Tenv408020*, newenv_409049)(Toutercontext408022* o, Tenv408020* up, Tnode227809* n, Tsym227841* 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_55022)(Cell48946* c);
static N_INLINE(NIM_BOOL, canbecycleroot_52667)(Cell48946* c);
static N_INLINE(void, rtladdcycleroot_53423)(Cell48946* c);
N_NOINLINE(void, incl_49665)(Cellset48958* s, Cell48946* cell);
static N_INLINE(void, decref_54604)(Cell48946* c);
N_NIMCALL(Tsym227841*, getenvparam_408607)(Tsym227841* routine);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(Ttype227847*, createenvobj_408082)(Tsym227841* owner);
N_NIMCALL(Ttype227847*, createobj_404372)(Tsym227841* owner, Tlineinfo192352 info);
N_NIMCALL(void, rawaddfield_404393)(Ttype227847* obj, Tsym227841* field);
N_NIMCALL(Tsym227841*, createstatefield_408070)(Tsym227841* iter);
N_NIMCALL(Tsym227841*, newsym_228656)(NU8 symkind, Tident200021* name, Tsym227841* owner, Tlineinfo192352 info);
N_NIMCALL(Tident200021*, getident_200463)(NimStringDesc* identifier);
N_NIMCALL(Ttype227847*, getstatetype_408049)(Tsym227841* iter);
N_NIMCALL(Tnode227809*, newintnode_228608)(NU8 kind, NI64 intval);
N_NIMCALL(Ttype227847*, newtype_230140)(NU8 kind, Tsym227841* owner);
N_NIMCALL(Ttype227847*, nilorsysint_276036)(void);
N_NIMCALL(void, rawaddson_231498)(Ttype227847* father, Ttype227847* son);
N_NIMCALL(void, addparamstoenv_410343)(Tsym227841* fn, Tenv408020* env);
N_NIMCALL(void, internalerror_198172)(Tlineinfo192352 info, NimStringDesc* errmsg);
N_NIMCALL(void, incl_224856)(Intset224056* s, NI key);
N_NIMCALL(NI, sonslen_230387)(Tnode227809* n);
N_NIMCALL(void, searchforinnerprocs_410423)(Toutercontext408022* o, Tnode227809* n, Tenv408020* env);
N_NIMCALL(NIM_BOOL, isinnerproc_409286)(Tsym227841* s, Tsym227841* outerproc);
N_NIMCALL(NIM_BOOL, containsorincl_224898)(Intset224056* s, NI key);
N_NIMCALL(Tnode227809*, getbody_273062)(Tsym227841* s);
N_NIMCALL(NI, gathervars_409870)(Toutercontext408022* o, Tenv408020* e, Tnode227809* n);
N_NIMCALL(NIM_BOOL, capturevar_409638)(Toutercontext408022* o, Tenv408020* top, Tsym227841* local, Tlineinfo192352 info);
N_NIMCALL(NIM_BOOL, contains_224829)(Intset224056 s, NI key);
static N_INLINE(NIM_BOOL, illegalcapture_409375)(Tsym227841* s);
N_NIMCALL(Ttype227847*, skiptypes_231167)(Ttype227847* t, NU64 kinds);
N_NIMCALL(void, localerror_198128)(Tlineinfo192352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(Tsym227841*, createupfield_409621)(Ttype227847* obj, Ttype227847* fieldtype);
N_NIMCALL(void, addfield_404809)(Ttype227847* obj, Tsym227841* s);
N_NIMCALL(void, addclosureparam_409338)(Tsym227841* fn, Tenv408020* e);
N_NIMCALL(void, addhiddenparam_408124)(Tsym227841* routine, Tsym227841* param);
N_NIMCALL(TNimObject*, idtableget_235182)(Tidtable227859 t, Tidobj200015* key);
N_NIMCALL(void, idtableput_235196)(Tidtable227859* t, Tidobj200015* key, TNimObject* val);
N_NIMCALL(void, addcapturedvar_409215)(Tenv408020* e, Tsym227841* v);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(Tnode227809*, transforminnerproc_410210)(Toutercontext408022* o, Tenv408020* e, Tnode227809* n);
N_NIMCALL(Tnode227809*, getclosurevar_410097)(Tenv408020* e);
N_NIMCALL(Tnode227809*, newclosurecreationvar_410062)(Tenv408020* e);
N_NIMCALL(void, inititer_408807)(Tsym227841* iter, Titer408016* Result);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(Tsym227841*, newiterresult_408093)(Tsym227841* iter);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, adduniquefield_405008)(Ttype227847* obj, Tsym227841* s);
N_NIMCALL(Tnode227809*, indirectaccess_406038)(Tnode227809* a, Tsym227841* b, Tlineinfo192352 info);
N_NIMCALL(Tenv408020*, findenv_410119)(Toutercontext408022* o, Tsym227841* s);
N_NIMCALL(Tnode227809*, nestedaccess_409438)(Tenv408020* top, Tsym227841* local);
N_NIMCALL(void, createenvironments_412010)(Toutercontext408022* o);
N_NIMCALL(Tnode227809*, generateclosurecreation_410883)(Toutercontext408022* o, Tenv408020* scope);
N_NIMCALL(Tnode227809*, rawclosurecreation_410785)(Toutercontext408022* o, Tenv408020* scope, Tnode227809* env);
N_NIMCALL(Tnode227809*, newasgnstmt_410771)(Tnode227809* le, Tnode227809* ri, Tlineinfo192352 info);
N_NIMCALL(Tnode227809*, idnodetableget_235212)(Tidnodetable227865 t, Tidobj200015* key);
N_NIMCALL(void, idnodetableput_235219)(Tidnodetable227865* t, Tidobj200015* key, Tnode227809* val);
N_NIMCALL(Tnode227809*, transformouterprocbody_412614)(Toutercontext408022* o, Tnode227809* n, Titer408016* it);
N_NIMCALL(Tnode227809*, rawindirectaccess_404608)(Tnode227809* a, Tsym227841* field, Tlineinfo192352 info);
N_NIMCALL(Tnode227809*, transformouterproc_411076)(Toutercontext408022* o, Tnode227809* n, Titer408016* it);
N_NIMCALL(void, excl_224871)(Intset224056* s, NI key);
static N_INLINE(NIM_BOOL, interestingitervar_411044)(Tsym227841* s);
N_NIMCALL(Tnode227809*, liftitersym_411731)(Tnode227809* n, Tsym227841* owner);
N_NIMCALL(Tnode227809*, generateiterclosurecreation_410895)(Toutercontext408022* o, Tenv408020* env, Tnode227809* scope);
N_NIMCALL(NI, len_230369)(Ttype227847* n);
N_NIMCALL(Tnode227809*, transformouterconv_409993)(Tnode227809* n);
N_NIMCALL(Tnode227809*, generatethunk_409968)(Tnode227809* prc, Ttype227847* dest);
N_NIMCALL(Tnode227809*, transformyield_411084)(Toutercontext408022* c, Tnode227809* n, Titer408016* it);
N_NIMCALL(void, outerprocsons_411675)(Toutercontext408022* o, Tnode227809* n, Titer408016* it);
N_NIMCALL(Tnode227809*, transformreturn_411658)(Toutercontext408022* c, Tnode227809* n, Titer408016* it);
N_NIMCALL(void, finishenvironments_412224)(Toutercontext408022* o);
STRING_LITERAL(TMP3406, "ignored invalid for loop", 24);
STRING_LITERAL(TMP3408, "compiler/lambdalifting.nim", 26);
NIM_CONST TY92759 TMP3407 = {((NimStringDesc*) &TMP3408),
((NI) 196)}
;
STRING_LITERAL(TMP3409, "internalNew", 11);
STRING_LITERAL(TMP3450, ":envP", 5);
STRING_LITERAL(TMP3451, ":state", 6);
STRING_LITERAL(TMP3452, "liftLambdas: strange params", 27);
STRING_LITERAL(TMP3453, ":up", 3);
STRING_LITERAL(TMP3454, ":env", 4);
NIM_CONST TY92759 TMP3455 = {((NimStringDesc*) &TMP3408),
((NI) 222)}
;
STRING_LITERAL(TMP3456, ":result", 7);
NIM_CONST TY92759 TMP3459 = {((NimStringDesc*) &TMP3408),
((NI) 472)}
;
NIM_CONST TY92759 TMP3460 = {((NimStringDesc*) &TMP3408),
((NI) 315)}
;
NIM_CONST TY92759 TMP3461 = {((NimStringDesc*) &TMP3408),
((NI) 322)}
;
STRING_LITERAL(TMP3462, "searchForInnerProcs", 19);
STRING_LITERAL(TMP3463, "environment computation failed", 30);
extern Gcheap51018 gch_51059;
extern Tnode227809* emptynode_228807;
extern NU8 gcmd_169134;
TNimType NTI408022; /* TOuterContext */
extern TNimType NTI227807; /* PSym */
extern TNimType NTI4011; /* RootObj */
TNimType NTI408020; /* TEnv */
extern TNimType NTI227801; /* PNode */
extern TNimType NTI138; /* bool */
extern TNimType NTI227811; /* TSymSeq */
extern TNimType NTI227805; /* PType */
extern TNimType NTI224056; /* IntSet */
TNimType NTI408018; /* PEnv */
extern TNimType NTI227865; /* TIdNodeTable */
extern TNimType NTI227859; /* TIdTable */
TNimType NTI408014; /* POuterContext */

static N_INLINE(NIM_BOOL, interestingvar_409406)(Tsym227841* 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_409834)(Tsym227841* s, Tsym227841* owner) {
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_409406(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_232650(owner);
			LOC11 = !(LOC13);
			LA12: ;
			if (!LOC11) goto LA14;
			(*(*owner).typ).callconv = ((NU8) 8);
		}
		LA14: ;
	}
	LA7: ;
}

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

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

N_NIMCALL(Tsym227841*, gethiddenparam_408407)(Tsym227841* routine) {
	Tsym227841* result;
	Tnode227809* params;
	Tnode227809* hidden;
	result = 0;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	hidden = lastson_230406(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_198279(TMP3407);
		internalerror_198191(LOC7);
	}
	LA5: ;
	result = (*hidden).kindU.S4.sym;
	return result;
}

N_NIMCALL(Tnode227809*, newcall_409272)(Tsym227841* a, Tnode227809* b) {
	Tnode227809* result;
	Tnode227809* LOC1;
	result = 0;
	result = newnodei_229351(((NU8) 27), (*a).info);
	LOC1 = 0;
	LOC1 = newsymnode_229325(a);
	add_228165(result, LOC1);
	add_228165(result, b);
	return result;
}

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

static N_INLINE(void, rtladdzct_54204)(Cell48946* c) {
	addzct_52617((&gch_51059.zct), c);
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		Cell48946* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_52646(src);
		(*c).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Cell48946* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_52646((*dest));
		{
			(*c).refcount -= ((NI) 8);
			if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA11;
			rtladdzct_54204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(Tnode227809*, makeclosure_410034)(Tsym227841* prc, Tnode227809* env, Tlineinfo192352 info) {
	Tnode227809* result;
	Tnode227809* LOC1;
	result = 0;
	result = newnodeit_229807(((NU8) 155), info, (*prc).typ);
	LOC1 = 0;
	LOC1 = newsymnode_229325(prc);
	add_228165(result, LOC1);
	{
		Ttype227847* LOC6;
		Tnode227809* LOC7;
		if (!(env == NIM_NIL)) goto LA4;
		LOC6 = 0;
		LOC6 = getsystype_276190(((NU8) 5));
		LOC7 = 0;
		LOC7 = newnodeit_229807(((NU8) 23), info, LOC6);
		add_228165(result, LOC7);
	}
	goto LA2;
	LA4: ;
	{
		add_228165(result, env);
	}
	LA2: ;
	return result;
}

N_NIMCALL(Tnode227809*, liftforloop_414344)(Tnode227809* body) {
	Tnode227809* result;
	NI L;
	Tnode227809* call;
	Tsym227841* env;
	Tnode227809* loopbody;
	Tnode227809* whileloop;
	Ttype227847* LOC22;
	Tnode227809* v2;
	Tnode227809* vpart;
	NU8 LOC23;
	Tnode227809* bs;
{	result = 0;
	L = len_228098(body);
	{
		NIM_BOOL LOC3;
		Tnode227809* LOC5;
		LOC3 = 0;
		LOC3 = ((*body).kind == ((NU8) 94));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = HEX5BHEX5D_228244(body, (NI)(L - ((NI) 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;
		localerror_198139((*body).info, ((NimStringDesc*) &TMP3406));
		result = body;
		goto BeforeRet;
	}
	LA6: ;
	call = HEX5BHEX5D_228244(body, (NI)(L - ((NI) 2)));
	result = newnodei_229351(((NU8) 115), (*body).info);
	env = 0;
	{
		NIM_BOOL LOC10;
		Tnode227809* LOC11;
		Tnode227809* LOC13;
		Tsym227841* iter;
		Tnode227809* LOC16;
		Tsym227841* LOC17;
		Tnode227809* v;
		Tnode227809* LOC18;
		Tsym227841* LOC19;
		Tnode227809* LOC20;
		Tnode227809* LOC21;
		LOC10 = 0;
		LOC11 = 0;
		LOC11 = HEX5BHEX5D_228244(call, ((NI) 0));
		LOC10 = ((*LOC11).kind == ((NU8) 3));
		if (!(LOC10)) goto LA12;
		LOC13 = 0;
		LOC13 = HEX5BHEX5D_228244(call, ((NI) 0));
		LOC10 = ((*(*LOC13).kindU.S4.sym).kind == ((NU8) 15));
		LA12: ;
		if (!LOC10) goto LA14;
		LOC16 = 0;
		LOC16 = HEX5BHEX5D_228244(call, ((NI) 0));
		iter = (*LOC16).kindU.S4.sym;
		LOC17 = 0;
		LOC17 = gethiddenparam_408407(iter);
		env = copysym_230607(LOC17, NIM_FALSE);
		v = newnodei_229351(((NU8) 99), (*body).info);
		LOC18 = 0;
		LOC18 = newsymnode_229325(env);
		addvar_404047(v, LOC18);
		add_228165(result, v);
		LOC19 = 0;
		LOC19 = getsyssym_276077(((NimStringDesc*) &TMP3409));
		LOC20 = 0;
		LOC20 = newsymnode_229325(env);
		LOC21 = 0;
		LOC21 = newcall_409272(LOC19, LOC20);
		add_228165(result, LOC21);
	}
	LA14: ;
	loopbody = newnodei_229407(((NU8) 115), (*body).info, ((NI) 3));
	whileloop = newnodei_229407(((NU8) 96), (*body).info, ((NI) 2));
	LOC22 = 0;
	LOC22 = getsystype_276190(((NU8) 1));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.sons->data[((NI) 0)]), newinttypenode_228620(((NU8) 6), IL64(1), LOC22));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.sons->data[((NI) 1)]), loopbody);
	add_228165(result, whileloop);
	v2 = newnodei_229351(((NU8) 100), (*body).info);
	LOC23 = 0;
	{
		if (!(L == ((NI) 3))) goto LA26;
		LOC23 = ((NU8) 35);
	}
	goto LA24;
	LA26: ;
	{
		LOC23 = ((NU8) 36);
	}
	LA24: ;
	vpart = newnodei_229351(LOC23, (*body).info);
	{
		NI i_414622;
		NI HEX3Atmp_414823;
		NI res_414826;
		i_414622 = 0;
		HEX3Atmp_414823 = 0;
		HEX3Atmp_414823 = (NI)(L - ((NI) 3));
		res_414826 = ((NI) 0);
		{
			while (1) {
				Tnode227809* LOC32;
				Tnode227809* LOC33;
				if (!(res_414826 <= HEX3Atmp_414823)) goto LA31;
				i_414622 = res_414826;
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_228244(body, i_414622);
				(*(*LOC32).kindU.S4.sym).kind = ((NU8) 9);
				LOC33 = 0;
				LOC33 = HEX5BHEX5D_228244(body, i_414622);
				addson_229819(vpart, LOC33);
				res_414826 += ((NI) 1);
			} LA31: ;
		}
	}
	addson_229819(vpart, emptynode_228807);
	{
		Tnode227809* LOC38;
		if (!!(env == 0)) goto LA36;
		LOC38 = 0;
		LOC38 = newsymnode_229325(env);
		asgnRefNoCycle((void**) (&(*call).kindU.S6.sons->data[((NI) 0)]), makeclosure_410034((*(*call).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym, LOC38, (*body).info));
	}
	LA36: ;
	addson_229819(vpart, call);
	addson_229819(v2, vpart);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.sons->data[((NI) 0)]), v2);
	bs = newnodei_229351(((NU8) 158), (*body).info);
	addson_229819(bs, (*call).kindU.S6.sons->data[((NI) 0)]);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.sons->data[((NI) 1)]), bs);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.sons->data[((NI) 2)]), HEX5BHEX5D_228244(body, (NI)(L - ((NI) 1))));
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP3448)(void* p, NI op) {
	Tenv408020* a;
	a = (Tenv408020*)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, TMP3449)(void* p, NI op) {
	Toutercontext408022* a;
	a = (Toutercontext408022*)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(Toutercontext408022*, newoutercontext_409029)(Tsym227841* fn) {
	Toutercontext408022* result;
	result = 0;
	result = (Toutercontext408022*) newObj((&NTI408014), sizeof(Toutercontext408022));
	asgnRefNoCycle((void**) (&(*result).fn), fn);
	initintset_224927((&(*result).capturedvars));
	initintset_224927((&(*result).processed));
	initidnodetable_231127((&(*result).localstoaccess));
	initidtable_231057((&(*result).lambdastoenv));
	return result;
}

N_NIMCALL(Tnode227809*, closurecreationpoint_410312)(Tnode227809* n) {
	Tnode227809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC6;
		Tnode227809* LOC8;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*n).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC6 = 0;
		LOC6 = len_228098(n);
		LOC4 = (((NI) 1) <= LOC6);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA7;
		LOC8 = 0;
		LOC8 = HEX5BHEX5D_228244(n, ((NI) 0));
		LOC3 = ((*LOC8).kind == ((NU8) 1));
		LA7: ;
		if (!LOC3) goto LA9;
		result = n;
	}
	goto LA1;
	LA9: ;
	{
		result = newnodei_229351(((NU8) 115), (*n).info);
		add_228165(result, emptynode_228807);
		add_228165(result, n);
	}
	LA1: ;
	return result;
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	Cell48946* c;
	c = usrtocell_52646(p);
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3;
		rtladdzct_54204(c);
	}
	LA3: ;
}

static N_INLINE(NIM_BOOL, canbecycleroot_52667)(Cell48946* c) {
	NIM_BOOL result;
	result = 0;
	result = !((((*(*c).typ).flags &(1<<((((NU8) 1))&7)))!=0));
	return result;
}

static N_INLINE(void, rtladdcycleroot_53423)(Cell48946* c) {
	{
		if (!!((((NI) ((NI)((*c).refcount & ((NI) 3)))) == ((NI) 3)))) goto LA3;
		(*c).refcount = (NI)((NI)((*c).refcount & ((NI) -4)) | ((NI) 3));
		incl_49665((&gch_51059.cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_55022)(Cell48946* c) {
	(*c).refcount = (NI)((NU32)((*c).refcount) + (NU32)(((NI) 8)));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_52667(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_53423(c);
	}
	LA4: ;
}

static N_INLINE(void, decref_54604)(Cell48946* c) {
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3;
		rtladdzct_54204(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_52667(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_53423(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

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

N_NIMCALL(Tsym227841*, getenvparam_408607)(Tsym227841* routine) {
	Tsym227841* result;
	Tnode227809* params;
	Tnode227809* hidden;
	result = 0;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	hidden = lastson_230406(params);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*hidden).kind == ((NU8) 3));
		if (!(LOC3)) goto LA4;
		LOC3 = eqStrings((*(*(*hidden).kindU.S4.sym).name).s, ((NimStringDesc*) &TMP3450));
		LA4: ;
		if (!LOC3) goto LA5;
		result = (*hidden).kindU.S4.sym;
	}
	LA5: ;
	return result;
}

N_NIMCALL(Ttype227847*, getstatetype_408049)(Tsym227841* iter) {
	Ttype227847* result;
	Tnode227809* n;
	Tnode227809* LOC1;
	Tnode227809* LOC2;
	Ttype227847* inttype;
	result = 0;
	n = newnodei_229351(((NU8) 44), (*iter).info);
	LOC1 = 0;
	LOC1 = newintnode_228608(((NU8) 6), IL64(-1));
	addson_229819(n, LOC1);
	LOC2 = 0;
	LOC2 = newintnode_228608(((NU8) 6), IL64(0));
	addson_229819(n, LOC2);
	result = newtype_230140(((NU8) 20), iter);
	asgnRefNoCycle((void**) (&(*result).n), n);
	inttype = nilorsysint_276036();
	{
		if (!inttype == 0) goto LA5;
		inttype = newtype_230140(((NU8) 31), iter);
	}
	LA5: ;
	rawaddson_231498(result, inttype);
	return result;
}

N_NIMCALL(Tsym227841*, createstatefield_408070)(Tsym227841* iter) {
	Tsym227841* result;
	Tident200021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_200463(((NimStringDesc*) &TMP3451));
	result = newsym_228656(((NU8) 19), LOC1, iter, (*iter).info);
	asgnRefNoCycle((void**) (&(*result).typ), getstatetype_408049(iter));
	return result;
}

N_NIMCALL(Ttype227847*, createenvobj_408082)(Tsym227841* owner) {
	Ttype227847* result;
	Tsym227841* LOC1;
	result = 0;
	result = createobj_404372(owner, (*owner).info);
	LOC1 = 0;
	LOC1 = createstatefield_408070(owner);
	rawaddfield_404393(result, LOC1);
	return result;
}

N_NIMCALL(Tenv408020*, newenv_409049)(Toutercontext408022* o, Tenv408020* up, Tnode227809* n, Tsym227841* owner) {
	Tenv408020* result;
	result = 0;
	result = (Tenv408020*) newObj((&NTI408018), sizeof(Tenv408020));
	(*result).Sup.m_type = (&NTI408020);
	if ((*result).capturedvars) nimGCunrefNoCycle((*result).capturedvars);
	(*result).capturedvars = (Tsymseq227811*) newSeqRC1((&NTI227811), 0);
	asgnRef((void**) (&(*result).up), up);
	asgnRefNoCycle((void**) (&(*result).attachednode), n);
	asgnRefNoCycle((void**) (&(*result).fn), owner);
	initintset_224927((&(*result).vars));
	asgnRef((void**) (&(*result).next), (*o).head);
	asgnRef((void**) (&(*o).head), result);
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		Tsym227841* 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_408607(owner);
		{
			if (!!((param == NIM_NIL))) goto LA11;
			asgnRefNoCycle((void**) (&(*result).obj), (*(*param).typ).sons->data[((NI) 0)]);
		}
		LA11: ;
	}
	LA7: ;
	{
		if (!(*result).obj == 0) goto LA15;
		asgnRefNoCycle((void**) (&(*result).obj), createenvobj_408082(owner));
	}
	LA15: ;
	return result;
}

N_NIMCALL(void, addparamstoenv_410343)(Tsym227841* fn, Tenv408020* env) {
	Tnode227809* params;
	Tnode227809* ast;
	params = (*(*fn).typ).n;
	{
		NI i_410368;
		NI HEX3Atmp_410401;
		NI LOC2;
		NI res_410404;
		i_410368 = 0;
		HEX3Atmp_410401 = 0;
		LOC2 = 0;
		LOC2 = len_228098(params);
		HEX3Atmp_410401 = (LOC2 - 1);
		res_410404 = ((NI) 1);
		{
			while (1) {
				Tsym227841* param;
				if (!(res_410404 <= HEX3Atmp_410401)) goto LA4;
				i_410368 = res_410404;
				{
					if (!!(((*(*params).kindU.S6.sons->data[i_410368]).kind == ((NU8) 3)))) goto LA7;
					internalerror_198172((*params).info, ((NimStringDesc*) &TMP3452));
				}
				LA7: ;
				param = (*(*params).kindU.S6.sons->data[i_410368]).kindU.S4.sym;
				incl_224856((&(*env).vars), (*param).Sup.id);
				res_410404 += ((NI) 1);
			} LA4: ;
		}
	}
	ast = (*fn).ast;
	{
		NIM_BOOL LOC11;
		NI LOC12;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = sonslen_230387(ast);
		LOC11 = (((NI) 7) < LOC12);
		if (!(LOC11)) goto LA13;
		LOC11 = ((*(*ast).kindU.S6.sons->data[((NI) 7)]).kind == ((NU8) 3));
		LA13: ;
		if (!LOC11) goto LA14;
		incl_224856((&(*env).vars), (*(*(*ast).kindU.S6.sons->data[((NI) 7)]).kindU.S4.sym).Sup.id);
	}
	LA14: ;
}

N_NIMCALL(NIM_BOOL, isinnerproc_409286)(Tsym227841* s, Tsym227841* outerproc) {
	NIM_BOOL result;
{	result = 0;
	{
		Tsym227841* owner;
		if (!((110592 &(1<<(((*s).kind)&31)))!=0)) goto LA3;
		owner = skipgenericowner_232694(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_409375)(Tsym227841* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	Ttype227847* LOC2;
	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = skiptypes_231167((*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(Tsym227841*, createupfield_409621)(Ttype227847* obj, Ttype227847* fieldtype) {
	Tsym227841* result;
	NI pos;
	Tident200021* LOC1;
	result = 0;
	pos = len_228098((*obj).n);
	LOC1 = 0;
	LOC1 = getident_200463(((NimStringDesc*) &TMP3453));
	result = newsym_228656(((NU8) 19), LOC1, (*obj).owner, (*(*obj).owner).info);
	asgnRefNoCycle((void**) (&(*result).typ), newtype_230140(((NU8) 22), (*obj).owner));
	(*result).position = pos;
	rawaddson_231498((*result).typ, fieldtype);
	addfield_404809(obj, result);
	return result;
}

N_NIMCALL(void, addhiddenparam_408124)(Tsym227841* routine, Tsym227841* param) {
	Tnode227809* params;
	NI LOC1;
	Tnode227809* LOC2;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	LOC1 = 0;
	LOC1 = len_228098((*(*routine).typ).n);
	(*param).position = (NI)(LOC1 - ((NI) 1));
	LOC2 = 0;
	LOC2 = newsymnode_229325(param);
	addson_229819(params, LOC2);
	(*(*routine).typ).flags |= ((NU32)1)<<((((NU8) 11))%(sizeof(NU32)*8));
}

N_NIMCALL(void, addclosureparam_409338)(Tsym227841* fn, Tenv408020* e) {
	Tsym227841* cp;
	cp = getenvparam_408607(fn);
	{
		Tident200021* LOC5;
		if (!(cp == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = getident_200463(((NimStringDesc*) &TMP3450));
		cp = newsym_228656(((NU8) 3), LOC5, fn, (*fn).info);
		(*cp).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
		asgnRefNoCycle((void**) (&(*cp).typ), newtype_230140(((NU8) 22), fn));
		rawaddson_231498((*cp).typ, (*e).obj);
		addhiddenparam_408124(fn, cp);
	}
	LA3: ;
}

N_NIMCALL(void, addcapturedvar_409215)(Tenv408020* e, Tsym227841* v) {
{	{
		Tsym227841* x_409228;
		Tsymseq227811* HEX3Atmp_409251;
		NI i_409254;
		NI L_409256;
		x_409228 = 0;
		HEX3Atmp_409251 = 0;
		HEX3Atmp_409251 = (*e).capturedvars;
		i_409254 = ((NI) 0);
		L_409256 = (HEX3Atmp_409251 ? HEX3Atmp_409251->Sup.len : 0);
		{
			while (1) {
				if (!(i_409254 < L_409256)) goto LA3;
				x_409228 = HEX3Atmp_409251->data[i_409254];
				{
					if (!(x_409228 == v)) goto LA6;
					goto BeforeRet;
				}
				LA6: ;
				i_409254 += ((NI) 1);
			} LA3: ;
		}
	}
	(*e).capturedvars = (Tsymseq227811*) incrSeqV2(&((*e).capturedvars)->Sup, sizeof(Tsym227841*));
	asgnRefNoCycle((void**) (&(*e).capturedvars->data[(*e).capturedvars->Sup.len]), v);
	++(*e).capturedvars->Sup.len;
	addfield_404809((*e).obj, v);
	}BeforeRet: ;
}

N_NIMCALL(NIM_BOOL, capturevar_409638)(Toutercontext408022* o, Tenv408020* top, Tsym227841* local, Tlineinfo192352 info) {
	NIM_BOOL result;
	Tenv408020* it;
{	result = 0;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				LOC5 = 0;
				LOC5 = contains_224829((*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_409375(local);
		if (LOC14) goto LA15;
		LOC14 = !(((257 &(1<<(((*(*(*top).fn).typ).callconv)&15)))!=0));
		LA15: ;
		if (!LOC14) goto LA16;
		localerror_198128(info, ((NU16) 227), (*(*local).name).s);
	}
	LA16: ;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA19;
			{
				NIM_BOOL LOC22;
				LOC22 = 0;
				LOC22 = contains_224829((*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_409621((*it).obj, (*(*it).up).obj));
			}
			LA31: ;
			{
				Tenv408020* u;
				if (!!(((*it).fn == (*local).owner))) goto LA35;
				(*(*(*it).fn).typ).callconv = ((NU8) 8);
				(*(*(*it).fn).typ).flags |= ((NU32)1)<<((((NU8) 11))%(sizeof(NU32)*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_409338((*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_224856((&(*o).capturedvars), (*local).Sup.id);
	addcapturedvar_409215(it, local);
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI, gathervars_409870)(Toutercontext408022* o, Tenv408020* e, Tnode227809* n) {
	NI result;
{	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = ((NI) 0);
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		Tsym227841* s;
		s = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = interestingvar_409406(s);
			if (!(LOC8)) goto LA9;
			LOC8 = !(((*e).fn == (*s).owner));
			LA9: ;
			if (!LOC8) goto LA10;
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = capturevar_409638(o, e, s, (*n).info);
				if (!LOC14) goto LA15;
				result = ((NI) 1);
			}
			LA15: ;
		}
		LA10: ;
	}
	break;
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	case ((NU8) 155):
	case ((NU8) 79):
	case ((NU8) 80):
	case ((NU8) 81):
	case ((NU8) 82):
	case ((NU8) 83):
	case ((NU8) 98):
	{
	}
	break;
	default:
	{
		{
			NI k_409934;
			NI HEX3Atmp_409946;
			NI LOC20;
			NI res_409949;
			k_409934 = 0;
			HEX3Atmp_409946 = 0;
			LOC20 = 0;
			LOC20 = sonslen_230387(n);
			HEX3Atmp_409946 = (NI)(LOC20 - ((NI) 1));
			res_409949 = ((NI) 0);
			{
				while (1) {
					NI LOC23;
					if (!(res_409949 <= HEX3Atmp_409946)) goto LA22;
					k_409934 = res_409949;
					LOC23 = 0;
					LOC23 = gathervars_409870(o, e, (*n).kindU.S6.sons->data[k_409934]);
					result += LOC23;
					res_409949 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym227841*, newiterresult_408093)(Tsym227841* iter) {
	Tsym227841* result;
	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_228098((*iter).ast);
		if (!(((NI) 7) < LOC3)) goto LA4;
		result = (*(*(*iter).ast).kindU.S6.sons->data[((NI) 7)]).kindU.S4.sym;
	}
	goto LA1;
	LA4: ;
	{
		Tident200021* LOC7;
		Tnode227809* LOC8;
		LOC7 = 0;
		LOC7 = getident_200463(((NimStringDesc*) &TMP3456));
		result = newsym_228656(((NU8) 11), LOC7, iter, (*iter).info);
		asgnRefNoCycle((void**) (&(*result).typ), (*(*iter).typ).sons->data[((NI) 0)]);
		(*result).flags |= ((NU32)1)<<((((NU8) 0))%(sizeof(NU32)*8));
		LOC8 = 0;
		LOC8 = newsymnode_229325(result);
		add_228165((*iter).ast, LOC8);
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, inititer_408807)(Tsym227841* iter, Titer408016* Result) {
	unsureAsgnRef((void**) (&(*Result).fn), iter);
	{
		Tsym227841* cp;
		Tnode227809* LOC17;
		if (!((*iter).kind == ((NU8) 15))) goto LA3;
		cp = getenvparam_408607(iter);
		{
			Tident200021* LOC9;
			if (!(cp == NIM_NIL)) goto LA7;
			unsureAsgnRef((void**) (&(*Result).obj), createenvobj_408082(iter));
			LOC9 = 0;
			LOC9 = getident_200463(((NimStringDesc*) &TMP3450));
			cp = newsym_228656(((NU8) 3), LOC9, iter, (*iter).info);
			(*cp).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
			asgnRefNoCycle((void**) (&(*cp).typ), newtype_230140(((NU8) 22), iter));
			rawaddson_231498((*cp).typ, (*Result).obj);
			addhiddenparam_408124(iter, cp);
		}
		goto LA5;
		LA7: ;
		{
			unsureAsgnRef((void**) (&(*Result).obj), (*(*cp).typ).sons->data[((NI) 0)]);
		}
		LA5: ;
		{
			NI LOC13;
			NimStringDesc* LOC16;
			LOC13 = 0;
			LOC13 = len_228098((*(*Result).obj).n);
			if (!!((((NI) 0) < LOC13))) goto LA14;
			LOC16 = 0;
			LOC16 = HEX24_198279(TMP3455);
			internalerror_198191(LOC16);
		}
		LA14: ;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_228244((*(*Result).obj).n, ((NI) 0));
		unsureAsgnRef((void**) (&(*Result).state), (*LOC17).kindU.S4.sym);
		unsureAsgnRef((void**) (&(*Result).closureparam), cp);
		{
			if (!!(((*(*iter).typ).sons->data[((NI) 0)] == NIM_NIL))) goto LA20;
			unsureAsgnRef((void**) (&(*Result).resultsym), newiterresult_408093(iter));
		}
		LA20: ;
	}
	LA3: ;
}

N_NIMCALL(Tnode227809*, newclosurecreationvar_410062)(Tenv408020* e) {
	Tnode227809* result;
	Tsym227841* v;
	Tident200021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_200463(((NimStringDesc*) &TMP3454));
	v = newsym_228656(((NU8) 8), LOC1, (*e).fn, (*(*e).attachednode).info);
	(*v).flags |= ((NU32)1)<<((((NU8) 21))%(sizeof(NU32)*8));
	asgnRefNoCycle((void**) (&(*v).typ), newtype_230140(((NU8) 22), (*e).fn));
	rawaddson_231498((*v).typ, (*e).obj);
	{
		Titer408016 it;
		Tnode227809* 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_408807((*e).fn, (&it));
		adduniquefield_405008(it.obj, v);
		LOC6 = 0;
		LOC6 = newsymnode_229325(it.closureparam);
		result = indirectaccess_406038(LOC6, v, (*v).info);
	}
	goto LA2;
	LA4: ;
	{
		result = newsymnode_229325(v);
	}
	LA2: ;
	return result;
}

N_NIMCALL(Tnode227809*, getclosurevar_410097)(Tenv408020* e) {
	Tnode227809* result;
	result = 0;
	{
		if (!((*e).createdvar == NIM_NIL)) goto LA3;
		result = newclosurecreationvar_410062(e);
		asgnRefNoCycle((void**) (&(*e).createdvar), result);
	}
	goto LA1;
	LA3: ;
	{
		result = (*e).createdvar;
	}
	LA1: ;
	return result;
}

N_NIMCALL(Tenv408020*, findenv_410119)(Toutercontext408022* o, Tsym227841* s) {
	Tenv408020* result;
	Tenv408020* 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_198279(TMP3459);
		internalerror_198191(LOC13);
	}
	LA11: ;
	result = (*env).up;
	{
		while (1) {
			if (!((*result).fn == s)) goto LA15;
			result = (*result).up;
		} LA15: ;
	}
	return result;
}

N_NIMCALL(Tnode227809*, nestedaccess_409438)(Tenv408020* top, Tsym227841* local) {
	Tnode227809* result;
	Tenv408020* it;
	Tsym227841* envparam;
	Tnode227809* access;
{	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_409406(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_224829((*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_408607((*top).fn);
	{
		NimStringDesc* LOC23;
		if (!!(!(envparam == 0))) goto LA21;
		LOC23 = 0;
		LOC23 = HEX24_198279(TMP3460);
		internalerror_198191(LOC23);
	}
	LA21: ;
	access = newsymnode_229325(envparam);
	it = (*top).up;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA25;
			{
				NIM_BOOL LOC28;
				LOC28 = 0;
				LOC28 = contains_224829((*it).vars, (*local).Sup.id);
				if (!LOC28) goto LA29;
				access = indirectaccess_406038(access, local, (*local).info);
				result = access;
				goto BeforeRet;
			}
			LA29: ;
			{
				NimStringDesc* LOC35;
				if (!!(!(((*it).upfield == NIM_NIL)))) goto LA33;
				LOC35 = 0;
				LOC35 = HEX24_198279(TMP3461);
				internalerror_198191(LOC35);
			}
			LA33: ;
			access = indirectaccess_406038(access, (*it).upfield, (*local).info);
			it = (*it).up;
		} LA25: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode227809*, transforminnerproc_410210)(Toutercontext408022* o, Tenv408020* e, Tnode227809* n) {
	Tnode227809* result;
	result = 0;
	switch ((*n).kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		Tsym227841* s;
		s = (*n).kindU.S4.sym;
		{
			Tsym227841* LOC7;
			Tnode227809* LOC8;
			if (!(s == (*e).fn)) goto LA5;
			LOC7 = 0;
			LOC7 = getenvparam_408607(s);
			LOC8 = 0;
			LOC8 = newsymnode_229325(LOC7);
			result = makeclosure_410034(s, LOC8, (*n).info);
		}
		goto LA3;
		LA5: ;
		{
			NIM_BOOL LOC10;
			Tenv408020* LOC14;
			Tnode227809* LOC15;
			LOC10 = 0;
			LOC10 = isinnerproc_409286(s, (*o).fn);
			if (!(LOC10)) goto LA11;
			LOC10 = ((*(*s).typ).callconv == ((NU8) 8));
			LA11: ;
			if (!LOC10) goto LA12;
			LOC14 = 0;
			LOC14 = findenv_410119(o, s);
			LOC15 = 0;
			LOC15 = getclosurevar_410097(LOC14);
			result = makeclosure_410034(s, LOC15, (*n).info);
		}
		goto LA3;
		LA12: ;
		{
			result = nestedaccess_409438(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) 155):
	case ((NU8) 52):
	{
	}
	break;
	default:
	{
		{
			NI j_410273;
			NI HEX3Atmp_410290;
			NI LOC20;
			NI res_410293;
			j_410273 = 0;
			HEX3Atmp_410290 = 0;
			LOC20 = 0;
			LOC20 = sonslen_230387(n);
			HEX3Atmp_410290 = (NI)(LOC20 - ((NI) 1));
			res_410293 = ((NI) 0);
			{
				while (1) {
					Tnode227809* x;
					if (!(res_410293 <= HEX3Atmp_410290)) goto LA22;
					j_410273 = res_410293;
					x = transforminnerproc_410210(o, e, (*n).kindU.S6.sons->data[j_410273]);
					{
						if (!!((x == NIM_NIL))) goto LA25;
						asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[j_410273]), x);
					}
					LA25: ;
					res_410293 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	}
	return result;
}

N_NIMCALL(void, searchforinnerprocs_410423)(Toutercontext408022* o, Tnode227809* n, Tenv408020* 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):
	{
		Tsym227841* fn;
		fn = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC9;
			NIM_BOOL LOC11;
			Tnode227809* body;
			Tnode227809* ex;
			Tenv408020* envb;
			NI capturedcounter;
			LOC9 = 0;
			LOC9 = isinnerproc_409286(fn, (*o).fn);
			if (!(LOC9)) goto LA10;
			LOC11 = 0;
			LOC11 = containsorincl_224898((&(*o).processed), (*fn).Sup.id);
			LOC9 = !(LOC11);
			LA10: ;
			if (!LOC9) goto LA12;
			body = getbody_273062(fn);
			ex = closurecreationpoint_410312(body);
			envb = newenv_409049(o, env, ex, fn);
			addparamstoenv_410343(fn, envb);
			searchforinnerprocs_410423(o, body, envb);
			asgnRefNoCycle((void**) (&(*(*fn).ast).kindU.S6.sons->data[((NI) 6)]), ex);
			capturedcounter = gathervars_409870(o, envb, body);
			{
				NIM_BOOL LOC16;
				LOC16 = 0;
				LOC16 = (capturedcounter == ((NI) 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_409338(fn, env);
			}
			goto LA14;
			LA18: ;
			{
				Tsym227841* LOC29;
				Tnode227809* ti;
				LOC29 = 0;
				LOC29 = getenvparam_408607(fn);
				if (!!((LOC29 == NIM_NIL))) goto LA30;
				ti = transforminnerproc_410210(o, envb, body);
				{
					if (!!((ti == NIM_NIL))) goto LA34;
					asgnRefNoCycle((void**) (&(*(*fn).ast).kindU.S6.sons->data[((NI) 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_410423(o, (*n).kindU.S6.sons->data[((NI) 0)], env);
		}
		LA39: ;
	}
	break;
	case ((NU8) 96):
	case ((NU8) 94):
	case ((NU8) 95):
	case ((NU8) 112):
	{
		{
			NI body;
			NI LOC46;
			Tnode227809* ex;
			Tenv408020* LOC50;
			if (!!(((*(*env).fn).kind == ((NU8) 15)))) goto LA44;
			LOC46 = 0;
			LOC46 = len_228098(n);
			body = (NI)(LOC46 - ((NI) 1));
			{
				NI i_410558;
				NI HEX3Atmp_410681;
				NI res_410684;
				i_410558 = 0;
				HEX3Atmp_410681 = 0;
				HEX3Atmp_410681 = (NI)(body - ((NI) 1));
				res_410684 = ((NI) 0);
				{
					while (1) {
						if (!(res_410684 <= HEX3Atmp_410681)) goto LA49;
						i_410558 = res_410684;
						searchforinnerprocs_410423(o, (*n).kindU.S6.sons->data[i_410558], env);
						res_410684 += ((NI) 1);
					} LA49: ;
				}
			}
			ex = closurecreationpoint_410312((*n).kindU.S6.sons->data[body]);
			LOC50 = 0;
			LOC50 = newenv_409049(o, env, ex, (*env).fn);
			searchforinnerprocs_410423(o, (*n).kindU.S6.sons->data[body], LOC50);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[body]), ex);
		}
		goto LA42;
		LA44: ;
		{
			{
				NI i_410576;
				NI HEX3Atmp_410689;
				NI LOC53;
				NI res_410692;
				i_410576 = 0;
				HEX3Atmp_410689 = 0;
				LOC53 = 0;
				LOC53 = sonslen_230387(n);
				HEX3Atmp_410689 = (NI)(LOC53 - ((NI) 1));
				res_410692 = ((NI) 0);
				{
					while (1) {
						if (!(res_410692 <= HEX3Atmp_410689)) goto LA55;
						i_410576 = res_410692;
						searchforinnerprocs_410423(o, (*n).kindU.S6.sons->data[i_410576], env);
						res_410692 += ((NI) 1);
					} LA55: ;
				}
			}
		}
		LA42: ;
	}
	break;
	case ((NU8) 99):
	case ((NU8) 100):
	{
		{
			NI i_410590;
			NI HEX3Atmp_410705;
			NI LOC58;
			NI res_410708;
			i_410590 = 0;
			HEX3Atmp_410705 = 0;
			LOC58 = 0;
			LOC58 = sonslen_230387(n);
			HEX3Atmp_410705 = (NI)(LOC58 - ((NI) 1));
			res_410708 = ((NI) 0);
			{
				while (1) {
					Tnode227809* it;
					if (!(res_410708 <= HEX3Atmp_410705)) goto LA60;
					i_410590 = res_410708;
					it = (*n).kindU.S6.sons->data[i_410590];
					{
						if (!((*it).kind == ((NU8) 125))) goto LA63;
					}
					goto LA61;
					LA63: ;
					{
						NI L;
						if (!((*it).kind == ((NU8) 35))) goto LA66;
						L = sonslen_230387(it);
						{
							if (!((*(*it).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 3))) goto LA70;
							incl_224856((&(*env).vars), (*(*(*it).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym).Sup.id);
						}
						LA70: ;
						searchforinnerprocs_410423(o, (*it).kindU.S6.sons->data[(NI)(L - ((NI) 1))], env);
					}
					goto LA61;
					LA66: ;
					{
						NI L;
						if (!((*it).kind == ((NU8) 36))) goto LA73;
						L = sonslen_230387(it);
						{
							NI j_410649;
							NI HEX3Atmp_410698;
							NI res_410701;
							j_410649 = 0;
							HEX3Atmp_410698 = 0;
							HEX3Atmp_410698 = (NI)(L - ((NI) 3));
							res_410701 = ((NI) 0);
							{
								while (1) {
									if (!(res_410701 <= HEX3Atmp_410698)) goto LA77;
									j_410649 = res_410701;
									{
										if (!((*(*it).kindU.S6.sons->data[j_410649]).kind == ((NU8) 3))) goto LA80;
										incl_224856((&(*env).vars), (*(*(*it).kindU.S6.sons->data[j_410649]).kindU.S4.sym).Sup.id);
									}
									LA80: ;
									res_410701 += ((NI) 1);
								} LA77: ;
							}
						}
						searchforinnerprocs_410423(o, (*it).kindU.S6.sons->data[(NI)(L - ((NI) 1))], env);
					}
					goto LA61;
					LA73: ;
					{
						internalerror_198172((*it).info, ((NimStringDesc*) &TMP3462));
					}
					LA61: ;
					res_410708 += ((NI) 1);
				} LA60: ;
			}
		}
	}
	break;
	case ((NU8) 155):
	{
		searchforinnerprocs_410423(o, (*n).kindU.S6.sons->data[((NI) 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_410678;
			NI HEX3Atmp_410713;
			NI LOC87;
			NI res_410716;
			i_410678 = 0;
			HEX3Atmp_410713 = 0;
			LOC87 = 0;
			LOC87 = sonslen_230387(n);
			HEX3Atmp_410713 = (NI)(LOC87 - ((NI) 1));
			res_410716 = ((NI) 0);
			{
				while (1) {
					if (!(res_410716 <= HEX3Atmp_410713)) goto LA89;
					i_410678 = res_410716;
					searchforinnerprocs_410423(o, (*n).kindU.S6.sons->data[i_410678], env);
					res_410716 += ((NI) 1);
				} LA89: ;
			}
		}
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(Tnode227809*, newasgnstmt_410771)(Tnode227809* le, Tnode227809* ri, Tlineinfo192352 info) {
	Tnode227809* result;
	result = 0;
	result = newnodei_229407(((NU8) 73), info, ((NI) 2));
	asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 0)]), le);
	asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 1)]), ri);
	return result;
}

N_NIMCALL(Tnode227809*, rawclosurecreation_410785)(Toutercontext408022* o, Tenv408020* scope, Tnode227809* env) {
	Tnode227809* result;
	Tsym227841* LOC5;
	Tnode227809* LOC6;
	result = 0;
	result = newnodei_229351(((NU8) 115), (*env).info);
	{
		Tnode227809* v;
		if (!((*env).kind == ((NU8) 3))) goto LA3;
		v = newnodei_229351(((NU8) 99), (*env).info);
		addvar_404047(v, env);
		add_228165(result, v);
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = getsyssym_276077(((NimStringDesc*) &TMP3409));
	LOC6 = 0;
	LOC6 = newcall_409272(LOC5, env);
	add_228165(result, LOC6);
	{
		Tsym227841* local_410812;
		Tsymseq227811* HEX3Atmp_410862;
		NI i_410865;
		NI L_410867;
		local_410812 = 0;
		HEX3Atmp_410862 = 0;
		HEX3Atmp_410862 = (*scope).capturedvars;
		i_410865 = ((NI) 0);
		L_410867 = (HEX3Atmp_410862 ? HEX3Atmp_410862->Sup.len : 0);
		{
			while (1) {
				Tnode227809* fieldaccess;
				Tnode227809* existing;
				Tidobj200015* LOC16;
				if (!(i_410865 < L_410867)) goto LA9;
				local_410812 = HEX3Atmp_410862->data[i_410865];
				fieldaccess = indirectaccess_406038(env, local_410812, (*env).info);
				{
					Tnode227809* LOC14;
					Tnode227809* LOC15;
					if (!((*local_410812).kind == ((NU8) 3))) goto LA12;
					LOC14 = 0;
					LOC14 = newsymnode_229325(local_410812);
					LOC15 = 0;
					LOC15 = newasgnstmt_410771(fieldaccess, LOC14, (*env).info);
					add_228165(result, LOC15);
				}
				LA12: ;
				LOC16 = 0;
				LOC16 = &local_410812->Sup;
				existing = idnodetableget_235212((*o).localstoaccess, LOC16);
				{
					Tidobj200015* LOC21;
					if (!existing == 0) goto LA19;
					LOC21 = 0;
					LOC21 = &local_410812->Sup;
					idnodetableput_235219((&(*o).localstoaccess), LOC21, fieldaccess);
				}
				goto LA17;
				LA19: ;
				{
					Tnode227809* LOC23;
					LOC23 = 0;
					LOC23 = newasgnstmt_410771(fieldaccess, existing, (*env).info);
					add_228165(result, LOC23);
				}
				LA17: ;
				i_410865 += ((NI) 1);
			} LA9: ;
		}
	}
	{
		if (!!(((*scope).upfield == NIM_NIL))) goto LA26;
		{
			Tnode227809* LOC32;
			Tsym227841* LOC33;
			Tnode227809* LOC34;
			Tnode227809* LOC35;
			if (!!(((*(*scope).up).fn == (*scope).fn))) goto LA30;
			LOC32 = 0;
			LOC32 = indirectaccess_406038(env, (*scope).upfield, (*env).info);
			LOC33 = 0;
			LOC33 = getenvparam_408607((*scope).fn);
			LOC34 = 0;
			LOC34 = newsymnode_229325(LOC33);
			LOC35 = 0;
			LOC35 = newasgnstmt_410771(LOC32, LOC34, (*env).info);
			add_228165(result, LOC35);
		}
		goto LA28;
		LA30: ;
		{
			Tnode227809* LOC37;
			Tnode227809* LOC38;
			Tnode227809* LOC39;
			LOC37 = 0;
			LOC37 = indirectaccess_406038(env, (*scope).upfield, (*env).info);
			LOC38 = 0;
			LOC38 = getclosurevar_410097((*scope).up);
			LOC39 = 0;
			LOC39 = newasgnstmt_410771(LOC37, LOC38, (*env).info);
			add_228165(result, LOC39);
		}
		LA28: ;
	}
	LA26: ;
	return result;
}

N_NIMCALL(Tnode227809*, generateclosurecreation_410883)(Toutercontext408022* o, Tenv408020* scope) {
	Tnode227809* result;
	Tnode227809* env;
	result = 0;
	env = getclosurevar_410097(scope);
	result = rawclosurecreation_410785(o, scope, env);
	return result;
}

N_NIMCALL(void, createenvironments_412010)(Toutercontext408022* o) {
	Tenv408020* env;
	env = (*o).head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				Tnode227809* scope;
				LOC5 = 0;
				LOC5 = (((NI) 0) < ((*env).capturedvars ? (*env).capturedvars->Sup.len : 0));
				if (LOC5) goto LA6;
				LOC5 = !(((*env).upfield == NIM_NIL));
				LA6: ;
				if (!LOC5) goto LA7;
				scope = (*env).attachednode;
				{
					if (!((*(*scope).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 1))) goto LA11;
					asgnRefNoCycle((void**) (&(*env).replacementnode), generateclosurecreation_410883(o, env));
				}
				LA11: ;
			}
			LA7: ;
			env = (*env).next;
		} LA2: ;
	}
}

static N_INLINE(NIM_BOOL, interestingitervar_411044)(Tsym227841* 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(Tnode227809*, liftitersym_411731)(Tnode227809* n, Tsym227841* owner) {
	Tnode227809* result;
	Tsym227841* iter;
	Tsym227841* hp;
	Tsym227841* env;
	Tnode227809* v;
	Tnode227809* LOC1;
	Tnode227809* envasnode;
	Tsym227841* LOC2;
	Tnode227809* LOC3;
	Tnode227809* LOC4;
	result = 0;
	iter = (*n).kindU.S4.sym;
	result = newnodeit_229807(((NU8) 126), (*n).info, (*n).typ);
	hp = gethiddenparam_408407(iter);
	env = newsym_228656(((NU8) 9), (*iter).name, owner, (*n).info);
	asgnRefNoCycle((void**) (&(*env).typ), (*hp).typ);
	(*env).flags = (*hp).flags;
	v = newnodei_229351(((NU8) 99), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_229325(env);
	addvar_404047(v, LOC1);
	add_228165(result, v);
	envasnode = newsymnode_229325(env);
	LOC2 = 0;
	LOC2 = getsyssym_276077(((NimStringDesc*) &TMP3409));
	LOC3 = 0;
	LOC3 = newcall_409272(LOC2, envasnode);
	add_228165(result, LOC3);
	LOC4 = 0;
	LOC4 = makeclosure_410034(iter, envasnode, (*n).info);
	add_228165(result, LOC4);
	return result;
}

N_NIMCALL(Tnode227809*, generateiterclosurecreation_410895)(Toutercontext408022* o, Tenv408020* env, Tnode227809* scope) {
	Tnode227809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode227809* cc;
		Tnode227809* insertpoint;
		LOC3 = 0;
		LOC3 = (*env).createdvarcomesfromiter;
		if (LOC3) goto LA4;
		LOC3 = (*env).createdvar == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = newclosurecreationvar_410062(env);
		cc = rawclosurecreation_410785(o, env, result);
		insertpoint = (*scope).kindU.S6.sons->data[((NI) 0)];
		{
			if (!((*insertpoint).kind == ((NU8) 1))) goto LA9;
			asgnRefNoCycle((void**) (&(*scope).kindU.S6.sons->data[((NI) 0)]), cc);
		}
		goto LA7;
		LA9: ;
		{
			{
				Tnode227809* x_411001;
				x_411001 = 0;
				{
					NI i_411019;
					NI HEX3Atmp_411021;
					NI LOC14;
					NI res_411023;
					i_411019 = 0;
					HEX3Atmp_411021 = 0;
					LOC14 = 0;
					LOC14 = len_228098(cc);
					HEX3Atmp_411021 = (LOC14 - 1);
					res_411023 = ((NI) 0);
					{
						while (1) {
							if (!(res_411023 <= HEX3Atmp_411021)) goto LA16;
							i_411019 = res_411023;
							x_411001 = (*cc).kindU.S6.sons->data[i_411019];
							add_228165(insertpoint, x_411001);
							res_411023 += ((NI) 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(Tnode227809*, generatethunk_409968)(Tnode227809* prc, Ttype227847* dest) {
	Tnode227809* result;
	Tnode227809* conv;
	Ttype227847* LOC5;
	Tnode227809* LOC6;
{	result = 0;
	{
		if (!(gcmd_169134 == ((NU8) 4))) goto LA3;
		result = prc;
		goto BeforeRet;
	}
	LA3: ;
	result = newnodeit_229807(((NU8) 155), (*prc).info, dest);
	conv = newnodeit_229807(((NU8) 58), (*prc).info, dest);
	add_228165(conv, emptynode_228807);
	add_228165(conv, prc);
	add_228165(result, conv);
	LOC5 = 0;
	LOC5 = getsystype_276190(((NU8) 5));
	LOC6 = 0;
	LOC6 = newnodeit_229807(((NU8) 23), (*prc).info, LOC5);
	add_228165(result, LOC6);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode227809*, transformouterconv_409993)(Tnode227809* n) {
	Tnode227809* result;
	Ttype227847* dest;
	Ttype227847* source;
	result = 0;
	dest = skiptypes_231167((*n).typ, IL64(211106242013440));
	source = skiptypes_231167((*(*n).kindU.S6.sons->data[((NI) 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_409968((*n).kindU.S6.sons->data[((NI) 1)], dest);
		}
		LA9: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(Tnode227809*, transformyield_411084)(Toutercontext408022* c, Tnode227809* n, Titer408016* it) {
	Tnode227809* result;
	NI64 stateno;
	Tnode227809* stateasgnstmt;
	Tnode227809* LOC1;
	Tnode227809* LOC2;
	Ttype227847* LOC3;
	Tnode227809* LOC4;
	Tnode227809* retstmt;
	Tnode227809* statelabelstmt;
	Ttype227847* LOC17;
	Tnode227809* LOC18;
	result = 0;
	(*(*(*(*(*it).state).typ).n).kindU.S6.sons->data[((NI) 1)]).kindU.S1.intval += ((NI) 1);
	stateno = (*(*(*(*(*it).state).typ).n).kindU.S6.sons->data[((NI) 1)]).kindU.S1.intval;
	stateasgnstmt = newnodei_229351(((NU8) 73), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_229325((*it).closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_404608(LOC1, (*it).state, (*n).info);
	add_228165(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_276190(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_228620(((NU8) 6), stateno, LOC3);
	add_228165(stateasgnstmt, LOC4);
	retstmt = newnodei_229351(((NU8) 109), (*n).info);
	{
		Tnode227809* a;
		Tnode227809* retval;
		Tnode227809* LOC9;
		Tnode227809* LOC10;
		if (!!(((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 1)))) goto LA7;
		a = newnodei_229351(((NU8) 73), (*(*n).kindU.S6.sons->data[((NI) 0)]).info);
		retval = transformouterproc_411076(c, (*n).kindU.S6.sons->data[((NI) 0)], it);
		LOC9 = 0;
		LOC9 = newsymnode_229325((*it).resultsym);
		addson_229819(a, LOC9);
		LOC10 = 0;
		{
			if (!retval == 0) goto LA13;
			LOC10 = (*n).kindU.S6.sons->data[((NI) 0)];
		}
		goto LA11;
		LA13: ;
		{
			LOC10 = retval;
		}
		LA11: ;
		addson_229819(a, LOC10);
		add_228165(retstmt, a);
	}
	goto LA5;
	LA7: ;
	{
		add_228165(retstmt, emptynode_228807);
	}
	LA5: ;
	statelabelstmt = newnodei_229351(((NU8) 157), (*n).info);
	LOC17 = 0;
	LOC17 = getsystype_276190(((NU8) 31));
	LOC18 = 0;
	LOC18 = newinttypenode_228620(((NU8) 6), stateno, LOC17);
	add_228165(statelabelstmt, LOC18);
	result = newnodei_229351(((NU8) 115), (*n).info);
	add_228165(result, stateasgnstmt);
	add_228165(result, retstmt);
	add_228165(result, statelabelstmt);
	return result;
}

N_NIMCALL(void, outerprocsons_411675)(Toutercontext408022* o, Tnode227809* n, Titer408016* it) {
	{
		NI i_411692;
		NI HEX3Atmp_411709;
		NI LOC2;
		NI res_411712;
		i_411692 = 0;
		HEX3Atmp_411709 = 0;
		LOC2 = 0;
		LOC2 = sonslen_230387(n);
		HEX3Atmp_411709 = (NI)(LOC2 - ((NI) 1));
		res_411712 = ((NI) 0);
		{
			while (1) {
				Tnode227809* x;
				if (!(res_411712 <= HEX3Atmp_411709)) goto LA4;
				i_411692 = res_411712;
				x = transformouterproc_411076(o, (*n).kindU.S6.sons->data[i_411692], it);
				{
					if (!!((x == NIM_NIL))) goto LA7;
					asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_411692]), x);
				}
				LA7: ;
				res_411712 += ((NI) 1);
			} LA4: ;
		}
	}
}

N_NIMCALL(Tnode227809*, transformreturn_411658)(Toutercontext408022* c, Tnode227809* n, Titer408016* it) {
	Tnode227809* result;
	Tnode227809* stateasgnstmt;
	Tnode227809* LOC1;
	Tnode227809* LOC2;
	Ttype227847* LOC3;
	Tnode227809* LOC4;
	result = 0;
	result = newnodei_229351(((NU8) 115), (*n).info);
	stateasgnstmt = newnodei_229351(((NU8) 73), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_229325((*it).closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_404608(LOC1, (*it).state, (*n).info);
	add_228165(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_276190(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_228620(((NU8) 6), IL64(-1), LOC3);
	add_228165(stateasgnstmt, LOC4);
	add_228165(result, stateasgnstmt);
	add_228165(result, n);
	return result;
}

N_NIMCALL(Tnode227809*, transformouterproc_411076)(Toutercontext408022* o, Tnode227809* n, Titer408016* it) {
	Tnode227809* result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (n == NIM_NIL);
		if (LOC3) goto LA4;
		LOC3 = (((*n).flags &(1<<((((NU8) 8))&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):
	{
		Tsym227841* local;
		Tenv408020* closure;
		Tidobj200015* LOC65;
		TNimObject* LOC66;
		Tidobj200015* LOC85;
		local = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC11;
			Tnode227809* body;
			Tnode227809* newbody;
			Titer408016 LOC15;
			LOC11 = 0;
			LOC11 = isinnerproc_409286(local, (*o).fn);
			if (!(LOC11)) goto LA12;
			LOC11 = contains_224829((*o).processed, (*local).Sup.id);
			LA12: ;
			if (!LOC11) goto LA13;
			excl_224871((&(*o).processed), (*local).Sup.id);
			body = getbody_273062(local);
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_408807(local, (&LOC15));
			newbody = transformouterprocbody_412614(o, body, (&LOC15));
			{
				if (!!((newbody == NIM_NIL))) goto LA18;
				asgnRefNoCycle((void**) (&(*(*local).ast).kindU.S6.sons->data[((NI) 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_411044(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_224829((*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: ;
			{
				Tnode227809* LOC35;
				adduniquefield_405008((*it).obj, local);
				LOC35 = 0;
				LOC35 = newsymnode_229325((*it).closureparam);
				result = indirectaccess_406038(LOC35, local, (*n).info);
				goto BeforeRet;
			}
			LA28: ;
		}
		LA26: ;
		{
			Tenv408020* closure;
			Tidobj200015* LOC40;
			TNimObject* LOC41;
			if (!((*local).kind == ((NU8) 15))) goto LA38;
			LOC40 = 0;
			LOC40 = &local->Sup;
			LOC41 = 0;
			LOC41 = idtableget_235182((*o).lambdastoenv, LOC40);
			closure = ((Tenv408020*) (LOC41));
			{
				if (!closure == 0) goto LA44;
				result = liftitersym_411731(n, (*o).fn);
				goto BeforeRet;
			}
			goto LA42;
			LA44: ;
			{
				Tnode227809* createdvar;
				Ttype227847* lpt;
				Tsym227841* LOC47;
				createdvar = generateiterclosurecreation_410895(o, closure, (*closure).attachednode);
				LOC47 = 0;
				LOC47 = gethiddenparam_408407(local);
				lpt = (*LOC47).typ;
				{
					if (!!((lpt == (*createdvar).typ))) goto LA50;
					{
						NIM_BOOL LOC54;
						NI LOC55;
						NI LOC57;
						LOC54 = 0;
						LOC55 = 0;
						LOC55 = len_230369((*(*createdvar).typ).sons->data[((NI) 0)]);
						LOC54 = (LOC55 == ((NI) 1));
						if (!(LOC54)) goto LA56;
						LOC57 = 0;
						LOC57 = len_230369((*lpt).sons->data[((NI) 0)]);
						LOC54 = (((NI) 1) <= LOC57);
						LA56: ;
						if (!LOC54) goto LA58;
						asgnRefNoCycle((void**) (&(*createdvar).typ), lpt);
						{
							if (!((*createdvar).kind == ((NU8) 3))) goto LA62;
							asgnRefNoCycle((void**) (&(*(*createdvar).kindU.S4.sym).typ), lpt);
						}
						LA62: ;
						asgnRefNoCycle((void**) (&(*closure).obj), (*lpt).sons->data[((NI) 0)]);
					}
					goto LA52;
					LA58: ;
					{
						internalerror_198172((*n).info, ((NimStringDesc*) &TMP3463));
					}
					LA52: ;
				}
				LA50: ;
				result = makeclosure_410034(local, createdvar, (*n).info);
				goto BeforeRet;
			}
			LA42: ;
		}
		LA38: ;
		LOC65 = 0;
		LOC65 = &local->Sup;
		LOC66 = 0;
		LOC66 = idtableget_235182((*o).lambdastoenv, LOC65);
		closure = ((Tenv408020*) (LOC66));
		{
			Tnode227809* a;
			if (!!((closure == NIM_NIL))) goto LA69;
			a = (*closure).createdvar;
			{
				if (!!((a == NIM_NIL))) goto LA73;
				result = makeclosure_410034(local, a, (*n).info);
				goto BeforeRet;
			}
			goto LA71;
			LA73: ;
			{
				Tnode227809* scope;
				Tnode227809* x;
				scope = (*closure).attachednode;
				{
					if (!((*(*scope).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 1))) goto LA78;
					asgnRefNoCycle((void**) (&(*scope).kindU.S6.sons->data[((NI) 0)]), generateclosurecreation_410883(o, closure));
				}
				LA78: ;
				x = (*closure).createdvar;
				result = makeclosure_410034(local, x, (*n).info);
				goto BeforeRet;
			}
			LA71: ;
		}
		LA69: ;
		{
			NIM_BOOL LOC82;
			LOC82 = 0;
			LOC82 = contains_224829((*o).capturedvars, (*local).Sup.id);
			if (!!(LOC82)) goto LA83;
			goto BeforeRet;
		}
		LA83: ;
		LOC85 = 0;
		LOC85 = &local->Sup;
		result = idnodetableget_235212((*o).localstoaccess, LOC85);
	}
	break;
	case ((NU8) 51):
	case ((NU8) 84):
	case ((NU8) 52):
	{
		{
			if (!!(((*n).typ == NIM_NIL))) goto LA89;
			result = transformouterproc_411076(o, (*n).kindU.S6.sons->data[((NI) 0)], it);
		}
		LA89: ;
	}
	break;
	case ((NU8) 79):
	case ((NU8) 80):
	case ((NU8) 81):
	case ((NU8) 82):
	case ((NU8) 83):
	{
	}
	break;
	case ((NU8) 155):
	{
		{
			Tsym227841* local;
			if (!((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 3))) goto LA95;
			local = (*(*n).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym;
			{
				NIM_BOOL LOC99;
				Tnode227809* body;
				Tnode227809* newbody;
				Titer408016 LOC103;
				LOC99 = 0;
				LOC99 = isinnerproc_409286(local, (*o).fn);
				if (!(LOC99)) goto LA100;
				LOC99 = contains_224829((*o).processed, (*local).Sup.id);
				LA100: ;
				if (!LOC99) goto LA101;
				excl_224871((&(*o).processed), (*local).Sup.id);
				body = getbody_273062(local);
				memset((void*)(&LOC103), 0, sizeof(LOC103));
				inititer_408807(local, (&LOC103));
				newbody = transformouterprocbody_412614(o, body, (&LOC103));
				{
					if (!!((newbody == NIM_NIL))) goto LA106;
					asgnRefNoCycle((void**) (&(*(*local).ast).kindU.S6.sons->data[((NI) 6)]), newbody);
				}
				LA106: ;
			}
			LA101: ;
		}
		LA95: ;
	}
	break;
	case ((NU8) 58):
	case ((NU8) 59):
	case ((NU8) 60):
	{
		Tnode227809* x;
		x = transformouterproc_411076(o, (*n).kindU.S6.sons->data[((NI) 1)], it);
		{
			if (!!((x == NIM_NIL))) goto LA111;
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 1)]), x);
		}
		LA111: ;
		result = transformouterconv_409993(n);
	}
	break;
	case ((NU8) 104):
	{
		{
			if (!((*(*it).fn).kind == ((NU8) 15))) goto LA116;
			result = transformyield_411084(o, n, it);
		}
		goto LA114;
		LA116: ;
		{
			outerprocsons_411675(o, n, it);
		}
		LA114: ;
	}
	break;
	case ((NU8) 109):
	{
		{
			if (!((*(*it).fn).kind == ((NU8) 15))) goto LA122;
			result = transformreturn_411658(o, n, it);
		}
		goto LA120;
		LA122: ;
		{
			outerprocsons_411675(o, n, it);
		}
		LA120: ;
	}
	break;
	default:
	{
		outerprocsons_411675(o, n, it);
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode227809*, transformouterprocbody_412614)(Toutercontext408022* o, Tnode227809* n, Titer408016* it) {
	Tnode227809* result;
{	result = 0;
	{
		if (!(((*n).flags &(1<<((((NU8) 8))&15)))!=0)) goto LA3;
		result = NIM_NIL;
	}
	goto LA1;
	LA3: ;
	{
		Tnode227809* gs;
		Tnode227809* LOC35;
		Tnode227809* LOC36;
		Tnode227809* state0;
		Tnode227809* LOC37;
		Tnode227809* newbody;
		Tnode227809* stateasgnstmt;
		Tnode227809* LOC43;
		Tnode227809* LOC44;
		Ttype227847* LOC45;
		Tnode227809* 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_228098(n);
			LOC10 = (((NI) 0) < LOC12);
			LA11: ;
			if (!LOC10) goto LA13;
			{
				if (!((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 156))) goto LA17;
				result = NIM_NIL;
				goto BeforeRet;
			}
			LA17: ;
			{
				NIM_BOOL LOC21;
				NIM_BOOL LOC22;
				NIM_BOOL LOC23;
				NI LOC24;
				Tnode227809* LOC26;
				Tnode227809* LOC28;
				NI LOC29;
				Tnode227809* LOC31;
				Tnode227809* LOC32;
				LOC21 = 0;
				LOC22 = 0;
				LOC23 = 0;
				LOC24 = 0;
				LOC24 = len_228098(n);
				LOC23 = (((NI) 1) < LOC24);
				if (!(LOC23)) goto LA25;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_228244(n, ((NI) 1));
				LOC23 = ((*LOC26).kind == ((NU8) 115));
				LA25: ;
				LOC22 = LOC23;
				if (!(LOC22)) goto LA27;
				LOC28 = 0;
				LOC28 = HEX5BHEX5D_228244(n, ((NI) 1));
				LOC29 = 0;
				LOC29 = len_228098(LOC28);
				LOC22 = (((NI) 0) < LOC29);
				LA27: ;
				LOC21 = LOC22;
				if (!(LOC21)) goto LA30;
				LOC31 = 0;
				LOC31 = HEX5BHEX5D_228244(n, ((NI) 1));
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_228244(LOC31, ((NI) 0));
				LOC21 = ((*LOC32).kind == ((NU8) 156));
				LA30: ;
				if (!LOC21) goto LA33;
				result = NIM_NIL;
				goto BeforeRet;
			}
			LA33: ;
		}
		LA13: ;
		result = newnodei_229351(((NU8) 115), (*(*it).fn).info);
		gs = newnodei_229351(((NU8) 156), (*(*it).fn).info);
		LOC35 = 0;
		LOC35 = newsymnode_229325((*it).closureparam);
		LOC36 = 0;
		LOC36 = rawindirectaccess_404608(LOC35, (*it).state, (*(*it).fn).info);
		add_228165(gs, LOC36);
		add_228165(result, gs);
		state0 = newnodei_229351(((NU8) 157), (*(*it).fn).info);
		LOC37 = 0;
		LOC37 = newintnode_228608(((NU8) 6), IL64(0));
		add_228165(state0, LOC37);
		add_228165(result, state0);
		newbody = transformouterproc_411076(o, n, it);
		{
			if (!!((newbody == NIM_NIL))) goto LA40;
			add_228165(result, newbody);
		}
		goto LA38;
		LA40: ;
		{
			add_228165(result, n);
		}
		LA38: ;
		stateasgnstmt = newnodei_229351(((NU8) 73), (*(*it).fn).info);
		LOC43 = 0;
		LOC43 = newsymnode_229325((*it).closureparam);
		LOC44 = 0;
		LOC44 = rawindirectaccess_404608(LOC43, (*it).state, (*(*it).fn).info);
		add_228165(stateasgnstmt, LOC44);
		LOC45 = 0;
		LOC45 = getsystype_276190(((NU8) 31));
		LOC46 = 0;
		LOC46 = newinttypenode_228620(((NU8) 6), IL64(-1), LOC45);
		add_228165(stateasgnstmt, LOC46);
		add_228165(result, stateasgnstmt);
		(*result).flags |= ((NU16)1)<<((((NU8) 8))%(sizeof(NU16)*8));
	}
	goto LA1;
	LA6: ;
	{
		result = transformouterproc_411076(o, n, it);
		{
			if (!!((result == NIM_NIL))) goto LA50;
			(*result).flags |= ((NU16)1)<<((((NU8) 8))%(sizeof(NU16)*8));
		}
		LA50: ;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, finishenvironments_412224)(Toutercontext408022* o) {
	Tenv408020* env;
	env = (*o).head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				Tnode227809* scope;
				if (!!(((*env).replacementnode == NIM_NIL))) goto LA5;
				scope = (*env).attachednode;
				{
					if (!((*(*scope).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 1))) goto LA9;
					asgnRefNoCycle((void**) (&(*scope).kindU.S6.sons->data[((NI) 0)]), (*env).replacementnode);
				}
				LA9: ;
			}
			LA5: ;
			env = (*env).next;
		} LA2: ;
	}
}

N_NIMCALL(Tnode227809*, liftlambdas_414240)(Tsym227841* fn, Tnode227809* body) {
	Tnode227809* result;
	NIM_BOOL iscompiletime;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = (((*fn).flags &(1<<((((NU8) 23))&31)))!=0);
	if (LOC1) goto LA2;
	LOC1 = ((*fn).kind == ((NU8) 17));
	LA2: ;
	iscompiletime = LOC1;
	{
		NIM_BOOL LOC5;
		NIM_BOOL LOC6;
		NIM_BOOL LOC8;
		Tsym227841* LOC11;
		LOC5 = 0;
		LOC6 = 0;
		LOC6 = ((*body).kind == ((NU8) 1));
		if (LOC6) goto LA7;
		LOC8 = 0;
		LOC8 = (gcmd_169134 == ((NU8) 4));
		if (!(LOC8)) goto LA9;
		LOC8 = !(iscompiletime);
		LA9: ;
		LOC6 = LOC8;
		LA7: ;
		LOC5 = LOC6;
		if (LOC5) goto LA10;
		LOC11 = 0;
		LOC11 = skipgenericowner_232694(fn);
		LOC5 = !(((*LOC11).kind == ((NU8) 6)));
		LA10: ;
		if (!LOC5) goto LA12;
		result = body;
	}
	goto LA3;
	LA12: ;
	{
		Toutercontext408022* o;
		Tnode227809* ex;
		Tenv408020* env;
		o = newoutercontext_409029(fn);
		ex = closurecreationpoint_410312(body);
		env = newenv_409049(o, NIM_NIL, ex, fn);
		addparamstoenv_410343(fn, env);
		searchforinnerprocs_410423(o, body, env);
		createenvironments_412010(o);
		{
			Titer408016 LOC19;
			if (!((*fn).kind == ((NU8) 15))) goto LA17;
			memset((void*)(&LOC19), 0, sizeof(LOC19));
			inititer_408807(fn, (&LOC19));
			result = transformouterprocbody_412614(o, body, (&LOC19));
		}
		goto LA15;
		LA17: ;
		{
			Titer408016 LOC21;
			Tnode227809* LOC22;
			memset((void*)(&LOC21), 0, sizeof(LOC21));
			inititer_408807(fn, (&LOC21));
			LOC22 = 0;
			LOC22 = transformouterprocbody_412614(o, body, (&LOC21));
			result = ex;
		}
		LA15: ;
		finishenvironments_412224(o);
	}
	LA3: ;
	return result;
}

N_NIMCALL(Tnode227809*, liftlambdasfortoplevel_414312)(Tsym227841* module, Tnode227809* body) {
	Tnode227809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*body).kind == ((NU8) 1));
		if (LOC3) goto LA4;
		LOC3 = (gcmd_169134 == ((NU8) 4));
		LA4: ;
		if (!LOC3) goto LA5;
		result = body;
	}
	goto LA1;
	LA5: ;
	{
		Toutercontext408022* o;
		Tnode227809* ex;
		Tenv408020* env;
		Titer408016 LOC8;
		Tnode227809* LOC9;
		o = newoutercontext_409029(module);
		ex = closurecreationpoint_410312(body);
		env = newenv_409049(o, NIM_NIL, ex, module);
		searchforinnerprocs_410423(o, body, env);
		createenvironments_412010(o);
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		inititer_408807(module, (&LOC8));
		LOC9 = 0;
		LOC9 = transformouterproc_411076(o, body, (&LOC8));
		finishenvironments_412224(o);
		result = ex;
	}
	LA1: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_lambdaliftingInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, compiler_lambdaliftingDatInit000)(void) {
static TNimNode* TMP3446[6];
static TNimNode* TMP3447[11];
static TNimNode TMP1016[19];
NTI408022.size = sizeof(Toutercontext408022);
NTI408022.kind = 18;
NTI408022.base = 0;
TMP3446[0] = &TMP1016[1];
TMP1016[1].kind = 1;
TMP1016[1].offset = offsetof(Toutercontext408022, fn);
TMP1016[1].typ = (&NTI227807);
TMP1016[1].name = "fn";
TMP3446[1] = &TMP1016[2];
NTI408020.size = sizeof(Tenv408020);
NTI408020.kind = 17;
NTI408020.base = (&NTI4011);
TMP3447[0] = &TMP1016[4];
TMP1016[4].kind = 1;
TMP1016[4].offset = offsetof(Tenv408020, attachednode);
TMP1016[4].typ = (&NTI227801);
TMP1016[4].name = "attachedNode";
TMP3447[1] = &TMP1016[5];
TMP1016[5].kind = 1;
TMP1016[5].offset = offsetof(Tenv408020, replacementnode);
TMP1016[5].typ = (&NTI227801);
TMP1016[5].name = "replacementNode";
TMP3447[2] = &TMP1016[6];
TMP1016[6].kind = 1;
TMP1016[6].offset = offsetof(Tenv408020, createdvar);
TMP1016[6].typ = (&NTI227801);
TMP1016[6].name = "createdVar";
TMP3447[3] = &TMP1016[7];
TMP1016[7].kind = 1;
TMP1016[7].offset = offsetof(Tenv408020, createdvarcomesfromiter);
TMP1016[7].typ = (&NTI138);
TMP1016[7].name = "createdVarComesFromIter";
TMP3447[4] = &TMP1016[8];
TMP1016[8].kind = 1;
TMP1016[8].offset = offsetof(Tenv408020, capturedvars);
TMP1016[8].typ = (&NTI227811);
TMP1016[8].name = "capturedVars";
TMP3447[5] = &TMP1016[9];
TMP1016[9].kind = 1;
TMP1016[9].offset = offsetof(Tenv408020, up);
TMP1016[9].typ = (&NTI408018);
TMP1016[9].name = "up";
TMP3447[6] = &TMP1016[10];
TMP1016[10].kind = 1;
TMP1016[10].offset = offsetof(Tenv408020, next);
TMP1016[10].typ = (&NTI408018);
TMP1016[10].name = "next";
TMP3447[7] = &TMP1016[11];
TMP1016[11].kind = 1;
TMP1016[11].offset = offsetof(Tenv408020, upfield);
TMP1016[11].typ = (&NTI227807);
TMP1016[11].name = "upField";
TMP3447[8] = &TMP1016[12];
TMP1016[12].kind = 1;
TMP1016[12].offset = offsetof(Tenv408020, obj);
TMP1016[12].typ = (&NTI227805);
TMP1016[12].name = "obj";
TMP3447[9] = &TMP1016[13];
TMP1016[13].kind = 1;
TMP1016[13].offset = offsetof(Tenv408020, fn);
TMP1016[13].typ = (&NTI227807);
TMP1016[13].name = "fn";
TMP3447[10] = &TMP1016[14];
TMP1016[14].kind = 1;
TMP1016[14].offset = offsetof(Tenv408020, vars);
TMP1016[14].typ = (&NTI224056);
TMP1016[14].name = "vars";
TMP1016[3].len = 11; TMP1016[3].kind = 2; TMP1016[3].sons = &TMP3447[0];
NTI408020.node = &TMP1016[3];
NTI408018.size = sizeof(Tenv408020*);
NTI408018.kind = 22;
NTI408018.base = (&NTI408020);
NTI408018.marker = TMP3448;
TMP1016[2].kind = 1;
TMP1016[2].offset = offsetof(Toutercontext408022, head);
TMP1016[2].typ = (&NTI408018);
TMP1016[2].name = "head";
TMP3446[2] = &TMP1016[15];
TMP1016[15].kind = 1;
TMP1016[15].offset = offsetof(Toutercontext408022, capturedvars);
TMP1016[15].typ = (&NTI224056);
TMP1016[15].name = "capturedVars";
TMP3446[3] = &TMP1016[16];
TMP1016[16].kind = 1;
TMP1016[16].offset = offsetof(Toutercontext408022, processed);
TMP1016[16].typ = (&NTI224056);
TMP1016[16].name = "processed";
TMP3446[4] = &TMP1016[17];
TMP1016[17].kind = 1;
TMP1016[17].offset = offsetof(Toutercontext408022, localstoaccess);
TMP1016[17].typ = (&NTI227865);
TMP1016[17].name = "localsToAccess";
TMP3446[5] = &TMP1016[18];
TMP1016[18].kind = 1;
TMP1016[18].offset = offsetof(Toutercontext408022, lambdastoenv);
TMP1016[18].typ = (&NTI227859);
TMP1016[18].name = "lambdasToEnv";
TMP1016[0].len = 6; TMP1016[0].kind = 2; TMP1016[0].sons = &TMP3446[0];
NTI408022.node = &TMP1016[0];
NTI408014.size = sizeof(Toutercontext408022*);
NTI408014.kind = 22;
NTI408014.base = (&NTI408022);
NTI408014.marker = TMP3449;
}

