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

#include "nimbase.h"
#include <string.h>
typedef struct Tnode215790 Tnode215790;
typedef struct Tcontext265020 Tcontext265020;
typedef struct Tidtable215840 Tidtable215840;
typedef struct Tidpairseq215838 Tidpairseq215838;
typedef struct Tsym215822 Tsym215822;
typedef struct Trepltypevars284531 Trepltypevars284531;
typedef struct Tlineinfo183337 Tlineinfo183337;
typedef struct Ttype215828 Ttype215828;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tident190012 Tident190012;
typedef struct Tnodeseq215784 Tnodeseq215784;
typedef struct Tidobj190006 Tidobj190006;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq215824 Ttypeseq215824;
typedef struct Tloc215804 Tloc215804;
typedef struct Ropeobj170006 Ropeobj170006;
typedef struct TY88687 TY88687;
typedef struct Tscope215816 Tscope215816;
typedef struct TY215925 TY215925;
typedef struct Tstrtable215794 Tstrtable215794;
typedef struct Tsymseq215792 Tsymseq215792;
typedef struct Tlib215808 Tlib215808;
typedef struct Cell47504 Cell47504;
typedef struct Cellseq47520 Cellseq47520;
typedef struct Gcheap49818 Gcheap49818;
typedef struct Gcstack49816 Gcstack49816;
typedef struct Cellset47516 Cellset47516;
typedef struct Pagedesc47512 Pagedesc47512;
typedef struct Memregion29687 Memregion29687;
typedef struct Smallchunk29639 Smallchunk29639;
typedef struct Llchunk29681 Llchunk29681;
typedef struct Bigchunk29641 Bigchunk29641;
typedef struct Intset29614 Intset29614;
typedef struct Trunk29610 Trunk29610;
typedef struct Avlnode29685 Avlnode29685;
typedef struct Gcstat49814 Gcstat49814;
typedef struct Tpasscontext262002 Tpasscontext262002;
typedef struct Tproccon265008 Tproccon265008;
typedef struct Intset212035 Intset212035;
typedef struct Trunk212031 Trunk212031;
typedef struct Trunkseq212033 Trunkseq212033;
typedef struct Tlinkedlist135016 Tlinkedlist135016;
typedef struct Tlistentry135010 Tlistentry135010;
typedef struct Tctx264036 Tctx264036;
typedef struct TY265140 TY265140;
typedef struct Tidpair215836 Tidpair215836;
typedef struct Tinstantiation215812 Tinstantiation215812;
typedef struct Basechunk29637 Basechunk29637;
typedef struct Freecell29629 Freecell29629;
typedef struct TY264242 TY264242;
typedef struct TY184093 TY184093;
typedef struct PprocHEX3Aobjecttype264221 PprocHEX3Aobjecttype264221;
typedef struct TY264261 TY264261;
typedef struct Tinstantiationpair265010 Tinstantiationpair265010;
typedef struct TY215913 TY215913;
typedef struct TY264222 TY264222;
typedef struct TY264227 TY264227;
typedef struct TY264262 TY264262;
typedef struct Vmargs264030 Vmargs264030;
typedef struct Tblock264018 Tblock264018;
typedef struct TY264202 TY264202;
struct  Tidtable215840  {
NI counter;
Tidpairseq215838* data;
};
struct  Tlineinfo183337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Trepltypevars284531  {
Tcontext265020* c;
Tidtable215840 typemap;
Tidtable215840 symmap;
Tidtable215840 localcache;
Tlineinfo183337 info;
NIM_BOOL allowmetatypes;
NIM_BOOL skiptypedesc;
Tsym215822* owner;
NI recursionlimit;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode215790  {
Ttype215828* typ;
Tlineinfo183337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym215822* sym;
} S4;
struct {Tident190012* ident;
} S5;
struct {Tnodeseq215784* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
typedef N_NIMCALL_PTR(void, TY3489) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3494) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3489 marker;
TY3494 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj190006  {
  TNimObject Sup;
NI id;
};
struct  Tloc215804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype215828* t;
Ropeobj170006* r;
Ropeobj170006* heaproot;
};
struct  Ttype215828  {
  Tidobj190006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq215824* sons;
Tnode215790* n;
Tsym215822* owner;
Tsym215822* sym;
Tsym215822* destructor;
Tsym215822* deepcopy;
Tsym215822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc215804 loc;
};
struct TY88687 {
NimStringDesc* Field0;
NI Field1;
};
struct  Tstrtable215794  {
NI counter;
Tsymseq215792* data;
};
struct  Tsym215822  {
  Tidobj190006 Sup;
NU8 kind;
union{
struct {Ttypeseq215824* typeinstcache;
Tscope215816* typscope;
} S1;
struct {TY215925* procinstcache;
Tsym215822* gcunsafetyreason;
} S2;
struct {TY215925* usedgenerics;
Tstrtable215794 tab;
} S3;
struct {Tsym215822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype215828* typ;
Tident190012* name;
Tlineinfo183337 info;
Tsym215822* owner;
NU32 flags;
Tnode215790* ast;
NU32 options;
NI position;
NI offset;
Tloc215804 loc;
Tlib215808* annex;
Tnode215790* constraint;
};
struct  Cell47504  {
NI refcount;
TNimType* typ;
};
struct  Cellseq47520  {
NI len;
NI cap;
Cell47504** d;
};
struct  Cellset47516  {
NI counter;
NI max;
Pagedesc47512* head;
Pagedesc47512** data;
};
typedef Smallchunk29639* TY29702[512];
typedef Trunk29610* Trunkbuckets29612[256];
struct  Intset29614  {
Trunkbuckets29612 data;
};
struct  Memregion29687  {
NI minlargeobj;
NI maxlargeobj;
TY29702 freesmallchunks;
Llchunk29681* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk29641* freechunkslist;
Intset29614 chunkstarts;
Avlnode29685* root;
Avlnode29685* deleted;
Avlnode29685* last;
Avlnode29685* freeavlnodes;
};
struct  Gcstat49814  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap49818  {
Gcstack49816* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq47520 zct;
Cellseq47520 decstack;
Cellset47516 cycleroots;
Cellseq47520 tempstack;
NI recgclock;
Memregion29687 region;
Gcstat49814 stat;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef Ttype215828* TY367877[1];
struct  Tpasscontext262002  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset212035  {
NI counter;
NI max;
Trunk212031* head;
Trunkseq212033* data;
};
struct  Tlinkedlist135016  {
Tlistentry135010* head;
Tlistentry135010* tail;
NI counter;
};
typedef N_NIMCALL_PTR(Tnode215790*, TY265071) (Tcontext265020* c, Tnode215790* n);
typedef N_NIMCALL_PTR(Tnode215790*, TY265076) (Tcontext265020* c, Tnode215790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode215790*, TY265084) (Tcontext265020* c, Tnode215790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode215790*, TY265092) (Tcontext265020* c, Tnode215790* n);
typedef N_NIMCALL_PTR(Tnode215790*, TY265097) (Tcontext265020* c, Tnode215790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode215790*, TY265105) (Tcontext265020* c, Tnode215790* n);
typedef N_NIMCALL_PTR(Tnode215790*, TY265110) (Tcontext265020* c, Tnode215790* n, Tnode215790* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype215828*, TY265117) (Tcontext265020* c, Tnode215790* n, Ttype215828* prev);
typedef struct {
N_NIMCALL_PTR(Tnode215790*, ClPrc) (Tcontext265020* c, Tidtable215840 pt, Tnode215790* n, void* ClEnv);
void* ClEnv;
} TY265123;
typedef struct {
N_NIMCALL_PTR(Tsym215822*, ClPrc) (Tcontext265020* c, Tsym215822* fn, Tidtable215840 pt, Tlineinfo183337 info, void* ClEnv);
void* ClEnv;
} TY265129;
typedef N_NIMCALL_PTR(Tsym215822*, TY265145) (Tcontext265020* c, Tsym215822* dc, Ttype215828* t, Tlineinfo183337 info, NU8 op);
struct  Tcontext265020  {
  Tpasscontext262002 Sup;
Tsym215822* module;
Tscope215816* currentscope;
Tscope215816* importtable;
Tscope215816* toplevelscope;
Tproccon265008* p;
Tsymseq215792* friendmodules;
NI instcounter;
Intset212035 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq215792* converters;
Tsymseq215792* patterns;
Tlinkedlist135016 optionstack;
Tidtable215840 symmapping;
Tlinkedlist135016 libs;
TY265071 semconstexpr;
TY265076 semexpr;
TY265084 semtryexpr;
TY265092 semtryconstexpr;
TY265097 semoperand;
TY265105 semconstboolexpr;
TY265110 semoverloadedcall;
TY265117 semtypenode;
TY265123 seminferredlambda;
TY265129 semgenerateinstance;
Intset212035 includedfiles;
Tstrtable215794 userpragmas;
Tctx264036* evalcontext;
Intset212035 unknownidents;
TY265140* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY265145 insttypeboundop;
};
struct  Tidpair215836  {
Tidobj190006* key;
TNimObject* val;
};
struct  Tident190012  {
  Tidobj190006 Sup;
NimStringDesc* s;
Tident190012* next;
NI h;
};
struct  Ropeobj170006  {
  TNimObject Sup;
Ropeobj170006* left;
Ropeobj170006* right;
NI length;
NimStringDesc* data;
};
struct  Tscope215816  {
NI depthlevel;
Tstrtable215794 symbols;
Tnodeseq215784* usingsyms;
Tscope215816* parent;
};
struct  Tlistentry135010  {
  TNimObject Sup;
Tlistentry135010* prev;
Tlistentry135010* next;
};
struct  Tlib215808  {
  Tlistentry135010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj170006* name;
Tnode215790* path;
};
struct  Gcstack49816  {
Gcstack49816* prev;
Gcstack49816* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY29618[16];
struct  Pagedesc47512  {
Pagedesc47512* next;
NI key;
TY29618 bits;
};
struct  Basechunk29637  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk29639  {
  Basechunk29637 Sup;
Smallchunk29639* next;
Smallchunk29639* prev;
Freecell29629* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk29681  {
NI size;
NI acc;
Llchunk29681* next;
};
struct  Bigchunk29641  {
  Basechunk29637 Sup;
Bigchunk29641* next;
Bigchunk29641* prev;
NI align;
NF data;
};
struct  Trunk29610  {
Trunk29610* next;
NI key;
TY29618 bits;
};
typedef Avlnode29685* TY29692[2];
struct  Avlnode29685  {
TY29692 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon265008  {
Tsym215822* owner;
Tsym215822* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon265008* next;
NIM_BOOL wasforwarded;
Tnode215790* bracketexpr;
};
struct  Trunk212031  {
Trunk212031* next;
NI key;
TY29618 bits;
};
struct  Tctx264036  {
  Tpasscontext262002 Sup;
TY264242* code;
TY184093* debug;
Tnode215790* globals;
Tnode215790* constants;
Ttypeseq215824* types;
Tnode215790* currentexceptiona;
Tnode215790* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype264221* prc;
Tsym215822* module;
Tnode215790* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo183337 comesfromheuristic;
TY264261* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair265010  {
Tsym215822* genericsym;
Tinstantiation215812* inst;
};
struct  Tinstantiation215812  {
Tsym215822* sym;
Ttypeseq215824* concretetypes;
TY215913* usedby;
NI compilesid;
};
struct  Freecell29629  {
Freecell29629* next;
NI zerofield;
};
struct TY264227 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY264227 TY264230[256];
struct  PprocHEX3Aobjecttype264221  {
TY264222* blocks;
Tsym215822* sym;
TY264230 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs264030* args, void* ClEnv);
void* ClEnv;
} Vmcallback264032;
struct TY264262 {
NimStringDesc* Field0;
Vmcallback264032 Field1;
};
struct  Tblock264018  {
Tsym215822* label;
TY264202* fixups;
};
struct  Vmargs264030  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode215790* currentexception;
};
struct Ttypeseq215824 {
  TGenericSeq Sup;
  Ttype215828* data[SEQ_DECL_SIZE];
};
struct Tnodeseq215784 {
  TGenericSeq Sup;
  Tnode215790* data[SEQ_DECL_SIZE];
};
struct Tidpairseq215838 {
  TGenericSeq Sup;
  Tidpair215836 data[SEQ_DECL_SIZE];
};
struct TY215925 {
  TGenericSeq Sup;
  Tinstantiation215812* data[SEQ_DECL_SIZE];
};
struct Tsymseq215792 {
  TGenericSeq Sup;
  Tsym215822* data[SEQ_DECL_SIZE];
};
struct Trunkseq212033 {
  TGenericSeq Sup;
  Trunk212031* data[SEQ_DECL_SIZE];
};
struct TY265140 {
  TGenericSeq Sup;
  Tinstantiationpair265010 data[SEQ_DECL_SIZE];
};
struct TY264242 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY184093 {
  TGenericSeq Sup;
  Tlineinfo183337 data[SEQ_DECL_SIZE];
};
struct TY264261 {
  TGenericSeq Sup;
  TY264262 data[SEQ_DECL_SIZE];
};
struct TY215913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY264222 {
  TGenericSeq Sup;
  Tblock264018 data[SEQ_DECL_SIZE];
};
struct TY264202 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, inittypevars_286420)(Tcontext265020* p, Tidtable215840 pt, Tlineinfo183337 info, Tsym215822* owner, Trepltypevars284531* Result);
N_NIMCALL(void, initidtable_219033)(Tidtable215840* x);
N_NIMCALL(void, copyidtable_217066)(Tidtable215840* dest, Tidtable215840 src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, pushinfocontext_184209)(Tlineinfo183337 info);
N_NIMCALL(Tnode215790*, replacetypevarsn_284551)(Trepltypevars284531* cl, Tnode215790* n_284555);
N_NIMCALL(Tnode215790*, copynode_219542)(Tnode215790* src);
N_NIMCALL(Ttype215828*, replacetypevarst_284566)(Trepltypevars284531* cl, Ttype215828* t);
N_NIMCALL(Ttype215828*, replacetypevarstaux_284541)(Trepltypevars284531* cl, Ttype215828* t);
N_NIMCALL(TNimObject*, idtableget_222107)(Tidtable215840 t, Tidobj190006* key);
N_NIMCALL(Ttype215828*, handlegenericinvocation_285316)(Trepltypevars284531* cl, Ttype215828* t);
N_NIMCALL(void, internalerror_188100)(Tlineinfo183337 info, NimStringDesc* errmsg);
N_NIMCALL(Ttype215828*, searchinsttypes_284201)(Ttype215828* key);
N_NIMCALL(void, internalerror_188113)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_188183)(TY88687 x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_249927)(Ttypeseq215824* x, Ttypeseq215824* y);
N_NIMCALL(NIM_BOOL, comparetypes_247404)(Ttype215828* x, Ttype215828* y, NU8 cmp, NU8 flags);
N_NIMCALL(NI, sonslen_218327)(Ttype215828* n);
N_NIMCALL(Ttype215828*, lookuptypevar_285217)(Trepltypevars284531* cl, Ttype215828* t);
N_NIMCALL(void, localerror_188080)(Tlineinfo183337 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, typetostring_241017)(Ttype215828* typ, NU8 prefer);
N_NIMCALL(Ttype215828*, errortype_265901)(Tcontext265020* c);
N_NIMCALL(void, idtableput_222115)(Tidtable215840* t, Tidobj190006* key, TNimObject* val);
N_NIMCALL(Ttype215828*, instcopytype_285256)(Trepltypevars284531* cl, Ttype215828* t);
N_NIMCALL(Ttype215828*, copytype_218470)(Ttype215828* t, Tsym215822* owner, NIM_BOOL keepid);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell47504*, usrtocell_51440)(void* usr);
static N_INLINE(void, rtladdzct_53001)(Cell47504* c);
N_NOINLINE(void, addzct_51417)(Cellseq47520* s, Cell47504* c);
N_NIMCALL(void, propagatetoowner_219190)(Ttype215828* owner, Ttype215828* elem);
N_NIMCALL(Ttype215828*, newtype_218107)(NU8 kind, Tsym215822* owner);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(void, cachetypeinst_284446)(Ttype215828* inst);
N_NIMCALL(Ttype215828*, lastson_218377)(Ttype215828* n);
N_NIMCALL(void, safeadd_284485)(Ttypeseq215824** x, Ttype215828* y);
N_NIMCALL(void, rawaddson_219408)(Ttype215828* father, Ttype215828* son);
N_NIMCALL(NIM_BOOL, isgenericalias_246584)(Ttype215828* t);
N_NIMCALL(Ttype215828*, skipgenericalias_246606)(Ttype215828* t);
N_NIMCALL(void, checkpartialconstructedtype_284048)(Tlineinfo183337 info, Ttype215828* t);
N_NIMCALL(Ttype215828*, skiptypes_219113)(Ttype215828* t, NU64 kinds);
N_NIMCALL(void, sharedptrcheck_284005)(Tlineinfo183337 info, Ttype215828* t);
N_NIMCALL(NI, len_218339)(Ttype215828* n);
static N_INLINE(NIM_BOOL, isgcedmem_219157)(Ttype215828* t);
N_NIMCALL(Tnode215790*, preparenode_284601)(Trepltypevars284531* cl, Tnode215790* n);
N_NIMCALL(Tsym215822*, replacetypevarss_284546)(Trepltypevars284531* cl, Tsym215822* s);
N_NIMCALL(Tsym215822*, copysym_218601)(Tsym215822* s, NIM_BOOL keepid);
static N_INLINE(NI, safelen_216081)(Tnode215790* n);
N_NIMCALL(void, add_216114)(Tnode215790* father, Tnode215790* son);
static N_INLINE(Tnode215790*, HEX5BHEX5D_216238)(Tnode215790* n, NI i);
N_NIMCALL(Ttype215828*, newtypes_265185)(NU8 kind, Tcontext265020* c);
static N_INLINE(Ttype215828*, skipintlit_259651)(Ttype215828* t);
N_NIMCALL(Ttype215828*, getsystype_259130)(NU8 kind);
N_NIMCALL(Ttype215828*, base_241021)(Ttype215828* t);
N_NIMCALL(Ttype215828*, maketypedesc_265524)(Tcontext265020* c, Ttype215828* typ);
N_NIMCALL(NIM_BOOL, containsgenerictype_249492)(Ttype215828* t);
N_NIMCALL(void, propagatefieldflags_285955)(Ttype215828* t, Tnode215790* n);
static N_INLINE(NI, len_216059)(Tnode215790* n);
N_NIMCALL(void, erasevoidparams_285748)(Ttype215828* t);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, skipintliteralparams_285876)(Ttype215828* t);
N_NIMCALL(Tnode215790*, newnode_217601)(NU8 kind, Tlineinfo183337 info, Tnodeseq215784* sons, Ttype215828* typ);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(NI, sonslen_218351)(Tnode215790* n);
N_NIMCALL(void, illformedast_265950)(Tnode215790* n);
N_NIMCALL(void, checksonslen_265958)(Tnode215790* n, NI length);
N_NIMCALL(Tnode215790*, newnodei_217248)(NU8 kind, Tlineinfo183337 info);
N_NIMCALL(Tnode215790*, reresolvecallswithtypedescparams_284827)(Trepltypevars284531* cl, Tnode215790* n);
N_NIMCALL(NIM_BOOL, istypeparam_284692)(Tnode215790* n);
N_NIMCALL(Tnode215790*, newsymnode_217234)(Tsym215822* sym);
N_NIMCALL(void, newsons_218260)(Tnode215790* father, NI length);
N_NIMCALL(void, popinfocontext_184222)(void);
N_NIMCALL(NIM_BOOL, hasgenericarguments_284737)(Tnode215790* n);
N_NIMCALL(NI64, computesize_241121)(Ttype215828* typ);
STRING_LITERAL(TMP2778, "no generic body", 15);
STRING_LITERAL(TMP2780, "compiler/semtypinst.nim", 23);
NIM_CONST TY88687 TMP2779 = {((NimStringDesc*) &TMP2780),
((NI) 52)}
;
STRING_LITERAL(TMP2785, "substitution with generic parameter", 35);
STRING_LITERAL(TMP2786, "acyclic", 7);
STRING_LITERAL(TMP2787, "", 0);
STRING_LITERAL(TMP2788, "shared memory may not refer to GC\'ed thread local memory", 56);
NIM_CONST TY88687 TMP2791 = {((NimStringDesc*) &TMP2780),
((NI) 477)}
;
NIM_CONST TY88687 TMP2792 = {((NimStringDesc*) &TMP2780),
((NI) 367)}
;
STRING_LITERAL(TMP2793, "ReplaceTypeVarsN: when condition not a bool", 43);
extern Gcheap49818 gch_49859;
extern TNimType NTI215824; /* TTypeSeq */
extern TNimType NTI215784; /* TNodeSeq */

N_NIMCALL(void, inittypevars_286420)(Tcontext265020* p, Tidtable215840 pt, Tlineinfo183337 info, Tsym215822* owner, Trepltypevars284531* Result) {
	initidtable_219033((&(*Result).symmap));
	copyidtable_217066((&(*Result).typemap), pt);
	initidtable_219033((&(*Result).localcache));
	(*Result).info = info;
	unsureAsgnRef((void**) (&(*Result).c), p);
	unsureAsgnRef((void**) (&(*Result).owner), owner);
}

N_NIMCALL(Ttype215828*, searchinsttypes_284201)(Ttype215828* key) {
	Ttype215828* result;
	Ttype215828* 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_188183(TMP2779);
		internalerror_188113(LOC9);
	}
	LA7: ;
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = HEX3DHEX3D_249927((*(*generictyp).sym).kindU.S1.typeinstcache, NIM_NIL);
		if (!LOC12) goto LA13;
		goto BeforeRet;
	}
	LA13: ;
	{
		Ttype215828* inst_284402;
		Ttypeseq215824* HEX3Atmp_284440;
		NI i_284443;
		NI L_284445;
		inst_284402 = 0;
		HEX3Atmp_284440 = 0;
		HEX3Atmp_284440 = (*(*generictyp).sym).kindU.S1.typeinstcache;
		i_284443 = ((NI) 0);
		L_284445 = (HEX3Atmp_284440 ? HEX3Atmp_284440->Sup.len : 0);
		{
			while (1) {
				if (!(i_284443 < L_284445)) goto LA17;
				inst_284402 = HEX3Atmp_284440->data[i_284443];
				{
					if (!((*inst_284402).Sup.id == (*key).Sup.id)) goto LA20;
					result = inst_284402;
					goto BeforeRet;
				}
				LA20: ;
				{
					if (!(((*inst_284402).sons ? (*inst_284402).sons->Sup.len : 0) < ((*key).sons ? (*key).sons->Sup.len : 0))) goto LA24;
					goto BeforeRet;
				}
				LA24: ;
				{
					{
						NI j_284429;
						NI HEX3Atmp_284433;
						NI res_284436;
						j_284429 = 0;
						HEX3Atmp_284433 = 0;
						HEX3Atmp_284433 = ((*key).sons ? ((*key).sons->Sup.len-1) : -1);
						res_284436 = ((NI) 1);
						{
							while (1) {
								if (!(res_284436 <= HEX3Atmp_284433)) goto LA29;
								j_284429 = res_284436;
								{
									NIM_BOOL LOC32;
									LOC32 = 0;
									LOC32 = comparetypes_247404((*inst_284402).sons->data[j_284429], (*key).sons->data[j_284429], ((NU8) 0), 8);
									if (!!(LOC32)) goto LA33;
									goto LA26;
								}
								LA33: ;
								res_284436 += ((NI) 1);
							} LA29: ;
						}
					}
					result = inst_284402;
					goto BeforeRet;
				} LA26: ;
				i_284443 += ((NI) 1);
			} LA17: ;
		}
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype215828*, lookuptypevar_285217)(Trepltypevars284531* cl, Ttype215828* t) {
	Ttype215828* result;
	Tidobj190006* LOC1;
	TNimObject* LOC2;
{	result = 0;
	LOC1 = 0;
	LOC1 = &t->Sup;
	LOC2 = 0;
	LOC2 = idtableget_222107((*cl).typemap, LOC1);
	result = ((Ttype215828*) (LOC2));
	{
		NimStringDesc* LOC13;
		Tidobj190006* LOC14;
		TNimObject* LOC15;
		if (!(result == NIM_NIL)) goto LA5;
		{
			NIM_BOOL LOC9;
			LOC9 = 0;
			LOC9 = (*cl).allowmetatypes;
			if (LOC9) goto LA10;
			LOC9 = (((*t).flags &(1U<<((NU)(((NU8) 10))&31U)))!=0);
			LA10: ;
			if (!LOC9) goto LA11;
			goto BeforeRet;
		}
		LA11: ;
		LOC13 = 0;
		LOC13 = typetostring_241017(t, ((NU8) 0));
		localerror_188080((*(*t).sym).info, ((NU16) 128), LOC13);
		result = errortype_265901((*cl).c);
		LOC14 = 0;
		LOC14 = &t->Sup;
		LOC15 = 0;
		LOC15 = &result->Sup.Sup;
		idtableput_222115((&(*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_188100((*cl).info, ((NimStringDesc*) &TMP2785));
	}
	goto LA3;
	LA19: ;
	LA3: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype215828*, instcopytype_285256)(Trepltypevars284531* cl, Ttype215828* t) {
	Ttype215828* result;
	result = 0;
	result = copytype_218470(t, (*t).owner, (*cl).allowmetatypes);
	(*result).flags |= ((NU32)1)<<((((NU8) 8))%(sizeof(NU32)*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(Cell47504*, usrtocell_51440)(void* usr) {
	Cell47504* result;
	result = 0;
	result = ((Cell47504*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(Cell47504))))));
	return result;
}

static N_INLINE(void, rtladdzct_53001)(Cell47504* c) {
	addzct_51417((&gch_49859.zct), c);
}

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

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

N_NIMCALL(void, cachetypeinst_284446)(Ttype215828* inst) {
	Ttype215828* gt;
	Ttype215828* t;
{	gt = (*inst).sons->data[((NI) 0)];
	{
		if (!((*gt).kind == ((NU8) 10))) goto LA3;
		t = lastson_218377(gt);
	}
	goto LA1;
	LA3: ;
	{
		t = gt;
	}
	LA1: ;
	{
		if (!((*t).kind == ((NU8) 12) || (*t).kind >= ((NU8) 51) && (*t).kind <= ((NU8) 59))) goto LA8;
		goto BeforeRet;
	}
	LA8: ;
	safeadd_284485((&(*(*gt).sym).kindU.S1.typeinstcache), inst);
	}BeforeRet: ;
}

static N_INLINE(NIM_BOOL, isgcedmem_219157)(Ttype215828* 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_284005)(Tlineinfo183337 info, Ttype215828* t) {
	{
		NIM_BOOL LOC3;
		NI LOC5;
		LOC3 = 0;
		LOC3 = ((*t).kind == ((NU8) 21));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = len_218339(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 &(1U<<((NU)(((NU8) 20))&31U)))!=0);
				if (LOC14) goto LA15;
				LOC14 = isgcedmem_219157(t);
				LA15: ;
				if (!LOC14) goto LA16;
				localerror_188080(info, ((NU16) 4), ((NimStringDesc*) &TMP2788));
			}
			LA16: ;
		}
		LA10: ;
	}
	LA6: ;
}

N_NIMCALL(void, checkpartialconstructedtype_284048)(Tlineinfo183337 info, Ttype215828* t) {
	{
		NIM_BOOL LOC3;
		Ttype215828* LOC5;
		LOC3 = 0;
		LOC3 = (((*t).flags &(1U<<((NU)(((NU8) 4))&31U)))!=0);
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = skiptypes_219113(t, IL64(211106232576256));
		LOC3 = !(((*LOC5).kind == ((NU8) 17)));
		LA4: ;
		if (!LOC3) goto LA6;
		localerror_188080(info, ((NU16) 166), ((NimStringDesc*) &TMP2786));
	}
	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_188080(info, ((NU16) 202), ((NimStringDesc*) &TMP2787));
	}
	goto LA1;
	LA11: ;
	{
		sharedptrcheck_284005(info, t);
	}
	LA1: ;
}

N_NIMCALL(Ttype215828*, handlegenericinvocation_285316)(Trepltypevars284531* cl, Ttype215828* t) {
	Ttype215828* result;
	Ttype215828* body;
	Ttype215828* header;
	TY367877 LOC46;
	NIM_BOOL oldskiptypedesc;
	Ttype215828* newbody;
	Ttype215828* LOC64;
	Tsym215822* dc;
	Tsym215822* asgn;
{	result = 0;
	body = (*t).sons->data[((NI) 0)];
	{
		if (!!(((*body).kind == ((NU8) 10)))) goto LA3;
		internalerror_188100((*cl).info, ((NimStringDesc*) &TMP2778));
	}
	LA3: ;
	header = t;
	{
		Tidobj190006* LOC9;
		TNimObject* LOC10;
		if (!(*cl).allowmetatypes) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_222107((*cl).localcache, LOC9);
		result = ((Ttype215828*) (LOC10));
	}
	goto LA5;
	LA7: ;
	{
		result = searchinsttypes_284201(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_285391;
		NI HEX3Atmp_285725;
		NI LOC19;
		NI res_285728;
		i_285391 = 0;
		HEX3Atmp_285725 = 0;
		LOC19 = 0;
		LOC19 = sonslen_218327(t);
		HEX3Atmp_285725 = (NI)(LOC19 - ((NI) 1));
		res_285728 = ((NI) 1);
		{
			while (1) {
				Ttype215828* x;
				if (!(res_285728 <= HEX3Atmp_285725)) goto LA21;
				i_285391 = res_285728;
				x = (*t).sons->data[i_285391];
				{
					if (!((*x).kind == ((NU8) 12))) goto LA24;
					x = lookuptypevar_285217(cl, x);
					{
						if (!!((x == NIM_NIL))) goto LA28;
						{
							if (!(header == t)) goto LA32;
							header = instcopytype_285256(cl, t);
						}
						LA32: ;
						asgnRefNoCycle((void**) (&(*header).sons->data[i_285391]), x);
						propagatetoowner_219190(header, x);
					}
					LA28: ;
				}
				goto LA22;
				LA24: ;
				{
					propagatetoowner_219190(header, x);
				}
				LA22: ;
				res_285728 += ((NI) 1);
			} LA21: ;
		}
	}
	{
		if (!!((header == t))) goto LA37;
		result = searchinsttypes_284201(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_285256(cl, t);
	}
	LA35: ;
	result = newtype_218107(((NU8) 11), (*(*t).sons->data[((NI) 0)]).owner);
	(*result).flags = (*header).flags;
	if ((*result).sons) nimGCunrefNoCycle((*result).sons);
	(*result).sons = (Ttypeseq215824*) newSeqRC1((&NTI215824), 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_284446(result);
	}
	goto LA47;
	LA49: ;
	{
		Tidobj190006* LOC52;
		TNimObject* LOC53;
		LOC52 = 0;
		LOC52 = &t->Sup;
		LOC53 = 0;
		LOC53 = &result->Sup.Sup;
		idtableput_222115((&(*cl).localcache), LOC52, LOC53);
	}
	LA47: ;
	oldskiptypedesc = (*cl).skiptypedesc;
	(*cl).skiptypedesc = NIM_TRUE;
	{
		NI i_285509;
		NI HEX3Atmp_285733;
		NI LOC55;
		NI res_285736;
		i_285509 = 0;
		HEX3Atmp_285733 = 0;
		LOC55 = 0;
		LOC55 = sonslen_218327(t);
		HEX3Atmp_285733 = (NI)(LOC55 - ((NI) 1));
		res_285736 = ((NI) 1);
		{
			while (1) {
				Ttype215828* x;
				Tidobj190006* LOC58;
				TNimObject* LOC59;
				if (!(res_285736 <= HEX3Atmp_285733)) goto LA57;
				i_285509 = res_285736;
				x = replacetypevarst_284566(cl, (*t).sons->data[i_285509]);
				asgnRefNoCycle((void**) (&(*header).sons->data[i_285509]), x);
				propagatetoowner_219190(header, x);
				LOC58 = 0;
				LOC58 = &(*body).sons->data[(NI)(i_285509 - ((NI) 1))]->Sup;
				LOC59 = 0;
				LOC59 = &x->Sup.Sup;
				idtableput_222115((&(*cl).typemap), LOC58, LOC59);
				res_285736 += ((NI) 1);
			} LA57: ;
		}
	}
	{
		NI i_285613;
		NI HEX3Atmp_285741;
		NI LOC61;
		NI res_285744;
		i_285613 = 0;
		HEX3Atmp_285741 = 0;
		LOC61 = 0;
		LOC61 = sonslen_218327(t);
		HEX3Atmp_285741 = (NI)(LOC61 - ((NI) 1));
		res_285744 = ((NI) 1);
		{
			while (1) {
				if (!(res_285744 <= HEX3Atmp_285741)) goto LA63;
				i_285613 = res_285744;
				rawaddson_219408(result, (*header).sons->data[i_285613]);
				res_285744 += ((NI) 1);
			} LA63: ;
		}
	}
	LOC64 = 0;
	LOC64 = lastson_218377(body);
	newbody = replacetypevarst_284566(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_246584(newbody);
		if (!LOC67) goto LA68;
		newbody = skipgenericalias_246606(newbody);
	}
	LA68: ;
	rawaddson_219408(result, newbody);
	checkpartialconstructedtype_284048((*cl).info, newbody);
	dc = (*newbody).deepcopy;
	{
		NIM_BOOL LOC72;
		LOC72 = 0;
		LOC72 = !((dc == NIM_NIL));
		if (!(LOC72)) goto LA73;
		LOC72 = !((((*(*newbody).deepcopy).flags &(1U<<((NU)(((NU8) 2))&31U)))!=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 &(1U<<((NU)(((NU8) 2))&31U)))!=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(Tsym215822*, replacetypevarss_284546)(Trepltypevars284531* cl, Tsym215822* s) {
	Tsym215822* result;
	Tidobj190006* 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_222107((*cl).symmap, LOC11);
	result = ((Tsym215822*) (LOC12));
	{
		Tidobj190006* LOC17;
		TNimObject* LOC18;
		if (!(result == NIM_NIL)) goto LA15;
		result = copysym_218601(s, NIM_FALSE);
		(*result).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
		LOC17 = 0;
		LOC17 = &s->Sup;
		LOC18 = 0;
		LOC18 = &result->Sup.Sup;
		idtableput_222115((&(*cl).symmap), LOC17, LOC18);
		asgnRefNoCycle((void**) (&(*result).owner), (*s).owner);
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_284566(cl, (*s).typ));
		asgnRefNoCycle((void**) (&(*result).ast), replacetypevarsn_284551(cl, (*s).ast));
	}
	LA15: ;
	}BeforeRet: ;
	return result;
}

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

N_NIMCALL(Tnode215790*, preparenode_284601)(Trepltypevars284531* cl, Tnode215790* n) {
	Tnode215790* result;
	Ttype215828* t;
	NIM_BOOL iscall;
{	result = 0;
	t = replacetypevarst_284566(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_219542(n);
	asgnRefNoCycle((void**) (&(*result).typ), t);
	{
		if (!((*result).kind == ((NU8) 3))) goto LA11;
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_284546(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_284681;
		NI HEX3Atmp_284685;
		NI LOC14;
		NI res_284688;
		i_284681 = 0;
		HEX3Atmp_284685 = 0;
		LOC14 = 0;
		LOC14 = safelen_216081(n);
		HEX3Atmp_284685 = (LOC14 - 1);
		res_284688 = ((NI) 0);
		{
			while (1) {
				if (!(res_284688 <= HEX3Atmp_284685)) goto LA16;
				i_284681 = res_284688;
				{
					NIM_BOOL LOC19;
					Tnode215790* LOC23;
					LOC19 = 0;
					LOC19 = iscall;
					if (!(LOC19)) goto LA20;
					LOC19 = (i_284681 == ((NI) 0));
					LA20: ;
					if (!LOC19) goto LA21;
					LOC23 = 0;
					LOC23 = HEX5BHEX5D_216238(n, i_284681);
					add_216114(result, LOC23);
				}
				goto LA17;
				LA21: ;
				{
					Tnode215790* LOC25;
					Tnode215790* LOC26;
					LOC25 = 0;
					LOC25 = HEX5BHEX5D_216238(n, i_284681);
					LOC26 = 0;
					LOC26 = preparenode_284601(cl, LOC25);
					add_216114(result, LOC26);
				}
				LA17: ;
				res_284688 += ((NI) 1);
			} LA16: ;
		}
	}
	}BeforeRet: ;
	return result;
}

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

static N_INLINE(NI, len_216059)(Tnode215790* 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_285955)(Ttype215828* t, Tnode215790* n) {
{	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		NimStringDesc* LOC9;
		if (!!(!(((*n).kind == ((NU8) 140))))) goto LA7;
		LOC9 = 0;
		LOC9 = HEX24_188183(TMP2792);
		internalerror_188113(LOC9);
	}
	LA7: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		propagatetoowner_219190(t, (*(*n).kindU.S4.sym).typ);
	}
	break;
	case ((NU8) 138):
	case ((NU8) 139):
	case ((NU8) 85):
	case ((NU8) 88):
	{
		{
			Tnode215790* son_285986;
			son_285986 = 0;
			{
				NI i_285991;
				NI HEX3Atmp_285993;
				NI LOC14;
				NI res_285995;
				i_285991 = 0;
				HEX3Atmp_285993 = 0;
				LOC14 = 0;
				LOC14 = len_216059(n);
				HEX3Atmp_285993 = (LOC14 - 1);
				res_285995 = ((NI) 0);
				{
					while (1) {
						if (!(res_285995 <= HEX3Atmp_285993)) goto LA16;
						i_285991 = res_285995;
						son_285986 = (*n).kindU.S6.sons->data[i_285991];
						propagatefieldflags_285955(t, son_285986);
						res_285995 += ((NI) 1);
					} LA16: ;
				}
			}
		}
	}
	break;
	default:
	{
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, erasevoidparams_285748)(Ttype215828* 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_285789;
		NI HEX3Atmp_285869;
		NI LOC8;
		NI res_285872;
		i_285789 = 0;
		HEX3Atmp_285869 = 0;
		LOC8 = 0;
		LOC8 = sonslen_218327(t);
		HEX3Atmp_285869 = (LOC8 - 1);
		res_285872 = ((NI) 1);
		{
			while (1) {
				if (!(res_285872 <= HEX3Atmp_285869)) goto LA10;
				i_285789 = res_285872;
				{
					NI pos;
					if (!((*(*t).sons->data[i_285789]).kind == ((NU8) 3))) goto LA13;
					pos = i_285789;
					{
						NI j_285817;
						NI HEX3Atmp_285861;
						NI HEX3Atmp_285862;
						NI LOC16;
						NI res_285865;
						j_285817 = 0;
						HEX3Atmp_285861 = 0;
						HEX3Atmp_285862 = 0;
						HEX3Atmp_285861 = (NI)(i_285789 + ((NI) 1));
						LOC16 = 0;
						LOC16 = sonslen_218327(t);
						HEX3Atmp_285862 = (LOC16 - 1);
						res_285865 = HEX3Atmp_285861;
						{
							while (1) {
								if (!(res_285865 <= HEX3Atmp_285862)) goto LA18;
								j_285817 = res_285865;
								{
									if (!!(((*(*t).sons->data[j_285817]).kind == ((NU8) 3)))) goto LA21;
									asgnRefNoCycle((void**) (&(*t).sons->data[pos]), (*t).sons->data[j_285817]);
									asgnRefNoCycle((void**) (&(*(*t).n).kindU.S6.sons->data[pos]), (*(*t).n).kindU.S6.sons->data[j_285817]);
									pos += ((NI) 1);
								}
								LA21: ;
								res_285865 += ((NI) 1);
							} LA18: ;
						}
					}
					(*t).sons = (Ttypeseq215824*) setLengthSeq(&((*t).sons)->Sup, sizeof(Ttype215828*), ((NI) (pos)));
					(*(*t).n).kindU.S6.sons = (Tnodeseq215784*) setLengthSeq(&((*(*t).n).kindU.S6.sons)->Sup, sizeof(Tnode215790*), ((NI) (pos)));
					goto BeforeRet;
				}
				LA13: ;
				res_285872 += ((NI) 1);
			} LA10: ;
		}
	}
	}BeforeRet: ;
}

N_NIMCALL(void, skipintliteralparams_285876)(Ttype215828* t) {
	{
		NI i_285896;
		NI HEX3Atmp_285948;
		NI LOC2;
		NI res_285951;
		i_285896 = 0;
		HEX3Atmp_285948 = 0;
		LOC2 = 0;
		LOC2 = sonslen_218327(t);
		HEX3Atmp_285948 = (LOC2 - 1);
		res_285951 = ((NI) 0);
		{
			while (1) {
				if (!(res_285951 <= HEX3Atmp_285948)) goto LA4;
				i_285896 = res_285951;
				{
					Ttype215828* p;
					Ttype215828* skipped;
					p = (*t).sons->data[i_285896];
					{
						if (!(p == NIM_NIL)) goto LA8;
						goto LA5;
					}
					LA8: ;
					skipped = skipintlit_259651(p);
					{
						if (!!((skipped == p))) goto LA12;
						asgnRefNoCycle((void**) (&(*t).sons->data[i_285896]), skipped);
						{
							if (!(((NI) 0) < i_285896)) goto LA16;
							asgnRefNoCycle((void**) (&(*(*(*(*t).n).kindU.S6.sons->data[i_285896]).kindU.S4.sym).typ), skipped);
						}
						LA16: ;
					}
					LA12: ;
				} LA5: ;
				res_285951 += ((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_241021((*t).sons->data[((NI) 0)]));
	}
	LA22: ;
}

N_NIMCALL(Ttype215828*, replacetypevarstaux_284541)(Trepltypevars284531* cl, Ttype215828* t) {
	Ttype215828* result;
{	result = 0;
	result = t;
	{
		if (!(t == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		Ttype215828* lookup;
		Tidobj190006* LOC9;
		TNimObject* LOC10;
		if (!((*t).kind == ((NU8) 12) || (*t).kind >= ((NU8) 51) && (*t).kind <= ((NU8) 59))) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_222107((*cl).typemap, LOC9);
		lookup = ((Ttype215828*) (LOC10));
		{
			if (!!((lookup == NIM_NIL))) goto LA13;
			result = lookup;
			goto BeforeRet;
		}
		LA13: ;
	}
	LA7: ;
	switch ((*t).kind) {
	case ((NU8) 9):
	{
		result = handlegenericinvocation_285316(cl, t);
	}
	break;
	case ((NU8) 10):
	{
		NimStringDesc* LOC17;
		LOC17 = 0;
		LOC17 = typetostring_241017(t, ((NU8) 0));
		localerror_188080((*cl).info, ((NU16) 128), LOC17);
		result = errortype_265901((*cl).c);
	}
	break;
	case ((NU8) 60):
	{
		Tnode215790* n;
		{
			if (!(*cl).allowmetatypes) goto LA21;
			goto BeforeRet;
		}
		LA21: ;
		n = preparenode_284601(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_219113((*n).typ, 256);
		}
		goto LA27;
		LA29: ;
		{
			{
				TY367877 LOC36;
				if (!!(((*(*n).typ).kind == ((NU8) 59)))) goto LA34;
				result = newtypes_265185(((NU8) 59), (*cl).c);
				if ((*result).sons) nimGCunrefNoCycle((*result).sons);
				(*result).sons = (Ttypeseq215824*) newSeqRC1((&NTI215824), 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_259651(t);
	}
	break;
	case ((NU8) 8):
	{
		Ttype215828* lookup;
		Tidobj190006* LOC40;
		TNimObject* LOC41;
		LOC40 = 0;
		LOC40 = &t->Sup;
		LOC41 = 0;
		LOC41 = idtableget_222107((*cl).typemap, LOC40);
		lookup = ((Ttype215828*) (LOC41));
		{
			if (!!((lookup == NIM_NIL))) goto LA44;
			result = lookup;
			{
				NIM_BOOL LOC48;
				LOC48 = 0;
				LOC48 = (((*t).flags &(1U<<((NU)(((NU8) 9))&31U)))!=0);
				if (LOC48) goto LA49;
				LOC48 = (*cl).skiptypedesc;
				LA49: ;
				if (!LOC48) goto LA50;
				result = base_241021(result);
			}
			LA50: ;
		}
		goto LA42;
		LA44: ;
		{
			Ttype215828* LOC55;
			if (!!(((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 0)))) goto LA53;
			LOC55 = 0;
			LOC55 = replacetypevarst_284566(cl, (*t).sons->data[((NI) 0)]);
			result = maketypedesc_265524((*cl).c, LOC55);
		}
		goto LA42;
		LA53: ;
		LA42: ;
	}
	break;
	case ((NU8) 52):
	{
		result = t;
	}
	break;
	case ((NU8) 11):
	{
		Tidobj190006* LOC68;
		TNimObject* LOC69;
		Ttype215828* LOC74;
		{
			Tidobj190006* LOC62;
			TNimObject* LOC63;
			if (!(((NI) 100) < (*cl).recursionlimit)) goto LA60;
			LOC62 = 0;
			LOC62 = &t->Sup;
			LOC63 = 0;
			LOC63 = idtableget_222107((*cl).localcache, LOC62);
			result = ((Ttype215828*) (LOC63));
			{
				if (!!((result == NIM_NIL))) goto LA66;
				goto BeforeRet;
			}
			LA66: ;
		}
		LA60: ;
		(*cl).recursionlimit += ((NI) 1);
		result = instcopytype_285256(cl, t);
		LOC68 = 0;
		LOC68 = &t->Sup;
		LOC69 = 0;
		LOC69 = &result->Sup.Sup;
		idtableput_222115((&(*cl).localcache), LOC68, LOC69);
		{
			NI i_286315;
			NI HEX3Atmp_286405;
			NI LOC71;
			NI res_286408;
			i_286315 = 0;
			HEX3Atmp_286405 = 0;
			LOC71 = 0;
			LOC71 = sonslen_218327(result);
			HEX3Atmp_286405 = (LOC71 - 1);
			res_286408 = ((NI) 1);
			{
				while (1) {
					if (!(res_286408 <= HEX3Atmp_286405)) goto LA73;
					i_286315 = res_286408;
					asgnRefNoCycle((void**) (&(*result).sons->data[i_286315]), replacetypevarst_284566(cl, (*result).sons->data[i_286315]));
					res_286408 += ((NI) 1);
				} LA73: ;
			}
		}
		LOC74 = 0;
		LOC74 = lastson_218377(result);
		propagatetoowner_219190(result, LOC74);
	}
	break;
	default:
	{
		{
			NIM_BOOL LOC78;
			Tidobj190006* LOC91;
			TNimObject* LOC92;
			LOC78 = 0;
			LOC78 = containsgenerictype_249492(t);
			if (!LOC78) goto LA79;
			{
				Tidobj190006* LOC85;
				TNimObject* LOC86;
				if (!(((NI) 100) < (*cl).recursionlimit)) goto LA83;
				LOC85 = 0;
				LOC85 = &t->Sup;
				LOC86 = 0;
				LOC86 = idtableget_222107((*cl).localcache, LOC85);
				result = ((Ttype215828*) (LOC86));
				{
					if (!!((result == NIM_NIL))) goto LA89;
					goto BeforeRet;
				}
				LA89: ;
			}
			LA83: ;
			(*cl).recursionlimit += ((NI) 1);
			result = instcopytype_285256(cl, t);
			(*result).size = IL64(-1);
			LOC91 = 0;
			LOC91 = &t->Sup;
			LOC92 = 0;
			LOC92 = &result->Sup.Sup;
			idtableput_222115((&(*cl).localcache), LOC91, LOC92);
			{
				NI i_286350;
				NI HEX3Atmp_286413;
				NI LOC94;
				NI res_286416;
				i_286350 = 0;
				HEX3Atmp_286413 = 0;
				LOC94 = 0;
				LOC94 = sonslen_218327(result);
				HEX3Atmp_286413 = (NI)(LOC94 - ((NI) 1));
				res_286416 = ((NI) 0);
				{
					while (1) {
						if (!(res_286416 <= HEX3Atmp_286413)) goto LA96;
						i_286350 = res_286416;
						{
							Ttype215828* r;
							if (!!(((*result).sons->data[i_286350] == NIM_NIL))) goto LA99;
							r = replacetypevarst_284566(cl, (*result).sons->data[i_286350]);
							{
								Ttype215828* r2;
								if (!((*result).kind == ((NU8) 17))) goto LA103;
								r2 = skiptypes_219113(r, 2048);
								{
									if (!((*r2).kind == ((NU8) 21) || (*r2).kind == ((NU8) 22))) goto LA107;
									r = skiptypes_219113(r2, 6291456);
								}
								LA107: ;
							}
							LA103: ;
							asgnRefNoCycle((void**) (&(*result).sons->data[i_286350]), r);
							propagatetoowner_219190(result, r);
						}
						LA99: ;
						res_286416 += ((NI) 1);
					} LA96: ;
				}
			}
			asgnRefNoCycle((void**) (&(*result).n), replacetypevarsn_284551(cl, (*result).n));
			switch ((*result).kind) {
			case ((NU8) 16):
			{
				Ttype215828* idx;
				idx = (*result).sons->data[((NI) 0)];
				{
					NimStringDesc* LOC114;
					if (!!(!(((*idx).kind == ((NU8) 59))))) goto LA112;
					LOC114 = 0;
					LOC114 = HEX24_188183(TMP2791);
					internalerror_188113(LOC114);
				}
				LA112: ;
			}
			break;
			case ((NU8) 17):
			case ((NU8) 18):
			{
				propagatefieldflags_285955(result, (*result).n);
			}
			break;
			case ((NU8) 25):
			{
				erasevoidparams_285748(result);
				skipintliteralparams_285876(result);
			}
			break;
			default:
			{
			}
			break;
			}
		}
		LA79: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype215828*, replacetypevarst_284566)(Trepltypevars284531* cl, Ttype215828* t) {
	Ttype215828* result;
	result = 0;
	result = replacetypevarstaux_284541(cl, t);
	return result;
}

N_NIMCALL(NIM_BOOL, istypeparam_284692)(Tnode215790* 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 &(1U<<((NU)(((NU8) 2))&31U)))!=0);
	LA6: ;
	LOC3 = LOC5;
	LA4: ;
	LOC1 = LOC3;
	LA2: ;
	result = LOC1;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode215790*, reresolvecallswithtypedescparams_284827)(Trepltypevars284531* cl, Tnode215790* n) {
	Tnode215790* result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode215790* 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_216238(n, ((NI) 0));
		LOC3 = (((*(*LOC5).kindU.S4.sym).flags &(1U<<((NU)(((NU8) 2))&31U)))!=0);
		LA4: ;
		if (!LOC3) goto LA6;
		needsfixing = NIM_FALSE;
		{
			NI i_284874;
			NI HEX3Atmp_284901;
			NI LOC9;
			NI res_284904;
			i_284874 = 0;
			HEX3Atmp_284901 = 0;
			LOC9 = 0;
			LOC9 = safelen_216081(n);
			HEX3Atmp_284901 = (LOC9 - 1);
			res_284904 = ((NI) 1);
			{
				while (1) {
					if (!(res_284904 <= HEX3Atmp_284901)) goto LA11;
					i_284874 = res_284904;
					{
						Tnode215790* LOC14;
						NIM_BOOL LOC15;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_216238(n, i_284874);
						LOC15 = 0;
						LOC15 = istypeparam_284692(LOC14);
						if (!LOC15) goto LA16;
						needsfixing = NIM_TRUE;
					}
					LA16: ;
					res_284904 += ((NI) 1);
				} LA11: ;
			}
		}
		{
			if (!needsfixing) goto LA20;
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_217234((*(*(*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_284898;
		NI HEX3Atmp_284909;
		NI LOC23;
		NI res_284912;
		i_284898 = 0;
		HEX3Atmp_284909 = 0;
		LOC23 = 0;
		LOC23 = safelen_216081(n);
		HEX3Atmp_284909 = (LOC23 - 1);
		res_284912 = ((NI) 0);
		{
			while (1) {
				Tnode215790* LOC26;
				if (!(res_284912 <= HEX3Atmp_284909)) goto LA25;
				i_284898 = res_284912;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_216238(n, i_284898);
				asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_284898]), reresolvecallswithtypedescparams_284827(cl, LOC26));
				res_284912 += ((NI) 1);
			} LA25: ;
		}
	}
	result = n;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode215790*, replacetypevarsn_284551)(Trepltypevars284531* cl, Tnode215790* n_284555) {
	Tnode215790* result;
{	result = 0;
	{
		if (!(n_284555 == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	result = copynode_219542(n_284555);
	{
		if (!!(((*n_284555).typ == NIM_NIL))) goto LA7;
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_284566(cl, (*n_284555).typ));
	}
	LA7: ;
	switch ((*n_284555).kind) {
	case ((NU8) 0) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_284546(cl, (*n_284555).kindU.S4.sym));
		{
			Tnodeseq215784* LOC15;
			if (!((*(*(*result).kindU.S4.sym).typ).kind == ((NU8) 3))) goto LA13;
			LOC15 = 0;
			LOC15 = (Tnodeseq215784*) newSeq((&NTI215784), 0);
			result = newnode_217601(((NU8) 138), (*n_284555).info, LOC15, NIM_NIL);
		}
		LA13: ;
	}
	break;
	case ((NU8) 140):
	{
		Tnode215790* branch;
		branch = NIM_NIL;
		{
			NI i_285046;
			NI HEX3Atmp_285130;
			NI LOC18;
			NI res_285133;
			i_285046 = 0;
			HEX3Atmp_285130 = 0;
			LOC18 = 0;
			LOC18 = sonslen_218351(n_284555);
			HEX3Atmp_285130 = (NI)(LOC18 - ((NI) 1));
			res_285133 = ((NI) 0);
			{
				while (1) {
					Tnode215790* it;
					if (!(res_285133 <= HEX3Atmp_285130)) goto LA20;
					i_285046 = res_285133;
					it = (*n_284555).kindU.S6.sons->data[i_285046];
					{
						if (!(it == NIM_NIL)) goto LA23;
						illformedast_265950(n_284555);
					}
					LA23: ;
					switch ((*it).kind) {
					case ((NU8) 86):
					{
						Tnode215790* cond;
						Tnode215790* e;
						checksonslen_265958(it, ((NI) 2));
						cond = preparenode_284601(cl, (*it).kindU.S6.sons->data[((NI) 0)]);
						e = (*(*cl).c).semconstexpr((*cl).c, cond);
						{
							if (!!(((*e).kind == ((NU8) 6)))) goto LA28;
							internalerror_188100((*e).info, ((NimStringDesc*) &TMP2793));
						}
						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_265958(it, ((NI) 1));
						{
							if (!(branch == NIM_NIL)) goto LA39;
							branch = (*it).kindU.S6.sons->data[((NI) 0)];
						}
						LA39: ;
					}
					break;
					default:
					{
						illformedast_265950(n_284555);
					}
					break;
					}
					res_285133 += ((NI) 1);
				} LA20: ;
			}
		}
		{
			if (!!((branch == NIM_NIL))) goto LA44;
			result = replacetypevarsn_284551(cl, branch);
		}
		goto LA42;
		LA44: ;
		{
			result = newnodei_217248(((NU8) 138), (*n_284555).info);
		}
		LA42: ;
	}
	break;
	case ((NU8) 62):
	{
		Tnode215790* n;
		n = preparenode_284601(cl, n_284555);
		n = reresolvecallswithtypedescparams_284827(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_218351(n_284555);
		{
			if (!(((NI) 0) < length)) goto LA56;
			newsons_218260(result, length);
			{
				NI i_285125;
				NI HEX3Atmp_285138;
				NI res_285141;
				i_285125 = 0;
				HEX3Atmp_285138 = 0;
				HEX3Atmp_285138 = (NI)(length - ((NI) 1));
				res_285141 = ((NI) 0);
				{
					while (1) {
						if (!(res_285141 <= HEX3Atmp_285138)) goto LA60;
						i_285125 = res_285141;
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[i_285125]), replacetypevarsn_284551(cl, (*n_284555).kindU.S6.sons->data[i_285125]));
						res_285141 += ((NI) 1);
					} LA60: ;
				}
			}
		}
		LA56: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode215790*, replacetypesinbody_286430)(Tcontext265020* p, Tidtable215840 pt, Tnode215790* n, Tsym215822* owner) {
	Tnode215790* result;
	Trepltypevars284531 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_286420(p, pt, (*n).info, owner, (&cl));
	pushinfocontext_184209((*n).info);
	result = replacetypevarsn_284551((&cl), n);
	popinfocontext_184222();
	return result;
}

N_NIMCALL(Ttype215828*, generatetypeinstance_286450)(Tcontext265020* p, Tidtable215840 pt, Tlineinfo183337 info, Ttype215828* t) {
	Ttype215828* result;
	Trepltypevars284531 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_286420(p, pt, info, NIM_NIL, (&cl));
	pushinfocontext_184209(info);
	result = replacetypevarst_284566((&cl), t);
	popinfocontext_184222();
	return result;
}

N_NIMCALL(NIM_BOOL, hasgenericarguments_284737)(Tnode215790* 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_284817;
			NI HEX3Atmp_284820;
			NI LOC11;
			NI res_284823;
			i_284817 = 0;
			HEX3Atmp_284820 = 0;
			LOC11 = 0;
			LOC11 = safelen_216081(n);
			HEX3Atmp_284820 = (LOC11 - 1);
			res_284823 = ((NI) 0);
			{
				while (1) {
					if (!(res_284823 <= HEX3Atmp_284820)) goto LA13;
					i_284817 = res_284823;
					{
						NIM_BOOL LOC16;
						LOC16 = 0;
						LOC16 = hasgenericarguments_284737((*n).kindU.S6.sons->data[i_284817]);
						if (!LOC16) goto LA17;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA17: ;
					res_284823 += ((NI) 1);
				} LA13: ;
			}
		}
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, checkconstructedtype_284089)(Tlineinfo183337 info, Ttype215828* typ) {
	Ttype215828* t;
	t = skiptypes_219113(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;
		Ttype215828* LOC8;
		LOC6 = 0;
		LOC6 = (((*t).flags &(1U<<((NU)(((NU8) 4))&31U)))!=0);
		if (!(LOC6)) goto LA7;
		LOC8 = 0;
		LOC8 = skiptypes_219113(t, IL64(211106232576256));
		LOC6 = !(((*LOC8).kind == ((NU8) 17)));
		LA7: ;
		if (!LOC6) goto LA9;
		localerror_188080(info, ((NU16) 166), ((NimStringDesc*) &TMP2786));
	}
	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_188080(info, ((NU16) 202), ((NimStringDesc*) &TMP2787));
	}
	goto LA1;
	LA14: ;
	{
		NI64 LOC17;
		NimStringDesc* LOC20;
		LOC17 = 0;
		LOC17 = computesize_241121(t);
		if (!(LOC17 == IL64(-2))) goto LA18;
		LOC20 = 0;
		LOC20 = typetostring_241017(t, ((NU8) 0));
		localerror_188080(info, ((NU16) 127), LOC20);
	}
	goto LA1;
	LA18: ;
	{
		sharedptrcheck_284005(info, t);
	}
	LA1: ;
}
NIM_EXTERNC N_NOINLINE(void, compiler_semtypinstInit000)(void) {
}

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

