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

#include "nimbase.h"
#include <string.h>
typedef struct Tnode224809 Tnode224809;
typedef struct Tcontext279023 Tcontext279023;
typedef struct Tidtable224859 Tidtable224859;
typedef struct Tidpairseq224857 Tidpairseq224857;
typedef struct Tsym224841 Tsym224841;
typedef struct Trepltypevars301577 Trepltypevars301577;
typedef struct Tlineinfo189352 Tlineinfo189352;
typedef struct Ttype224847 Ttype224847;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tident197021 Tident197021;
typedef struct Tnodeseq224803 Tnodeseq224803;
typedef struct Tidobj197015 Tidobj197015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq224843 Ttypeseq224843;
typedef struct Tloc224823 Tloc224823;
typedef struct Ropeobj175009 Ropeobj175009;
typedef struct TY90959 TY90959;
typedef struct Tscope224835 Tscope224835;
typedef struct TY224944 TY224944;
typedef struct Tstrtable224813 Tstrtable224813;
typedef struct Tsymseq224811 Tsymseq224811;
typedef struct Tlib224827 Tlib224827;
typedef struct Cell48947 Cell48947;
typedef struct Cellseq48963 Cellseq48963;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48959 Cellset48959;
typedef struct Pagedesc48955 Pagedesc48955;
typedef struct Memregion30891 Memregion30891;
typedef struct Smallchunk30843 Smallchunk30843;
typedef struct Llchunk30885 Llchunk30885;
typedef struct Bigchunk30845 Bigchunk30845;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30889 Avlnode30889;
typedef struct Gcstat51014 Gcstat51014;
typedef struct Tpasscontext276005 Tpasscontext276005;
typedef struct Tproccon279011 Tproccon279011;
typedef struct Intset221056 Intset221056;
typedef struct Trunk221052 Trunk221052;
typedef struct Trunkseq221054 Trunkseq221054;
typedef struct Tlinkedlist140028 Tlinkedlist140028;
typedef struct Tlistentry140022 Tlistentry140022;
typedef struct Tctx278048 Tctx278048;
typedef struct TY279143 TY279143;
typedef struct Tidpair224855 Tidpair224855;
typedef struct Tinstantiation224831 Tinstantiation224831;
typedef struct Basechunk30841 Basechunk30841;
typedef struct Freecell30833 Freecell30833;
typedef struct TY278254 TY278254;
typedef struct TY190417 TY190417;
typedef struct PprocHEX3Aobjecttype278233 PprocHEX3Aobjecttype278233;
typedef struct TY278273 TY278273;
typedef struct Tinstantiationpair279013 Tinstantiationpair279013;
typedef struct TY224932 TY224932;
typedef struct TY278234 TY278234;
typedef struct TY278239 TY278239;
typedef struct TY278274 TY278274;
typedef struct Vmargs278042 Vmargs278042;
typedef struct Tblock278030 Tblock278030;
typedef struct TY278214 TY278214;
struct  Tidtable224859  {
NI counter;
Tidpairseq224857* data;
};
struct  Tlineinfo189352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Trepltypevars301577  {
Tcontext279023* c;
Tidtable224859 typemap;
Tidtable224859 symmap;
Tidtable224859 localcache;
Tlineinfo189352 info;
NIM_BOOL allowmetatypes;
NIM_BOOL skiptypedesc;
Tsym224841* owner;
NI recursionlimit;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode224809  {
Ttype224847* typ;
Tlineinfo189352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym224841* sym;
} S4;
struct {Tident197021* ident;
} S5;
struct {Tnodeseq224803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
typedef N_NIMCALL_PTR(void, TY3889) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3894) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3889 marker;
TY3894 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj197015  {
  TNimObject Sup;
NI id;
};
struct  Tloc224823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype224847* t;
Ropeobj175009* r;
Ropeobj175009* heaproot;
};
struct  Ttype224847  {
  Tidobj197015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq224843* sons;
Tnode224809* n;
Tsym224841* owner;
Tsym224841* sym;
Tsym224841* destructor;
Tsym224841* deepcopy;
Tsym224841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc224823 loc;
};
struct TY90959 {
NimStringDesc* Field0;
NI Field1;
};
struct  Tstrtable224813  {
NI counter;
Tsymseq224811* data;
};
struct  Tsym224841  {
  Tidobj197015 Sup;
NU8 kind;
union{
struct {Ttypeseq224843* typeinstcache;
Tscope224835* typscope;
} S1;
struct {TY224944* procinstcache;
Tsym224841* gcunsafetyreason;
} S2;
struct {TY224944* usedgenerics;
Tstrtable224813 tab;
} S3;
struct {Tsym224841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype224847* typ;
Tident197021* name;
Tlineinfo189352 info;
Tsym224841* owner;
NU32 flags;
Tnode224809* ast;
NU32 options;
NI position;
NI offset;
Tloc224823 loc;
Tlib224827* annex;
Tnode224809* constraint;
};
struct  Cell48947  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48963  {
NI len;
NI cap;
Cell48947** d;
};
struct  Cellset48959  {
NI counter;
NI max;
Pagedesc48955* head;
Pagedesc48955** data;
};
typedef Smallchunk30843* TY30906[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30891  {
NI minlargeobj;
NI maxlargeobj;
TY30906 freesmallchunks;
Llchunk30885* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30845* freechunkslist;
Intset30817 chunkstarts;
Avlnode30889* root;
Avlnode30889* deleted;
Avlnode30889* last;
Avlnode30889* freeavlnodes;
};
struct  Gcstat51014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap51018  {
Gcstack51016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq48963 zct;
Cellseq48963 decstack;
Cellset48959 cycleroots;
Cellseq48963 tempstack;
NI recgclock;
Memregion30891 region;
Gcstat51014 stat;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef Ttype224847* TY392275[1];
struct  Tpasscontext276005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset221056  {
NI counter;
NI max;
Trunk221052* head;
Trunkseq221054* data;
};
struct  Tlinkedlist140028  {
Tlistentry140022* head;
Tlistentry140022* tail;
NI counter;
};
typedef N_NIMCALL_PTR(Tnode224809*, TY279074) (Tcontext279023* c, Tnode224809* n);
typedef N_NIMCALL_PTR(Tnode224809*, TY279079) (Tcontext279023* c, Tnode224809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode224809*, TY279087) (Tcontext279023* c, Tnode224809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode224809*, TY279095) (Tcontext279023* c, Tnode224809* n);
typedef N_NIMCALL_PTR(Tnode224809*, TY279100) (Tcontext279023* c, Tnode224809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode224809*, TY279108) (Tcontext279023* c, Tnode224809* n);
typedef N_NIMCALL_PTR(Tnode224809*, TY279113) (Tcontext279023* c, Tnode224809* n, Tnode224809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype224847*, TY279120) (Tcontext279023* c, Tnode224809* n, Ttype224847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode224809*, ClPrc) (Tcontext279023* c, Tidtable224859 pt, Tnode224809* n, void* ClEnv);
void* ClEnv;
} TY279126;
typedef struct {
N_NIMCALL_PTR(Tsym224841*, ClPrc) (Tcontext279023* c, Tsym224841* fn, Tidtable224859 pt, Tlineinfo189352 info, void* ClEnv);
void* ClEnv;
} TY279132;
typedef N_NIMCALL_PTR(Tsym224841*, TY279148) (Tcontext279023* c, Tsym224841* dc, Ttype224847* t, Tlineinfo189352 info, NU8 op);
struct  Tcontext279023  {
  Tpasscontext276005 Sup;
Tsym224841* module;
Tscope224835* currentscope;
Tscope224835* importtable;
Tscope224835* toplevelscope;
Tproccon279011* p;
Tsymseq224811* friendmodules;
NI instcounter;
Intset221056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq224811* converters;
Tsymseq224811* patterns;
Tlinkedlist140028 optionstack;
Tidtable224859 symmapping;
Tlinkedlist140028 libs;
TY279074 semconstexpr;
TY279079 semexpr;
TY279087 semtryexpr;
TY279095 semtryconstexpr;
TY279100 semoperand;
TY279108 semconstboolexpr;
TY279113 semoverloadedcall;
TY279120 semtypenode;
TY279126 seminferredlambda;
TY279132 semgenerateinstance;
Intset221056 includedfiles;
Tstrtable224813 userpragmas;
Tctx278048* evalcontext;
Intset221056 unknownidents;
TY279143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY279148 insttypeboundop;
};
struct  Tidpair224855  {
Tidobj197015* key;
TNimObject* val;
};
struct  Tident197021  {
  Tidobj197015 Sup;
NimStringDesc* s;
Tident197021* next;
NI h;
};
struct  Ropeobj175009  {
  TNimObject Sup;
Ropeobj175009* left;
Ropeobj175009* right;
NI length;
NimStringDesc* data;
};
struct  Tscope224835  {
NI depthlevel;
Tstrtable224813 symbols;
Tnodeseq224803* usingsyms;
Tscope224835* parent;
};
struct  Tlistentry140022  {
  TNimObject Sup;
Tlistentry140022* prev;
Tlistentry140022* next;
};
struct  Tlib224827  {
  Tlistentry140022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj175009* name;
Tnode224809* path;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30822[8];
struct  Pagedesc48955  {
Pagedesc48955* next;
NI key;
TY30822 bits;
};
struct  Basechunk30841  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30843  {
  Basechunk30841 Sup;
Smallchunk30843* next;
Smallchunk30843* prev;
Freecell30833* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30885  {
NI size;
NI acc;
Llchunk30885* next;
};
struct  Bigchunk30845  {
  Basechunk30841 Sup;
Bigchunk30845* next;
Bigchunk30845* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30822 bits;
};
typedef Avlnode30889* TY30896[2];
struct  Avlnode30889  {
TY30896 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon279011  {
Tsym224841* owner;
Tsym224841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon279011* next;
NIM_BOOL wasforwarded;
Tnode224809* bracketexpr;
};
struct  Trunk221052  {
Trunk221052* next;
NI key;
TY30822 bits;
};
struct  Tctx278048  {
  Tpasscontext276005 Sup;
TY278254* code;
TY190417* debug;
Tnode224809* globals;
Tnode224809* constants;
Ttypeseq224843* types;
Tnode224809* currentexceptiona;
Tnode224809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype278233* prc;
Tsym224841* module;
Tnode224809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo189352 comesfromheuristic;
TY278273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair279013  {
Tsym224841* genericsym;
Tinstantiation224831* inst;
};
struct  Tinstantiation224831  {
Tsym224841* sym;
Ttypeseq224843* concretetypes;
TY224932* usedby;
NI compilesid;
};
struct  Freecell30833  {
Freecell30833* next;
NI zerofield;
};
struct TY278239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY278239 TY278242[256];
struct  PprocHEX3Aobjecttype278233  {
TY278234* blocks;
Tsym224841* sym;
TY278242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs278042* args, void* ClEnv);
void* ClEnv;
} Vmcallback278044;
struct TY278274 {
NimStringDesc* Field0;
Vmcallback278044 Field1;
};
struct  Tblock278030  {
Tsym224841* label;
TY278214* fixups;
};
struct  Vmargs278042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode224809* currentexception;
};
struct Ttypeseq224843 {
  TGenericSeq Sup;
  Ttype224847* data[SEQ_DECL_SIZE];
};
struct Tnodeseq224803 {
  TGenericSeq Sup;
  Tnode224809* data[SEQ_DECL_SIZE];
};
struct Tidpairseq224857 {
  TGenericSeq Sup;
  Tidpair224855 data[SEQ_DECL_SIZE];
};
struct TY224944 {
  TGenericSeq Sup;
  Tinstantiation224831* data[SEQ_DECL_SIZE];
};
struct Tsymseq224811 {
  TGenericSeq Sup;
  Tsym224841* data[SEQ_DECL_SIZE];
};
struct Trunkseq221054 {
  TGenericSeq Sup;
  Trunk221052* data[SEQ_DECL_SIZE];
};
struct TY279143 {
  TGenericSeq Sup;
  Tinstantiationpair279013 data[SEQ_DECL_SIZE];
};
struct TY278254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY190417 {
  TGenericSeq Sup;
  Tlineinfo189352 data[SEQ_DECL_SIZE];
};
struct TY278273 {
  TGenericSeq Sup;
  TY278274 data[SEQ_DECL_SIZE];
};
struct TY224932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY278234 {
  TGenericSeq Sup;
  Tblock278030 data[SEQ_DECL_SIZE];
};
struct TY278214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, inittypevars_303846)(Tcontext279023* p, Tidtable224859 pt, Tlineinfo189352 info, Tsym224841* owner, Trepltypevars301577* Result);
N_NIMCALL(void, initidtable_228057)(Tidtable224859* x);
N_NIMCALL(void, copyidtable_226091)(Tidtable224859* dest, Tidtable224859 src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, pushinfocontext_190578)(Tlineinfo189352 info);
N_NIMCALL(Tnode224809*, replacetypevarsn_301606)(Trepltypevars301577* cl, Tnode224809* n_301610);
N_NIMCALL(Tnode224809*, copynode_228660)(Tnode224809* src);
N_NIMCALL(Ttype224847*, replacetypevarst_301627)(Trepltypevars301577* cl, Ttype224847* t);
N_NIMCALL(Ttype224847*, replacetypevarstaux_301590)(Trepltypevars301577* cl, Ttype224847* t);
N_NIMCALL(TNimObject*, idtableget_232182)(Tidtable224859 t, Tidobj197015* key);
N_NIMCALL(Ttype224847*, handlegenericinvocation_302760)(Trepltypevars301577* cl, Ttype224847* t);
N_NIMCALL(void, internalerror_195172)(Tlineinfo189352 info, NimStringDesc* errmsg);
N_NIMCALL(Ttype224847*, searchinsttypes_301207)(Ttype224847* key);
N_NIMCALL(void, internalerror_195191)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_195279)(TY90959 x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_263739)(Ttypeseq224843* x, Ttypeseq224843* y);
N_NIMCALL(NIM_BOOL, comparetypes_261047)(Ttype224847* x, Ttype224847* y, NU8 cmp, NU8 flags);
N_NIMCALL(NI, sonslen_227351)(Ttype224847* n);
N_NIMCALL(Ttype224847*, lookuptypevar_302649)(Trepltypevars301577* cl, Ttype224847* t);
N_NIMCALL(void, localerror_195128)(Tlineinfo189352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, typetostring_254032)(Ttype224847* typ, NU8 prefer);
N_NIMCALL(Ttype224847*, errortype_280161)(Tcontext279023* c);
N_NIMCALL(void, idtableput_232196)(Tidtable224859* t, Tidobj197015* key, TNimObject* val);
N_NIMCALL(Ttype224847*, instcopytype_302694)(Trepltypevars301577* cl, Ttype224847* t);
N_NIMCALL(Ttype224847*, copytype_227542)(Ttype224847* t, Tsym224841* owner, NIM_BOOL keepid);
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, propagatetoowner_228274)(Ttype224847* owner, Ttype224847* elem);
N_NIMCALL(Ttype224847*, newtype_227140)(NU8 kind, Tsym224841* owner);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(void, cachetypeinst_301483)(Ttype224847* inst);
N_NIMCALL(Ttype224847*, lastson_227426)(Ttype224847* n);
N_NIMCALL(void, safeadd_301522)(Ttypeseq224843** x, Ttype224847* y);
N_NIMCALL(void, rawaddson_228498)(Ttype224847* father, Ttype224847* son);
N_NIMCALL(NIM_BOOL, isgenericalias_260091)(Ttype224847* t);
N_NIMCALL(Ttype224847*, skipgenericalias_260119)(Ttype224847* t);
N_NIMCALL(void, checkpartialconstructedtype_301063)(Tlineinfo189352 info, Ttype224847* t);
N_NIMCALL(Ttype224847*, skiptypes_228167)(Ttype224847* t, NU64 kinds);
N_NIMCALL(void, sharedptrcheck_301014)(Tlineinfo189352 info, Ttype224847* t);
N_NIMCALL(NI, len_227369)(Ttype224847* n);
static N_INLINE(NIM_BOOL, isgcedmem_228235)(Ttype224847* t);
N_NIMCALL(Tnode224809*, preparenode_301807)(Trepltypevars301577* cl, Tnode224809* n);
N_NIMCALL(Tsym224841*, replacetypevarss_301598)(Trepltypevars301577* cl, Tsym224841* s);
N_NIMCALL(Tsym224841*, copysym_227607)(Tsym224841* s, NIM_BOOL keepid);
static N_INLINE(NI, safelen_225126)(Tnode224809* n);
N_NIMCALL(void, add_225165)(Tnode224809* father, Tnode224809* son);
static N_INLINE(Tnode224809*, HEX5BHEX5D_225244)(Tnode224809* n, NI i);
N_NIMCALL(Ttype224847*, newtypes_279220)(NU8 kind, Tcontext279023* c);
static N_INLINE(Ttype224847*, skipintlit_273698)(Ttype224847* t);
N_NIMCALL(Ttype224847*, getsystype_273190)(NU8 kind);
N_NIMCALL(Ttype224847*, base_254039)(Ttype224847* t);
N_NIMCALL(Ttype224847*, maketypedesc_279683)(Tcontext279023* c, Ttype224847* typ);
N_NIMCALL(NIM_BOOL, containsgenerictype_263310)(Ttype224847* t);
N_NIMCALL(void, propagatefieldflags_303434)(Ttype224847* t, Tnode224809* n);
static N_INLINE(NI, len_225098)(Tnode224809* n);
N_NIMCALL(void, erasevoidparams_303182)(Ttype224847* t);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, skipintliteralparams_303336)(Ttype224847* t);
N_NIMCALL(Tnode224809*, newnode_226607)(NU8 kind, Tlineinfo189352 info, Tnodeseq224803* sons, Ttype224847* typ);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(NI, sonslen_227387)(Tnode224809* n);
N_NIMCALL(void, illformedast_280240)(Tnode224809* n);
N_NIMCALL(void, checksonslen_280260)(Tnode224809* n, NI length);
N_NIMCALL(Tnode224809*, newnodei_226351)(NU8 kind, Tlineinfo189352 info);
N_NIMCALL(Tnode224809*, reresolvecallswithtypedescparams_302071)(Trepltypevars301577* cl, Tnode224809* n);
N_NIMCALL(NIM_BOOL, istypeparam_301914)(Tnode224809* n);
N_NIMCALL(Tnode224809*, newsymnode_226325)(Tsym224841* sym);
N_NIMCALL(void, newsons_227272)(Tnode224809* father, NI length);
N_NIMCALL(void, popinfocontext_190597)(void);
N_NIMCALL(NIM_BOOL, hasgenericarguments_301965)(Tnode224809* n);
N_NIMCALL(NI64, computesize_254184)(Ttype224847* typ);
STRING_LITERAL(TMP2735, "no generic body", 15);
STRING_LITERAL(TMP2737, "compiler/semtypinst.nim", 23);
NIM_CONST TY90959 TMP2736 = {((NimStringDesc*) &TMP2737),
((NI) 52)}
;
STRING_LITERAL(TMP2742, "substitution with generic parameter", 35);
STRING_LITERAL(TMP2743, "acyclic", 7);
STRING_LITERAL(TMP2744, "", 0);
STRING_LITERAL(TMP2745, "shared memory may not refer to GC\'ed thread local memory", 56);
NIM_CONST TY90959 TMP2748 = {((NimStringDesc*) &TMP2737),
((NI) 477)}
;
NIM_CONST TY90959 TMP2749 = {((NimStringDesc*) &TMP2737),
((NI) 367)}
;
STRING_LITERAL(TMP2750, "ReplaceTypeVarsN: when condition not a bool", 43);
extern Gcheap51018 gch_51059;
extern TNimType NTI224843; /* TTypeSeq */
extern TNimType NTI224803; /* TNodeSeq */

N_NIMCALL(void, inittypevars_303846)(Tcontext279023* p, Tidtable224859 pt, Tlineinfo189352 info, Tsym224841* owner, Trepltypevars301577* Result) {
	initidtable_228057((&(*Result).symmap));
	copyidtable_226091((&(*Result).typemap), pt);
	initidtable_228057((&(*Result).localcache));
	(*Result).info = info;
	unsureAsgnRef((void**) (&(*Result).c), p);
	unsureAsgnRef((void**) (&(*Result).owner), owner);
}

N_NIMCALL(Ttype224847*, searchinsttypes_301207)(Ttype224847* key) {
	Ttype224847* result;
	Ttype224847* generictyp;
{	result = 0;
	generictyp = (*key).sons->data[((NI) 0)];
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NimStringDesc* LOC9;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*generictyp).kind == ((NU8) 10));
		if (!(LOC4)) goto LA5;
		LOC4 = ((*key).sons->data[((NI) 0)] == generictyp);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA6;
		LOC3 = !(((*generictyp).sym == NIM_NIL));
		LA6: ;
		if (!!(LOC3)) goto LA7;
		LOC9 = 0;
		LOC9 = HEX24_195279(TMP2736);
		internalerror_195191(LOC9);
	}
	LA7: ;
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = HEX3DHEX3D_263739((*(*generictyp).sym).kindU.S1.typeinstcache, NIM_NIL);
		if (!LOC12) goto LA13;
		goto BeforeRet;
	}
	LA13: ;
	{
		Ttype224847* inst_301411;
		Ttypeseq224843* HEX3Atmp_301450;
		NI i_301453;
		NI L_301455;
		inst_301411 = 0;
		HEX3Atmp_301450 = 0;
		HEX3Atmp_301450 = (*(*generictyp).sym).kindU.S1.typeinstcache;
		i_301453 = ((NI) 0);
		L_301455 = (HEX3Atmp_301450 ? HEX3Atmp_301450->Sup.len : 0);
		{
			while (1) {
				if (!(i_301453 < L_301455)) goto LA17;
				inst_301411 = HEX3Atmp_301450->data[i_301453];
				{
					if (!((*inst_301411).Sup.id == (*key).Sup.id)) goto LA20;
					result = inst_301411;
					goto BeforeRet;
				}
				LA20: ;
				{
					if (!(((*inst_301411).sons ? (*inst_301411).sons->Sup.len : 0) < ((*key).sons ? (*key).sons->Sup.len : 0))) goto LA24;
					goto BeforeRet;
				}
				LA24: ;
				{
					{
						NI j_301439;
						NI HEX3Atmp_301443;
						NI res_301446;
						j_301439 = 0;
						HEX3Atmp_301443 = 0;
						HEX3Atmp_301443 = ((*key).sons ? ((*key).sons->Sup.len-1) : -1);
						res_301446 = ((NI) 1);
						{
							while (1) {
								if (!(res_301446 <= HEX3Atmp_301443)) goto LA29;
								j_301439 = res_301446;
								{
									NIM_BOOL LOC32;
									LOC32 = 0;
									LOC32 = comparetypes_261047((*inst_301411).sons->data[j_301439], (*key).sons->data[j_301439], ((NU8) 0), 8);
									if (!!(LOC32)) goto LA33;
									goto LA26;
								}
								LA33: ;
								res_301446 += ((NI) 1);
							} LA29: ;
						}
					}
					result = inst_301411;
					goto BeforeRet;
				} LA26: ;
				i_301453 += ((NI) 1);
			} LA17: ;
		}
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype224847*, lookuptypevar_302649)(Trepltypevars301577* cl, Ttype224847* t) {
	Ttype224847* result;
	Tidobj197015* LOC1;
	TNimObject* LOC2;
{	result = 0;
	LOC1 = 0;
	LOC1 = &t->Sup;
	LOC2 = 0;
	LOC2 = idtableget_232182((*cl).typemap, LOC1);
	result = ((Ttype224847*) (LOC2));
	{
		NimStringDesc* LOC13;
		Tidobj197015* LOC14;
		TNimObject* LOC15;
		if (!(result == NIM_NIL)) goto LA5;
		{
			NIM_BOOL LOC9;
			LOC9 = 0;
			LOC9 = (*cl).allowmetatypes;
			if (LOC9) goto LA10;
			LOC9 = (((*t).flags &(1<<((((NU8) 10))&31)))!=0);
			LA10: ;
			if (!LOC9) goto LA11;
			goto BeforeRet;
		}
		LA11: ;
		LOC13 = 0;
		LOC13 = typetostring_254032(t, ((NU8) 0));
		localerror_195128((*(*t).sym).info, ((NU16) 128), LOC13);
		result = errortype_280161((*cl).c);
		LOC14 = 0;
		LOC14 = &t->Sup;
		LOC15 = 0;
		LOC15 = &result->Sup.Sup;
		idtableput_232196((&(*cl).typemap), LOC14, LOC15);
	}
	goto LA3;
	LA5: ;
	{
		NIM_BOOL LOC17;
		LOC17 = 0;
		LOC17 = ((*result).kind == ((NU8) 12));
		if (!(LOC17)) goto LA18;
		LOC17 = !((*cl).allowmetatypes);
		LA18: ;
		if (!LOC17) goto LA19;
		internalerror_195172((*cl).info, ((NimStringDesc*) &TMP2742));
	}
	goto LA3;
	LA19: ;
	LA3: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype224847*, instcopytype_302694)(Trepltypevars301577* cl, Ttype224847* t) {
	Ttype224847* result;
	result = 0;
	result = copytype_227542(t, (*t).owner, (*cl).allowmetatypes);
	(*result).flags |= ((NU32)1)<<((((NU8) 8))%(sizeof(NU32)*8));
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		LOC3 = 0;
		LOC3 = ((IL64(574208952489742656) &(IL64(1)<<(((*t).kind)&IL64(63))))!=0);
		if (LOC3) goto LA4;
		LOC5 = 0;
		LOC5 = ((*t).kind == ((NU8) 59));
		if (!(LOC5)) goto LA6;
		LOC5 = ((*t).n == NIM_NIL);
		LA6: ;
		LOC3 = LOC5;
		LA4: ;
		if (!!(LOC3)) goto LA7;
		(*result).flags = ((*result).flags & ~ 524288);
	}
	LA7: ;
	return result;
}

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

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

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

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

N_NIMCALL(void, cachetypeinst_301483)(Ttype224847* inst) {
	Ttype224847* gt;
	Ttype224847* t;
{	gt = (*inst).sons->data[((NI) 0)];
	{
		if (!((*gt).kind == ((NU8) 10))) goto LA3;
		t = lastson_227426(gt);
	}
	goto LA1;
	LA3: ;
	{
		t = gt;
	}
	LA1: ;
	{
		if (!((IL64(1151232654746587136) &(IL64(1)<<(((*t).kind)&IL64(63))))!=0)) goto LA8;
		goto BeforeRet;
	}
	LA8: ;
	safeadd_301522((&(*(*gt).sym).kindU.S1.typeinstcache), inst);
	}BeforeRet: ;
}

static N_INLINE(NIM_BOOL, isgcedmem_228235)(Ttype224847* t) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	NIM_BOOL LOC3;
	result = 0;
	LOC1 = 0;
	LOC1 = ((289406976 &(IL64(1)<<(((*t).kind)&IL64(63))))!=0);
	if (LOC1) goto LA2;
	LOC3 = 0;
	LOC3 = ((*t).kind == ((NU8) 25));
	if (!(LOC3)) goto LA4;
	LOC3 = ((*t).callconv == ((NU8) 8));
	LA4: ;
	LOC1 = LOC3;
	LA2: ;
	result = LOC1;
	return result;
}

N_NIMCALL(void, sharedptrcheck_301014)(Tlineinfo189352 info, Ttype224847* t) {
	{
		NIM_BOOL LOC3;
		NI LOC5;
		LOC3 = 0;
		LOC3 = ((*t).kind == ((NU8) 21));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = len_227369(t);
		LOC3 = (((NI) 1) < LOC5);
		LA4: ;
		if (!LOC3) goto LA6;
		{
			if (!((*(*(*t).sons->data[((NI) 0)]).sym).magic == ((NU8) 198))) goto LA10;
			(*t).flags |= ((NU32)1)<<((((NU8) 15))%(sizeof(NU32)*8));
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = (((*t).flags &(1<<((((NU8) 20))&31)))!=0);
				if (LOC14) goto LA15;
				LOC14 = isgcedmem_228235(t);
				LA15: ;
				if (!LOC14) goto LA16;
				localerror_195128(info, ((NU16) 4), ((NimStringDesc*) &TMP2745));
			}
			LA16: ;
		}
		LA10: ;
	}
	LA6: ;
}

N_NIMCALL(void, checkpartialconstructedtype_301063)(Tlineinfo189352 info, Ttype224847* t) {
	{
		NIM_BOOL LOC3;
		Ttype224847* LOC5;
		LOC3 = 0;
		LOC3 = (((*t).flags &(1<<((((NU8) 4))&31)))!=0);
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = skiptypes_228167(t, IL64(211106232576256));
		LOC3 = !(((*LOC5).kind == ((NU8) 17)));
		LA4: ;
		if (!LOC3) goto LA6;
		localerror_195128(info, ((NU16) 166), ((NimStringDesc*) &TMP2743));
	}
	goto LA1;
	LA6: ;
	{
		NIM_BOOL LOC9;
		LOC9 = 0;
		LOC9 = ((*t).kind == ((NU8) 23));
		if (!(LOC9)) goto LA10;
		LOC9 = ((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 23));
		LA10: ;
		if (!LOC9) goto LA11;
		localerror_195128(info, ((NU16) 202), ((NimStringDesc*) &TMP2744));
	}
	goto LA1;
	LA11: ;
	{
		sharedptrcheck_301014(info, t);
	}
	LA1: ;
}

N_NIMCALL(Ttype224847*, handlegenericinvocation_302760)(Trepltypevars301577* cl, Ttype224847* t) {
	Ttype224847* result;
	Ttype224847* body;
	Ttype224847* header;
	TY392275 LOC46;
	NIM_BOOL oldskiptypedesc;
	Ttype224847* newbody;
	Ttype224847* LOC64;
	Tsym224841* dc;
	Tsym224841* asgn;
{	result = 0;
	body = (*t).sons->data[((NI) 0)];
	{
		if (!!(((*body).kind == ((NU8) 10)))) goto LA3;
		internalerror_195172((*cl).info, ((NimStringDesc*) &TMP2735));
	}
	LA3: ;
	header = t;
	{
		Tidobj197015* LOC9;
		TNimObject* LOC10;
		if (!(*cl).allowmetatypes) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_232182((*cl).localcache, LOC9);
		result = ((Ttype224847*) (LOC10));
	}
	goto LA5;
	LA7: ;
	{
		result = searchinsttypes_301207(t);
	}
	LA5: ;
	{
		NIM_BOOL LOC14;
		LOC14 = 0;
		LOC14 = !((result == NIM_NIL));
		if (!(LOC14)) goto LA15;
		LOC14 = ((376832 & (*result).flags) == (376832 & (*t).flags));
		LA15: ;
		if (!LOC14) goto LA16;
		goto BeforeRet;
	}
	LA16: ;
	{
		NI i_302836;
		NI HEX3Atmp_303126;
		NI LOC19;
		NI res_303129;
		i_302836 = 0;
		HEX3Atmp_303126 = 0;
		LOC19 = 0;
		LOC19 = sonslen_227351(t);
		HEX3Atmp_303126 = (NI)(LOC19 - ((NI) 1));
		res_303129 = ((NI) 1);
		{
			while (1) {
				Ttype224847* x;
				if (!(res_303129 <= HEX3Atmp_303126)) goto LA21;
				i_302836 = res_303129;
				x = (*t).sons->data[i_302836];
				{
					if (!((*x).kind == ((NU8) 12))) goto LA24;
					x = lookuptypevar_302649(cl, x);
					{
						if (!!((x == NIM_NIL))) goto LA28;
						{
							if (!(header == t)) goto LA32;
							header = instcopytype_302694(cl, t);
						}
						LA32: ;
						asgnRefNoCycle((void**) (&(*header).sons->data[i_302836]), x);
						propagatetoowner_228274(header, x);
					}
					LA28: ;
				}
				goto LA22;
				LA24: ;
				{
					propagatetoowner_228274(header, x);
				}
				LA22: ;
				res_303129 += ((NI) 1);
			} LA21: ;
		}
	}
	{
		if (!!((header == t))) goto LA37;
		result = searchinsttypes_301207(header);
		{
			NIM_BOOL LOC41;
			LOC41 = 0;
			LOC41 = !((result == NIM_NIL));
			if (!(LOC41)) goto LA42;
			LOC41 = ((376832 & (*result).flags) == (376832 & (*t).flags));
			LA42: ;
			if (!LOC41) goto LA43;
			goto BeforeRet;
		}
		LA43: ;
	}
	goto LA35;
	LA37: ;
	{
		header = instcopytype_302694(cl, t);
	}
	LA35: ;
	result = newtype_227140(((NU8) 11), (*(*t).sons->data[((NI) 0)]).owner);
	(*result).flags = (*header).flags;
	if ((*result).sons) nimGCunrefNoCycle((*result).sons);
	(*result).sons = (Ttypeseq224843*) newSeqRC1((&NTI224843), 1);
	memset((void*)LOC46, 0, sizeof(LOC46));
	LOC46[0] = (*header).sons->data[((NI) 0)];
	asgnRefNoCycle((void**) (&(*result).sons->data[0]), LOC46[0]);
	{
		if (!!((*cl).allowmetatypes)) goto LA49;
		cachetypeinst_301483(result);
	}
	goto LA47;
	LA49: ;
	{
		Tidobj197015* LOC52;
		TNimObject* LOC53;
		LOC52 = 0;
		LOC52 = &t->Sup;
		LOC53 = 0;
		LOC53 = &result->Sup.Sup;
		idtableput_232196((&(*cl).localcache), LOC52, LOC53);
	}
	LA47: ;
	oldskiptypedesc = (*cl).skiptypedesc;
	(*cl).skiptypedesc = NIM_TRUE;
	{
		NI i_302955;
		NI HEX3Atmp_303134;
		NI LOC55;
		NI res_303137;
		i_302955 = 0;
		HEX3Atmp_303134 = 0;
		LOC55 = 0;
		LOC55 = sonslen_227351(t);
		HEX3Atmp_303134 = (NI)(LOC55 - ((NI) 1));
		res_303137 = ((NI) 1);
		{
			while (1) {
				Ttype224847* x;
				Tidobj197015* LOC58;
				TNimObject* LOC59;
				if (!(res_303137 <= HEX3Atmp_303134)) goto LA57;
				i_302955 = res_303137;
				x = replacetypevarst_301627(cl, (*t).sons->data[i_302955]);
				asgnRefNoCycle((void**) (&(*header).sons->data[i_302955]), x);
				propagatetoowner_228274(header, x);
				LOC58 = 0;
				LOC58 = &(*body).sons->data[(NI)(i_302955 - ((NI) 1))]->Sup;
				LOC59 = 0;
				LOC59 = &x->Sup.Sup;
				idtableput_232196((&(*cl).typemap), LOC58, LOC59);
				res_303137 += ((NI) 1);
			} LA57: ;
		}
	}
	{
		NI i_303014;
		NI HEX3Atmp_303142;
		NI LOC61;
		NI res_303145;
		i_303014 = 0;
		HEX3Atmp_303142 = 0;
		LOC61 = 0;
		LOC61 = sonslen_227351(t);
		HEX3Atmp_303142 = (NI)(LOC61 - ((NI) 1));
		res_303145 = ((NI) 1);
		{
			while (1) {
				if (!(res_303145 <= HEX3Atmp_303142)) goto LA63;
				i_303014 = res_303145;
				rawaddson_228498(result, (*header).sons->data[i_303014]);
				res_303145 += ((NI) 1);
			} LA63: ;
		}
	}
	LOC64 = 0;
	LOC64 = lastson_227426(body);
	newbody = replacetypevarst_301627(cl, LOC64);
	(*cl).skiptypedesc = oldskiptypedesc;
	(*newbody).flags = ((*newbody).flags | (((*t).flags | (*body).flags) & ~ 524288));
	(*result).flags = (((*result).flags | (*newbody).flags) & ~ 524288);
	{
		NIM_BOOL LOC67;
		LOC67 = 0;
		LOC67 = isgenericalias_260091(newbody);
		if (!LOC67) goto LA68;
		newbody = skipgenericalias_260119(newbody);
	}
	LA68: ;
	rawaddson_228498(result, newbody);
	checkpartialconstructedtype_301063((*cl).info, newbody);
	dc = (*newbody).deepcopy;
	{
		NIM_BOOL LOC72;
		LOC72 = 0;
		LOC72 = !((dc == NIM_NIL));
		if (!(LOC72)) goto LA73;
		LOC72 = !((((*(*newbody).deepcopy).flags &(1<<((((NU8) 2))&31)))!=0));
		LA73: ;
		if (!LOC72) goto LA74;
		asgnRefNoCycle((void**) (&(*newbody).deepcopy), (*(*cl).c).insttypeboundop((*cl).c, dc, result, (*cl).info, ((NU8) 1)));
	}
	LA74: ;
	asgn = (*newbody).assignment;
	{
		NIM_BOOL LOC78;
		LOC78 = 0;
		LOC78 = !((asgn == NIM_NIL));
		if (!(LOC78)) goto LA79;
		LOC78 = !((((*asgn).flags &(1<<((((NU8) 2))&31)))!=0));
		LA79: ;
		if (!LOC78) goto LA80;
		asgnRefNoCycle((void**) (&(*newbody).assignment), (*(*cl).c).insttypeboundop((*cl).c, asgn, result, (*cl).info, ((NU8) 0)));
	}
	LA80: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym224841*, replacetypevarss_301598)(Trepltypevars301577* cl, Tsym224841* s) {
	Tsym224841* result;
	Tidobj197015* LOC11;
	TNimObject* LOC12;
{	result = 0;
	{
		if (!(s == NIM_NIL)) goto LA3;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = !(((*cl).owner == NIM_NIL));
		if (!(LOC7)) goto LA8;
		LOC7 = !(((*s).owner == (*cl).owner));
		LA8: ;
		if (!LOC7) goto LA9;
		result = s;
		goto BeforeRet;
	}
	LA9: ;
	LOC11 = 0;
	LOC11 = &s->Sup;
	LOC12 = 0;
	LOC12 = idtableget_232182((*cl).symmap, LOC11);
	result = ((Tsym224841*) (LOC12));
	{
		Tidobj197015* LOC17;
		TNimObject* LOC18;
		if (!(result == NIM_NIL)) goto LA15;
		result = copysym_227607(s, NIM_FALSE);
		(*result).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
		LOC17 = 0;
		LOC17 = &s->Sup;
		LOC18 = 0;
		LOC18 = &result->Sup.Sup;
		idtableput_232196((&(*cl).symmap), LOC17, LOC18);
		asgnRefNoCycle((void**) (&(*result).owner), (*s).owner);
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_301627(cl, (*s).typ));
		asgnRefNoCycle((void**) (&(*result).ast), replacetypevarsn_301606(cl, (*s).ast));
	}
	LA15: ;
	}BeforeRet: ;
	return result;
}

static N_INLINE(NI, safelen_225126)(Tnode224809* n) {
	NI result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*n).kind >= ((NU8) 0) && (*n).kind <= ((NU8) 23));
		if (LOC3) goto LA4;
		LOC3 = (*n).kindU.S6.sons == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = ((NI) 0);
	}
	goto LA1;
	LA5: ;
	{
		result = ((*n).kindU.S6.sons ? (*n).kindU.S6.sons->Sup.len : 0);
	}
	LA1: ;
	return result;
}

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

N_NIMCALL(Tnode224809*, preparenode_301807)(Trepltypevars301577* cl, Tnode224809* n) {
	Tnode224809* result;
	Ttype224847* t;
	NIM_BOOL iscall;
{	result = 0;
	t = replacetypevarst_301627(cl, (*n).typ);
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = !((t == NIM_NIL));
		if (!(LOC4)) goto LA5;
		LOC4 = ((*t).kind == ((NU8) 59));
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA6;
		LOC3 = !(((*t).n == NIM_NIL));
		LA6: ;
		if (!LOC3) goto LA7;
		result = (*t).n;
		goto BeforeRet;
	}
	LA7: ;
	result = copynode_228660(n);
	asgnRefNoCycle((void**) (&(*result).typ), t);
	{
		if (!((*result).kind == ((NU8) 3))) goto LA11;
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_301598(cl, (*n).kindU.S4.sym));
	}
	LA11: ;
	iscall = ((*result).kind == ((NU8) 27) || (*result).kind == ((NU8) 29) || (*result).kind == ((NU8) 30) || (*result).kind == ((NU8) 31) || (*result).kind == ((NU8) 26) || (*result).kind == ((NU8) 28) || (*result).kind == ((NU8) 32));
	{
		NI i_301888;
		NI HEX3Atmp_301892;
		NI LOC14;
		NI res_301895;
		i_301888 = 0;
		HEX3Atmp_301892 = 0;
		LOC14 = 0;
		LOC14 = safelen_225126(n);
		HEX3Atmp_301892 = (LOC14 - 1);
		res_301895 = ((NI) 0);
		{
			while (1) {
				if (!(res_301895 <= HEX3Atmp_301892)) goto LA16;
				i_301888 = res_301895;
				{
					NIM_BOOL LOC19;
					Tnode224809* LOC23;
					LOC19 = 0;
					LOC19 = iscall;
					if (!(LOC19)) goto LA20;
					LOC19 = (i_301888 == ((NI) 0));
					LA20: ;
					if (!LOC19) goto LA21;
					LOC23 = 0;
					LOC23 = HEX5BHEX5D_225244(n, i_301888);
					add_225165(result, LOC23);
				}
				goto LA17;
				LA21: ;
				{
					Tnode224809* LOC25;
					Tnode224809* LOC26;
					LOC25 = 0;
					LOC25 = HEX5BHEX5D_225244(n, i_301888);
					LOC26 = 0;
					LOC26 = preparenode_301807(cl, LOC25);
					add_225165(result, LOC26);
				}
				LA17: ;
				res_301895 += ((NI) 1);
			} LA16: ;
		}
	}
	}BeforeRet: ;
	return result;
}

static N_INLINE(Ttype224847*, skipintlit_273698)(Ttype224847* t) {
	Ttype224847* result;
{	result = 0;
	{
		if (!!(((*t).n == NIM_NIL))) goto LA3;
		{
			if (!((IL64(70866960384) &(IL64(1)<<(((*t).kind)&IL64(63))))!=0)) goto LA7;
			result = getsystype_273190((*t).kind);
			goto BeforeRet;
		}
		LA7: ;
	}
	LA3: ;
	result = t;
	}BeforeRet: ;
	return result;
}

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

N_NIMCALL(void, propagatefieldflags_303434)(Ttype224847* t, Tnode224809* n) {
{	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		NimStringDesc* LOC9;
		if (!!(!(((*n).kind == ((NU8) 140))))) goto LA7;
		LOC9 = 0;
		LOC9 = HEX24_195279(TMP2749);
		internalerror_195191(LOC9);
	}
	LA7: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		propagatetoowner_228274(t, (*(*n).kindU.S4.sym).typ);
	}
	break;
	case ((NU8) 138):
	case ((NU8) 139):
	case ((NU8) 85):
	case ((NU8) 88):
	{
		{
			Tnode224809* son_303465;
			son_303465 = 0;
			{
				NI i_303470;
				NI HEX3Atmp_303472;
				NI LOC14;
				NI res_303474;
				i_303470 = 0;
				HEX3Atmp_303472 = 0;
				LOC14 = 0;
				LOC14 = len_225098(n);
				HEX3Atmp_303472 = (LOC14 - 1);
				res_303474 = ((NI) 0);
				{
					while (1) {
						if (!(res_303474 <= HEX3Atmp_303472)) goto LA16;
						i_303470 = res_303474;
						son_303465 = (*n).kindU.S6.sons->data[i_303470];
						propagatefieldflags_303434(t, son_303465);
						res_303474 += ((NI) 1);
					} LA16: ;
				}
			}
		}
	}
	break;
	default:
	{
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, erasevoidparams_303182)(Ttype224847* t) {
{	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = !(((*t).sons->data[((NI) 0)] == NIM_NIL));
		if (!(LOC3)) goto LA4;
		LOC3 = ((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 3));
		LA4: ;
		if (!LOC3) goto LA5;
		asgnRefNoCycle((void**) (&(*t).sons->data[((NI) 0)]), NIM_NIL);
	}
	LA5: ;
	{
		NI i_303224;
		NI HEX3Atmp_303305;
		NI LOC8;
		NI res_303308;
		i_303224 = 0;
		HEX3Atmp_303305 = 0;
		LOC8 = 0;
		LOC8 = sonslen_227351(t);
		HEX3Atmp_303305 = (LOC8 - 1);
		res_303308 = ((NI) 1);
		{
			while (1) {
				if (!(res_303308 <= HEX3Atmp_303305)) goto LA10;
				i_303224 = res_303308;
				{
					NI pos;
					if (!((*(*t).sons->data[i_303224]).kind == ((NU8) 3))) goto LA13;
					pos = i_303224;
					{
						NI j_303253;
						NI HEX3Atmp_303297;
						NI HEX3Atmp_303298;
						NI LOC16;
						NI res_303301;
						j_303253 = 0;
						HEX3Atmp_303297 = 0;
						HEX3Atmp_303298 = 0;
						HEX3Atmp_303297 = (NI)(i_303224 + ((NI) 1));
						LOC16 = 0;
						LOC16 = sonslen_227351(t);
						HEX3Atmp_303298 = (LOC16 - 1);
						res_303301 = HEX3Atmp_303297;
						{
							while (1) {
								if (!(res_303301 <= HEX3Atmp_303298)) goto LA18;
								j_303253 = res_303301;
								{
									if (!!(((*(*t).sons->data[j_303253]).kind == ((NU8) 3)))) goto LA21;
									asgnRefNoCycle((void**) (&(*t).sons->data[pos]), (*t).sons->data[j_303253]);
									asgnRefNoCycle((void**) (&(*(*t).n).kindU.S6.sons->data[pos]), (*(*t).n).kindU.S6.sons->data[j_303253]);
									pos += ((NI) 1);
								}
								LA21: ;
								res_303301 += ((NI) 1);
							} LA18: ;
						}
					}
					(*t).sons = (Ttypeseq224843*) setLengthSeq(&((*t).sons)->Sup, sizeof(Ttype224847*), ((NI) (pos)));
					(*(*t).n).kindU.S6.sons = (Tnodeseq224803*) setLengthSeq(&((*(*t).n).kindU.S6.sons)->Sup, sizeof(Tnode224809*), ((NI) (pos)));
					goto BeforeRet;
				}
				LA13: ;
				res_303308 += ((NI) 1);
			} LA10: ;
		}
	}
	}BeforeRet: ;
}

N_NIMCALL(void, skipintliteralparams_303336)(Ttype224847* t) {
	{
		NI i_303357;
		NI HEX3Atmp_303409;
		NI LOC2;
		NI res_303412;
		i_303357 = 0;
		HEX3Atmp_303409 = 0;
		LOC2 = 0;
		LOC2 = sonslen_227351(t);
		HEX3Atmp_303409 = (LOC2 - 1);
		res_303412 = ((NI) 0);
		{
			while (1) {
				if (!(res_303412 <= HEX3Atmp_303409)) goto LA4;
				i_303357 = res_303412;
				{
					Ttype224847* p;
					Ttype224847* skipped;
					p = (*t).sons->data[i_303357];
					{
						if (!(p == NIM_NIL)) goto LA8;
						goto LA5;
					}
					LA8: ;
					skipped = skipintlit_273698(p);
					{
						if (!!((skipped == p))) goto LA12;
						asgnRefNoCycle((void**) (&(*t).sons->data[i_303357]), skipped);
						{
							if (!(((NI) 0) < i_303357)) goto LA16;
							asgnRefNoCycle((void**) (&(*(*(*(*t).n).kindU.S6.sons->data[i_303357]).kindU.S4.sym).typ), skipped);
						}
						LA16: ;
					}
					LA12: ;
				} LA5: ;
				res_303412 += ((NI) 1);
			} LA4: ;
		}
	}
	{
		NIM_BOOL LOC20;
		LOC20 = 0;
		LOC20 = !(((*t).sons->data[((NI) 0)] == NIM_NIL));
		if (!(LOC20)) goto LA21;
		LOC20 = ((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 59));
		LA21: ;
		if (!LOC20) goto LA22;
		asgnRefNoCycle((void**) (&(*t).sons->data[((NI) 0)]), base_254039((*t).sons->data[((NI) 0)]));
	}
	LA22: ;
}

N_NIMCALL(Ttype224847*, replacetypevarstaux_301590)(Trepltypevars301577* cl, Ttype224847* t) {
	Ttype224847* result;
{	result = 0;
	result = t;
	{
		if (!(t == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		Ttype224847* lookup;
		Tidobj197015* LOC9;
		TNimObject* LOC10;
		if (!((IL64(1151232654746587136) &(IL64(1)<<(((*t).kind)&IL64(63))))!=0)) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_232182((*cl).typemap, LOC9);
		lookup = ((Ttype224847*) (LOC10));
		{
			if (!!((lookup == NIM_NIL))) goto LA13;
			result = lookup;
			goto BeforeRet;
		}
		LA13: ;
	}
	LA7: ;
	switch ((*t).kind) {
	case ((NU8) 9):
	{
		result = handlegenericinvocation_302760(cl, t);
	}
	break;
	case ((NU8) 10):
	{
		NimStringDesc* LOC17;
		LOC17 = 0;
		LOC17 = typetostring_254032(t, ((NU8) 0));
		localerror_195128((*cl).info, ((NU16) 128), LOC17);
		result = errortype_280161((*cl).c);
	}
	break;
	case ((NU8) 60):
	{
		Tnode224809* n;
		{
			if (!(*cl).allowmetatypes) goto LA21;
			goto BeforeRet;
		}
		LA21: ;
		n = preparenode_301807(cl, (*t).n);
		{
			if (!!(((*n).kind == ((NU8) 1)))) goto LA25;
			n = (*(*cl).c).semconstexpr((*cl).c, n);
		}
		LA25: ;
		{
			if (!((*(*n).typ).kind == ((NU8) 8))) goto LA29;
			result = skiptypes_228167((*n).typ, 256);
		}
		goto LA27;
		LA29: ;
		{
			{
				TY392275 LOC36;
				if (!!(((*(*n).typ).kind == ((NU8) 59)))) goto LA34;
				result = newtypes_279220(((NU8) 59), (*cl).c);
				if ((*result).sons) nimGCunrefNoCycle((*result).sons);
				(*result).sons = (Ttypeseq224843*) newSeqRC1((&NTI224843), 1);
				memset((void*)LOC36, 0, sizeof(LOC36));
				LOC36[0] = (*n).typ;
				asgnRefNoCycle((void**) (&(*result).sons->data[0]), LOC36[0]);
				asgnRefNoCycle((void**) (&(*result).n), n);
			}
			goto LA32;
			LA34: ;
			{
				result = (*n).typ;
			}
			LA32: ;
		}
		LA27: ;
	}
	break;
	case ((NU8) 31):
	case ((NU8) 36):
	{
		result = skipintlit_273698(t);
	}
	break;
	case ((NU8) 8):
	{
		Ttype224847* lookup;
		Tidobj197015* LOC40;
		TNimObject* LOC41;
		LOC40 = 0;
		LOC40 = &t->Sup;
		LOC41 = 0;
		LOC41 = idtableget_232182((*cl).typemap, LOC40);
		lookup = ((Ttype224847*) (LOC41));
		{
			if (!!((lookup == NIM_NIL))) goto LA44;
			result = lookup;
			{
				NIM_BOOL LOC48;
				LOC48 = 0;
				LOC48 = (((*t).flags &(1<<((((NU8) 9))&31)))!=0);
				if (LOC48) goto LA49;
				LOC48 = (*cl).skiptypedesc;
				LA49: ;
				if (!LOC48) goto LA50;
				result = base_254039(result);
			}
			LA50: ;
		}
		goto LA42;
		LA44: ;
		{
			Ttype224847* LOC55;
			if (!!(((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 0)))) goto LA53;
			LOC55 = 0;
			LOC55 = replacetypevarst_301627(cl, (*t).sons->data[((NI) 0)]);
			result = maketypedesc_279683((*cl).c, LOC55);
		}
		goto LA42;
		LA53: ;
		LA42: ;
	}
	break;
	case ((NU8) 52):
	{
		result = t;
	}
	break;
	case ((NU8) 11):
	{
		Tidobj197015* LOC68;
		TNimObject* LOC69;
		Ttype224847* LOC74;
		{
			Tidobj197015* LOC62;
			TNimObject* LOC63;
			if (!(((NI) 100) < (*cl).recursionlimit)) goto LA60;
			LOC62 = 0;
			LOC62 = &t->Sup;
			LOC63 = 0;
			LOC63 = idtableget_232182((*cl).localcache, LOC62);
			result = ((Ttype224847*) (LOC63));
			{
				if (!!((result == NIM_NIL))) goto LA66;
				goto BeforeRet;
			}
			LA66: ;
		}
		LA60: ;
		(*cl).recursionlimit += ((NI) 1);
		result = instcopytype_302694(cl, t);
		LOC68 = 0;
		LOC68 = &t->Sup;
		LOC69 = 0;
		LOC69 = &result->Sup.Sup;
		idtableput_232196((&(*cl).localcache), LOC68, LOC69);
		{
			NI i_303716;
			NI HEX3Atmp_303807;
			NI LOC71;
			NI res_303810;
			i_303716 = 0;
			HEX3Atmp_303807 = 0;
			LOC71 = 0;
			LOC71 = sonslen_227351(result);
			HEX3Atmp_303807 = (LOC71 - 1);
			res_303810 = ((NI) 1);
			{
				while (1) {
					if (!(res_303810 <= HEX3Atmp_303807)) goto LA73;
					i_303716 = res_303810;
					asgnRefNoCycle((void**) (&(*result).sons->data[i_303716]), replacetypevarst_301627(cl, (*result).sons->data[i_303716]));
					res_303810 += ((NI) 1);
				} LA73: ;
			}
		}
		LOC74 = 0;
		LOC74 = lastson_227426(result);
		propagatetoowner_228274(result, LOC74);
	}
	break;
	default:
	{
		{
			NIM_BOOL LOC78;
			Tidobj197015* LOC91;
			TNimObject* LOC92;
			LOC78 = 0;
			LOC78 = containsgenerictype_263310(t);
			if (!LOC78) goto LA79;
			{
				Tidobj197015* LOC85;
				TNimObject* LOC86;
				if (!(((NI) 100) < (*cl).recursionlimit)) goto LA83;
				LOC85 = 0;
				LOC85 = &t->Sup;
				LOC86 = 0;
				LOC86 = idtableget_232182((*cl).localcache, LOC85);
				result = ((Ttype224847*) (LOC86));
				{
					if (!!((result == NIM_NIL))) goto LA89;
					goto BeforeRet;
				}
				LA89: ;
			}
			LA83: ;
			(*cl).recursionlimit += ((NI) 1);
			result = instcopytype_302694(cl, t);
			(*result).size = IL64(-1);
			LOC91 = 0;
			LOC91 = &t->Sup;
			LOC92 = 0;
			LOC92 = &result->Sup.Sup;
			idtableput_232196((&(*cl).localcache), LOC91, LOC92);
			{
				NI i_303752;
				NI HEX3Atmp_303815;
				NI LOC94;
				NI res_303818;
				i_303752 = 0;
				HEX3Atmp_303815 = 0;
				LOC94 = 0;
				LOC94 = sonslen_227351(result);
				HEX3Atmp_303815 = (NI)(LOC94 - ((NI) 1));
				res_303818 = ((NI) 0);
				{
					while (1) {
						if (!(res_303818 <= HEX3Atmp_303815)) goto LA96;
						i_303752 = res_303818;
						{
							Ttype224847* r;
							if (!!(((*result).sons->data[i_303752] == NIM_NIL))) goto LA99;
							r = replacetypevarst_301627(cl, (*result).sons->data[i_303752]);
							{
								Ttype224847* r2;
								if (!((*result).kind == ((NU8) 17))) goto LA103;
								r2 = skiptypes_228167(r, 2048);
								{
									if (!((6291456 &(IL64(1)<<(((*r2).kind)&IL64(63))))!=0)) goto LA107;
									r = skiptypes_228167(r2, 6291456);
								}
								LA107: ;
							}
							LA103: ;
							asgnRefNoCycle((void**) (&(*result).sons->data[i_303752]), r);
							propagatetoowner_228274(result, r);
						}
						LA99: ;
						res_303818 += ((NI) 1);
					} LA96: ;
				}
			}
			asgnRefNoCycle((void**) (&(*result).n), replacetypevarsn_301606(cl, (*result).n));
			switch ((*result).kind) {
			case ((NU8) 16):
			{
				Ttype224847* idx;
				idx = (*result).sons->data[((NI) 0)];
				{
					NimStringDesc* LOC114;
					if (!!(!(((*idx).kind == ((NU8) 59))))) goto LA112;
					LOC114 = 0;
					LOC114 = HEX24_195279(TMP2748);
					internalerror_195191(LOC114);
				}
				LA112: ;
			}
			break;
			case ((NU8) 17):
			case ((NU8) 18):
			{
				propagatefieldflags_303434(result, (*result).n);
			}
			break;
			case ((NU8) 25):
			{
				erasevoidparams_303182(result);
				skipintliteralparams_303336(result);
			}
			break;
			default:
			{
			}
			break;
			}
		}
		LA79: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype224847*, replacetypevarst_301627)(Trepltypevars301577* cl, Ttype224847* t) {
	Ttype224847* result;
	result = 0;
	result = replacetypevarstaux_301590(cl, t);
	return result;
}

N_NIMCALL(NIM_BOOL, istypeparam_301914)(Tnode224809* n) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	NIM_BOOL LOC3;
	NIM_BOOL LOC5;
{	result = 0;
	LOC1 = 0;
	LOC1 = ((*n).kind == ((NU8) 3));
	if (!(LOC1)) goto LA2;
	LOC3 = 0;
	LOC3 = ((*(*n).kindU.S4.sym).kind == ((NU8) 4));
	if (LOC3) goto LA4;
	LOC5 = 0;
	LOC5 = ((*(*n).kindU.S4.sym).kind == ((NU8) 7));
	if (!(LOC5)) goto LA6;
	LOC5 = (((*(*n).kindU.S4.sym).flags &(1<<((((NU8) 2))&31)))!=0);
	LA6: ;
	LOC3 = LOC5;
	LA4: ;
	LOC1 = LOC3;
	LA2: ;
	result = LOC1;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode224809*, reresolvecallswithtypedescparams_302071)(Trepltypevars301577* cl, Tnode224809* n) {
	Tnode224809* result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode224809* LOC5;
		NIM_BOOL needsfixing;
		LOC3 = 0;
		LOC3 = ((*n).kind == ((NU8) 27) || (*n).kind == ((NU8) 29) || (*n).kind == ((NU8) 30) || (*n).kind == ((NU8) 31) || (*n).kind == ((NU8) 26) || (*n).kind == ((NU8) 28) || (*n).kind == ((NU8) 32));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = HEX5BHEX5D_225244(n, ((NI) 0));
		LOC3 = (((*(*LOC5).kindU.S4.sym).flags &(1<<((((NU8) 2))&31)))!=0);
		LA4: ;
		if (!LOC3) goto LA6;
		needsfixing = NIM_FALSE;
		{
			NI i_302119;
			NI HEX3Atmp_302147;
			NI LOC9;
			NI res_302150;
			i_302119 = 0;
			HEX3Atmp_302147 = 0;
			LOC9 = 0;
			LOC9 = safelen_225126(n);
			HEX3Atmp_302147 = (LOC9 - 1);
			res_302150 = ((NI) 1);
			{
				while (1) {
					if (!(res_302150 <= HEX3Atmp_302147)) goto LA11;
					i_302119 = res_302150;
					{
						Tnode224809* LOC14;
						NIM_BOOL LOC15;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_225244(n, i_302119);
						LOC15 = 0;
						LOC15 = istypeparam_301914(LOC14);
						if (!LOC15) goto LA16;
						needsfixing = NIM_TRUE;
					}
					LA16: ;
					res_302150 += ((NI) 1);
				} LA11: ;
			}
		}
		{
			if (!needsfixing) goto LA20;
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_226325((*(*(*n).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym).owner));
			result = (*(*cl).c).semoverloadedcall((*cl).c, n, n, 4096);
			goto BeforeRet;
		}
		LA20: ;
	}
	LA6: ;
	{
		NI i_302144;
		NI HEX3Atmp_302155;
		NI LOC23;
		NI res_302158;
		i_302144 = 0;
		HEX3Atmp_302155 = 0;
		LOC23 = 0;
		LOC23 = safelen_225126(n);
		HEX3Atmp_302155 = (LOC23 - 1);
		res_302158 = ((NI) 0);
		{
			while (1) {
				Tnode224809* LOC26;
				if (!(res_302158 <= HEX3Atmp_302155)) goto LA25;
				i_302144 = res_302158;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_225244(n, i_302144);
				asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_302144]), reresolvecallswithtypedescparams_302071(cl, LOC26));
				res_302158 += ((NI) 1);
			} LA25: ;
		}
	}
	result = n;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode224809*, replacetypevarsn_301606)(Trepltypevars301577* cl, Tnode224809* n_301610) {
	Tnode224809* result;
{	result = 0;
	{
		if (!(n_301610 == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	result = copynode_228660(n_301610);
	{
		if (!!(((*n_301610).typ == NIM_NIL))) goto LA7;
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_301627(cl, (*n_301610).typ));
	}
	LA7: ;
	switch ((*n_301610).kind) {
	case ((NU8) 0) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_301598(cl, (*n_301610).kindU.S4.sym));
		{
			Tnodeseq224803* LOC15;
			if (!((*(*(*result).kindU.S4.sym).typ).kind == ((NU8) 3))) goto LA13;
			LOC15 = 0;
			LOC15 = (Tnodeseq224803*) newSeq((&NTI224803), 0);
			result = newnode_226607(((NU8) 138), (*n_301610).info, LOC15, NIM_NIL);
		}
		LA13: ;
	}
	break;
	case ((NU8) 140):
	{
		Tnode224809* branch;
		branch = NIM_NIL;
		{
			NI i_302447;
			NI HEX3Atmp_302532;
			NI LOC18;
			NI res_302535;
			i_302447 = 0;
			HEX3Atmp_302532 = 0;
			LOC18 = 0;
			LOC18 = sonslen_227387(n_301610);
			HEX3Atmp_302532 = (NI)(LOC18 - ((NI) 1));
			res_302535 = ((NI) 0);
			{
				while (1) {
					Tnode224809* it;
					if (!(res_302535 <= HEX3Atmp_302532)) goto LA20;
					i_302447 = res_302535;
					it = (*n_301610).kindU.S6.sons->data[i_302447];
					{
						if (!(it == NIM_NIL)) goto LA23;
						illformedast_280240(n_301610);
					}
					LA23: ;
					switch ((*it).kind) {
					case ((NU8) 86):
					{
						Tnode224809* cond;
						Tnode224809* e;
						checksonslen_280260(it, ((NI) 2));
						cond = preparenode_301807(cl, (*it).kindU.S6.sons->data[((NI) 0)]);
						e = (*(*cl).c).semconstexpr((*cl).c, cond);
						{
							if (!!(((*e).kind == ((NU8) 6)))) goto LA28;
							internalerror_195172((*e).info, ((NimStringDesc*) &TMP2750));
						}
						LA28: ;
						{
							NIM_BOOL LOC32;
							LOC32 = 0;
							LOC32 = !(((*e).kindU.S1.intval == IL64(0)));
							if (!(LOC32)) goto LA33;
							LOC32 = (branch == NIM_NIL);
							LA33: ;
							if (!LOC32) goto LA34;
							branch = (*it).kindU.S6.sons->data[((NI) 1)];
						}
						LA34: ;
					}
					break;
					case ((NU8) 88):
					{
						checksonslen_280260(it, ((NI) 1));
						{
							if (!(branch == NIM_NIL)) goto LA39;
							branch = (*it).kindU.S6.sons->data[((NI) 0)];
						}
						LA39: ;
					}
					break;
					default:
					{
						illformedast_280240(n_301610);
					}
					break;
					}
					res_302535 += ((NI) 1);
				} LA20: ;
			}
		}
		{
			if (!!((branch == NIM_NIL))) goto LA44;
			result = replacetypevarsn_301606(cl, branch);
		}
		goto LA42;
		LA44: ;
		{
			result = newnodei_226351(((NU8) 138), (*n_301610).info);
		}
		LA42: ;
	}
	break;
	case ((NU8) 62):
	{
		Tnode224809* n;
		n = preparenode_301807(cl, n_301610);
		n = reresolvecallswithtypedescparams_302071(cl, n);
		{
			if (!(*cl).allowmetatypes) goto LA50;
			result = n;
		}
		goto LA48;
		LA50: ;
		{
			result = (*(*cl).c).semexpr((*cl).c, n, 0);
		}
		LA48: ;
	}
	break;
	default:
	{
		NI length;
		length = sonslen_227387(n_301610);
		{
			if (!(((NI) 0) < length)) goto LA56;
			newsons_227272(result, length);
			{
				NI i_302527;
				NI HEX3Atmp_302540;
				NI res_302543;
				i_302527 = 0;
				HEX3Atmp_302540 = 0;
				HEX3Atmp_302540 = (NI)(length - ((NI) 1));
				res_302543 = ((NI) 0);
				{
					while (1) {
						if (!(res_302543 <= HEX3Atmp_302540)) goto LA60;
						i_302527 = res_302543;
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[i_302527]), replacetypevarsn_301606(cl, (*n_301610).kindU.S6.sons->data[i_302527]));
						res_302543 += ((NI) 1);
					} LA60: ;
				}
			}
		}
		LA56: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode224809*, replacetypesinbody_303862)(Tcontext279023* p, Tidtable224859 pt, Tnode224809* n, Tsym224841* owner) {
	Tnode224809* result;
	Trepltypevars301577 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_303846(p, pt, (*n).info, owner, (&cl));
	pushinfocontext_190578((*n).info);
	result = replacetypevarsn_301606((&cl), n);
	popinfocontext_190597();
	return result;
}

N_NIMCALL(Ttype224847*, generatetypeinstance_303894)(Tcontext279023* p, Tidtable224859 pt, Tlineinfo189352 info, Ttype224847* t) {
	Ttype224847* result;
	Trepltypevars301577 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_303846(p, pt, info, NIM_NIL, (&cl));
	pushinfocontext_190578(info);
	result = replacetypevarst_301627((&cl), t);
	popinfocontext_190597();
	return result;
}

N_NIMCALL(NIM_BOOL, hasgenericarguments_301965)(Tnode224809* n) {
	NIM_BOOL result;
{	result = 0;
	{
		NIM_BOOL LOC5;
		NIM_BOOL LOC7;
		if (!((*n).kind == ((NU8) 3))) goto LA3;
		LOC5 = 0;
		LOC5 = ((*(*n).kindU.S4.sym).kind == ((NU8) 4));
		if (LOC5) goto LA6;
		LOC7 = 0;
		LOC7 = ((*(*n).kindU.S4.sym).kind == ((NU8) 7));
		if (!(LOC7)) goto LA8;
		LOC7 = !((((*(*(*n).kindU.S4.sym).typ).flags & 25165824) == 0));
		LA8: ;
		LOC5 = LOC7;
		LA6: ;
		result = LOC5;
		goto BeforeRet;
	}
	goto LA1;
	LA3: ;
	{
		{
			NI i_302046;
			NI HEX3Atmp_302049;
			NI LOC11;
			NI res_302052;
			i_302046 = 0;
			HEX3Atmp_302049 = 0;
			LOC11 = 0;
			LOC11 = safelen_225126(n);
			HEX3Atmp_302049 = (LOC11 - 1);
			res_302052 = ((NI) 0);
			{
				while (1) {
					if (!(res_302052 <= HEX3Atmp_302049)) goto LA13;
					i_302046 = res_302052;
					{
						NIM_BOOL LOC16;
						LOC16 = 0;
						LOC16 = hasgenericarguments_301965((*n).kindU.S6.sons->data[i_302046]);
						if (!LOC16) goto LA17;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA17: ;
					res_302052 += ((NI) 1);
				} LA13: ;
			}
		}
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, checkconstructedtype_301110)(Tlineinfo189352 info, Ttype224847* typ) {
	Ttype224847* t;
	t = skiptypes_228167(typ, 8192);
	{
		if (!((IL64(574208952489738240) &(IL64(1)<<(((*t).kind)&IL64(63))))!=0)) goto LA3;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		Ttype224847* LOC8;
		LOC6 = 0;
		LOC6 = (((*t).flags &(1<<((((NU8) 4))&31)))!=0);
		if (!(LOC6)) goto LA7;
		LOC8 = 0;
		LOC8 = skiptypes_228167(t, IL64(211106232576256));
		LOC6 = !(((*LOC8).kind == ((NU8) 17)));
		LA7: ;
		if (!LOC6) goto LA9;
		localerror_195128(info, ((NU16) 166), ((NimStringDesc*) &TMP2743));
	}
	goto LA1;
	LA9: ;
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = ((*t).kind == ((NU8) 23));
		if (!(LOC12)) goto LA13;
		LOC12 = ((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 23));
		LA13: ;
		if (!LOC12) goto LA14;
		localerror_195128(info, ((NU16) 202), ((NimStringDesc*) &TMP2744));
	}
	goto LA1;
	LA14: ;
	{
		NI64 LOC17;
		NimStringDesc* LOC20;
		LOC17 = 0;
		LOC17 = computesize_254184(t);
		if (!(LOC17 == IL64(-2))) goto LA18;
		LOC20 = 0;
		LOC20 = typetostring_254032(t, ((NU8) 0));
		localerror_195128(info, ((NU16) 127), LOC20);
	}
	goto LA1;
	LA18: ;
	{
		sharedptrcheck_301014(info, t);
	}
	LA1: ;
}
NIM_EXTERNC N_NOINLINE(void, compiler_semtypinstInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, compiler_semtypinstDatInit000)(void) {
}

