/* 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 Tnode216790 Tnode216790;
typedef struct Tcontext266020 Tcontext266020;
typedef struct Tidtable216840 Tidtable216840;
typedef struct Tidpairseq216838 Tidpairseq216838;
typedef struct Tsym216822 Tsym216822;
typedef struct Trepltypevars285531 Trepltypevars285531;
typedef struct Tlineinfo184337 Tlineinfo184337;
typedef struct Ttype216828 Ttype216828;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tident191012 Tident191012;
typedef struct Tnodeseq216784 Tnodeseq216784;
typedef struct Tidobj191006 Tidobj191006;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq216824 Ttypeseq216824;
typedef struct Tloc216804 Tloc216804;
typedef struct Ropeobj172006 Ropeobj172006;
typedef struct TY89887 TY89887;
typedef struct Tscope216816 Tscope216816;
typedef struct TY216925 TY216925;
typedef struct Tstrtable216794 Tstrtable216794;
typedef struct Tsymseq216792 Tsymseq216792;
typedef struct Tlib216808 Tlib216808;
typedef struct Cell47304 Cell47304;
typedef struct Cellseq47320 Cellseq47320;
typedef struct Gcheap49618 Gcheap49618;
typedef struct Gcstack49616 Gcstack49616;
typedef struct Cellset47316 Cellset47316;
typedef struct Pagedesc47312 Pagedesc47312;
typedef struct Memregion29487 Memregion29487;
typedef struct Smallchunk29439 Smallchunk29439;
typedef struct Llchunk29481 Llchunk29481;
typedef struct Bigchunk29441 Bigchunk29441;
typedef struct Intset29414 Intset29414;
typedef struct Trunk29410 Trunk29410;
typedef struct Avlnode29485 Avlnode29485;
typedef struct Gcstat49614 Gcstat49614;
typedef struct Tpasscontext263002 Tpasscontext263002;
typedef struct Tproccon266008 Tproccon266008;
typedef struct Intset213035 Intset213035;
typedef struct Trunk213031 Trunk213031;
typedef struct Trunkseq213033 Trunkseq213033;
typedef struct Tlinkedlist138016 Tlinkedlist138016;
typedef struct Tlistentry138010 Tlistentry138010;
typedef struct Tctx265036 Tctx265036;
typedef struct TY266140 TY266140;
typedef struct Tidpair216836 Tidpair216836;
typedef struct Tinstantiation216812 Tinstantiation216812;
typedef struct Basechunk29437 Basechunk29437;
typedef struct Freecell29429 Freecell29429;
typedef struct TY265242 TY265242;
typedef struct TY185093 TY185093;
typedef struct PprocHEX3Aobjecttype265221 PprocHEX3Aobjecttype265221;
typedef struct TY265261 TY265261;
typedef struct Tinstantiationpair266010 Tinstantiationpair266010;
typedef struct TY216913 TY216913;
typedef struct TY265222 TY265222;
typedef struct TY265227 TY265227;
typedef struct TY265262 TY265262;
typedef struct Vmargs265030 Vmargs265030;
typedef struct Tblock265018 Tblock265018;
typedef struct TY265202 TY265202;
struct  Tidtable216840  {
NI counter;
Tidpairseq216838* data;
};
struct  Tlineinfo184337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Trepltypevars285531  {
Tcontext266020* c;
Tidtable216840 typemap;
Tidtable216840 symmap;
Tidtable216840 localcache;
Tlineinfo184337 info;
NIM_BOOL allowmetatypes;
NIM_BOOL skiptypedesc;
Tsym216822* owner;
NI recursionlimit;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode216790  {
Ttype216828* typ;
Tlineinfo184337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym216822* sym;
} S4;
struct {Tident191012* ident;
} S5;
struct {Tnodeseq216784* 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  Tidobj191006  {
  TNimObject Sup;
NI id;
};
struct  Tloc216804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype216828* t;
Ropeobj172006* r;
Ropeobj172006* heaproot;
};
struct  Ttype216828  {
  Tidobj191006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq216824* sons;
Tnode216790* n;
Tsym216822* owner;
Tsym216822* sym;
Tsym216822* destructor;
Tsym216822* deepcopy;
Tsym216822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc216804 loc;
};
struct TY89887 {
NimStringDesc* Field0;
NI Field1;
};
struct  Tstrtable216794  {
NI counter;
Tsymseq216792* data;
};
struct  Tsym216822  {
  Tidobj191006 Sup;
NU8 kind;
union{
struct {Ttypeseq216824* typeinstcache;
Tscope216816* typscope;
} S1;
struct {TY216925* procinstcache;
Tsym216822* gcunsafetyreason;
} S2;
struct {TY216925* usedgenerics;
Tstrtable216794 tab;
} S3;
struct {Tsym216822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype216828* typ;
Tident191012* name;
Tlineinfo184337 info;
Tsym216822* owner;
NU32 flags;
Tnode216790* ast;
NU32 options;
NI position;
NI offset;
Tloc216804 loc;
Tlib216808* annex;
Tnode216790* constraint;
};
struct  Cell47304  {
NI refcount;
TNimType* typ;
};
struct  Cellseq47320  {
NI len;
NI cap;
Cell47304** d;
};
struct  Cellset47316  {
NI counter;
NI max;
Pagedesc47312* head;
Pagedesc47312** data;
};
typedef Smallchunk29439* TY29502[512];
typedef Trunk29410* Trunkbuckets29412[256];
struct  Intset29414  {
Trunkbuckets29412 data;
};
struct  Memregion29487  {
NI minlargeobj;
NI maxlargeobj;
TY29502 freesmallchunks;
Llchunk29481* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk29441* freechunkslist;
Intset29414 chunkstarts;
Avlnode29485* root;
Avlnode29485* deleted;
Avlnode29485* last;
Avlnode29485* freeavlnodes;
};
struct  Gcstat49614  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap49618  {
Gcstack49616* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq47320 zct;
Cellseq47320 decstack;
Cellset47316 cycleroots;
Cellseq47320 tempstack;
NI recgclock;
Memregion29487 region;
Gcstat49614 stat;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef Ttype216828* TY368877[1];
struct  Tpasscontext263002  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset213035  {
NI counter;
NI max;
Trunk213031* head;
Trunkseq213033* data;
};
struct  Tlinkedlist138016  {
Tlistentry138010* head;
Tlistentry138010* tail;
NI counter;
};
typedef N_NIMCALL_PTR(Tnode216790*, TY266071) (Tcontext266020* c, Tnode216790* n);
typedef N_NIMCALL_PTR(Tnode216790*, TY266076) (Tcontext266020* c, Tnode216790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode216790*, TY266084) (Tcontext266020* c, Tnode216790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode216790*, TY266092) (Tcontext266020* c, Tnode216790* n);
typedef N_NIMCALL_PTR(Tnode216790*, TY266097) (Tcontext266020* c, Tnode216790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode216790*, TY266105) (Tcontext266020* c, Tnode216790* n);
typedef N_NIMCALL_PTR(Tnode216790*, TY266110) (Tcontext266020* c, Tnode216790* n, Tnode216790* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype216828*, TY266117) (Tcontext266020* c, Tnode216790* n, Ttype216828* prev);
typedef struct {
N_NIMCALL_PTR(Tnode216790*, ClPrc) (Tcontext266020* c, Tidtable216840 pt, Tnode216790* n, void* ClEnv);
void* ClEnv;
} TY266123;
typedef struct {
N_NIMCALL_PTR(Tsym216822*, ClPrc) (Tcontext266020* c, Tsym216822* fn, Tidtable216840 pt, Tlineinfo184337 info, void* ClEnv);
void* ClEnv;
} TY266129;
typedef N_NIMCALL_PTR(Tsym216822*, TY266145) (Tcontext266020* c, Tsym216822* dc, Ttype216828* t, Tlineinfo184337 info, NU8 op);
struct  Tcontext266020  {
  Tpasscontext263002 Sup;
Tsym216822* module;
Tscope216816* currentscope;
Tscope216816* importtable;
Tscope216816* toplevelscope;
Tproccon266008* p;
Tsymseq216792* friendmodules;
NI instcounter;
Intset213035 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq216792* converters;
Tsymseq216792* patterns;
Tlinkedlist138016 optionstack;
Tidtable216840 symmapping;
Tlinkedlist138016 libs;
TY266071 semconstexpr;
TY266076 semexpr;
TY266084 semtryexpr;
TY266092 semtryconstexpr;
TY266097 semoperand;
TY266105 semconstboolexpr;
TY266110 semoverloadedcall;
TY266117 semtypenode;
TY266123 seminferredlambda;
TY266129 semgenerateinstance;
Intset213035 includedfiles;
Tstrtable216794 userpragmas;
Tctx265036* evalcontext;
Intset213035 unknownidents;
TY266140* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY266145 insttypeboundop;
};
struct  Tidpair216836  {
Tidobj191006* key;
TNimObject* val;
};
struct  Tident191012  {
  Tidobj191006 Sup;
NimStringDesc* s;
Tident191012* next;
NI h;
};
struct  Ropeobj172006  {
  TNimObject Sup;
Ropeobj172006* left;
Ropeobj172006* right;
NI length;
NimStringDesc* data;
};
struct  Tscope216816  {
NI depthlevel;
Tstrtable216794 symbols;
Tnodeseq216784* usingsyms;
Tscope216816* parent;
};
struct  Tlistentry138010  {
  TNimObject Sup;
Tlistentry138010* prev;
Tlistentry138010* next;
};
struct  Tlib216808  {
  Tlistentry138010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj172006* name;
Tnode216790* path;
};
struct  Gcstack49616  {
Gcstack49616* prev;
Gcstack49616* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY29418[16];
struct  Pagedesc47312  {
Pagedesc47312* next;
NI key;
TY29418 bits;
};
struct  Basechunk29437  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk29439  {
  Basechunk29437 Sup;
Smallchunk29439* next;
Smallchunk29439* prev;
Freecell29429* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk29481  {
NI size;
NI acc;
Llchunk29481* next;
};
struct  Bigchunk29441  {
  Basechunk29437 Sup;
Bigchunk29441* next;
Bigchunk29441* prev;
NI align;
NF data;
};
struct  Trunk29410  {
Trunk29410* next;
NI key;
TY29418 bits;
};
typedef Avlnode29485* TY29492[2];
struct  Avlnode29485  {
TY29492 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon266008  {
Tsym216822* owner;
Tsym216822* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon266008* next;
NIM_BOOL wasforwarded;
Tnode216790* bracketexpr;
};
struct  Trunk213031  {
Trunk213031* next;
NI key;
TY29418 bits;
};
struct  Tctx265036  {
  Tpasscontext263002 Sup;
TY265242* code;
TY185093* debug;
Tnode216790* globals;
Tnode216790* constants;
Ttypeseq216824* types;
Tnode216790* currentexceptiona;
Tnode216790* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype265221* prc;
Tsym216822* module;
Tnode216790* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo184337 comesfromheuristic;
TY265261* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair266010  {
Tsym216822* genericsym;
Tinstantiation216812* inst;
};
struct  Tinstantiation216812  {
Tsym216822* sym;
Ttypeseq216824* concretetypes;
TY216913* usedby;
NI compilesid;
};
struct  Freecell29429  {
Freecell29429* next;
NI zerofield;
};
struct TY265227 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY265227 TY265230[256];
struct  PprocHEX3Aobjecttype265221  {
TY265222* blocks;
Tsym216822* sym;
TY265230 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs265030* args, void* ClEnv);
void* ClEnv;
} Vmcallback265032;
struct TY265262 {
NimStringDesc* Field0;
Vmcallback265032 Field1;
};
struct  Tblock265018  {
Tsym216822* label;
TY265202* fixups;
};
struct  Vmargs265030  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode216790* currentexception;
};
struct Ttypeseq216824 {
  TGenericSeq Sup;
  Ttype216828* data[SEQ_DECL_SIZE];
};
struct Tnodeseq216784 {
  TGenericSeq Sup;
  Tnode216790* data[SEQ_DECL_SIZE];
};
struct Tidpairseq216838 {
  TGenericSeq Sup;
  Tidpair216836 data[SEQ_DECL_SIZE];
};
struct TY216925 {
  TGenericSeq Sup;
  Tinstantiation216812* data[SEQ_DECL_SIZE];
};
struct Tsymseq216792 {
  TGenericSeq Sup;
  Tsym216822* data[SEQ_DECL_SIZE];
};
struct Trunkseq213033 {
  TGenericSeq Sup;
  Trunk213031* data[SEQ_DECL_SIZE];
};
struct TY266140 {
  TGenericSeq Sup;
  Tinstantiationpair266010 data[SEQ_DECL_SIZE];
};
struct TY265242 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY185093 {
  TGenericSeq Sup;
  Tlineinfo184337 data[SEQ_DECL_SIZE];
};
struct TY265261 {
  TGenericSeq Sup;
  TY265262 data[SEQ_DECL_SIZE];
};
struct TY216913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY265222 {
  TGenericSeq Sup;
  Tblock265018 data[SEQ_DECL_SIZE];
};
struct TY265202 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, inittypevars_287420)(Tcontext266020* p, Tidtable216840 pt, Tlineinfo184337 info, Tsym216822* owner, Trepltypevars285531* Result);
N_NIMCALL(void, initidtable_220033)(Tidtable216840* x);
N_NIMCALL(void, copyidtable_218066)(Tidtable216840* dest, Tidtable216840 src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, pushinfocontext_185209)(Tlineinfo184337 info);
N_NIMCALL(Tnode216790*, replacetypevarsn_285551)(Trepltypevars285531* cl, Tnode216790* n_285555);
N_NIMCALL(Tnode216790*, copynode_220542)(Tnode216790* src);
N_NIMCALL(Ttype216828*, replacetypevarst_285566)(Trepltypevars285531* cl, Ttype216828* t);
N_NIMCALL(Ttype216828*, replacetypevarstaux_285541)(Trepltypevars285531* cl, Ttype216828* t);
N_NIMCALL(TNimObject*, idtableget_223107)(Tidtable216840 t, Tidobj191006* key);
N_NIMCALL(Ttype216828*, handlegenericinvocation_286316)(Trepltypevars285531* cl, Ttype216828* t);
N_NIMCALL(void, internalerror_189100)(Tlineinfo184337 info, NimStringDesc* errmsg);
N_NIMCALL(Ttype216828*, searchinsttypes_285201)(Ttype216828* key);
N_NIMCALL(void, internalerror_189113)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_189183)(TY89887 x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_250927)(Ttypeseq216824* x, Ttypeseq216824* y);
N_NIMCALL(NIM_BOOL, comparetypes_248404)(Ttype216828* x, Ttype216828* y, NU8 cmp, NU8 flags);
N_NIMCALL(NI, sonslen_219327)(Ttype216828* n);
N_NIMCALL(Ttype216828*, lookuptypevar_286217)(Trepltypevars285531* cl, Ttype216828* t);
N_NIMCALL(void, localerror_189080)(Tlineinfo184337 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, typetostring_242017)(Ttype216828* typ, NU8 prefer);
N_NIMCALL(Ttype216828*, errortype_266901)(Tcontext266020* c);
N_NIMCALL(void, idtableput_223115)(Tidtable216840* t, Tidobj191006* key, TNimObject* val);
N_NIMCALL(Ttype216828*, instcopytype_286256)(Trepltypevars285531* cl, Ttype216828* t);
N_NIMCALL(Ttype216828*, copytype_219470)(Ttype216828* t, Tsym216822* owner, NIM_BOOL keepid);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell47304*, usrtocell_51240)(void* usr);
static N_INLINE(void, rtladdzct_52801)(Cell47304* c);
N_NOINLINE(void, addzct_51217)(Cellseq47320* s, Cell47304* c);
N_NIMCALL(void, propagatetoowner_220190)(Ttype216828* owner, Ttype216828* elem);
N_NIMCALL(Ttype216828*, newtype_219107)(NU8 kind, Tsym216822* owner);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(void, cachetypeinst_285446)(Ttype216828* inst);
N_NIMCALL(Ttype216828*, lastson_219377)(Ttype216828* n);
N_NIMCALL(void, safeadd_285485)(Ttypeseq216824** x, Ttype216828* y);
N_NIMCALL(void, rawaddson_220408)(Ttype216828* father, Ttype216828* son);
N_NIMCALL(NIM_BOOL, isgenericalias_247584)(Ttype216828* t);
N_NIMCALL(Ttype216828*, skipgenericalias_247606)(Ttype216828* t);
N_NIMCALL(void, checkpartialconstructedtype_285048)(Tlineinfo184337 info, Ttype216828* t);
N_NIMCALL(Ttype216828*, skiptypes_220113)(Ttype216828* t, NU64 kinds);
N_NIMCALL(void, sharedptrcheck_285005)(Tlineinfo184337 info, Ttype216828* t);
N_NIMCALL(NI, len_219339)(Ttype216828* n);
static N_INLINE(NIM_BOOL, isgcedmem_220157)(Ttype216828* t);
N_NIMCALL(Tnode216790*, preparenode_285601)(Trepltypevars285531* cl, Tnode216790* n);
N_NIMCALL(Tsym216822*, replacetypevarss_285546)(Trepltypevars285531* cl, Tsym216822* s);
N_NIMCALL(Tsym216822*, copysym_219601)(Tsym216822* s, NIM_BOOL keepid);
static N_INLINE(NI, safelen_217081)(Tnode216790* n);
N_NIMCALL(void, add_217114)(Tnode216790* father, Tnode216790* son);
static N_INLINE(Tnode216790*, HEX5BHEX5D_217238)(Tnode216790* n, NI i);
N_NIMCALL(Ttype216828*, newtypes_266185)(NU8 kind, Tcontext266020* c);
static N_INLINE(Ttype216828*, skipintlit_260651)(Ttype216828* t);
N_NIMCALL(Ttype216828*, getsystype_260130)(NU8 kind);
N_NIMCALL(Ttype216828*, base_242021)(Ttype216828* t);
N_NIMCALL(Ttype216828*, maketypedesc_266524)(Tcontext266020* c, Ttype216828* typ);
N_NIMCALL(NIM_BOOL, containsgenerictype_250492)(Ttype216828* t);
N_NIMCALL(void, propagatefieldflags_286955)(Ttype216828* t, Tnode216790* n);
static N_INLINE(NI, len_217059)(Tnode216790* n);
N_NIMCALL(void, erasevoidparams_286748)(Ttype216828* t);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, skipintliteralparams_286876)(Ttype216828* t);
N_NIMCALL(Tnode216790*, newnode_218601)(NU8 kind, Tlineinfo184337 info, Tnodeseq216784* sons, Ttype216828* typ);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(NI, sonslen_219351)(Tnode216790* n);
N_NIMCALL(void, illformedast_266950)(Tnode216790* n);
N_NIMCALL(void, checksonslen_266958)(Tnode216790* n, NI length);
N_NIMCALL(Tnode216790*, newnodei_218248)(NU8 kind, Tlineinfo184337 info);
N_NIMCALL(Tnode216790*, reresolvecallswithtypedescparams_285827)(Trepltypevars285531* cl, Tnode216790* n);
N_NIMCALL(NIM_BOOL, istypeparam_285692)(Tnode216790* n);
N_NIMCALL(Tnode216790*, newsymnode_218234)(Tsym216822* sym);
N_NIMCALL(void, newsons_219260)(Tnode216790* father, NI length);
N_NIMCALL(void, popinfocontext_185222)(void);
N_NIMCALL(NIM_BOOL, hasgenericarguments_285737)(Tnode216790* n);
N_NIMCALL(NI64, computesize_242121)(Ttype216828* typ);
STRING_LITERAL(TMP2784, "no generic body", 15);
STRING_LITERAL(TMP2786, "compiler/semtypinst.nim", 23);
NIM_CONST TY89887 TMP2785 = {((NimStringDesc*) &TMP2786),
((NI) 52)}
;
STRING_LITERAL(TMP2791, "substitution with generic parameter", 35);
STRING_LITERAL(TMP2792, "acyclic", 7);
STRING_LITERAL(TMP2793, "", 0);
STRING_LITERAL(TMP2794, "shared memory may not refer to GC\'ed thread local memory", 56);
NIM_CONST TY89887 TMP2797 = {((NimStringDesc*) &TMP2786),
((NI) 477)}
;
NIM_CONST TY89887 TMP2798 = {((NimStringDesc*) &TMP2786),
((NI) 367)}
;
STRING_LITERAL(TMP2799, "ReplaceTypeVarsN: when condition not a bool", 43);
extern Gcheap49618 gch_49659;
extern TNimType NTI216824; /* TTypeSeq */
extern TNimType NTI216784; /* TNodeSeq */

N_NIMCALL(void, inittypevars_287420)(Tcontext266020* p, Tidtable216840 pt, Tlineinfo184337 info, Tsym216822* owner, Trepltypevars285531* Result) {
	initidtable_220033((&(*Result).symmap));
	copyidtable_218066((&(*Result).typemap), pt);
	initidtable_220033((&(*Result).localcache));
	(*Result).info = info;
	unsureAsgnRef((void**) (&(*Result).c), p);
	unsureAsgnRef((void**) (&(*Result).owner), owner);
}

N_NIMCALL(Ttype216828*, searchinsttypes_285201)(Ttype216828* key) {
	Ttype216828* result;
	Ttype216828* 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_189183(TMP2785);
		internalerror_189113(LOC9);
	}
	LA7: ;
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = HEX3DHEX3D_250927((*(*generictyp).sym).kindU.S1.typeinstcache, NIM_NIL);
		if (!LOC12) goto LA13;
		goto BeforeRet;
	}
	LA13: ;
	{
		Ttype216828* inst_285402;
		Ttypeseq216824* HEX3Atmp_285440;
		NI i_285443;
		NI L_285445;
		inst_285402 = 0;
		HEX3Atmp_285440 = 0;
		HEX3Atmp_285440 = (*(*generictyp).sym).kindU.S1.typeinstcache;
		i_285443 = ((NI) 0);
		L_285445 = (HEX3Atmp_285440 ? HEX3Atmp_285440->Sup.len : 0);
		{
			while (1) {
				if (!(i_285443 < L_285445)) goto LA17;
				inst_285402 = HEX3Atmp_285440->data[i_285443];
				{
					if (!((*inst_285402).Sup.id == (*key).Sup.id)) goto LA20;
					result = inst_285402;
					goto BeforeRet;
				}
				LA20: ;
				{
					if (!(((*inst_285402).sons ? (*inst_285402).sons->Sup.len : 0) < ((*key).sons ? (*key).sons->Sup.len : 0))) goto LA24;
					goto BeforeRet;
				}
				LA24: ;
				{
					{
						NI j_285429;
						NI HEX3Atmp_285433;
						NI res_285436;
						j_285429 = 0;
						HEX3Atmp_285433 = 0;
						HEX3Atmp_285433 = ((*key).sons ? ((*key).sons->Sup.len-1) : -1);
						res_285436 = ((NI) 1);
						{
							while (1) {
								if (!(res_285436 <= HEX3Atmp_285433)) goto LA29;
								j_285429 = res_285436;
								{
									NIM_BOOL LOC32;
									LOC32 = 0;
									LOC32 = comparetypes_248404((*inst_285402).sons->data[j_285429], (*key).sons->data[j_285429], ((NU8) 0), 8);
									if (!!(LOC32)) goto LA33;
									goto LA26;
								}
								LA33: ;
								res_285436 += ((NI) 1);
							} LA29: ;
						}
					}
					result = inst_285402;
					goto BeforeRet;
				} LA26: ;
				i_285443 += ((NI) 1);
			} LA17: ;
		}
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype216828*, lookuptypevar_286217)(Trepltypevars285531* cl, Ttype216828* t) {
	Ttype216828* result;
	Tidobj191006* LOC1;
	TNimObject* LOC2;
{	result = 0;
	LOC1 = 0;
	LOC1 = &t->Sup;
	LOC2 = 0;
	LOC2 = idtableget_223107((*cl).typemap, LOC1);
	result = ((Ttype216828*) (LOC2));
	{
		NimStringDesc* LOC13;
		Tidobj191006* 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_242017(t, ((NU8) 0));
		localerror_189080((*(*t).sym).info, ((NU16) 128), LOC13);
		result = errortype_266901((*cl).c);
		LOC14 = 0;
		LOC14 = &t->Sup;
		LOC15 = 0;
		LOC15 = &result->Sup.Sup;
		idtableput_223115((&(*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_189100((*cl).info, ((NimStringDesc*) &TMP2791));
	}
	goto LA3;
	LA19: ;
	LA3: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype216828*, instcopytype_286256)(Trepltypevars285531* cl, Ttype216828* t) {
	Ttype216828* result;
	result = 0;
	result = copytype_219470(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(Cell47304*, usrtocell_51240)(void* usr) {
	Cell47304* result;
	result = 0;
	result = ((Cell47304*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(Cell47304))))));
	return result;
}

static N_INLINE(void, rtladdzct_52801)(Cell47304* c) {
	addzct_51217((&gch_49659.zct), c);
}

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

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

N_NIMCALL(void, cachetypeinst_285446)(Ttype216828* inst) {
	Ttype216828* gt;
	Ttype216828* t;
{	gt = (*inst).sons->data[((NI) 0)];
	{
		if (!((*gt).kind == ((NU8) 10))) goto LA3;
		t = lastson_219377(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_285485((&(*(*gt).sym).kindU.S1.typeinstcache), inst);
	}BeforeRet: ;
}

static N_INLINE(NIM_BOOL, isgcedmem_220157)(Ttype216828* 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_285005)(Tlineinfo184337 info, Ttype216828* t) {
	{
		NIM_BOOL LOC3;
		NI LOC5;
		LOC3 = 0;
		LOC3 = ((*t).kind == ((NU8) 21));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = len_219339(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_220157(t);
				LA15: ;
				if (!LOC14) goto LA16;
				localerror_189080(info, ((NU16) 4), ((NimStringDesc*) &TMP2794));
			}
			LA16: ;
		}
		LA10: ;
	}
	LA6: ;
}

N_NIMCALL(void, checkpartialconstructedtype_285048)(Tlineinfo184337 info, Ttype216828* t) {
	{
		NIM_BOOL LOC3;
		Ttype216828* LOC5;
		LOC3 = 0;
		LOC3 = (((*t).flags &(1U<<((NU)(((NU8) 4))&31U)))!=0);
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = skiptypes_220113(t, IL64(211106232576256));
		LOC3 = !(((*LOC5).kind == ((NU8) 17)));
		LA4: ;
		if (!LOC3) goto LA6;
		localerror_189080(info, ((NU16) 166), ((NimStringDesc*) &TMP2792));
	}
	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_189080(info, ((NU16) 202), ((NimStringDesc*) &TMP2793));
	}
	goto LA1;
	LA11: ;
	{
		sharedptrcheck_285005(info, t);
	}
	LA1: ;
}

N_NIMCALL(Ttype216828*, handlegenericinvocation_286316)(Trepltypevars285531* cl, Ttype216828* t) {
	Ttype216828* result;
	Ttype216828* body;
	Ttype216828* header;
	TY368877 LOC46;
	NIM_BOOL oldskiptypedesc;
	Ttype216828* newbody;
	Ttype216828* LOC64;
	Tsym216822* dc;
	Tsym216822* asgn;
{	result = 0;
	body = (*t).sons->data[((NI) 0)];
	{
		if (!!(((*body).kind == ((NU8) 10)))) goto LA3;
		internalerror_189100((*cl).info, ((NimStringDesc*) &TMP2784));
	}
	LA3: ;
	header = t;
	{
		Tidobj191006* LOC9;
		TNimObject* LOC10;
		if (!(*cl).allowmetatypes) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_223107((*cl).localcache, LOC9);
		result = ((Ttype216828*) (LOC10));
	}
	goto LA5;
	LA7: ;
	{
		result = searchinsttypes_285201(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_286391;
		NI HEX3Atmp_286725;
		NI LOC19;
		NI res_286728;
		i_286391 = 0;
		HEX3Atmp_286725 = 0;
		LOC19 = 0;
		LOC19 = sonslen_219327(t);
		HEX3Atmp_286725 = (NI)(LOC19 - ((NI) 1));
		res_286728 = ((NI) 1);
		{
			while (1) {
				Ttype216828* x;
				if (!(res_286728 <= HEX3Atmp_286725)) goto LA21;
				i_286391 = res_286728;
				x = (*t).sons->data[i_286391];
				{
					if (!((*x).kind == ((NU8) 12))) goto LA24;
					x = lookuptypevar_286217(cl, x);
					{
						if (!!((x == NIM_NIL))) goto LA28;
						{
							if (!(header == t)) goto LA32;
							header = instcopytype_286256(cl, t);
						}
						LA32: ;
						asgnRefNoCycle((void**) (&(*header).sons->data[i_286391]), x);
						propagatetoowner_220190(header, x);
					}
					LA28: ;
				}
				goto LA22;
				LA24: ;
				{
					propagatetoowner_220190(header, x);
				}
				LA22: ;
				res_286728 += ((NI) 1);
			} LA21: ;
		}
	}
	{
		if (!!((header == t))) goto LA37;
		result = searchinsttypes_285201(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_286256(cl, t);
	}
	LA35: ;
	result = newtype_219107(((NU8) 11), (*(*t).sons->data[((NI) 0)]).owner);
	(*result).flags = (*header).flags;
	if ((*result).sons) nimGCunrefNoCycle((*result).sons);
	(*result).sons = (Ttypeseq216824*) newSeqRC1((&NTI216824), 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_285446(result);
	}
	goto LA47;
	LA49: ;
	{
		Tidobj191006* LOC52;
		TNimObject* LOC53;
		LOC52 = 0;
		LOC52 = &t->Sup;
		LOC53 = 0;
		LOC53 = &result->Sup.Sup;
		idtableput_223115((&(*cl).localcache), LOC52, LOC53);
	}
	LA47: ;
	oldskiptypedesc = (*cl).skiptypedesc;
	(*cl).skiptypedesc = NIM_TRUE;
	{
		NI i_286509;
		NI HEX3Atmp_286733;
		NI LOC55;
		NI res_286736;
		i_286509 = 0;
		HEX3Atmp_286733 = 0;
		LOC55 = 0;
		LOC55 = sonslen_219327(t);
		HEX3Atmp_286733 = (NI)(LOC55 - ((NI) 1));
		res_286736 = ((NI) 1);
		{
			while (1) {
				Ttype216828* x;
				Tidobj191006* LOC58;
				TNimObject* LOC59;
				if (!(res_286736 <= HEX3Atmp_286733)) goto LA57;
				i_286509 = res_286736;
				x = replacetypevarst_285566(cl, (*t).sons->data[i_286509]);
				asgnRefNoCycle((void**) (&(*header).sons->data[i_286509]), x);
				propagatetoowner_220190(header, x);
				LOC58 = 0;
				LOC58 = &(*body).sons->data[(NI)(i_286509 - ((NI) 1))]->Sup;
				LOC59 = 0;
				LOC59 = &x->Sup.Sup;
				idtableput_223115((&(*cl).typemap), LOC58, LOC59);
				res_286736 += ((NI) 1);
			} LA57: ;
		}
	}
	{
		NI i_286613;
		NI HEX3Atmp_286741;
		NI LOC61;
		NI res_286744;
		i_286613 = 0;
		HEX3Atmp_286741 = 0;
		LOC61 = 0;
		LOC61 = sonslen_219327(t);
		HEX3Atmp_286741 = (NI)(LOC61 - ((NI) 1));
		res_286744 = ((NI) 1);
		{
			while (1) {
				if (!(res_286744 <= HEX3Atmp_286741)) goto LA63;
				i_286613 = res_286744;
				rawaddson_220408(result, (*header).sons->data[i_286613]);
				res_286744 += ((NI) 1);
			} LA63: ;
		}
	}
	LOC64 = 0;
	LOC64 = lastson_219377(body);
	newbody = replacetypevarst_285566(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_247584(newbody);
		if (!LOC67) goto LA68;
		newbody = skipgenericalias_247606(newbody);
	}
	LA68: ;
	rawaddson_220408(result, newbody);
	checkpartialconstructedtype_285048((*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(Tsym216822*, replacetypevarss_285546)(Trepltypevars285531* cl, Tsym216822* s) {
	Tsym216822* result;
	Tidobj191006* 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_223107((*cl).symmap, LOC11);
	result = ((Tsym216822*) (LOC12));
	{
		Tidobj191006* LOC17;
		TNimObject* LOC18;
		if (!(result == NIM_NIL)) goto LA15;
		result = copysym_219601(s, NIM_FALSE);
		(*result).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
		LOC17 = 0;
		LOC17 = &s->Sup;
		LOC18 = 0;
		LOC18 = &result->Sup.Sup;
		idtableput_223115((&(*cl).symmap), LOC17, LOC18);
		asgnRefNoCycle((void**) (&(*result).owner), (*s).owner);
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_285566(cl, (*s).typ));
		asgnRefNoCycle((void**) (&(*result).ast), replacetypevarsn_285551(cl, (*s).ast));
	}
	LA15: ;
	}BeforeRet: ;
	return result;
}

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

N_NIMCALL(Tnode216790*, preparenode_285601)(Trepltypevars285531* cl, Tnode216790* n) {
	Tnode216790* result;
	Ttype216828* t;
	NIM_BOOL iscall;
{	result = 0;
	t = replacetypevarst_285566(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_220542(n);
	asgnRefNoCycle((void**) (&(*result).typ), t);
	{
		if (!((*result).kind == ((NU8) 3))) goto LA11;
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_285546(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_285681;
		NI HEX3Atmp_285685;
		NI LOC14;
		NI res_285688;
		i_285681 = 0;
		HEX3Atmp_285685 = 0;
		LOC14 = 0;
		LOC14 = safelen_217081(n);
		HEX3Atmp_285685 = (LOC14 - 1);
		res_285688 = ((NI) 0);
		{
			while (1) {
				if (!(res_285688 <= HEX3Atmp_285685)) goto LA16;
				i_285681 = res_285688;
				{
					NIM_BOOL LOC19;
					Tnode216790* LOC23;
					LOC19 = 0;
					LOC19 = iscall;
					if (!(LOC19)) goto LA20;
					LOC19 = (i_285681 == ((NI) 0));
					LA20: ;
					if (!LOC19) goto LA21;
					LOC23 = 0;
					LOC23 = HEX5BHEX5D_217238(n, i_285681);
					add_217114(result, LOC23);
				}
				goto LA17;
				LA21: ;
				{
					Tnode216790* LOC25;
					Tnode216790* LOC26;
					LOC25 = 0;
					LOC25 = HEX5BHEX5D_217238(n, i_285681);
					LOC26 = 0;
					LOC26 = preparenode_285601(cl, LOC25);
					add_217114(result, LOC26);
				}
				LA17: ;
				res_285688 += ((NI) 1);
			} LA16: ;
		}
	}
	}BeforeRet: ;
	return result;
}

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

static N_INLINE(NI, len_217059)(Tnode216790* 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_286955)(Ttype216828* t, Tnode216790* n) {
{	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		NimStringDesc* LOC9;
		if (!!(!(((*n).kind == ((NU8) 140))))) goto LA7;
		LOC9 = 0;
		LOC9 = HEX24_189183(TMP2798);
		internalerror_189113(LOC9);
	}
	LA7: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		propagatetoowner_220190(t, (*(*n).kindU.S4.sym).typ);
	}
	break;
	case ((NU8) 138):
	case ((NU8) 139):
	case ((NU8) 85):
	case ((NU8) 88):
	{
		{
			Tnode216790* son_286986;
			son_286986 = 0;
			{
				NI i_286991;
				NI HEX3Atmp_286993;
				NI LOC14;
				NI res_286995;
				i_286991 = 0;
				HEX3Atmp_286993 = 0;
				LOC14 = 0;
				LOC14 = len_217059(n);
				HEX3Atmp_286993 = (LOC14 - 1);
				res_286995 = ((NI) 0);
				{
					while (1) {
						if (!(res_286995 <= HEX3Atmp_286993)) goto LA16;
						i_286991 = res_286995;
						son_286986 = (*n).kindU.S6.sons->data[i_286991];
						propagatefieldflags_286955(t, son_286986);
						res_286995 += ((NI) 1);
					} LA16: ;
				}
			}
		}
	}
	break;
	default:
	{
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, erasevoidparams_286748)(Ttype216828* 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_286789;
		NI HEX3Atmp_286869;
		NI LOC8;
		NI res_286872;
		i_286789 = 0;
		HEX3Atmp_286869 = 0;
		LOC8 = 0;
		LOC8 = sonslen_219327(t);
		HEX3Atmp_286869 = (LOC8 - 1);
		res_286872 = ((NI) 1);
		{
			while (1) {
				if (!(res_286872 <= HEX3Atmp_286869)) goto LA10;
				i_286789 = res_286872;
				{
					NI pos;
					if (!((*(*t).sons->data[i_286789]).kind == ((NU8) 3))) goto LA13;
					pos = i_286789;
					{
						NI j_286817;
						NI HEX3Atmp_286861;
						NI HEX3Atmp_286862;
						NI LOC16;
						NI res_286865;
						j_286817 = 0;
						HEX3Atmp_286861 = 0;
						HEX3Atmp_286862 = 0;
						HEX3Atmp_286861 = (NI)(i_286789 + ((NI) 1));
						LOC16 = 0;
						LOC16 = sonslen_219327(t);
						HEX3Atmp_286862 = (LOC16 - 1);
						res_286865 = HEX3Atmp_286861;
						{
							while (1) {
								if (!(res_286865 <= HEX3Atmp_286862)) goto LA18;
								j_286817 = res_286865;
								{
									if (!!(((*(*t).sons->data[j_286817]).kind == ((NU8) 3)))) goto LA21;
									asgnRefNoCycle((void**) (&(*t).sons->data[pos]), (*t).sons->data[j_286817]);
									asgnRefNoCycle((void**) (&(*(*t).n).kindU.S6.sons->data[pos]), (*(*t).n).kindU.S6.sons->data[j_286817]);
									pos += ((NI) 1);
								}
								LA21: ;
								res_286865 += ((NI) 1);
							} LA18: ;
						}
					}
					(*t).sons = (Ttypeseq216824*) setLengthSeq(&((*t).sons)->Sup, sizeof(Ttype216828*), ((NI) (pos)));
					(*(*t).n).kindU.S6.sons = (Tnodeseq216784*) setLengthSeq(&((*(*t).n).kindU.S6.sons)->Sup, sizeof(Tnode216790*), ((NI) (pos)));
					goto BeforeRet;
				}
				LA13: ;
				res_286872 += ((NI) 1);
			} LA10: ;
		}
	}
	}BeforeRet: ;
}

N_NIMCALL(void, skipintliteralparams_286876)(Ttype216828* t) {
	{
		NI i_286896;
		NI HEX3Atmp_286948;
		NI LOC2;
		NI res_286951;
		i_286896 = 0;
		HEX3Atmp_286948 = 0;
		LOC2 = 0;
		LOC2 = sonslen_219327(t);
		HEX3Atmp_286948 = (LOC2 - 1);
		res_286951 = ((NI) 0);
		{
			while (1) {
				if (!(res_286951 <= HEX3Atmp_286948)) goto LA4;
				i_286896 = res_286951;
				{
					Ttype216828* p;
					Ttype216828* skipped;
					p = (*t).sons->data[i_286896];
					{
						if (!(p == NIM_NIL)) goto LA8;
						goto LA5;
					}
					LA8: ;
					skipped = skipintlit_260651(p);
					{
						if (!!((skipped == p))) goto LA12;
						asgnRefNoCycle((void**) (&(*t).sons->data[i_286896]), skipped);
						{
							if (!(((NI) 0) < i_286896)) goto LA16;
							asgnRefNoCycle((void**) (&(*(*(*(*t).n).kindU.S6.sons->data[i_286896]).kindU.S4.sym).typ), skipped);
						}
						LA16: ;
					}
					LA12: ;
				} LA5: ;
				res_286951 += ((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_242021((*t).sons->data[((NI) 0)]));
	}
	LA22: ;
}

N_NIMCALL(Ttype216828*, replacetypevarstaux_285541)(Trepltypevars285531* cl, Ttype216828* t) {
	Ttype216828* result;
{	result = 0;
	result = t;
	{
		if (!(t == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		Ttype216828* lookup;
		Tidobj191006* 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_223107((*cl).typemap, LOC9);
		lookup = ((Ttype216828*) (LOC10));
		{
			if (!!((lookup == NIM_NIL))) goto LA13;
			result = lookup;
			goto BeforeRet;
		}
		LA13: ;
	}
	LA7: ;
	switch ((*t).kind) {
	case ((NU8) 9):
	{
		result = handlegenericinvocation_286316(cl, t);
	}
	break;
	case ((NU8) 10):
	{
		NimStringDesc* LOC17;
		LOC17 = 0;
		LOC17 = typetostring_242017(t, ((NU8) 0));
		localerror_189080((*cl).info, ((NU16) 128), LOC17);
		result = errortype_266901((*cl).c);
	}
	break;
	case ((NU8) 60):
	{
		Tnode216790* n;
		{
			if (!(*cl).allowmetatypes) goto LA21;
			goto BeforeRet;
		}
		LA21: ;
		n = preparenode_285601(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_220113((*n).typ, 256);
		}
		goto LA27;
		LA29: ;
		{
			{
				TY368877 LOC36;
				if (!!(((*(*n).typ).kind == ((NU8) 59)))) goto LA34;
				result = newtypes_266185(((NU8) 59), (*cl).c);
				if ((*result).sons) nimGCunrefNoCycle((*result).sons);
				(*result).sons = (Ttypeseq216824*) newSeqRC1((&NTI216824), 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_260651(t);
	}
	break;
	case ((NU8) 8):
	{
		Ttype216828* lookup;
		Tidobj191006* LOC40;
		TNimObject* LOC41;
		LOC40 = 0;
		LOC40 = &t->Sup;
		LOC41 = 0;
		LOC41 = idtableget_223107((*cl).typemap, LOC40);
		lookup = ((Ttype216828*) (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_242021(result);
			}
			LA50: ;
		}
		goto LA42;
		LA44: ;
		{
			Ttype216828* LOC55;
			if (!!(((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 0)))) goto LA53;
			LOC55 = 0;
			LOC55 = replacetypevarst_285566(cl, (*t).sons->data[((NI) 0)]);
			result = maketypedesc_266524((*cl).c, LOC55);
		}
		goto LA42;
		LA53: ;
		LA42: ;
	}
	break;
	case ((NU8) 52):
	{
		result = t;
	}
	break;
	case ((NU8) 11):
	{
		Tidobj191006* LOC68;
		TNimObject* LOC69;
		Ttype216828* LOC74;
		{
			Tidobj191006* LOC62;
			TNimObject* LOC63;
			if (!(((NI) 100) < (*cl).recursionlimit)) goto LA60;
			LOC62 = 0;
			LOC62 = &t->Sup;
			LOC63 = 0;
			LOC63 = idtableget_223107((*cl).localcache, LOC62);
			result = ((Ttype216828*) (LOC63));
			{
				if (!!((result == NIM_NIL))) goto LA66;
				goto BeforeRet;
			}
			LA66: ;
		}
		LA60: ;
		(*cl).recursionlimit += ((NI) 1);
		result = instcopytype_286256(cl, t);
		LOC68 = 0;
		LOC68 = &t->Sup;
		LOC69 = 0;
		LOC69 = &result->Sup.Sup;
		idtableput_223115((&(*cl).localcache), LOC68, LOC69);
		{
			NI i_287315;
			NI HEX3Atmp_287405;
			NI LOC71;
			NI res_287408;
			i_287315 = 0;
			HEX3Atmp_287405 = 0;
			LOC71 = 0;
			LOC71 = sonslen_219327(result);
			HEX3Atmp_287405 = (LOC71 - 1);
			res_287408 = ((NI) 1);
			{
				while (1) {
					if (!(res_287408 <= HEX3Atmp_287405)) goto LA73;
					i_287315 = res_287408;
					asgnRefNoCycle((void**) (&(*result).sons->data[i_287315]), replacetypevarst_285566(cl, (*result).sons->data[i_287315]));
					res_287408 += ((NI) 1);
				} LA73: ;
			}
		}
		LOC74 = 0;
		LOC74 = lastson_219377(result);
		propagatetoowner_220190(result, LOC74);
	}
	break;
	default:
	{
		{
			NIM_BOOL LOC78;
			Tidobj191006* LOC91;
			TNimObject* LOC92;
			LOC78 = 0;
			LOC78 = containsgenerictype_250492(t);
			if (!LOC78) goto LA79;
			{
				Tidobj191006* LOC85;
				TNimObject* LOC86;
				if (!(((NI) 100) < (*cl).recursionlimit)) goto LA83;
				LOC85 = 0;
				LOC85 = &t->Sup;
				LOC86 = 0;
				LOC86 = idtableget_223107((*cl).localcache, LOC85);
				result = ((Ttype216828*) (LOC86));
				{
					if (!!((result == NIM_NIL))) goto LA89;
					goto BeforeRet;
				}
				LA89: ;
			}
			LA83: ;
			(*cl).recursionlimit += ((NI) 1);
			result = instcopytype_286256(cl, t);
			(*result).size = IL64(-1);
			LOC91 = 0;
			LOC91 = &t->Sup;
			LOC92 = 0;
			LOC92 = &result->Sup.Sup;
			idtableput_223115((&(*cl).localcache), LOC91, LOC92);
			{
				NI i_287350;
				NI HEX3Atmp_287413;
				NI LOC94;
				NI res_287416;
				i_287350 = 0;
				HEX3Atmp_287413 = 0;
				LOC94 = 0;
				LOC94 = sonslen_219327(result);
				HEX3Atmp_287413 = (NI)(LOC94 - ((NI) 1));
				res_287416 = ((NI) 0);
				{
					while (1) {
						if (!(res_287416 <= HEX3Atmp_287413)) goto LA96;
						i_287350 = res_287416;
						{
							Ttype216828* r;
							if (!!(((*result).sons->data[i_287350] == NIM_NIL))) goto LA99;
							r = replacetypevarst_285566(cl, (*result).sons->data[i_287350]);
							{
								Ttype216828* r2;
								if (!((*result).kind == ((NU8) 17))) goto LA103;
								r2 = skiptypes_220113(r, 2048);
								{
									if (!((*r2).kind == ((NU8) 21) || (*r2).kind == ((NU8) 22))) goto LA107;
									r = skiptypes_220113(r2, 6291456);
								}
								LA107: ;
							}
							LA103: ;
							asgnRefNoCycle((void**) (&(*result).sons->data[i_287350]), r);
							propagatetoowner_220190(result, r);
						}
						LA99: ;
						res_287416 += ((NI) 1);
					} LA96: ;
				}
			}
			asgnRefNoCycle((void**) (&(*result).n), replacetypevarsn_285551(cl, (*result).n));
			switch ((*result).kind) {
			case ((NU8) 16):
			{
				Ttype216828* idx;
				idx = (*result).sons->data[((NI) 0)];
				{
					NimStringDesc* LOC114;
					if (!!(!(((*idx).kind == ((NU8) 59))))) goto LA112;
					LOC114 = 0;
					LOC114 = HEX24_189183(TMP2797);
					internalerror_189113(LOC114);
				}
				LA112: ;
			}
			break;
			case ((NU8) 17):
			case ((NU8) 18):
			{
				propagatefieldflags_286955(result, (*result).n);
			}
			break;
			case ((NU8) 25):
			{
				erasevoidparams_286748(result);
				skipintliteralparams_286876(result);
			}
			break;
			default:
			{
			}
			break;
			}
		}
		LA79: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype216828*, replacetypevarst_285566)(Trepltypevars285531* cl, Ttype216828* t) {
	Ttype216828* result;
	result = 0;
	result = replacetypevarstaux_285541(cl, t);
	return result;
}

N_NIMCALL(NIM_BOOL, istypeparam_285692)(Tnode216790* 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(Tnode216790*, reresolvecallswithtypedescparams_285827)(Trepltypevars285531* cl, Tnode216790* n) {
	Tnode216790* result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode216790* 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_217238(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_285874;
			NI HEX3Atmp_285901;
			NI LOC9;
			NI res_285904;
			i_285874 = 0;
			HEX3Atmp_285901 = 0;
			LOC9 = 0;
			LOC9 = safelen_217081(n);
			HEX3Atmp_285901 = (LOC9 - 1);
			res_285904 = ((NI) 1);
			{
				while (1) {
					if (!(res_285904 <= HEX3Atmp_285901)) goto LA11;
					i_285874 = res_285904;
					{
						Tnode216790* LOC14;
						NIM_BOOL LOC15;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_217238(n, i_285874);
						LOC15 = 0;
						LOC15 = istypeparam_285692(LOC14);
						if (!LOC15) goto LA16;
						needsfixing = NIM_TRUE;
					}
					LA16: ;
					res_285904 += ((NI) 1);
				} LA11: ;
			}
		}
		{
			if (!needsfixing) goto LA20;
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_218234((*(*(*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_285898;
		NI HEX3Atmp_285909;
		NI LOC23;
		NI res_285912;
		i_285898 = 0;
		HEX3Atmp_285909 = 0;
		LOC23 = 0;
		LOC23 = safelen_217081(n);
		HEX3Atmp_285909 = (LOC23 - 1);
		res_285912 = ((NI) 0);
		{
			while (1) {
				Tnode216790* LOC26;
				if (!(res_285912 <= HEX3Atmp_285909)) goto LA25;
				i_285898 = res_285912;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_217238(n, i_285898);
				asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_285898]), reresolvecallswithtypedescparams_285827(cl, LOC26));
				res_285912 += ((NI) 1);
			} LA25: ;
		}
	}
	result = n;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode216790*, replacetypevarsn_285551)(Trepltypevars285531* cl, Tnode216790* n_285555) {
	Tnode216790* result;
{	result = 0;
	{
		if (!(n_285555 == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	result = copynode_220542(n_285555);
	{
		if (!!(((*n_285555).typ == NIM_NIL))) goto LA7;
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_285566(cl, (*n_285555).typ));
	}
	LA7: ;
	switch ((*n_285555).kind) {
	case ((NU8) 0) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_285546(cl, (*n_285555).kindU.S4.sym));
		{
			Tnodeseq216784* LOC15;
			if (!((*(*(*result).kindU.S4.sym).typ).kind == ((NU8) 3))) goto LA13;
			LOC15 = 0;
			LOC15 = (Tnodeseq216784*) newSeq((&NTI216784), 0);
			result = newnode_218601(((NU8) 138), (*n_285555).info, LOC15, NIM_NIL);
		}
		LA13: ;
	}
	break;
	case ((NU8) 140):
	{
		Tnode216790* branch;
		branch = NIM_NIL;
		{
			NI i_286046;
			NI HEX3Atmp_286130;
			NI LOC18;
			NI res_286133;
			i_286046 = 0;
			HEX3Atmp_286130 = 0;
			LOC18 = 0;
			LOC18 = sonslen_219351(n_285555);
			HEX3Atmp_286130 = (NI)(LOC18 - ((NI) 1));
			res_286133 = ((NI) 0);
			{
				while (1) {
					Tnode216790* it;
					if (!(res_286133 <= HEX3Atmp_286130)) goto LA20;
					i_286046 = res_286133;
					it = (*n_285555).kindU.S6.sons->data[i_286046];
					{
						if (!(it == NIM_NIL)) goto LA23;
						illformedast_266950(n_285555);
					}
					LA23: ;
					switch ((*it).kind) {
					case ((NU8) 86):
					{
						Tnode216790* cond;
						Tnode216790* e;
						checksonslen_266958(it, ((NI) 2));
						cond = preparenode_285601(cl, (*it).kindU.S6.sons->data[((NI) 0)]);
						e = (*(*cl).c).semconstexpr((*cl).c, cond);
						{
							if (!!(((*e).kind == ((NU8) 6)))) goto LA28;
							internalerror_189100((*e).info, ((NimStringDesc*) &TMP2799));
						}
						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_266958(it, ((NI) 1));
						{
							if (!(branch == NIM_NIL)) goto LA39;
							branch = (*it).kindU.S6.sons->data[((NI) 0)];
						}
						LA39: ;
					}
					break;
					default:
					{
						illformedast_266950(n_285555);
					}
					break;
					}
					res_286133 += ((NI) 1);
				} LA20: ;
			}
		}
		{
			if (!!((branch == NIM_NIL))) goto LA44;
			result = replacetypevarsn_285551(cl, branch);
		}
		goto LA42;
		LA44: ;
		{
			result = newnodei_218248(((NU8) 138), (*n_285555).info);
		}
		LA42: ;
	}
	break;
	case ((NU8) 62):
	{
		Tnode216790* n;
		n = preparenode_285601(cl, n_285555);
		n = reresolvecallswithtypedescparams_285827(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_219351(n_285555);
		{
			if (!(((NI) 0) < length)) goto LA56;
			newsons_219260(result, length);
			{
				NI i_286125;
				NI HEX3Atmp_286138;
				NI res_286141;
				i_286125 = 0;
				HEX3Atmp_286138 = 0;
				HEX3Atmp_286138 = (NI)(length - ((NI) 1));
				res_286141 = ((NI) 0);
				{
					while (1) {
						if (!(res_286141 <= HEX3Atmp_286138)) goto LA60;
						i_286125 = res_286141;
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[i_286125]), replacetypevarsn_285551(cl, (*n_285555).kindU.S6.sons->data[i_286125]));
						res_286141 += ((NI) 1);
					} LA60: ;
				}
			}
		}
		LA56: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode216790*, replacetypesinbody_287430)(Tcontext266020* p, Tidtable216840 pt, Tnode216790* n, Tsym216822* owner) {
	Tnode216790* result;
	Trepltypevars285531 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_287420(p, pt, (*n).info, owner, (&cl));
	pushinfocontext_185209((*n).info);
	result = replacetypevarsn_285551((&cl), n);
	popinfocontext_185222();
	return result;
}

N_NIMCALL(Ttype216828*, generatetypeinstance_287450)(Tcontext266020* p, Tidtable216840 pt, Tlineinfo184337 info, Ttype216828* t) {
	Ttype216828* result;
	Trepltypevars285531 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_287420(p, pt, info, NIM_NIL, (&cl));
	pushinfocontext_185209(info);
	result = replacetypevarst_285566((&cl), t);
	popinfocontext_185222();
	return result;
}

N_NIMCALL(NIM_BOOL, hasgenericarguments_285737)(Tnode216790* 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_285817;
			NI HEX3Atmp_285820;
			NI LOC11;
			NI res_285823;
			i_285817 = 0;
			HEX3Atmp_285820 = 0;
			LOC11 = 0;
			LOC11 = safelen_217081(n);
			HEX3Atmp_285820 = (LOC11 - 1);
			res_285823 = ((NI) 0);
			{
				while (1) {
					if (!(res_285823 <= HEX3Atmp_285820)) goto LA13;
					i_285817 = res_285823;
					{
						NIM_BOOL LOC16;
						LOC16 = 0;
						LOC16 = hasgenericarguments_285737((*n).kindU.S6.sons->data[i_285817]);
						if (!LOC16) goto LA17;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA17: ;
					res_285823 += ((NI) 1);
				} LA13: ;
			}
		}
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, checkconstructedtype_285089)(Tlineinfo184337 info, Ttype216828* typ) {
	Ttype216828* t;
	t = skiptypes_220113(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;
		Ttype216828* LOC8;
		LOC6 = 0;
		LOC6 = (((*t).flags &(1U<<((NU)(((NU8) 4))&31U)))!=0);
		if (!(LOC6)) goto LA7;
		LOC8 = 0;
		LOC8 = skiptypes_220113(t, IL64(211106232576256));
		LOC6 = !(((*LOC8).kind == ((NU8) 17)));
		LA7: ;
		if (!LOC6) goto LA9;
		localerror_189080(info, ((NU16) 166), ((NimStringDesc*) &TMP2792));
	}
	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_189080(info, ((NU16) 202), ((NimStringDesc*) &TMP2793));
	}
	goto LA1;
	LA14: ;
	{
		NI64 LOC17;
		NimStringDesc* LOC20;
		LOC17 = 0;
		LOC17 = computesize_242121(t);
		if (!(LOC17 == IL64(-2))) goto LA18;
		LOC20 = 0;
		LOC20 = typetostring_242017(t, ((NU8) 0));
		localerror_189080(info, ((NU16) 127), LOC20);
	}
	goto LA1;
	LA18: ;
	{
		sharedptrcheck_285005(info, t);
	}
	LA1: ;
}
NIM_EXTERNC N_NOINLINE(void, compiler_semtypinstInit000)(void) {
}

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

