/* 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 Tsym225841 Tsym225841;
typedef struct Tidobj198015 Tidobj198015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq225843 Ttypeseq225843;
typedef struct Tscope225835 Tscope225835;
typedef struct TY225944 TY225944;
typedef struct Tstrtable225813 Tstrtable225813;
typedef struct Tsymseq225811 Tsymseq225811;
typedef struct Ttype225847 Ttype225847;
typedef struct Tident198021 Tident198021;
typedef struct Tlineinfo190352 Tlineinfo190352;
typedef struct Tnode225809 Tnode225809;
typedef struct Tloc225823 Tloc225823;
typedef struct Ropeobj176009 Ropeobj176009;
typedef struct Tlib225827 Tlib225827;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tnodeseq225803 Tnodeseq225803;
typedef struct TY90959 TY90959;
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 Toutercontext406022 Toutercontext406022;
typedef struct Tenv406020 Tenv406020;
typedef struct Intset222056 Intset222056;
typedef struct Trunk222052 Trunk222052;
typedef struct Trunkseq222054 Trunkseq222054;
typedef struct Tidnodetable225865 Tidnodetable225865;
typedef struct Tidnodepairseq225863 Tidnodepairseq225863;
typedef struct Tidtable225859 Tidtable225859;
typedef struct Tidpairseq225857 Tidpairseq225857;
typedef struct Titer406016 Titer406016;
typedef struct Tinstantiation225831 Tinstantiation225831;
typedef struct Tlistentry140022 Tlistentry140022;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef struct Tidnodepair225861 Tidnodepair225861;
typedef struct Tidpair225855 Tidpair225855;
typedef struct TY225932 TY225932;
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  Tidobj198015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable225813  {
NI counter;
Tsymseq225811* data;
};
struct  Tlineinfo190352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc225823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype225847* t;
Ropeobj176009* r;
Ropeobj176009* heaproot;
};
struct  Tsym225841  {
  Tidobj198015 Sup;
NU8 kind;
union{
struct {Ttypeseq225843* typeinstcache;
Tscope225835* typscope;
} S1;
struct {TY225944* procinstcache;
Tsym225841* gcunsafetyreason;
} S2;
struct {TY225944* usedgenerics;
Tstrtable225813 tab;
} S3;
struct {Tsym225841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype225847* typ;
Tident198021* name;
Tlineinfo190352 info;
Tsym225841* owner;
NU32 flags;
Tnode225809* ast;
NU32 options;
NI position;
NI offset;
Tloc225823 loc;
Tlib225827* annex;
Tnode225809* constraint;
};
struct  Ttype225847  {
  Tidobj198015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq225843* sons;
Tnode225809* n;
Tsym225841* owner;
Tsym225841* sym;
Tsym225841* destructor;
Tsym225841* deepcopy;
Tsym225841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc225823 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode225809  {
Ttype225847* typ;
Tlineinfo190352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym225841* sym;
} S4;
struct {Tident198021* ident;
} S5;
struct {Tnodeseq225803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct TY90959 {
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  Intset222056  {
NI counter;
NI max;
Trunk222052* head;
Trunkseq222054* data;
};
struct  Tidnodetable225865  {
NI counter;
Tidnodepairseq225863* data;
};
struct  Tidtable225859  {
NI counter;
Tidpairseq225857* data;
};
struct  Toutercontext406022  {
Tsym225841* fn;
Tenv406020* head;
Intset222056 capturedvars;
Intset222056 processed;
Tidnodetable225865 localstoaccess;
Tidtable225859 lambdastoenv;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tenv406020  {
  TNimObject Sup;
Tnode225809* attachednode;
Tnode225809* replacementnode;
Tnode225809* createdvar;
NIM_BOOL createdvarcomesfromiter;
Tsymseq225811* capturedvars;
Tenv406020* up;
Tenv406020* next;
Tsym225841* upfield;
Ttype225847* obj;
Tsym225841* fn;
Intset222056 vars;
};
struct  Tident198021  {
  Tidobj198015 Sup;
NimStringDesc* s;
Tident198021* next;
NI h;
};
struct  Titer406016  {
Tsym225841* fn;
Tsym225841* closureparam;
Tsym225841* state;
Tsym225841* resultsym;
Ttype225847* obj;
};
struct  Tscope225835  {
NI depthlevel;
Tstrtable225813 symbols;
Tnodeseq225803* usingsyms;
Tscope225835* parent;
};
struct  Ropeobj176009  {
  TNimObject Sup;
Ropeobj176009* left;
Ropeobj176009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry140022  {
  TNimObject Sup;
Tlistentry140022* prev;
Tlistentry140022* next;
};
struct  Tlib225827  {
  Tlistentry140022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj176009* name;
Tnode225809* 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  Trunk222052  {
Trunk222052* next;
NI key;
TY30821 bits;
};
struct  Tidnodepair225861  {
Tidobj198015* key;
Tnode225809* val;
};
struct  Tidpair225855  {
Tidobj198015* key;
TNimObject* val;
};
struct  Tinstantiation225831  {
Tsym225841* sym;
Ttypeseq225843* concretetypes;
TY225932* usedby;
NI compilesid;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct Tsymseq225811 {
  TGenericSeq Sup;
  Tsym225841* data[SEQ_DECL_SIZE];
};
struct Ttypeseq225843 {
  TGenericSeq Sup;
  Ttype225847* data[SEQ_DECL_SIZE];
};
struct TY225944 {
  TGenericSeq Sup;
  Tinstantiation225831* data[SEQ_DECL_SIZE];
};
struct Tnodeseq225803 {
  TGenericSeq Sup;
  Tnode225809* data[SEQ_DECL_SIZE];
};
struct Trunkseq222054 {
  TGenericSeq Sup;
  Trunk222052* data[SEQ_DECL_SIZE];
};
struct Tidnodepairseq225863 {
  TGenericSeq Sup;
  Tidnodepair225861 data[SEQ_DECL_SIZE];
};
struct Tidpairseq225857 {
  TGenericSeq Sup;
  Tidpair225855 data[SEQ_DECL_SIZE];
};
struct TY225932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
static N_INLINE(NIM_BOOL, interestingvar_407406)(Tsym225841* s);
N_NIMCALL(NIM_BOOL, isgenericroutine_230650)(Tsym225841* s);
static N_INLINE(NI, len_226098)(Tnode225809* n);
static N_INLINE(Tnode225809*, HEX5BHEX5D_226244)(Tnode225809* n, NI i);
N_NIMCALL(void, localerror_196139)(Tlineinfo190352 info, NimStringDesc* arg);
N_NIMCALL(Tnode225809*, newnodei_227351)(NU8 kind, Tlineinfo190352 info);
N_NIMCALL(Tsym225841*, copysym_228607)(Tsym225841* s, NIM_BOOL keepid);
N_NIMCALL(Tsym225841*, gethiddenparam_406407)(Tsym225841* routine);
N_NIMCALL(Tnode225809*, lastson_228406)(Tnode225809* n);
N_NIMCALL(void, internalerror_196191)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_196279)(TY90959 x);
N_NIMCALL(void, addvar_402047)(Tnode225809* father, Tnode225809* v);
N_NIMCALL(Tnode225809*, newsymnode_227325)(Tsym225841* sym);
N_NIMCALL(void, add_226165)(Tnode225809* father, Tnode225809* son);
N_NIMCALL(Tnode225809*, newcall_407272)(Tsym225841* a, Tnode225809* b);
N_NIMCALL(Tsym225841*, getsyssym_274077)(NimStringDesc* name);
N_NIMCALL(Tnode225809*, newnodei_227407)(NU8 kind, Tlineinfo190352 info, NI children);
N_NIMCALL(Tnode225809*, newinttypenode_226620)(NU8 kind, NI64 intval, Ttype225847* typ);
N_NIMCALL(Ttype225847*, getsystype_274190)(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_227819)(Tnode225809* father, Tnode225809* son);
N_NIMCALL(Tnode225809*, makeclosure_408034)(Tsym225841* prc, Tnode225809* env, Tlineinfo190352 info);
N_NIMCALL(Tnode225809*, newnodeit_227807)(NU8 kind, Tlineinfo190352 info, Ttype225847* typ);
N_NIMCALL(Tsym225841*, skipgenericowner_230694)(Tsym225841* s);
N_NIMCALL(Toutercontext406022*, newoutercontext_407029)(Tsym225841* fn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3449)(void* p, NI op);
N_NIMCALL(void, TMP3450)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initintset_222927)(Intset222056* Result);
N_NIMCALL(void, initidnodetable_229127)(Tidnodetable225865* x);
N_NIMCALL(void, initidtable_229057)(Tidtable225859* x);
N_NIMCALL(Tnode225809*, closurecreationpoint_408312)(Tnode225809* n);
N_NIMCALL(Tenv406020*, newenv_407049)(Toutercontext406022* o, Tenv406020* up, Tnode225809* n, Tsym225841* 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(Tsym225841*, getenvparam_406607)(Tsym225841* routine);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(Ttype225847*, createenvobj_406082)(Tsym225841* owner);
N_NIMCALL(Ttype225847*, createobj_402372)(Tsym225841* owner, Tlineinfo190352 info);
N_NIMCALL(void, rawaddfield_402393)(Ttype225847* obj, Tsym225841* field);
N_NIMCALL(Tsym225841*, createstatefield_406070)(Tsym225841* iter);
N_NIMCALL(Tsym225841*, newsym_226656)(NU8 symkind, Tident198021* name, Tsym225841* owner, Tlineinfo190352 info);
N_NIMCALL(Tident198021*, getident_198463)(NimStringDesc* identifier);
N_NIMCALL(Ttype225847*, getstatetype_406049)(Tsym225841* iter);
N_NIMCALL(Tnode225809*, newintnode_226608)(NU8 kind, NI64 intval);
N_NIMCALL(Ttype225847*, newtype_228140)(NU8 kind, Tsym225841* owner);
N_NIMCALL(Ttype225847*, nilorsysint_274036)(void);
N_NIMCALL(void, rawaddson_229498)(Ttype225847* father, Ttype225847* son);
N_NIMCALL(void, addparamstoenv_408343)(Tsym225841* fn, Tenv406020* env);
N_NIMCALL(void, internalerror_196172)(Tlineinfo190352 info, NimStringDesc* errmsg);
N_NIMCALL(void, incl_222856)(Intset222056* s, NI key);
N_NIMCALL(NI, sonslen_228387)(Tnode225809* n);
N_NIMCALL(void, searchforinnerprocs_408423)(Toutercontext406022* o, Tnode225809* n, Tenv406020* env);
N_NIMCALL(NIM_BOOL, isinnerproc_407286)(Tsym225841* s, Tsym225841* outerproc);
N_NIMCALL(NIM_BOOL, containsorincl_222898)(Intset222056* s, NI key);
N_NIMCALL(Tnode225809*, getbody_271062)(Tsym225841* s);
N_NIMCALL(NI, gathervars_407870)(Toutercontext406022* o, Tenv406020* e, Tnode225809* n);
N_NIMCALL(NIM_BOOL, capturevar_407638)(Toutercontext406022* o, Tenv406020* top, Tsym225841* local, Tlineinfo190352 info);
N_NIMCALL(NIM_BOOL, contains_222829)(Intset222056 s, NI key);
static N_INLINE(NIM_BOOL, illegalcapture_407375)(Tsym225841* s);
N_NIMCALL(Ttype225847*, skiptypes_229167)(Ttype225847* t, NU64 kinds);
N_NIMCALL(void, localerror_196128)(Tlineinfo190352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(Tsym225841*, createupfield_407621)(Ttype225847* obj, Ttype225847* fieldtype);
N_NIMCALL(void, addfield_402809)(Ttype225847* obj, Tsym225841* s);
N_NIMCALL(void, addclosureparam_407338)(Tsym225841* fn, Tenv406020* e);
N_NIMCALL(void, addhiddenparam_406124)(Tsym225841* routine, Tsym225841* param);
N_NIMCALL(TNimObject*, idtableget_233182)(Tidtable225859 t, Tidobj198015* key);
N_NIMCALL(void, idtableput_233196)(Tidtable225859* t, Tidobj198015* key, TNimObject* val);
N_NIMCALL(void, addcapturedvar_407215)(Tenv406020* e, Tsym225841* v);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(Tnode225809*, transforminnerproc_408210)(Toutercontext406022* o, Tenv406020* e, Tnode225809* n);
N_NIMCALL(Tnode225809*, getclosurevar_408097)(Tenv406020* e);
N_NIMCALL(Tnode225809*, newclosurecreationvar_408062)(Tenv406020* e);
N_NIMCALL(void, inititer_406807)(Tsym225841* iter, Titer406016* Result);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(Tsym225841*, newiterresult_406093)(Tsym225841* iter);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, adduniquefield_403008)(Ttype225847* obj, Tsym225841* s);
N_NIMCALL(Tnode225809*, indirectaccess_404038)(Tnode225809* a, Tsym225841* b, Tlineinfo190352 info);
N_NIMCALL(Tenv406020*, findenv_408119)(Toutercontext406022* o, Tsym225841* s);
N_NIMCALL(Tnode225809*, nestedaccess_407438)(Tenv406020* top, Tsym225841* local);
N_NIMCALL(void, createenvironments_410010)(Toutercontext406022* o);
N_NIMCALL(Tnode225809*, generateclosurecreation_408883)(Toutercontext406022* o, Tenv406020* scope);
N_NIMCALL(Tnode225809*, rawclosurecreation_408785)(Toutercontext406022* o, Tenv406020* scope, Tnode225809* env);
N_NIMCALL(Tnode225809*, newasgnstmt_408771)(Tnode225809* le, Tnode225809* ri, Tlineinfo190352 info);
N_NIMCALL(Tnode225809*, idnodetableget_233212)(Tidnodetable225865 t, Tidobj198015* key);
N_NIMCALL(void, idnodetableput_233219)(Tidnodetable225865* t, Tidobj198015* key, Tnode225809* val);
N_NIMCALL(Tnode225809*, transformouterprocbody_410614)(Toutercontext406022* o, Tnode225809* n, Titer406016* it);
N_NIMCALL(Tnode225809*, rawindirectaccess_402608)(Tnode225809* a, Tsym225841* field, Tlineinfo190352 info);
N_NIMCALL(Tnode225809*, transformouterproc_409076)(Toutercontext406022* o, Tnode225809* n, Titer406016* it);
N_NIMCALL(void, excl_222871)(Intset222056* s, NI key);
static N_INLINE(NIM_BOOL, interestingitervar_409044)(Tsym225841* s);
N_NIMCALL(Tnode225809*, liftitersym_409731)(Tnode225809* n, Tsym225841* owner);
N_NIMCALL(Tnode225809*, generateiterclosurecreation_408895)(Toutercontext406022* o, Tenv406020* env, Tnode225809* scope);
N_NIMCALL(NI, len_228369)(Ttype225847* n);
N_NIMCALL(Tnode225809*, transformouterconv_407993)(Tnode225809* n);
N_NIMCALL(Tnode225809*, generatethunk_407968)(Tnode225809* prc, Ttype225847* dest);
N_NIMCALL(Tnode225809*, transformyield_409084)(Toutercontext406022* c, Tnode225809* n, Titer406016* it);
N_NIMCALL(void, outerprocsons_409675)(Toutercontext406022* o, Tnode225809* n, Titer406016* it);
N_NIMCALL(Tnode225809*, transformreturn_409658)(Toutercontext406022* c, Tnode225809* n, Titer406016* it);
N_NIMCALL(void, finishenvironments_410224)(Toutercontext406022* o);
STRING_LITERAL(TMP3407, "ignored invalid for loop", 24);
STRING_LITERAL(TMP3409, "compiler/lambdalifting.nim", 26);
NIM_CONST TY90959 TMP3408 = {((NimStringDesc*) &TMP3409),
((NI) 196)}
;
STRING_LITERAL(TMP3410, "internalNew", 11);
STRING_LITERAL(TMP3451, ":envP", 5);
STRING_LITERAL(TMP3452, ":state", 6);
STRING_LITERAL(TMP3453, "liftLambdas: strange params", 27);
STRING_LITERAL(TMP3454, ":up", 3);
STRING_LITERAL(TMP3455, ":env", 4);
NIM_CONST TY90959 TMP3456 = {((NimStringDesc*) &TMP3409),
((NI) 222)}
;
STRING_LITERAL(TMP3457, ":result", 7);
NIM_CONST TY90959 TMP3460 = {((NimStringDesc*) &TMP3409),
((NI) 472)}
;
NIM_CONST TY90959 TMP3461 = {((NimStringDesc*) &TMP3409),
((NI) 315)}
;
NIM_CONST TY90959 TMP3462 = {((NimStringDesc*) &TMP3409),
((NI) 322)}
;
STRING_LITERAL(TMP3463, "searchForInnerProcs", 19);
STRING_LITERAL(TMP3464, "environment computation failed", 30);
extern Gcheap51018 gch_51059;
extern Tnode225809* emptynode_226807;
extern NU8 gcmd_167134;
TNimType NTI406022; /* TOuterContext */
extern TNimType NTI225807; /* PSym */
extern TNimType NTI4011; /* RootObj */
TNimType NTI406020; /* TEnv */
extern TNimType NTI225801; /* PNode */
extern TNimType NTI138; /* bool */
extern TNimType NTI225811; /* TSymSeq */
extern TNimType NTI225805; /* PType */
extern TNimType NTI222056; /* IntSet */
TNimType NTI406018; /* PEnv */
extern TNimType NTI225865; /* TIdNodeTable */
extern TNimType NTI225859; /* TIdTable */
TNimType NTI406014; /* POuterContext */

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

static N_INLINE(NI, len_226098)(Tnode225809* 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(Tnode225809*, HEX5BHEX5D_226244)(Tnode225809* n, NI i) {
	Tnode225809* result;
	result = 0;
	result = (*n).kindU.S6.sons->data[i];
	return result;
}

N_NIMCALL(Tsym225841*, gethiddenparam_406407)(Tsym225841* routine) {
	Tsym225841* result;
	Tnode225809* params;
	Tnode225809* hidden;
	result = 0;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	hidden = lastson_228406(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_196279(TMP3408);
		internalerror_196191(LOC7);
	}
	LA5: ;
	result = (*hidden).kindU.S4.sym;
	return result;
}

N_NIMCALL(Tnode225809*, newcall_407272)(Tsym225841* a, Tnode225809* b) {
	Tnode225809* result;
	Tnode225809* LOC1;
	result = 0;
	result = newnodei_227351(((NU8) 27), (*a).info);
	LOC1 = 0;
	LOC1 = newsymnode_227325(a);
	add_226165(result, LOC1);
	add_226165(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(Tnode225809*, makeclosure_408034)(Tsym225841* prc, Tnode225809* env, Tlineinfo190352 info) {
	Tnode225809* result;
	Tnode225809* LOC1;
	result = 0;
	result = newnodeit_227807(((NU8) 155), info, (*prc).typ);
	LOC1 = 0;
	LOC1 = newsymnode_227325(prc);
	add_226165(result, LOC1);
	{
		Ttype225847* LOC6;
		Tnode225809* LOC7;
		if (!(env == NIM_NIL)) goto LA4;
		LOC6 = 0;
		LOC6 = getsystype_274190(((NU8) 5));
		LOC7 = 0;
		LOC7 = newnodeit_227807(((NU8) 23), info, LOC6);
		add_226165(result, LOC7);
	}
	goto LA2;
	LA4: ;
	{
		add_226165(result, env);
	}
	LA2: ;
	return result;
}

N_NIMCALL(Tnode225809*, liftforloop_412344)(Tnode225809* body) {
	Tnode225809* result;
	NI L;
	Tnode225809* call;
	Tsym225841* env;
	Tnode225809* loopbody;
	Tnode225809* whileloop;
	Ttype225847* LOC22;
	Tnode225809* v2;
	Tnode225809* vpart;
	NU8 LOC23;
	Tnode225809* bs;
{	result = 0;
	L = len_226098(body);
	{
		NIM_BOOL LOC3;
		Tnode225809* LOC5;
		LOC3 = 0;
		LOC3 = ((*body).kind == ((NU8) 94));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = HEX5BHEX5D_226244(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_196139((*body).info, ((NimStringDesc*) &TMP3407));
		result = body;
		goto BeforeRet;
	}
	LA6: ;
	call = HEX5BHEX5D_226244(body, (NI)(L - ((NI) 2)));
	result = newnodei_227351(((NU8) 115), (*body).info);
	env = 0;
	{
		NIM_BOOL LOC10;
		Tnode225809* LOC11;
		Tnode225809* LOC13;
		Tsym225841* iter;
		Tnode225809* LOC16;
		Tsym225841* LOC17;
		Tnode225809* v;
		Tnode225809* LOC18;
		Tsym225841* LOC19;
		Tnode225809* LOC20;
		Tnode225809* LOC21;
		LOC10 = 0;
		LOC11 = 0;
		LOC11 = HEX5BHEX5D_226244(call, ((NI) 0));
		LOC10 = ((*LOC11).kind == ((NU8) 3));
		if (!(LOC10)) goto LA12;
		LOC13 = 0;
		LOC13 = HEX5BHEX5D_226244(call, ((NI) 0));
		LOC10 = ((*(*LOC13).kindU.S4.sym).kind == ((NU8) 15));
		LA12: ;
		if (!LOC10) goto LA14;
		LOC16 = 0;
		LOC16 = HEX5BHEX5D_226244(call, ((NI) 0));
		iter = (*LOC16).kindU.S4.sym;
		LOC17 = 0;
		LOC17 = gethiddenparam_406407(iter);
		env = copysym_228607(LOC17, NIM_FALSE);
		v = newnodei_227351(((NU8) 99), (*body).info);
		LOC18 = 0;
		LOC18 = newsymnode_227325(env);
		addvar_402047(v, LOC18);
		add_226165(result, v);
		LOC19 = 0;
		LOC19 = getsyssym_274077(((NimStringDesc*) &TMP3410));
		LOC20 = 0;
		LOC20 = newsymnode_227325(env);
		LOC21 = 0;
		LOC21 = newcall_407272(LOC19, LOC20);
		add_226165(result, LOC21);
	}
	LA14: ;
	loopbody = newnodei_227407(((NU8) 115), (*body).info, ((NI) 3));
	whileloop = newnodei_227407(((NU8) 96), (*body).info, ((NI) 2));
	LOC22 = 0;
	LOC22 = getsystype_274190(((NU8) 1));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.sons->data[((NI) 0)]), newinttypenode_226620(((NU8) 6), IL64(1), LOC22));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.sons->data[((NI) 1)]), loopbody);
	add_226165(result, whileloop);
	v2 = newnodei_227351(((NU8) 100), (*body).info);
	LOC23 = 0;
	{
		if (!(L == ((NI) 3))) goto LA26;
		LOC23 = ((NU8) 35);
	}
	goto LA24;
	LA26: ;
	{
		LOC23 = ((NU8) 36);
	}
	LA24: ;
	vpart = newnodei_227351(LOC23, (*body).info);
	{
		NI i_412622;
		NI HEX3Atmp_412823;
		NI res_412826;
		i_412622 = 0;
		HEX3Atmp_412823 = 0;
		HEX3Atmp_412823 = (NI)(L - ((NI) 3));
		res_412826 = ((NI) 0);
		{
			while (1) {
				Tnode225809* LOC32;
				Tnode225809* LOC33;
				if (!(res_412826 <= HEX3Atmp_412823)) goto LA31;
				i_412622 = res_412826;
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_226244(body, i_412622);
				(*(*LOC32).kindU.S4.sym).kind = ((NU8) 9);
				LOC33 = 0;
				LOC33 = HEX5BHEX5D_226244(body, i_412622);
				addson_227819(vpart, LOC33);
				res_412826 += ((NI) 1);
			} LA31: ;
		}
	}
	addson_227819(vpart, emptynode_226807);
	{
		Tnode225809* LOC38;
		if (!!(env == 0)) goto LA36;
		LOC38 = 0;
		LOC38 = newsymnode_227325(env);
		asgnRefNoCycle((void**) (&(*call).kindU.S6.sons->data[((NI) 0)]), makeclosure_408034((*(*call).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym, LOC38, (*body).info));
	}
	LA36: ;
	addson_227819(vpart, call);
	addson_227819(v2, vpart);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.sons->data[((NI) 0)]), v2);
	bs = newnodei_227351(((NU8) 158), (*body).info);
	addson_227819(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_226244(body, (NI)(L - ((NI) 1))));
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP3449)(void* p, NI op) {
	Tenv406020* a;
	a = (Tenv406020*)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, TMP3450)(void* p, NI op) {
	Toutercontext406022* a;
	a = (Toutercontext406022*)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(Toutercontext406022*, newoutercontext_407029)(Tsym225841* fn) {
	Toutercontext406022* result;
	result = 0;
	result = (Toutercontext406022*) newObj((&NTI406014), sizeof(Toutercontext406022));
	asgnRefNoCycle((void**) (&(*result).fn), fn);
	initintset_222927((&(*result).capturedvars));
	initintset_222927((&(*result).processed));
	initidnodetable_229127((&(*result).localstoaccess));
	initidtable_229057((&(*result).lambdastoenv));
	return result;
}

N_NIMCALL(Tnode225809*, closurecreationpoint_408312)(Tnode225809* n) {
	Tnode225809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC6;
		Tnode225809* LOC8;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*n).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC6 = 0;
		LOC6 = len_226098(n);
		LOC4 = (((NI) 1) <= LOC6);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA7;
		LOC8 = 0;
		LOC8 = HEX5BHEX5D_226244(n, ((NI) 0));
		LOC3 = ((*LOC8).kind == ((NU8) 1));
		LA7: ;
		if (!LOC3) goto LA9;
		result = n;
	}
	goto LA1;
	LA9: ;
	{
		result = newnodei_227351(((NU8) 115), (*n).info);
		add_226165(result, emptynode_226807);
		add_226165(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(Tsym225841*, getenvparam_406607)(Tsym225841* routine) {
	Tsym225841* result;
	Tnode225809* params;
	Tnode225809* hidden;
	result = 0;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	hidden = lastson_228406(params);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*hidden).kind == ((NU8) 3));
		if (!(LOC3)) goto LA4;
		LOC3 = eqStrings((*(*(*hidden).kindU.S4.sym).name).s, ((NimStringDesc*) &TMP3451));
		LA4: ;
		if (!LOC3) goto LA5;
		result = (*hidden).kindU.S4.sym;
	}
	LA5: ;
	return result;
}

N_NIMCALL(Ttype225847*, getstatetype_406049)(Tsym225841* iter) {
	Ttype225847* result;
	Tnode225809* n;
	Tnode225809* LOC1;
	Tnode225809* LOC2;
	Ttype225847* inttype;
	result = 0;
	n = newnodei_227351(((NU8) 44), (*iter).info);
	LOC1 = 0;
	LOC1 = newintnode_226608(((NU8) 6), IL64(-1));
	addson_227819(n, LOC1);
	LOC2 = 0;
	LOC2 = newintnode_226608(((NU8) 6), IL64(0));
	addson_227819(n, LOC2);
	result = newtype_228140(((NU8) 20), iter);
	asgnRefNoCycle((void**) (&(*result).n), n);
	inttype = nilorsysint_274036();
	{
		if (!inttype == 0) goto LA5;
		inttype = newtype_228140(((NU8) 31), iter);
	}
	LA5: ;
	rawaddson_229498(result, inttype);
	return result;
}

N_NIMCALL(Tsym225841*, createstatefield_406070)(Tsym225841* iter) {
	Tsym225841* result;
	Tident198021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_198463(((NimStringDesc*) &TMP3452));
	result = newsym_226656(((NU8) 19), LOC1, iter, (*iter).info);
	asgnRefNoCycle((void**) (&(*result).typ), getstatetype_406049(iter));
	return result;
}

N_NIMCALL(Ttype225847*, createenvobj_406082)(Tsym225841* owner) {
	Ttype225847* result;
	Tsym225841* LOC1;
	result = 0;
	result = createobj_402372(owner, (*owner).info);
	LOC1 = 0;
	LOC1 = createstatefield_406070(owner);
	rawaddfield_402393(result, LOC1);
	return result;
}

N_NIMCALL(Tenv406020*, newenv_407049)(Toutercontext406022* o, Tenv406020* up, Tnode225809* n, Tsym225841* owner) {
	Tenv406020* result;
	result = 0;
	result = (Tenv406020*) newObj((&NTI406018), sizeof(Tenv406020));
	(*result).Sup.m_type = (&NTI406020);
	if ((*result).capturedvars) nimGCunrefNoCycle((*result).capturedvars);
	(*result).capturedvars = (Tsymseq225811*) newSeqRC1((&NTI225811), 0);
	asgnRef((void**) (&(*result).up), up);
	asgnRefNoCycle((void**) (&(*result).attachednode), n);
	asgnRefNoCycle((void**) (&(*result).fn), owner);
	initintset_222927((&(*result).vars));
	asgnRef((void**) (&(*result).next), (*o).head);
	asgnRef((void**) (&(*o).head), result);
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		Tsym225841* 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_406607(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_406082(owner));
	}
	LA15: ;
	return result;
}

N_NIMCALL(void, addparamstoenv_408343)(Tsym225841* fn, Tenv406020* env) {
	Tnode225809* params;
	Tnode225809* ast;
	params = (*(*fn).typ).n;
	{
		NI i_408368;
		NI HEX3Atmp_408401;
		NI LOC2;
		NI res_408404;
		i_408368 = 0;
		HEX3Atmp_408401 = 0;
		LOC2 = 0;
		LOC2 = len_226098(params);
		HEX3Atmp_408401 = (LOC2 - 1);
		res_408404 = ((NI) 1);
		{
			while (1) {
				Tsym225841* param;
				if (!(res_408404 <= HEX3Atmp_408401)) goto LA4;
				i_408368 = res_408404;
				{
					if (!!(((*(*params).kindU.S6.sons->data[i_408368]).kind == ((NU8) 3)))) goto LA7;
					internalerror_196172((*params).info, ((NimStringDesc*) &TMP3453));
				}
				LA7: ;
				param = (*(*params).kindU.S6.sons->data[i_408368]).kindU.S4.sym;
				incl_222856((&(*env).vars), (*param).Sup.id);
				res_408404 += ((NI) 1);
			} LA4: ;
		}
	}
	ast = (*fn).ast;
	{
		NIM_BOOL LOC11;
		NI LOC12;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = sonslen_228387(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_222856((&(*env).vars), (*(*(*ast).kindU.S6.sons->data[((NI) 7)]).kindU.S4.sym).Sup.id);
	}
	LA14: ;
}

N_NIMCALL(NIM_BOOL, isinnerproc_407286)(Tsym225841* s, Tsym225841* outerproc) {
	NIM_BOOL result;
{	result = 0;
	{
		Tsym225841* owner;
		if (!((110592 &(1<<(((*s).kind)&31)))!=0)) goto LA3;
		owner = skipgenericowner_230694(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_407375)(Tsym225841* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	Ttype225847* LOC2;
	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = skiptypes_229167((*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(Tsym225841*, createupfield_407621)(Ttype225847* obj, Ttype225847* fieldtype) {
	Tsym225841* result;
	NI pos;
	Tident198021* LOC1;
	result = 0;
	pos = len_226098((*obj).n);
	LOC1 = 0;
	LOC1 = getident_198463(((NimStringDesc*) &TMP3454));
	result = newsym_226656(((NU8) 19), LOC1, (*obj).owner, (*(*obj).owner).info);
	asgnRefNoCycle((void**) (&(*result).typ), newtype_228140(((NU8) 22), (*obj).owner));
	(*result).position = pos;
	rawaddson_229498((*result).typ, fieldtype);
	addfield_402809(obj, result);
	return result;
}

N_NIMCALL(void, addhiddenparam_406124)(Tsym225841* routine, Tsym225841* param) {
	Tnode225809* params;
	NI LOC1;
	Tnode225809* LOC2;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	LOC1 = 0;
	LOC1 = len_226098((*(*routine).typ).n);
	(*param).position = (NI)(LOC1 - ((NI) 1));
	LOC2 = 0;
	LOC2 = newsymnode_227325(param);
	addson_227819(params, LOC2);
	(*(*routine).typ).flags |= ((NU32)1)<<((((NU8) 11))%(sizeof(NU32)*8));
}

N_NIMCALL(void, addclosureparam_407338)(Tsym225841* fn, Tenv406020* e) {
	Tsym225841* cp;
	cp = getenvparam_406607(fn);
	{
		Tident198021* LOC5;
		if (!(cp == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = getident_198463(((NimStringDesc*) &TMP3451));
		cp = newsym_226656(((NU8) 3), LOC5, fn, (*fn).info);
		(*cp).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
		asgnRefNoCycle((void**) (&(*cp).typ), newtype_228140(((NU8) 22), fn));
		rawaddson_229498((*cp).typ, (*e).obj);
		addhiddenparam_406124(fn, cp);
	}
	LA3: ;
}

N_NIMCALL(void, addcapturedvar_407215)(Tenv406020* e, Tsym225841* v) {
{	{
		Tsym225841* x_407228;
		Tsymseq225811* HEX3Atmp_407251;
		NI i_407254;
		NI L_407256;
		x_407228 = 0;
		HEX3Atmp_407251 = 0;
		HEX3Atmp_407251 = (*e).capturedvars;
		i_407254 = ((NI) 0);
		L_407256 = (HEX3Atmp_407251 ? HEX3Atmp_407251->Sup.len : 0);
		{
			while (1) {
				if (!(i_407254 < L_407256)) goto LA3;
				x_407228 = HEX3Atmp_407251->data[i_407254];
				{
					if (!(x_407228 == v)) goto LA6;
					goto BeforeRet;
				}
				LA6: ;
				i_407254 += ((NI) 1);
			} LA3: ;
		}
	}
	(*e).capturedvars = (Tsymseq225811*) incrSeqV2(&((*e).capturedvars)->Sup, sizeof(Tsym225841*));
	asgnRefNoCycle((void**) (&(*e).capturedvars->data[(*e).capturedvars->Sup.len]), v);
	++(*e).capturedvars->Sup.len;
	addfield_402809((*e).obj, v);
	}BeforeRet: ;
}

N_NIMCALL(NIM_BOOL, capturevar_407638)(Toutercontext406022* o, Tenv406020* top, Tsym225841* local, Tlineinfo190352 info) {
	NIM_BOOL result;
	Tenv406020* it;
{	result = 0;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				LOC5 = 0;
				LOC5 = contains_222829((*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_407375(local);
		if (LOC14) goto LA15;
		LOC14 = !(((257 &(1<<(((*(*(*top).fn).typ).callconv)&15)))!=0));
		LA15: ;
		if (!LOC14) goto LA16;
		localerror_196128(info, ((NU16) 227), (*(*local).name).s);
	}
	LA16: ;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA19;
			{
				NIM_BOOL LOC22;
				LOC22 = 0;
				LOC22 = contains_222829((*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_407621((*it).obj, (*(*it).up).obj));
			}
			LA31: ;
			{
				Tenv406020* 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_407338((*it).fn, u);
				{
					Tidobj198015* LOC43;
					TNimObject* LOC44;
					LOC43 = 0;
					LOC43 = &(*it).fn->Sup;
					LOC44 = 0;
					LOC44 = idtableget_233182((*o).lambdastoenv, LOC43);
					if (!(LOC44 == NIM_NIL)) goto LA45;
					{
						Tidobj198015* LOC51;
						TNimObject* LOC52;
						if (!!((u == NIM_NIL))) goto LA49;
						LOC51 = 0;
						LOC51 = &(*it).fn->Sup;
						LOC52 = 0;
						LOC52 = &u->Sup;
						idtableput_233196((&(*o).lambdastoenv), LOC51, LOC52);
					}
					LA49: ;
				}
				LA45: ;
			}
			LA35: ;
			it = (*it).up;
		} LA19: ;
	} LA18: ;
	incl_222856((&(*o).capturedvars), (*local).Sup.id);
	addcapturedvar_407215(it, local);
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI, gathervars_407870)(Toutercontext406022* o, Tenv406020* e, Tnode225809* n) {
	NI result;
{	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = ((NI) 0);
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		Tsym225841* s;
		s = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = interestingvar_407406(s);
			if (!(LOC8)) goto LA9;
			LOC8 = !(((*e).fn == (*s).owner));
			LA9: ;
			if (!LOC8) goto LA10;
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = capturevar_407638(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_407934;
			NI HEX3Atmp_407946;
			NI LOC20;
			NI res_407949;
			k_407934 = 0;
			HEX3Atmp_407946 = 0;
			LOC20 = 0;
			LOC20 = sonslen_228387(n);
			HEX3Atmp_407946 = (NI)(LOC20 - ((NI) 1));
			res_407949 = ((NI) 0);
			{
				while (1) {
					NI LOC23;
					if (!(res_407949 <= HEX3Atmp_407946)) goto LA22;
					k_407934 = res_407949;
					LOC23 = 0;
					LOC23 = gathervars_407870(o, e, (*n).kindU.S6.sons->data[k_407934]);
					result += LOC23;
					res_407949 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym225841*, newiterresult_406093)(Tsym225841* iter) {
	Tsym225841* result;
	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_226098((*iter).ast);
		if (!(((NI) 7) < LOC3)) goto LA4;
		result = (*(*(*iter).ast).kindU.S6.sons->data[((NI) 7)]).kindU.S4.sym;
	}
	goto LA1;
	LA4: ;
	{
		Tident198021* LOC7;
		Tnode225809* LOC8;
		LOC7 = 0;
		LOC7 = getident_198463(((NimStringDesc*) &TMP3457));
		result = newsym_226656(((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_227325(result);
		add_226165((*iter).ast, LOC8);
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, inititer_406807)(Tsym225841* iter, Titer406016* Result) {
	unsureAsgnRef((void**) (&(*Result).fn), iter);
	{
		Tsym225841* cp;
		Tnode225809* LOC17;
		if (!((*iter).kind == ((NU8) 15))) goto LA3;
		cp = getenvparam_406607(iter);
		{
			Tident198021* LOC9;
			if (!(cp == NIM_NIL)) goto LA7;
			unsureAsgnRef((void**) (&(*Result).obj), createenvobj_406082(iter));
			LOC9 = 0;
			LOC9 = getident_198463(((NimStringDesc*) &TMP3451));
			cp = newsym_226656(((NU8) 3), LOC9, iter, (*iter).info);
			(*cp).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
			asgnRefNoCycle((void**) (&(*cp).typ), newtype_228140(((NU8) 22), iter));
			rawaddson_229498((*cp).typ, (*Result).obj);
			addhiddenparam_406124(iter, cp);
		}
		goto LA5;
		LA7: ;
		{
			unsureAsgnRef((void**) (&(*Result).obj), (*(*cp).typ).sons->data[((NI) 0)]);
		}
		LA5: ;
		{
			NI LOC13;
			NimStringDesc* LOC16;
			LOC13 = 0;
			LOC13 = len_226098((*(*Result).obj).n);
			if (!!((((NI) 0) < LOC13))) goto LA14;
			LOC16 = 0;
			LOC16 = HEX24_196279(TMP3456);
			internalerror_196191(LOC16);
		}
		LA14: ;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_226244((*(*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_406093(iter));
		}
		LA20: ;
	}
	LA3: ;
}

N_NIMCALL(Tnode225809*, newclosurecreationvar_408062)(Tenv406020* e) {
	Tnode225809* result;
	Tsym225841* v;
	Tident198021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_198463(((NimStringDesc*) &TMP3455));
	v = newsym_226656(((NU8) 8), LOC1, (*e).fn, (*(*e).attachednode).info);
	(*v).flags |= ((NU32)1)<<((((NU8) 21))%(sizeof(NU32)*8));
	asgnRefNoCycle((void**) (&(*v).typ), newtype_228140(((NU8) 22), (*e).fn));
	rawaddson_229498((*v).typ, (*e).obj);
	{
		Titer406016 it;
		Tnode225809* 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_406807((*e).fn, (&it));
		adduniquefield_403008(it.obj, v);
		LOC6 = 0;
		LOC6 = newsymnode_227325(it.closureparam);
		result = indirectaccess_404038(LOC6, v, (*v).info);
	}
	goto LA2;
	LA4: ;
	{
		result = newsymnode_227325(v);
	}
	LA2: ;
	return result;
}

N_NIMCALL(Tnode225809*, getclosurevar_408097)(Tenv406020* e) {
	Tnode225809* result;
	result = 0;
	{
		if (!((*e).createdvar == NIM_NIL)) goto LA3;
		result = newclosurecreationvar_408062(e);
		asgnRefNoCycle((void**) (&(*e).createdvar), result);
	}
	goto LA1;
	LA3: ;
	{
		result = (*e).createdvar;
	}
	LA1: ;
	return result;
}

N_NIMCALL(Tenv406020*, findenv_408119)(Toutercontext406022* o, Tsym225841* s) {
	Tenv406020* result;
	Tenv406020* 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_196279(TMP3460);
		internalerror_196191(LOC13);
	}
	LA11: ;
	result = (*env).up;
	{
		while (1) {
			if (!((*result).fn == s)) goto LA15;
			result = (*result).up;
		} LA15: ;
	}
	return result;
}

N_NIMCALL(Tnode225809*, nestedaccess_407438)(Tenv406020* top, Tsym225841* local) {
	Tnode225809* result;
	Tenv406020* it;
	Tsym225841* envparam;
	Tnode225809* access;
{	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_407406(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_222829((*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_406607((*top).fn);
	{
		NimStringDesc* LOC23;
		if (!!(!(envparam == 0))) goto LA21;
		LOC23 = 0;
		LOC23 = HEX24_196279(TMP3461);
		internalerror_196191(LOC23);
	}
	LA21: ;
	access = newsymnode_227325(envparam);
	it = (*top).up;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA25;
			{
				NIM_BOOL LOC28;
				LOC28 = 0;
				LOC28 = contains_222829((*it).vars, (*local).Sup.id);
				if (!LOC28) goto LA29;
				access = indirectaccess_404038(access, local, (*local).info);
				result = access;
				goto BeforeRet;
			}
			LA29: ;
			{
				NimStringDesc* LOC35;
				if (!!(!(((*it).upfield == NIM_NIL)))) goto LA33;
				LOC35 = 0;
				LOC35 = HEX24_196279(TMP3462);
				internalerror_196191(LOC35);
			}
			LA33: ;
			access = indirectaccess_404038(access, (*it).upfield, (*local).info);
			it = (*it).up;
		} LA25: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode225809*, transforminnerproc_408210)(Toutercontext406022* o, Tenv406020* e, Tnode225809* n) {
	Tnode225809* result;
	result = 0;
	switch ((*n).kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		Tsym225841* s;
		s = (*n).kindU.S4.sym;
		{
			Tsym225841* LOC7;
			Tnode225809* LOC8;
			if (!(s == (*e).fn)) goto LA5;
			LOC7 = 0;
			LOC7 = getenvparam_406607(s);
			LOC8 = 0;
			LOC8 = newsymnode_227325(LOC7);
			result = makeclosure_408034(s, LOC8, (*n).info);
		}
		goto LA3;
		LA5: ;
		{
			NIM_BOOL LOC10;
			Tenv406020* LOC14;
			Tnode225809* LOC15;
			LOC10 = 0;
			LOC10 = isinnerproc_407286(s, (*o).fn);
			if (!(LOC10)) goto LA11;
			LOC10 = ((*(*s).typ).callconv == ((NU8) 8));
			LA11: ;
			if (!LOC10) goto LA12;
			LOC14 = 0;
			LOC14 = findenv_408119(o, s);
			LOC15 = 0;
			LOC15 = getclosurevar_408097(LOC14);
			result = makeclosure_408034(s, LOC15, (*n).info);
		}
		goto LA3;
		LA12: ;
		{
			result = nestedaccess_407438(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_408273;
			NI HEX3Atmp_408290;
			NI LOC20;
			NI res_408293;
			j_408273 = 0;
			HEX3Atmp_408290 = 0;
			LOC20 = 0;
			LOC20 = sonslen_228387(n);
			HEX3Atmp_408290 = (NI)(LOC20 - ((NI) 1));
			res_408293 = ((NI) 0);
			{
				while (1) {
					Tnode225809* x;
					if (!(res_408293 <= HEX3Atmp_408290)) goto LA22;
					j_408273 = res_408293;
					x = transforminnerproc_408210(o, e, (*n).kindU.S6.sons->data[j_408273]);
					{
						if (!!((x == NIM_NIL))) goto LA25;
						asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[j_408273]), x);
					}
					LA25: ;
					res_408293 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	}
	return result;
}

N_NIMCALL(void, searchforinnerprocs_408423)(Toutercontext406022* o, Tnode225809* n, Tenv406020* 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):
	{
		Tsym225841* fn;
		fn = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC9;
			NIM_BOOL LOC11;
			Tnode225809* body;
			Tnode225809* ex;
			Tenv406020* envb;
			NI capturedcounter;
			LOC9 = 0;
			LOC9 = isinnerproc_407286(fn, (*o).fn);
			if (!(LOC9)) goto LA10;
			LOC11 = 0;
			LOC11 = containsorincl_222898((&(*o).processed), (*fn).Sup.id);
			LOC9 = !(LOC11);
			LA10: ;
			if (!LOC9) goto LA12;
			body = getbody_271062(fn);
			ex = closurecreationpoint_408312(body);
			envb = newenv_407049(o, env, ex, fn);
			addparamstoenv_408343(fn, envb);
			searchforinnerprocs_408423(o, body, envb);
			asgnRefNoCycle((void**) (&(*(*fn).ast).kindU.S6.sons->data[((NI) 6)]), ex);
			capturedcounter = gathervars_407870(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;
				{
					Tidobj198015* LOC22;
					TNimObject* LOC23;
					Tidobj198015* LOC26;
					TNimObject* LOC27;
					LOC22 = 0;
					LOC22 = &fn->Sup;
					LOC23 = 0;
					LOC23 = idtableget_233182((*o).lambdastoenv, LOC22);
					if (!(LOC23 == NIM_NIL)) goto LA24;
					LOC26 = 0;
					LOC26 = &fn->Sup;
					LOC27 = 0;
					LOC27 = &env->Sup;
					idtableput_233196((&(*o).lambdastoenv), LOC26, LOC27);
				}
				LA24: ;
				addclosureparam_407338(fn, env);
			}
			goto LA14;
			LA18: ;
			{
				Tsym225841* LOC29;
				Tnode225809* ti;
				LOC29 = 0;
				LOC29 = getenvparam_406607(fn);
				if (!!((LOC29 == NIM_NIL))) goto LA30;
				ti = transforminnerproc_408210(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_408423(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;
			Tnode225809* ex;
			Tenv406020* LOC50;
			if (!!(((*(*env).fn).kind == ((NU8) 15)))) goto LA44;
			LOC46 = 0;
			LOC46 = len_226098(n);
			body = (NI)(LOC46 - ((NI) 1));
			{
				NI i_408558;
				NI HEX3Atmp_408681;
				NI res_408684;
				i_408558 = 0;
				HEX3Atmp_408681 = 0;
				HEX3Atmp_408681 = (NI)(body - ((NI) 1));
				res_408684 = ((NI) 0);
				{
					while (1) {
						if (!(res_408684 <= HEX3Atmp_408681)) goto LA49;
						i_408558 = res_408684;
						searchforinnerprocs_408423(o, (*n).kindU.S6.sons->data[i_408558], env);
						res_408684 += ((NI) 1);
					} LA49: ;
				}
			}
			ex = closurecreationpoint_408312((*n).kindU.S6.sons->data[body]);
			LOC50 = 0;
			LOC50 = newenv_407049(o, env, ex, (*env).fn);
			searchforinnerprocs_408423(o, (*n).kindU.S6.sons->data[body], LOC50);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[body]), ex);
		}
		goto LA42;
		LA44: ;
		{
			{
				NI i_408576;
				NI HEX3Atmp_408689;
				NI LOC53;
				NI res_408692;
				i_408576 = 0;
				HEX3Atmp_408689 = 0;
				LOC53 = 0;
				LOC53 = sonslen_228387(n);
				HEX3Atmp_408689 = (NI)(LOC53 - ((NI) 1));
				res_408692 = ((NI) 0);
				{
					while (1) {
						if (!(res_408692 <= HEX3Atmp_408689)) goto LA55;
						i_408576 = res_408692;
						searchforinnerprocs_408423(o, (*n).kindU.S6.sons->data[i_408576], env);
						res_408692 += ((NI) 1);
					} LA55: ;
				}
			}
		}
		LA42: ;
	}
	break;
	case ((NU8) 99):
	case ((NU8) 100):
	{
		{
			NI i_408590;
			NI HEX3Atmp_408705;
			NI LOC58;
			NI res_408708;
			i_408590 = 0;
			HEX3Atmp_408705 = 0;
			LOC58 = 0;
			LOC58 = sonslen_228387(n);
			HEX3Atmp_408705 = (NI)(LOC58 - ((NI) 1));
			res_408708 = ((NI) 0);
			{
				while (1) {
					Tnode225809* it;
					if (!(res_408708 <= HEX3Atmp_408705)) goto LA60;
					i_408590 = res_408708;
					it = (*n).kindU.S6.sons->data[i_408590];
					{
						if (!((*it).kind == ((NU8) 125))) goto LA63;
					}
					goto LA61;
					LA63: ;
					{
						NI L;
						if (!((*it).kind == ((NU8) 35))) goto LA66;
						L = sonslen_228387(it);
						{
							if (!((*(*it).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 3))) goto LA70;
							incl_222856((&(*env).vars), (*(*(*it).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym).Sup.id);
						}
						LA70: ;
						searchforinnerprocs_408423(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_228387(it);
						{
							NI j_408649;
							NI HEX3Atmp_408698;
							NI res_408701;
							j_408649 = 0;
							HEX3Atmp_408698 = 0;
							HEX3Atmp_408698 = (NI)(L - ((NI) 3));
							res_408701 = ((NI) 0);
							{
								while (1) {
									if (!(res_408701 <= HEX3Atmp_408698)) goto LA77;
									j_408649 = res_408701;
									{
										if (!((*(*it).kindU.S6.sons->data[j_408649]).kind == ((NU8) 3))) goto LA80;
										incl_222856((&(*env).vars), (*(*(*it).kindU.S6.sons->data[j_408649]).kindU.S4.sym).Sup.id);
									}
									LA80: ;
									res_408701 += ((NI) 1);
								} LA77: ;
							}
						}
						searchforinnerprocs_408423(o, (*it).kindU.S6.sons->data[(NI)(L - ((NI) 1))], env);
					}
					goto LA61;
					LA73: ;
					{
						internalerror_196172((*it).info, ((NimStringDesc*) &TMP3463));
					}
					LA61: ;
					res_408708 += ((NI) 1);
				} LA60: ;
			}
		}
	}
	break;
	case ((NU8) 155):
	{
		searchforinnerprocs_408423(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_408678;
			NI HEX3Atmp_408713;
			NI LOC87;
			NI res_408716;
			i_408678 = 0;
			HEX3Atmp_408713 = 0;
			LOC87 = 0;
			LOC87 = sonslen_228387(n);
			HEX3Atmp_408713 = (NI)(LOC87 - ((NI) 1));
			res_408716 = ((NI) 0);
			{
				while (1) {
					if (!(res_408716 <= HEX3Atmp_408713)) goto LA89;
					i_408678 = res_408716;
					searchforinnerprocs_408423(o, (*n).kindU.S6.sons->data[i_408678], env);
					res_408716 += ((NI) 1);
				} LA89: ;
			}
		}
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(Tnode225809*, newasgnstmt_408771)(Tnode225809* le, Tnode225809* ri, Tlineinfo190352 info) {
	Tnode225809* result;
	result = 0;
	result = newnodei_227407(((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(Tnode225809*, rawclosurecreation_408785)(Toutercontext406022* o, Tenv406020* scope, Tnode225809* env) {
	Tnode225809* result;
	Tsym225841* LOC5;
	Tnode225809* LOC6;
	result = 0;
	result = newnodei_227351(((NU8) 115), (*env).info);
	{
		Tnode225809* v;
		if (!((*env).kind == ((NU8) 3))) goto LA3;
		v = newnodei_227351(((NU8) 99), (*env).info);
		addvar_402047(v, env);
		add_226165(result, v);
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = getsyssym_274077(((NimStringDesc*) &TMP3410));
	LOC6 = 0;
	LOC6 = newcall_407272(LOC5, env);
	add_226165(result, LOC6);
	{
		Tsym225841* local_408812;
		Tsymseq225811* HEX3Atmp_408862;
		NI i_408865;
		NI L_408867;
		local_408812 = 0;
		HEX3Atmp_408862 = 0;
		HEX3Atmp_408862 = (*scope).capturedvars;
		i_408865 = ((NI) 0);
		L_408867 = (HEX3Atmp_408862 ? HEX3Atmp_408862->Sup.len : 0);
		{
			while (1) {
				Tnode225809* fieldaccess;
				Tnode225809* existing;
				Tidobj198015* LOC16;
				if (!(i_408865 < L_408867)) goto LA9;
				local_408812 = HEX3Atmp_408862->data[i_408865];
				fieldaccess = indirectaccess_404038(env, local_408812, (*env).info);
				{
					Tnode225809* LOC14;
					Tnode225809* LOC15;
					if (!((*local_408812).kind == ((NU8) 3))) goto LA12;
					LOC14 = 0;
					LOC14 = newsymnode_227325(local_408812);
					LOC15 = 0;
					LOC15 = newasgnstmt_408771(fieldaccess, LOC14, (*env).info);
					add_226165(result, LOC15);
				}
				LA12: ;
				LOC16 = 0;
				LOC16 = &local_408812->Sup;
				existing = idnodetableget_233212((*o).localstoaccess, LOC16);
				{
					Tidobj198015* LOC21;
					if (!existing == 0) goto LA19;
					LOC21 = 0;
					LOC21 = &local_408812->Sup;
					idnodetableput_233219((&(*o).localstoaccess), LOC21, fieldaccess);
				}
				goto LA17;
				LA19: ;
				{
					Tnode225809* LOC23;
					LOC23 = 0;
					LOC23 = newasgnstmt_408771(fieldaccess, existing, (*env).info);
					add_226165(result, LOC23);
				}
				LA17: ;
				i_408865 += ((NI) 1);
			} LA9: ;
		}
	}
	{
		if (!!(((*scope).upfield == NIM_NIL))) goto LA26;
		{
			Tnode225809* LOC32;
			Tsym225841* LOC33;
			Tnode225809* LOC34;
			Tnode225809* LOC35;
			if (!!(((*(*scope).up).fn == (*scope).fn))) goto LA30;
			LOC32 = 0;
			LOC32 = indirectaccess_404038(env, (*scope).upfield, (*env).info);
			LOC33 = 0;
			LOC33 = getenvparam_406607((*scope).fn);
			LOC34 = 0;
			LOC34 = newsymnode_227325(LOC33);
			LOC35 = 0;
			LOC35 = newasgnstmt_408771(LOC32, LOC34, (*env).info);
			add_226165(result, LOC35);
		}
		goto LA28;
		LA30: ;
		{
			Tnode225809* LOC37;
			Tnode225809* LOC38;
			Tnode225809* LOC39;
			LOC37 = 0;
			LOC37 = indirectaccess_404038(env, (*scope).upfield, (*env).info);
			LOC38 = 0;
			LOC38 = getclosurevar_408097((*scope).up);
			LOC39 = 0;
			LOC39 = newasgnstmt_408771(LOC37, LOC38, (*env).info);
			add_226165(result, LOC39);
		}
		LA28: ;
	}
	LA26: ;
	return result;
}

N_NIMCALL(Tnode225809*, generateclosurecreation_408883)(Toutercontext406022* o, Tenv406020* scope) {
	Tnode225809* result;
	Tnode225809* env;
	result = 0;
	env = getclosurevar_408097(scope);
	result = rawclosurecreation_408785(o, scope, env);
	return result;
}

N_NIMCALL(void, createenvironments_410010)(Toutercontext406022* o) {
	Tenv406020* env;
	env = (*o).head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				Tnode225809* 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_408883(o, env));
				}
				LA11: ;
			}
			LA7: ;
			env = (*env).next;
		} LA2: ;
	}
}

static N_INLINE(NIM_BOOL, interestingitervar_409044)(Tsym225841* 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(Tnode225809*, liftitersym_409731)(Tnode225809* n, Tsym225841* owner) {
	Tnode225809* result;
	Tsym225841* iter;
	Tsym225841* hp;
	Tsym225841* env;
	Tnode225809* v;
	Tnode225809* LOC1;
	Tnode225809* envasnode;
	Tsym225841* LOC2;
	Tnode225809* LOC3;
	Tnode225809* LOC4;
	result = 0;
	iter = (*n).kindU.S4.sym;
	result = newnodeit_227807(((NU8) 126), (*n).info, (*n).typ);
	hp = gethiddenparam_406407(iter);
	env = newsym_226656(((NU8) 9), (*iter).name, owner, (*n).info);
	asgnRefNoCycle((void**) (&(*env).typ), (*hp).typ);
	(*env).flags = (*hp).flags;
	v = newnodei_227351(((NU8) 99), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_227325(env);
	addvar_402047(v, LOC1);
	add_226165(result, v);
	envasnode = newsymnode_227325(env);
	LOC2 = 0;
	LOC2 = getsyssym_274077(((NimStringDesc*) &TMP3410));
	LOC3 = 0;
	LOC3 = newcall_407272(LOC2, envasnode);
	add_226165(result, LOC3);
	LOC4 = 0;
	LOC4 = makeclosure_408034(iter, envasnode, (*n).info);
	add_226165(result, LOC4);
	return result;
}

N_NIMCALL(Tnode225809*, generateiterclosurecreation_408895)(Toutercontext406022* o, Tenv406020* env, Tnode225809* scope) {
	Tnode225809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode225809* cc;
		Tnode225809* insertpoint;
		LOC3 = 0;
		LOC3 = (*env).createdvarcomesfromiter;
		if (LOC3) goto LA4;
		LOC3 = (*env).createdvar == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = newclosurecreationvar_408062(env);
		cc = rawclosurecreation_408785(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: ;
		{
			{
				Tnode225809* x_409001;
				x_409001 = 0;
				{
					NI i_409019;
					NI HEX3Atmp_409021;
					NI LOC14;
					NI res_409023;
					i_409019 = 0;
					HEX3Atmp_409021 = 0;
					LOC14 = 0;
					LOC14 = len_226098(cc);
					HEX3Atmp_409021 = (LOC14 - 1);
					res_409023 = ((NI) 0);
					{
						while (1) {
							if (!(res_409023 <= HEX3Atmp_409021)) goto LA16;
							i_409019 = res_409023;
							x_409001 = (*cc).kindU.S6.sons->data[i_409019];
							add_226165(insertpoint, x_409001);
							res_409023 += ((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(Tnode225809*, generatethunk_407968)(Tnode225809* prc, Ttype225847* dest) {
	Tnode225809* result;
	Tnode225809* conv;
	Ttype225847* LOC5;
	Tnode225809* LOC6;
{	result = 0;
	{
		if (!(gcmd_167134 == ((NU8) 4))) goto LA3;
		result = prc;
		goto BeforeRet;
	}
	LA3: ;
	result = newnodeit_227807(((NU8) 155), (*prc).info, dest);
	conv = newnodeit_227807(((NU8) 58), (*prc).info, dest);
	add_226165(conv, emptynode_226807);
	add_226165(conv, prc);
	add_226165(result, conv);
	LOC5 = 0;
	LOC5 = getsystype_274190(((NU8) 5));
	LOC6 = 0;
	LOC6 = newnodeit_227807(((NU8) 23), (*prc).info, LOC5);
	add_226165(result, LOC6);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode225809*, transformouterconv_407993)(Tnode225809* n) {
	Tnode225809* result;
	Ttype225847* dest;
	Ttype225847* source;
	result = 0;
	dest = skiptypes_229167((*n).typ, IL64(211106242013440));
	source = skiptypes_229167((*(*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_407968((*n).kindU.S6.sons->data[((NI) 1)], dest);
		}
		LA9: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(Tnode225809*, transformyield_409084)(Toutercontext406022* c, Tnode225809* n, Titer406016* it) {
	Tnode225809* result;
	NI64 stateno;
	Tnode225809* stateasgnstmt;
	Tnode225809* LOC1;
	Tnode225809* LOC2;
	Ttype225847* LOC3;
	Tnode225809* LOC4;
	Tnode225809* retstmt;
	Tnode225809* statelabelstmt;
	Ttype225847* LOC17;
	Tnode225809* 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_227351(((NU8) 73), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_227325((*it).closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_402608(LOC1, (*it).state, (*n).info);
	add_226165(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_274190(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_226620(((NU8) 6), stateno, LOC3);
	add_226165(stateasgnstmt, LOC4);
	retstmt = newnodei_227351(((NU8) 109), (*n).info);
	{
		Tnode225809* a;
		Tnode225809* retval;
		Tnode225809* LOC9;
		Tnode225809* LOC10;
		if (!!(((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 1)))) goto LA7;
		a = newnodei_227351(((NU8) 73), (*(*n).kindU.S6.sons->data[((NI) 0)]).info);
		retval = transformouterproc_409076(c, (*n).kindU.S6.sons->data[((NI) 0)], it);
		LOC9 = 0;
		LOC9 = newsymnode_227325((*it).resultsym);
		addson_227819(a, LOC9);
		LOC10 = 0;
		{
			if (!retval == 0) goto LA13;
			LOC10 = (*n).kindU.S6.sons->data[((NI) 0)];
		}
		goto LA11;
		LA13: ;
		{
			LOC10 = retval;
		}
		LA11: ;
		addson_227819(a, LOC10);
		add_226165(retstmt, a);
	}
	goto LA5;
	LA7: ;
	{
		add_226165(retstmt, emptynode_226807);
	}
	LA5: ;
	statelabelstmt = newnodei_227351(((NU8) 157), (*n).info);
	LOC17 = 0;
	LOC17 = getsystype_274190(((NU8) 31));
	LOC18 = 0;
	LOC18 = newinttypenode_226620(((NU8) 6), stateno, LOC17);
	add_226165(statelabelstmt, LOC18);
	result = newnodei_227351(((NU8) 115), (*n).info);
	add_226165(result, stateasgnstmt);
	add_226165(result, retstmt);
	add_226165(result, statelabelstmt);
	return result;
}

N_NIMCALL(void, outerprocsons_409675)(Toutercontext406022* o, Tnode225809* n, Titer406016* it) {
	{
		NI i_409692;
		NI HEX3Atmp_409709;
		NI LOC2;
		NI res_409712;
		i_409692 = 0;
		HEX3Atmp_409709 = 0;
		LOC2 = 0;
		LOC2 = sonslen_228387(n);
		HEX3Atmp_409709 = (NI)(LOC2 - ((NI) 1));
		res_409712 = ((NI) 0);
		{
			while (1) {
				Tnode225809* x;
				if (!(res_409712 <= HEX3Atmp_409709)) goto LA4;
				i_409692 = res_409712;
				x = transformouterproc_409076(o, (*n).kindU.S6.sons->data[i_409692], it);
				{
					if (!!((x == NIM_NIL))) goto LA7;
					asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_409692]), x);
				}
				LA7: ;
				res_409712 += ((NI) 1);
			} LA4: ;
		}
	}
}

N_NIMCALL(Tnode225809*, transformreturn_409658)(Toutercontext406022* c, Tnode225809* n, Titer406016* it) {
	Tnode225809* result;
	Tnode225809* stateasgnstmt;
	Tnode225809* LOC1;
	Tnode225809* LOC2;
	Ttype225847* LOC3;
	Tnode225809* LOC4;
	result = 0;
	result = newnodei_227351(((NU8) 115), (*n).info);
	stateasgnstmt = newnodei_227351(((NU8) 73), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_227325((*it).closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_402608(LOC1, (*it).state, (*n).info);
	add_226165(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_274190(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_226620(((NU8) 6), IL64(-1), LOC3);
	add_226165(stateasgnstmt, LOC4);
	add_226165(result, stateasgnstmt);
	add_226165(result, n);
	return result;
}

N_NIMCALL(Tnode225809*, transformouterproc_409076)(Toutercontext406022* o, Tnode225809* n, Titer406016* it) {
	Tnode225809* 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):
	{
		Tsym225841* local;
		Tenv406020* closure;
		Tidobj198015* LOC65;
		TNimObject* LOC66;
		Tidobj198015* LOC85;
		local = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC11;
			Tnode225809* body;
			Tnode225809* newbody;
			Titer406016 LOC15;
			LOC11 = 0;
			LOC11 = isinnerproc_407286(local, (*o).fn);
			if (!(LOC11)) goto LA12;
			LOC11 = contains_222829((*o).processed, (*local).Sup.id);
			LA12: ;
			if (!LOC11) goto LA13;
			excl_222871((&(*o).processed), (*local).Sup.id);
			body = getbody_271062(local);
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_406807(local, (&LOC15));
			newbody = transformouterprocbody_410614(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_409044(local);
			LA24: ;
			LOC22 = LOC23;
			if (!(LOC22)) goto LA25;
			LOC22 = ((*it).fn == (*local).owner);
			LA25: ;
			if (!LOC22) goto LA26;
			{
				NIM_BOOL LOC30;
				Tidobj198015* LOC33;
				LOC30 = 0;
				LOC30 = contains_222829((*o).capturedvars, (*local).Sup.id);
				if (!LOC30) goto LA31;
				LOC33 = 0;
				LOC33 = &local->Sup;
				result = idnodetableget_233212((*o).localstoaccess, LOC33);
				goto BeforeRet;
			}
			goto LA28;
			LA31: ;
			{
				Tnode225809* LOC35;
				adduniquefield_403008((*it).obj, local);
				LOC35 = 0;
				LOC35 = newsymnode_227325((*it).closureparam);
				result = indirectaccess_404038(LOC35, local, (*n).info);
				goto BeforeRet;
			}
			LA28: ;
		}
		LA26: ;
		{
			Tenv406020* closure;
			Tidobj198015* LOC40;
			TNimObject* LOC41;
			if (!((*local).kind == ((NU8) 15))) goto LA38;
			LOC40 = 0;
			LOC40 = &local->Sup;
			LOC41 = 0;
			LOC41 = idtableget_233182((*o).lambdastoenv, LOC40);
			closure = ((Tenv406020*) (LOC41));
			{
				if (!closure == 0) goto LA44;
				result = liftitersym_409731(n, (*o).fn);
				goto BeforeRet;
			}
			goto LA42;
			LA44: ;
			{
				Tnode225809* createdvar;
				Ttype225847* lpt;
				Tsym225841* LOC47;
				createdvar = generateiterclosurecreation_408895(o, closure, (*closure).attachednode);
				LOC47 = 0;
				LOC47 = gethiddenparam_406407(local);
				lpt = (*LOC47).typ;
				{
					if (!!((lpt == (*createdvar).typ))) goto LA50;
					{
						NIM_BOOL LOC54;
						NI LOC55;
						NI LOC57;
						LOC54 = 0;
						LOC55 = 0;
						LOC55 = len_228369((*(*createdvar).typ).sons->data[((NI) 0)]);
						LOC54 = (LOC55 == ((NI) 1));
						if (!(LOC54)) goto LA56;
						LOC57 = 0;
						LOC57 = len_228369((*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_196172((*n).info, ((NimStringDesc*) &TMP3464));
					}
					LA52: ;
				}
				LA50: ;
				result = makeclosure_408034(local, createdvar, (*n).info);
				goto BeforeRet;
			}
			LA42: ;
		}
		LA38: ;
		LOC65 = 0;
		LOC65 = &local->Sup;
		LOC66 = 0;
		LOC66 = idtableget_233182((*o).lambdastoenv, LOC65);
		closure = ((Tenv406020*) (LOC66));
		{
			Tnode225809* a;
			if (!!((closure == NIM_NIL))) goto LA69;
			a = (*closure).createdvar;
			{
				if (!!((a == NIM_NIL))) goto LA73;
				result = makeclosure_408034(local, a, (*n).info);
				goto BeforeRet;
			}
			goto LA71;
			LA73: ;
			{
				Tnode225809* scope;
				Tnode225809* 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_408883(o, closure));
				}
				LA78: ;
				x = (*closure).createdvar;
				result = makeclosure_408034(local, x, (*n).info);
				goto BeforeRet;
			}
			LA71: ;
		}
		LA69: ;
		{
			NIM_BOOL LOC82;
			LOC82 = 0;
			LOC82 = contains_222829((*o).capturedvars, (*local).Sup.id);
			if (!!(LOC82)) goto LA83;
			goto BeforeRet;
		}
		LA83: ;
		LOC85 = 0;
		LOC85 = &local->Sup;
		result = idnodetableget_233212((*o).localstoaccess, LOC85);
	}
	break;
	case ((NU8) 51):
	case ((NU8) 84):
	case ((NU8) 52):
	{
		{
			if (!!(((*n).typ == NIM_NIL))) goto LA89;
			result = transformouterproc_409076(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):
	{
		{
			Tsym225841* 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;
				Tnode225809* body;
				Tnode225809* newbody;
				Titer406016 LOC103;
				LOC99 = 0;
				LOC99 = isinnerproc_407286(local, (*o).fn);
				if (!(LOC99)) goto LA100;
				LOC99 = contains_222829((*o).processed, (*local).Sup.id);
				LA100: ;
				if (!LOC99) goto LA101;
				excl_222871((&(*o).processed), (*local).Sup.id);
				body = getbody_271062(local);
				memset((void*)(&LOC103), 0, sizeof(LOC103));
				inititer_406807(local, (&LOC103));
				newbody = transformouterprocbody_410614(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):
	{
		Tnode225809* x;
		x = transformouterproc_409076(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_407993(n);
	}
	break;
	case ((NU8) 104):
	{
		{
			if (!((*(*it).fn).kind == ((NU8) 15))) goto LA116;
			result = transformyield_409084(o, n, it);
		}
		goto LA114;
		LA116: ;
		{
			outerprocsons_409675(o, n, it);
		}
		LA114: ;
	}
	break;
	case ((NU8) 109):
	{
		{
			if (!((*(*it).fn).kind == ((NU8) 15))) goto LA122;
			result = transformreturn_409658(o, n, it);
		}
		goto LA120;
		LA122: ;
		{
			outerprocsons_409675(o, n, it);
		}
		LA120: ;
	}
	break;
	default:
	{
		outerprocsons_409675(o, n, it);
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode225809*, transformouterprocbody_410614)(Toutercontext406022* o, Tnode225809* n, Titer406016* it) {
	Tnode225809* result;
{	result = 0;
	{
		if (!(((*n).flags &(1<<((((NU8) 8))&15)))!=0)) goto LA3;
		result = NIM_NIL;
	}
	goto LA1;
	LA3: ;
	{
		Tnode225809* gs;
		Tnode225809* LOC35;
		Tnode225809* LOC36;
		Tnode225809* state0;
		Tnode225809* LOC37;
		Tnode225809* newbody;
		Tnode225809* stateasgnstmt;
		Tnode225809* LOC43;
		Tnode225809* LOC44;
		Ttype225847* LOC45;
		Tnode225809* 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_226098(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;
				Tnode225809* LOC26;
				Tnode225809* LOC28;
				NI LOC29;
				Tnode225809* LOC31;
				Tnode225809* LOC32;
				LOC21 = 0;
				LOC22 = 0;
				LOC23 = 0;
				LOC24 = 0;
				LOC24 = len_226098(n);
				LOC23 = (((NI) 1) < LOC24);
				if (!(LOC23)) goto LA25;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_226244(n, ((NI) 1));
				LOC23 = ((*LOC26).kind == ((NU8) 115));
				LA25: ;
				LOC22 = LOC23;
				if (!(LOC22)) goto LA27;
				LOC28 = 0;
				LOC28 = HEX5BHEX5D_226244(n, ((NI) 1));
				LOC29 = 0;
				LOC29 = len_226098(LOC28);
				LOC22 = (((NI) 0) < LOC29);
				LA27: ;
				LOC21 = LOC22;
				if (!(LOC21)) goto LA30;
				LOC31 = 0;
				LOC31 = HEX5BHEX5D_226244(n, ((NI) 1));
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_226244(LOC31, ((NI) 0));
				LOC21 = ((*LOC32).kind == ((NU8) 156));
				LA30: ;
				if (!LOC21) goto LA33;
				result = NIM_NIL;
				goto BeforeRet;
			}
			LA33: ;
		}
		LA13: ;
		result = newnodei_227351(((NU8) 115), (*(*it).fn).info);
		gs = newnodei_227351(((NU8) 156), (*(*it).fn).info);
		LOC35 = 0;
		LOC35 = newsymnode_227325((*it).closureparam);
		LOC36 = 0;
		LOC36 = rawindirectaccess_402608(LOC35, (*it).state, (*(*it).fn).info);
		add_226165(gs, LOC36);
		add_226165(result, gs);
		state0 = newnodei_227351(((NU8) 157), (*(*it).fn).info);
		LOC37 = 0;
		LOC37 = newintnode_226608(((NU8) 6), IL64(0));
		add_226165(state0, LOC37);
		add_226165(result, state0);
		newbody = transformouterproc_409076(o, n, it);
		{
			if (!!((newbody == NIM_NIL))) goto LA40;
			add_226165(result, newbody);
		}
		goto LA38;
		LA40: ;
		{
			add_226165(result, n);
		}
		LA38: ;
		stateasgnstmt = newnodei_227351(((NU8) 73), (*(*it).fn).info);
		LOC43 = 0;
		LOC43 = newsymnode_227325((*it).closureparam);
		LOC44 = 0;
		LOC44 = rawindirectaccess_402608(LOC43, (*it).state, (*(*it).fn).info);
		add_226165(stateasgnstmt, LOC44);
		LOC45 = 0;
		LOC45 = getsystype_274190(((NU8) 31));
		LOC46 = 0;
		LOC46 = newinttypenode_226620(((NU8) 6), IL64(-1), LOC45);
		add_226165(stateasgnstmt, LOC46);
		add_226165(result, stateasgnstmt);
		(*result).flags |= ((NU16)1)<<((((NU8) 8))%(sizeof(NU16)*8));
	}
	goto LA1;
	LA6: ;
	{
		result = transformouterproc_409076(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_410224)(Toutercontext406022* o) {
	Tenv406020* env;
	env = (*o).head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				Tnode225809* 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(Tnode225809*, liftlambdas_412240)(Tsym225841* fn, Tnode225809* body) {
	Tnode225809* 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;
		Tsym225841* LOC11;
		LOC5 = 0;
		LOC6 = 0;
		LOC6 = ((*body).kind == ((NU8) 1));
		if (LOC6) goto LA7;
		LOC8 = 0;
		LOC8 = (gcmd_167134 == ((NU8) 4));
		if (!(LOC8)) goto LA9;
		LOC8 = !(iscompiletime);
		LA9: ;
		LOC6 = LOC8;
		LA7: ;
		LOC5 = LOC6;
		if (LOC5) goto LA10;
		LOC11 = 0;
		LOC11 = skipgenericowner_230694(fn);
		LOC5 = !(((*LOC11).kind == ((NU8) 6)));
		LA10: ;
		if (!LOC5) goto LA12;
		result = body;
	}
	goto LA3;
	LA12: ;
	{
		Toutercontext406022* o;
		Tnode225809* ex;
		Tenv406020* env;
		o = newoutercontext_407029(fn);
		ex = closurecreationpoint_408312(body);
		env = newenv_407049(o, NIM_NIL, ex, fn);
		addparamstoenv_408343(fn, env);
		searchforinnerprocs_408423(o, body, env);
		createenvironments_410010(o);
		{
			Titer406016 LOC19;
			if (!((*fn).kind == ((NU8) 15))) goto LA17;
			memset((void*)(&LOC19), 0, sizeof(LOC19));
			inititer_406807(fn, (&LOC19));
			result = transformouterprocbody_410614(o, body, (&LOC19));
		}
		goto LA15;
		LA17: ;
		{
			Titer406016 LOC21;
			Tnode225809* LOC22;
			memset((void*)(&LOC21), 0, sizeof(LOC21));
			inititer_406807(fn, (&LOC21));
			LOC22 = 0;
			LOC22 = transformouterprocbody_410614(o, body, (&LOC21));
			result = ex;
		}
		LA15: ;
		finishenvironments_410224(o);
	}
	LA3: ;
	return result;
}

N_NIMCALL(Tnode225809*, liftlambdasfortoplevel_412312)(Tsym225841* module, Tnode225809* body) {
	Tnode225809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*body).kind == ((NU8) 1));
		if (LOC3) goto LA4;
		LOC3 = (gcmd_167134 == ((NU8) 4));
		LA4: ;
		if (!LOC3) goto LA5;
		result = body;
	}
	goto LA1;
	LA5: ;
	{
		Toutercontext406022* o;
		Tnode225809* ex;
		Tenv406020* env;
		Titer406016 LOC8;
		Tnode225809* LOC9;
		o = newoutercontext_407029(module);
		ex = closurecreationpoint_408312(body);
		env = newenv_407049(o, NIM_NIL, ex, module);
		searchforinnerprocs_408423(o, body, env);
		createenvironments_410010(o);
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		inititer_406807(module, (&LOC8));
		LOC9 = 0;
		LOC9 = transformouterproc_409076(o, body, (&LOC8));
		finishenvironments_410224(o);
		result = ex;
	}
	LA1: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_lambdaliftingInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, compiler_lambdaliftingDatInit000)(void) {
static TNimNode* TMP3447[6];
static TNimNode* TMP3448[11];
static TNimNode TMP1011[19];
NTI406022.size = sizeof(Toutercontext406022);
NTI406022.kind = 18;
NTI406022.base = 0;
TMP3447[0] = &TMP1011[1];
TMP1011[1].kind = 1;
TMP1011[1].offset = offsetof(Toutercontext406022, fn);
TMP1011[1].typ = (&NTI225807);
TMP1011[1].name = "fn";
TMP3447[1] = &TMP1011[2];
NTI406020.size = sizeof(Tenv406020);
NTI406020.kind = 17;
NTI406020.base = (&NTI4011);
TMP3448[0] = &TMP1011[4];
TMP1011[4].kind = 1;
TMP1011[4].offset = offsetof(Tenv406020, attachednode);
TMP1011[4].typ = (&NTI225801);
TMP1011[4].name = "attachedNode";
TMP3448[1] = &TMP1011[5];
TMP1011[5].kind = 1;
TMP1011[5].offset = offsetof(Tenv406020, replacementnode);
TMP1011[5].typ = (&NTI225801);
TMP1011[5].name = "replacementNode";
TMP3448[2] = &TMP1011[6];
TMP1011[6].kind = 1;
TMP1011[6].offset = offsetof(Tenv406020, createdvar);
TMP1011[6].typ = (&NTI225801);
TMP1011[6].name = "createdVar";
TMP3448[3] = &TMP1011[7];
TMP1011[7].kind = 1;
TMP1011[7].offset = offsetof(Tenv406020, createdvarcomesfromiter);
TMP1011[7].typ = (&NTI138);
TMP1011[7].name = "createdVarComesFromIter";
TMP3448[4] = &TMP1011[8];
TMP1011[8].kind = 1;
TMP1011[8].offset = offsetof(Tenv406020, capturedvars);
TMP1011[8].typ = (&NTI225811);
TMP1011[8].name = "capturedVars";
TMP3448[5] = &TMP1011[9];
TMP1011[9].kind = 1;
TMP1011[9].offset = offsetof(Tenv406020, up);
TMP1011[9].typ = (&NTI406018);
TMP1011[9].name = "up";
TMP3448[6] = &TMP1011[10];
TMP1011[10].kind = 1;
TMP1011[10].offset = offsetof(Tenv406020, next);
TMP1011[10].typ = (&NTI406018);
TMP1011[10].name = "next";
TMP3448[7] = &TMP1011[11];
TMP1011[11].kind = 1;
TMP1011[11].offset = offsetof(Tenv406020, upfield);
TMP1011[11].typ = (&NTI225807);
TMP1011[11].name = "upField";
TMP3448[8] = &TMP1011[12];
TMP1011[12].kind = 1;
TMP1011[12].offset = offsetof(Tenv406020, obj);
TMP1011[12].typ = (&NTI225805);
TMP1011[12].name = "obj";
TMP3448[9] = &TMP1011[13];
TMP1011[13].kind = 1;
TMP1011[13].offset = offsetof(Tenv406020, fn);
TMP1011[13].typ = (&NTI225807);
TMP1011[13].name = "fn";
TMP3448[10] = &TMP1011[14];
TMP1011[14].kind = 1;
TMP1011[14].offset = offsetof(Tenv406020, vars);
TMP1011[14].typ = (&NTI222056);
TMP1011[14].name = "vars";
TMP1011[3].len = 11; TMP1011[3].kind = 2; TMP1011[3].sons = &TMP3448[0];
NTI406020.node = &TMP1011[3];
NTI406018.size = sizeof(Tenv406020*);
NTI406018.kind = 22;
NTI406018.base = (&NTI406020);
NTI406018.marker = TMP3449;
TMP1011[2].kind = 1;
TMP1011[2].offset = offsetof(Toutercontext406022, head);
TMP1011[2].typ = (&NTI406018);
TMP1011[2].name = "head";
TMP3447[2] = &TMP1011[15];
TMP1011[15].kind = 1;
TMP1011[15].offset = offsetof(Toutercontext406022, capturedvars);
TMP1011[15].typ = (&NTI222056);
TMP1011[15].name = "capturedVars";
TMP3447[3] = &TMP1011[16];
TMP1011[16].kind = 1;
TMP1011[16].offset = offsetof(Toutercontext406022, processed);
TMP1011[16].typ = (&NTI222056);
TMP1011[16].name = "processed";
TMP3447[4] = &TMP1011[17];
TMP1011[17].kind = 1;
TMP1011[17].offset = offsetof(Toutercontext406022, localstoaccess);
TMP1011[17].typ = (&NTI225865);
TMP1011[17].name = "localsToAccess";
TMP3447[5] = &TMP1011[18];
TMP1011[18].kind = 1;
TMP1011[18].offset = offsetof(Toutercontext406022, lambdastoenv);
TMP1011[18].typ = (&NTI225859);
TMP1011[18].name = "lambdasToEnv";
TMP1011[0].len = 6; TMP1011[0].kind = 2; TMP1011[0].sons = &TMP3447[0];
NTI406022.node = &TMP1011[0];
NTI406014.size = sizeof(Toutercontext406022*);
NTI406014.kind = 22;
NTI406014.base = (&NTI406022);
NTI406014.marker = TMP3450;
}

