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

#include "nimbase.h"
#include <string.h>
typedef struct Tsym224841 Tsym224841;
typedef struct Tidobj197015 Tidobj197015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq224843 Ttypeseq224843;
typedef struct Tscope224835 Tscope224835;
typedef struct TY224944 TY224944;
typedef struct Tstrtable224813 Tstrtable224813;
typedef struct Tsymseq224811 Tsymseq224811;
typedef struct Ttype224847 Ttype224847;
typedef struct Tident197021 Tident197021;
typedef struct Tlineinfo189352 Tlineinfo189352;
typedef struct Tnode224809 Tnode224809;
typedef struct Tloc224823 Tloc224823;
typedef struct Ropeobj175009 Ropeobj175009;
typedef struct Tlib224827 Tlib224827;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tnodeseq224803 Tnodeseq224803;
typedef struct TY90959 TY90959;
typedef struct Cell48947 Cell48947;
typedef struct Cellseq48963 Cellseq48963;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48959 Cellset48959;
typedef struct Pagedesc48955 Pagedesc48955;
typedef struct Memregion30891 Memregion30891;
typedef struct Smallchunk30843 Smallchunk30843;
typedef struct Llchunk30885 Llchunk30885;
typedef struct Bigchunk30845 Bigchunk30845;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30889 Avlnode30889;
typedef struct Gcstat51014 Gcstat51014;
typedef struct Toutercontext405022 Toutercontext405022;
typedef struct Tenv405020 Tenv405020;
typedef struct Intset221056 Intset221056;
typedef struct Trunk221052 Trunk221052;
typedef struct Trunkseq221054 Trunkseq221054;
typedef struct Tidnodetable224865 Tidnodetable224865;
typedef struct Tidnodepairseq224863 Tidnodepairseq224863;
typedef struct Tidtable224859 Tidtable224859;
typedef struct Tidpairseq224857 Tidpairseq224857;
typedef struct Titer405016 Titer405016;
typedef struct Tinstantiation224831 Tinstantiation224831;
typedef struct Tlistentry140022 Tlistentry140022;
typedef struct Basechunk30841 Basechunk30841;
typedef struct Freecell30833 Freecell30833;
typedef struct Tidnodepair224861 Tidnodepair224861;
typedef struct Tidpair224855 Tidpair224855;
typedef struct TY224932 TY224932;
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  Tidobj197015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable224813  {
NI counter;
Tsymseq224811* data;
};
struct  Tlineinfo189352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc224823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype224847* t;
Ropeobj175009* r;
Ropeobj175009* heaproot;
};
struct  Tsym224841  {
  Tidobj197015 Sup;
NU8 kind;
union{
struct {Ttypeseq224843* typeinstcache;
Tscope224835* typscope;
} S1;
struct {TY224944* procinstcache;
Tsym224841* gcunsafetyreason;
} S2;
struct {TY224944* usedgenerics;
Tstrtable224813 tab;
} S3;
struct {Tsym224841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype224847* typ;
Tident197021* name;
Tlineinfo189352 info;
Tsym224841* owner;
NU32 flags;
Tnode224809* ast;
NU32 options;
NI position;
NI offset;
Tloc224823 loc;
Tlib224827* annex;
Tnode224809* constraint;
};
struct  Ttype224847  {
  Tidobj197015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq224843* sons;
Tnode224809* n;
Tsym224841* owner;
Tsym224841* sym;
Tsym224841* destructor;
Tsym224841* deepcopy;
Tsym224841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc224823 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode224809  {
Ttype224847* typ;
Tlineinfo189352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym224841* sym;
} S4;
struct {Tident197021* ident;
} S5;
struct {Tnodeseq224803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct TY90959 {
NimStringDesc* Field0;
NI Field1;
};
struct  Cell48947  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48963  {
NI len;
NI cap;
Cell48947** d;
};
struct  Cellset48959  {
NI counter;
NI max;
Pagedesc48955* head;
Pagedesc48955** data;
};
typedef Smallchunk30843* TY30906[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30891  {
NI minlargeobj;
NI maxlargeobj;
TY30906 freesmallchunks;
Llchunk30885* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30845* freechunkslist;
Intset30817 chunkstarts;
Avlnode30889* root;
Avlnode30889* deleted;
Avlnode30889* last;
Avlnode30889* 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;
Cellseq48963 zct;
Cellseq48963 decstack;
Cellset48959 cycleroots;
Cellseq48963 tempstack;
NI recgclock;
Memregion30891 region;
Gcstat51014 stat;
};
struct  Intset221056  {
NI counter;
NI max;
Trunk221052* head;
Trunkseq221054* data;
};
struct  Tidnodetable224865  {
NI counter;
Tidnodepairseq224863* data;
};
struct  Tidtable224859  {
NI counter;
Tidpairseq224857* data;
};
struct  Toutercontext405022  {
Tsym224841* fn;
Tenv405020* head;
Intset221056 capturedvars;
Intset221056 processed;
Tidnodetable224865 localstoaccess;
Tidtable224859 lambdastoenv;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tenv405020  {
  TNimObject Sup;
Tnode224809* attachednode;
Tnode224809* replacementnode;
Tnode224809* createdvar;
NIM_BOOL createdvarcomesfromiter;
Tsymseq224811* capturedvars;
Tenv405020* up;
Tenv405020* next;
Tsym224841* upfield;
Ttype224847* obj;
Tsym224841* fn;
Intset221056 vars;
};
struct  Tident197021  {
  Tidobj197015 Sup;
NimStringDesc* s;
Tident197021* next;
NI h;
};
struct  Titer405016  {
Tsym224841* fn;
Tsym224841* closureparam;
Tsym224841* state;
Tsym224841* resultsym;
Ttype224847* obj;
};
struct  Tscope224835  {
NI depthlevel;
Tstrtable224813 symbols;
Tnodeseq224803* usingsyms;
Tscope224835* parent;
};
struct  Ropeobj175009  {
  TNimObject Sup;
Ropeobj175009* left;
Ropeobj175009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry140022  {
  TNimObject Sup;
Tlistentry140022* prev;
Tlistentry140022* next;
};
struct  Tlib224827  {
  Tlistentry140022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj175009* name;
Tnode224809* path;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30822[8];
struct  Pagedesc48955  {
Pagedesc48955* next;
NI key;
TY30822 bits;
};
struct  Basechunk30841  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30843  {
  Basechunk30841 Sup;
Smallchunk30843* next;
Smallchunk30843* prev;
Freecell30833* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30885  {
NI size;
NI acc;
Llchunk30885* next;
};
struct  Bigchunk30845  {
  Basechunk30841 Sup;
Bigchunk30845* next;
Bigchunk30845* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30822 bits;
};
typedef Avlnode30889* TY30896[2];
struct  Avlnode30889  {
TY30896 link;
NI key;
NI upperbound;
NI level;
};
struct  Trunk221052  {
Trunk221052* next;
NI key;
TY30822 bits;
};
struct  Tidnodepair224861  {
Tidobj197015* key;
Tnode224809* val;
};
struct  Tidpair224855  {
Tidobj197015* key;
TNimObject* val;
};
struct  Tinstantiation224831  {
Tsym224841* sym;
Ttypeseq224843* concretetypes;
TY224932* usedby;
NI compilesid;
};
struct  Freecell30833  {
Freecell30833* next;
NI zerofield;
};
struct Tsymseq224811 {
  TGenericSeq Sup;
  Tsym224841* data[SEQ_DECL_SIZE];
};
struct Ttypeseq224843 {
  TGenericSeq Sup;
  Ttype224847* data[SEQ_DECL_SIZE];
};
struct TY224944 {
  TGenericSeq Sup;
  Tinstantiation224831* data[SEQ_DECL_SIZE];
};
struct Tnodeseq224803 {
  TGenericSeq Sup;
  Tnode224809* data[SEQ_DECL_SIZE];
};
struct Trunkseq221054 {
  TGenericSeq Sup;
  Trunk221052* data[SEQ_DECL_SIZE];
};
struct Tidnodepairseq224863 {
  TGenericSeq Sup;
  Tidnodepair224861 data[SEQ_DECL_SIZE];
};
struct Tidpairseq224857 {
  TGenericSeq Sup;
  Tidpair224855 data[SEQ_DECL_SIZE];
};
struct TY224932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
static N_INLINE(NIM_BOOL, interestingvar_406406)(Tsym224841* s);
N_NIMCALL(NIM_BOOL, isgenericroutine_229651)(Tsym224841* s);
static N_INLINE(NI, len_225098)(Tnode224809* n);
static N_INLINE(Tnode224809*, HEX5BHEX5D_225244)(Tnode224809* n, NI i);
N_NIMCALL(void, localerror_195139)(Tlineinfo189352 info, NimStringDesc* arg);
N_NIMCALL(Tnode224809*, newnodei_226351)(NU8 kind, Tlineinfo189352 info);
N_NIMCALL(Tsym224841*, copysym_227607)(Tsym224841* s, NIM_BOOL keepid);
N_NIMCALL(Tsym224841*, gethiddenparam_405407)(Tsym224841* routine);
N_NIMCALL(Tnode224809*, lastson_227406)(Tnode224809* n);
N_NIMCALL(void, internalerror_195191)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_195279)(TY90959 x);
N_NIMCALL(void, addvar_401047)(Tnode224809* father, Tnode224809* v);
N_NIMCALL(Tnode224809*, newsymnode_226325)(Tsym224841* sym);
N_NIMCALL(void, add_225165)(Tnode224809* father, Tnode224809* son);
N_NIMCALL(Tnode224809*, newcall_406272)(Tsym224841* a, Tnode224809* b);
N_NIMCALL(Tsym224841*, getsyssym_273077)(NimStringDesc* name);
N_NIMCALL(Tnode224809*, newnodei_226407)(NU8 kind, Tlineinfo189352 info, NI children);
N_NIMCALL(Tnode224809*, newinttypenode_225619)(NU8 kind, NI64 intval, Ttype224847* typ);
N_NIMCALL(Ttype224847*, getsystype_273190)(NU8 kind);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell48947*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48947* c);
N_NOINLINE(void, addzct_52617)(Cellseq48963* s, Cell48947* c);
N_NIMCALL(void, addson_226819)(Tnode224809* father, Tnode224809* son);
N_NIMCALL(Tnode224809*, makeclosure_407034)(Tsym224841* prc, Tnode224809* env, Tlineinfo189352 info);
N_NIMCALL(Tnode224809*, newnodeit_226807)(NU8 kind, Tlineinfo189352 info, Ttype224847* typ);
N_NIMCALL(Tsym224841*, skipgenericowner_229695)(Tsym224841* s);
N_NIMCALL(Toutercontext405022*, newoutercontext_406029)(Tsym224841* 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_221927)(Intset221056* Result);
N_NIMCALL(void, initidnodetable_228127)(Tidnodetable224865* x);
N_NIMCALL(void, initidtable_228057)(Tidtable224859* x);
N_NIMCALL(Tnode224809*, closurecreationpoint_407312)(Tnode224809* n);
N_NIMCALL(Tenv405020*, newenv_406049)(Toutercontext405022* o, Tenv405020* up, Tnode224809* n, Tsym224841* 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)(Cell48947* c);
static N_INLINE(NIM_BOOL, canbecycleroot_52667)(Cell48947* c);
static N_INLINE(void, rtladdcycleroot_53423)(Cell48947* c);
N_NOINLINE(void, incl_49665)(Cellset48959* s, Cell48947* cell);
static N_INLINE(void, decref_54604)(Cell48947* c);
N_NIMCALL(Tsym224841*, getenvparam_405607)(Tsym224841* routine);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(Ttype224847*, createenvobj_405082)(Tsym224841* owner);
N_NIMCALL(Ttype224847*, createobj_401372)(Tsym224841* owner, Tlineinfo189352 info);
N_NIMCALL(void, rawaddfield_401393)(Ttype224847* obj, Tsym224841* field);
N_NIMCALL(Tsym224841*, createstatefield_405070)(Tsym224841* iter);
N_NIMCALL(Tsym224841*, newsym_225655)(NU8 symkind, Tident197021* name, Tsym224841* owner, Tlineinfo189352 info);
N_NIMCALL(Tident197021*, getident_197463)(NimStringDesc* identifier);
N_NIMCALL(Ttype224847*, getstatetype_405049)(Tsym224841* iter);
N_NIMCALL(Tnode224809*, newintnode_225607)(NU8 kind, NI64 intval);
N_NIMCALL(Ttype224847*, newtype_227140)(NU8 kind, Tsym224841* owner);
N_NIMCALL(Ttype224847*, nilorsysint_273036)(void);
N_NIMCALL(void, rawaddson_228498)(Ttype224847* father, Ttype224847* son);
N_NIMCALL(void, addparamstoenv_407343)(Tsym224841* fn, Tenv405020* env);
N_NIMCALL(void, internalerror_195172)(Tlineinfo189352 info, NimStringDesc* errmsg);
N_NIMCALL(void, incl_221856)(Intset221056* s, NI key);
N_NIMCALL(NI, sonslen_227387)(Tnode224809* n);
N_NIMCALL(void, searchforinnerprocs_407423)(Toutercontext405022* o, Tnode224809* n, Tenv405020* env);
N_NIMCALL(NIM_BOOL, isinnerproc_406286)(Tsym224841* s, Tsym224841* outerproc);
N_NIMCALL(NIM_BOOL, containsorincl_221898)(Intset221056* s, NI key);
N_NIMCALL(Tnode224809*, getbody_270061)(Tsym224841* s);
N_NIMCALL(NI, gathervars_406870)(Toutercontext405022* o, Tenv405020* e, Tnode224809* n);
N_NIMCALL(NIM_BOOL, capturevar_406638)(Toutercontext405022* o, Tenv405020* top, Tsym224841* local, Tlineinfo189352 info);
N_NIMCALL(NIM_BOOL, contains_221829)(Intset221056* s, NI key);
static N_INLINE(NIM_BOOL, illegalcapture_406375)(Tsym224841* s);
N_NIMCALL(Ttype224847*, skiptypes_228167)(Ttype224847* t, NU64 kinds);
N_NIMCALL(void, localerror_195128)(Tlineinfo189352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(Tsym224841*, createupfield_406621)(Ttype224847* obj, Ttype224847* fieldtype);
N_NIMCALL(void, addfield_401809)(Ttype224847* obj, Tsym224841* s);
N_NIMCALL(void, addclosureparam_406338)(Tsym224841* fn, Tenv405020* e);
N_NIMCALL(void, addhiddenparam_405124)(Tsym224841* routine, Tsym224841* param);
N_NIMCALL(TNimObject*, idtableget_232182)(Tidtable224859 t, Tidobj197015* key);
N_NIMCALL(void, idtableput_232196)(Tidtable224859* t, Tidobj197015* key, TNimObject* val);
N_NIMCALL(void, addcapturedvar_406215)(Tenv405020* e, Tsym224841* v);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(Tnode224809*, transforminnerproc_407210)(Toutercontext405022* o, Tenv405020* e, Tnode224809* n);
N_NIMCALL(Tnode224809*, getclosurevar_407097)(Tenv405020* e);
N_NIMCALL(Tnode224809*, newclosurecreationvar_407062)(Tenv405020* e);
N_NIMCALL(void, inititer_405807)(Tsym224841* iter, Titer405016* Result);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(Tsym224841*, newiterresult_405093)(Tsym224841* iter);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, adduniquefield_402008)(Ttype224847* obj, Tsym224841* s);
N_NIMCALL(Tnode224809*, indirectaccess_403038)(Tnode224809* a, Tsym224841* b, Tlineinfo189352 info);
N_NIMCALL(Tenv405020*, findenv_407119)(Toutercontext405022* o, Tsym224841* s);
N_NIMCALL(Tnode224809*, nestedaccess_406438)(Tenv405020* top, Tsym224841* local);
N_NIMCALL(void, createenvironments_409010)(Toutercontext405022* o);
N_NIMCALL(Tnode224809*, generateclosurecreation_407883)(Toutercontext405022* o, Tenv405020* scope);
N_NIMCALL(Tnode224809*, rawclosurecreation_407785)(Toutercontext405022* o, Tenv405020* scope, Tnode224809* env);
N_NIMCALL(Tnode224809*, newasgnstmt_407771)(Tnode224809* le, Tnode224809* ri, Tlineinfo189352 info);
N_NIMCALL(Tnode224809*, idnodetableget_232212)(Tidnodetable224865 t, Tidobj197015* key);
N_NIMCALL(void, idnodetableput_232219)(Tidnodetable224865* t, Tidobj197015* key, Tnode224809* val);
N_NIMCALL(Tnode224809*, transformouterprocbody_409614)(Toutercontext405022* o, Tnode224809* n, Titer405016* it);
N_NIMCALL(Tnode224809*, rawindirectaccess_401608)(Tnode224809* a, Tsym224841* field, Tlineinfo189352 info);
N_NIMCALL(Tnode224809*, transformouterproc_408076)(Toutercontext405022* o, Tnode224809* n, Titer405016* it);
N_NIMCALL(void, excl_221871)(Intset221056* s, NI key);
static N_INLINE(NIM_BOOL, interestingitervar_408044)(Tsym224841* s);
N_NIMCALL(Tnode224809*, liftitersym_408731)(Tnode224809* n, Tsym224841* owner);
N_NIMCALL(Tnode224809*, generateiterclosurecreation_407895)(Toutercontext405022* o, Tenv405020* env, Tnode224809* scope);
N_NIMCALL(NI, len_227369)(Ttype224847* n);
N_NIMCALL(Tnode224809*, transformouterconv_406993)(Tnode224809* n);
N_NIMCALL(Tnode224809*, generatethunk_406968)(Tnode224809* prc, Ttype224847* dest);
N_NIMCALL(Tnode224809*, transformyield_408084)(Toutercontext405022* c, Tnode224809* n, Titer405016* it);
N_NIMCALL(void, outerprocsons_408675)(Toutercontext405022* o, Tnode224809* n, Titer405016* it);
N_NIMCALL(Tnode224809*, transformreturn_408658)(Toutercontext405022* c, Tnode224809* n, Titer405016* it);
N_NIMCALL(void, finishenvironments_409224)(Toutercontext405022* o);
STRING_LITERAL(TMP3406, "ignored invalid for loop", 24);
STRING_LITERAL(TMP3408, "compiler/lambdalifting.nim", 26);
NIM_CONST TY90959 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 TY90959 TMP3455 = {((NimStringDesc*) &TMP3408),
((NI) 222)}
;
STRING_LITERAL(TMP3456, ":result", 7);
NIM_CONST TY90959 TMP3459 = {((NimStringDesc*) &TMP3408),
((NI) 472)}
;
NIM_CONST TY90959 TMP3460 = {((NimStringDesc*) &TMP3408),
((NI) 315)}
;
NIM_CONST TY90959 TMP3461 = {((NimStringDesc*) &TMP3408),
((NI) 322)}
;
STRING_LITERAL(TMP3462, "searchForInnerProcs", 19);
STRING_LITERAL(TMP3463, "environment computation failed", 30);
extern Gcheap51018 gch_51059;
extern Tnode224809* emptynode_225807;
extern NU8 gcmd_166134;
TNimType NTI405022; /* TOuterContext */
extern TNimType NTI224807; /* PSym */
extern TNimType NTI4011; /* RootObj */
TNimType NTI405020; /* TEnv */
extern TNimType NTI224801; /* PNode */
extern TNimType NTI138; /* bool */
extern TNimType NTI224811; /* TSymSeq */
extern TNimType NTI224805; /* PType */
extern TNimType NTI221056; /* IntSet */
TNimType NTI405018; /* PEnv */
extern TNimType NTI224865; /* TIdNodeTable */
extern TNimType NTI224859; /* TIdTable */
TNimType NTI405014; /* POuterContext */

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

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

N_NIMCALL(Tsym224841*, gethiddenparam_405407)(Tsym224841* routine) {
	Tsym224841* result;
	Tnode224809* params;
	Tnode224809* hidden;
	result = 0;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	hidden = lastson_227406(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_195279(TMP3407);
		internalerror_195191(LOC7);
	}
	LA5: ;
	result = (*hidden).kindU.S4.sym;
	return result;
}

N_NIMCALL(Tnode224809*, newcall_406272)(Tsym224841* a, Tnode224809* b) {
	Tnode224809* result;
	Tnode224809* LOC1;
	result = 0;
	result = newnodei_226351(((NU8) 27), (*a).info);
	LOC1 = 0;
	LOC1 = newsymnode_226325(a);
	add_225165(result, LOC1);
	add_225165(result, b);
	return result;
}

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

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

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

N_NIMCALL(Tnode224809*, makeclosure_407034)(Tsym224841* prc, Tnode224809* env, Tlineinfo189352 info) {
	Tnode224809* result;
	Tnode224809* LOC1;
	result = 0;
	result = newnodeit_226807(((NU8) 155), info, (*prc).typ);
	LOC1 = 0;
	LOC1 = newsymnode_226325(prc);
	add_225165(result, LOC1);
	{
		Ttype224847* LOC6;
		Tnode224809* LOC7;
		if (!(env == NIM_NIL)) goto LA4;
		LOC6 = 0;
		LOC6 = getsystype_273190(((NU8) 5));
		LOC7 = 0;
		LOC7 = newnodeit_226807(((NU8) 23), info, LOC6);
		add_225165(result, LOC7);
	}
	goto LA2;
	LA4: ;
	{
		add_225165(result, env);
	}
	LA2: ;
	return result;
}

N_NIMCALL(Tnode224809*, liftforloop_411344)(Tnode224809* body) {
	Tnode224809* result;
	NI L;
	Tnode224809* call;
	Tsym224841* env;
	Tnode224809* loopbody;
	Tnode224809* whileloop;
	Ttype224847* LOC22;
	Tnode224809* v2;
	Tnode224809* vpart;
	NU8 LOC23;
	Tnode224809* bs;
{	result = 0;
	L = len_225098(body);
	{
		NIM_BOOL LOC3;
		Tnode224809* LOC5;
		LOC3 = 0;
		LOC3 = ((*body).kind == ((NU8) 94));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = HEX5BHEX5D_225244(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_195139((*body).info, ((NimStringDesc*) &TMP3406));
		result = body;
		goto BeforeRet;
	}
	LA6: ;
	call = HEX5BHEX5D_225244(body, (NI)(L - ((NI) 2)));
	result = newnodei_226351(((NU8) 115), (*body).info);
	env = 0;
	{
		NIM_BOOL LOC10;
		Tnode224809* LOC11;
		Tnode224809* LOC13;
		Tsym224841* iter;
		Tnode224809* LOC16;
		Tsym224841* LOC17;
		Tnode224809* v;
		Tnode224809* LOC18;
		Tsym224841* LOC19;
		Tnode224809* LOC20;
		Tnode224809* LOC21;
		LOC10 = 0;
		LOC11 = 0;
		LOC11 = HEX5BHEX5D_225244(call, ((NI) 0));
		LOC10 = ((*LOC11).kind == ((NU8) 3));
		if (!(LOC10)) goto LA12;
		LOC13 = 0;
		LOC13 = HEX5BHEX5D_225244(call, ((NI) 0));
		LOC10 = ((*(*LOC13).kindU.S4.sym).kind == ((NU8) 15));
		LA12: ;
		if (!LOC10) goto LA14;
		LOC16 = 0;
		LOC16 = HEX5BHEX5D_225244(call, ((NI) 0));
		iter = (*LOC16).kindU.S4.sym;
		LOC17 = 0;
		LOC17 = gethiddenparam_405407(iter);
		env = copysym_227607(LOC17, NIM_FALSE);
		v = newnodei_226351(((NU8) 99), (*body).info);
		LOC18 = 0;
		LOC18 = newsymnode_226325(env);
		addvar_401047(v, LOC18);
		add_225165(result, v);
		LOC19 = 0;
		LOC19 = getsyssym_273077(((NimStringDesc*) &TMP3409));
		LOC20 = 0;
		LOC20 = newsymnode_226325(env);
		LOC21 = 0;
		LOC21 = newcall_406272(LOC19, LOC20);
		add_225165(result, LOC21);
	}
	LA14: ;
	loopbody = newnodei_226407(((NU8) 115), (*body).info, ((NI) 3));
	whileloop = newnodei_226407(((NU8) 96), (*body).info, ((NI) 2));
	LOC22 = 0;
	LOC22 = getsystype_273190(((NU8) 1));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.sons->data[((NI) 0)]), newinttypenode_225619(((NU8) 6), IL64(1), LOC22));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.sons->data[((NI) 1)]), loopbody);
	add_225165(result, whileloop);
	v2 = newnodei_226351(((NU8) 100), (*body).info);
	LOC23 = 0;
	{
		if (!(L == ((NI) 3))) goto LA26;
		LOC23 = ((NU8) 35);
	}
	goto LA24;
	LA26: ;
	{
		LOC23 = ((NU8) 36);
	}
	LA24: ;
	vpart = newnodei_226351(LOC23, (*body).info);
	{
		NI i_411622;
		NI HEX3Atmp_411823;
		NI res_411826;
		i_411622 = 0;
		HEX3Atmp_411823 = 0;
		HEX3Atmp_411823 = (NI)(L - ((NI) 3));
		res_411826 = ((NI) 0);
		{
			while (1) {
				Tnode224809* LOC32;
				Tnode224809* LOC33;
				if (!(res_411826 <= HEX3Atmp_411823)) goto LA31;
				i_411622 = res_411826;
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_225244(body, i_411622);
				(*(*LOC32).kindU.S4.sym).kind = ((NU8) 9);
				LOC33 = 0;
				LOC33 = HEX5BHEX5D_225244(body, i_411622);
				addson_226819(vpart, LOC33);
				res_411826 += ((NI) 1);
			} LA31: ;
		}
	}
	addson_226819(vpart, emptynode_225807);
	{
		Tnode224809* LOC38;
		if (!!(env == 0)) goto LA36;
		LOC38 = 0;
		LOC38 = newsymnode_226325(env);
		asgnRefNoCycle((void**) (&(*call).kindU.S6.sons->data[((NI) 0)]), makeclosure_407034((*(*call).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym, LOC38, (*body).info));
	}
	LA36: ;
	addson_226819(vpart, call);
	addson_226819(v2, vpart);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.sons->data[((NI) 0)]), v2);
	bs = newnodei_226351(((NU8) 158), (*body).info);
	addson_226819(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_225244(body, (NI)(L - ((NI) 1))));
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP3448)(void* p, NI op) {
	Tenv405020* a;
	a = (Tenv405020*)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) {
	Toutercontext405022* a;
	a = (Toutercontext405022*)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(Toutercontext405022*, newoutercontext_406029)(Tsym224841* fn) {
	Toutercontext405022* result;
	result = 0;
	result = (Toutercontext405022*) newObj((&NTI405014), sizeof(Toutercontext405022));
	asgnRefNoCycle((void**) (&(*result).fn), fn);
	initintset_221927((&(*result).capturedvars));
	initintset_221927((&(*result).processed));
	initidnodetable_228127((&(*result).localstoaccess));
	initidtable_228057((&(*result).lambdastoenv));
	return result;
}

N_NIMCALL(Tnode224809*, closurecreationpoint_407312)(Tnode224809* n) {
	Tnode224809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC6;
		Tnode224809* LOC8;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*n).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC6 = 0;
		LOC6 = len_225098(n);
		LOC4 = (((NI) 1) <= LOC6);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA7;
		LOC8 = 0;
		LOC8 = HEX5BHEX5D_225244(n, ((NI) 0));
		LOC3 = ((*LOC8).kind == ((NU8) 1));
		LA7: ;
		if (!LOC3) goto LA9;
		result = n;
	}
	goto LA1;
	LA9: ;
	{
		result = newnodei_226351(((NU8) 115), (*n).info);
		add_225165(result, emptynode_225807);
		add_225165(result, n);
	}
	LA1: ;
	return result;
}

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

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

static N_INLINE(void, rtladdcycleroot_53423)(Cell48947* 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)(Cell48947* c) {
	(*c).refcount = (NI)((NU64)((*c).refcount) + (NU64)(((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)(Cell48947* c) {
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU64)((*c).refcount) < (NU64)(((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) {
	{
		Cell48947* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_52646(src);
		incref_55022(LOC5);
	}
	LA3: ;
	{
		Cell48947* 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(Tsym224841*, getenvparam_405607)(Tsym224841* routine) {
	Tsym224841* result;
	Tnode224809* params;
	Tnode224809* hidden;
	result = 0;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	hidden = lastson_227406(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(Ttype224847*, getstatetype_405049)(Tsym224841* iter) {
	Ttype224847* result;
	Tnode224809* n;
	Tnode224809* LOC1;
	Tnode224809* LOC2;
	Ttype224847* inttype;
	result = 0;
	n = newnodei_226351(((NU8) 44), (*iter).info);
	LOC1 = 0;
	LOC1 = newintnode_225607(((NU8) 6), IL64(-1));
	addson_226819(n, LOC1);
	LOC2 = 0;
	LOC2 = newintnode_225607(((NU8) 6), IL64(0));
	addson_226819(n, LOC2);
	result = newtype_227140(((NU8) 20), iter);
	asgnRefNoCycle((void**) (&(*result).n), n);
	inttype = nilorsysint_273036();
	{
		if (!inttype == 0) goto LA5;
		inttype = newtype_227140(((NU8) 31), iter);
	}
	LA5: ;
	rawaddson_228498(result, inttype);
	return result;
}

N_NIMCALL(Tsym224841*, createstatefield_405070)(Tsym224841* iter) {
	Tsym224841* result;
	Tident197021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_197463(((NimStringDesc*) &TMP3451));
	result = newsym_225655(((NU8) 19), LOC1, iter, (*iter).info);
	asgnRefNoCycle((void**) (&(*result).typ), getstatetype_405049(iter));
	return result;
}

N_NIMCALL(Ttype224847*, createenvobj_405082)(Tsym224841* owner) {
	Ttype224847* result;
	Tsym224841* LOC1;
	result = 0;
	result = createobj_401372(owner, (*owner).info);
	LOC1 = 0;
	LOC1 = createstatefield_405070(owner);
	rawaddfield_401393(result, LOC1);
	return result;
}

N_NIMCALL(Tenv405020*, newenv_406049)(Toutercontext405022* o, Tenv405020* up, Tnode224809* n, Tsym224841* owner) {
	Tenv405020* result;
	result = 0;
	result = (Tenv405020*) newObj((&NTI405018), sizeof(Tenv405020));
	(*result).Sup.m_type = (&NTI405020);
	if ((*result).capturedvars) nimGCunrefNoCycle((*result).capturedvars);
	(*result).capturedvars = (Tsymseq224811*) newSeqRC1((&NTI224811), 0);
	asgnRef((void**) (&(*result).up), up);
	asgnRefNoCycle((void**) (&(*result).attachednode), n);
	asgnRefNoCycle((void**) (&(*result).fn), owner);
	initintset_221927((&(*result).vars));
	asgnRef((void**) (&(*result).next), (*o).head);
	asgnRef((void**) (&(*o).head), result);
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		Tsym224841* 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_405607(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_405082(owner));
	}
	LA15: ;
	return result;
}

N_NIMCALL(void, addparamstoenv_407343)(Tsym224841* fn, Tenv405020* env) {
	Tnode224809* params;
	Tnode224809* ast;
	params = (*(*fn).typ).n;
	{
		NI i_407368;
		NI HEX3Atmp_407401;
		NI LOC2;
		NI res_407404;
		i_407368 = 0;
		HEX3Atmp_407401 = 0;
		LOC2 = 0;
		LOC2 = len_225098(params);
		HEX3Atmp_407401 = (LOC2 - 1);
		res_407404 = ((NI) 1);
		{
			while (1) {
				Tsym224841* param;
				if (!(res_407404 <= HEX3Atmp_407401)) goto LA4;
				i_407368 = res_407404;
				{
					if (!!(((*(*params).kindU.S6.sons->data[i_407368]).kind == ((NU8) 3)))) goto LA7;
					internalerror_195172((*params).info, ((NimStringDesc*) &TMP3452));
				}
				LA7: ;
				param = (*(*params).kindU.S6.sons->data[i_407368]).kindU.S4.sym;
				incl_221856((&(*env).vars), (*param).Sup.id);
				res_407404 += ((NI) 1);
			} LA4: ;
		}
	}
	ast = (*fn).ast;
	{
		NIM_BOOL LOC11;
		NI LOC12;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = sonslen_227387(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_221856((&(*env).vars), (*(*(*ast).kindU.S6.sons->data[((NI) 7)]).kindU.S4.sym).Sup.id);
	}
	LA14: ;
}

N_NIMCALL(NIM_BOOL, isinnerproc_406286)(Tsym224841* s, Tsym224841* outerproc) {
	NIM_BOOL result;
{	result = 0;
	{
		Tsym224841* owner;
		if (!((110592 &(1<<(((*s).kind)&31)))!=0)) goto LA3;
		owner = skipgenericowner_229695(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_406375)(Tsym224841* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	Ttype224847* LOC2;
	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = skiptypes_228167((*s).typ, IL64(211106232576256));
	LOC1 = ((IL64(281475119316992) &(IL64(1)<<(((*LOC2).kind)&IL64(63))))!=0);
	if (LOC1) goto LA3;
	LOC1 = ((*s).kind == ((NU8) 11));
	LA3: ;
	result = LOC1;
	return result;
}

N_NIMCALL(Tsym224841*, createupfield_406621)(Ttype224847* obj, Ttype224847* fieldtype) {
	Tsym224841* result;
	NI pos;
	Tident197021* LOC1;
	result = 0;
	pos = len_225098((*obj).n);
	LOC1 = 0;
	LOC1 = getident_197463(((NimStringDesc*) &TMP3453));
	result = newsym_225655(((NU8) 19), LOC1, (*obj).owner, (*(*obj).owner).info);
	asgnRefNoCycle((void**) (&(*result).typ), newtype_227140(((NU8) 22), (*obj).owner));
	(*result).position = pos;
	rawaddson_228498((*result).typ, fieldtype);
	addfield_401809(obj, result);
	return result;
}

N_NIMCALL(void, addhiddenparam_405124)(Tsym224841* routine, Tsym224841* param) {
	Tnode224809* params;
	NI LOC1;
	Tnode224809* LOC2;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	LOC1 = 0;
	LOC1 = len_225098((*(*routine).typ).n);
	(*param).position = (NI)(LOC1 - ((NI) 1));
	LOC2 = 0;
	LOC2 = newsymnode_226325(param);
	addson_226819(params, LOC2);
	(*(*routine).typ).flags |= ((NU32)1)<<((((NU8) 11))%(sizeof(NU32)*8));
}

N_NIMCALL(void, addclosureparam_406338)(Tsym224841* fn, Tenv405020* e) {
	Tsym224841* cp;
	cp = getenvparam_405607(fn);
	{
		Tident197021* LOC5;
		if (!(cp == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = getident_197463(((NimStringDesc*) &TMP3450));
		cp = newsym_225655(((NU8) 3), LOC5, fn, (*fn).info);
		(*cp).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
		asgnRefNoCycle((void**) (&(*cp).typ), newtype_227140(((NU8) 22), fn));
		rawaddson_228498((*cp).typ, (*e).obj);
		addhiddenparam_405124(fn, cp);
	}
	LA3: ;
}

N_NIMCALL(void, addcapturedvar_406215)(Tenv405020* e, Tsym224841* v) {
{	{
		Tsym224841* x_406228;
		Tsymseq224811* HEX3Atmp_406251;
		NI i_406254;
		NI L_406256;
		x_406228 = 0;
		HEX3Atmp_406251 = 0;
		HEX3Atmp_406251 = (*e).capturedvars;
		i_406254 = ((NI) 0);
		L_406256 = (HEX3Atmp_406251 ? HEX3Atmp_406251->Sup.len : 0);
		{
			while (1) {
				if (!(i_406254 < L_406256)) goto LA3;
				x_406228 = HEX3Atmp_406251->data[i_406254];
				{
					if (!(x_406228 == v)) goto LA6;
					goto BeforeRet;
				}
				LA6: ;
				i_406254 += ((NI) 1);
			} LA3: ;
		}
	}
	(*e).capturedvars = (Tsymseq224811*) incrSeqV2(&((*e).capturedvars)->Sup, sizeof(Tsym224841*));
	asgnRefNoCycle((void**) (&(*e).capturedvars->data[(*e).capturedvars->Sup.len]), v);
	++(*e).capturedvars->Sup.len;
	addfield_401809((*e).obj, v);
	}BeforeRet: ;
}

N_NIMCALL(NIM_BOOL, capturevar_406638)(Toutercontext405022* o, Tenv405020* top, Tsym224841* local, Tlineinfo189352 info) {
	NIM_BOOL result;
	Tenv405020* it;
{	result = 0;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				LOC5 = 0;
				LOC5 = contains_221829((&(*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_406375(local);
		if (LOC14) goto LA15;
		LOC14 = !(((257 &(1<<(((*(*(*top).fn).typ).callconv)&15)))!=0));
		LA15: ;
		if (!LOC14) goto LA16;
		localerror_195128(info, ((NU16) 227), (*(*local).name).s);
	}
	LA16: ;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA19;
			{
				NIM_BOOL LOC22;
				LOC22 = 0;
				LOC22 = contains_221829((&(*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_406621((*it).obj, (*(*it).up).obj));
			}
			LA31: ;
			{
				Tenv405020* 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_406338((*it).fn, u);
				{
					Tidobj197015* LOC43;
					TNimObject* LOC44;
					LOC43 = 0;
					LOC43 = &(*it).fn->Sup;
					LOC44 = 0;
					LOC44 = idtableget_232182((*o).lambdastoenv, LOC43);
					if (!(LOC44 == NIM_NIL)) goto LA45;
					{
						Tidobj197015* LOC51;
						TNimObject* LOC52;
						if (!!((u == NIM_NIL))) goto LA49;
						LOC51 = 0;
						LOC51 = &(*it).fn->Sup;
						LOC52 = 0;
						LOC52 = &u->Sup;
						idtableput_232196((&(*o).lambdastoenv), LOC51, LOC52);
					}
					LA49: ;
				}
				LA45: ;
			}
			LA35: ;
			it = (*it).up;
		} LA19: ;
	} LA18: ;
	incl_221856((&(*o).capturedvars), (*local).Sup.id);
	addcapturedvar_406215(it, local);
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI, gathervars_406870)(Toutercontext405022* o, Tenv405020* e, Tnode224809* n) {
	NI result;
{	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = ((NI) 0);
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		Tsym224841* s;
		s = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = interestingvar_406406(s);
			if (!(LOC8)) goto LA9;
			LOC8 = !(((*e).fn == (*s).owner));
			LA9: ;
			if (!LOC8) goto LA10;
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = capturevar_406638(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_406934;
			NI HEX3Atmp_406946;
			NI LOC20;
			NI res_406949;
			k_406934 = 0;
			HEX3Atmp_406946 = 0;
			LOC20 = 0;
			LOC20 = sonslen_227387(n);
			HEX3Atmp_406946 = (NI)(LOC20 - ((NI) 1));
			res_406949 = ((NI) 0);
			{
				while (1) {
					NI LOC23;
					if (!(res_406949 <= HEX3Atmp_406946)) goto LA22;
					k_406934 = res_406949;
					LOC23 = 0;
					LOC23 = gathervars_406870(o, e, (*n).kindU.S6.sons->data[k_406934]);
					result += LOC23;
					res_406949 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym224841*, newiterresult_405093)(Tsym224841* iter) {
	Tsym224841* result;
	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_225098((*iter).ast);
		if (!(((NI) 7) < LOC3)) goto LA4;
		result = (*(*(*iter).ast).kindU.S6.sons->data[((NI) 7)]).kindU.S4.sym;
	}
	goto LA1;
	LA4: ;
	{
		Tident197021* LOC7;
		Tnode224809* LOC8;
		LOC7 = 0;
		LOC7 = getident_197463(((NimStringDesc*) &TMP3456));
		result = newsym_225655(((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_226325(result);
		add_225165((*iter).ast, LOC8);
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, inititer_405807)(Tsym224841* iter, Titer405016* Result) {
	unsureAsgnRef((void**) (&(*Result).fn), iter);
	{
		Tsym224841* cp;
		Tnode224809* LOC17;
		if (!((*iter).kind == ((NU8) 15))) goto LA3;
		cp = getenvparam_405607(iter);
		{
			Tident197021* LOC9;
			if (!(cp == NIM_NIL)) goto LA7;
			unsureAsgnRef((void**) (&(*Result).obj), createenvobj_405082(iter));
			LOC9 = 0;
			LOC9 = getident_197463(((NimStringDesc*) &TMP3450));
			cp = newsym_225655(((NU8) 3), LOC9, iter, (*iter).info);
			(*cp).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
			asgnRefNoCycle((void**) (&(*cp).typ), newtype_227140(((NU8) 22), iter));
			rawaddson_228498((*cp).typ, (*Result).obj);
			addhiddenparam_405124(iter, cp);
		}
		goto LA5;
		LA7: ;
		{
			unsureAsgnRef((void**) (&(*Result).obj), (*(*cp).typ).sons->data[((NI) 0)]);
		}
		LA5: ;
		{
			NI LOC13;
			NimStringDesc* LOC16;
			LOC13 = 0;
			LOC13 = len_225098((*(*Result).obj).n);
			if (!!((((NI) 0) < LOC13))) goto LA14;
			LOC16 = 0;
			LOC16 = HEX24_195279(TMP3455);
			internalerror_195191(LOC16);
		}
		LA14: ;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_225244((*(*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_405093(iter));
		}
		LA20: ;
	}
	LA3: ;
}

N_NIMCALL(Tnode224809*, newclosurecreationvar_407062)(Tenv405020* e) {
	Tnode224809* result;
	Tsym224841* v;
	Tident197021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_197463(((NimStringDesc*) &TMP3454));
	v = newsym_225655(((NU8) 8), LOC1, (*e).fn, (*(*e).attachednode).info);
	(*v).flags |= ((NU32)1)<<((((NU8) 21))%(sizeof(NU32)*8));
	asgnRefNoCycle((void**) (&(*v).typ), newtype_227140(((NU8) 22), (*e).fn));
	rawaddson_228498((*v).typ, (*e).obj);
	{
		Titer405016 it;
		Tnode224809* 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_405807((*e).fn, (&it));
		adduniquefield_402008(it.obj, v);
		LOC6 = 0;
		LOC6 = newsymnode_226325(it.closureparam);
		result = indirectaccess_403038(LOC6, v, (*v).info);
	}
	goto LA2;
	LA4: ;
	{
		result = newsymnode_226325(v);
	}
	LA2: ;
	return result;
}

N_NIMCALL(Tnode224809*, getclosurevar_407097)(Tenv405020* e) {
	Tnode224809* result;
	result = 0;
	{
		if (!((*e).createdvar == NIM_NIL)) goto LA3;
		result = newclosurecreationvar_407062(e);
		asgnRefNoCycle((void**) (&(*e).createdvar), result);
	}
	goto LA1;
	LA3: ;
	{
		result = (*e).createdvar;
	}
	LA1: ;
	return result;
}

N_NIMCALL(Tenv405020*, findenv_407119)(Toutercontext405022* o, Tsym224841* s) {
	Tenv405020* result;
	Tenv405020* 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_195279(TMP3459);
		internalerror_195191(LOC13);
	}
	LA11: ;
	result = (*env).up;
	{
		while (1) {
			if (!((*result).fn == s)) goto LA15;
			result = (*result).up;
		} LA15: ;
	}
	return result;
}

N_NIMCALL(Tnode224809*, nestedaccess_406438)(Tenv405020* top, Tsym224841* local) {
	Tnode224809* result;
	Tenv405020* it;
	Tsym224841* envparam;
	Tnode224809* access;
{	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_406406(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_221829((&(*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_405607((*top).fn);
	{
		NimStringDesc* LOC23;
		if (!!(!(envparam == 0))) goto LA21;
		LOC23 = 0;
		LOC23 = HEX24_195279(TMP3460);
		internalerror_195191(LOC23);
	}
	LA21: ;
	access = newsymnode_226325(envparam);
	it = (*top).up;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA25;
			{
				NIM_BOOL LOC28;
				LOC28 = 0;
				LOC28 = contains_221829((&(*it).vars), (*local).Sup.id);
				if (!LOC28) goto LA29;
				access = indirectaccess_403038(access, local, (*local).info);
				result = access;
				goto BeforeRet;
			}
			LA29: ;
			{
				NimStringDesc* LOC35;
				if (!!(!(((*it).upfield == NIM_NIL)))) goto LA33;
				LOC35 = 0;
				LOC35 = HEX24_195279(TMP3461);
				internalerror_195191(LOC35);
			}
			LA33: ;
			access = indirectaccess_403038(access, (*it).upfield, (*local).info);
			it = (*it).up;
		} LA25: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode224809*, transforminnerproc_407210)(Toutercontext405022* o, Tenv405020* e, Tnode224809* n) {
	Tnode224809* result;
	result = 0;
	switch ((*n).kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		Tsym224841* s;
		s = (*n).kindU.S4.sym;
		{
			Tsym224841* LOC7;
			Tnode224809* LOC8;
			if (!(s == (*e).fn)) goto LA5;
			LOC7 = 0;
			LOC7 = getenvparam_405607(s);
			LOC8 = 0;
			LOC8 = newsymnode_226325(LOC7);
			result = makeclosure_407034(s, LOC8, (*n).info);
		}
		goto LA3;
		LA5: ;
		{
			NIM_BOOL LOC10;
			Tenv405020* LOC14;
			Tnode224809* LOC15;
			LOC10 = 0;
			LOC10 = isinnerproc_406286(s, (*o).fn);
			if (!(LOC10)) goto LA11;
			LOC10 = ((*(*s).typ).callconv == ((NU8) 8));
			LA11: ;
			if (!LOC10) goto LA12;
			LOC14 = 0;
			LOC14 = findenv_407119(o, s);
			LOC15 = 0;
			LOC15 = getclosurevar_407097(LOC14);
			result = makeclosure_407034(s, LOC15, (*n).info);
		}
		goto LA3;
		LA12: ;
		{
			result = nestedaccess_406438(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_407273;
			NI HEX3Atmp_407290;
			NI LOC20;
			NI res_407293;
			j_407273 = 0;
			HEX3Atmp_407290 = 0;
			LOC20 = 0;
			LOC20 = sonslen_227387(n);
			HEX3Atmp_407290 = (NI)(LOC20 - ((NI) 1));
			res_407293 = ((NI) 0);
			{
				while (1) {
					Tnode224809* x;
					if (!(res_407293 <= HEX3Atmp_407290)) goto LA22;
					j_407273 = res_407293;
					x = transforminnerproc_407210(o, e, (*n).kindU.S6.sons->data[j_407273]);
					{
						if (!!((x == NIM_NIL))) goto LA25;
						asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[j_407273]), x);
					}
					LA25: ;
					res_407293 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	}
	return result;
}

N_NIMCALL(void, searchforinnerprocs_407423)(Toutercontext405022* o, Tnode224809* n, Tenv405020* 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):
	{
		Tsym224841* fn;
		fn = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC9;
			NIM_BOOL LOC11;
			Tnode224809* body;
			Tnode224809* ex;
			Tenv405020* envb;
			NI capturedcounter;
			LOC9 = 0;
			LOC9 = isinnerproc_406286(fn, (*o).fn);
			if (!(LOC9)) goto LA10;
			LOC11 = 0;
			LOC11 = containsorincl_221898((&(*o).processed), (*fn).Sup.id);
			LOC9 = !(LOC11);
			LA10: ;
			if (!LOC9) goto LA12;
			body = getbody_270061(fn);
			ex = closurecreationpoint_407312(body);
			envb = newenv_406049(o, env, ex, fn);
			addparamstoenv_407343(fn, envb);
			searchforinnerprocs_407423(o, body, envb);
			asgnRefNoCycle((void**) (&(*(*fn).ast).kindU.S6.sons->data[((NI) 6)]), ex);
			capturedcounter = gathervars_406870(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;
				{
					Tidobj197015* LOC22;
					TNimObject* LOC23;
					Tidobj197015* LOC26;
					TNimObject* LOC27;
					LOC22 = 0;
					LOC22 = &fn->Sup;
					LOC23 = 0;
					LOC23 = idtableget_232182((*o).lambdastoenv, LOC22);
					if (!(LOC23 == NIM_NIL)) goto LA24;
					LOC26 = 0;
					LOC26 = &fn->Sup;
					LOC27 = 0;
					LOC27 = &env->Sup;
					idtableput_232196((&(*o).lambdastoenv), LOC26, LOC27);
				}
				LA24: ;
				addclosureparam_406338(fn, env);
			}
			goto LA14;
			LA18: ;
			{
				Tsym224841* LOC29;
				Tnode224809* ti;
				LOC29 = 0;
				LOC29 = getenvparam_405607(fn);
				if (!!((LOC29 == NIM_NIL))) goto LA30;
				ti = transforminnerproc_407210(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_407423(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;
			Tnode224809* ex;
			Tenv405020* LOC50;
			if (!!(((*(*env).fn).kind == ((NU8) 15)))) goto LA44;
			LOC46 = 0;
			LOC46 = len_225098(n);
			body = (NI)(LOC46 - ((NI) 1));
			{
				NI i_407558;
				NI HEX3Atmp_407681;
				NI res_407684;
				i_407558 = 0;
				HEX3Atmp_407681 = 0;
				HEX3Atmp_407681 = (NI)(body - ((NI) 1));
				res_407684 = ((NI) 0);
				{
					while (1) {
						if (!(res_407684 <= HEX3Atmp_407681)) goto LA49;
						i_407558 = res_407684;
						searchforinnerprocs_407423(o, (*n).kindU.S6.sons->data[i_407558], env);
						res_407684 += ((NI) 1);
					} LA49: ;
				}
			}
			ex = closurecreationpoint_407312((*n).kindU.S6.sons->data[body]);
			LOC50 = 0;
			LOC50 = newenv_406049(o, env, ex, (*env).fn);
			searchforinnerprocs_407423(o, (*n).kindU.S6.sons->data[body], LOC50);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[body]), ex);
		}
		goto LA42;
		LA44: ;
		{
			{
				NI i_407576;
				NI HEX3Atmp_407689;
				NI LOC53;
				NI res_407692;
				i_407576 = 0;
				HEX3Atmp_407689 = 0;
				LOC53 = 0;
				LOC53 = sonslen_227387(n);
				HEX3Atmp_407689 = (NI)(LOC53 - ((NI) 1));
				res_407692 = ((NI) 0);
				{
					while (1) {
						if (!(res_407692 <= HEX3Atmp_407689)) goto LA55;
						i_407576 = res_407692;
						searchforinnerprocs_407423(o, (*n).kindU.S6.sons->data[i_407576], env);
						res_407692 += ((NI) 1);
					} LA55: ;
				}
			}
		}
		LA42: ;
	}
	break;
	case ((NU8) 99):
	case ((NU8) 100):
	{
		{
			NI i_407590;
			NI HEX3Atmp_407705;
			NI LOC58;
			NI res_407708;
			i_407590 = 0;
			HEX3Atmp_407705 = 0;
			LOC58 = 0;
			LOC58 = sonslen_227387(n);
			HEX3Atmp_407705 = (NI)(LOC58 - ((NI) 1));
			res_407708 = ((NI) 0);
			{
				while (1) {
					Tnode224809* it;
					if (!(res_407708 <= HEX3Atmp_407705)) goto LA60;
					i_407590 = res_407708;
					it = (*n).kindU.S6.sons->data[i_407590];
					{
						if (!((*it).kind == ((NU8) 125))) goto LA63;
					}
					goto LA61;
					LA63: ;
					{
						NI L;
						if (!((*it).kind == ((NU8) 35))) goto LA66;
						L = sonslen_227387(it);
						{
							if (!((*(*it).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 3))) goto LA70;
							incl_221856((&(*env).vars), (*(*(*it).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym).Sup.id);
						}
						LA70: ;
						searchforinnerprocs_407423(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_227387(it);
						{
							NI j_407649;
							NI HEX3Atmp_407698;
							NI res_407701;
							j_407649 = 0;
							HEX3Atmp_407698 = 0;
							HEX3Atmp_407698 = (NI)(L - ((NI) 3));
							res_407701 = ((NI) 0);
							{
								while (1) {
									if (!(res_407701 <= HEX3Atmp_407698)) goto LA77;
									j_407649 = res_407701;
									{
										if (!((*(*it).kindU.S6.sons->data[j_407649]).kind == ((NU8) 3))) goto LA80;
										incl_221856((&(*env).vars), (*(*(*it).kindU.S6.sons->data[j_407649]).kindU.S4.sym).Sup.id);
									}
									LA80: ;
									res_407701 += ((NI) 1);
								} LA77: ;
							}
						}
						searchforinnerprocs_407423(o, (*it).kindU.S6.sons->data[(NI)(L - ((NI) 1))], env);
					}
					goto LA61;
					LA73: ;
					{
						internalerror_195172((*it).info, ((NimStringDesc*) &TMP3462));
					}
					LA61: ;
					res_407708 += ((NI) 1);
				} LA60: ;
			}
		}
	}
	break;
	case ((NU8) 155):
	{
		searchforinnerprocs_407423(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_407678;
			NI HEX3Atmp_407713;
			NI LOC87;
			NI res_407716;
			i_407678 = 0;
			HEX3Atmp_407713 = 0;
			LOC87 = 0;
			LOC87 = sonslen_227387(n);
			HEX3Atmp_407713 = (NI)(LOC87 - ((NI) 1));
			res_407716 = ((NI) 0);
			{
				while (1) {
					if (!(res_407716 <= HEX3Atmp_407713)) goto LA89;
					i_407678 = res_407716;
					searchforinnerprocs_407423(o, (*n).kindU.S6.sons->data[i_407678], env);
					res_407716 += ((NI) 1);
				} LA89: ;
			}
		}
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(Tnode224809*, newasgnstmt_407771)(Tnode224809* le, Tnode224809* ri, Tlineinfo189352 info) {
	Tnode224809* result;
	result = 0;
	result = newnodei_226407(((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(Tnode224809*, rawclosurecreation_407785)(Toutercontext405022* o, Tenv405020* scope, Tnode224809* env) {
	Tnode224809* result;
	Tsym224841* LOC5;
	Tnode224809* LOC6;
	result = 0;
	result = newnodei_226351(((NU8) 115), (*env).info);
	{
		Tnode224809* v;
		if (!((*env).kind == ((NU8) 3))) goto LA3;
		v = newnodei_226351(((NU8) 99), (*env).info);
		addvar_401047(v, env);
		add_225165(result, v);
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = getsyssym_273077(((NimStringDesc*) &TMP3409));
	LOC6 = 0;
	LOC6 = newcall_406272(LOC5, env);
	add_225165(result, LOC6);
	{
		Tsym224841* local_407812;
		Tsymseq224811* HEX3Atmp_407862;
		NI i_407865;
		NI L_407867;
		local_407812 = 0;
		HEX3Atmp_407862 = 0;
		HEX3Atmp_407862 = (*scope).capturedvars;
		i_407865 = ((NI) 0);
		L_407867 = (HEX3Atmp_407862 ? HEX3Atmp_407862->Sup.len : 0);
		{
			while (1) {
				Tnode224809* fieldaccess;
				Tnode224809* existing;
				Tidobj197015* LOC16;
				if (!(i_407865 < L_407867)) goto LA9;
				local_407812 = HEX3Atmp_407862->data[i_407865];
				fieldaccess = indirectaccess_403038(env, local_407812, (*env).info);
				{
					Tnode224809* LOC14;
					Tnode224809* LOC15;
					if (!((*local_407812).kind == ((NU8) 3))) goto LA12;
					LOC14 = 0;
					LOC14 = newsymnode_226325(local_407812);
					LOC15 = 0;
					LOC15 = newasgnstmt_407771(fieldaccess, LOC14, (*env).info);
					add_225165(result, LOC15);
				}
				LA12: ;
				LOC16 = 0;
				LOC16 = &local_407812->Sup;
				existing = idnodetableget_232212((*o).localstoaccess, LOC16);
				{
					Tidobj197015* LOC21;
					if (!existing == 0) goto LA19;
					LOC21 = 0;
					LOC21 = &local_407812->Sup;
					idnodetableput_232219((&(*o).localstoaccess), LOC21, fieldaccess);
				}
				goto LA17;
				LA19: ;
				{
					Tnode224809* LOC23;
					LOC23 = 0;
					LOC23 = newasgnstmt_407771(fieldaccess, existing, (*env).info);
					add_225165(result, LOC23);
				}
				LA17: ;
				i_407865 += ((NI) 1);
			} LA9: ;
		}
	}
	{
		if (!!(((*scope).upfield == NIM_NIL))) goto LA26;
		{
			Tnode224809* LOC32;
			Tsym224841* LOC33;
			Tnode224809* LOC34;
			Tnode224809* LOC35;
			if (!!(((*(*scope).up).fn == (*scope).fn))) goto LA30;
			LOC32 = 0;
			LOC32 = indirectaccess_403038(env, (*scope).upfield, (*env).info);
			LOC33 = 0;
			LOC33 = getenvparam_405607((*scope).fn);
			LOC34 = 0;
			LOC34 = newsymnode_226325(LOC33);
			LOC35 = 0;
			LOC35 = newasgnstmt_407771(LOC32, LOC34, (*env).info);
			add_225165(result, LOC35);
		}
		goto LA28;
		LA30: ;
		{
			Tnode224809* LOC37;
			Tnode224809* LOC38;
			Tnode224809* LOC39;
			LOC37 = 0;
			LOC37 = indirectaccess_403038(env, (*scope).upfield, (*env).info);
			LOC38 = 0;
			LOC38 = getclosurevar_407097((*scope).up);
			LOC39 = 0;
			LOC39 = newasgnstmt_407771(LOC37, LOC38, (*env).info);
			add_225165(result, LOC39);
		}
		LA28: ;
	}
	LA26: ;
	return result;
}

N_NIMCALL(Tnode224809*, generateclosurecreation_407883)(Toutercontext405022* o, Tenv405020* scope) {
	Tnode224809* result;
	Tnode224809* env;
	result = 0;
	env = getclosurevar_407097(scope);
	result = rawclosurecreation_407785(o, scope, env);
	return result;
}

N_NIMCALL(void, createenvironments_409010)(Toutercontext405022* o) {
	Tenv405020* env;
	env = (*o).head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				Tnode224809* 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_407883(o, env));
				}
				LA11: ;
			}
			LA7: ;
			env = (*env).next;
		} LA2: ;
	}
}

static N_INLINE(NIM_BOOL, interestingitervar_408044)(Tsym224841* 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(Tnode224809*, liftitersym_408731)(Tnode224809* n, Tsym224841* owner) {
	Tnode224809* result;
	Tsym224841* iter;
	Tsym224841* hp;
	Tsym224841* env;
	Tnode224809* v;
	Tnode224809* LOC1;
	Tnode224809* envasnode;
	Tsym224841* LOC2;
	Tnode224809* LOC3;
	Tnode224809* LOC4;
	result = 0;
	iter = (*n).kindU.S4.sym;
	result = newnodeit_226807(((NU8) 126), (*n).info, (*n).typ);
	hp = gethiddenparam_405407(iter);
	env = newsym_225655(((NU8) 9), (*iter).name, owner, (*n).info);
	asgnRefNoCycle((void**) (&(*env).typ), (*hp).typ);
	(*env).flags = (*hp).flags;
	v = newnodei_226351(((NU8) 99), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_226325(env);
	addvar_401047(v, LOC1);
	add_225165(result, v);
	envasnode = newsymnode_226325(env);
	LOC2 = 0;
	LOC2 = getsyssym_273077(((NimStringDesc*) &TMP3409));
	LOC3 = 0;
	LOC3 = newcall_406272(LOC2, envasnode);
	add_225165(result, LOC3);
	LOC4 = 0;
	LOC4 = makeclosure_407034(iter, envasnode, (*n).info);
	add_225165(result, LOC4);
	return result;
}

N_NIMCALL(Tnode224809*, generateiterclosurecreation_407895)(Toutercontext405022* o, Tenv405020* env, Tnode224809* scope) {
	Tnode224809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode224809* cc;
		Tnode224809* insertpoint;
		LOC3 = 0;
		LOC3 = (*env).createdvarcomesfromiter;
		if (LOC3) goto LA4;
		LOC3 = (*env).createdvar == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = newclosurecreationvar_407062(env);
		cc = rawclosurecreation_407785(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: ;
		{
			{
				Tnode224809* x_408001;
				x_408001 = 0;
				{
					NI i_408019;
					NI HEX3Atmp_408021;
					NI LOC14;
					NI res_408023;
					i_408019 = 0;
					HEX3Atmp_408021 = 0;
					LOC14 = 0;
					LOC14 = len_225098(cc);
					HEX3Atmp_408021 = (LOC14 - 1);
					res_408023 = ((NI) 0);
					{
						while (1) {
							if (!(res_408023 <= HEX3Atmp_408021)) goto LA16;
							i_408019 = res_408023;
							x_408001 = (*cc).kindU.S6.sons->data[i_408019];
							add_225165(insertpoint, x_408001);
							res_408023 += ((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(Tnode224809*, generatethunk_406968)(Tnode224809* prc, Ttype224847* dest) {
	Tnode224809* result;
	Tnode224809* conv;
	Ttype224847* LOC5;
	Tnode224809* LOC6;
{	result = 0;
	{
		if (!(gcmd_166134 == ((NU8) 4))) goto LA3;
		result = prc;
		goto BeforeRet;
	}
	LA3: ;
	result = newnodeit_226807(((NU8) 155), (*prc).info, dest);
	conv = newnodeit_226807(((NU8) 58), (*prc).info, dest);
	add_225165(conv, emptynode_225807);
	add_225165(conv, prc);
	add_225165(result, conv);
	LOC5 = 0;
	LOC5 = getsystype_273190(((NU8) 5));
	LOC6 = 0;
	LOC6 = newnodeit_226807(((NU8) 23), (*prc).info, LOC5);
	add_225165(result, LOC6);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode224809*, transformouterconv_406993)(Tnode224809* n) {
	Tnode224809* result;
	Ttype224847* dest;
	Ttype224847* source;
	result = 0;
	dest = skiptypes_228167((*n).typ, IL64(211106242013440));
	source = skiptypes_228167((*(*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_406968((*n).kindU.S6.sons->data[((NI) 1)], dest);
		}
		LA9: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(Tnode224809*, transformyield_408084)(Toutercontext405022* c, Tnode224809* n, Titer405016* it) {
	Tnode224809* result;
	NI64 stateno;
	Tnode224809* stateasgnstmt;
	Tnode224809* LOC1;
	Tnode224809* LOC2;
	Ttype224847* LOC3;
	Tnode224809* LOC4;
	Tnode224809* retstmt;
	Tnode224809* statelabelstmt;
	Ttype224847* LOC17;
	Tnode224809* 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_226351(((NU8) 73), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_226325((*it).closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_401608(LOC1, (*it).state, (*n).info);
	add_225165(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_273190(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_225619(((NU8) 6), stateno, LOC3);
	add_225165(stateasgnstmt, LOC4);
	retstmt = newnodei_226351(((NU8) 109), (*n).info);
	{
		Tnode224809* a;
		Tnode224809* retval;
		Tnode224809* LOC9;
		Tnode224809* LOC10;
		if (!!(((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 1)))) goto LA7;
		a = newnodei_226351(((NU8) 73), (*(*n).kindU.S6.sons->data[((NI) 0)]).info);
		retval = transformouterproc_408076(c, (*n).kindU.S6.sons->data[((NI) 0)], it);
		LOC9 = 0;
		LOC9 = newsymnode_226325((*it).resultsym);
		addson_226819(a, LOC9);
		LOC10 = 0;
		{
			if (!retval == 0) goto LA13;
			LOC10 = (*n).kindU.S6.sons->data[((NI) 0)];
		}
		goto LA11;
		LA13: ;
		{
			LOC10 = retval;
		}
		LA11: ;
		addson_226819(a, LOC10);
		add_225165(retstmt, a);
	}
	goto LA5;
	LA7: ;
	{
		add_225165(retstmt, emptynode_225807);
	}
	LA5: ;
	statelabelstmt = newnodei_226351(((NU8) 157), (*n).info);
	LOC17 = 0;
	LOC17 = getsystype_273190(((NU8) 31));
	LOC18 = 0;
	LOC18 = newinttypenode_225619(((NU8) 6), stateno, LOC17);
	add_225165(statelabelstmt, LOC18);
	result = newnodei_226351(((NU8) 115), (*n).info);
	add_225165(result, stateasgnstmt);
	add_225165(result, retstmt);
	add_225165(result, statelabelstmt);
	return result;
}

N_NIMCALL(void, outerprocsons_408675)(Toutercontext405022* o, Tnode224809* n, Titer405016* it) {
	{
		NI i_408692;
		NI HEX3Atmp_408709;
		NI LOC2;
		NI res_408712;
		i_408692 = 0;
		HEX3Atmp_408709 = 0;
		LOC2 = 0;
		LOC2 = sonslen_227387(n);
		HEX3Atmp_408709 = (NI)(LOC2 - ((NI) 1));
		res_408712 = ((NI) 0);
		{
			while (1) {
				Tnode224809* x;
				if (!(res_408712 <= HEX3Atmp_408709)) goto LA4;
				i_408692 = res_408712;
				x = transformouterproc_408076(o, (*n).kindU.S6.sons->data[i_408692], it);
				{
					if (!!((x == NIM_NIL))) goto LA7;
					asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_408692]), x);
				}
				LA7: ;
				res_408712 += ((NI) 1);
			} LA4: ;
		}
	}
}

N_NIMCALL(Tnode224809*, transformreturn_408658)(Toutercontext405022* c, Tnode224809* n, Titer405016* it) {
	Tnode224809* result;
	Tnode224809* stateasgnstmt;
	Tnode224809* LOC1;
	Tnode224809* LOC2;
	Ttype224847* LOC3;
	Tnode224809* LOC4;
	result = 0;
	result = newnodei_226351(((NU8) 115), (*n).info);
	stateasgnstmt = newnodei_226351(((NU8) 73), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_226325((*it).closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_401608(LOC1, (*it).state, (*n).info);
	add_225165(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_273190(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_225619(((NU8) 6), IL64(-1), LOC3);
	add_225165(stateasgnstmt, LOC4);
	add_225165(result, stateasgnstmt);
	add_225165(result, n);
	return result;
}

N_NIMCALL(Tnode224809*, transformouterproc_408076)(Toutercontext405022* o, Tnode224809* n, Titer405016* it) {
	Tnode224809* 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):
	{
		Tsym224841* local;
		Tenv405020* closure;
		Tidobj197015* LOC65;
		TNimObject* LOC66;
		Tidobj197015* LOC85;
		local = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC11;
			Tnode224809* body;
			Tnode224809* newbody;
			Titer405016 LOC15;
			LOC11 = 0;
			LOC11 = isinnerproc_406286(local, (*o).fn);
			if (!(LOC11)) goto LA12;
			LOC11 = contains_221829((&(*o).processed), (*local).Sup.id);
			LA12: ;
			if (!LOC11) goto LA13;
			excl_221871((&(*o).processed), (*local).Sup.id);
			body = getbody_270061(local);
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_405807(local, (&LOC15));
			newbody = transformouterprocbody_409614(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_408044(local);
			LA24: ;
			LOC22 = LOC23;
			if (!(LOC22)) goto LA25;
			LOC22 = ((*it).fn == (*local).owner);
			LA25: ;
			if (!LOC22) goto LA26;
			{
				NIM_BOOL LOC30;
				Tidobj197015* LOC33;
				LOC30 = 0;
				LOC30 = contains_221829((&(*o).capturedvars), (*local).Sup.id);
				if (!LOC30) goto LA31;
				LOC33 = 0;
				LOC33 = &local->Sup;
				result = idnodetableget_232212((*o).localstoaccess, LOC33);
				goto BeforeRet;
			}
			goto LA28;
			LA31: ;
			{
				Tnode224809* LOC35;
				adduniquefield_402008((*it).obj, local);
				LOC35 = 0;
				LOC35 = newsymnode_226325((*it).closureparam);
				result = indirectaccess_403038(LOC35, local, (*n).info);
				goto BeforeRet;
			}
			LA28: ;
		}
		LA26: ;
		{
			Tenv405020* closure;
			Tidobj197015* LOC40;
			TNimObject* LOC41;
			if (!((*local).kind == ((NU8) 15))) goto LA38;
			LOC40 = 0;
			LOC40 = &local->Sup;
			LOC41 = 0;
			LOC41 = idtableget_232182((*o).lambdastoenv, LOC40);
			closure = ((Tenv405020*) (LOC41));
			{
				if (!closure == 0) goto LA44;
				result = liftitersym_408731(n, (*o).fn);
				goto BeforeRet;
			}
			goto LA42;
			LA44: ;
			{
				Tnode224809* createdvar;
				Ttype224847* lpt;
				Tsym224841* LOC47;
				createdvar = generateiterclosurecreation_407895(o, closure, (*closure).attachednode);
				LOC47 = 0;
				LOC47 = gethiddenparam_405407(local);
				lpt = (*LOC47).typ;
				{
					if (!!((lpt == (*createdvar).typ))) goto LA50;
					{
						NIM_BOOL LOC54;
						NI LOC55;
						NI LOC57;
						LOC54 = 0;
						LOC55 = 0;
						LOC55 = len_227369((*(*createdvar).typ).sons->data[((NI) 0)]);
						LOC54 = (LOC55 == ((NI) 1));
						if (!(LOC54)) goto LA56;
						LOC57 = 0;
						LOC57 = len_227369((*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_195172((*n).info, ((NimStringDesc*) &TMP3463));
					}
					LA52: ;
				}
				LA50: ;
				result = makeclosure_407034(local, createdvar, (*n).info);
				goto BeforeRet;
			}
			LA42: ;
		}
		LA38: ;
		LOC65 = 0;
		LOC65 = &local->Sup;
		LOC66 = 0;
		LOC66 = idtableget_232182((*o).lambdastoenv, LOC65);
		closure = ((Tenv405020*) (LOC66));
		{
			Tnode224809* a;
			if (!!((closure == NIM_NIL))) goto LA69;
			a = (*closure).createdvar;
			{
				if (!!((a == NIM_NIL))) goto LA73;
				result = makeclosure_407034(local, a, (*n).info);
				goto BeforeRet;
			}
			goto LA71;
			LA73: ;
			{
				Tnode224809* scope;
				Tnode224809* 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_407883(o, closure));
				}
				LA78: ;
				x = (*closure).createdvar;
				result = makeclosure_407034(local, x, (*n).info);
				goto BeforeRet;
			}
			LA71: ;
		}
		LA69: ;
		{
			NIM_BOOL LOC82;
			LOC82 = 0;
			LOC82 = contains_221829((&(*o).capturedvars), (*local).Sup.id);
			if (!!(LOC82)) goto LA83;
			goto BeforeRet;
		}
		LA83: ;
		LOC85 = 0;
		LOC85 = &local->Sup;
		result = idnodetableget_232212((*o).localstoaccess, LOC85);
	}
	break;
	case ((NU8) 51):
	case ((NU8) 84):
	case ((NU8) 52):
	{
		{
			if (!!(((*n).typ == NIM_NIL))) goto LA89;
			result = transformouterproc_408076(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):
	{
		{
			Tsym224841* 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;
				Tnode224809* body;
				Tnode224809* newbody;
				Titer405016 LOC103;
				LOC99 = 0;
				LOC99 = isinnerproc_406286(local, (*o).fn);
				if (!(LOC99)) goto LA100;
				LOC99 = contains_221829((&(*o).processed), (*local).Sup.id);
				LA100: ;
				if (!LOC99) goto LA101;
				excl_221871((&(*o).processed), (*local).Sup.id);
				body = getbody_270061(local);
				memset((void*)(&LOC103), 0, sizeof(LOC103));
				inititer_405807(local, (&LOC103));
				newbody = transformouterprocbody_409614(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):
	{
		Tnode224809* x;
		x = transformouterproc_408076(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_406993(n);
	}
	break;
	case ((NU8) 104):
	{
		{
			if (!((*(*it).fn).kind == ((NU8) 15))) goto LA116;
			result = transformyield_408084(o, n, it);
		}
		goto LA114;
		LA116: ;
		{
			outerprocsons_408675(o, n, it);
		}
		LA114: ;
	}
	break;
	case ((NU8) 109):
	{
		{
			if (!((*(*it).fn).kind == ((NU8) 15))) goto LA122;
			result = transformreturn_408658(o, n, it);
		}
		goto LA120;
		LA122: ;
		{
			outerprocsons_408675(o, n, it);
		}
		LA120: ;
	}
	break;
	default:
	{
		outerprocsons_408675(o, n, it);
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode224809*, transformouterprocbody_409614)(Toutercontext405022* o, Tnode224809* n, Titer405016* it) {
	Tnode224809* result;
{	result = 0;
	{
		if (!(((*n).flags &(1<<((((NU8) 8))&15)))!=0)) goto LA3;
		result = NIM_NIL;
	}
	goto LA1;
	LA3: ;
	{
		Tnode224809* gs;
		Tnode224809* LOC35;
		Tnode224809* LOC36;
		Tnode224809* state0;
		Tnode224809* LOC37;
		Tnode224809* newbody;
		Tnode224809* stateasgnstmt;
		Tnode224809* LOC43;
		Tnode224809* LOC44;
		Ttype224847* LOC45;
		Tnode224809* 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_225098(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;
				Tnode224809* LOC26;
				Tnode224809* LOC28;
				NI LOC29;
				Tnode224809* LOC31;
				Tnode224809* LOC32;
				LOC21 = 0;
				LOC22 = 0;
				LOC23 = 0;
				LOC24 = 0;
				LOC24 = len_225098(n);
				LOC23 = (((NI) 1) < LOC24);
				if (!(LOC23)) goto LA25;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_225244(n, ((NI) 1));
				LOC23 = ((*LOC26).kind == ((NU8) 115));
				LA25: ;
				LOC22 = LOC23;
				if (!(LOC22)) goto LA27;
				LOC28 = 0;
				LOC28 = HEX5BHEX5D_225244(n, ((NI) 1));
				LOC29 = 0;
				LOC29 = len_225098(LOC28);
				LOC22 = (((NI) 0) < LOC29);
				LA27: ;
				LOC21 = LOC22;
				if (!(LOC21)) goto LA30;
				LOC31 = 0;
				LOC31 = HEX5BHEX5D_225244(n, ((NI) 1));
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_225244(LOC31, ((NI) 0));
				LOC21 = ((*LOC32).kind == ((NU8) 156));
				LA30: ;
				if (!LOC21) goto LA33;
				result = NIM_NIL;
				goto BeforeRet;
			}
			LA33: ;
		}
		LA13: ;
		result = newnodei_226351(((NU8) 115), (*(*it).fn).info);
		gs = newnodei_226351(((NU8) 156), (*(*it).fn).info);
		LOC35 = 0;
		LOC35 = newsymnode_226325((*it).closureparam);
		LOC36 = 0;
		LOC36 = rawindirectaccess_401608(LOC35, (*it).state, (*(*it).fn).info);
		add_225165(gs, LOC36);
		add_225165(result, gs);
		state0 = newnodei_226351(((NU8) 157), (*(*it).fn).info);
		LOC37 = 0;
		LOC37 = newintnode_225607(((NU8) 6), IL64(0));
		add_225165(state0, LOC37);
		add_225165(result, state0);
		newbody = transformouterproc_408076(o, n, it);
		{
			if (!!((newbody == NIM_NIL))) goto LA40;
			add_225165(result, newbody);
		}
		goto LA38;
		LA40: ;
		{
			add_225165(result, n);
		}
		LA38: ;
		stateasgnstmt = newnodei_226351(((NU8) 73), (*(*it).fn).info);
		LOC43 = 0;
		LOC43 = newsymnode_226325((*it).closureparam);
		LOC44 = 0;
		LOC44 = rawindirectaccess_401608(LOC43, (*it).state, (*(*it).fn).info);
		add_225165(stateasgnstmt, LOC44);
		LOC45 = 0;
		LOC45 = getsystype_273190(((NU8) 31));
		LOC46 = 0;
		LOC46 = newinttypenode_225619(((NU8) 6), IL64(-1), LOC45);
		add_225165(stateasgnstmt, LOC46);
		add_225165(result, stateasgnstmt);
		(*result).flags |= ((NU16)1)<<((((NU8) 8))%(sizeof(NU16)*8));
	}
	goto LA1;
	LA6: ;
	{
		result = transformouterproc_408076(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_409224)(Toutercontext405022* o) {
	Tenv405020* env;
	env = (*o).head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				Tnode224809* 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(Tnode224809*, liftlambdas_411240)(Tsym224841* fn, Tnode224809* body) {
	Tnode224809* 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;
		Tsym224841* LOC11;
		LOC5 = 0;
		LOC6 = 0;
		LOC6 = ((*body).kind == ((NU8) 1));
		if (LOC6) goto LA7;
		LOC8 = 0;
		LOC8 = (gcmd_166134 == ((NU8) 4));
		if (!(LOC8)) goto LA9;
		LOC8 = !(iscompiletime);
		LA9: ;
		LOC6 = LOC8;
		LA7: ;
		LOC5 = LOC6;
		if (LOC5) goto LA10;
		LOC11 = 0;
		LOC11 = skipgenericowner_229695(fn);
		LOC5 = !(((*LOC11).kind == ((NU8) 6)));
		LA10: ;
		if (!LOC5) goto LA12;
		result = body;
	}
	goto LA3;
	LA12: ;
	{
		Toutercontext405022* o;
		Tnode224809* ex;
		Tenv405020* env;
		o = newoutercontext_406029(fn);
		ex = closurecreationpoint_407312(body);
		env = newenv_406049(o, NIM_NIL, ex, fn);
		addparamstoenv_407343(fn, env);
		searchforinnerprocs_407423(o, body, env);
		createenvironments_409010(o);
		{
			Titer405016 LOC19;
			if (!((*fn).kind == ((NU8) 15))) goto LA17;
			memset((void*)(&LOC19), 0, sizeof(LOC19));
			inititer_405807(fn, (&LOC19));
			result = transformouterprocbody_409614(o, body, (&LOC19));
		}
		goto LA15;
		LA17: ;
		{
			Titer405016 LOC21;
			Tnode224809* LOC22;
			memset((void*)(&LOC21), 0, sizeof(LOC21));
			inititer_405807(fn, (&LOC21));
			LOC22 = 0;
			LOC22 = transformouterprocbody_409614(o, body, (&LOC21));
			result = ex;
		}
		LA15: ;
		finishenvironments_409224(o);
	}
	LA3: ;
	return result;
}

N_NIMCALL(Tnode224809*, liftlambdasfortoplevel_411312)(Tsym224841* module, Tnode224809* body) {
	Tnode224809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*body).kind == ((NU8) 1));
		if (LOC3) goto LA4;
		LOC3 = (gcmd_166134 == ((NU8) 4));
		LA4: ;
		if (!LOC3) goto LA5;
		result = body;
	}
	goto LA1;
	LA5: ;
	{
		Toutercontext405022* o;
		Tnode224809* ex;
		Tenv405020* env;
		Titer405016 LOC8;
		Tnode224809* LOC9;
		o = newoutercontext_406029(module);
		ex = closurecreationpoint_407312(body);
		env = newenv_406049(o, NIM_NIL, ex, module);
		searchforinnerprocs_407423(o, body, env);
		createenvironments_409010(o);
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		inititer_405807(module, (&LOC8));
		LOC9 = 0;
		LOC9 = transformouterproc_408076(o, body, (&LOC8));
		finishenvironments_409224(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 TMP1009[19];
NTI405022.size = sizeof(Toutercontext405022);
NTI405022.kind = 18;
NTI405022.base = 0;
TMP3446[0] = &TMP1009[1];
TMP1009[1].kind = 1;
TMP1009[1].offset = offsetof(Toutercontext405022, fn);
TMP1009[1].typ = (&NTI224807);
TMP1009[1].name = "fn";
TMP3446[1] = &TMP1009[2];
NTI405020.size = sizeof(Tenv405020);
NTI405020.kind = 17;
NTI405020.base = (&NTI4011);
TMP3447[0] = &TMP1009[4];
TMP1009[4].kind = 1;
TMP1009[4].offset = offsetof(Tenv405020, attachednode);
TMP1009[4].typ = (&NTI224801);
TMP1009[4].name = "attachedNode";
TMP3447[1] = &TMP1009[5];
TMP1009[5].kind = 1;
TMP1009[5].offset = offsetof(Tenv405020, replacementnode);
TMP1009[5].typ = (&NTI224801);
TMP1009[5].name = "replacementNode";
TMP3447[2] = &TMP1009[6];
TMP1009[6].kind = 1;
TMP1009[6].offset = offsetof(Tenv405020, createdvar);
TMP1009[6].typ = (&NTI224801);
TMP1009[6].name = "createdVar";
TMP3447[3] = &TMP1009[7];
TMP1009[7].kind = 1;
TMP1009[7].offset = offsetof(Tenv405020, createdvarcomesfromiter);
TMP1009[7].typ = (&NTI138);
TMP1009[7].name = "createdVarComesFromIter";
TMP3447[4] = &TMP1009[8];
TMP1009[8].kind = 1;
TMP1009[8].offset = offsetof(Tenv405020, capturedvars);
TMP1009[8].typ = (&NTI224811);
TMP1009[8].name = "capturedVars";
TMP3447[5] = &TMP1009[9];
TMP1009[9].kind = 1;
TMP1009[9].offset = offsetof(Tenv405020, up);
TMP1009[9].typ = (&NTI405018);
TMP1009[9].name = "up";
TMP3447[6] = &TMP1009[10];
TMP1009[10].kind = 1;
TMP1009[10].offset = offsetof(Tenv405020, next);
TMP1009[10].typ = (&NTI405018);
TMP1009[10].name = "next";
TMP3447[7] = &TMP1009[11];
TMP1009[11].kind = 1;
TMP1009[11].offset = offsetof(Tenv405020, upfield);
TMP1009[11].typ = (&NTI224807);
TMP1009[11].name = "upField";
TMP3447[8] = &TMP1009[12];
TMP1009[12].kind = 1;
TMP1009[12].offset = offsetof(Tenv405020, obj);
TMP1009[12].typ = (&NTI224805);
TMP1009[12].name = "obj";
TMP3447[9] = &TMP1009[13];
TMP1009[13].kind = 1;
TMP1009[13].offset = offsetof(Tenv405020, fn);
TMP1009[13].typ = (&NTI224807);
TMP1009[13].name = "fn";
TMP3447[10] = &TMP1009[14];
TMP1009[14].kind = 1;
TMP1009[14].offset = offsetof(Tenv405020, vars);
TMP1009[14].typ = (&NTI221056);
TMP1009[14].name = "vars";
TMP1009[3].len = 11; TMP1009[3].kind = 2; TMP1009[3].sons = &TMP3447[0];
NTI405020.node = &TMP1009[3];
NTI405018.size = sizeof(Tenv405020*);
NTI405018.kind = 22;
NTI405018.base = (&NTI405020);
NTI405018.marker = TMP3448;
TMP1009[2].kind = 1;
TMP1009[2].offset = offsetof(Toutercontext405022, head);
TMP1009[2].typ = (&NTI405018);
TMP1009[2].name = "head";
TMP3446[2] = &TMP1009[15];
TMP1009[15].kind = 1;
TMP1009[15].offset = offsetof(Toutercontext405022, capturedvars);
TMP1009[15].typ = (&NTI221056);
TMP1009[15].name = "capturedVars";
TMP3446[3] = &TMP1009[16];
TMP1009[16].kind = 1;
TMP1009[16].offset = offsetof(Toutercontext405022, processed);
TMP1009[16].typ = (&NTI221056);
TMP1009[16].name = "processed";
TMP3446[4] = &TMP1009[17];
TMP1009[17].kind = 1;
TMP1009[17].offset = offsetof(Toutercontext405022, localstoaccess);
TMP1009[17].typ = (&NTI224865);
TMP1009[17].name = "localsToAccess";
TMP3446[5] = &TMP1009[18];
TMP1009[18].kind = 1;
TMP1009[18].offset = offsetof(Toutercontext405022, lambdastoenv);
TMP1009[18].typ = (&NTI224859);
TMP1009[18].name = "lambdasToEnv";
TMP1009[0].len = 6; TMP1009[0].kind = 2; TMP1009[0].sons = &TMP3446[0];
NTI405022.node = &TMP1009[0];
NTI405014.size = sizeof(Toutercontext405022*);
NTI405014.kind = 22;
NTI405014.base = (&NTI405022);
NTI405014.marker = TMP3449;
}

