/* 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 Tsym223841 Tsym223841;
typedef struct Tidobj196015 Tidobj196015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq223843 Ttypeseq223843;
typedef struct Tscope223835 Tscope223835;
typedef struct TY223944 TY223944;
typedef struct Tstrtable223813 Tstrtable223813;
typedef struct Tsymseq223811 Tsymseq223811;
typedef struct Ttype223847 Ttype223847;
typedef struct Tident196021 Tident196021;
typedef struct Tlineinfo188352 Tlineinfo188352;
typedef struct Tnode223809 Tnode223809;
typedef struct Tloc223823 Tloc223823;
typedef struct Ropeobj174009 Ropeobj174009;
typedef struct Tlib223827 Tlib223827;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tnodeseq223803 Tnodeseq223803;
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 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 Toutercontext404022 Toutercontext404022;
typedef struct Tenv404020 Tenv404020;
typedef struct Intset220056 Intset220056;
typedef struct Trunk220052 Trunk220052;
typedef struct Trunkseq220054 Trunkseq220054;
typedef struct Tidnodetable223865 Tidnodetable223865;
typedef struct Tidnodepairseq223863 Tidnodepairseq223863;
typedef struct Tidtable223859 Tidtable223859;
typedef struct Tidpairseq223857 Tidpairseq223857;
typedef struct Titer404016 Titer404016;
typedef struct Tinstantiation223831 Tinstantiation223831;
typedef struct Tlistentry139022 Tlistentry139022;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef struct Tidnodepair223861 Tidnodepair223861;
typedef struct Tidpair223855 Tidpair223855;
typedef struct TY223932 TY223932;
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  Tidobj196015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable223813  {
NI counter;
Tsymseq223811* data;
};
struct  Tlineinfo188352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc223823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype223847* t;
Ropeobj174009* r;
Ropeobj174009* heaproot;
};
struct  Tsym223841  {
  Tidobj196015 Sup;
NU8 kind;
union{
struct {Ttypeseq223843* typeinstcache;
Tscope223835* typscope;
} S1;
struct {TY223944* procinstcache;
Tsym223841* gcunsafetyreason;
} S2;
struct {TY223944* usedgenerics;
Tstrtable223813 tab;
} S3;
struct {Tsym223841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype223847* typ;
Tident196021* name;
Tlineinfo188352 info;
Tsym223841* owner;
NU32 flags;
Tnode223809* ast;
NU32 options;
NI position;
NI offset;
Tloc223823 loc;
Tlib223827* annex;
Tnode223809* constraint;
};
struct  Ttype223847  {
  Tidobj196015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq223843* sons;
Tnode223809* n;
Tsym223841* owner;
Tsym223841* sym;
Tsym223841* destructor;
Tsym223841* deepcopy;
Tsym223841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc223823 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode223809  {
Ttype223847* typ;
Tlineinfo188352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym223841* sym;
} S4;
struct {Tident196021* ident;
} S5;
struct {Tnodeseq223803* 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 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;
Cellseq48963 zct;
Cellseq48963 decstack;
Cellset48959 cycleroots;
Cellseq48963 tempstack;
NI recgclock;
Memregion30890 region;
Gcstat51014 stat;
};
struct  Intset220056  {
NI counter;
NI max;
Trunk220052* head;
Trunkseq220054* data;
};
struct  Tidnodetable223865  {
NI counter;
Tidnodepairseq223863* data;
};
struct  Tidtable223859  {
NI counter;
Tidpairseq223857* data;
};
struct  Toutercontext404022  {
Tsym223841* fn;
Tenv404020* head;
Intset220056 capturedvars;
Intset220056 processed;
Tidnodetable223865 localstoaccess;
Tidtable223859 lambdastoenv;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tenv404020  {
  TNimObject Sup;
Tnode223809* attachednode;
Tnode223809* replacementnode;
Tnode223809* createdvar;
NIM_BOOL createdvarcomesfromiter;
Tsymseq223811* capturedvars;
Tenv404020* up;
Tenv404020* next;
Tsym223841* upfield;
Ttype223847* obj;
Tsym223841* fn;
Intset220056 vars;
};
struct  Tident196021  {
  Tidobj196015 Sup;
NimStringDesc* s;
Tident196021* next;
NI h;
};
struct  Titer404016  {
Tsym223841* fn;
Tsym223841* closureparam;
Tsym223841* state;
Tsym223841* resultsym;
Ttype223847* obj;
};
struct  Tscope223835  {
NI depthlevel;
Tstrtable223813 symbols;
Tnodeseq223803* usingsyms;
Tscope223835* parent;
};
struct  Ropeobj174009  {
  TNimObject Sup;
Ropeobj174009* left;
Ropeobj174009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry139022  {
  TNimObject Sup;
Tlistentry139022* prev;
Tlistentry139022* next;
};
struct  Tlib223827  {
  Tlistentry139022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj174009* name;
Tnode223809* path;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30821[16];
struct  Pagedesc48955  {
Pagedesc48955* 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  Trunk220052  {
Trunk220052* next;
NI key;
TY30821 bits;
};
struct  Tidnodepair223861  {
Tidobj196015* key;
Tnode223809* val;
};
struct  Tidpair223855  {
Tidobj196015* key;
TNimObject* val;
};
struct  Tinstantiation223831  {
Tsym223841* sym;
Ttypeseq223843* concretetypes;
TY223932* usedby;
NI compilesid;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct Tsymseq223811 {
  TGenericSeq Sup;
  Tsym223841* data[SEQ_DECL_SIZE];
};
struct Ttypeseq223843 {
  TGenericSeq Sup;
  Ttype223847* data[SEQ_DECL_SIZE];
};
struct TY223944 {
  TGenericSeq Sup;
  Tinstantiation223831* data[SEQ_DECL_SIZE];
};
struct Tnodeseq223803 {
  TGenericSeq Sup;
  Tnode223809* data[SEQ_DECL_SIZE];
};
struct Trunkseq220054 {
  TGenericSeq Sup;
  Trunk220052* data[SEQ_DECL_SIZE];
};
struct Tidnodepairseq223863 {
  TGenericSeq Sup;
  Tidnodepair223861 data[SEQ_DECL_SIZE];
};
struct Tidpairseq223857 {
  TGenericSeq Sup;
  Tidpair223855 data[SEQ_DECL_SIZE];
};
struct TY223932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
static N_INLINE(NIM_BOOL, interestingvar_405406)(Tsym223841* s);
N_NIMCALL(NIM_BOOL, isgenericroutine_228650)(Tsym223841* s);
static N_INLINE(NI, len_224098)(Tnode223809* n);
static N_INLINE(Tnode223809*, HEX5BHEX5D_224244)(Tnode223809* n, NI i);
N_NIMCALL(void, localerror_194139)(Tlineinfo188352 info, NimStringDesc* arg);
N_NIMCALL(Tnode223809*, newnodei_225351)(NU8 kind, Tlineinfo188352 info);
N_NIMCALL(Tsym223841*, copysym_226607)(Tsym223841* s, NIM_BOOL keepid);
N_NIMCALL(Tsym223841*, gethiddenparam_404407)(Tsym223841* routine);
N_NIMCALL(Tnode223809*, lastson_226406)(Tnode223809* n);
N_NIMCALL(void, internalerror_194191)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_194279)(TY90959 x);
N_NIMCALL(void, addvar_400047)(Tnode223809* father, Tnode223809* v);
N_NIMCALL(Tnode223809*, newsymnode_225325)(Tsym223841* sym);
N_NIMCALL(void, add_224165)(Tnode223809* father, Tnode223809* son);
N_NIMCALL(Tnode223809*, newcall_405272)(Tsym223841* a, Tnode223809* b);
N_NIMCALL(Tsym223841*, getsyssym_272077)(NimStringDesc* name);
N_NIMCALL(Tnode223809*, newnodei_225407)(NU8 kind, Tlineinfo188352 info, NI children);
N_NIMCALL(Tnode223809*, newinttypenode_224620)(NU8 kind, NI64 intval, Ttype223847* typ);
N_NIMCALL(Ttype223847*, getsystype_272190)(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_225819)(Tnode223809* father, Tnode223809* son);
N_NIMCALL(Tnode223809*, makeclosure_406034)(Tsym223841* prc, Tnode223809* env, Tlineinfo188352 info);
N_NIMCALL(Tnode223809*, newnodeit_225807)(NU8 kind, Tlineinfo188352 info, Ttype223847* typ);
N_NIMCALL(Tsym223841*, skipgenericowner_228694)(Tsym223841* s);
N_NIMCALL(Toutercontext404022*, newoutercontext_405029)(Tsym223841* fn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3447)(void* p, NI op);
N_NIMCALL(void, TMP3448)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initintset_220927)(Intset220056* Result);
N_NIMCALL(void, initidnodetable_227127)(Tidnodetable223865* x);
N_NIMCALL(void, initidtable_227057)(Tidtable223859* x);
N_NIMCALL(Tnode223809*, closurecreationpoint_406312)(Tnode223809* n);
N_NIMCALL(Tenv404020*, newenv_405049)(Toutercontext404022* o, Tenv404020* up, Tnode223809* n, Tsym223841* 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(Tsym223841*, getenvparam_404607)(Tsym223841* routine);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(Ttype223847*, createenvobj_404082)(Tsym223841* owner);
N_NIMCALL(Ttype223847*, createobj_400372)(Tsym223841* owner, Tlineinfo188352 info);
N_NIMCALL(void, rawaddfield_400393)(Ttype223847* obj, Tsym223841* field);
N_NIMCALL(Tsym223841*, createstatefield_404070)(Tsym223841* iter);
N_NIMCALL(Tsym223841*, newsym_224656)(NU8 symkind, Tident196021* name, Tsym223841* owner, Tlineinfo188352 info);
N_NIMCALL(Tident196021*, getident_196463)(NimStringDesc* identifier);
N_NIMCALL(Ttype223847*, getstatetype_404049)(Tsym223841* iter);
N_NIMCALL(Tnode223809*, newintnode_224608)(NU8 kind, NI64 intval);
N_NIMCALL(Ttype223847*, newtype_226140)(NU8 kind, Tsym223841* owner);
N_NIMCALL(Ttype223847*, nilorsysint_272036)(void);
N_NIMCALL(void, rawaddson_227498)(Ttype223847* father, Ttype223847* son);
N_NIMCALL(void, addparamstoenv_406343)(Tsym223841* fn, Tenv404020* env);
N_NIMCALL(void, internalerror_194172)(Tlineinfo188352 info, NimStringDesc* errmsg);
N_NIMCALL(void, incl_220856)(Intset220056* s, NI key);
N_NIMCALL(NI, sonslen_226387)(Tnode223809* n);
N_NIMCALL(void, searchforinnerprocs_406423)(Toutercontext404022* o, Tnode223809* n, Tenv404020* env);
N_NIMCALL(NIM_BOOL, isinnerproc_405286)(Tsym223841* s, Tsym223841* outerproc);
N_NIMCALL(NIM_BOOL, containsorincl_220898)(Intset220056* s, NI key);
N_NIMCALL(Tnode223809*, getbody_269062)(Tsym223841* s);
N_NIMCALL(NI, gathervars_405870)(Toutercontext404022* o, Tenv404020* e, Tnode223809* n);
N_NIMCALL(NIM_BOOL, capturevar_405638)(Toutercontext404022* o, Tenv404020* top, Tsym223841* local, Tlineinfo188352 info);
N_NIMCALL(NIM_BOOL, contains_220829)(Intset220056 s, NI key);
static N_INLINE(NIM_BOOL, illegalcapture_405375)(Tsym223841* s);
N_NIMCALL(Ttype223847*, skiptypes_227167)(Ttype223847* t, NU64 kinds);
N_NIMCALL(void, localerror_194128)(Tlineinfo188352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(Tsym223841*, createupfield_405621)(Ttype223847* obj, Ttype223847* fieldtype);
N_NIMCALL(void, addfield_400809)(Ttype223847* obj, Tsym223841* s);
N_NIMCALL(void, addclosureparam_405338)(Tsym223841* fn, Tenv404020* e);
N_NIMCALL(void, addhiddenparam_404124)(Tsym223841* routine, Tsym223841* param);
N_NIMCALL(TNimObject*, idtableget_231182)(Tidtable223859 t, Tidobj196015* key);
N_NIMCALL(void, idtableput_231196)(Tidtable223859* t, Tidobj196015* key, TNimObject* val);
N_NIMCALL(void, addcapturedvar_405215)(Tenv404020* e, Tsym223841* v);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(Tnode223809*, transforminnerproc_406210)(Toutercontext404022* o, Tenv404020* e, Tnode223809* n);
N_NIMCALL(Tnode223809*, getclosurevar_406097)(Tenv404020* e);
N_NIMCALL(Tnode223809*, newclosurecreationvar_406062)(Tenv404020* e);
N_NIMCALL(void, inititer_404807)(Tsym223841* iter, Titer404016* Result);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(Tsym223841*, newiterresult_404093)(Tsym223841* iter);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, adduniquefield_401008)(Ttype223847* obj, Tsym223841* s);
N_NIMCALL(Tnode223809*, indirectaccess_402038)(Tnode223809* a, Tsym223841* b, Tlineinfo188352 info);
N_NIMCALL(Tenv404020*, findenv_406119)(Toutercontext404022* o, Tsym223841* s);
N_NIMCALL(Tnode223809*, nestedaccess_405438)(Tenv404020* top, Tsym223841* local);
N_NIMCALL(void, createenvironments_408010)(Toutercontext404022* o);
N_NIMCALL(Tnode223809*, generateclosurecreation_406883)(Toutercontext404022* o, Tenv404020* scope);
N_NIMCALL(Tnode223809*, rawclosurecreation_406785)(Toutercontext404022* o, Tenv404020* scope, Tnode223809* env);
N_NIMCALL(Tnode223809*, newasgnstmt_406771)(Tnode223809* le, Tnode223809* ri, Tlineinfo188352 info);
N_NIMCALL(Tnode223809*, idnodetableget_231212)(Tidnodetable223865 t, Tidobj196015* key);
N_NIMCALL(void, idnodetableput_231219)(Tidnodetable223865* t, Tidobj196015* key, Tnode223809* val);
N_NIMCALL(Tnode223809*, transformouterprocbody_408614)(Toutercontext404022* o, Tnode223809* n, Titer404016* it);
N_NIMCALL(Tnode223809*, rawindirectaccess_400608)(Tnode223809* a, Tsym223841* field, Tlineinfo188352 info);
N_NIMCALL(Tnode223809*, transformouterproc_407076)(Toutercontext404022* o, Tnode223809* n, Titer404016* it);
N_NIMCALL(void, excl_220871)(Intset220056* s, NI key);
static N_INLINE(NIM_BOOL, interestingitervar_407044)(Tsym223841* s);
N_NIMCALL(Tnode223809*, liftitersym_407731)(Tnode223809* n, Tsym223841* owner);
N_NIMCALL(Tnode223809*, generateiterclosurecreation_406895)(Toutercontext404022* o, Tenv404020* env, Tnode223809* scope);
N_NIMCALL(NI, len_226369)(Ttype223847* n);
N_NIMCALL(Tnode223809*, transformouterconv_405993)(Tnode223809* n);
N_NIMCALL(Tnode223809*, generatethunk_405968)(Tnode223809* prc, Ttype223847* dest);
N_NIMCALL(Tnode223809*, transformyield_407084)(Toutercontext404022* c, Tnode223809* n, Titer404016* it);
N_NIMCALL(void, outerprocsons_407675)(Toutercontext404022* o, Tnode223809* n, Titer404016* it);
N_NIMCALL(Tnode223809*, transformreturn_407658)(Toutercontext404022* c, Tnode223809* n, Titer404016* it);
N_NIMCALL(void, finishenvironments_408224)(Toutercontext404022* o);
STRING_LITERAL(TMP3405, "ignored invalid for loop", 24);
STRING_LITERAL(TMP3407, "compiler/lambdalifting.nim", 26);
NIM_CONST TY90959 TMP3406 = {((NimStringDesc*) &TMP3407),
((NI) 196)}
;
STRING_LITERAL(TMP3408, "internalNew", 11);
STRING_LITERAL(TMP3449, ":envP", 5);
STRING_LITERAL(TMP3450, ":state", 6);
STRING_LITERAL(TMP3451, "liftLambdas: strange params", 27);
STRING_LITERAL(TMP3452, ":up", 3);
STRING_LITERAL(TMP3453, ":env", 4);
NIM_CONST TY90959 TMP3454 = {((NimStringDesc*) &TMP3407),
((NI) 222)}
;
STRING_LITERAL(TMP3455, ":result", 7);
NIM_CONST TY90959 TMP3458 = {((NimStringDesc*) &TMP3407),
((NI) 472)}
;
NIM_CONST TY90959 TMP3459 = {((NimStringDesc*) &TMP3407),
((NI) 315)}
;
NIM_CONST TY90959 TMP3460 = {((NimStringDesc*) &TMP3407),
((NI) 322)}
;
STRING_LITERAL(TMP3461, "searchForInnerProcs", 19);
STRING_LITERAL(TMP3462, "environment computation failed", 30);
extern Gcheap51018 gch_51059;
extern Tnode223809* emptynode_224807;
extern NU8 gcmd_165134;
TNimType NTI404022; /* TOuterContext */
extern TNimType NTI223807; /* PSym */
extern TNimType NTI4011; /* RootObj */
TNimType NTI404020; /* TEnv */
extern TNimType NTI223801; /* PNode */
extern TNimType NTI138; /* bool */
extern TNimType NTI223811; /* TSymSeq */
extern TNimType NTI223805; /* PType */
extern TNimType NTI220056; /* IntSet */
TNimType NTI404018; /* PEnv */
extern TNimType NTI223865; /* TIdNodeTable */
extern TNimType NTI223859; /* TIdTable */
TNimType NTI404014; /* POuterContext */

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

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

N_NIMCALL(Tsym223841*, gethiddenparam_404407)(Tsym223841* routine) {
	Tsym223841* result;
	Tnode223809* params;
	Tnode223809* hidden;
	result = 0;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	hidden = lastson_226406(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_194279(TMP3406);
		internalerror_194191(LOC7);
	}
	LA5: ;
	result = (*hidden).kindU.S4.sym;
	return result;
}

N_NIMCALL(Tnode223809*, newcall_405272)(Tsym223841* a, Tnode223809* b) {
	Tnode223809* result;
	Tnode223809* LOC1;
	result = 0;
	result = newnodei_225351(((NU8) 27), (*a).info);
	LOC1 = 0;
	LOC1 = newsymnode_225325(a);
	add_224165(result, LOC1);
	add_224165(result, b);
	return result;
}

static N_INLINE(Cell48947*, usrtocell_52646)(void* usr) {
	Cell48947* result;
	result = 0;
	result = ((Cell48947*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((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 (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA11;
			rtladdzct_54204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(Tnode223809*, makeclosure_406034)(Tsym223841* prc, Tnode223809* env, Tlineinfo188352 info) {
	Tnode223809* result;
	Tnode223809* LOC1;
	result = 0;
	result = newnodeit_225807(((NU8) 155), info, (*prc).typ);
	LOC1 = 0;
	LOC1 = newsymnode_225325(prc);
	add_224165(result, LOC1);
	{
		Ttype223847* LOC6;
		Tnode223809* LOC7;
		if (!(env == NIM_NIL)) goto LA4;
		LOC6 = 0;
		LOC6 = getsystype_272190(((NU8) 5));
		LOC7 = 0;
		LOC7 = newnodeit_225807(((NU8) 23), info, LOC6);
		add_224165(result, LOC7);
	}
	goto LA2;
	LA4: ;
	{
		add_224165(result, env);
	}
	LA2: ;
	return result;
}

N_NIMCALL(Tnode223809*, liftforloop_410344)(Tnode223809* body) {
	Tnode223809* result;
	NI L;
	Tnode223809* call;
	Tsym223841* env;
	Tnode223809* loopbody;
	Tnode223809* whileloop;
	Ttype223847* LOC22;
	Tnode223809* v2;
	Tnode223809* vpart;
	NU8 LOC23;
	Tnode223809* bs;
{	result = 0;
	L = len_224098(body);
	{
		NIM_BOOL LOC3;
		Tnode223809* LOC5;
		LOC3 = 0;
		LOC3 = ((*body).kind == ((NU8) 94));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = HEX5BHEX5D_224244(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_194139((*body).info, ((NimStringDesc*) &TMP3405));
		result = body;
		goto BeforeRet;
	}
	LA6: ;
	call = HEX5BHEX5D_224244(body, (NI)(L - ((NI) 2)));
	result = newnodei_225351(((NU8) 115), (*body).info);
	env = 0;
	{
		NIM_BOOL LOC10;
		Tnode223809* LOC11;
		Tnode223809* LOC13;
		Tsym223841* iter;
		Tnode223809* LOC16;
		Tsym223841* LOC17;
		Tnode223809* v;
		Tnode223809* LOC18;
		Tsym223841* LOC19;
		Tnode223809* LOC20;
		Tnode223809* LOC21;
		LOC10 = 0;
		LOC11 = 0;
		LOC11 = HEX5BHEX5D_224244(call, ((NI) 0));
		LOC10 = ((*LOC11).kind == ((NU8) 3));
		if (!(LOC10)) goto LA12;
		LOC13 = 0;
		LOC13 = HEX5BHEX5D_224244(call, ((NI) 0));
		LOC10 = ((*(*LOC13).kindU.S4.sym).kind == ((NU8) 15));
		LA12: ;
		if (!LOC10) goto LA14;
		LOC16 = 0;
		LOC16 = HEX5BHEX5D_224244(call, ((NI) 0));
		iter = (*LOC16).kindU.S4.sym;
		LOC17 = 0;
		LOC17 = gethiddenparam_404407(iter);
		env = copysym_226607(LOC17, NIM_FALSE);
		v = newnodei_225351(((NU8) 99), (*body).info);
		LOC18 = 0;
		LOC18 = newsymnode_225325(env);
		addvar_400047(v, LOC18);
		add_224165(result, v);
		LOC19 = 0;
		LOC19 = getsyssym_272077(((NimStringDesc*) &TMP3408));
		LOC20 = 0;
		LOC20 = newsymnode_225325(env);
		LOC21 = 0;
		LOC21 = newcall_405272(LOC19, LOC20);
		add_224165(result, LOC21);
	}
	LA14: ;
	loopbody = newnodei_225407(((NU8) 115), (*body).info, ((NI) 3));
	whileloop = newnodei_225407(((NU8) 96), (*body).info, ((NI) 2));
	LOC22 = 0;
	LOC22 = getsystype_272190(((NU8) 1));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.sons->data[((NI) 0)]), newinttypenode_224620(((NU8) 6), IL64(1), LOC22));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.sons->data[((NI) 1)]), loopbody);
	add_224165(result, whileloop);
	v2 = newnodei_225351(((NU8) 100), (*body).info);
	LOC23 = 0;
	{
		if (!(L == ((NI) 3))) goto LA26;
		LOC23 = ((NU8) 35);
	}
	goto LA24;
	LA26: ;
	{
		LOC23 = ((NU8) 36);
	}
	LA24: ;
	vpart = newnodei_225351(LOC23, (*body).info);
	{
		NI i_410622;
		NI HEX3Atmp_410823;
		NI res_410826;
		i_410622 = 0;
		HEX3Atmp_410823 = 0;
		HEX3Atmp_410823 = (NI)(L - ((NI) 3));
		res_410826 = ((NI) 0);
		{
			while (1) {
				Tnode223809* LOC32;
				Tnode223809* LOC33;
				if (!(res_410826 <= HEX3Atmp_410823)) goto LA31;
				i_410622 = res_410826;
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_224244(body, i_410622);
				(*(*LOC32).kindU.S4.sym).kind = ((NU8) 9);
				LOC33 = 0;
				LOC33 = HEX5BHEX5D_224244(body, i_410622);
				addson_225819(vpart, LOC33);
				res_410826 += ((NI) 1);
			} LA31: ;
		}
	}
	addson_225819(vpart, emptynode_224807);
	{
		Tnode223809* LOC38;
		if (!!(env == 0)) goto LA36;
		LOC38 = 0;
		LOC38 = newsymnode_225325(env);
		asgnRefNoCycle((void**) (&(*call).kindU.S6.sons->data[((NI) 0)]), makeclosure_406034((*(*call).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym, LOC38, (*body).info));
	}
	LA36: ;
	addson_225819(vpart, call);
	addson_225819(v2, vpart);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.sons->data[((NI) 0)]), v2);
	bs = newnodei_225351(((NU8) 158), (*body).info);
	addson_225819(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_224244(body, (NI)(L - ((NI) 1))));
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP3447)(void* p, NI op) {
	Tenv404020* a;
	a = (Tenv404020*)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, TMP3448)(void* p, NI op) {
	Toutercontext404022* a;
	a = (Toutercontext404022*)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(Toutercontext404022*, newoutercontext_405029)(Tsym223841* fn) {
	Toutercontext404022* result;
	result = 0;
	result = (Toutercontext404022*) newObj((&NTI404014), sizeof(Toutercontext404022));
	asgnRefNoCycle((void**) (&(*result).fn), fn);
	initintset_220927((&(*result).capturedvars));
	initintset_220927((&(*result).processed));
	initidnodetable_227127((&(*result).localstoaccess));
	initidtable_227057((&(*result).lambdastoenv));
	return result;
}

N_NIMCALL(Tnode223809*, closurecreationpoint_406312)(Tnode223809* n) {
	Tnode223809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC6;
		Tnode223809* LOC8;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*n).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC6 = 0;
		LOC6 = len_224098(n);
		LOC4 = (((NI) 1) <= LOC6);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA7;
		LOC8 = 0;
		LOC8 = HEX5BHEX5D_224244(n, ((NI) 0));
		LOC3 = ((*LOC8).kind == ((NU8) 1));
		LA7: ;
		if (!LOC3) goto LA9;
		result = n;
	}
	goto LA1;
	LA9: ;
	{
		result = newnodei_225351(((NU8) 115), (*n).info);
		add_224165(result, emptynode_224807);
		add_224165(result, n);
	}
	LA1: ;
	return result;
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	Cell48947* 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)(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)((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)(Cell48947* 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) {
	{
		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(Tsym223841*, getenvparam_404607)(Tsym223841* routine) {
	Tsym223841* result;
	Tnode223809* params;
	Tnode223809* hidden;
	result = 0;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	hidden = lastson_226406(params);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*hidden).kind == ((NU8) 3));
		if (!(LOC3)) goto LA4;
		LOC3 = eqStrings((*(*(*hidden).kindU.S4.sym).name).s, ((NimStringDesc*) &TMP3449));
		LA4: ;
		if (!LOC3) goto LA5;
		result = (*hidden).kindU.S4.sym;
	}
	LA5: ;
	return result;
}

N_NIMCALL(Ttype223847*, getstatetype_404049)(Tsym223841* iter) {
	Ttype223847* result;
	Tnode223809* n;
	Tnode223809* LOC1;
	Tnode223809* LOC2;
	Ttype223847* inttype;
	result = 0;
	n = newnodei_225351(((NU8) 44), (*iter).info);
	LOC1 = 0;
	LOC1 = newintnode_224608(((NU8) 6), IL64(-1));
	addson_225819(n, LOC1);
	LOC2 = 0;
	LOC2 = newintnode_224608(((NU8) 6), IL64(0));
	addson_225819(n, LOC2);
	result = newtype_226140(((NU8) 20), iter);
	asgnRefNoCycle((void**) (&(*result).n), n);
	inttype = nilorsysint_272036();
	{
		if (!inttype == 0) goto LA5;
		inttype = newtype_226140(((NU8) 31), iter);
	}
	LA5: ;
	rawaddson_227498(result, inttype);
	return result;
}

N_NIMCALL(Tsym223841*, createstatefield_404070)(Tsym223841* iter) {
	Tsym223841* result;
	Tident196021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_196463(((NimStringDesc*) &TMP3450));
	result = newsym_224656(((NU8) 19), LOC1, iter, (*iter).info);
	asgnRefNoCycle((void**) (&(*result).typ), getstatetype_404049(iter));
	return result;
}

N_NIMCALL(Ttype223847*, createenvobj_404082)(Tsym223841* owner) {
	Ttype223847* result;
	Tsym223841* LOC1;
	result = 0;
	result = createobj_400372(owner, (*owner).info);
	LOC1 = 0;
	LOC1 = createstatefield_404070(owner);
	rawaddfield_400393(result, LOC1);
	return result;
}

N_NIMCALL(Tenv404020*, newenv_405049)(Toutercontext404022* o, Tenv404020* up, Tnode223809* n, Tsym223841* owner) {
	Tenv404020* result;
	result = 0;
	result = (Tenv404020*) newObj((&NTI404018), sizeof(Tenv404020));
	(*result).Sup.m_type = (&NTI404020);
	if ((*result).capturedvars) nimGCunrefNoCycle((*result).capturedvars);
	(*result).capturedvars = (Tsymseq223811*) newSeqRC1((&NTI223811), 0);
	asgnRef((void**) (&(*result).up), up);
	asgnRefNoCycle((void**) (&(*result).attachednode), n);
	asgnRefNoCycle((void**) (&(*result).fn), owner);
	initintset_220927((&(*result).vars));
	asgnRef((void**) (&(*result).next), (*o).head);
	asgnRef((void**) (&(*o).head), result);
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		Tsym223841* 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_404607(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_404082(owner));
	}
	LA15: ;
	return result;
}

N_NIMCALL(void, addparamstoenv_406343)(Tsym223841* fn, Tenv404020* env) {
	Tnode223809* params;
	Tnode223809* ast;
	params = (*(*fn).typ).n;
	{
		NI i_406368;
		NI HEX3Atmp_406401;
		NI LOC2;
		NI res_406404;
		i_406368 = 0;
		HEX3Atmp_406401 = 0;
		LOC2 = 0;
		LOC2 = len_224098(params);
		HEX3Atmp_406401 = (LOC2 - 1);
		res_406404 = ((NI) 1);
		{
			while (1) {
				Tsym223841* param;
				if (!(res_406404 <= HEX3Atmp_406401)) goto LA4;
				i_406368 = res_406404;
				{
					if (!!(((*(*params).kindU.S6.sons->data[i_406368]).kind == ((NU8) 3)))) goto LA7;
					internalerror_194172((*params).info, ((NimStringDesc*) &TMP3451));
				}
				LA7: ;
				param = (*(*params).kindU.S6.sons->data[i_406368]).kindU.S4.sym;
				incl_220856((&(*env).vars), (*param).Sup.id);
				res_406404 += ((NI) 1);
			} LA4: ;
		}
	}
	ast = (*fn).ast;
	{
		NIM_BOOL LOC11;
		NI LOC12;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = sonslen_226387(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_220856((&(*env).vars), (*(*(*ast).kindU.S6.sons->data[((NI) 7)]).kindU.S4.sym).Sup.id);
	}
	LA14: ;
}

N_NIMCALL(NIM_BOOL, isinnerproc_405286)(Tsym223841* s, Tsym223841* outerproc) {
	NIM_BOOL result;
{	result = 0;
	{
		Tsym223841* owner;
		if (!((110592 &(1<<(((*s).kind)&31)))!=0)) goto LA3;
		owner = skipgenericowner_228694(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_405375)(Tsym223841* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	Ttype223847* LOC2;
	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = skiptypes_227167((*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(Tsym223841*, createupfield_405621)(Ttype223847* obj, Ttype223847* fieldtype) {
	Tsym223841* result;
	NI pos;
	Tident196021* LOC1;
	result = 0;
	pos = len_224098((*obj).n);
	LOC1 = 0;
	LOC1 = getident_196463(((NimStringDesc*) &TMP3452));
	result = newsym_224656(((NU8) 19), LOC1, (*obj).owner, (*(*obj).owner).info);
	asgnRefNoCycle((void**) (&(*result).typ), newtype_226140(((NU8) 22), (*obj).owner));
	(*result).position = pos;
	rawaddson_227498((*result).typ, fieldtype);
	addfield_400809(obj, result);
	return result;
}

N_NIMCALL(void, addhiddenparam_404124)(Tsym223841* routine, Tsym223841* param) {
	Tnode223809* params;
	NI LOC1;
	Tnode223809* LOC2;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	LOC1 = 0;
	LOC1 = len_224098((*(*routine).typ).n);
	(*param).position = (NI)(LOC1 - ((NI) 1));
	LOC2 = 0;
	LOC2 = newsymnode_225325(param);
	addson_225819(params, LOC2);
	(*(*routine).typ).flags |= ((NU32)1)<<((((NU8) 11))%(sizeof(NU32)*8));
}

N_NIMCALL(void, addclosureparam_405338)(Tsym223841* fn, Tenv404020* e) {
	Tsym223841* cp;
	cp = getenvparam_404607(fn);
	{
		Tident196021* LOC5;
		if (!(cp == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = getident_196463(((NimStringDesc*) &TMP3449));
		cp = newsym_224656(((NU8) 3), LOC5, fn, (*fn).info);
		(*cp).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
		asgnRefNoCycle((void**) (&(*cp).typ), newtype_226140(((NU8) 22), fn));
		rawaddson_227498((*cp).typ, (*e).obj);
		addhiddenparam_404124(fn, cp);
	}
	LA3: ;
}

N_NIMCALL(void, addcapturedvar_405215)(Tenv404020* e, Tsym223841* v) {
{	{
		Tsym223841* x_405228;
		Tsymseq223811* HEX3Atmp_405251;
		NI i_405254;
		NI L_405256;
		x_405228 = 0;
		HEX3Atmp_405251 = 0;
		HEX3Atmp_405251 = (*e).capturedvars;
		i_405254 = ((NI) 0);
		L_405256 = (HEX3Atmp_405251 ? HEX3Atmp_405251->Sup.len : 0);
		{
			while (1) {
				if (!(i_405254 < L_405256)) goto LA3;
				x_405228 = HEX3Atmp_405251->data[i_405254];
				{
					if (!(x_405228 == v)) goto LA6;
					goto BeforeRet;
				}
				LA6: ;
				i_405254 += ((NI) 1);
			} LA3: ;
		}
	}
	(*e).capturedvars = (Tsymseq223811*) incrSeqV2(&((*e).capturedvars)->Sup, sizeof(Tsym223841*));
	asgnRefNoCycle((void**) (&(*e).capturedvars->data[(*e).capturedvars->Sup.len]), v);
	++(*e).capturedvars->Sup.len;
	addfield_400809((*e).obj, v);
	}BeforeRet: ;
}

N_NIMCALL(NIM_BOOL, capturevar_405638)(Toutercontext404022* o, Tenv404020* top, Tsym223841* local, Tlineinfo188352 info) {
	NIM_BOOL result;
	Tenv404020* it;
{	result = 0;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				LOC5 = 0;
				LOC5 = contains_220829((*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_405375(local);
		if (LOC14) goto LA15;
		LOC14 = !(((257 &(1<<(((*(*(*top).fn).typ).callconv)&15)))!=0));
		LA15: ;
		if (!LOC14) goto LA16;
		localerror_194128(info, ((NU16) 227), (*(*local).name).s);
	}
	LA16: ;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA19;
			{
				NIM_BOOL LOC22;
				LOC22 = 0;
				LOC22 = contains_220829((*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_405621((*it).obj, (*(*it).up).obj));
			}
			LA31: ;
			{
				Tenv404020* 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_405338((*it).fn, u);
				{
					Tidobj196015* LOC43;
					TNimObject* LOC44;
					LOC43 = 0;
					LOC43 = &(*it).fn->Sup;
					LOC44 = 0;
					LOC44 = idtableget_231182((*o).lambdastoenv, LOC43);
					if (!(LOC44 == NIM_NIL)) goto LA45;
					{
						Tidobj196015* LOC51;
						TNimObject* LOC52;
						if (!!((u == NIM_NIL))) goto LA49;
						LOC51 = 0;
						LOC51 = &(*it).fn->Sup;
						LOC52 = 0;
						LOC52 = &u->Sup;
						idtableput_231196((&(*o).lambdastoenv), LOC51, LOC52);
					}
					LA49: ;
				}
				LA45: ;
			}
			LA35: ;
			it = (*it).up;
		} LA19: ;
	} LA18: ;
	incl_220856((&(*o).capturedvars), (*local).Sup.id);
	addcapturedvar_405215(it, local);
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI, gathervars_405870)(Toutercontext404022* o, Tenv404020* e, Tnode223809* n) {
	NI result;
{	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = ((NI) 0);
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		Tsym223841* s;
		s = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = interestingvar_405406(s);
			if (!(LOC8)) goto LA9;
			LOC8 = !(((*e).fn == (*s).owner));
			LA9: ;
			if (!LOC8) goto LA10;
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = capturevar_405638(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_405934;
			NI HEX3Atmp_405946;
			NI LOC20;
			NI res_405949;
			k_405934 = 0;
			HEX3Atmp_405946 = 0;
			LOC20 = 0;
			LOC20 = sonslen_226387(n);
			HEX3Atmp_405946 = (NI)(LOC20 - ((NI) 1));
			res_405949 = ((NI) 0);
			{
				while (1) {
					NI LOC23;
					if (!(res_405949 <= HEX3Atmp_405946)) goto LA22;
					k_405934 = res_405949;
					LOC23 = 0;
					LOC23 = gathervars_405870(o, e, (*n).kindU.S6.sons->data[k_405934]);
					result += LOC23;
					res_405949 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym223841*, newiterresult_404093)(Tsym223841* iter) {
	Tsym223841* result;
	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_224098((*iter).ast);
		if (!(((NI) 7) < LOC3)) goto LA4;
		result = (*(*(*iter).ast).kindU.S6.sons->data[((NI) 7)]).kindU.S4.sym;
	}
	goto LA1;
	LA4: ;
	{
		Tident196021* LOC7;
		Tnode223809* LOC8;
		LOC7 = 0;
		LOC7 = getident_196463(((NimStringDesc*) &TMP3455));
		result = newsym_224656(((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_225325(result);
		add_224165((*iter).ast, LOC8);
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, inititer_404807)(Tsym223841* iter, Titer404016* Result) {
	unsureAsgnRef((void**) (&(*Result).fn), iter);
	{
		Tsym223841* cp;
		Tnode223809* LOC17;
		if (!((*iter).kind == ((NU8) 15))) goto LA3;
		cp = getenvparam_404607(iter);
		{
			Tident196021* LOC9;
			if (!(cp == NIM_NIL)) goto LA7;
			unsureAsgnRef((void**) (&(*Result).obj), createenvobj_404082(iter));
			LOC9 = 0;
			LOC9 = getident_196463(((NimStringDesc*) &TMP3449));
			cp = newsym_224656(((NU8) 3), LOC9, iter, (*iter).info);
			(*cp).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
			asgnRefNoCycle((void**) (&(*cp).typ), newtype_226140(((NU8) 22), iter));
			rawaddson_227498((*cp).typ, (*Result).obj);
			addhiddenparam_404124(iter, cp);
		}
		goto LA5;
		LA7: ;
		{
			unsureAsgnRef((void**) (&(*Result).obj), (*(*cp).typ).sons->data[((NI) 0)]);
		}
		LA5: ;
		{
			NI LOC13;
			NimStringDesc* LOC16;
			LOC13 = 0;
			LOC13 = len_224098((*(*Result).obj).n);
			if (!!((((NI) 0) < LOC13))) goto LA14;
			LOC16 = 0;
			LOC16 = HEX24_194279(TMP3454);
			internalerror_194191(LOC16);
		}
		LA14: ;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_224244((*(*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_404093(iter));
		}
		LA20: ;
	}
	LA3: ;
}

N_NIMCALL(Tnode223809*, newclosurecreationvar_406062)(Tenv404020* e) {
	Tnode223809* result;
	Tsym223841* v;
	Tident196021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_196463(((NimStringDesc*) &TMP3453));
	v = newsym_224656(((NU8) 8), LOC1, (*e).fn, (*(*e).attachednode).info);
	(*v).flags |= ((NU32)1)<<((((NU8) 21))%(sizeof(NU32)*8));
	asgnRefNoCycle((void**) (&(*v).typ), newtype_226140(((NU8) 22), (*e).fn));
	rawaddson_227498((*v).typ, (*e).obj);
	{
		Titer404016 it;
		Tnode223809* 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_404807((*e).fn, (&it));
		adduniquefield_401008(it.obj, v);
		LOC6 = 0;
		LOC6 = newsymnode_225325(it.closureparam);
		result = indirectaccess_402038(LOC6, v, (*v).info);
	}
	goto LA2;
	LA4: ;
	{
		result = newsymnode_225325(v);
	}
	LA2: ;
	return result;
}

N_NIMCALL(Tnode223809*, getclosurevar_406097)(Tenv404020* e) {
	Tnode223809* result;
	result = 0;
	{
		if (!((*e).createdvar == NIM_NIL)) goto LA3;
		result = newclosurecreationvar_406062(e);
		asgnRefNoCycle((void**) (&(*e).createdvar), result);
	}
	goto LA1;
	LA3: ;
	{
		result = (*e).createdvar;
	}
	LA1: ;
	return result;
}

N_NIMCALL(Tenv404020*, findenv_406119)(Toutercontext404022* o, Tsym223841* s) {
	Tenv404020* result;
	Tenv404020* 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_194279(TMP3458);
		internalerror_194191(LOC13);
	}
	LA11: ;
	result = (*env).up;
	{
		while (1) {
			if (!((*result).fn == s)) goto LA15;
			result = (*result).up;
		} LA15: ;
	}
	return result;
}

N_NIMCALL(Tnode223809*, nestedaccess_405438)(Tenv404020* top, Tsym223841* local) {
	Tnode223809* result;
	Tenv404020* it;
	Tsym223841* envparam;
	Tnode223809* access;
{	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_405406(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_220829((*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_404607((*top).fn);
	{
		NimStringDesc* LOC23;
		if (!!(!(envparam == 0))) goto LA21;
		LOC23 = 0;
		LOC23 = HEX24_194279(TMP3459);
		internalerror_194191(LOC23);
	}
	LA21: ;
	access = newsymnode_225325(envparam);
	it = (*top).up;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA25;
			{
				NIM_BOOL LOC28;
				LOC28 = 0;
				LOC28 = contains_220829((*it).vars, (*local).Sup.id);
				if (!LOC28) goto LA29;
				access = indirectaccess_402038(access, local, (*local).info);
				result = access;
				goto BeforeRet;
			}
			LA29: ;
			{
				NimStringDesc* LOC35;
				if (!!(!(((*it).upfield == NIM_NIL)))) goto LA33;
				LOC35 = 0;
				LOC35 = HEX24_194279(TMP3460);
				internalerror_194191(LOC35);
			}
			LA33: ;
			access = indirectaccess_402038(access, (*it).upfield, (*local).info);
			it = (*it).up;
		} LA25: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode223809*, transforminnerproc_406210)(Toutercontext404022* o, Tenv404020* e, Tnode223809* n) {
	Tnode223809* result;
	result = 0;
	switch ((*n).kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		Tsym223841* s;
		s = (*n).kindU.S4.sym;
		{
			Tsym223841* LOC7;
			Tnode223809* LOC8;
			if (!(s == (*e).fn)) goto LA5;
			LOC7 = 0;
			LOC7 = getenvparam_404607(s);
			LOC8 = 0;
			LOC8 = newsymnode_225325(LOC7);
			result = makeclosure_406034(s, LOC8, (*n).info);
		}
		goto LA3;
		LA5: ;
		{
			NIM_BOOL LOC10;
			Tenv404020* LOC14;
			Tnode223809* LOC15;
			LOC10 = 0;
			LOC10 = isinnerproc_405286(s, (*o).fn);
			if (!(LOC10)) goto LA11;
			LOC10 = ((*(*s).typ).callconv == ((NU8) 8));
			LA11: ;
			if (!LOC10) goto LA12;
			LOC14 = 0;
			LOC14 = findenv_406119(o, s);
			LOC15 = 0;
			LOC15 = getclosurevar_406097(LOC14);
			result = makeclosure_406034(s, LOC15, (*n).info);
		}
		goto LA3;
		LA12: ;
		{
			result = nestedaccess_405438(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_406273;
			NI HEX3Atmp_406290;
			NI LOC20;
			NI res_406293;
			j_406273 = 0;
			HEX3Atmp_406290 = 0;
			LOC20 = 0;
			LOC20 = sonslen_226387(n);
			HEX3Atmp_406290 = (NI)(LOC20 - ((NI) 1));
			res_406293 = ((NI) 0);
			{
				while (1) {
					Tnode223809* x;
					if (!(res_406293 <= HEX3Atmp_406290)) goto LA22;
					j_406273 = res_406293;
					x = transforminnerproc_406210(o, e, (*n).kindU.S6.sons->data[j_406273]);
					{
						if (!!((x == NIM_NIL))) goto LA25;
						asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[j_406273]), x);
					}
					LA25: ;
					res_406293 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	}
	return result;
}

N_NIMCALL(void, searchforinnerprocs_406423)(Toutercontext404022* o, Tnode223809* n, Tenv404020* 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):
	{
		Tsym223841* fn;
		fn = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC9;
			NIM_BOOL LOC11;
			Tnode223809* body;
			Tnode223809* ex;
			Tenv404020* envb;
			NI capturedcounter;
			LOC9 = 0;
			LOC9 = isinnerproc_405286(fn, (*o).fn);
			if (!(LOC9)) goto LA10;
			LOC11 = 0;
			LOC11 = containsorincl_220898((&(*o).processed), (*fn).Sup.id);
			LOC9 = !(LOC11);
			LA10: ;
			if (!LOC9) goto LA12;
			body = getbody_269062(fn);
			ex = closurecreationpoint_406312(body);
			envb = newenv_405049(o, env, ex, fn);
			addparamstoenv_406343(fn, envb);
			searchforinnerprocs_406423(o, body, envb);
			asgnRefNoCycle((void**) (&(*(*fn).ast).kindU.S6.sons->data[((NI) 6)]), ex);
			capturedcounter = gathervars_405870(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;
				{
					Tidobj196015* LOC22;
					TNimObject* LOC23;
					Tidobj196015* LOC26;
					TNimObject* LOC27;
					LOC22 = 0;
					LOC22 = &fn->Sup;
					LOC23 = 0;
					LOC23 = idtableget_231182((*o).lambdastoenv, LOC22);
					if (!(LOC23 == NIM_NIL)) goto LA24;
					LOC26 = 0;
					LOC26 = &fn->Sup;
					LOC27 = 0;
					LOC27 = &env->Sup;
					idtableput_231196((&(*o).lambdastoenv), LOC26, LOC27);
				}
				LA24: ;
				addclosureparam_405338(fn, env);
			}
			goto LA14;
			LA18: ;
			{
				Tsym223841* LOC29;
				Tnode223809* ti;
				LOC29 = 0;
				LOC29 = getenvparam_404607(fn);
				if (!!((LOC29 == NIM_NIL))) goto LA30;
				ti = transforminnerproc_406210(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_406423(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;
			Tnode223809* ex;
			Tenv404020* LOC50;
			if (!!(((*(*env).fn).kind == ((NU8) 15)))) goto LA44;
			LOC46 = 0;
			LOC46 = len_224098(n);
			body = (NI)(LOC46 - ((NI) 1));
			{
				NI i_406558;
				NI HEX3Atmp_406681;
				NI res_406684;
				i_406558 = 0;
				HEX3Atmp_406681 = 0;
				HEX3Atmp_406681 = (NI)(body - ((NI) 1));
				res_406684 = ((NI) 0);
				{
					while (1) {
						if (!(res_406684 <= HEX3Atmp_406681)) goto LA49;
						i_406558 = res_406684;
						searchforinnerprocs_406423(o, (*n).kindU.S6.sons->data[i_406558], env);
						res_406684 += ((NI) 1);
					} LA49: ;
				}
			}
			ex = closurecreationpoint_406312((*n).kindU.S6.sons->data[body]);
			LOC50 = 0;
			LOC50 = newenv_405049(o, env, ex, (*env).fn);
			searchforinnerprocs_406423(o, (*n).kindU.S6.sons->data[body], LOC50);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[body]), ex);
		}
		goto LA42;
		LA44: ;
		{
			{
				NI i_406576;
				NI HEX3Atmp_406689;
				NI LOC53;
				NI res_406692;
				i_406576 = 0;
				HEX3Atmp_406689 = 0;
				LOC53 = 0;
				LOC53 = sonslen_226387(n);
				HEX3Atmp_406689 = (NI)(LOC53 - ((NI) 1));
				res_406692 = ((NI) 0);
				{
					while (1) {
						if (!(res_406692 <= HEX3Atmp_406689)) goto LA55;
						i_406576 = res_406692;
						searchforinnerprocs_406423(o, (*n).kindU.S6.sons->data[i_406576], env);
						res_406692 += ((NI) 1);
					} LA55: ;
				}
			}
		}
		LA42: ;
	}
	break;
	case ((NU8) 99):
	case ((NU8) 100):
	{
		{
			NI i_406590;
			NI HEX3Atmp_406705;
			NI LOC58;
			NI res_406708;
			i_406590 = 0;
			HEX3Atmp_406705 = 0;
			LOC58 = 0;
			LOC58 = sonslen_226387(n);
			HEX3Atmp_406705 = (NI)(LOC58 - ((NI) 1));
			res_406708 = ((NI) 0);
			{
				while (1) {
					Tnode223809* it;
					if (!(res_406708 <= HEX3Atmp_406705)) goto LA60;
					i_406590 = res_406708;
					it = (*n).kindU.S6.sons->data[i_406590];
					{
						if (!((*it).kind == ((NU8) 125))) goto LA63;
					}
					goto LA61;
					LA63: ;
					{
						NI L;
						if (!((*it).kind == ((NU8) 35))) goto LA66;
						L = sonslen_226387(it);
						{
							if (!((*(*it).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 3))) goto LA70;
							incl_220856((&(*env).vars), (*(*(*it).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym).Sup.id);
						}
						LA70: ;
						searchforinnerprocs_406423(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_226387(it);
						{
							NI j_406649;
							NI HEX3Atmp_406698;
							NI res_406701;
							j_406649 = 0;
							HEX3Atmp_406698 = 0;
							HEX3Atmp_406698 = (NI)(L - ((NI) 3));
							res_406701 = ((NI) 0);
							{
								while (1) {
									if (!(res_406701 <= HEX3Atmp_406698)) goto LA77;
									j_406649 = res_406701;
									{
										if (!((*(*it).kindU.S6.sons->data[j_406649]).kind == ((NU8) 3))) goto LA80;
										incl_220856((&(*env).vars), (*(*(*it).kindU.S6.sons->data[j_406649]).kindU.S4.sym).Sup.id);
									}
									LA80: ;
									res_406701 += ((NI) 1);
								} LA77: ;
							}
						}
						searchforinnerprocs_406423(o, (*it).kindU.S6.sons->data[(NI)(L - ((NI) 1))], env);
					}
					goto LA61;
					LA73: ;
					{
						internalerror_194172((*it).info, ((NimStringDesc*) &TMP3461));
					}
					LA61: ;
					res_406708 += ((NI) 1);
				} LA60: ;
			}
		}
	}
	break;
	case ((NU8) 155):
	{
		searchforinnerprocs_406423(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_406678;
			NI HEX3Atmp_406713;
			NI LOC87;
			NI res_406716;
			i_406678 = 0;
			HEX3Atmp_406713 = 0;
			LOC87 = 0;
			LOC87 = sonslen_226387(n);
			HEX3Atmp_406713 = (NI)(LOC87 - ((NI) 1));
			res_406716 = ((NI) 0);
			{
				while (1) {
					if (!(res_406716 <= HEX3Atmp_406713)) goto LA89;
					i_406678 = res_406716;
					searchforinnerprocs_406423(o, (*n).kindU.S6.sons->data[i_406678], env);
					res_406716 += ((NI) 1);
				} LA89: ;
			}
		}
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(Tnode223809*, newasgnstmt_406771)(Tnode223809* le, Tnode223809* ri, Tlineinfo188352 info) {
	Tnode223809* result;
	result = 0;
	result = newnodei_225407(((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(Tnode223809*, rawclosurecreation_406785)(Toutercontext404022* o, Tenv404020* scope, Tnode223809* env) {
	Tnode223809* result;
	Tsym223841* LOC5;
	Tnode223809* LOC6;
	result = 0;
	result = newnodei_225351(((NU8) 115), (*env).info);
	{
		Tnode223809* v;
		if (!((*env).kind == ((NU8) 3))) goto LA3;
		v = newnodei_225351(((NU8) 99), (*env).info);
		addvar_400047(v, env);
		add_224165(result, v);
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = getsyssym_272077(((NimStringDesc*) &TMP3408));
	LOC6 = 0;
	LOC6 = newcall_405272(LOC5, env);
	add_224165(result, LOC6);
	{
		Tsym223841* local_406812;
		Tsymseq223811* HEX3Atmp_406862;
		NI i_406865;
		NI L_406867;
		local_406812 = 0;
		HEX3Atmp_406862 = 0;
		HEX3Atmp_406862 = (*scope).capturedvars;
		i_406865 = ((NI) 0);
		L_406867 = (HEX3Atmp_406862 ? HEX3Atmp_406862->Sup.len : 0);
		{
			while (1) {
				Tnode223809* fieldaccess;
				Tnode223809* existing;
				Tidobj196015* LOC16;
				if (!(i_406865 < L_406867)) goto LA9;
				local_406812 = HEX3Atmp_406862->data[i_406865];
				fieldaccess = indirectaccess_402038(env, local_406812, (*env).info);
				{
					Tnode223809* LOC14;
					Tnode223809* LOC15;
					if (!((*local_406812).kind == ((NU8) 3))) goto LA12;
					LOC14 = 0;
					LOC14 = newsymnode_225325(local_406812);
					LOC15 = 0;
					LOC15 = newasgnstmt_406771(fieldaccess, LOC14, (*env).info);
					add_224165(result, LOC15);
				}
				LA12: ;
				LOC16 = 0;
				LOC16 = &local_406812->Sup;
				existing = idnodetableget_231212((*o).localstoaccess, LOC16);
				{
					Tidobj196015* LOC21;
					if (!existing == 0) goto LA19;
					LOC21 = 0;
					LOC21 = &local_406812->Sup;
					idnodetableput_231219((&(*o).localstoaccess), LOC21, fieldaccess);
				}
				goto LA17;
				LA19: ;
				{
					Tnode223809* LOC23;
					LOC23 = 0;
					LOC23 = newasgnstmt_406771(fieldaccess, existing, (*env).info);
					add_224165(result, LOC23);
				}
				LA17: ;
				i_406865 += ((NI) 1);
			} LA9: ;
		}
	}
	{
		if (!!(((*scope).upfield == NIM_NIL))) goto LA26;
		{
			Tnode223809* LOC32;
			Tsym223841* LOC33;
			Tnode223809* LOC34;
			Tnode223809* LOC35;
			if (!!(((*(*scope).up).fn == (*scope).fn))) goto LA30;
			LOC32 = 0;
			LOC32 = indirectaccess_402038(env, (*scope).upfield, (*env).info);
			LOC33 = 0;
			LOC33 = getenvparam_404607((*scope).fn);
			LOC34 = 0;
			LOC34 = newsymnode_225325(LOC33);
			LOC35 = 0;
			LOC35 = newasgnstmt_406771(LOC32, LOC34, (*env).info);
			add_224165(result, LOC35);
		}
		goto LA28;
		LA30: ;
		{
			Tnode223809* LOC37;
			Tnode223809* LOC38;
			Tnode223809* LOC39;
			LOC37 = 0;
			LOC37 = indirectaccess_402038(env, (*scope).upfield, (*env).info);
			LOC38 = 0;
			LOC38 = getclosurevar_406097((*scope).up);
			LOC39 = 0;
			LOC39 = newasgnstmt_406771(LOC37, LOC38, (*env).info);
			add_224165(result, LOC39);
		}
		LA28: ;
	}
	LA26: ;
	return result;
}

N_NIMCALL(Tnode223809*, generateclosurecreation_406883)(Toutercontext404022* o, Tenv404020* scope) {
	Tnode223809* result;
	Tnode223809* env;
	result = 0;
	env = getclosurevar_406097(scope);
	result = rawclosurecreation_406785(o, scope, env);
	return result;
}

N_NIMCALL(void, createenvironments_408010)(Toutercontext404022* o) {
	Tenv404020* env;
	env = (*o).head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				Tnode223809* 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_406883(o, env));
				}
				LA11: ;
			}
			LA7: ;
			env = (*env).next;
		} LA2: ;
	}
}

static N_INLINE(NIM_BOOL, interestingitervar_407044)(Tsym223841* 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(Tnode223809*, liftitersym_407731)(Tnode223809* n, Tsym223841* owner) {
	Tnode223809* result;
	Tsym223841* iter;
	Tsym223841* hp;
	Tsym223841* env;
	Tnode223809* v;
	Tnode223809* LOC1;
	Tnode223809* envasnode;
	Tsym223841* LOC2;
	Tnode223809* LOC3;
	Tnode223809* LOC4;
	result = 0;
	iter = (*n).kindU.S4.sym;
	result = newnodeit_225807(((NU8) 126), (*n).info, (*n).typ);
	hp = gethiddenparam_404407(iter);
	env = newsym_224656(((NU8) 9), (*iter).name, owner, (*n).info);
	asgnRefNoCycle((void**) (&(*env).typ), (*hp).typ);
	(*env).flags = (*hp).flags;
	v = newnodei_225351(((NU8) 99), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_225325(env);
	addvar_400047(v, LOC1);
	add_224165(result, v);
	envasnode = newsymnode_225325(env);
	LOC2 = 0;
	LOC2 = getsyssym_272077(((NimStringDesc*) &TMP3408));
	LOC3 = 0;
	LOC3 = newcall_405272(LOC2, envasnode);
	add_224165(result, LOC3);
	LOC4 = 0;
	LOC4 = makeclosure_406034(iter, envasnode, (*n).info);
	add_224165(result, LOC4);
	return result;
}

N_NIMCALL(Tnode223809*, generateiterclosurecreation_406895)(Toutercontext404022* o, Tenv404020* env, Tnode223809* scope) {
	Tnode223809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode223809* cc;
		Tnode223809* insertpoint;
		LOC3 = 0;
		LOC3 = (*env).createdvarcomesfromiter;
		if (LOC3) goto LA4;
		LOC3 = (*env).createdvar == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = newclosurecreationvar_406062(env);
		cc = rawclosurecreation_406785(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: ;
		{
			{
				Tnode223809* x_407001;
				x_407001 = 0;
				{
					NI i_407019;
					NI HEX3Atmp_407021;
					NI LOC14;
					NI res_407023;
					i_407019 = 0;
					HEX3Atmp_407021 = 0;
					LOC14 = 0;
					LOC14 = len_224098(cc);
					HEX3Atmp_407021 = (LOC14 - 1);
					res_407023 = ((NI) 0);
					{
						while (1) {
							if (!(res_407023 <= HEX3Atmp_407021)) goto LA16;
							i_407019 = res_407023;
							x_407001 = (*cc).kindU.S6.sons->data[i_407019];
							add_224165(insertpoint, x_407001);
							res_407023 += ((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(Tnode223809*, generatethunk_405968)(Tnode223809* prc, Ttype223847* dest) {
	Tnode223809* result;
	Tnode223809* conv;
	Ttype223847* LOC5;
	Tnode223809* LOC6;
{	result = 0;
	{
		if (!(gcmd_165134 == ((NU8) 4))) goto LA3;
		result = prc;
		goto BeforeRet;
	}
	LA3: ;
	result = newnodeit_225807(((NU8) 155), (*prc).info, dest);
	conv = newnodeit_225807(((NU8) 58), (*prc).info, dest);
	add_224165(conv, emptynode_224807);
	add_224165(conv, prc);
	add_224165(result, conv);
	LOC5 = 0;
	LOC5 = getsystype_272190(((NU8) 5));
	LOC6 = 0;
	LOC6 = newnodeit_225807(((NU8) 23), (*prc).info, LOC5);
	add_224165(result, LOC6);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode223809*, transformouterconv_405993)(Tnode223809* n) {
	Tnode223809* result;
	Ttype223847* dest;
	Ttype223847* source;
	result = 0;
	dest = skiptypes_227167((*n).typ, IL64(211106242013440));
	source = skiptypes_227167((*(*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_405968((*n).kindU.S6.sons->data[((NI) 1)], dest);
		}
		LA9: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(Tnode223809*, transformyield_407084)(Toutercontext404022* c, Tnode223809* n, Titer404016* it) {
	Tnode223809* result;
	NI64 stateno;
	Tnode223809* stateasgnstmt;
	Tnode223809* LOC1;
	Tnode223809* LOC2;
	Ttype223847* LOC3;
	Tnode223809* LOC4;
	Tnode223809* retstmt;
	Tnode223809* statelabelstmt;
	Ttype223847* LOC17;
	Tnode223809* 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_225351(((NU8) 73), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_225325((*it).closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_400608(LOC1, (*it).state, (*n).info);
	add_224165(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_272190(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_224620(((NU8) 6), stateno, LOC3);
	add_224165(stateasgnstmt, LOC4);
	retstmt = newnodei_225351(((NU8) 109), (*n).info);
	{
		Tnode223809* a;
		Tnode223809* retval;
		Tnode223809* LOC9;
		Tnode223809* LOC10;
		if (!!(((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 1)))) goto LA7;
		a = newnodei_225351(((NU8) 73), (*(*n).kindU.S6.sons->data[((NI) 0)]).info);
		retval = transformouterproc_407076(c, (*n).kindU.S6.sons->data[((NI) 0)], it);
		LOC9 = 0;
		LOC9 = newsymnode_225325((*it).resultsym);
		addson_225819(a, LOC9);
		LOC10 = 0;
		{
			if (!retval == 0) goto LA13;
			LOC10 = (*n).kindU.S6.sons->data[((NI) 0)];
		}
		goto LA11;
		LA13: ;
		{
			LOC10 = retval;
		}
		LA11: ;
		addson_225819(a, LOC10);
		add_224165(retstmt, a);
	}
	goto LA5;
	LA7: ;
	{
		add_224165(retstmt, emptynode_224807);
	}
	LA5: ;
	statelabelstmt = newnodei_225351(((NU8) 157), (*n).info);
	LOC17 = 0;
	LOC17 = getsystype_272190(((NU8) 31));
	LOC18 = 0;
	LOC18 = newinttypenode_224620(((NU8) 6), stateno, LOC17);
	add_224165(statelabelstmt, LOC18);
	result = newnodei_225351(((NU8) 115), (*n).info);
	add_224165(result, stateasgnstmt);
	add_224165(result, retstmt);
	add_224165(result, statelabelstmt);
	return result;
}

N_NIMCALL(void, outerprocsons_407675)(Toutercontext404022* o, Tnode223809* n, Titer404016* it) {
	{
		NI i_407692;
		NI HEX3Atmp_407709;
		NI LOC2;
		NI res_407712;
		i_407692 = 0;
		HEX3Atmp_407709 = 0;
		LOC2 = 0;
		LOC2 = sonslen_226387(n);
		HEX3Atmp_407709 = (NI)(LOC2 - ((NI) 1));
		res_407712 = ((NI) 0);
		{
			while (1) {
				Tnode223809* x;
				if (!(res_407712 <= HEX3Atmp_407709)) goto LA4;
				i_407692 = res_407712;
				x = transformouterproc_407076(o, (*n).kindU.S6.sons->data[i_407692], it);
				{
					if (!!((x == NIM_NIL))) goto LA7;
					asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_407692]), x);
				}
				LA7: ;
				res_407712 += ((NI) 1);
			} LA4: ;
		}
	}
}

N_NIMCALL(Tnode223809*, transformreturn_407658)(Toutercontext404022* c, Tnode223809* n, Titer404016* it) {
	Tnode223809* result;
	Tnode223809* stateasgnstmt;
	Tnode223809* LOC1;
	Tnode223809* LOC2;
	Ttype223847* LOC3;
	Tnode223809* LOC4;
	result = 0;
	result = newnodei_225351(((NU8) 115), (*n).info);
	stateasgnstmt = newnodei_225351(((NU8) 73), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_225325((*it).closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_400608(LOC1, (*it).state, (*n).info);
	add_224165(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_272190(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_224620(((NU8) 6), IL64(-1), LOC3);
	add_224165(stateasgnstmt, LOC4);
	add_224165(result, stateasgnstmt);
	add_224165(result, n);
	return result;
}

N_NIMCALL(Tnode223809*, transformouterproc_407076)(Toutercontext404022* o, Tnode223809* n, Titer404016* it) {
	Tnode223809* 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):
	{
		Tsym223841* local;
		Tenv404020* closure;
		Tidobj196015* LOC65;
		TNimObject* LOC66;
		Tidobj196015* LOC85;
		local = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC11;
			Tnode223809* body;
			Tnode223809* newbody;
			Titer404016 LOC15;
			LOC11 = 0;
			LOC11 = isinnerproc_405286(local, (*o).fn);
			if (!(LOC11)) goto LA12;
			LOC11 = contains_220829((*o).processed, (*local).Sup.id);
			LA12: ;
			if (!LOC11) goto LA13;
			excl_220871((&(*o).processed), (*local).Sup.id);
			body = getbody_269062(local);
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_404807(local, (&LOC15));
			newbody = transformouterprocbody_408614(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_407044(local);
			LA24: ;
			LOC22 = LOC23;
			if (!(LOC22)) goto LA25;
			LOC22 = ((*it).fn == (*local).owner);
			LA25: ;
			if (!LOC22) goto LA26;
			{
				NIM_BOOL LOC30;
				Tidobj196015* LOC33;
				LOC30 = 0;
				LOC30 = contains_220829((*o).capturedvars, (*local).Sup.id);
				if (!LOC30) goto LA31;
				LOC33 = 0;
				LOC33 = &local->Sup;
				result = idnodetableget_231212((*o).localstoaccess, LOC33);
				goto BeforeRet;
			}
			goto LA28;
			LA31: ;
			{
				Tnode223809* LOC35;
				adduniquefield_401008((*it).obj, local);
				LOC35 = 0;
				LOC35 = newsymnode_225325((*it).closureparam);
				result = indirectaccess_402038(LOC35, local, (*n).info);
				goto BeforeRet;
			}
			LA28: ;
		}
		LA26: ;
		{
			Tenv404020* closure;
			Tidobj196015* LOC40;
			TNimObject* LOC41;
			if (!((*local).kind == ((NU8) 15))) goto LA38;
			LOC40 = 0;
			LOC40 = &local->Sup;
			LOC41 = 0;
			LOC41 = idtableget_231182((*o).lambdastoenv, LOC40);
			closure = ((Tenv404020*) (LOC41));
			{
				if (!closure == 0) goto LA44;
				result = liftitersym_407731(n, (*o).fn);
				goto BeforeRet;
			}
			goto LA42;
			LA44: ;
			{
				Tnode223809* createdvar;
				Ttype223847* lpt;
				Tsym223841* LOC47;
				createdvar = generateiterclosurecreation_406895(o, closure, (*closure).attachednode);
				LOC47 = 0;
				LOC47 = gethiddenparam_404407(local);
				lpt = (*LOC47).typ;
				{
					if (!!((lpt == (*createdvar).typ))) goto LA50;
					{
						NIM_BOOL LOC54;
						NI LOC55;
						NI LOC57;
						LOC54 = 0;
						LOC55 = 0;
						LOC55 = len_226369((*(*createdvar).typ).sons->data[((NI) 0)]);
						LOC54 = (LOC55 == ((NI) 1));
						if (!(LOC54)) goto LA56;
						LOC57 = 0;
						LOC57 = len_226369((*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_194172((*n).info, ((NimStringDesc*) &TMP3462));
					}
					LA52: ;
				}
				LA50: ;
				result = makeclosure_406034(local, createdvar, (*n).info);
				goto BeforeRet;
			}
			LA42: ;
		}
		LA38: ;
		LOC65 = 0;
		LOC65 = &local->Sup;
		LOC66 = 0;
		LOC66 = idtableget_231182((*o).lambdastoenv, LOC65);
		closure = ((Tenv404020*) (LOC66));
		{
			Tnode223809* a;
			if (!!((closure == NIM_NIL))) goto LA69;
			a = (*closure).createdvar;
			{
				if (!!((a == NIM_NIL))) goto LA73;
				result = makeclosure_406034(local, a, (*n).info);
				goto BeforeRet;
			}
			goto LA71;
			LA73: ;
			{
				Tnode223809* scope;
				Tnode223809* 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_406883(o, closure));
				}
				LA78: ;
				x = (*closure).createdvar;
				result = makeclosure_406034(local, x, (*n).info);
				goto BeforeRet;
			}
			LA71: ;
		}
		LA69: ;
		{
			NIM_BOOL LOC82;
			LOC82 = 0;
			LOC82 = contains_220829((*o).capturedvars, (*local).Sup.id);
			if (!!(LOC82)) goto LA83;
			goto BeforeRet;
		}
		LA83: ;
		LOC85 = 0;
		LOC85 = &local->Sup;
		result = idnodetableget_231212((*o).localstoaccess, LOC85);
	}
	break;
	case ((NU8) 51):
	case ((NU8) 84):
	case ((NU8) 52):
	{
		{
			if (!!(((*n).typ == NIM_NIL))) goto LA89;
			result = transformouterproc_407076(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):
	{
		{
			Tsym223841* 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;
				Tnode223809* body;
				Tnode223809* newbody;
				Titer404016 LOC103;
				LOC99 = 0;
				LOC99 = isinnerproc_405286(local, (*o).fn);
				if (!(LOC99)) goto LA100;
				LOC99 = contains_220829((*o).processed, (*local).Sup.id);
				LA100: ;
				if (!LOC99) goto LA101;
				excl_220871((&(*o).processed), (*local).Sup.id);
				body = getbody_269062(local);
				memset((void*)(&LOC103), 0, sizeof(LOC103));
				inititer_404807(local, (&LOC103));
				newbody = transformouterprocbody_408614(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):
	{
		Tnode223809* x;
		x = transformouterproc_407076(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_405993(n);
	}
	break;
	case ((NU8) 104):
	{
		{
			if (!((*(*it).fn).kind == ((NU8) 15))) goto LA116;
			result = transformyield_407084(o, n, it);
		}
		goto LA114;
		LA116: ;
		{
			outerprocsons_407675(o, n, it);
		}
		LA114: ;
	}
	break;
	case ((NU8) 109):
	{
		{
			if (!((*(*it).fn).kind == ((NU8) 15))) goto LA122;
			result = transformreturn_407658(o, n, it);
		}
		goto LA120;
		LA122: ;
		{
			outerprocsons_407675(o, n, it);
		}
		LA120: ;
	}
	break;
	default:
	{
		outerprocsons_407675(o, n, it);
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode223809*, transformouterprocbody_408614)(Toutercontext404022* o, Tnode223809* n, Titer404016* it) {
	Tnode223809* result;
{	result = 0;
	{
		if (!(((*n).flags &(1<<((((NU8) 8))&15)))!=0)) goto LA3;
		result = NIM_NIL;
	}
	goto LA1;
	LA3: ;
	{
		Tnode223809* gs;
		Tnode223809* LOC35;
		Tnode223809* LOC36;
		Tnode223809* state0;
		Tnode223809* LOC37;
		Tnode223809* newbody;
		Tnode223809* stateasgnstmt;
		Tnode223809* LOC43;
		Tnode223809* LOC44;
		Ttype223847* LOC45;
		Tnode223809* 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_224098(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;
				Tnode223809* LOC26;
				Tnode223809* LOC28;
				NI LOC29;
				Tnode223809* LOC31;
				Tnode223809* LOC32;
				LOC21 = 0;
				LOC22 = 0;
				LOC23 = 0;
				LOC24 = 0;
				LOC24 = len_224098(n);
				LOC23 = (((NI) 1) < LOC24);
				if (!(LOC23)) goto LA25;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_224244(n, ((NI) 1));
				LOC23 = ((*LOC26).kind == ((NU8) 115));
				LA25: ;
				LOC22 = LOC23;
				if (!(LOC22)) goto LA27;
				LOC28 = 0;
				LOC28 = HEX5BHEX5D_224244(n, ((NI) 1));
				LOC29 = 0;
				LOC29 = len_224098(LOC28);
				LOC22 = (((NI) 0) < LOC29);
				LA27: ;
				LOC21 = LOC22;
				if (!(LOC21)) goto LA30;
				LOC31 = 0;
				LOC31 = HEX5BHEX5D_224244(n, ((NI) 1));
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_224244(LOC31, ((NI) 0));
				LOC21 = ((*LOC32).kind == ((NU8) 156));
				LA30: ;
				if (!LOC21) goto LA33;
				result = NIM_NIL;
				goto BeforeRet;
			}
			LA33: ;
		}
		LA13: ;
		result = newnodei_225351(((NU8) 115), (*(*it).fn).info);
		gs = newnodei_225351(((NU8) 156), (*(*it).fn).info);
		LOC35 = 0;
		LOC35 = newsymnode_225325((*it).closureparam);
		LOC36 = 0;
		LOC36 = rawindirectaccess_400608(LOC35, (*it).state, (*(*it).fn).info);
		add_224165(gs, LOC36);
		add_224165(result, gs);
		state0 = newnodei_225351(((NU8) 157), (*(*it).fn).info);
		LOC37 = 0;
		LOC37 = newintnode_224608(((NU8) 6), IL64(0));
		add_224165(state0, LOC37);
		add_224165(result, state0);
		newbody = transformouterproc_407076(o, n, it);
		{
			if (!!((newbody == NIM_NIL))) goto LA40;
			add_224165(result, newbody);
		}
		goto LA38;
		LA40: ;
		{
			add_224165(result, n);
		}
		LA38: ;
		stateasgnstmt = newnodei_225351(((NU8) 73), (*(*it).fn).info);
		LOC43 = 0;
		LOC43 = newsymnode_225325((*it).closureparam);
		LOC44 = 0;
		LOC44 = rawindirectaccess_400608(LOC43, (*it).state, (*(*it).fn).info);
		add_224165(stateasgnstmt, LOC44);
		LOC45 = 0;
		LOC45 = getsystype_272190(((NU8) 31));
		LOC46 = 0;
		LOC46 = newinttypenode_224620(((NU8) 6), IL64(-1), LOC45);
		add_224165(stateasgnstmt, LOC46);
		add_224165(result, stateasgnstmt);
		(*result).flags |= ((NU16)1)<<((((NU8) 8))%(sizeof(NU16)*8));
	}
	goto LA1;
	LA6: ;
	{
		result = transformouterproc_407076(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_408224)(Toutercontext404022* o) {
	Tenv404020* env;
	env = (*o).head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				Tnode223809* 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(Tnode223809*, liftlambdas_410240)(Tsym223841* fn, Tnode223809* body) {
	Tnode223809* 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;
		Tsym223841* LOC11;
		LOC5 = 0;
		LOC6 = 0;
		LOC6 = ((*body).kind == ((NU8) 1));
		if (LOC6) goto LA7;
		LOC8 = 0;
		LOC8 = (gcmd_165134 == ((NU8) 4));
		if (!(LOC8)) goto LA9;
		LOC8 = !(iscompiletime);
		LA9: ;
		LOC6 = LOC8;
		LA7: ;
		LOC5 = LOC6;
		if (LOC5) goto LA10;
		LOC11 = 0;
		LOC11 = skipgenericowner_228694(fn);
		LOC5 = !(((*LOC11).kind == ((NU8) 6)));
		LA10: ;
		if (!LOC5) goto LA12;
		result = body;
	}
	goto LA3;
	LA12: ;
	{
		Toutercontext404022* o;
		Tnode223809* ex;
		Tenv404020* env;
		o = newoutercontext_405029(fn);
		ex = closurecreationpoint_406312(body);
		env = newenv_405049(o, NIM_NIL, ex, fn);
		addparamstoenv_406343(fn, env);
		searchforinnerprocs_406423(o, body, env);
		createenvironments_408010(o);
		{
			Titer404016 LOC19;
			if (!((*fn).kind == ((NU8) 15))) goto LA17;
			memset((void*)(&LOC19), 0, sizeof(LOC19));
			inititer_404807(fn, (&LOC19));
			result = transformouterprocbody_408614(o, body, (&LOC19));
		}
		goto LA15;
		LA17: ;
		{
			Titer404016 LOC21;
			Tnode223809* LOC22;
			memset((void*)(&LOC21), 0, sizeof(LOC21));
			inititer_404807(fn, (&LOC21));
			LOC22 = 0;
			LOC22 = transformouterprocbody_408614(o, body, (&LOC21));
			result = ex;
		}
		LA15: ;
		finishenvironments_408224(o);
	}
	LA3: ;
	return result;
}

N_NIMCALL(Tnode223809*, liftlambdasfortoplevel_410312)(Tsym223841* module, Tnode223809* body) {
	Tnode223809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*body).kind == ((NU8) 1));
		if (LOC3) goto LA4;
		LOC3 = (gcmd_165134 == ((NU8) 4));
		LA4: ;
		if (!LOC3) goto LA5;
		result = body;
	}
	goto LA1;
	LA5: ;
	{
		Toutercontext404022* o;
		Tnode223809* ex;
		Tenv404020* env;
		Titer404016 LOC8;
		Tnode223809* LOC9;
		o = newoutercontext_405029(module);
		ex = closurecreationpoint_406312(body);
		env = newenv_405049(o, NIM_NIL, ex, module);
		searchforinnerprocs_406423(o, body, env);
		createenvironments_408010(o);
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		inititer_404807(module, (&LOC8));
		LOC9 = 0;
		LOC9 = transformouterproc_407076(o, body, (&LOC8));
		finishenvironments_408224(o);
		result = ex;
	}
	LA1: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_lambdaliftingInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, compiler_lambdaliftingDatInit000)(void) {
static TNimNode* TMP3445[6];
static TNimNode* TMP3446[11];
static TNimNode TMP1009[19];
NTI404022.size = sizeof(Toutercontext404022);
NTI404022.kind = 18;
NTI404022.base = 0;
TMP3445[0] = &TMP1009[1];
TMP1009[1].kind = 1;
TMP1009[1].offset = offsetof(Toutercontext404022, fn);
TMP1009[1].typ = (&NTI223807);
TMP1009[1].name = "fn";
TMP3445[1] = &TMP1009[2];
NTI404020.size = sizeof(Tenv404020);
NTI404020.kind = 17;
NTI404020.base = (&NTI4011);
TMP3446[0] = &TMP1009[4];
TMP1009[4].kind = 1;
TMP1009[4].offset = offsetof(Tenv404020, attachednode);
TMP1009[4].typ = (&NTI223801);
TMP1009[4].name = "attachedNode";
TMP3446[1] = &TMP1009[5];
TMP1009[5].kind = 1;
TMP1009[5].offset = offsetof(Tenv404020, replacementnode);
TMP1009[5].typ = (&NTI223801);
TMP1009[5].name = "replacementNode";
TMP3446[2] = &TMP1009[6];
TMP1009[6].kind = 1;
TMP1009[6].offset = offsetof(Tenv404020, createdvar);
TMP1009[6].typ = (&NTI223801);
TMP1009[6].name = "createdVar";
TMP3446[3] = &TMP1009[7];
TMP1009[7].kind = 1;
TMP1009[7].offset = offsetof(Tenv404020, createdvarcomesfromiter);
TMP1009[7].typ = (&NTI138);
TMP1009[7].name = "createdVarComesFromIter";
TMP3446[4] = &TMP1009[8];
TMP1009[8].kind = 1;
TMP1009[8].offset = offsetof(Tenv404020, capturedvars);
TMP1009[8].typ = (&NTI223811);
TMP1009[8].name = "capturedVars";
TMP3446[5] = &TMP1009[9];
TMP1009[9].kind = 1;
TMP1009[9].offset = offsetof(Tenv404020, up);
TMP1009[9].typ = (&NTI404018);
TMP1009[9].name = "up";
TMP3446[6] = &TMP1009[10];
TMP1009[10].kind = 1;
TMP1009[10].offset = offsetof(Tenv404020, next);
TMP1009[10].typ = (&NTI404018);
TMP1009[10].name = "next";
TMP3446[7] = &TMP1009[11];
TMP1009[11].kind = 1;
TMP1009[11].offset = offsetof(Tenv404020, upfield);
TMP1009[11].typ = (&NTI223807);
TMP1009[11].name = "upField";
TMP3446[8] = &TMP1009[12];
TMP1009[12].kind = 1;
TMP1009[12].offset = offsetof(Tenv404020, obj);
TMP1009[12].typ = (&NTI223805);
TMP1009[12].name = "obj";
TMP3446[9] = &TMP1009[13];
TMP1009[13].kind = 1;
TMP1009[13].offset = offsetof(Tenv404020, fn);
TMP1009[13].typ = (&NTI223807);
TMP1009[13].name = "fn";
TMP3446[10] = &TMP1009[14];
TMP1009[14].kind = 1;
TMP1009[14].offset = offsetof(Tenv404020, vars);
TMP1009[14].typ = (&NTI220056);
TMP1009[14].name = "vars";
TMP1009[3].len = 11; TMP1009[3].kind = 2; TMP1009[3].sons = &TMP3446[0];
NTI404020.node = &TMP1009[3];
NTI404018.size = sizeof(Tenv404020*);
NTI404018.kind = 22;
NTI404018.base = (&NTI404020);
NTI404018.marker = TMP3447;
TMP1009[2].kind = 1;
TMP1009[2].offset = offsetof(Toutercontext404022, head);
TMP1009[2].typ = (&NTI404018);
TMP1009[2].name = "head";
TMP3445[2] = &TMP1009[15];
TMP1009[15].kind = 1;
TMP1009[15].offset = offsetof(Toutercontext404022, capturedvars);
TMP1009[15].typ = (&NTI220056);
TMP1009[15].name = "capturedVars";
TMP3445[3] = &TMP1009[16];
TMP1009[16].kind = 1;
TMP1009[16].offset = offsetof(Toutercontext404022, processed);
TMP1009[16].typ = (&NTI220056);
TMP1009[16].name = "processed";
TMP3445[4] = &TMP1009[17];
TMP1009[17].kind = 1;
TMP1009[17].offset = offsetof(Toutercontext404022, localstoaccess);
TMP1009[17].typ = (&NTI223865);
TMP1009[17].name = "localsToAccess";
TMP3445[5] = &TMP1009[18];
TMP1009[18].kind = 1;
TMP1009[18].offset = offsetof(Toutercontext404022, lambdastoenv);
TMP1009[18].typ = (&NTI223859);
TMP1009[18].name = "lambdasToEnv";
TMP1009[0].len = 6; TMP1009[0].kind = 2; TMP1009[0].sons = &TMP3445[0];
NTI404022.node = &TMP1009[0];
NTI404014.size = sizeof(Toutercontext404022*);
NTI404014.kind = 22;
NTI404014.base = (&NTI404022);
NTI404014.marker = TMP3448;
}

