/* Generated by Nim Compiler v0.11.2 */
/*   (c) 2015 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 32
#include "nimbase.h"

#include <string.h>
typedef struct Tnode191813 Tnode191813;
typedef struct Tcontext245023 Tcontext245023;
typedef struct Tidtable191861 Tidtable191861;
typedef struct Tidpairseq191859 Tidpairseq191859;
typedef struct Trepltypevars266544 Trepltypevars266544;
typedef struct Tlineinfo164338 Tlineinfo164338;
typedef struct Ttype191849 Ttype191849;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tsym191843 Tsym191843;
typedef struct Tident168021 Tident168021;
typedef struct Tnodeseq191807 Tnodeseq191807;
typedef struct Tidobj168015 Tidobj168015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq191845 Ttypeseq191845;
typedef struct Tloc191827 Tloc191827;
typedef struct Ropeobj162009 Ropeobj162009;
typedef struct TY88145 TY88145;
typedef struct Tscope191837 Tscope191837;
typedef struct TY191944 TY191944;
typedef struct Tstrtable191817 Tstrtable191817;
typedef struct Tsymseq191815 Tsymseq191815;
typedef struct Tlib191831 Tlib191831;
typedef struct Tcell46346 Tcell46346;
typedef struct Tcellseq46362 Tcellseq46362;
typedef struct Tgcheap48216 Tgcheap48216;
typedef struct Tcellset46358 Tcellset46358;
typedef struct Tpagedesc46354 Tpagedesc46354;
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 Tpasscontext242005 Tpasscontext242005;
typedef struct Tproccon245011 Tproccon245011;
typedef struct Intset188056 Intset188056;
typedef struct Ttrunk188052 Ttrunk188052;
typedef struct Ttrunkseq188054 Ttrunkseq188054;
typedef struct Tlinkedlist132028 Tlinkedlist132028;
typedef struct Tlistentry132022 Tlistentry132022;
typedef struct Tctx244048 Tctx244048;
typedef struct TY245141 TY245141;
typedef struct Tidpair191857 Tidpair191857;
typedef struct Tinstantiation191833 Tinstantiation191833;
typedef struct Tbasechunk27438 Tbasechunk27438;
typedef struct Tfreecell27430 Tfreecell27430;
typedef struct TY244253 TY244253;
typedef struct TY165036 TY165036;
typedef struct PprocHEX3Aobjecttype244232 PprocHEX3Aobjecttype244232;
typedef struct TY244272 TY244272;
typedef struct Tinstantiationpair245013 Tinstantiationpair245013;
typedef struct TY191933 TY191933;
typedef struct TY244233 TY244233;
typedef struct TY244239 TY244239;
typedef struct TY244273 TY244273;
typedef struct Vmargs244042 Vmargs244042;
typedef struct Tblock244030 Tblock244030;
typedef struct TY244213 TY244213;
struct  Tidtable191861  {
NI counter;
Tidpairseq191859* data;
};
struct  Tlineinfo164338  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Trepltypevars266544  {
Tcontext245023* c;
Tidtable191861 typemap;
Tidtable191861 symmap;
Tidtable191861 localcache;
Tlineinfo164338 info;
NIM_BOOL allowmetatypes;
NIM_BOOL skiptypedesc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode191813  {
Ttype191849* typ;
Tlineinfo164338 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym191843* sym;
} S4;
struct {Tident168021* ident;
} S5;
struct {Tnodeseq191807* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
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  Tidobj168015  {
  TNimObject Sup;
NI id;
};
struct  Tloc191827  {
NU8 k;
NU8 s;
NU16 flags;
Ttype191849* t;
Ropeobj162009* r;
Ropeobj162009* heaproot;
};
struct  Ttype191849  {
  Tidobj168015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq191845* sons;
Tnode191813* n;
Tsym191843* owner;
Tsym191843* sym;
Tsym191843* destructor;
Tsym191843* deepcopy;
Tsym191843* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc191827 loc;
};
struct TY88145 {
NimStringDesc* Field0;
NI Field1;
};
struct  Tstrtable191817  {
NI counter;
Tsymseq191815* data;
};
struct  Tsym191843  {
  Tidobj168015 Sup;
NU8 kind;
union{
struct {Ttypeseq191845* typeinstcache;
Tscope191837* typscope;
} S1;
struct {TY191944* procinstcache;
Tsym191843* gcunsafetyreason;
} S2;
struct {TY191944* usedgenerics;
Tstrtable191817 tab;
} S3;
struct {Tsym191843* guard;
} S4;
} kindU;
NU16 magic;
Ttype191849* typ;
Tident168021* name;
Tlineinfo164338 info;
Tsym191843* owner;
NU32 flags;
Tnode191813* ast;
NU32 options;
NI position;
NI offset;
Tloc191827 loc;
Tlib191831* annex;
Tnode191813* constraint;
};
struct  Tcell46346  {
NI refcount;
TNimType* typ;
};
struct  Tcellseq46362  {
NI len;
NI cap;
Tcell46346** d;
};
struct  Tcellset46358  {
NI counter;
NI max;
Tpagedesc46354* head;
Tpagedesc46354** 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;
Tcellseq46362 zct;
Tcellseq46362 decstack;
Tcellset46358 cycleroots;
Tcellseq46362 tempstack;
NI recgclock;
Tmemregion28210 region;
Tgcstat48214 stat;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef Ttype191849* TY350187[1];
struct  Tpasscontext242005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset188056  {
NI counter;
NI max;
Ttrunk188052* head;
Ttrunkseq188054* data;
};
struct  Tlinkedlist132028  {
Tlistentry132022* head;
Tlistentry132022* tail;
NI counter;
};
typedef N_NIMCALL_PTR(Tnode191813*, TY245072) (Tcontext245023* c, Tnode191813* n);
typedef N_NIMCALL_PTR(Tnode191813*, TY245077) (Tcontext245023* c, Tnode191813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode191813*, TY245085) (Tcontext245023* c, Tnode191813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode191813*, TY245093) (Tcontext245023* c, Tnode191813* n);
typedef N_NIMCALL_PTR(Tnode191813*, TY245098) (Tcontext245023* c, Tnode191813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode191813*, TY245106) (Tcontext245023* c, Tnode191813* n);
typedef N_NIMCALL_PTR(Tnode191813*, TY245111) (Tcontext245023* c, Tnode191813* n, Tnode191813* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype191849*, TY245118) (Tcontext245023* c, Tnode191813* n, Ttype191849* prev);
typedef struct {
N_NIMCALL_PTR(Tnode191813*, ClPrc) (Tcontext245023* c, Tidtable191861 pt, Tnode191813* n, void* ClEnv);
void* ClEnv;
} TY245124;
typedef struct {
N_NIMCALL_PTR(Tsym191843*, ClPrc) (Tcontext245023* c, Tsym191843* fn, Tidtable191861 pt, Tlineinfo164338 info, void* ClEnv);
void* ClEnv;
} TY245130;
typedef N_NIMCALL_PTR(Tsym191843*, TY245146) (Tcontext245023* c, Tsym191843* dc, Ttype191849* t, Tlineinfo164338 info, NU8 op);
struct  Tcontext245023  {
  Tpasscontext242005 Sup;
Tsym191843* module;
Tscope191837* currentscope;
Tscope191837* importtable;
Tscope191837* toplevelscope;
Tproccon245011* p;
Tsymseq191815* friendmodules;
NI instcounter;
Intset188056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI incompilescontext;
NI ingenericinst;
Tsymseq191815* converters;
Tsymseq191815* patterns;
Tlinkedlist132028 optionstack;
Tidtable191861 symmapping;
Tlinkedlist132028 libs;
TY245072 semconstexpr;
TY245077 semexpr;
TY245085 semtryexpr;
TY245093 semtryconstexpr;
TY245098 semoperand;
TY245106 semconstboolexpr;
TY245111 semoverloadedcall;
TY245118 semtypenode;
TY245124 seminferredlambda;
TY245130 semgenerateinstance;
Intset188056 includedfiles;
Tstrtable191817 userpragmas;
Tctx244048* evalcontext;
Intset188056 unknownidents;
TY245141* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY245146 insttypeboundop;
};
struct  Tidpair191857  {
Tidobj168015* key;
TNimObject* val;
};
struct  Tident168021  {
  Tidobj168015 Sup;
NimStringDesc* s;
Tident168021* next;
NI h;
};
struct  Ropeobj162009  {
  TNimObject Sup;
Ropeobj162009* left;
Ropeobj162009* right;
NI length;
NimStringDesc* data;
};
struct  Tscope191837  {
NI depthlevel;
Tstrtable191817 symbols;
Tnodeseq191807* usingsyms;
Tscope191837* parent;
};
struct  Tlistentry132022  {
  TNimObject Sup;
Tlistentry132022* prev;
Tlistentry132022* next;
};
struct  Tlib191831  {
  Tlistentry132022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj162009* name;
Tnode191813* path;
};
typedef NI TY27420[16];
struct  Tpagedesc46354  {
Tpagedesc46354* 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  Tproccon245011  {
Tsym191843* owner;
Tsym191843* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon245011* next;
NIM_BOOL wasforwarded;
Tnode191813* bracketexpr;
};
struct  Ttrunk188052  {
Ttrunk188052* next;
NI key;
TY27420 bits;
};
struct  Tctx244048  {
  Tpasscontext242005 Sup;
TY244253* code;
TY165036* debug;
Tnode191813* globals;
Tnode191813* constants;
Ttypeseq191845* types;
Tnode191813* currentexceptiona;
Tnode191813* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype244232* prc;
Tsym191843* module;
Tnode191813* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo164338 comesfromheuristic;
TY244272* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair245013  {
Tsym191843* genericsym;
Tinstantiation191833* inst;
};
struct  Tinstantiation191833  {
Tsym191843* sym;
Ttypeseq191845* concretetypes;
TY191933* usedby;
};
struct  Tfreecell27430  {
Tfreecell27430* next;
NI zerofield;
};
struct TY244239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY244239 TY244236[256];
struct  PprocHEX3Aobjecttype244232  {
TY244233* blocks;
Tsym191843* sym;
TY244236 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs244042* args, void* ClEnv);
void* ClEnv;
} Vmcallback244044;
struct TY244273 {
NimStringDesc* Field0;
Vmcallback244044 Field1;
};
struct  Tblock244030  {
Tsym191843* label;
TY244213* fixups;
};
struct  Vmargs244042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode191813* currentexception;
};
struct Ttypeseq191845 {
  TGenericSeq Sup;
  Ttype191849* data[SEQ_DECL_SIZE];
};
struct Tnodeseq191807 {
  TGenericSeq Sup;
  Tnode191813* data[SEQ_DECL_SIZE];
};
struct Tidpairseq191859 {
  TGenericSeq Sup;
  Tidpair191857 data[SEQ_DECL_SIZE];
};
struct TY191944 {
  TGenericSeq Sup;
  Tinstantiation191833* data[SEQ_DECL_SIZE];
};
struct Tsymseq191815 {
  TGenericSeq Sup;
  Tsym191843* data[SEQ_DECL_SIZE];
};
struct Ttrunkseq188054 {
  TGenericSeq Sup;
  Ttrunk188052* data[SEQ_DECL_SIZE];
};
struct TY245141 {
  TGenericSeq Sup;
  Tinstantiationpair245013 data[SEQ_DECL_SIZE];
};
struct TY244253 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY165036 {
  TGenericSeq Sup;
  Tlineinfo164338 data[SEQ_DECL_SIZE];
};
struct TY244272 {
  TGenericSeq Sup;
  TY244273 data[SEQ_DECL_SIZE];
};
struct TY191933 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY244233 {
  TGenericSeq Sup;
  Tblock244030 data[SEQ_DECL_SIZE];
};
struct TY244213 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, inittypevars_268602)(Tcontext245023* p, Tidtable191861 pt, Tlineinfo164338 info, Trepltypevars266544* Result);
N_NIMCALL(void, initidtable_195057)(Tidtable191861* x);
N_NIMCALL(void, copyidtable_193091)(Tidtable191861* dest, Tidtable191861 src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, pushinfocontext_165192)(Tlineinfo164338 info);
N_NIMCALL(Tnode191813*, replacetypevarsn_266571)(Trepltypevars266544* cl, Tnode191813* n_266575);
N_NIMCALL(Tnode191813*, copynode_195640)(Tnode191813* src);
N_NIMCALL(Ttype191849*, replacetypevarst_266592)(Trepltypevars266544* cl, Ttype191849* t);
N_NIMCALL(Ttype191849*, replacetypevarstaux_266555)(Trepltypevars266544* cl, Ttype191849* t);
N_NIMCALL(TNimObject*, idtableget_199182)(Tidtable191861 t, Tidobj168015* key);
N_NIMCALL(Ttype191849*, handlegenericinvocation_267535)(Trepltypevars266544* cl, Ttype191849* t);
N_NIMCALL(void, internalerror_166199)(Tlineinfo164338 info, NimStringDesc* errmsg);
N_NIMCALL(Ttype191849*, searchinsttypes_266207)(Ttype191849* key);
N_NIMCALL(void, internalerror_166218)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_166306)(TY88145 x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_230739)(Ttypeseq191845* x, Ttypeseq191845* y);
N_NIMCALL(NIM_BOOL, comparetypes_228047)(Ttype191849* x, Ttype191849* y, NU8 cmp, NU8 flags);
N_NIMCALL(NI, sonslen_194351)(Ttype191849* n);
N_NIMCALL(Ttype191849*, lookuptypevar_267425)(Trepltypevars266544* cl, Ttype191849* t);
N_NIMCALL(void, localerror_166155)(Tlineinfo164338 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, typetostring_221032)(Ttype191849* typ, NU8 prefer);
N_NIMCALL(Ttype191849*, errortype_246150)(Tcontext245023* c);
N_NIMCALL(void, idtableput_199196)(Tidtable191861* t, Tidobj168015* key, TNimObject* val);
N_NIMCALL(Ttype191849*, instcopytype_267470)(Trepltypevars266544* cl, Ttype191849* t);
N_NIMCALL(Ttype191849*, copytype_194549)(Ttype191849* t, Tsym191843* owner, NIM_BOOL keepid);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Tcell46346*, usrtocell_49846)(void* usr);
static N_INLINE(void, rtladdzct_51404)(Tcell46346* c);
N_NOINLINE(void, addzct_49817)(Tcellseq46362* s, Tcell46346* c);
N_NIMCALL(void, propagatetoowner_195274)(Ttype191849* owner, Ttype191849* elem);
N_NIMCALL(Ttype191849*, newtype_194140)(NU8 kind, Tsym191843* owner);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(void, cachetypeinst_266483)(Ttype191849* inst);
N_NIMCALL(void, safeadd_266489)(Ttypeseq191845** x, Ttype191849* y);
N_NIMCALL(void, rawaddson_195478)(Ttype191849* father, Ttype191849* son);
N_NIMCALL(Ttype191849*, lastson_194442)(Ttype191849* n);
N_NIMCALL(NIM_BOOL, isgenericalias_227091)(Ttype191849* t);
N_NIMCALL(Ttype191849*, skipgenericalias_227119)(Ttype191849* t);
N_NIMCALL(void, checkpartialconstructedtype_266063)(Tlineinfo164338 info, Ttype191849* t);
N_NIMCALL(Ttype191849*, skiptypes_195167)(Ttype191849* t, NU64 kinds);
N_NIMCALL(void, sharedptrcheck_266014)(Tlineinfo164338 info, Ttype191849* t);
N_NIMCALL(NI, len_194377)(Ttype191849* n);
static N_INLINE(NIM_BOOL, isgcedmem_195235)(Ttype191849* t);
N_NIMCALL(Tnode191813*, preparenode_266607)(Trepltypevars266544* cl, Tnode191813* n);
N_NIMCALL(Tsym191843*, replacetypevarss_266563)(Trepltypevars266544* cl, Tsym191843* s);
N_NIMCALL(Tsym191843*, copysym_194607)(Tsym191843* s, NIM_BOOL keepid);
static N_INLINE(NI, safelen_192125)(Tnode191813* n);
N_NIMCALL(void, add_192164)(Tnode191813* father, Tnode191813* son);
static N_INLINE(Tnode191813*, HEX5BHEX5D_192244)(Tnode191813* n, NI i);
N_NIMCALL(Ttype191849*, newtypes_245219)(NU8 kind, Tcontext245023* c);
static N_INLINE(Ttype191849*, skipintlit_239696)(Ttype191849* t);
N_NIMCALL(Ttype191849*, getsystype_239030)(NU8 kind);
N_NIMCALL(Ttype191849*, base_221039)(Ttype191849* t);
N_NIMCALL(Ttype191849*, maketypedesc_245682)(Tcontext245023* c, Ttype191849* typ);
N_NIMCALL(NIM_BOOL, containsgenerictype_230310)(Ttype191849* t);
N_NIMCALL(void, propagatefieldflags_268234)(Ttype191849* t, Tnode191813* n);
static N_INLINE(NI, len_192097)(Tnode191813* n);
N_NIMCALL(void, erasevoidparams_267982)(Ttype191849* t);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, skipintliteralparams_268136)(Ttype191849* t);
N_NIMCALL(Tnode191813*, newnode_193607)(NU8 kind, Tlineinfo164338 info, Tnodeseq191807* sons, Ttype191849* typ);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(NI, sonslen_194403)(Tnode191813* n);
N_NIMCALL(void, illformedast_246229)(Tnode191813* n);
N_NIMCALL(void, checksonslen_246249)(Tnode191813* n, NI length);
N_NIMCALL(Tnode191813*, newnodei_193351)(NU8 kind, Tlineinfo164338 info);
N_NIMCALL(Tnode191813*, reresolvecallswithtypedescparams_266871)(Trepltypevars266544* cl, Tnode191813* n);
N_NIMCALL(NIM_BOOL, istypeparam_266714)(Tnode191813* n);
N_NIMCALL(Tnode191813*, newsymnode_193325)(Tsym191843* sym);
N_NIMCALL(void, newsons_194272)(Tnode191813* father, NI length);
N_NIMCALL(void, popinfocontext_165211)(void);
N_NIMCALL(NIM_BOOL, hasgenericarguments_266765)(Tnode191813* n);
N_NIMCALL(NI64, computesize_221184)(Ttype191849* typ);
STRING_LITERAL(TMP2628, "no generic body", 15);
STRING_LITERAL(TMP2630, "semtypinst.nim", 14);
NIM_CONST TY88145 TMP2629 = {((NimStringDesc*) &TMP2630),
((NI) 52)}
;
STRING_LITERAL(TMP2635, "substitution with generic parameter", 35);
STRING_LITERAL(TMP2636, "acyclic", 7);
STRING_LITERAL(TMP2637, "", 0);
STRING_LITERAL(TMP2638, "shared memory may not refer to GC\'ed thread local memory", 56);
NIM_CONST TY88145 TMP2641 = {((NimStringDesc*) &TMP2630),
((NI) 451)}
;
NIM_CONST TY88145 TMP2642 = {((NimStringDesc*) &TMP2630),
((NI) 358)}
;
STRING_LITERAL(TMP2643, "ReplaceTypeVarsN: when condition not a bool", 43);
extern Tgcheap48216 gch_48244;
extern TNimType NTI191845; /* TTypeSeq */
extern TNimType NTI191807; /* TNodeSeq */

N_NIMCALL(void, inittypevars_268602)(Tcontext245023* p, Tidtable191861 pt, Tlineinfo164338 info, Trepltypevars266544* Result) {
	initidtable_195057((&(*Result).symmap));
	copyidtable_193091((&(*Result).typemap), pt);
	initidtable_195057((&(*Result).localcache));
	(*Result).info = info;
	unsureAsgnRef((void**) (&(*Result).c), p);
}

N_NIMCALL(Ttype191849*, searchinsttypes_266207)(Ttype191849* key) {
	Ttype191849* result;
	Ttype191849* 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_166306(TMP2629);
		internalerror_166218(LOC9);
	}
	LA7: ;
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = HEX3DHEX3D_230739((*(*generictyp).sym).kindU.S1.typeinstcache, NIM_NIL);
		if (!LOC12) goto LA13;
		goto BeforeRet;
	}
	LA13: ;
	{
		Ttype191849* inst_266411;
		Ttypeseq191845* HEX3Atmp_266450;
		NI i_266453;
		NI L_266455;
		inst_266411 = 0;
		HEX3Atmp_266450 = 0;
		HEX3Atmp_266450 = (*(*generictyp).sym).kindU.S1.typeinstcache;
		i_266453 = ((NI) 0);
		L_266455 = (HEX3Atmp_266450 ? HEX3Atmp_266450->Sup.len : 0);
		{
			while (1) {
				if (!(i_266453 < L_266455)) goto LA17;
				inst_266411 = HEX3Atmp_266450->data[i_266453];
				{
					if (!((*inst_266411).Sup.id == (*key).Sup.id)) goto LA20;
					result = inst_266411;
					goto BeforeRet;
				}
				LA20: ;
				{
					if (!(((*inst_266411).sons ? (*inst_266411).sons->Sup.len : 0) < ((*key).sons ? (*key).sons->Sup.len : 0))) goto LA24;
					goto BeforeRet;
				}
				LA24: ;
				{
					{
						NI j_266439;
						NI HEX3Atmp_266443;
						NI res_266446;
						j_266439 = 0;
						HEX3Atmp_266443 = 0;
						HEX3Atmp_266443 = ((*key).sons ? ((*key).sons->Sup.len-1) : -1);
						res_266446 = ((NI) 1);
						{
							while (1) {
								if (!(res_266446 <= HEX3Atmp_266443)) goto LA29;
								j_266439 = res_266446;
								{
									NIM_BOOL LOC32;
									LOC32 = 0;
									LOC32 = comparetypes_228047((*inst_266411).sons->data[j_266439], (*key).sons->data[j_266439], ((NU8) 0), 8);
									if (!!(LOC32)) goto LA33;
									goto LA26;
								}
								LA33: ;
								res_266446 += ((NI) 1);
							} LA29: ;
						}
					}
					result = inst_266411;
					goto BeforeRet;
				} LA26: ;
				i_266453 += ((NI) 1);
			} LA17: ;
		}
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype191849*, lookuptypevar_267425)(Trepltypevars266544* cl, Ttype191849* t) {
	Ttype191849* result;
	Tidobj168015* LOC1;
	TNimObject* LOC2;
{	result = 0;
	LOC1 = 0;
	LOC1 = &t->Sup;
	LOC2 = 0;
	LOC2 = idtableget_199182((*cl).typemap, LOC1);
	result = ((Ttype191849*) (LOC2));
	{
		NimStringDesc* LOC13;
		Tidobj168015* 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_221032(t, ((NU8) 0));
		localerror_166155((*(*t).sym).info, ((NU16) 124), LOC13);
		result = errortype_246150((*cl).c);
		LOC14 = 0;
		LOC14 = &t->Sup;
		LOC15 = 0;
		LOC15 = &result->Sup.Sup;
		idtableput_199196((&(*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_166199((*cl).info, ((NimStringDesc*) &TMP2635));
	}
	goto LA3;
	LA19: ;
	LA3: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype191849*, instcopytype_267470)(Trepltypevars266544* cl, Ttype191849* t) {
	Ttype191849* result;
	result = 0;
	result = copytype_194549(t, (*t).owner, (*cl).allowmetatypes);
	(*result).flags |= ((NI32)1)<<((((NU8) 8))%(sizeof(NI32)*8));
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		LOC3 = 0;
		LOC3 = ((*t).kind == ((NU8) 6) || (*t).kind == ((NU8) 8) || (*t).kind == ((NU8) 12) || (*t).kind >= ((NU8) 51) && (*t).kind <= ((NU8) 58));
		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(Tcell46346*, usrtocell_49846)(void* usr) {
	Tcell46346* result;
	result = 0;
	result = ((Tcell46346*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(Tcell46346))))));
	return result;
}

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

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

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

N_NIMCALL(void, cachetypeinst_266483)(Ttype191849* inst) {
	Ttype191849* generictyp;
	generictyp = (*inst).sons->data[((NI) 0)];
	safeadd_266489((&(*(*generictyp).sym).kindU.S1.typeinstcache), inst);
}

static N_INLINE(NIM_BOOL, isgcedmem_195235)(Ttype191849* t) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	NIM_BOOL LOC3;
	result = 0;
	LOC1 = 0;
	LOC1 = ((*t).kind == ((NU8) 28) || (*t).kind == ((NU8) 22) || (*t).kind == ((NU8) 24));
	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_266014)(Tlineinfo164338 info, Ttype191849* t) {
	{
		NIM_BOOL LOC3;
		NI LOC5;
		LOC3 = 0;
		LOC3 = ((*t).kind == ((NU8) 21));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = len_194377(t);
		LOC3 = (((NI) 1) < LOC5);
		LA4: ;
		if (!LOC3) goto LA6;
		{
			if (!((*(*(*t).sons->data[((NI) 0)]).sym).magic == ((NU16) 210))) goto LA10;
			(*t).flags |= ((NI32)1)<<((((NU8) 15))%(sizeof(NI32)*8));
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = (((*t).flags &(1<<((((NU8) 20))&31)))!=0);
				if (LOC14) goto LA15;
				LOC14 = isgcedmem_195235(t);
				LA15: ;
				if (!LOC14) goto LA16;
				localerror_166155(info, ((NU16) 4), ((NimStringDesc*) &TMP2638));
			}
			LA16: ;
		}
		LA10: ;
	}
	LA6: ;
}

N_NIMCALL(void, checkpartialconstructedtype_266063)(Tlineinfo164338 info, Ttype191849* t) {
	{
		NIM_BOOL LOC3;
		Ttype191849* LOC5;
		LOC3 = 0;
		LOC3 = (((*t).flags &(1<<((((NU8) 4))&31)))!=0);
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = skiptypes_195167(t, IL64(211106232576256));
		LOC3 = !(((*LOC5).kind == ((NU8) 17)));
		LA4: ;
		if (!LOC3) goto LA6;
		localerror_166155(info, ((NU16) 162), ((NimStringDesc*) &TMP2636));
	}
	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_166155(info, ((NU16) 197), ((NimStringDesc*) &TMP2637));
	}
	goto LA1;
	LA11: ;
	{
		sharedptrcheck_266014(info, t);
	}
	LA1: ;
}

N_NIMCALL(Ttype191849*, handlegenericinvocation_267535)(Trepltypevars266544* cl, Ttype191849* t) {
	Ttype191849* result;
	Ttype191849* body;
	Ttype191849* header;
	TY350187 LOC46;
	NIM_BOOL oldskiptypedesc;
	Ttype191849* newbody;
	Ttype191849* LOC64;
	Tsym191843* dc;
	Tsym191843* asgn;
{	result = 0;
	body = (*t).sons->data[((NI) 0)];
	{
		if (!!(((*body).kind == ((NU8) 10)))) goto LA3;
		internalerror_166199((*cl).info, ((NimStringDesc*) &TMP2628));
	}
	LA3: ;
	header = t;
	{
		Tidobj168015* LOC9;
		TNimObject* LOC10;
		if (!(*cl).allowmetatypes) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_199182((*cl).localcache, LOC9);
		result = ((Ttype191849*) (LOC10));
	}
	goto LA5;
	LA7: ;
	{
		result = searchinsttypes_266207(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_267611;
		NI HEX3Atmp_267926;
		NI LOC19;
		NI res_267929;
		i_267611 = 0;
		HEX3Atmp_267926 = 0;
		LOC19 = 0;
		LOC19 = sonslen_194351(t);
		HEX3Atmp_267926 = (NI)(LOC19 - ((NI) 1));
		res_267929 = ((NI) 1);
		{
			while (1) {
				Ttype191849* x;
				if (!(res_267929 <= HEX3Atmp_267926)) goto LA21;
				i_267611 = res_267929;
				x = (*t).sons->data[i_267611];
				{
					if (!((*x).kind == ((NU8) 12))) goto LA24;
					x = lookuptypevar_267425(cl, x);
					{
						if (!!((x == NIM_NIL))) goto LA28;
						{
							if (!(header == t)) goto LA32;
							header = instcopytype_267470(cl, t);
						}
						LA32: ;
						asgnRefNoCycle((void**) (&(*header).sons->data[i_267611]), x);
						propagatetoowner_195274(header, x);
					}
					LA28: ;
				}
				goto LA22;
				LA24: ;
				{
					propagatetoowner_195274(header, x);
				}
				LA22: ;
				res_267929 += ((NI) 1);
			} LA21: ;
		}
	}
	{
		if (!!((header == t))) goto LA37;
		result = searchinsttypes_266207(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_267470(cl, t);
	}
	LA35: ;
	result = newtype_194140(((NU8) 11), (*(*t).sons->data[((NI) 0)]).owner);
	(*result).flags = (*header).flags;
	if ((*result).sons) nimGCunrefNoCycle((*result).sons);
	(*result).sons = (Ttypeseq191845*) newSeqRC1((&NTI191845), 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_266483(result);
	}
	goto LA47;
	LA49: ;
	{
		Tidobj168015* LOC52;
		TNimObject* LOC53;
		LOC52 = 0;
		LOC52 = &t->Sup;
		LOC53 = 0;
		LOC53 = &result->Sup.Sup;
		idtableput_199196((&(*cl).localcache), LOC52, LOC53);
	}
	LA47: ;
	oldskiptypedesc = (*cl).skiptypedesc;
	(*cl).skiptypedesc = NIM_TRUE;
	{
		NI i_267730;
		NI HEX3Atmp_267934;
		NI LOC55;
		NI res_267937;
		i_267730 = 0;
		HEX3Atmp_267934 = 0;
		LOC55 = 0;
		LOC55 = sonslen_194351(t);
		HEX3Atmp_267934 = (NI)(LOC55 - ((NI) 1));
		res_267937 = ((NI) 1);
		{
			while (1) {
				Ttype191849* x;
				Tidobj168015* LOC58;
				TNimObject* LOC59;
				if (!(res_267937 <= HEX3Atmp_267934)) goto LA57;
				i_267730 = res_267937;
				x = replacetypevarst_266592(cl, (*t).sons->data[i_267730]);
				asgnRefNoCycle((void**) (&(*header).sons->data[i_267730]), x);
				propagatetoowner_195274(header, x);
				LOC58 = 0;
				LOC58 = &(*body).sons->data[(NI)(i_267730 - ((NI) 1))]->Sup;
				LOC59 = 0;
				LOC59 = &x->Sup.Sup;
				idtableput_199196((&(*cl).typemap), LOC58, LOC59);
				res_267937 += ((NI) 1);
			} LA57: ;
		}
	}
	{
		NI i_267814;
		NI HEX3Atmp_267942;
		NI LOC61;
		NI res_267945;
		i_267814 = 0;
		HEX3Atmp_267942 = 0;
		LOC61 = 0;
		LOC61 = sonslen_194351(t);
		HEX3Atmp_267942 = (NI)(LOC61 - ((NI) 1));
		res_267945 = ((NI) 1);
		{
			while (1) {
				if (!(res_267945 <= HEX3Atmp_267942)) goto LA63;
				i_267814 = res_267945;
				rawaddson_195478(result, (*header).sons->data[i_267814]);
				res_267945 += ((NI) 1);
			} LA63: ;
		}
	}
	LOC64 = 0;
	LOC64 = lastson_194442(body);
	newbody = replacetypevarst_266592(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_227091(newbody);
		if (!LOC67) goto LA68;
		newbody = skipgenericalias_227119(newbody);
	}
	LA68: ;
	rawaddson_195478(result, newbody);
	checkpartialconstructedtype_266063((*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(Tsym191843*, replacetypevarss_266563)(Trepltypevars266544* cl, Tsym191843* s) {
	Tsym191843* result;
	Tidobj168015* LOC5;
	TNimObject* LOC6;
{	result = 0;
	{
		if (!(s == NIM_NIL)) goto LA3;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = &s->Sup;
	LOC6 = 0;
	LOC6 = idtableget_199182((*cl).symmap, LOC5);
	result = ((Tsym191843*) (LOC6));
	{
		Tidobj168015* LOC11;
		TNimObject* LOC12;
		if (!(result == NIM_NIL)) goto LA9;
		result = copysym_194607(s, NIM_FALSE);
		(*result).flags |= ((NI32)1)<<((((NU8) 2))%(sizeof(NI32)*8));
		LOC11 = 0;
		LOC11 = &s->Sup;
		LOC12 = 0;
		LOC12 = &result->Sup.Sup;
		idtableput_199196((&(*cl).symmap), LOC11, LOC12);
		asgnRefNoCycle((void**) (&(*result).owner), (*s).owner);
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_266592(cl, (*s).typ));
		asgnRefNoCycle((void**) (&(*result).ast), replacetypevarsn_266571(cl, (*s).ast));
	}
	LA9: ;
	}BeforeRet: ;
	return result;
}

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

N_NIMCALL(Tnode191813*, preparenode_266607)(Trepltypevars266544* cl, Tnode191813* n) {
	Tnode191813* result;
	Ttype191849* t;
	NIM_BOOL iscall;
{	result = 0;
	t = replacetypevarst_266592(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_195640(n);
	asgnRefNoCycle((void**) (&(*result).typ), t);
	{
		if (!((*result).kind == ((NU8) 3))) goto LA11;
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_266563(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_266688;
		NI HEX3Atmp_266692;
		NI LOC14;
		NI res_266695;
		i_266688 = 0;
		HEX3Atmp_266692 = 0;
		LOC14 = 0;
		LOC14 = safelen_192125(n);
		HEX3Atmp_266692 = (LOC14 - 1);
		res_266695 = ((NI) 0);
		{
			while (1) {
				if (!(res_266695 <= HEX3Atmp_266692)) goto LA16;
				i_266688 = res_266695;
				{
					NIM_BOOL LOC19;
					Tnode191813* LOC23;
					LOC19 = 0;
					LOC19 = iscall;
					if (!(LOC19)) goto LA20;
					LOC19 = (i_266688 == ((NI) 0));
					LA20: ;
					if (!LOC19) goto LA21;
					LOC23 = 0;
					LOC23 = HEX5BHEX5D_192244(n, i_266688);
					add_192164(result, LOC23);
				}
				goto LA17;
				LA21: ;
				{
					Tnode191813* LOC25;
					Tnode191813* LOC26;
					LOC25 = 0;
					LOC25 = HEX5BHEX5D_192244(n, i_266688);
					LOC26 = 0;
					LOC26 = preparenode_266607(cl, LOC25);
					add_192164(result, LOC26);
				}
				LA17: ;
				res_266695 += ((NI) 1);
			} LA16: ;
		}
	}
	}BeforeRet: ;
	return result;
}

static N_INLINE(Ttype191849*, skipintlit_239696)(Ttype191849* t) {
	Ttype191849* result;
{	result = 0;
	{
		if (!!(((*t).n == NIM_NIL))) goto LA3;
		{
			if (!((*t).kind == ((NU8) 31) || (*t).kind == ((NU8) 36))) goto LA7;
			result = getsystype_239030((*t).kind);
			goto BeforeRet;
		}
		LA7: ;
	}
	LA3: ;
	result = t;
	}BeforeRet: ;
	return result;
}

static N_INLINE(NI, len_192097)(Tnode191813* 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_268234)(Ttype191849* t, Tnode191813* n) {
{	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		NimStringDesc* LOC9;
		if (!!(!(((*n).kind == ((NU8) 140))))) goto LA7;
		LOC9 = 0;
		LOC9 = HEX24_166306(TMP2642);
		internalerror_166218(LOC9);
	}
	LA7: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		propagatetoowner_195274(t, (*(*n).kindU.S4.sym).typ);
	}
	break;
	case ((NU8) 138):
	case ((NU8) 139):
	case ((NU8) 85):
	case ((NU8) 88):
	{
		{
			Tnode191813* son_268265;
			son_268265 = 0;
			{
				NI i_268270;
				NI HEX3Atmp_268272;
				NI LOC14;
				NI res_268274;
				i_268270 = 0;
				HEX3Atmp_268272 = 0;
				LOC14 = 0;
				LOC14 = len_192097(n);
				HEX3Atmp_268272 = (LOC14 - 1);
				res_268274 = ((NI) 0);
				{
					while (1) {
						if (!(res_268274 <= HEX3Atmp_268272)) goto LA16;
						i_268270 = res_268274;
						son_268265 = (*n).kindU.S6.sons->data[i_268270];
						propagatefieldflags_268234(t, son_268265);
						res_268274 += ((NI) 1);
					} LA16: ;
				}
			}
		}
	}
	break;
	default:
	{
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, erasevoidparams_267982)(Ttype191849* 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_268024;
		NI HEX3Atmp_268105;
		NI LOC8;
		NI res_268108;
		i_268024 = 0;
		HEX3Atmp_268105 = 0;
		LOC8 = 0;
		LOC8 = sonslen_194351(t);
		HEX3Atmp_268105 = (LOC8 - 1);
		res_268108 = ((NI) 1);
		{
			while (1) {
				if (!(res_268108 <= HEX3Atmp_268105)) goto LA10;
				i_268024 = res_268108;
				{
					NI pos;
					if (!((*(*t).sons->data[i_268024]).kind == ((NU8) 3))) goto LA13;
					pos = i_268024;
					{
						NI j_268053;
						NI HEX3Atmp_268097;
						NI HEX3Atmp_268098;
						NI LOC16;
						NI res_268101;
						j_268053 = 0;
						HEX3Atmp_268097 = 0;
						HEX3Atmp_268098 = 0;
						HEX3Atmp_268097 = (NI)(i_268024 + ((NI) 1));
						LOC16 = 0;
						LOC16 = sonslen_194351(t);
						HEX3Atmp_268098 = (LOC16 - 1);
						res_268101 = HEX3Atmp_268097;
						{
							while (1) {
								if (!(res_268101 <= HEX3Atmp_268098)) goto LA18;
								j_268053 = res_268101;
								{
									if (!!(((*(*t).sons->data[j_268053]).kind == ((NU8) 3)))) goto LA21;
									asgnRefNoCycle((void**) (&(*t).sons->data[pos]), (*t).sons->data[j_268053]);
									asgnRefNoCycle((void**) (&(*(*t).n).kindU.S6.sons->data[pos]), (*(*t).n).kindU.S6.sons->data[j_268053]);
									pos += ((NI) 1);
								}
								LA21: ;
								res_268101 += ((NI) 1);
							} LA18: ;
						}
					}
					(*t).sons = (Ttypeseq191845*) setLengthSeq(&((*t).sons)->Sup, sizeof(Ttype191849*), ((NI) (pos)));
					(*(*t).n).kindU.S6.sons = (Tnodeseq191807*) setLengthSeq(&((*(*t).n).kindU.S6.sons)->Sup, sizeof(Tnode191813*), ((NI) (pos)));
					goto BeforeRet;
				}
				LA13: ;
				res_268108 += ((NI) 1);
			} LA10: ;
		}
	}
	}BeforeRet: ;
}

N_NIMCALL(void, skipintliteralparams_268136)(Ttype191849* t) {
	{
		NI i_268157;
		NI HEX3Atmp_268209;
		NI LOC2;
		NI res_268212;
		i_268157 = 0;
		HEX3Atmp_268209 = 0;
		LOC2 = 0;
		LOC2 = sonslen_194351(t);
		HEX3Atmp_268209 = (LOC2 - 1);
		res_268212 = ((NI) 0);
		{
			while (1) {
				if (!(res_268212 <= HEX3Atmp_268209)) goto LA4;
				i_268157 = res_268212;
				{
					Ttype191849* p;
					Ttype191849* skipped;
					p = (*t).sons->data[i_268157];
					{
						if (!(p == NIM_NIL)) goto LA8;
						goto LA5;
					}
					LA8: ;
					skipped = skipintlit_239696(p);
					{
						if (!!((skipped == p))) goto LA12;
						asgnRefNoCycle((void**) (&(*t).sons->data[i_268157]), skipped);
						{
							if (!(((NI) 0) < i_268157)) goto LA16;
							asgnRefNoCycle((void**) (&(*(*(*(*t).n).kindU.S6.sons->data[i_268157]).kindU.S4.sym).typ), skipped);
						}
						LA16: ;
					}
					LA12: ;
				} LA5: ;
				res_268212 += ((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_221039((*t).sons->data[((NI) 0)]));
	}
	LA22: ;
}

N_NIMCALL(Ttype191849*, replacetypevarstaux_266555)(Trepltypevars266544* cl, Ttype191849* t) {
	Ttype191849* result;
{	result = 0;
	result = t;
	{
		if (!(t == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		Ttype191849* lookup;
		Tidobj168015* LOC9;
		TNimObject* LOC10;
		if (!((*t).kind == ((NU8) 12) || (*t).kind == ((NU8) 49) || (*t).kind >= ((NU8) 51) && (*t).kind <= ((NU8) 59))) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_199182((*cl).typemap, LOC9);
		lookup = ((Ttype191849*) (LOC10));
		{
			if (!!((lookup == NIM_NIL))) goto LA13;
			result = lookup;
			goto BeforeRet;
		}
		LA13: ;
	}
	LA7: ;
	switch ((*t).kind) {
	case ((NU8) 9):
	{
		result = handlegenericinvocation_267535(cl, t);
	}
	break;
	case ((NU8) 10):
	{
		NimStringDesc* LOC17;
		LOC17 = 0;
		LOC17 = typetostring_221032(t, ((NU8) 0));
		localerror_166155((*cl).info, ((NU16) 124), LOC17);
		result = errortype_246150((*cl).c);
	}
	break;
	case ((NU8) 60):
	{
		Tnode191813* n;
		{
			if (!(*cl).allowmetatypes) goto LA21;
			goto BeforeRet;
		}
		LA21: ;
		n = preparenode_266607(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_195167((*n).typ, 256);
		}
		goto LA27;
		LA29: ;
		{
			{
				TY350187 LOC36;
				if (!!(((*(*n).typ).kind == ((NU8) 59)))) goto LA34;
				result = newtypes_245219(((NU8) 59), (*cl).c);
				if ((*result).sons) nimGCunrefNoCycle((*result).sons);
				(*result).sons = (Ttypeseq191845*) newSeqRC1((&NTI191845), 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_239696(t);
	}
	break;
	case ((NU8) 8):
	{
		Ttype191849* lookup;
		Tidobj168015* LOC40;
		TNimObject* LOC41;
		LOC40 = 0;
		LOC40 = &t->Sup;
		LOC41 = 0;
		LOC41 = idtableget_199182((*cl).typemap, LOC40);
		lookup = ((Ttype191849*) (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_221039(result);
			}
			LA50: ;
		}
		goto LA42;
		LA44: ;
		{
			Ttype191849* LOC55;
			if (!!(((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 0)))) goto LA53;
			LOC55 = 0;
			LOC55 = replacetypevarst_266592(cl, (*t).sons->data[((NI) 0)]);
			result = maketypedesc_245682((*cl).c, LOC55);
		}
		goto LA42;
		LA53: ;
		LA42: ;
	}
	break;
	case ((NU8) 52):
	{
		result = t;
	}
	break;
	case ((NU8) 11):
	{
		Tidobj168015* LOC58;
		TNimObject* LOC59;
		Tidobj168015* LOC64;
		TNimObject* LOC65;
		Ttype191849* LOC70;
		LOC58 = 0;
		LOC58 = &t->Sup;
		LOC59 = 0;
		LOC59 = idtableget_199182((*cl).localcache, LOC58);
		result = ((Ttype191849*) (LOC59));
		{
			if (!!((result == NIM_NIL))) goto LA62;
			goto BeforeRet;
		}
		LA62: ;
		result = instcopytype_267470(cl, t);
		LOC64 = 0;
		LOC64 = &t->Sup;
		LOC65 = 0;
		LOC65 = &result->Sup.Sup;
		idtableput_199196((&(*cl).localcache), LOC64, LOC65);
		{
			NI i_268506;
			NI HEX3Atmp_268563;
			NI LOC67;
			NI res_268566;
			i_268506 = 0;
			HEX3Atmp_268563 = 0;
			LOC67 = 0;
			LOC67 = sonslen_194351(result);
			HEX3Atmp_268563 = (LOC67 - 1);
			res_268566 = ((NI) 1);
			{
				while (1) {
					if (!(res_268566 <= HEX3Atmp_268563)) goto LA69;
					i_268506 = res_268566;
					asgnRefNoCycle((void**) (&(*result).sons->data[i_268506]), replacetypevarst_266592(cl, (*result).sons->data[i_268506]));
					res_268566 += ((NI) 1);
				} LA69: ;
			}
		}
		LOC70 = 0;
		LOC70 = lastson_194442(result);
		propagatetoowner_195274(result, LOC70);
	}
	break;
	default:
	{
		{
			NIM_BOOL LOC74;
			Tidobj168015* LOC77;
			TNimObject* LOC78;
			Tidobj168015* LOC83;
			TNimObject* LOC84;
			LOC74 = 0;
			LOC74 = containsgenerictype_230310(t);
			if (!LOC74) goto LA75;
			LOC77 = 0;
			LOC77 = &t->Sup;
			LOC78 = 0;
			LOC78 = idtableget_199182((*cl).localcache, LOC77);
			result = ((Ttype191849*) (LOC78));
			{
				if (!!((result == NIM_NIL))) goto LA81;
				goto BeforeRet;
			}
			LA81: ;
			result = instcopytype_267470(cl, t);
			(*result).size = IL64(-1);
			LOC83 = 0;
			LOC83 = &t->Sup;
			LOC84 = 0;
			LOC84 = &result->Sup.Sup;
			idtableput_199196((&(*cl).localcache), LOC83, LOC84);
			{
				NI i_268532;
				NI HEX3Atmp_268571;
				NI LOC86;
				NI res_268574;
				i_268532 = 0;
				HEX3Atmp_268571 = 0;
				LOC86 = 0;
				LOC86 = sonslen_194351(result);
				HEX3Atmp_268571 = (NI)(LOC86 - ((NI) 1));
				res_268574 = ((NI) 0);
				{
					while (1) {
						if (!(res_268574 <= HEX3Atmp_268571)) goto LA88;
						i_268532 = res_268574;
						{
							if (!!(((*result).sons->data[i_268532] == NIM_NIL))) goto LA91;
							asgnRefNoCycle((void**) (&(*result).sons->data[i_268532]), replacetypevarst_266592(cl, (*result).sons->data[i_268532]));
							propagatetoowner_195274(result, (*result).sons->data[i_268532]);
						}
						LA91: ;
						res_268574 += ((NI) 1);
					} LA88: ;
				}
			}
			asgnRefNoCycle((void**) (&(*result).n), replacetypevarsn_266571(cl, (*result).n));
			switch ((*result).kind) {
			case ((NU8) 16):
			{
				Ttype191849* idx;
				idx = (*result).sons->data[((NI) 0)];
				{
					NimStringDesc* LOC98;
					if (!!(!(((*idx).kind == ((NU8) 59))))) goto LA96;
					LOC98 = 0;
					LOC98 = HEX24_166306(TMP2641);
					internalerror_166218(LOC98);
				}
				LA96: ;
			}
			break;
			case ((NU8) 17):
			case ((NU8) 18):
			{
				propagatefieldflags_268234(result, (*result).n);
			}
			break;
			case ((NU8) 25):
			{
				erasevoidparams_267982(result);
				skipintliteralparams_268136(result);
			}
			break;
			default:
			{
			}
			break;
			}
		}
		LA75: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype191849*, replacetypevarst_266592)(Trepltypevars266544* cl, Ttype191849* t) {
	Ttype191849* result;
	result = 0;
	result = replacetypevarstaux_266555(cl, t);
	return result;
}

N_NIMCALL(NIM_BOOL, istypeparam_266714)(Tnode191813* 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(Tnode191813*, reresolvecallswithtypedescparams_266871)(Trepltypevars266544* cl, Tnode191813* n) {
	Tnode191813* result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode191813* 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_192244(n, ((NI) 0));
		LOC3 = (((*(*LOC5).kindU.S4.sym).flags &(1<<((((NU8) 2))&31)))!=0);
		LA4: ;
		if (!LOC3) goto LA6;
		needsfixing = NIM_FALSE;
		{
			NI i_266919;
			NI HEX3Atmp_266947;
			NI LOC9;
			NI res_266950;
			i_266919 = 0;
			HEX3Atmp_266947 = 0;
			LOC9 = 0;
			LOC9 = safelen_192125(n);
			HEX3Atmp_266947 = (LOC9 - 1);
			res_266950 = ((NI) 1);
			{
				while (1) {
					if (!(res_266950 <= HEX3Atmp_266947)) goto LA11;
					i_266919 = res_266950;
					{
						Tnode191813* LOC14;
						NIM_BOOL LOC15;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_192244(n, i_266919);
						LOC15 = 0;
						LOC15 = istypeparam_266714(LOC14);
						if (!LOC15) goto LA16;
						needsfixing = NIM_TRUE;
					}
					LA16: ;
					res_266950 += ((NI) 1);
				} LA11: ;
			}
		}
		{
			if (!needsfixing) goto LA20;
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_193325((*(*(*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_266944;
		NI HEX3Atmp_266955;
		NI LOC23;
		NI res_266958;
		i_266944 = 0;
		HEX3Atmp_266955 = 0;
		LOC23 = 0;
		LOC23 = safelen_192125(n);
		HEX3Atmp_266955 = (LOC23 - 1);
		res_266958 = ((NI) 0);
		{
			while (1) {
				Tnode191813* LOC26;
				if (!(res_266958 <= HEX3Atmp_266955)) goto LA25;
				i_266944 = res_266958;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_192244(n, i_266944);
				asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_266944]), reresolvecallswithtypedescparams_266871(cl, LOC26));
				res_266958 += ((NI) 1);
			} LA25: ;
		}
	}
	result = n;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode191813*, replacetypevarsn_266571)(Trepltypevars266544* cl, Tnode191813* n_266575) {
	Tnode191813* result;
{	result = 0;
	{
		if (!(n_266575 == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	result = copynode_195640(n_266575);
	{
		if (!!(((*n_266575).typ == NIM_NIL))) goto LA7;
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_266592(cl, (*n_266575).typ));
	}
	LA7: ;
	switch ((*n_266575).kind) {
	case ((NU8) 0) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_266563(cl, (*n_266575).kindU.S4.sym));
		{
			Tnodeseq191807* LOC15;
			if (!((*(*(*result).kindU.S4.sym).typ).kind == ((NU8) 3))) goto LA13;
			LOC15 = 0;
			LOC15 = (Tnodeseq191807*) newSeq((&NTI191807), 0);
			result = newnode_193607(((NU8) 138), (*n_266575).info, LOC15, NIM_NIL);
		}
		LA13: ;
	}
	break;
	case ((NU8) 140):
	{
		Tnode191813* branch;
		branch = NIM_NIL;
		{
			NI i_267247;
			NI HEX3Atmp_267332;
			NI LOC18;
			NI res_267335;
			i_267247 = 0;
			HEX3Atmp_267332 = 0;
			LOC18 = 0;
			LOC18 = sonslen_194403(n_266575);
			HEX3Atmp_267332 = (NI)(LOC18 - ((NI) 1));
			res_267335 = ((NI) 0);
			{
				while (1) {
					Tnode191813* it;
					if (!(res_267335 <= HEX3Atmp_267332)) goto LA20;
					i_267247 = res_267335;
					it = (*n_266575).kindU.S6.sons->data[i_267247];
					{
						if (!(it == NIM_NIL)) goto LA23;
						illformedast_246229(n_266575);
					}
					LA23: ;
					switch ((*it).kind) {
					case ((NU8) 86):
					{
						Tnode191813* cond;
						Tnode191813* e;
						checksonslen_246249(it, ((NI) 2));
						cond = preparenode_266607(cl, (*it).kindU.S6.sons->data[((NI) 0)]);
						e = (*(*cl).c).semconstexpr((*cl).c, cond);
						{
							if (!!(((*e).kind == ((NU8) 6)))) goto LA28;
							internalerror_166199((*e).info, ((NimStringDesc*) &TMP2643));
						}
						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_246249(it, ((NI) 1));
						{
							if (!(branch == NIM_NIL)) goto LA39;
							branch = (*it).kindU.S6.sons->data[((NI) 0)];
						}
						LA39: ;
					}
					break;
					default:
					{
						illformedast_246229(n_266575);
					}
					break;
					}
					res_267335 += ((NI) 1);
				} LA20: ;
			}
		}
		{
			if (!!((branch == NIM_NIL))) goto LA44;
			result = replacetypevarsn_266571(cl, branch);
		}
		goto LA42;
		LA44: ;
		{
			result = newnodei_193351(((NU8) 138), (*n_266575).info);
		}
		LA42: ;
	}
	break;
	case ((NU8) 62):
	{
		Tnode191813* n;
		n = preparenode_266607(cl, n_266575);
		n = reresolvecallswithtypedescparams_266871(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_194403(n_266575);
		{
			if (!(((NI) 0) < length)) goto LA56;
			newsons_194272(result, length);
			{
				NI i_267327;
				NI HEX3Atmp_267340;
				NI res_267343;
				i_267327 = 0;
				HEX3Atmp_267340 = 0;
				HEX3Atmp_267340 = (NI)(length - ((NI) 1));
				res_267343 = ((NI) 0);
				{
					while (1) {
						if (!(res_267343 <= HEX3Atmp_267340)) goto LA60;
						i_267327 = res_267343;
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[i_267327]), replacetypevarsn_266571(cl, (*n_266575).kindU.S6.sons->data[i_267327]));
						res_267343 += ((NI) 1);
					} LA60: ;
				}
			}
		}
		LA56: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode191813*, replacetypesinbody_268617)(Tcontext245023* p, Tidtable191861 pt, Tnode191813* n) {
	Tnode191813* result;
	Trepltypevars266544 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_268602(p, pt, (*n).info, (&cl));
	pushinfocontext_165192((*n).info);
	result = replacetypevarsn_266571((&cl), n);
	popinfocontext_165211();
	return result;
}

N_NIMCALL(Ttype191849*, generatetypeinstance_268631)(Tcontext245023* p, Tidtable191861 pt, Tlineinfo164338 info, Ttype191849* t) {
	Ttype191849* result;
	Trepltypevars266544 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_268602(p, pt, info, (&cl));
	pushinfocontext_165192(info);
	result = replacetypevarst_266592((&cl), t);
	popinfocontext_165211();
	return result;
}

N_NIMCALL(NIM_BOOL, hasgenericarguments_266765)(Tnode191813* 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_266846;
			NI HEX3Atmp_266849;
			NI LOC11;
			NI res_266852;
			i_266846 = 0;
			HEX3Atmp_266849 = 0;
			LOC11 = 0;
			LOC11 = safelen_192125(n);
			HEX3Atmp_266849 = (LOC11 - 1);
			res_266852 = ((NI) 0);
			{
				while (1) {
					if (!(res_266852 <= HEX3Atmp_266849)) goto LA13;
					i_266846 = res_266852;
					{
						NIM_BOOL LOC16;
						LOC16 = 0;
						LOC16 = hasgenericarguments_266765((*n).kindU.S6.sons->data[i_266846]);
						if (!LOC16) goto LA17;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA17: ;
					res_266852 += ((NI) 1);
				} LA13: ;
			}
		}
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, checkconstructedtype_266110)(Tlineinfo164338 info, Ttype191849* typ) {
	Ttype191849* t;
	t = skiptypes_195167(typ, 8192);
	{
		if (!((*t).kind == ((NU8) 51) || (*t).kind == ((NU8) 54) || (*t).kind == ((NU8) 52) || (*t).kind == ((NU8) 53) || (*t).kind == ((NU8) 55) || (*t).kind == ((NU8) 56) || (*t).kind == ((NU8) 57) || (*t).kind == ((NU8) 58))) goto LA3;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		Ttype191849* LOC8;
		LOC6 = 0;
		LOC6 = (((*t).flags &(1<<((((NU8) 4))&31)))!=0);
		if (!(LOC6)) goto LA7;
		LOC8 = 0;
		LOC8 = skiptypes_195167(t, IL64(211106232576256));
		LOC6 = !(((*LOC8).kind == ((NU8) 17)));
		LA7: ;
		if (!LOC6) goto LA9;
		localerror_166155(info, ((NU16) 162), ((NimStringDesc*) &TMP2636));
	}
	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_166155(info, ((NU16) 197), ((NimStringDesc*) &TMP2637));
	}
	goto LA1;
	LA14: ;
	{
		NI64 LOC17;
		NimStringDesc* LOC20;
		LOC17 = 0;
		LOC17 = computesize_221184(t);
		if (!(LOC17 == IL64(-2))) goto LA18;
		LOC20 = 0;
		LOC20 = typetostring_221032(t, ((NU8) 0));
		localerror_166155(info, ((NU16) 123), LOC20);
	}
	goto LA1;
	LA18: ;
	{
		sharedptrcheck_266014(info, t);
	}
	LA1: ;
}
NIM_EXTERNC N_NOINLINE(void, nimsrc_semtypinstInit)(void) {
}

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

