/* Generated by Nim Compiler v0.11.2 */
/*   (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 Tsym190843 Tsym190843;
typedef struct Tidobj167015 Tidobj167015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq190845 Ttypeseq190845;
typedef struct Tscope190837 Tscope190837;
typedef struct TY190944 TY190944;
typedef struct Tstrtable190817 Tstrtable190817;
typedef struct Tsymseq190815 Tsymseq190815;
typedef struct Ttype190849 Ttype190849;
typedef struct Tident167021 Tident167021;
typedef struct Tlineinfo163338 Tlineinfo163338;
typedef struct Tnode190813 Tnode190813;
typedef struct Tloc190827 Tloc190827;
typedef struct Ropeobj161009 Ropeobj161009;
typedef struct Tlib190831 Tlib190831;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tnodeseq190807 Tnodeseq190807;
typedef struct TY86345 TY86345;
typedef struct Tcell46347 Tcell46347;
typedef struct Tcellseq46363 Tcellseq46363;
typedef struct Tgcheap48216 Tgcheap48216;
typedef struct Tcellset46359 Tcellset46359;
typedef struct Tpagedesc46355 Tpagedesc46355;
typedef struct Tmemregion28210 Tmemregion28210;
typedef struct Tsmallchunk27440 Tsmallchunk27440;
typedef struct Tllchunk28204 Tllchunk28204;
typedef struct Tbigchunk27442 Tbigchunk27442;
typedef struct Tintset27417 Tintset27417;
typedef struct Ttrunk27413 Ttrunk27413;
typedef struct Tavlnode28208 Tavlnode28208;
typedef struct Tgcstat48214 Tgcstat48214;
typedef struct Toutercontext360022 Toutercontext360022;
typedef struct Tenv360020 Tenv360020;
typedef struct Intset187056 Intset187056;
typedef struct Ttrunk187052 Ttrunk187052;
typedef struct Ttrunkseq187054 Ttrunkseq187054;
typedef struct Tidnodetable190867 Tidnodetable190867;
typedef struct Tidnodepairseq190865 Tidnodepairseq190865;
typedef struct Tidtable190861 Tidtable190861;
typedef struct Tidpairseq190859 Tidpairseq190859;
typedef struct Titer360016 Titer360016;
typedef struct Tinstantiation190833 Tinstantiation190833;
typedef struct Tlistentry130022 Tlistentry130022;
typedef struct Tbasechunk27438 Tbasechunk27438;
typedef struct Tfreecell27430 Tfreecell27430;
typedef struct Tidnodepair190863 Tidnodepair190863;
typedef struct Tidpair190857 Tidpair190857;
typedef struct TY190933 TY190933;
typedef N_NIMCALL_PTR(void, TY3289) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3294) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3289 marker;
TY3294 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj167015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable190817  {
NI counter;
Tsymseq190815* data;
};
struct  Tlineinfo163338  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc190827  {
NU8 k;
NU8 s;
NU16 flags;
Ttype190849* t;
Ropeobj161009* r;
Ropeobj161009* heaproot;
};
struct  Tsym190843  {
  Tidobj167015 Sup;
NU8 kind;
union{
struct {Ttypeseq190845* typeinstcache;
Tscope190837* typscope;
} S1;
struct {TY190944* procinstcache;
Tsym190843* gcunsafetyreason;
} S2;
struct {TY190944* usedgenerics;
Tstrtable190817 tab;
} S3;
struct {Tsym190843* guard;
} S4;
} kindU;
NU16 magic;
Ttype190849* typ;
Tident167021* name;
Tlineinfo163338 info;
Tsym190843* owner;
NU32 flags;
Tnode190813* ast;
NU32 options;
NI position;
NI offset;
Tloc190827 loc;
Tlib190831* annex;
Tnode190813* constraint;
};
struct  Ttype190849  {
  Tidobj167015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq190845* sons;
Tnode190813* n;
Tsym190843* owner;
Tsym190843* sym;
Tsym190843* destructor;
Tsym190843* deepcopy;
Tsym190843* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc190827 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode190813  {
Ttype190849* typ;
Tlineinfo163338 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym190843* sym;
} S4;
struct {Tident167021* ident;
} S5;
struct {Tnodeseq190807* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct TY86345 {
NimStringDesc* Field0;
NI Field1;
};
struct  Tcell46347  {
NI refcount;
TNimType* typ;
};
struct  Tcellseq46363  {
NI len;
NI cap;
Tcell46347** d;
};
struct  Tcellset46359  {
NI counter;
NI max;
Tpagedesc46355* head;
Tpagedesc46355** data;
};
typedef Tsmallchunk27440* TY28222[512];
typedef Ttrunk27413* Ttrunkbuckets27415[256];
struct  Tintset27417  {
Ttrunkbuckets27415 data;
};
struct  Tmemregion28210  {
NI minlargeobj;
NI maxlargeobj;
TY28222 freesmallchunks;
Tllchunk28204* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Tbigchunk27442* freechunkslist;
Tintset27417 chunkstarts;
Tavlnode28208* root;
Tavlnode28208* deleted;
Tavlnode28208* last;
Tavlnode28208* freeavlnodes;
};
struct  Tgcstat48214  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Tgcheap48216  {
void* stackbottom;
NI cyclethreshold;
Tcellseq46363 zct;
Tcellseq46363 decstack;
Tcellset46359 cycleroots;
Tcellseq46363 tempstack;
NI recgclock;
Tmemregion28210 region;
Tgcstat48214 stat;
};
struct  Intset187056  {
NI counter;
NI max;
Ttrunk187052* head;
Ttrunkseq187054* data;
};
struct  Tidnodetable190867  {
NI counter;
Tidnodepairseq190865* data;
};
struct  Tidtable190861  {
NI counter;
Tidpairseq190859* data;
};
struct  Toutercontext360022  {
Tsym190843* fn;
Tenv360020* head;
Intset187056 capturedvars;
Intset187056 processed;
Tidnodetable190867 localstoaccess;
Tidtable190861 lambdastoenv;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tenv360020  {
  TNimObject Sup;
Tnode190813* attachednode;
Tnode190813* replacementnode;
Tnode190813* createdvar;
NIM_BOOL createdvarcomesfromiter;
Tsymseq190815* capturedvars;
Tenv360020* up;
Tenv360020* next;
Tsym190843* upfield;
Ttype190849* obj;
Tsym190843* fn;
Intset187056 vars;
};
struct  Tident167021  {
  Tidobj167015 Sup;
NimStringDesc* s;
Tident167021* next;
NI h;
};
struct  Titer360016  {
Tsym190843* fn;
Tsym190843* closureparam;
Tsym190843* state;
Tsym190843* resultsym;
Ttype190849* obj;
};
struct  Tscope190837  {
NI depthlevel;
Tstrtable190817 symbols;
Tnodeseq190807* usingsyms;
Tscope190837* parent;
};
struct  Ropeobj161009  {
  TNimObject Sup;
Ropeobj161009* left;
Ropeobj161009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry130022  {
  TNimObject Sup;
Tlistentry130022* prev;
Tlistentry130022* next;
};
struct  Tlib190831  {
  Tlistentry130022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj161009* name;
Tnode190813* path;
};
typedef NI TY27420[8];
struct  Tpagedesc46355  {
Tpagedesc46355* next;
NI key;
TY27420 bits;
};
struct  Tbasechunk27438  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Tsmallchunk27440  {
  Tbasechunk27438 Sup;
Tsmallchunk27440* next;
Tsmallchunk27440* prev;
Tfreecell27430* freelist;
NI free;
NI acc;
NF data;
};
struct  Tllchunk28204  {
NI size;
NI acc;
Tllchunk28204* next;
};
struct  Tbigchunk27442  {
  Tbasechunk27438 Sup;
Tbigchunk27442* next;
Tbigchunk27442* prev;
NI align;
NF data;
};
struct  Ttrunk27413  {
Ttrunk27413* next;
NI key;
TY27420 bits;
};
typedef Tavlnode28208* TY28214[2];
struct  Tavlnode28208  {
TY28214 link;
NI key;
NI upperbound;
NI level;
};
struct  Ttrunk187052  {
Ttrunk187052* next;
NI key;
TY27420 bits;
};
struct  Tidnodepair190863  {
Tidobj167015* key;
Tnode190813* val;
};
struct  Tidpair190857  {
Tidobj167015* key;
TNimObject* val;
};
struct  Tinstantiation190833  {
Tsym190843* sym;
Ttypeseq190845* concretetypes;
TY190933* usedby;
};
struct  Tfreecell27430  {
Tfreecell27430* next;
NI zerofield;
};
struct Tsymseq190815 {
  TGenericSeq Sup;
  Tsym190843* data[SEQ_DECL_SIZE];
};
struct Ttypeseq190845 {
  TGenericSeq Sup;
  Ttype190849* data[SEQ_DECL_SIZE];
};
struct TY190944 {
  TGenericSeq Sup;
  Tinstantiation190833* data[SEQ_DECL_SIZE];
};
struct Tnodeseq190807 {
  TGenericSeq Sup;
  Tnode190813* data[SEQ_DECL_SIZE];
};
struct Ttrunkseq187054 {
  TGenericSeq Sup;
  Ttrunk187052* data[SEQ_DECL_SIZE];
};
struct Tidnodepairseq190865 {
  TGenericSeq Sup;
  Tidnodepair190863 data[SEQ_DECL_SIZE];
};
struct Tidpairseq190859 {
  TGenericSeq Sup;
  Tidpair190857 data[SEQ_DECL_SIZE];
};
struct TY190933 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
static N_INLINE(NIM_BOOL, interestingvar_361406)(Tsym190843* s);
N_NIMCALL(NIM_BOOL, isgenericroutine_195652)(Tsym190843* s);
static N_INLINE(NI, len_191097)(Tnode190813* n);
static N_INLINE(Tnode190813*, HEX5BHEX5D_191244)(Tnode190813* n, NI i);
N_NIMCALL(void, internalerror_165218)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_165306)(TY86345 x);
N_NIMCALL(Tnode190813*, newnodei_192351)(NU8 kind, Tlineinfo163338 info);
N_NIMCALL(Tsym190843*, copysym_193607)(Tsym190843* s, NIM_BOOL keepid);
N_NIMCALL(Tsym190843*, gethiddenparam_360407)(Tsym190843* routine);
N_NIMCALL(Tnode190813*, lastson_193431)(Tnode190813* n);
N_NIMCALL(void, addvar_357047)(Tnode190813* father, Tnode190813* v);
N_NIMCALL(Tnode190813*, newsymnode_192325)(Tsym190843* sym);
N_NIMCALL(void, add_191164)(Tnode190813* father, Tnode190813* son);
N_NIMCALL(Tnode190813*, newcall_361272)(Tsym190843* a, Tnode190813* b);
N_NIMCALL(Tsym190843*, getsyssym_238054)(NimStringDesc* name);
N_NIMCALL(Tnode190813*, newnodei_192407)(NU8 kind, Tlineinfo163338 info, NI children);
N_NIMCALL(Tnode190813*, newinttypenode_191619)(NU8 kind, NI64 intval, Ttype190849* typ);
N_NIMCALL(Ttype190849*, getsystype_238030)(NU8 kind);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Tcell46347*, usrtocell_49846)(void* usr);
static N_INLINE(void, rtladdzct_51404)(Tcell46347* c);
N_NOINLINE(void, addzct_49817)(Tcellseq46363* s, Tcell46347* c);
N_NIMCALL(void, addson_192819)(Tnode190813* father, Tnode190813* son);
N_NIMCALL(Tnode190813*, makeclosure_362034)(Tsym190843* prc, Tnode190813* env, Tlineinfo163338 info);
N_NIMCALL(Tnode190813*, newnodeit_192807)(NU8 kind, Tlineinfo163338 info, Ttype190849* typ);
N_NIMCALL(Tsym190843*, skipgenericowner_195696)(Tsym190843* s);
N_NIMCALL(Toutercontext360022*, newoutercontext_361029)(Tsym190843* fn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3297)(void* p, NI op);
N_NIMCALL(void, TMP3298)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initintset_187927)(Intset187056* Result);
N_NIMCALL(void, initidnodetable_194127)(Tidnodetable190867* x);
N_NIMCALL(void, initidtable_194057)(Tidtable190861* x);
N_NIMCALL(Tnode190813*, closurecreationpoint_362312)(Tnode190813* n);
N_NIMCALL(Tenv360020*, newenv_361049)(Toutercontext360022* o, Tenv360020* up, Tnode190813* n, Tsym190843* 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_52222)(Tcell46347* c);
static N_INLINE(NIM_BOOL, canbecycleroot_49867)(Tcell46347* c);
static N_INLINE(void, rtladdcycleroot_50623)(Tcell46347* c);
N_NOINLINE(void, incl_47065)(Tcellset46359* s, Tcell46347* cell);
static N_INLINE(void, decref_51804)(Tcell46347* c);
N_NIMCALL(Tsym190843*, getenvparam_360607)(Tsym190843* routine);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(Ttype190849*, createenvobj_360082)(Tsym190843* owner);
N_NIMCALL(Ttype190849*, createobj_357270)(Tsym190843* owner, Tlineinfo163338 info);
N_NIMCALL(void, rawaddfield_357291)(Ttype190849* obj, Tsym190843* field);
N_NIMCALL(Tsym190843*, createstatefield_360070)(Tsym190843* iter);
N_NIMCALL(Tsym190843*, newsym_191655)(NU8 symkind, Tident167021* name, Tsym190843* owner, Tlineinfo163338 info);
N_NIMCALL(Tident167021*, getident_167463)(NimStringDesc* identifier);
N_NIMCALL(Ttype190849*, getstatetype_360049)(Tsym190843* iter);
N_NIMCALL(Tnode190813*, newintnode_191607)(NU8 kind, NI64 intval);
N_NIMCALL(Ttype190849*, newtype_193140)(NU8 kind, Tsym190843* owner);
N_NIMCALL(Ttype190849*, nilorsysint_238070)(void);
N_NIMCALL(void, rawaddson_194478)(Ttype190849* father, Ttype190849* son);
N_NIMCALL(void, addparamstoenv_362343)(Tsym190843* fn, Tenv360020* env);
N_NIMCALL(void, internalerror_165199)(Tlineinfo163338 info, NimStringDesc* errmsg);
N_NIMCALL(void, incl_187856)(Intset187056* s, NI key);
N_NIMCALL(NI, sonslen_193403)(Tnode190813* n);
N_NIMCALL(void, searchforinnerprocs_362423)(Toutercontext360022* o, Tnode190813* n, Tenv360020* env);
N_NIMCALL(NIM_BOOL, isinnerproc_361286)(Tsym190843* s, Tsym190843* outerproc);
N_NIMCALL(NIM_BOOL, containsorincl_187898)(Intset187056* s, NI key);
N_NIMCALL(Tnode190813*, getbody_235647)(Tsym190843* s);
N_NIMCALL(NI, gathervars_361870)(Toutercontext360022* o, Tenv360020* e, Tnode190813* n);
N_NIMCALL(NIM_BOOL, capturevar_361638)(Toutercontext360022* o, Tenv360020* top, Tsym190843* local, Tlineinfo163338 info);
N_NIMCALL(NIM_BOOL, contains_187829)(Intset187056* s, NI key);
static N_INLINE(NIM_BOOL, illegalcapture_361375)(Tsym190843* s);
N_NIMCALL(Ttype190849*, skiptypes_194167)(Ttype190849* t, NU64 kinds);
N_NIMCALL(void, localerror_165155)(Tlineinfo163338 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(Tsym190843*, createupfield_361621)(Ttype190849* obj, Ttype190849* fieldtype);
N_NIMCALL(void, addfield_357609)(Ttype190849* obj, Tsym190843* s);
N_NIMCALL(void, addclosureparam_361338)(Tsym190843* fn, Tenv360020* e);
N_NIMCALL(void, addhiddenparam_360124)(Tsym190843* routine, Tsym190843* param);
N_NIMCALL(TNimObject*, idtableget_198182)(Tidtable190861 t, Tidobj167015* key);
N_NIMCALL(void, idtableput_198196)(Tidtable190861* t, Tidobj167015* key, TNimObject* val);
N_NIMCALL(void, addcapturedvar_361215)(Tenv360020* e, Tsym190843* v);
N_NIMCALL(TGenericSeq*, incrSeq)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(Tnode190813*, transforminnerproc_362210)(Toutercontext360022* o, Tenv360020* e, Tnode190813* n);
N_NIMCALL(Tnode190813*, getclosurevar_362097)(Tenv360020* e);
N_NIMCALL(Tnode190813*, newclosurecreationvar_362062)(Tenv360020* e);
N_NIMCALL(void, inititer_360807)(Tsym190843* iter, Titer360016* Result);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(Tsym190843*, newiterresult_360093)(Tsym190843* iter);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, adduniquefield_357808)(Ttype190849* obj, Tsym190843* s);
N_NIMCALL(Tnode190813*, indirectaccess_358838)(Tnode190813* a, Tsym190843* b, Tlineinfo163338 info);
N_NIMCALL(Tenv360020*, findenv_362119)(Toutercontext360022* o, Tsym190843* s);
N_NIMCALL(Tnode190813*, nestedaccess_361438)(Tenv360020* top, Tsym190843* local);
N_NIMCALL(void, createenvironments_364010)(Toutercontext360022* o);
N_NIMCALL(Tnode190813*, generateclosurecreation_362883)(Toutercontext360022* o, Tenv360020* scope);
N_NIMCALL(Tnode190813*, rawclosurecreation_362785)(Toutercontext360022* o, Tenv360020* scope, Tnode190813* env);
N_NIMCALL(Tnode190813*, newasgnstmt_362771)(Tnode190813* le, Tnode190813* ri, Tlineinfo163338 info);
N_NIMCALL(Tnode190813*, idnodetableget_198212)(Tidnodetable190867 t, Tidobj167015* key);
N_NIMCALL(void, idnodetableput_198219)(Tidnodetable190867* t, Tidobj167015* key, Tnode190813* val);
N_NIMCALL(Tnode190813*, transformouterprocbody_364614)(Toutercontext360022* o, Tnode190813* n, Titer360016* it);
N_NIMCALL(Tnode190813*, rawindirectaccess_357408)(Tnode190813* a, Tsym190843* field, Tlineinfo163338 info);
N_NIMCALL(Tnode190813*, transformouterproc_363076)(Toutercontext360022* o, Tnode190813* n, Titer360016* it);
N_NIMCALL(void, excl_187871)(Intset187056* s, NI key);
static N_INLINE(NIM_BOOL, interestingitervar_363044)(Tsym190843* s);
N_NIMCALL(void, message_165188)(Tlineinfo163338 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(Tnode190813*, liftitersym_363731)(Tnode190813* n, Tsym190843* owner);
N_NIMCALL(Tnode190813*, generateiterclosurecreation_362895)(Toutercontext360022* o, Tenv360020* env, Tnode190813* scope);
N_NIMCALL(NI, len_193377)(Ttype190849* n);
N_NIMCALL(Tnode190813*, transformouterconv_361993)(Tnode190813* n);
N_NIMCALL(Tnode190813*, generatethunk_361968)(Tnode190813* prc, Ttype190849* dest);
N_NIMCALL(Tnode190813*, transformyield_363084)(Toutercontext360022* c, Tnode190813* n, Titer360016* it);
N_NIMCALL(void, outerprocsons_363675)(Toutercontext360022* o, Tnode190813* n, Titer360016* it);
N_NIMCALL(Tnode190813*, transformreturn_363658)(Toutercontext360022* c, Tnode190813* n, Titer360016* it);
N_NIMCALL(void, finishenvironments_364224)(Toutercontext360022* o);
STRING_LITERAL(TMP3262, "lambdalifting.nim", 17);
NIM_CONST TY86345 TMP3261 = {((NimStringDesc*) &TMP3262),
((NI) 1015)}
;
NIM_CONST TY86345 TMP3263 = {((NimStringDesc*) &TMP3262),
((NI) 196)}
;
STRING_LITERAL(TMP3264, "internalNew", 11);
STRING_LITERAL(TMP3299, ":envP", 5);
STRING_LITERAL(TMP3300, ":state", 6);
STRING_LITERAL(TMP3301, "liftLambdas: strange params", 27);
STRING_LITERAL(TMP3302, ":up", 3);
STRING_LITERAL(TMP3303, ":env", 4);
NIM_CONST TY86345 TMP3304 = {((NimStringDesc*) &TMP3262),
((NI) 222)}
;
STRING_LITERAL(TMP3305, ":result", 7);
NIM_CONST TY86345 TMP3308 = {((NimStringDesc*) &TMP3262),
((NI) 472)}
;
NIM_CONST TY86345 TMP3309 = {((NimStringDesc*) &TMP3262),
((NI) 315)}
;
NIM_CONST TY86345 TMP3310 = {((NimStringDesc*) &TMP3262),
((NI) 322)}
;
STRING_LITERAL(TMP3311, "searchForInnerProcs", 19);
STRING_LITERAL(TMP3312, "environment computation failed", 30);
extern Tgcheap48216 gch_48244;
extern Tnode190813* emptynode_191807;
extern NU8 gcmd_154130;
TNimType NTI360022; /* TOuterContext */
extern TNimType NTI190811; /* PSym */
extern TNimType NTI3411; /* RootObj */
TNimType NTI360020; /* TEnv */
extern TNimType NTI190805; /* PNode */
extern TNimType NTI138; /* bool */
extern TNimType NTI190815; /* TSymSeq */
extern TNimType NTI190809; /* PType */
extern TNimType NTI187056; /* IntSet */
TNimType NTI360018; /* PEnv */
extern TNimType NTI190867; /* TIdNodeTable */
extern TNimType NTI190861; /* TIdTable */
TNimType NTI360014; /* POuterContext */

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

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

N_NIMCALL(Tsym190843*, gethiddenparam_360407)(Tsym190843* routine) {
	Tsym190843* result;
	Tnode190813* params;
	Tnode190813* hidden;
	result = 0;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	hidden = lastson_193431(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_165306(TMP3263);
		internalerror_165218(LOC7);
	}
	LA5: ;
	result = (*hidden).kindU.S4.sym;
	return result;
}

N_NIMCALL(Tnode190813*, newcall_361272)(Tsym190843* a, Tnode190813* b) {
	Tnode190813* result;
	Tnode190813* LOC1;
	result = 0;
	result = newnodei_192351(((NU8) 27), (*a).info);
	LOC1 = 0;
	LOC1 = newsymnode_192325(a);
	add_191164(result, LOC1);
	add_191164(result, b);
	return result;
}

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

static N_INLINE(void, rtladdzct_51404)(Tcell46347* c) {
	addzct_49817((&gch_48244.zct), c);
}

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

N_NIMCALL(Tnode190813*, makeclosure_362034)(Tsym190843* prc, Tnode190813* env, Tlineinfo163338 info) {
	Tnode190813* result;
	Tnode190813* LOC1;
	result = 0;
	result = newnodeit_192807(((NU8) 155), info, (*prc).typ);
	LOC1 = 0;
	LOC1 = newsymnode_192325(prc);
	add_191164(result, LOC1);
	{
		Ttype190849* LOC6;
		Tnode190813* LOC7;
		if (!(env == NIM_NIL)) goto LA4;
		LOC6 = 0;
		LOC6 = getsystype_238030(((NU8) 5));
		LOC7 = 0;
		LOC7 = newnodeit_192807(((NU8) 23), info, LOC6);
		add_191164(result, LOC7);
	}
	goto LA2;
	LA4: ;
	{
		add_191164(result, env);
	}
	LA2: ;
	return result;
}

N_NIMCALL(Tnode190813*, liftforloop_366323)(Tnode190813* body) {
	Tnode190813* result;
	NI L;
	Tnode190813* call;
	Tsym190843* env;
	Tnode190813* loopbody;
	Tnode190813* whileloop;
	Ttype190849* LOC23;
	Tnode190813* v2;
	Tnode190813* vpart;
	NU8 LOC24;
	Tnode190813* bs;
	result = 0;
	L = len_191097(body);
	{
		NIM_BOOL LOC3;
		Tnode190813* LOC5;
		NimStringDesc* LOC8;
		LOC3 = 0;
		LOC3 = ((*body).kind == ((NU8) 94));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = HEX5BHEX5D_191244(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;
		LOC8 = 0;
		LOC8 = HEX24_165306(TMP3261);
		internalerror_165218(LOC8);
	}
	LA6: ;
	call = HEX5BHEX5D_191244(body, (NI)(L - ((NI) 2)));
	result = newnodei_192351(((NU8) 115), (*body).info);
	env = 0;
	{
		NIM_BOOL LOC11;
		Tnode190813* LOC12;
		Tnode190813* LOC14;
		Tsym190843* iter;
		Tnode190813* LOC17;
		Tsym190843* LOC18;
		Tnode190813* v;
		Tnode190813* LOC19;
		Tsym190843* LOC20;
		Tnode190813* LOC21;
		Tnode190813* LOC22;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = HEX5BHEX5D_191244(call, ((NI) 0));
		LOC11 = ((*LOC12).kind == ((NU8) 3));
		if (!(LOC11)) goto LA13;
		LOC14 = 0;
		LOC14 = HEX5BHEX5D_191244(call, ((NI) 0));
		LOC11 = ((*(*LOC14).kindU.S4.sym).kind == ((NU8) 15));
		LA13: ;
		if (!LOC11) goto LA15;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_191244(call, ((NI) 0));
		iter = (*LOC17).kindU.S4.sym;
		LOC18 = 0;
		LOC18 = gethiddenparam_360407(iter);
		env = copysym_193607(LOC18, NIM_FALSE);
		v = newnodei_192351(((NU8) 99), (*body).info);
		LOC19 = 0;
		LOC19 = newsymnode_192325(env);
		addvar_357047(v, LOC19);
		add_191164(result, v);
		LOC20 = 0;
		LOC20 = getsyssym_238054(((NimStringDesc*) &TMP3264));
		LOC21 = 0;
		LOC21 = newsymnode_192325(env);
		LOC22 = 0;
		LOC22 = newcall_361272(LOC20, LOC21);
		add_191164(result, LOC22);
	}
	LA15: ;
	loopbody = newnodei_192407(((NU8) 115), (*body).info, ((NI) 3));
	whileloop = newnodei_192407(((NU8) 96), (*body).info, ((NI) 2));
	LOC23 = 0;
	LOC23 = getsystype_238030(((NU8) 1));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.sons->data[((NI) 0)]), newinttypenode_191619(((NU8) 6), IL64(1), LOC23));
	asgnRefNoCycle((void**) (&(*whileloop).kindU.S6.sons->data[((NI) 1)]), loopbody);
	add_191164(result, whileloop);
	v2 = newnodei_192351(((NU8) 100), (*body).info);
	LOC24 = 0;
	{
		if (!(L == ((NI) 3))) goto LA27;
		LOC24 = ((NU8) 35);
	}
	goto LA25;
	LA27: ;
	{
		LOC24 = ((NU8) 36);
	}
	LA25: ;
	vpart = newnodei_192351(LOC24, (*body).info);
	{
		NI i_366422;
		NI HEX3Atmp_366623;
		NI res_366626;
		i_366422 = 0;
		HEX3Atmp_366623 = 0;
		HEX3Atmp_366623 = (NI)(L - ((NI) 3));
		res_366626 = ((NI) 0);
		{
			while (1) {
				Tnode190813* LOC33;
				Tnode190813* LOC34;
				if (!(res_366626 <= HEX3Atmp_366623)) goto LA32;
				i_366422 = res_366626;
				LOC33 = 0;
				LOC33 = HEX5BHEX5D_191244(body, i_366422);
				(*(*LOC33).kindU.S4.sym).kind = ((NU8) 9);
				LOC34 = 0;
				LOC34 = HEX5BHEX5D_191244(body, i_366422);
				addson_192819(vpart, LOC34);
				res_366626 += ((NI) 1);
			} LA32: ;
		}
	}
	addson_192819(vpart, emptynode_191807);
	{
		Tnode190813* LOC39;
		if (!!(env == 0)) goto LA37;
		LOC39 = 0;
		LOC39 = newsymnode_192325(env);
		asgnRefNoCycle((void**) (&(*call).kindU.S6.sons->data[((NI) 0)]), makeclosure_362034((*(*call).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym, LOC39, (*body).info));
	}
	LA37: ;
	addson_192819(vpart, call);
	addson_192819(v2, vpart);
	asgnRefNoCycle((void**) (&(*loopbody).kindU.S6.sons->data[((NI) 0)]), v2);
	bs = newnodei_192351(((NU8) 158), (*body).info);
	addson_192819(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_191244(body, (NI)(L - ((NI) 1))));
	return result;
}
N_NIMCALL(void, TMP3297)(void* p, NI op) {
	Tenv360020* a;
	a = (Tenv360020*)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, TMP3298)(void* p, NI op) {
	Toutercontext360022* a;
	a = (Toutercontext360022*)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(Toutercontext360022*, newoutercontext_361029)(Tsym190843* fn) {
	Toutercontext360022* result;
	result = 0;
	result = (Toutercontext360022*) newObj((&NTI360014), sizeof(Toutercontext360022));
	asgnRefNoCycle((void**) (&(*result).fn), fn);
	initintset_187927((&(*result).capturedvars));
	initintset_187927((&(*result).processed));
	initidnodetable_194127((&(*result).localstoaccess));
	initidtable_194057((&(*result).lambdastoenv));
	return result;
}

N_NIMCALL(Tnode190813*, closurecreationpoint_362312)(Tnode190813* n) {
	Tnode190813* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC6;
		Tnode190813* LOC8;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*n).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC6 = 0;
		LOC6 = len_191097(n);
		LOC4 = (((NI) 1) <= LOC6);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA7;
		LOC8 = 0;
		LOC8 = HEX5BHEX5D_191244(n, ((NI) 0));
		LOC3 = ((*LOC8).kind == ((NU8) 1));
		LA7: ;
		if (!LOC3) goto LA9;
		result = n;
	}
	goto LA1;
	LA9: ;
	{
		result = newnodei_192351(((NU8) 115), (*n).info);
		add_191164(result, emptynode_191807);
		add_191164(result, n);
	}
	LA1: ;
	return result;
}

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

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

static N_INLINE(void, rtladdcycleroot_50623)(Tcell46347* c) {
	{
		if (!!((((NI) ((NI)((*c).refcount & ((NI) 3)))) == ((NI) 3)))) goto LA3;
		(*c).refcount = (NI)((NI)((*c).refcount & ((NI) -4)) | ((NI) 3));
		incl_47065((&gch_48244.cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_52222)(Tcell46347* c) {
	(*c).refcount = (NI)((NU64)((*c).refcount) + (NU64)(((NI) 8)));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_49867(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_50623(c);
	}
	LA4: ;
}

static N_INLINE(void, decref_51804)(Tcell46347* c) {
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU64)((*c).refcount) < (NU64)(((NI) 8)))) goto LA3;
		rtladdzct_51404(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_49867(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_50623(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		Tcell46347* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_49846(src);
		incref_52222(LOC5);
	}
	LA3: ;
	{
		Tcell46347* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_49846((*dest));
		decref_51804(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(Tsym190843*, getenvparam_360607)(Tsym190843* routine) {
	Tsym190843* result;
	Tnode190813* params;
	Tnode190813* hidden;
	result = 0;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	hidden = lastson_193431(params);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*hidden).kind == ((NU8) 3));
		if (!(LOC3)) goto LA4;
		LOC3 = eqStrings((*(*(*hidden).kindU.S4.sym).name).s, ((NimStringDesc*) &TMP3299));
		LA4: ;
		if (!LOC3) goto LA5;
		result = (*hidden).kindU.S4.sym;
	}
	LA5: ;
	return result;
}

N_NIMCALL(Ttype190849*, getstatetype_360049)(Tsym190843* iter) {
	Ttype190849* result;
	Tnode190813* n;
	Tnode190813* LOC1;
	Tnode190813* LOC2;
	Ttype190849* inttype;
	result = 0;
	n = newnodei_192351(((NU8) 44), (*iter).info);
	LOC1 = 0;
	LOC1 = newintnode_191607(((NU8) 6), IL64(-1));
	addson_192819(n, LOC1);
	LOC2 = 0;
	LOC2 = newintnode_191607(((NU8) 6), IL64(0));
	addson_192819(n, LOC2);
	result = newtype_193140(((NU8) 20), iter);
	asgnRefNoCycle((void**) (&(*result).n), n);
	inttype = nilorsysint_238070();
	{
		if (!inttype == 0) goto LA5;
		inttype = newtype_193140(((NU8) 31), iter);
	}
	LA5: ;
	rawaddson_194478(result, inttype);
	return result;
}

N_NIMCALL(Tsym190843*, createstatefield_360070)(Tsym190843* iter) {
	Tsym190843* result;
	Tident167021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_167463(((NimStringDesc*) &TMP3300));
	result = newsym_191655(((NU8) 19), LOC1, iter, (*iter).info);
	asgnRefNoCycle((void**) (&(*result).typ), getstatetype_360049(iter));
	return result;
}

N_NIMCALL(Ttype190849*, createenvobj_360082)(Tsym190843* owner) {
	Ttype190849* result;
	Tsym190843* LOC1;
	result = 0;
	result = createobj_357270(owner, (*owner).info);
	LOC1 = 0;
	LOC1 = createstatefield_360070(owner);
	rawaddfield_357291(result, LOC1);
	return result;
}

N_NIMCALL(Tenv360020*, newenv_361049)(Toutercontext360022* o, Tenv360020* up, Tnode190813* n, Tsym190843* owner) {
	Tenv360020* result;
	result = 0;
	result = (Tenv360020*) newObj((&NTI360018), sizeof(Tenv360020));
	(*result).Sup.m_type = (&NTI360020);
	if ((*result).capturedvars) nimGCunrefNoCycle((*result).capturedvars);
	(*result).capturedvars = (Tsymseq190815*) newSeqRC1((&NTI190815), 0);
	asgnRef((void**) (&(*result).up), up);
	asgnRefNoCycle((void**) (&(*result).attachednode), n);
	asgnRefNoCycle((void**) (&(*result).fn), owner);
	initintset_187927((&(*result).vars));
	asgnRef((void**) (&(*result).next), (*o).head);
	asgnRef((void**) (&(*o).head), result);
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		Tsym190843* 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_360607(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_360082(owner));
	}
	LA15: ;
	return result;
}

N_NIMCALL(void, addparamstoenv_362343)(Tsym190843* fn, Tenv360020* env) {
	Tnode190813* params;
	Tnode190813* ast;
	params = (*(*fn).typ).n;
	{
		NI i_362368;
		NI HEX3Atmp_362401;
		NI LOC2;
		NI res_362404;
		i_362368 = 0;
		HEX3Atmp_362401 = 0;
		LOC2 = 0;
		LOC2 = len_191097(params);
		HEX3Atmp_362401 = (LOC2 - 1);
		res_362404 = ((NI) 1);
		{
			while (1) {
				Tsym190843* param;
				if (!(res_362404 <= HEX3Atmp_362401)) goto LA4;
				i_362368 = res_362404;
				{
					if (!!(((*(*params).kindU.S6.sons->data[i_362368]).kind == ((NU8) 3)))) goto LA7;
					internalerror_165199((*params).info, ((NimStringDesc*) &TMP3301));
				}
				LA7: ;
				param = (*(*params).kindU.S6.sons->data[i_362368]).kindU.S4.sym;
				incl_187856((&(*env).vars), (*param).Sup.id);
				res_362404 += ((NI) 1);
			} LA4: ;
		}
	}
	ast = (*fn).ast;
	{
		NIM_BOOL LOC11;
		NI LOC12;
		LOC11 = 0;
		LOC12 = 0;
		LOC12 = sonslen_193403(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_187856((&(*env).vars), (*(*(*ast).kindU.S6.sons->data[((NI) 7)]).kindU.S4.sym).Sup.id);
	}
	LA14: ;
}

N_NIMCALL(NIM_BOOL, isinnerproc_361286)(Tsym190843* s, Tsym190843* outerproc) {
	NIM_BOOL result;
{	result = 0;
	{
		Tsym190843* owner;
		if (!((110592 &(1<<(((*s).kind)&31)))!=0)) goto LA3;
		owner = skipgenericowner_195696(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_361375)(Tsym190843* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	Ttype190849* LOC2;
	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = skiptypes_194167((*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(Tsym190843*, createupfield_361621)(Ttype190849* obj, Ttype190849* fieldtype) {
	Tsym190843* result;
	NI pos;
	Tident167021* LOC1;
	result = 0;
	pos = len_191097((*obj).n);
	LOC1 = 0;
	LOC1 = getident_167463(((NimStringDesc*) &TMP3302));
	result = newsym_191655(((NU8) 19), LOC1, (*obj).owner, (*(*obj).owner).info);
	asgnRefNoCycle((void**) (&(*result).typ), newtype_193140(((NU8) 22), (*obj).owner));
	(*result).position = pos;
	rawaddson_194478((*result).typ, fieldtype);
	addfield_357609(obj, result);
	return result;
}

N_NIMCALL(void, addhiddenparam_360124)(Tsym190843* routine, Tsym190843* param) {
	Tnode190813* params;
	NI LOC1;
	Tnode190813* LOC2;
	params = (*(*routine).ast).kindU.S6.sons->data[((NI) 3)];
	LOC1 = 0;
	LOC1 = len_191097(params);
	(*param).position = (NI)(LOC1 - ((NI) 1));
	LOC2 = 0;
	LOC2 = newsymnode_192325(param);
	addson_192819(params, LOC2);
	(*(*routine).typ).flags |= ((NI32)1)<<((((NU8) 11))%(sizeof(NI32)*8));
}

N_NIMCALL(void, addclosureparam_361338)(Tsym190843* fn, Tenv360020* e) {
	Tsym190843* cp;
	cp = getenvparam_360607(fn);
	{
		Tident167021* LOC5;
		if (!(cp == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = getident_167463(((NimStringDesc*) &TMP3299));
		cp = newsym_191655(((NU8) 3), LOC5, fn, (*fn).info);
		(*cp).flags |= ((NI32)1)<<((((NU8) 2))%(sizeof(NI32)*8));
		asgnRefNoCycle((void**) (&(*cp).typ), newtype_193140(((NU8) 22), fn));
		rawaddson_194478((*cp).typ, (*e).obj);
		addhiddenparam_360124(fn, cp);
	}
	LA3: ;
}

N_NIMCALL(void, addcapturedvar_361215)(Tenv360020* e, Tsym190843* v) {
{	{
		Tsym190843* x_361228;
		Tsymseq190815* HEX3Atmp_361251;
		NI i_361254;
		NI L_361256;
		x_361228 = 0;
		HEX3Atmp_361251 = 0;
		HEX3Atmp_361251 = (*e).capturedvars;
		i_361254 = ((NI) 0);
		L_361256 = (HEX3Atmp_361251 ? HEX3Atmp_361251->Sup.len : 0);
		{
			while (1) {
				if (!(i_361254 < L_361256)) goto LA3;
				x_361228 = HEX3Atmp_361251->data[i_361254];
				{
					if (!(x_361228 == v)) goto LA6;
					goto BeforeRet;
				}
				LA6: ;
				i_361254 += ((NI) 1);
			} LA3: ;
		}
	}
	(*e).capturedvars = (Tsymseq190815*) incrSeq(&((*e).capturedvars)->Sup, sizeof(Tsym190843*));
	asgnRefNoCycle((void**) (&(*e).capturedvars->data[(*e).capturedvars->Sup.len-1]), v);
	addfield_357609((*e).obj, v);
	}BeforeRet: ;
}

N_NIMCALL(NIM_BOOL, capturevar_361638)(Toutercontext360022* o, Tenv360020* top, Tsym190843* local, Tlineinfo163338 info) {
	NIM_BOOL result;
	Tenv360020* it;
{	result = 0;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				LOC5 = 0;
				LOC5 = contains_187829((&(*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_361375(local);
		if (LOC14) goto LA15;
		LOC14 = !(((257 &(1<<(((*(*(*top).fn).typ).callconv)&15)))!=0));
		LA15: ;
		if (!LOC14) goto LA16;
		localerror_165155(info, ((NU16) 222), (*(*local).name).s);
	}
	LA16: ;
	it = top;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA19;
			{
				NIM_BOOL LOC22;
				LOC22 = 0;
				LOC22 = contains_187829((&(*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_361621((*it).obj, (*(*it).up).obj));
			}
			LA31: ;
			{
				Tenv360020* u;
				if (!!(((*it).fn == (*local).owner))) goto LA35;
				(*(*(*it).fn).typ).callconv = ((NU8) 8);
				(*(*(*it).fn).typ).flags |= ((NI32)1)<<((((NU8) 11))%(sizeof(NI32)*8));
				u = (*it).up;
				{
					while (1) {
						NIM_BOOL LOC39;
						LOC39 = 0;
						LOC39 = !((u == NIM_NIL));
						if (!(LOC39)) goto LA40;
						LOC39 = ((*u).fn == (*it).fn);
						LA40: ;
						if (!LOC39) goto LA38;
						u = (*u).up;
					} LA38: ;
				}
				addclosureparam_361338((*it).fn, u);
				{
					Tidobj167015* LOC43;
					TNimObject* LOC44;
					LOC43 = 0;
					LOC43 = &(*it).fn->Sup;
					LOC44 = 0;
					LOC44 = idtableget_198182((*o).lambdastoenv, LOC43);
					if (!(LOC44 == NIM_NIL)) goto LA45;
					{
						Tidobj167015* LOC51;
						TNimObject* LOC52;
						if (!!((u == NIM_NIL))) goto LA49;
						LOC51 = 0;
						LOC51 = &(*it).fn->Sup;
						LOC52 = 0;
						LOC52 = &u->Sup;
						idtableput_198196((&(*o).lambdastoenv), LOC51, LOC52);
					}
					LA49: ;
				}
				LA45: ;
			}
			LA35: ;
			it = (*it).up;
		} LA19: ;
	} LA18: ;
	incl_187856((&(*o).capturedvars), (*local).Sup.id);
	addcapturedvar_361215(it, local);
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI, gathervars_361870)(Toutercontext360022* o, Tenv360020* e, Tnode190813* n) {
	NI result;
{	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = ((NI) 0);
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		Tsym190843* s;
		s = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = interestingvar_361406(s);
			if (!(LOC8)) goto LA9;
			LOC8 = !(((*e).fn == (*s).owner));
			LA9: ;
			if (!LOC8) goto LA10;
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = capturevar_361638(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_361934;
			NI HEX3Atmp_361946;
			NI LOC20;
			NI res_361949;
			k_361934 = 0;
			HEX3Atmp_361946 = 0;
			LOC20 = 0;
			LOC20 = sonslen_193403(n);
			HEX3Atmp_361946 = (NI)(LOC20 - ((NI) 1));
			res_361949 = ((NI) 0);
			{
				while (1) {
					NI LOC23;
					if (!(res_361949 <= HEX3Atmp_361946)) goto LA22;
					k_361934 = res_361949;
					LOC23 = 0;
					LOC23 = gathervars_361870(o, e, (*n).kindU.S6.sons->data[k_361934]);
					result += LOC23;
					res_361949 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym190843*, newiterresult_360093)(Tsym190843* iter) {
	Tsym190843* result;
	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_191097((*iter).ast);
		if (!(((NI) 7) < LOC3)) goto LA4;
		result = (*(*(*iter).ast).kindU.S6.sons->data[((NI) 7)]).kindU.S4.sym;
	}
	goto LA1;
	LA4: ;
	{
		Tident167021* LOC7;
		Tnode190813* LOC8;
		LOC7 = 0;
		LOC7 = getident_167463(((NimStringDesc*) &TMP3305));
		result = newsym_191655(((NU8) 11), LOC7, iter, (*iter).info);
		asgnRefNoCycle((void**) (&(*result).typ), (*(*iter).typ).sons->data[((NI) 0)]);
		(*result).flags |= ((NI32)1)<<((((NU8) 0))%(sizeof(NI32)*8));
		LOC8 = 0;
		LOC8 = newsymnode_192325(result);
		add_191164((*iter).ast, LOC8);
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, inititer_360807)(Tsym190843* iter, Titer360016* Result) {
	unsureAsgnRef((void**) (&(*Result).fn), iter);
	{
		Tsym190843* cp;
		Tnode190813* LOC17;
		if (!((*iter).kind == ((NU8) 15))) goto LA3;
		cp = getenvparam_360607(iter);
		{
			Tident167021* LOC9;
			if (!(cp == NIM_NIL)) goto LA7;
			unsureAsgnRef((void**) (&(*Result).obj), createenvobj_360082(iter));
			LOC9 = 0;
			LOC9 = getident_167463(((NimStringDesc*) &TMP3299));
			cp = newsym_191655(((NU8) 3), LOC9, iter, (*iter).info);
			(*cp).flags |= ((NI32)1)<<((((NU8) 2))%(sizeof(NI32)*8));
			asgnRefNoCycle((void**) (&(*cp).typ), newtype_193140(((NU8) 22), iter));
			rawaddson_194478((*cp).typ, (*Result).obj);
			addhiddenparam_360124(iter, cp);
		}
		goto LA5;
		LA7: ;
		{
			unsureAsgnRef((void**) (&(*Result).obj), (*(*cp).typ).sons->data[((NI) 0)]);
		}
		LA5: ;
		{
			NI LOC13;
			NimStringDesc* LOC16;
			LOC13 = 0;
			LOC13 = len_191097((*(*Result).obj).n);
			if (!!((((NI) 0) < LOC13))) goto LA14;
			LOC16 = 0;
			LOC16 = HEX24_165306(TMP3304);
			internalerror_165218(LOC16);
		}
		LA14: ;
		LOC17 = 0;
		LOC17 = HEX5BHEX5D_191244((*(*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_360093(iter));
		}
		LA20: ;
	}
	LA3: ;
}

N_NIMCALL(Tnode190813*, newclosurecreationvar_362062)(Tenv360020* e) {
	Tnode190813* result;
	Tsym190843* v;
	Tident167021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_167463(((NimStringDesc*) &TMP3303));
	v = newsym_191655(((NU8) 8), LOC1, (*e).fn, (*(*e).attachednode).info);
	(*v).flags |= ((NI32)1)<<((((NU8) 21))%(sizeof(NI32)*8));
	asgnRefNoCycle((void**) (&(*v).typ), newtype_193140(((NU8) 22), (*e).fn));
	rawaddson_194478((*v).typ, (*e).obj);
	{
		Titer360016 it;
		Tnode190813* 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_360807((*e).fn, (&it));
		adduniquefield_357808(it.obj, v);
		LOC6 = 0;
		LOC6 = newsymnode_192325(it.closureparam);
		result = indirectaccess_358838(LOC6, v, (*v).info);
	}
	goto LA2;
	LA4: ;
	{
		result = newsymnode_192325(v);
	}
	LA2: ;
	return result;
}

N_NIMCALL(Tnode190813*, getclosurevar_362097)(Tenv360020* e) {
	Tnode190813* result;
	result = 0;
	{
		if (!((*e).createdvar == NIM_NIL)) goto LA3;
		result = newclosurecreationvar_362062(e);
		asgnRefNoCycle((void**) (&(*e).createdvar), result);
	}
	goto LA1;
	LA3: ;
	{
		result = (*e).createdvar;
	}
	LA1: ;
	return result;
}

N_NIMCALL(Tenv360020*, findenv_362119)(Toutercontext360022* o, Tsym190843* s) {
	Tenv360020* result;
	Tenv360020* 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_165306(TMP3308);
		internalerror_165218(LOC13);
	}
	LA11: ;
	result = (*env).up;
	{
		while (1) {
			if (!((*result).fn == s)) goto LA15;
			result = (*result).up;
		} LA15: ;
	}
	return result;
}

N_NIMCALL(Tnode190813*, nestedaccess_361438)(Tenv360020* top, Tsym190843* local) {
	Tnode190813* result;
	Tenv360020* it;
	Tsym190843* envparam;
	Tnode190813* access;
{	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = interestingvar_361406(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_187829((&(*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_360607((*top).fn);
	{
		NimStringDesc* LOC23;
		if (!!(!(envparam == 0))) goto LA21;
		LOC23 = 0;
		LOC23 = HEX24_165306(TMP3309);
		internalerror_165218(LOC23);
	}
	LA21: ;
	access = newsymnode_192325(envparam);
	it = (*top).up;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA25;
			{
				NIM_BOOL LOC28;
				LOC28 = 0;
				LOC28 = contains_187829((&(*it).vars), (*local).Sup.id);
				if (!LOC28) goto LA29;
				access = indirectaccess_358838(access, local, (*local).info);
				result = access;
				goto BeforeRet;
			}
			LA29: ;
			{
				NimStringDesc* LOC35;
				if (!!(!(((*it).upfield == NIM_NIL)))) goto LA33;
				LOC35 = 0;
				LOC35 = HEX24_165306(TMP3310);
				internalerror_165218(LOC35);
			}
			LA33: ;
			access = indirectaccess_358838(access, (*it).upfield, (*local).info);
			it = (*it).up;
		} LA25: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode190813*, transforminnerproc_362210)(Toutercontext360022* o, Tenv360020* e, Tnode190813* n) {
	Tnode190813* result;
	result = 0;
	switch ((*n).kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		Tsym190843* s;
		s = (*n).kindU.S4.sym;
		{
			Tsym190843* LOC7;
			Tnode190813* LOC8;
			if (!(s == (*e).fn)) goto LA5;
			LOC7 = 0;
			LOC7 = getenvparam_360607(s);
			LOC8 = 0;
			LOC8 = newsymnode_192325(LOC7);
			result = makeclosure_362034(s, LOC8, (*n).info);
		}
		goto LA3;
		LA5: ;
		{
			NIM_BOOL LOC10;
			Tenv360020* LOC14;
			Tnode190813* LOC15;
			LOC10 = 0;
			LOC10 = isinnerproc_361286(s, (*o).fn);
			if (!(LOC10)) goto LA11;
			LOC10 = ((*(*s).typ).callconv == ((NU8) 8));
			LA11: ;
			if (!LOC10) goto LA12;
			LOC14 = 0;
			LOC14 = findenv_362119(o, s);
			LOC15 = 0;
			LOC15 = getclosurevar_362097(LOC14);
			result = makeclosure_362034(s, LOC15, (*n).info);
		}
		goto LA3;
		LA12: ;
		{
			result = nestedaccess_361438(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_362273;
			NI HEX3Atmp_362290;
			NI LOC20;
			NI res_362293;
			j_362273 = 0;
			HEX3Atmp_362290 = 0;
			LOC20 = 0;
			LOC20 = sonslen_193403(n);
			HEX3Atmp_362290 = (NI)(LOC20 - ((NI) 1));
			res_362293 = ((NI) 0);
			{
				while (1) {
					Tnode190813* x;
					if (!(res_362293 <= HEX3Atmp_362290)) goto LA22;
					j_362273 = res_362293;
					x = transforminnerproc_362210(o, e, (*n).kindU.S6.sons->data[j_362273]);
					{
						if (!!((x == NIM_NIL))) goto LA25;
						asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[j_362273]), x);
					}
					LA25: ;
					res_362293 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	}
	return result;
}

N_NIMCALL(void, searchforinnerprocs_362423)(Toutercontext360022* o, Tnode190813* n, Tenv360020* 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):
	{
		Tsym190843* fn;
		fn = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC9;
			NIM_BOOL LOC11;
			Tnode190813* body;
			Tnode190813* ex;
			Tenv360020* envb;
			NI capturedcounter;
			LOC9 = 0;
			LOC9 = isinnerproc_361286(fn, (*o).fn);
			if (!(LOC9)) goto LA10;
			LOC11 = 0;
			LOC11 = containsorincl_187898((&(*o).processed), (*fn).Sup.id);
			LOC9 = !(LOC11);
			LA10: ;
			if (!LOC9) goto LA12;
			body = getbody_235647(fn);
			ex = closurecreationpoint_362312(body);
			envb = newenv_361049(o, env, ex, fn);
			addparamstoenv_362343(fn, envb);
			searchforinnerprocs_362423(o, body, envb);
			asgnRefNoCycle((void**) (&(*(*fn).ast).kindU.S6.sons->data[((NI) 6)]), ex);
			capturedcounter = gathervars_361870(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;
				{
					Tidobj167015* LOC22;
					TNimObject* LOC23;
					Tidobj167015* LOC26;
					TNimObject* LOC27;
					LOC22 = 0;
					LOC22 = &fn->Sup;
					LOC23 = 0;
					LOC23 = idtableget_198182((*o).lambdastoenv, LOC22);
					if (!(LOC23 == NIM_NIL)) goto LA24;
					LOC26 = 0;
					LOC26 = &fn->Sup;
					LOC27 = 0;
					LOC27 = &env->Sup;
					idtableput_198196((&(*o).lambdastoenv), LOC26, LOC27);
				}
				LA24: ;
				addclosureparam_361338(fn, env);
			}
			goto LA14;
			LA18: ;
			{
				Tsym190843* LOC29;
				Tnode190813* ti;
				LOC29 = 0;
				LOC29 = getenvparam_360607(fn);
				if (!!((LOC29 == NIM_NIL))) goto LA30;
				ti = transforminnerproc_362210(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_362423(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;
			Tnode190813* ex;
			Tenv360020* LOC50;
			if (!!(((*(*env).fn).kind == ((NU8) 15)))) goto LA44;
			LOC46 = 0;
			LOC46 = len_191097(n);
			body = (NI)(LOC46 - ((NI) 1));
			{
				NI i_362558;
				NI HEX3Atmp_362681;
				NI res_362684;
				i_362558 = 0;
				HEX3Atmp_362681 = 0;
				HEX3Atmp_362681 = (NI)(body - ((NI) 1));
				res_362684 = ((NI) 0);
				{
					while (1) {
						if (!(res_362684 <= HEX3Atmp_362681)) goto LA49;
						i_362558 = res_362684;
						searchforinnerprocs_362423(o, (*n).kindU.S6.sons->data[i_362558], env);
						res_362684 += ((NI) 1);
					} LA49: ;
				}
			}
			ex = closurecreationpoint_362312((*n).kindU.S6.sons->data[body]);
			LOC50 = 0;
			LOC50 = newenv_361049(o, env, ex, (*env).fn);
			searchforinnerprocs_362423(o, (*n).kindU.S6.sons->data[body], LOC50);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[body]), ex);
		}
		goto LA42;
		LA44: ;
		{
			{
				NI i_362576;
				NI HEX3Atmp_362689;
				NI LOC53;
				NI res_362692;
				i_362576 = 0;
				HEX3Atmp_362689 = 0;
				LOC53 = 0;
				LOC53 = sonslen_193403(n);
				HEX3Atmp_362689 = (NI)(LOC53 - ((NI) 1));
				res_362692 = ((NI) 0);
				{
					while (1) {
						if (!(res_362692 <= HEX3Atmp_362689)) goto LA55;
						i_362576 = res_362692;
						searchforinnerprocs_362423(o, (*n).kindU.S6.sons->data[i_362576], env);
						res_362692 += ((NI) 1);
					} LA55: ;
				}
			}
		}
		LA42: ;
	}
	break;
	case ((NU8) 99):
	case ((NU8) 100):
	{
		{
			NI i_362590;
			NI HEX3Atmp_362705;
			NI LOC58;
			NI res_362708;
			i_362590 = 0;
			HEX3Atmp_362705 = 0;
			LOC58 = 0;
			LOC58 = sonslen_193403(n);
			HEX3Atmp_362705 = (NI)(LOC58 - ((NI) 1));
			res_362708 = ((NI) 0);
			{
				while (1) {
					Tnode190813* it;
					if (!(res_362708 <= HEX3Atmp_362705)) goto LA60;
					i_362590 = res_362708;
					it = (*n).kindU.S6.sons->data[i_362590];
					{
						if (!((*it).kind == ((NU8) 125))) goto LA63;
					}
					goto LA61;
					LA63: ;
					{
						NI L;
						if (!((*it).kind == ((NU8) 35))) goto LA66;
						L = sonslen_193403(it);
						{
							if (!((*(*it).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 3))) goto LA70;
							incl_187856((&(*env).vars), (*(*(*it).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym).Sup.id);
						}
						LA70: ;
						searchforinnerprocs_362423(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_193403(it);
						{
							NI j_362649;
							NI HEX3Atmp_362698;
							NI res_362701;
							j_362649 = 0;
							HEX3Atmp_362698 = 0;
							HEX3Atmp_362698 = (NI)(L - ((NI) 3));
							res_362701 = ((NI) 0);
							{
								while (1) {
									if (!(res_362701 <= HEX3Atmp_362698)) goto LA77;
									j_362649 = res_362701;
									{
										if (!((*(*it).kindU.S6.sons->data[j_362649]).kind == ((NU8) 3))) goto LA80;
										incl_187856((&(*env).vars), (*(*(*it).kindU.S6.sons->data[j_362649]).kindU.S4.sym).Sup.id);
									}
									LA80: ;
									res_362701 += ((NI) 1);
								} LA77: ;
							}
						}
						searchforinnerprocs_362423(o, (*it).kindU.S6.sons->data[(NI)(L - ((NI) 1))], env);
					}
					goto LA61;
					LA73: ;
					{
						internalerror_165199((*it).info, ((NimStringDesc*) &TMP3311));
					}
					LA61: ;
					res_362708 += ((NI) 1);
				} LA60: ;
			}
		}
	}
	break;
	case ((NU8) 155):
	{
		searchforinnerprocs_362423(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_362678;
			NI HEX3Atmp_362713;
			NI LOC87;
			NI res_362716;
			i_362678 = 0;
			HEX3Atmp_362713 = 0;
			LOC87 = 0;
			LOC87 = sonslen_193403(n);
			HEX3Atmp_362713 = (NI)(LOC87 - ((NI) 1));
			res_362716 = ((NI) 0);
			{
				while (1) {
					if (!(res_362716 <= HEX3Atmp_362713)) goto LA89;
					i_362678 = res_362716;
					searchforinnerprocs_362423(o, (*n).kindU.S6.sons->data[i_362678], env);
					res_362716 += ((NI) 1);
				} LA89: ;
			}
		}
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(Tnode190813*, newasgnstmt_362771)(Tnode190813* le, Tnode190813* ri, Tlineinfo163338 info) {
	Tnode190813* result;
	result = 0;
	result = newnodei_192407(((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(Tnode190813*, rawclosurecreation_362785)(Toutercontext360022* o, Tenv360020* scope, Tnode190813* env) {
	Tnode190813* result;
	Tsym190843* LOC5;
	Tnode190813* LOC6;
	result = 0;
	result = newnodei_192351(((NU8) 115), (*env).info);
	{
		Tnode190813* v;
		if (!((*env).kind == ((NU8) 3))) goto LA3;
		v = newnodei_192351(((NU8) 99), (*env).info);
		addvar_357047(v, env);
		add_191164(result, v);
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = getsyssym_238054(((NimStringDesc*) &TMP3264));
	LOC6 = 0;
	LOC6 = newcall_361272(LOC5, env);
	add_191164(result, LOC6);
	{
		Tsym190843* local_362812;
		Tsymseq190815* HEX3Atmp_362862;
		NI i_362865;
		NI L_362867;
		local_362812 = 0;
		HEX3Atmp_362862 = 0;
		HEX3Atmp_362862 = (*scope).capturedvars;
		i_362865 = ((NI) 0);
		L_362867 = (HEX3Atmp_362862 ? HEX3Atmp_362862->Sup.len : 0);
		{
			while (1) {
				Tnode190813* fieldaccess;
				Tnode190813* existing;
				Tidobj167015* LOC16;
				if (!(i_362865 < L_362867)) goto LA9;
				local_362812 = HEX3Atmp_362862->data[i_362865];
				fieldaccess = indirectaccess_358838(env, local_362812, (*env).info);
				{
					Tnode190813* LOC14;
					Tnode190813* LOC15;
					if (!((*local_362812).kind == ((NU8) 3))) goto LA12;
					LOC14 = 0;
					LOC14 = newsymnode_192325(local_362812);
					LOC15 = 0;
					LOC15 = newasgnstmt_362771(fieldaccess, LOC14, (*env).info);
					add_191164(result, LOC15);
				}
				LA12: ;
				LOC16 = 0;
				LOC16 = &local_362812->Sup;
				existing = idnodetableget_198212((*o).localstoaccess, LOC16);
				{
					Tidobj167015* LOC21;
					if (!existing == 0) goto LA19;
					LOC21 = 0;
					LOC21 = &local_362812->Sup;
					idnodetableput_198219((&(*o).localstoaccess), LOC21, fieldaccess);
				}
				goto LA17;
				LA19: ;
				{
					Tnode190813* LOC23;
					LOC23 = 0;
					LOC23 = newasgnstmt_362771(fieldaccess, existing, (*env).info);
					add_191164(result, LOC23);
				}
				LA17: ;
				i_362865 += ((NI) 1);
			} LA9: ;
		}
	}
	{
		if (!!(((*scope).upfield == NIM_NIL))) goto LA26;
		{
			Tnode190813* LOC32;
			Tsym190843* LOC33;
			Tnode190813* LOC34;
			Tnode190813* LOC35;
			if (!!(((*(*scope).up).fn == (*scope).fn))) goto LA30;
			LOC32 = 0;
			LOC32 = indirectaccess_358838(env, (*scope).upfield, (*env).info);
			LOC33 = 0;
			LOC33 = getenvparam_360607((*scope).fn);
			LOC34 = 0;
			LOC34 = newsymnode_192325(LOC33);
			LOC35 = 0;
			LOC35 = newasgnstmt_362771(LOC32, LOC34, (*env).info);
			add_191164(result, LOC35);
		}
		goto LA28;
		LA30: ;
		{
			Tnode190813* LOC37;
			Tnode190813* LOC38;
			Tnode190813* LOC39;
			LOC37 = 0;
			LOC37 = indirectaccess_358838(env, (*scope).upfield, (*env).info);
			LOC38 = 0;
			LOC38 = getclosurevar_362097((*scope).up);
			LOC39 = 0;
			LOC39 = newasgnstmt_362771(LOC37, LOC38, (*env).info);
			add_191164(result, LOC39);
		}
		LA28: ;
	}
	LA26: ;
	return result;
}

N_NIMCALL(Tnode190813*, generateclosurecreation_362883)(Toutercontext360022* o, Tenv360020* scope) {
	Tnode190813* result;
	Tnode190813* env;
	result = 0;
	env = getclosurevar_362097(scope);
	result = rawclosurecreation_362785(o, scope, env);
	return result;
}

N_NIMCALL(void, createenvironments_364010)(Toutercontext360022* o) {
	Tenv360020* env;
	env = (*o).head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				Tnode190813* 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_362883(o, env));
				}
				LA11: ;
			}
			LA7: ;
			env = (*env).next;
		} LA2: ;
	}
}

static N_INLINE(NIM_BOOL, interestingitervar_363044)(Tsym190843* 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(Tnode190813*, liftitersym_363731)(Tnode190813* n, Tsym190843* owner) {
	Tnode190813* result;
	Tsym190843* iter;
	Tsym190843* hp;
	Tsym190843* env;
	Tnode190813* v;
	Tnode190813* LOC1;
	Tnode190813* envasnode;
	Tsym190843* LOC2;
	Tnode190813* LOC3;
	Tnode190813* LOC4;
	result = 0;
	iter = (*n).kindU.S4.sym;
	result = newnodeit_192807(((NU8) 126), (*n).info, (*n).typ);
	hp = gethiddenparam_360407(iter);
	env = newsym_191655(((NU8) 9), (*iter).name, owner, (*n).info);
	asgnRefNoCycle((void**) (&(*env).typ), (*hp).typ);
	(*env).flags = (*hp).flags;
	v = newnodei_192351(((NU8) 99), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_192325(env);
	addvar_357047(v, LOC1);
	add_191164(result, v);
	envasnode = newsymnode_192325(env);
	LOC2 = 0;
	LOC2 = getsyssym_238054(((NimStringDesc*) &TMP3264));
	LOC3 = 0;
	LOC3 = newcall_361272(LOC2, envasnode);
	add_191164(result, LOC3);
	LOC4 = 0;
	LOC4 = makeclosure_362034(iter, envasnode, (*n).info);
	add_191164(result, LOC4);
	return result;
}

N_NIMCALL(Tnode190813*, generateiterclosurecreation_362895)(Toutercontext360022* o, Tenv360020* env, Tnode190813* scope) {
	Tnode190813* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode190813* cc;
		Tnode190813* insertpoint;
		LOC3 = 0;
		LOC3 = (*env).createdvarcomesfromiter;
		if (LOC3) goto LA4;
		LOC3 = (*env).createdvar == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = newclosurecreationvar_362062(env);
		cc = rawclosurecreation_362785(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: ;
		{
			{
				Tnode190813* x_363001;
				x_363001 = 0;
				{
					NI i_363019;
					NI HEX3Atmp_363021;
					NI LOC14;
					NI res_363023;
					i_363019 = 0;
					HEX3Atmp_363021 = 0;
					LOC14 = 0;
					LOC14 = len_191097(cc);
					HEX3Atmp_363021 = (LOC14 - 1);
					res_363023 = ((NI) 0);
					{
						while (1) {
							if (!(res_363023 <= HEX3Atmp_363021)) goto LA16;
							i_363019 = res_363023;
							x_363001 = (*cc).kindU.S6.sons->data[i_363019];
							add_191164(insertpoint, x_363001);
							res_363023 += ((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(Tnode190813*, generatethunk_361968)(Tnode190813* prc, Ttype190849* dest) {
	Tnode190813* result;
	Tnode190813* conv;
	Ttype190849* LOC5;
	Tnode190813* LOC6;
{	result = 0;
	{
		if (!(gcmd_154130 == ((NU8) 4))) goto LA3;
		result = prc;
		goto BeforeRet;
	}
	LA3: ;
	result = newnodeit_192807(((NU8) 155), (*prc).info, dest);
	conv = newnodeit_192807(((NU8) 58), (*prc).info, dest);
	add_191164(conv, emptynode_191807);
	add_191164(conv, prc);
	add_191164(result, conv);
	LOC5 = 0;
	LOC5 = getsystype_238030(((NU8) 5));
	LOC6 = 0;
	LOC6 = newnodeit_192807(((NU8) 23), (*prc).info, LOC5);
	add_191164(result, LOC6);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode190813*, transformouterconv_361993)(Tnode190813* n) {
	Tnode190813* result;
	Ttype190849* dest;
	Ttype190849* source;
	result = 0;
	dest = skiptypes_194167((*n).typ, IL64(211106242013440));
	source = skiptypes_194167((*(*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_361968((*n).kindU.S6.sons->data[((NI) 1)], dest);
		}
		LA9: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(Tnode190813*, transformyield_363084)(Toutercontext360022* c, Tnode190813* n, Titer360016* it) {
	Tnode190813* result;
	NI64 stateno;
	Tnode190813* stateasgnstmt;
	Tnode190813* LOC1;
	Tnode190813* LOC2;
	Ttype190849* LOC3;
	Tnode190813* LOC4;
	Tnode190813* retstmt;
	Tnode190813* statelabelstmt;
	Ttype190849* LOC17;
	Tnode190813* 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_192351(((NU8) 73), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_192325((*it).closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_357408(LOC1, (*it).state, (*n).info);
	add_191164(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_238030(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_191619(((NU8) 6), stateno, LOC3);
	add_191164(stateasgnstmt, LOC4);
	retstmt = newnodei_192351(((NU8) 109), (*n).info);
	{
		Tnode190813* a;
		Tnode190813* retval;
		Tnode190813* LOC9;
		Tnode190813* LOC10;
		if (!!(((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 1)))) goto LA7;
		a = newnodei_192351(((NU8) 73), (*(*n).kindU.S6.sons->data[((NI) 0)]).info);
		retval = transformouterproc_363076(c, (*n).kindU.S6.sons->data[((NI) 0)], it);
		LOC9 = 0;
		LOC9 = newsymnode_192325((*it).resultsym);
		addson_192819(a, LOC9);
		LOC10 = 0;
		{
			if (!retval == 0) goto LA13;
			LOC10 = (*n).kindU.S6.sons->data[((NI) 0)];
		}
		goto LA11;
		LA13: ;
		{
			LOC10 = retval;
		}
		LA11: ;
		addson_192819(a, LOC10);
		add_191164(retstmt, a);
	}
	goto LA5;
	LA7: ;
	{
		add_191164(retstmt, emptynode_191807);
	}
	LA5: ;
	statelabelstmt = newnodei_192351(((NU8) 157), (*n).info);
	LOC17 = 0;
	LOC17 = getsystype_238030(((NU8) 31));
	LOC18 = 0;
	LOC18 = newinttypenode_191619(((NU8) 6), stateno, LOC17);
	add_191164(statelabelstmt, LOC18);
	result = newnodei_192351(((NU8) 115), (*n).info);
	add_191164(result, stateasgnstmt);
	add_191164(result, retstmt);
	add_191164(result, statelabelstmt);
	return result;
}

N_NIMCALL(void, outerprocsons_363675)(Toutercontext360022* o, Tnode190813* n, Titer360016* it) {
	{
		NI i_363692;
		NI HEX3Atmp_363709;
		NI LOC2;
		NI res_363712;
		i_363692 = 0;
		HEX3Atmp_363709 = 0;
		LOC2 = 0;
		LOC2 = sonslen_193403(n);
		HEX3Atmp_363709 = (NI)(LOC2 - ((NI) 1));
		res_363712 = ((NI) 0);
		{
			while (1) {
				Tnode190813* x;
				if (!(res_363712 <= HEX3Atmp_363709)) goto LA4;
				i_363692 = res_363712;
				x = transformouterproc_363076(o, (*n).kindU.S6.sons->data[i_363692], it);
				{
					if (!!((x == NIM_NIL))) goto LA7;
					asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_363692]), x);
				}
				LA7: ;
				res_363712 += ((NI) 1);
			} LA4: ;
		}
	}
}

N_NIMCALL(Tnode190813*, transformreturn_363658)(Toutercontext360022* c, Tnode190813* n, Titer360016* it) {
	Tnode190813* result;
	Tnode190813* stateasgnstmt;
	Tnode190813* LOC1;
	Tnode190813* LOC2;
	Ttype190849* LOC3;
	Tnode190813* LOC4;
	result = 0;
	result = newnodei_192351(((NU8) 115), (*n).info);
	stateasgnstmt = newnodei_192351(((NU8) 73), (*n).info);
	LOC1 = 0;
	LOC1 = newsymnode_192325((*it).closureparam);
	LOC2 = 0;
	LOC2 = rawindirectaccess_357408(LOC1, (*it).state, (*n).info);
	add_191164(stateasgnstmt, LOC2);
	LOC3 = 0;
	LOC3 = getsystype_238030(((NU8) 31));
	LOC4 = 0;
	LOC4 = newinttypenode_191619(((NU8) 6), IL64(-1), LOC3);
	add_191164(stateasgnstmt, LOC4);
	add_191164(result, stateasgnstmt);
	add_191164(result, n);
	return result;
}

N_NIMCALL(Tnode190813*, transformouterproc_363076)(Toutercontext360022* o, Tnode190813* n, Titer360016* it) {
	Tnode190813* result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (n == NIM_NIL);
		if (LOC3) goto LA4;
		LOC3 = (((*n).flags &(1<<((((NU8) 7))&15)))!=0);
		LA4: ;
		if (!LOC3) goto LA5;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA5: ;
	switch ((*n).kind) {
	case ((NU8) 1) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		Tsym190843* local;
		Tenv360020* closure;
		Tidobj167015* LOC71;
		TNimObject* LOC72;
		Tidobj167015* LOC91;
		local = (*n).kindU.S4.sym;
		{
			NIM_BOOL LOC11;
			Tnode190813* body;
			Tnode190813* newbody;
			Titer360016 LOC15;
			LOC11 = 0;
			LOC11 = isinnerproc_361286(local, (*o).fn);
			if (!(LOC11)) goto LA12;
			LOC11 = contains_187829((&(*o).processed), (*local).Sup.id);
			LA12: ;
			if (!LOC11) goto LA13;
			excl_187871((&(*o).processed), (*local).Sup.id);
			body = getbody_235647(local);
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_360807(local, (&LOC15));
			newbody = transformouterprocbody_364614(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_363044(local);
			LA24: ;
			LOC22 = LOC23;
			if (!(LOC22)) goto LA25;
			LOC22 = ((*it).fn == (*local).owner);
			LA25: ;
			if (!LOC22) goto LA26;
			{
				NIM_BOOL LOC30;
				Tidobj167015* LOC33;
				LOC30 = 0;
				LOC30 = contains_187829((&(*o).capturedvars), (*local).Sup.id);
				if (!LOC30) goto LA31;
				LOC33 = 0;
				LOC33 = &local->Sup;
				result = idnodetableget_198212((*o).localstoaccess, LOC33);
				goto BeforeRet;
			}
			goto LA28;
			LA31: ;
			{
				Tnode190813* LOC35;
				adduniquefield_357808((*it).obj, local);
				LOC35 = 0;
				LOC35 = newsymnode_192325((*it).closureparam);
				result = indirectaccess_358838(LOC35, local, (*n).info);
				goto BeforeRet;
			}
			LA28: ;
		}
		LA26: ;
		{
			Tenv360020* closure;
			Tidobj167015* LOC46;
			TNimObject* LOC47;
			if (!((*local).kind == ((NU8) 15))) goto LA38;
			{
				NIM_BOOL LOC42;
				LOC42 = 0;
				LOC42 = (local == (*o).fn);
				if (LOC42) goto LA43;
				LOC42 = (local == (*it).fn);
				LA43: ;
				if (!LOC42) goto LA44;
				message_165188((*n).info, ((NU16) 25), (*(*local).name).s);
			}
			LA44: ;
			LOC46 = 0;
			LOC46 = &local->Sup;
			LOC47 = 0;
			LOC47 = idtableget_198182((*o).lambdastoenv, LOC46);
			closure = ((Tenv360020*) (LOC47));
			{
				if (!closure == 0) goto LA50;
				result = liftitersym_363731(n, (*o).fn);
				goto BeforeRet;
			}
			goto LA48;
			LA50: ;
			{
				Tnode190813* createdvar;
				Ttype190849* lpt;
				Tsym190843* LOC53;
				createdvar = generateiterclosurecreation_362895(o, closure, (*closure).attachednode);
				LOC53 = 0;
				LOC53 = gethiddenparam_360407(local);
				lpt = (*LOC53).typ;
				{
					if (!!((lpt == (*createdvar).typ))) goto LA56;
					{
						NIM_BOOL LOC60;
						NI LOC61;
						NI LOC63;
						LOC60 = 0;
						LOC61 = 0;
						LOC61 = len_193377((*(*createdvar).typ).sons->data[((NI) 0)]);
						LOC60 = (LOC61 == ((NI) 1));
						if (!(LOC60)) goto LA62;
						LOC63 = 0;
						LOC63 = len_193377((*lpt).sons->data[((NI) 0)]);
						LOC60 = (((NI) 1) <= LOC63);
						LA62: ;
						if (!LOC60) goto LA64;
						asgnRefNoCycle((void**) (&(*createdvar).typ), lpt);
						{
							if (!((*createdvar).kind == ((NU8) 3))) goto LA68;
							asgnRefNoCycle((void**) (&(*(*createdvar).kindU.S4.sym).typ), lpt);
						}
						LA68: ;
						asgnRefNoCycle((void**) (&(*closure).obj), (*lpt).sons->data[((NI) 0)]);
					}
					goto LA58;
					LA64: ;
					{
						internalerror_165199((*n).info, ((NimStringDesc*) &TMP3312));
					}
					LA58: ;
				}
				LA56: ;
				result = makeclosure_362034(local, createdvar, (*n).info);
				goto BeforeRet;
			}
			LA48: ;
		}
		LA38: ;
		LOC71 = 0;
		LOC71 = &local->Sup;
		LOC72 = 0;
		LOC72 = idtableget_198182((*o).lambdastoenv, LOC71);
		closure = ((Tenv360020*) (LOC72));
		{
			Tnode190813* a;
			if (!!((closure == NIM_NIL))) goto LA75;
			a = (*closure).createdvar;
			{
				if (!!((a == NIM_NIL))) goto LA79;
				result = makeclosure_362034(local, a, (*n).info);
				goto BeforeRet;
			}
			goto LA77;
			LA79: ;
			{
				Tnode190813* scope;
				Tnode190813* x;
				scope = (*closure).attachednode;
				{
					if (!((*(*scope).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 1))) goto LA84;
					asgnRefNoCycle((void**) (&(*scope).kindU.S6.sons->data[((NI) 0)]), generateclosurecreation_362883(o, closure));
				}
				LA84: ;
				x = (*closure).createdvar;
				result = makeclosure_362034(local, x, (*n).info);
				goto BeforeRet;
			}
			LA77: ;
		}
		LA75: ;
		{
			NIM_BOOL LOC88;
			LOC88 = 0;
			LOC88 = contains_187829((&(*o).capturedvars), (*local).Sup.id);
			if (!!(LOC88)) goto LA89;
			goto BeforeRet;
		}
		LA89: ;
		LOC91 = 0;
		LOC91 = &local->Sup;
		result = idnodetableget_198212((*o).localstoaccess, LOC91);
	}
	break;
	case ((NU8) 51):
	case ((NU8) 84):
	case ((NU8) 52):
	{
		{
			if (!!(((*n).typ == NIM_NIL))) goto LA95;
			result = transformouterproc_363076(o, (*n).kindU.S6.sons->data[((NI) 0)], it);
		}
		LA95: ;
	}
	break;
	case ((NU8) 79):
	case ((NU8) 80):
	case ((NU8) 81):
	case ((NU8) 82):
	case ((NU8) 83):
	{
	}
	break;
	case ((NU8) 155):
	{
		{
			Tsym190843* local;
			if (!((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 3))) goto LA101;
			local = (*(*n).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym;
			{
				NIM_BOOL LOC105;
				Tnode190813* body;
				Tnode190813* newbody;
				Titer360016 LOC109;
				LOC105 = 0;
				LOC105 = isinnerproc_361286(local, (*o).fn);
				if (!(LOC105)) goto LA106;
				LOC105 = contains_187829((&(*o).processed), (*local).Sup.id);
				LA106: ;
				if (!LOC105) goto LA107;
				excl_187871((&(*o).processed), (*local).Sup.id);
				body = getbody_235647(local);
				memset((void*)(&LOC109), 0, sizeof(LOC109));
				inititer_360807(local, (&LOC109));
				newbody = transformouterprocbody_364614(o, body, (&LOC109));
				{
					if (!!((newbody == NIM_NIL))) goto LA112;
					asgnRefNoCycle((void**) (&(*(*local).ast).kindU.S6.sons->data[((NI) 6)]), newbody);
				}
				LA112: ;
			}
			LA107: ;
		}
		LA101: ;
	}
	break;
	case ((NU8) 58):
	case ((NU8) 59):
	case ((NU8) 60):
	{
		Tnode190813* x;
		x = transformouterproc_363076(o, (*n).kindU.S6.sons->data[((NI) 1)], it);
		{
			if (!!((x == NIM_NIL))) goto LA117;
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 1)]), x);
		}
		LA117: ;
		result = transformouterconv_361993(n);
	}
	break;
	case ((NU8) 104):
	{
		{
			if (!((*(*it).fn).kind == ((NU8) 15))) goto LA122;
			result = transformyield_363084(o, n, it);
		}
		goto LA120;
		LA122: ;
		{
			outerprocsons_363675(o, n, it);
		}
		LA120: ;
	}
	break;
	case ((NU8) 109):
	{
		{
			if (!((*(*it).fn).kind == ((NU8) 15))) goto LA128;
			result = transformreturn_363658(o, n, it);
		}
		goto LA126;
		LA128: ;
		{
			outerprocsons_363675(o, n, it);
		}
		LA126: ;
	}
	break;
	default:
	{
		outerprocsons_363675(o, n, it);
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode190813*, transformouterprocbody_364614)(Toutercontext360022* o, Tnode190813* n, Titer360016* it) {
	Tnode190813* result;
{	result = 0;
	{
		if (!(((*n).flags &(1<<((((NU8) 7))&15)))!=0)) goto LA3;
		result = NIM_NIL;
	}
	goto LA1;
	LA3: ;
	{
		Tnode190813* gs;
		Tnode190813* LOC35;
		Tnode190813* LOC36;
		Tnode190813* state0;
		Tnode190813* LOC37;
		Tnode190813* newbody;
		Tnode190813* stateasgnstmt;
		Tnode190813* LOC43;
		Tnode190813* LOC44;
		Ttype190849* LOC45;
		Tnode190813* 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_191097(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;
				Tnode190813* LOC26;
				Tnode190813* LOC28;
				NI LOC29;
				Tnode190813* LOC31;
				Tnode190813* LOC32;
				LOC21 = 0;
				LOC22 = 0;
				LOC23 = 0;
				LOC24 = 0;
				LOC24 = len_191097(n);
				LOC23 = (((NI) 1) < LOC24);
				if (!(LOC23)) goto LA25;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_191244(n, ((NI) 1));
				LOC23 = ((*LOC26).kind == ((NU8) 115));
				LA25: ;
				LOC22 = LOC23;
				if (!(LOC22)) goto LA27;
				LOC28 = 0;
				LOC28 = HEX5BHEX5D_191244(n, ((NI) 1));
				LOC29 = 0;
				LOC29 = len_191097(LOC28);
				LOC22 = (((NI) 0) < LOC29);
				LA27: ;
				LOC21 = LOC22;
				if (!(LOC21)) goto LA30;
				LOC31 = 0;
				LOC31 = HEX5BHEX5D_191244(n, ((NI) 1));
				LOC32 = 0;
				LOC32 = HEX5BHEX5D_191244(LOC31, ((NI) 0));
				LOC21 = ((*LOC32).kind == ((NU8) 156));
				LA30: ;
				if (!LOC21) goto LA33;
				result = NIM_NIL;
				goto BeforeRet;
			}
			LA33: ;
		}
		LA13: ;
		result = newnodei_192351(((NU8) 115), (*(*it).fn).info);
		gs = newnodei_192351(((NU8) 156), (*(*it).fn).info);
		LOC35 = 0;
		LOC35 = newsymnode_192325((*it).closureparam);
		LOC36 = 0;
		LOC36 = rawindirectaccess_357408(LOC35, (*it).state, (*(*it).fn).info);
		add_191164(gs, LOC36);
		add_191164(result, gs);
		state0 = newnodei_192351(((NU8) 157), (*(*it).fn).info);
		LOC37 = 0;
		LOC37 = newintnode_191607(((NU8) 6), IL64(0));
		add_191164(state0, LOC37);
		add_191164(result, state0);
		newbody = transformouterproc_363076(o, n, it);
		{
			if (!!((newbody == NIM_NIL))) goto LA40;
			add_191164(result, newbody);
		}
		goto LA38;
		LA40: ;
		{
			add_191164(result, n);
		}
		LA38: ;
		stateasgnstmt = newnodei_192351(((NU8) 73), (*(*it).fn).info);
		LOC43 = 0;
		LOC43 = newsymnode_192325((*it).closureparam);
		LOC44 = 0;
		LOC44 = rawindirectaccess_357408(LOC43, (*it).state, (*(*it).fn).info);
		add_191164(stateasgnstmt, LOC44);
		LOC45 = 0;
		LOC45 = getsystype_238030(((NU8) 31));
		LOC46 = 0;
		LOC46 = newinttypenode_191619(((NU8) 6), IL64(-1), LOC45);
		add_191164(stateasgnstmt, LOC46);
		add_191164(result, stateasgnstmt);
		(*result).flags |= ((NI16)1)<<((((NU8) 7))%(sizeof(NI16)*8));
	}
	goto LA1;
	LA6: ;
	{
		result = transformouterproc_363076(o, n, it);
		{
			if (!!((result == NIM_NIL))) goto LA50;
			(*result).flags |= ((NI16)1)<<((((NU8) 7))%(sizeof(NI16)*8));
		}
		LA50: ;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, finishenvironments_364224)(Toutercontext360022* o) {
	Tenv360020* env;
	env = (*o).head;
	{
		while (1) {
			if (!!((env == NIM_NIL))) goto LA2;
			{
				Tnode190813* 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(Tnode190813*, liftlambdas_366240)(Tsym190843* fn, Tnode190813* body) {
	Tnode190813* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		Tsym190843* LOC7;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*body).kind == ((NU8) 1));
		if (LOC4) goto LA5;
		LOC4 = (gcmd_154130 == ((NU8) 4));
		LA5: ;
		LOC3 = LOC4;
		if (LOC3) goto LA6;
		LOC7 = 0;
		LOC7 = skipgenericowner_195696(fn);
		LOC3 = !(((*LOC7).kind == ((NU8) 6)));
		LA6: ;
		if (!LOC3) goto LA8;
		result = body;
	}
	goto LA1;
	LA8: ;
	{
		Toutercontext360022* o;
		Tnode190813* ex;
		Tenv360020* env;
		o = newoutercontext_361029(fn);
		ex = closurecreationpoint_362312(body);
		env = newenv_361049(o, NIM_NIL, ex, fn);
		addparamstoenv_362343(fn, env);
		searchforinnerprocs_362423(o, body, env);
		createenvironments_364010(o);
		{
			Titer360016 LOC15;
			if (!((*fn).kind == ((NU8) 15))) goto LA13;
			memset((void*)(&LOC15), 0, sizeof(LOC15));
			inititer_360807(fn, (&LOC15));
			result = transformouterprocbody_364614(o, body, (&LOC15));
		}
		goto LA11;
		LA13: ;
		{
			Titer360016 LOC17;
			Tnode190813* LOC18;
			memset((void*)(&LOC17), 0, sizeof(LOC17));
			inititer_360807(fn, (&LOC17));
			LOC18 = 0;
			LOC18 = transformouterprocbody_364614(o, body, (&LOC17));
			result = ex;
		}
		LA11: ;
		finishenvironments_364224(o);
	}
	LA1: ;
	return result;
}

N_NIMCALL(Tnode190813*, liftlambdasfortoplevel_366291)(Tsym190843* module, Tnode190813* body) {
	Tnode190813* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*body).kind == ((NU8) 1));
		if (LOC3) goto LA4;
		LOC3 = (gcmd_154130 == ((NU8) 4));
		LA4: ;
		if (!LOC3) goto LA5;
		result = body;
	}
	goto LA1;
	LA5: ;
	{
		Toutercontext360022* o;
		Tnode190813* ex;
		Tenv360020* env;
		Titer360016 LOC8;
		Tnode190813* LOC9;
		o = newoutercontext_361029(module);
		ex = closurecreationpoint_362312(body);
		env = newenv_361049(o, NIM_NIL, ex, module);
		searchforinnerprocs_362423(o, body, env);
		createenvironments_364010(o);
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		inititer_360807(module, (&LOC8));
		LOC9 = 0;
		LOC9 = transformouterproc_363076(o, body, (&LOC8));
		finishenvironments_364224(o);
		result = ex;
	}
	LA1: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, nimsrc_lambdaliftingInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, nimsrc_lambdaliftingDatInit)(void) {
static TNimNode* TMP3295[6];
static TNimNode* TMP3296[11];
static TNimNode TMP928[19];
NTI360022.size = sizeof(Toutercontext360022);
NTI360022.kind = 18;
NTI360022.base = 0;
TMP3295[0] = &TMP928[1];
TMP928[1].kind = 1;
TMP928[1].offset = offsetof(Toutercontext360022, fn);
TMP928[1].typ = (&NTI190811);
TMP928[1].name = "fn";
TMP3295[1] = &TMP928[2];
NTI360020.size = sizeof(Tenv360020);
NTI360020.kind = 17;
NTI360020.base = (&NTI3411);
TMP3296[0] = &TMP928[4];
TMP928[4].kind = 1;
TMP928[4].offset = offsetof(Tenv360020, attachednode);
TMP928[4].typ = (&NTI190805);
TMP928[4].name = "attachedNode";
TMP3296[1] = &TMP928[5];
TMP928[5].kind = 1;
TMP928[5].offset = offsetof(Tenv360020, replacementnode);
TMP928[5].typ = (&NTI190805);
TMP928[5].name = "replacementNode";
TMP3296[2] = &TMP928[6];
TMP928[6].kind = 1;
TMP928[6].offset = offsetof(Tenv360020, createdvar);
TMP928[6].typ = (&NTI190805);
TMP928[6].name = "createdVar";
TMP3296[3] = &TMP928[7];
TMP928[7].kind = 1;
TMP928[7].offset = offsetof(Tenv360020, createdvarcomesfromiter);
TMP928[7].typ = (&NTI138);
TMP928[7].name = "createdVarComesFromIter";
TMP3296[4] = &TMP928[8];
TMP928[8].kind = 1;
TMP928[8].offset = offsetof(Tenv360020, capturedvars);
TMP928[8].typ = (&NTI190815);
TMP928[8].name = "capturedVars";
TMP3296[5] = &TMP928[9];
TMP928[9].kind = 1;
TMP928[9].offset = offsetof(Tenv360020, up);
TMP928[9].typ = (&NTI360018);
TMP928[9].name = "up";
TMP3296[6] = &TMP928[10];
TMP928[10].kind = 1;
TMP928[10].offset = offsetof(Tenv360020, next);
TMP928[10].typ = (&NTI360018);
TMP928[10].name = "next";
TMP3296[7] = &TMP928[11];
TMP928[11].kind = 1;
TMP928[11].offset = offsetof(Tenv360020, upfield);
TMP928[11].typ = (&NTI190811);
TMP928[11].name = "upField";
TMP3296[8] = &TMP928[12];
TMP928[12].kind = 1;
TMP928[12].offset = offsetof(Tenv360020, obj);
TMP928[12].typ = (&NTI190809);
TMP928[12].name = "obj";
TMP3296[9] = &TMP928[13];
TMP928[13].kind = 1;
TMP928[13].offset = offsetof(Tenv360020, fn);
TMP928[13].typ = (&NTI190811);
TMP928[13].name = "fn";
TMP3296[10] = &TMP928[14];
TMP928[14].kind = 1;
TMP928[14].offset = offsetof(Tenv360020, vars);
TMP928[14].typ = (&NTI187056);
TMP928[14].name = "vars";
TMP928[3].len = 11; TMP928[3].kind = 2; TMP928[3].sons = &TMP3296[0];
NTI360020.node = &TMP928[3];
NTI360018.size = sizeof(Tenv360020*);
NTI360018.kind = 22;
NTI360018.base = (&NTI360020);
NTI360018.marker = TMP3297;
TMP928[2].kind = 1;
TMP928[2].offset = offsetof(Toutercontext360022, head);
TMP928[2].typ = (&NTI360018);
TMP928[2].name = "head";
TMP3295[2] = &TMP928[15];
TMP928[15].kind = 1;
TMP928[15].offset = offsetof(Toutercontext360022, capturedvars);
TMP928[15].typ = (&NTI187056);
TMP928[15].name = "capturedVars";
TMP3295[3] = &TMP928[16];
TMP928[16].kind = 1;
TMP928[16].offset = offsetof(Toutercontext360022, processed);
TMP928[16].typ = (&NTI187056);
TMP928[16].name = "processed";
TMP3295[4] = &TMP928[17];
TMP928[17].kind = 1;
TMP928[17].offset = offsetof(Toutercontext360022, localstoaccess);
TMP928[17].typ = (&NTI190867);
TMP928[17].name = "localsToAccess";
TMP3295[5] = &TMP928[18];
TMP928[18].kind = 1;
TMP928[18].offset = offsetof(Toutercontext360022, lambdastoenv);
TMP928[18].typ = (&NTI190861);
TMP928[18].name = "lambdasToEnv";
TMP928[0].len = 6; TMP928[0].kind = 2; TMP928[0].sons = &TMP3295[0];
NTI360022.node = &TMP928[0];
NTI360014.size = sizeof(Toutercontext360022*);
NTI360014.kind = 22;
NTI360014.base = (&NTI360022);
NTI360014.marker = TMP3298;
}

