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

#include "nimbase.h"
#include <string.h>
typedef struct Tnode225809 Tnode225809;
typedef struct Tcontext280023 Tcontext280023;
typedef struct Tidtable225859 Tidtable225859;
typedef struct Tidpairseq225857 Tidpairseq225857;
typedef struct Tsym225841 Tsym225841;
typedef struct Trepltypevars302577 Trepltypevars302577;
typedef struct Tlineinfo190352 Tlineinfo190352;
typedef struct Ttype225847 Ttype225847;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tident198021 Tident198021;
typedef struct Tnodeseq225803 Tnodeseq225803;
typedef struct Tidobj198015 Tidobj198015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq225843 Ttypeseq225843;
typedef struct Tloc225823 Tloc225823;
typedef struct Ropeobj176009 Ropeobj176009;
typedef struct TY91159 TY91159;
typedef struct Tscope225835 Tscope225835;
typedef struct TY225944 TY225944;
typedef struct Tstrtable225813 Tstrtable225813;
typedef struct Tsymseq225811 Tsymseq225811;
typedef struct Tlib225827 Tlib225827;
typedef struct Cell49147 Cell49147;
typedef struct Cellseq49163 Cellseq49163;
typedef struct Gcheap51218 Gcheap51218;
typedef struct Gcstack51216 Gcstack51216;
typedef struct Cellset49159 Cellset49159;
typedef struct Pagedesc49155 Pagedesc49155;
typedef struct Memregion31091 Memregion31091;
typedef struct Smallchunk31043 Smallchunk31043;
typedef struct Llchunk31085 Llchunk31085;
typedef struct Bigchunk31045 Bigchunk31045;
typedef struct Intset31017 Intset31017;
typedef struct Trunk31013 Trunk31013;
typedef struct Avlnode31089 Avlnode31089;
typedef struct Gcstat51214 Gcstat51214;
typedef struct Tpasscontext277005 Tpasscontext277005;
typedef struct Tproccon280011 Tproccon280011;
typedef struct Intset222056 Intset222056;
typedef struct Trunk222052 Trunk222052;
typedef struct Trunkseq222054 Trunkseq222054;
typedef struct Tlinkedlist141028 Tlinkedlist141028;
typedef struct Tlistentry141022 Tlistentry141022;
typedef struct Tctx279048 Tctx279048;
typedef struct TY280143 TY280143;
typedef struct Tidpair225855 Tidpair225855;
typedef struct Tinstantiation225831 Tinstantiation225831;
typedef struct Basechunk31041 Basechunk31041;
typedef struct Freecell31033 Freecell31033;
typedef struct TY279254 TY279254;
typedef struct TY191417 TY191417;
typedef struct PprocHEX3Aobjecttype279233 PprocHEX3Aobjecttype279233;
typedef struct TY279273 TY279273;
typedef struct Tinstantiationpair280013 Tinstantiationpair280013;
typedef struct TY225932 TY225932;
typedef struct TY279234 TY279234;
typedef struct TY279239 TY279239;
typedef struct TY279274 TY279274;
typedef struct Vmargs279042 Vmargs279042;
typedef struct Tblock279030 Tblock279030;
typedef struct TY279214 TY279214;
struct  Tidtable225859  {
NI counter;
Tidpairseq225857* data;
};
struct  Tlineinfo190352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Trepltypevars302577  {
Tcontext280023* c;
Tidtable225859 typemap;
Tidtable225859 symmap;
Tidtable225859 localcache;
Tlineinfo190352 info;
NIM_BOOL allowmetatypes;
NIM_BOOL skiptypedesc;
Tsym225841* owner;
NI recursionlimit;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode225809  {
Ttype225847* typ;
Tlineinfo190352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym225841* sym;
} S4;
struct {Tident198021* ident;
} S5;
struct {Tnodeseq225803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
typedef N_NIMCALL_PTR(void, TY3889) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3894) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3889 marker;
TY3894 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj198015  {
  TNimObject Sup;
NI id;
};
struct  Tloc225823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype225847* t;
Ropeobj176009* r;
Ropeobj176009* heaproot;
};
struct  Ttype225847  {
  Tidobj198015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq225843* sons;
Tnode225809* n;
Tsym225841* owner;
Tsym225841* sym;
Tsym225841* destructor;
Tsym225841* deepcopy;
Tsym225841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc225823 loc;
};
struct TY91159 {
NimStringDesc* Field0;
NI Field1;
};
struct  Tstrtable225813  {
NI counter;
Tsymseq225811* data;
};
struct  Tsym225841  {
  Tidobj198015 Sup;
NU8 kind;
union{
struct {Ttypeseq225843* typeinstcache;
Tscope225835* typscope;
} S1;
struct {TY225944* procinstcache;
Tsym225841* gcunsafetyreason;
} S2;
struct {TY225944* usedgenerics;
Tstrtable225813 tab;
} S3;
struct {Tsym225841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype225847* typ;
Tident198021* name;
Tlineinfo190352 info;
Tsym225841* owner;
NU32 flags;
Tnode225809* ast;
NU32 options;
NI position;
NI offset;
Tloc225823 loc;
Tlib225827* annex;
Tnode225809* constraint;
};
struct  Cell49147  {
NI refcount;
TNimType* typ;
};
struct  Cellseq49163  {
NI len;
NI cap;
Cell49147** d;
};
struct  Cellset49159  {
NI counter;
NI max;
Pagedesc49155* head;
Pagedesc49155** data;
};
typedef Smallchunk31043* TY31106[512];
typedef Trunk31013* Trunkbuckets31015[256];
struct  Intset31017  {
Trunkbuckets31015 data;
};
struct  Memregion31091  {
NI minlargeobj;
NI maxlargeobj;
TY31106 freesmallchunks;
Llchunk31085* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk31045* freechunkslist;
Intset31017 chunkstarts;
Avlnode31089* root;
Avlnode31089* deleted;
Avlnode31089* last;
Avlnode31089* freeavlnodes;
};
struct  Gcstat51214  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap51218  {
Gcstack51216* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq49163 zct;
Cellseq49163 decstack;
Cellset49159 cycleroots;
Cellseq49163 tempstack;
NI recgclock;
Memregion31091 region;
Gcstat51214 stat;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef Ttype225847* TY393275[1];
struct  Tpasscontext277005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset222056  {
NI counter;
NI max;
Trunk222052* head;
Trunkseq222054* data;
};
struct  Tlinkedlist141028  {
Tlistentry141022* head;
Tlistentry141022* tail;
NI counter;
};
typedef N_NIMCALL_PTR(Tnode225809*, TY280074) (Tcontext280023* c, Tnode225809* n);
typedef N_NIMCALL_PTR(Tnode225809*, TY280079) (Tcontext280023* c, Tnode225809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode225809*, TY280087) (Tcontext280023* c, Tnode225809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode225809*, TY280095) (Tcontext280023* c, Tnode225809* n);
typedef N_NIMCALL_PTR(Tnode225809*, TY280100) (Tcontext280023* c, Tnode225809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode225809*, TY280108) (Tcontext280023* c, Tnode225809* n);
typedef N_NIMCALL_PTR(Tnode225809*, TY280113) (Tcontext280023* c, Tnode225809* n, Tnode225809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype225847*, TY280120) (Tcontext280023* c, Tnode225809* n, Ttype225847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode225809*, ClPrc) (Tcontext280023* c, Tidtable225859 pt, Tnode225809* n, void* ClEnv);
void* ClEnv;
} TY280126;
typedef struct {
N_NIMCALL_PTR(Tsym225841*, ClPrc) (Tcontext280023* c, Tsym225841* fn, Tidtable225859 pt, Tlineinfo190352 info, void* ClEnv);
void* ClEnv;
} TY280132;
typedef N_NIMCALL_PTR(Tsym225841*, TY280148) (Tcontext280023* c, Tsym225841* dc, Ttype225847* t, Tlineinfo190352 info, NU8 op);
struct  Tcontext280023  {
  Tpasscontext277005 Sup;
Tsym225841* module;
Tscope225835* currentscope;
Tscope225835* importtable;
Tscope225835* toplevelscope;
Tproccon280011* p;
Tsymseq225811* friendmodules;
NI instcounter;
Intset222056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq225811* converters;
Tsymseq225811* patterns;
Tlinkedlist141028 optionstack;
Tidtable225859 symmapping;
Tlinkedlist141028 libs;
TY280074 semconstexpr;
TY280079 semexpr;
TY280087 semtryexpr;
TY280095 semtryconstexpr;
TY280100 semoperand;
TY280108 semconstboolexpr;
TY280113 semoverloadedcall;
TY280120 semtypenode;
TY280126 seminferredlambda;
TY280132 semgenerateinstance;
Intset222056 includedfiles;
Tstrtable225813 userpragmas;
Tctx279048* evalcontext;
Intset222056 unknownidents;
TY280143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY280148 insttypeboundop;
};
struct  Tidpair225855  {
Tidobj198015* key;
TNimObject* val;
};
struct  Tident198021  {
  Tidobj198015 Sup;
NimStringDesc* s;
Tident198021* next;
NI h;
};
struct  Ropeobj176009  {
  TNimObject Sup;
Ropeobj176009* left;
Ropeobj176009* right;
NI length;
NimStringDesc* data;
};
struct  Tscope225835  {
NI depthlevel;
Tstrtable225813 symbols;
Tnodeseq225803* usingsyms;
Tscope225835* parent;
};
struct  Tlistentry141022  {
  TNimObject Sup;
Tlistentry141022* prev;
Tlistentry141022* next;
};
struct  Tlib225827  {
  Tlistentry141022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj176009* name;
Tnode225809* path;
};
struct  Gcstack51216  {
Gcstack51216* prev;
Gcstack51216* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY31022[8];
struct  Pagedesc49155  {
Pagedesc49155* next;
NI key;
TY31022 bits;
};
struct  Basechunk31041  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk31043  {
  Basechunk31041 Sup;
Smallchunk31043* next;
Smallchunk31043* prev;
Freecell31033* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk31085  {
NI size;
NI acc;
Llchunk31085* next;
};
struct  Bigchunk31045  {
  Basechunk31041 Sup;
Bigchunk31045* next;
Bigchunk31045* prev;
NI align;
NF data;
};
struct  Trunk31013  {
Trunk31013* next;
NI key;
TY31022 bits;
};
typedef Avlnode31089* TY31096[2];
struct  Avlnode31089  {
TY31096 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon280011  {
Tsym225841* owner;
Tsym225841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon280011* next;
NIM_BOOL wasforwarded;
Tnode225809* bracketexpr;
};
struct  Trunk222052  {
Trunk222052* next;
NI key;
TY31022 bits;
};
struct  Tctx279048  {
  Tpasscontext277005 Sup;
TY279254* code;
TY191417* debug;
Tnode225809* globals;
Tnode225809* constants;
Ttypeseq225843* types;
Tnode225809* currentexceptiona;
Tnode225809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype279233* prc;
Tsym225841* module;
Tnode225809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo190352 comesfromheuristic;
TY279273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair280013  {
Tsym225841* genericsym;
Tinstantiation225831* inst;
};
struct  Tinstantiation225831  {
Tsym225841* sym;
Ttypeseq225843* concretetypes;
TY225932* usedby;
NI compilesid;
};
struct  Freecell31033  {
Freecell31033* next;
NI zerofield;
};
struct TY279239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY279239 TY279242[256];
struct  PprocHEX3Aobjecttype279233  {
TY279234* blocks;
Tsym225841* sym;
TY279242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs279042* args, void* ClEnv);
void* ClEnv;
} Vmcallback279044;
struct TY279274 {
NimStringDesc* Field0;
Vmcallback279044 Field1;
};
struct  Tblock279030  {
Tsym225841* label;
TY279214* fixups;
};
struct  Vmargs279042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode225809* currentexception;
};
struct Ttypeseq225843 {
  TGenericSeq Sup;
  Ttype225847* data[SEQ_DECL_SIZE];
};
struct Tnodeseq225803 {
  TGenericSeq Sup;
  Tnode225809* data[SEQ_DECL_SIZE];
};
struct Tidpairseq225857 {
  TGenericSeq Sup;
  Tidpair225855 data[SEQ_DECL_SIZE];
};
struct TY225944 {
  TGenericSeq Sup;
  Tinstantiation225831* data[SEQ_DECL_SIZE];
};
struct Tsymseq225811 {
  TGenericSeq Sup;
  Tsym225841* data[SEQ_DECL_SIZE];
};
struct Trunkseq222054 {
  TGenericSeq Sup;
  Trunk222052* data[SEQ_DECL_SIZE];
};
struct TY280143 {
  TGenericSeq Sup;
  Tinstantiationpair280013 data[SEQ_DECL_SIZE];
};
struct TY279254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY191417 {
  TGenericSeq Sup;
  Tlineinfo190352 data[SEQ_DECL_SIZE];
};
struct TY279273 {
  TGenericSeq Sup;
  TY279274 data[SEQ_DECL_SIZE];
};
struct TY225932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY279234 {
  TGenericSeq Sup;
  Tblock279030 data[SEQ_DECL_SIZE];
};
struct TY279214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, inittypevars_304846)(Tcontext280023* p, Tidtable225859 pt, Tlineinfo190352 info, Tsym225841* owner, Trepltypevars302577* Result);
N_NIMCALL(void, initidtable_229057)(Tidtable225859* x);
N_NIMCALL(void, copyidtable_227091)(Tidtable225859* dest, Tidtable225859 src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, pushinfocontext_191578)(Tlineinfo190352 info);
N_NIMCALL(Tnode225809*, replacetypevarsn_302606)(Trepltypevars302577* cl, Tnode225809* n_302610);
N_NIMCALL(Tnode225809*, copynode_229660)(Tnode225809* src);
N_NIMCALL(Ttype225847*, replacetypevarst_302627)(Trepltypevars302577* cl, Ttype225847* t);
N_NIMCALL(Ttype225847*, replacetypevarstaux_302590)(Trepltypevars302577* cl, Ttype225847* t);
N_NIMCALL(TNimObject*, idtableget_233182)(Tidtable225859 t, Tidobj198015* key);
N_NIMCALL(Ttype225847*, handlegenericinvocation_303760)(Trepltypevars302577* cl, Ttype225847* t);
N_NIMCALL(void, internalerror_196172)(Tlineinfo190352 info, NimStringDesc* errmsg);
N_NIMCALL(Ttype225847*, searchinsttypes_302207)(Ttype225847* key);
N_NIMCALL(void, internalerror_196191)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_196279)(TY91159 x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_264739)(Ttypeseq225843* x, Ttypeseq225843* y);
N_NIMCALL(NIM_BOOL, comparetypes_262047)(Ttype225847* x, Ttype225847* y, NU8 cmp, NU8 flags);
N_NIMCALL(NI, sonslen_228351)(Ttype225847* n);
N_NIMCALL(Ttype225847*, lookuptypevar_303649)(Trepltypevars302577* cl, Ttype225847* t);
N_NIMCALL(void, localerror_196128)(Tlineinfo190352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, typetostring_255032)(Ttype225847* typ, NU8 prefer);
N_NIMCALL(Ttype225847*, errortype_281161)(Tcontext280023* c);
N_NIMCALL(void, idtableput_233196)(Tidtable225859* t, Tidobj198015* key, TNimObject* val);
N_NIMCALL(Ttype225847*, instcopytype_303694)(Trepltypevars302577* cl, Ttype225847* t);
N_NIMCALL(Ttype225847*, copytype_228542)(Ttype225847* t, Tsym225841* owner, NIM_BOOL keepid);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell49147*, usrtocell_52846)(void* usr);
static N_INLINE(void, rtladdzct_54404)(Cell49147* c);
N_NOINLINE(void, addzct_52817)(Cellseq49163* s, Cell49147* c);
N_NIMCALL(void, propagatetoowner_229274)(Ttype225847* owner, Ttype225847* elem);
N_NIMCALL(Ttype225847*, newtype_228140)(NU8 kind, Tsym225841* owner);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(void, cachetypeinst_302483)(Ttype225847* inst);
N_NIMCALL(Ttype225847*, lastson_228426)(Ttype225847* n);
N_NIMCALL(void, safeadd_302522)(Ttypeseq225843** x, Ttype225847* y);
N_NIMCALL(void, rawaddson_229498)(Ttype225847* father, Ttype225847* son);
N_NIMCALL(NIM_BOOL, isgenericalias_261091)(Ttype225847* t);
N_NIMCALL(Ttype225847*, skipgenericalias_261119)(Ttype225847* t);
N_NIMCALL(void, checkpartialconstructedtype_302063)(Tlineinfo190352 info, Ttype225847* t);
N_NIMCALL(Ttype225847*, skiptypes_229167)(Ttype225847* t, NU64 kinds);
N_NIMCALL(void, sharedptrcheck_302014)(Tlineinfo190352 info, Ttype225847* t);
N_NIMCALL(NI, len_228369)(Ttype225847* n);
static N_INLINE(NIM_BOOL, isgcedmem_229235)(Ttype225847* t);
N_NIMCALL(Tnode225809*, preparenode_302807)(Trepltypevars302577* cl, Tnode225809* n);
N_NIMCALL(Tsym225841*, replacetypevarss_302598)(Trepltypevars302577* cl, Tsym225841* s);
N_NIMCALL(Tsym225841*, copysym_228607)(Tsym225841* s, NIM_BOOL keepid);
static N_INLINE(NI, safelen_226126)(Tnode225809* n);
N_NIMCALL(void, add_226165)(Tnode225809* father, Tnode225809* son);
static N_INLINE(Tnode225809*, HEX5BHEX5D_226244)(Tnode225809* n, NI i);
N_NIMCALL(Ttype225847*, newtypes_280220)(NU8 kind, Tcontext280023* c);
static N_INLINE(Ttype225847*, skipintlit_274698)(Ttype225847* t);
N_NIMCALL(Ttype225847*, getsystype_274190)(NU8 kind);
N_NIMCALL(Ttype225847*, base_255039)(Ttype225847* t);
N_NIMCALL(Ttype225847*, maketypedesc_280683)(Tcontext280023* c, Ttype225847* typ);
N_NIMCALL(NIM_BOOL, containsgenerictype_264310)(Ttype225847* t);
N_NIMCALL(void, propagatefieldflags_304434)(Ttype225847* t, Tnode225809* n);
static N_INLINE(NI, len_226098)(Tnode225809* n);
N_NIMCALL(void, erasevoidparams_304182)(Ttype225847* t);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, skipintliteralparams_304336)(Ttype225847* t);
N_NIMCALL(Tnode225809*, newnode_227607)(NU8 kind, Tlineinfo190352 info, Tnodeseq225803* sons, Ttype225847* typ);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(NI, sonslen_228387)(Tnode225809* n);
N_NIMCALL(void, illformedast_281240)(Tnode225809* n);
N_NIMCALL(void, checksonslen_281260)(Tnode225809* n, NI length);
N_NIMCALL(Tnode225809*, newnodei_227351)(NU8 kind, Tlineinfo190352 info);
N_NIMCALL(Tnode225809*, reresolvecallswithtypedescparams_303071)(Trepltypevars302577* cl, Tnode225809* n);
N_NIMCALL(NIM_BOOL, istypeparam_302914)(Tnode225809* n);
N_NIMCALL(Tnode225809*, newsymnode_227325)(Tsym225841* sym);
N_NIMCALL(void, newsons_228272)(Tnode225809* father, NI length);
N_NIMCALL(void, popinfocontext_191597)(void);
N_NIMCALL(NIM_BOOL, hasgenericarguments_302965)(Tnode225809* n);
N_NIMCALL(NI64, computesize_255184)(Ttype225847* typ);
STRING_LITERAL(TMP2733, "no generic body", 15);
STRING_LITERAL(TMP2735, "compiler/semtypinst.nim", 23);
NIM_CONST TY91159 TMP2734 = {((NimStringDesc*) &TMP2735),
((NI) 52)}
;
STRING_LITERAL(TMP2740, "substitution with generic parameter", 35);
STRING_LITERAL(TMP2741, "acyclic", 7);
STRING_LITERAL(TMP2742, "", 0);
STRING_LITERAL(TMP2743, "shared memory may not refer to GC\'ed thread local memory", 56);
NIM_CONST TY91159 TMP2746 = {((NimStringDesc*) &TMP2735),
((NI) 477)}
;
NIM_CONST TY91159 TMP2747 = {((NimStringDesc*) &TMP2735),
((NI) 367)}
;
STRING_LITERAL(TMP2748, "ReplaceTypeVarsN: when condition not a bool", 43);
extern Gcheap51218 gch_51259;
extern TNimType NTI225843; /* TTypeSeq */
extern TNimType NTI225803; /* TNodeSeq */

N_NIMCALL(void, inittypevars_304846)(Tcontext280023* p, Tidtable225859 pt, Tlineinfo190352 info, Tsym225841* owner, Trepltypevars302577* Result) {
	initidtable_229057((&(*Result).symmap));
	copyidtable_227091((&(*Result).typemap), pt);
	initidtable_229057((&(*Result).localcache));
	(*Result).info = info;
	unsureAsgnRef((void**) (&(*Result).c), p);
	unsureAsgnRef((void**) (&(*Result).owner), owner);
}

N_NIMCALL(Ttype225847*, searchinsttypes_302207)(Ttype225847* key) {
	Ttype225847* result;
	Ttype225847* 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_196279(TMP2734);
		internalerror_196191(LOC9);
	}
	LA7: ;
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = HEX3DHEX3D_264739((*(*generictyp).sym).kindU.S1.typeinstcache, NIM_NIL);
		if (!LOC12) goto LA13;
		goto BeforeRet;
	}
	LA13: ;
	{
		Ttype225847* inst_302411;
		Ttypeseq225843* HEX3Atmp_302450;
		NI i_302453;
		NI L_302455;
		inst_302411 = 0;
		HEX3Atmp_302450 = 0;
		HEX3Atmp_302450 = (*(*generictyp).sym).kindU.S1.typeinstcache;
		i_302453 = ((NI) 0);
		L_302455 = (HEX3Atmp_302450 ? HEX3Atmp_302450->Sup.len : 0);
		{
			while (1) {
				if (!(i_302453 < L_302455)) goto LA17;
				inst_302411 = HEX3Atmp_302450->data[i_302453];
				{
					if (!((*inst_302411).Sup.id == (*key).Sup.id)) goto LA20;
					result = inst_302411;
					goto BeforeRet;
				}
				LA20: ;
				{
					if (!(((*inst_302411).sons ? (*inst_302411).sons->Sup.len : 0) < ((*key).sons ? (*key).sons->Sup.len : 0))) goto LA24;
					goto BeforeRet;
				}
				LA24: ;
				{
					{
						NI j_302439;
						NI HEX3Atmp_302443;
						NI res_302446;
						j_302439 = 0;
						HEX3Atmp_302443 = 0;
						HEX3Atmp_302443 = ((*key).sons ? ((*key).sons->Sup.len-1) : -1);
						res_302446 = ((NI) 1);
						{
							while (1) {
								if (!(res_302446 <= HEX3Atmp_302443)) goto LA29;
								j_302439 = res_302446;
								{
									NIM_BOOL LOC32;
									LOC32 = 0;
									LOC32 = comparetypes_262047((*inst_302411).sons->data[j_302439], (*key).sons->data[j_302439], ((NU8) 0), 8);
									if (!!(LOC32)) goto LA33;
									goto LA26;
								}
								LA33: ;
								res_302446 += ((NI) 1);
							} LA29: ;
						}
					}
					result = inst_302411;
					goto BeforeRet;
				} LA26: ;
				i_302453 += ((NI) 1);
			} LA17: ;
		}
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype225847*, lookuptypevar_303649)(Trepltypevars302577* cl, Ttype225847* t) {
	Ttype225847* result;
	Tidobj198015* LOC1;
	TNimObject* LOC2;
{	result = 0;
	LOC1 = 0;
	LOC1 = &t->Sup;
	LOC2 = 0;
	LOC2 = idtableget_233182((*cl).typemap, LOC1);
	result = ((Ttype225847*) (LOC2));
	{
		NimStringDesc* LOC13;
		Tidobj198015* LOC14;
		TNimObject* LOC15;
		if (!(result == NIM_NIL)) goto LA5;
		{
			NIM_BOOL LOC9;
			LOC9 = 0;
			LOC9 = (*cl).allowmetatypes;
			if (LOC9) goto LA10;
			LOC9 = (((*t).flags &(1<<((((NU8) 10))&31)))!=0);
			LA10: ;
			if (!LOC9) goto LA11;
			goto BeforeRet;
		}
		LA11: ;
		LOC13 = 0;
		LOC13 = typetostring_255032(t, ((NU8) 0));
		localerror_196128((*(*t).sym).info, ((NU16) 128), LOC13);
		result = errortype_281161((*cl).c);
		LOC14 = 0;
		LOC14 = &t->Sup;
		LOC15 = 0;
		LOC15 = &result->Sup.Sup;
		idtableput_233196((&(*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_196172((*cl).info, ((NimStringDesc*) &TMP2740));
	}
	goto LA3;
	LA19: ;
	LA3: ;
	}BeforeRet: ;
	return result;
}

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

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

static N_INLINE(void, rtladdzct_54404)(Cell49147* c) {
	addzct_52817((&gch_51259.zct), c);
}

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

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

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

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

N_NIMCALL(void, sharedptrcheck_302014)(Tlineinfo190352 info, Ttype225847* t) {
	{
		NIM_BOOL LOC3;
		NI LOC5;
		LOC3 = 0;
		LOC3 = ((*t).kind == ((NU8) 21));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = len_228369(t);
		LOC3 = (((NI) 1) < LOC5);
		LA4: ;
		if (!LOC3) goto LA6;
		{
			if (!((*(*(*t).sons->data[((NI) 0)]).sym).magic == ((NU8) 198))) goto LA10;
			(*t).flags |= ((NU32)1)<<((((NU8) 15))%(sizeof(NU32)*8));
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = (((*t).flags &(1<<((((NU8) 20))&31)))!=0);
				if (LOC14) goto LA15;
				LOC14 = isgcedmem_229235(t);
				LA15: ;
				if (!LOC14) goto LA16;
				localerror_196128(info, ((NU16) 4), ((NimStringDesc*) &TMP2743));
			}
			LA16: ;
		}
		LA10: ;
	}
	LA6: ;
}

N_NIMCALL(void, checkpartialconstructedtype_302063)(Tlineinfo190352 info, Ttype225847* t) {
	{
		NIM_BOOL LOC3;
		Ttype225847* LOC5;
		LOC3 = 0;
		LOC3 = (((*t).flags &(1<<((((NU8) 4))&31)))!=0);
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = skiptypes_229167(t, IL64(211106232576256));
		LOC3 = !(((*LOC5).kind == ((NU8) 17)));
		LA4: ;
		if (!LOC3) goto LA6;
		localerror_196128(info, ((NU16) 166), ((NimStringDesc*) &TMP2741));
	}
	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_196128(info, ((NU16) 202), ((NimStringDesc*) &TMP2742));
	}
	goto LA1;
	LA11: ;
	{
		sharedptrcheck_302014(info, t);
	}
	LA1: ;
}

N_NIMCALL(Ttype225847*, handlegenericinvocation_303760)(Trepltypevars302577* cl, Ttype225847* t) {
	Ttype225847* result;
	Ttype225847* body;
	Ttype225847* header;
	TY393275 LOC46;
	NIM_BOOL oldskiptypedesc;
	Ttype225847* newbody;
	Ttype225847* LOC64;
	Tsym225841* dc;
	Tsym225841* asgn;
{	result = 0;
	body = (*t).sons->data[((NI) 0)];
	{
		if (!!(((*body).kind == ((NU8) 10)))) goto LA3;
		internalerror_196172((*cl).info, ((NimStringDesc*) &TMP2733));
	}
	LA3: ;
	header = t;
	{
		Tidobj198015* LOC9;
		TNimObject* LOC10;
		if (!(*cl).allowmetatypes) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_233182((*cl).localcache, LOC9);
		result = ((Ttype225847*) (LOC10));
	}
	goto LA5;
	LA7: ;
	{
		result = searchinsttypes_302207(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_303836;
		NI HEX3Atmp_304126;
		NI LOC19;
		NI res_304129;
		i_303836 = 0;
		HEX3Atmp_304126 = 0;
		LOC19 = 0;
		LOC19 = sonslen_228351(t);
		HEX3Atmp_304126 = (NI)(LOC19 - ((NI) 1));
		res_304129 = ((NI) 1);
		{
			while (1) {
				Ttype225847* x;
				if (!(res_304129 <= HEX3Atmp_304126)) goto LA21;
				i_303836 = res_304129;
				x = (*t).sons->data[i_303836];
				{
					if (!((*x).kind == ((NU8) 12))) goto LA24;
					x = lookuptypevar_303649(cl, x);
					{
						if (!!((x == NIM_NIL))) goto LA28;
						{
							if (!(header == t)) goto LA32;
							header = instcopytype_303694(cl, t);
						}
						LA32: ;
						asgnRefNoCycle((void**) (&(*header).sons->data[i_303836]), x);
						propagatetoowner_229274(header, x);
					}
					LA28: ;
				}
				goto LA22;
				LA24: ;
				{
					propagatetoowner_229274(header, x);
				}
				LA22: ;
				res_304129 += ((NI) 1);
			} LA21: ;
		}
	}
	{
		if (!!((header == t))) goto LA37;
		result = searchinsttypes_302207(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_303694(cl, t);
	}
	LA35: ;
	result = newtype_228140(((NU8) 11), (*(*t).sons->data[((NI) 0)]).owner);
	(*result).flags = (*header).flags;
	if ((*result).sons) nimGCunrefNoCycle((*result).sons);
	(*result).sons = (Ttypeseq225843*) newSeqRC1((&NTI225843), 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_302483(result);
	}
	goto LA47;
	LA49: ;
	{
		Tidobj198015* LOC52;
		TNimObject* LOC53;
		LOC52 = 0;
		LOC52 = &t->Sup;
		LOC53 = 0;
		LOC53 = &result->Sup.Sup;
		idtableput_233196((&(*cl).localcache), LOC52, LOC53);
	}
	LA47: ;
	oldskiptypedesc = (*cl).skiptypedesc;
	(*cl).skiptypedesc = NIM_TRUE;
	{
		NI i_303955;
		NI HEX3Atmp_304134;
		NI LOC55;
		NI res_304137;
		i_303955 = 0;
		HEX3Atmp_304134 = 0;
		LOC55 = 0;
		LOC55 = sonslen_228351(t);
		HEX3Atmp_304134 = (NI)(LOC55 - ((NI) 1));
		res_304137 = ((NI) 1);
		{
			while (1) {
				Ttype225847* x;
				Tidobj198015* LOC58;
				TNimObject* LOC59;
				if (!(res_304137 <= HEX3Atmp_304134)) goto LA57;
				i_303955 = res_304137;
				x = replacetypevarst_302627(cl, (*t).sons->data[i_303955]);
				asgnRefNoCycle((void**) (&(*header).sons->data[i_303955]), x);
				propagatetoowner_229274(header, x);
				LOC58 = 0;
				LOC58 = &(*body).sons->data[(NI)(i_303955 - ((NI) 1))]->Sup;
				LOC59 = 0;
				LOC59 = &x->Sup.Sup;
				idtableput_233196((&(*cl).typemap), LOC58, LOC59);
				res_304137 += ((NI) 1);
			} LA57: ;
		}
	}
	{
		NI i_304014;
		NI HEX3Atmp_304142;
		NI LOC61;
		NI res_304145;
		i_304014 = 0;
		HEX3Atmp_304142 = 0;
		LOC61 = 0;
		LOC61 = sonslen_228351(t);
		HEX3Atmp_304142 = (NI)(LOC61 - ((NI) 1));
		res_304145 = ((NI) 1);
		{
			while (1) {
				if (!(res_304145 <= HEX3Atmp_304142)) goto LA63;
				i_304014 = res_304145;
				rawaddson_229498(result, (*header).sons->data[i_304014]);
				res_304145 += ((NI) 1);
			} LA63: ;
		}
	}
	LOC64 = 0;
	LOC64 = lastson_228426(body);
	newbody = replacetypevarst_302627(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_261091(newbody);
		if (!LOC67) goto LA68;
		newbody = skipgenericalias_261119(newbody);
	}
	LA68: ;
	rawaddson_229498(result, newbody);
	checkpartialconstructedtype_302063((*cl).info, newbody);
	dc = (*newbody).deepcopy;
	{
		NIM_BOOL LOC72;
		LOC72 = 0;
		LOC72 = !((dc == NIM_NIL));
		if (!(LOC72)) goto LA73;
		LOC72 = !((((*(*newbody).deepcopy).flags &(1<<((((NU8) 2))&31)))!=0));
		LA73: ;
		if (!LOC72) goto LA74;
		asgnRefNoCycle((void**) (&(*newbody).deepcopy), (*(*cl).c).insttypeboundop((*cl).c, dc, result, (*cl).info, ((NU8) 1)));
	}
	LA74: ;
	asgn = (*newbody).assignment;
	{
		NIM_BOOL LOC78;
		LOC78 = 0;
		LOC78 = !((asgn == NIM_NIL));
		if (!(LOC78)) goto LA79;
		LOC78 = !((((*asgn).flags &(1<<((((NU8) 2))&31)))!=0));
		LA79: ;
		if (!LOC78) goto LA80;
		asgnRefNoCycle((void**) (&(*newbody).assignment), (*(*cl).c).insttypeboundop((*cl).c, asgn, result, (*cl).info, ((NU8) 0)));
	}
	LA80: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym225841*, replacetypevarss_302598)(Trepltypevars302577* cl, Tsym225841* s) {
	Tsym225841* result;
	Tidobj198015* 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_233182((*cl).symmap, LOC11);
	result = ((Tsym225841*) (LOC12));
	{
		Tidobj198015* LOC17;
		TNimObject* LOC18;
		if (!(result == NIM_NIL)) goto LA15;
		result = copysym_228607(s, NIM_FALSE);
		(*result).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
		LOC17 = 0;
		LOC17 = &s->Sup;
		LOC18 = 0;
		LOC18 = &result->Sup.Sup;
		idtableput_233196((&(*cl).symmap), LOC17, LOC18);
		asgnRefNoCycle((void**) (&(*result).owner), (*s).owner);
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_302627(cl, (*s).typ));
		asgnRefNoCycle((void**) (&(*result).ast), replacetypevarsn_302606(cl, (*s).ast));
	}
	LA15: ;
	}BeforeRet: ;
	return result;
}

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

N_NIMCALL(Tnode225809*, preparenode_302807)(Trepltypevars302577* cl, Tnode225809* n) {
	Tnode225809* result;
	Ttype225847* t;
	NIM_BOOL iscall;
{	result = 0;
	t = replacetypevarst_302627(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_229660(n);
	asgnRefNoCycle((void**) (&(*result).typ), t);
	{
		if (!((*result).kind == ((NU8) 3))) goto LA11;
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_302598(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_302888;
		NI HEX3Atmp_302892;
		NI LOC14;
		NI res_302895;
		i_302888 = 0;
		HEX3Atmp_302892 = 0;
		LOC14 = 0;
		LOC14 = safelen_226126(n);
		HEX3Atmp_302892 = (LOC14 - 1);
		res_302895 = ((NI) 0);
		{
			while (1) {
				if (!(res_302895 <= HEX3Atmp_302892)) goto LA16;
				i_302888 = res_302895;
				{
					NIM_BOOL LOC19;
					Tnode225809* LOC23;
					LOC19 = 0;
					LOC19 = iscall;
					if (!(LOC19)) goto LA20;
					LOC19 = (i_302888 == ((NI) 0));
					LA20: ;
					if (!LOC19) goto LA21;
					LOC23 = 0;
					LOC23 = HEX5BHEX5D_226244(n, i_302888);
					add_226165(result, LOC23);
				}
				goto LA17;
				LA21: ;
				{
					Tnode225809* LOC25;
					Tnode225809* LOC26;
					LOC25 = 0;
					LOC25 = HEX5BHEX5D_226244(n, i_302888);
					LOC26 = 0;
					LOC26 = preparenode_302807(cl, LOC25);
					add_226165(result, LOC26);
				}
				LA17: ;
				res_302895 += ((NI) 1);
			} LA16: ;
		}
	}
	}BeforeRet: ;
	return result;
}

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

static N_INLINE(NI, len_226098)(Tnode225809* 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_304434)(Ttype225847* t, Tnode225809* n) {
{	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		NimStringDesc* LOC9;
		if (!!(!(((*n).kind == ((NU8) 140))))) goto LA7;
		LOC9 = 0;
		LOC9 = HEX24_196279(TMP2747);
		internalerror_196191(LOC9);
	}
	LA7: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		propagatetoowner_229274(t, (*(*n).kindU.S4.sym).typ);
	}
	break;
	case ((NU8) 138):
	case ((NU8) 139):
	case ((NU8) 85):
	case ((NU8) 88):
	{
		{
			Tnode225809* son_304465;
			son_304465 = 0;
			{
				NI i_304470;
				NI HEX3Atmp_304472;
				NI LOC14;
				NI res_304474;
				i_304470 = 0;
				HEX3Atmp_304472 = 0;
				LOC14 = 0;
				LOC14 = len_226098(n);
				HEX3Atmp_304472 = (LOC14 - 1);
				res_304474 = ((NI) 0);
				{
					while (1) {
						if (!(res_304474 <= HEX3Atmp_304472)) goto LA16;
						i_304470 = res_304474;
						son_304465 = (*n).kindU.S6.sons->data[i_304470];
						propagatefieldflags_304434(t, son_304465);
						res_304474 += ((NI) 1);
					} LA16: ;
				}
			}
		}
	}
	break;
	default:
	{
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, erasevoidparams_304182)(Ttype225847* 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_304224;
		NI HEX3Atmp_304305;
		NI LOC8;
		NI res_304308;
		i_304224 = 0;
		HEX3Atmp_304305 = 0;
		LOC8 = 0;
		LOC8 = sonslen_228351(t);
		HEX3Atmp_304305 = (LOC8 - 1);
		res_304308 = ((NI) 1);
		{
			while (1) {
				if (!(res_304308 <= HEX3Atmp_304305)) goto LA10;
				i_304224 = res_304308;
				{
					NI pos;
					if (!((*(*t).sons->data[i_304224]).kind == ((NU8) 3))) goto LA13;
					pos = i_304224;
					{
						NI j_304253;
						NI HEX3Atmp_304297;
						NI HEX3Atmp_304298;
						NI LOC16;
						NI res_304301;
						j_304253 = 0;
						HEX3Atmp_304297 = 0;
						HEX3Atmp_304298 = 0;
						HEX3Atmp_304297 = (NI)(i_304224 + ((NI) 1));
						LOC16 = 0;
						LOC16 = sonslen_228351(t);
						HEX3Atmp_304298 = (LOC16 - 1);
						res_304301 = HEX3Atmp_304297;
						{
							while (1) {
								if (!(res_304301 <= HEX3Atmp_304298)) goto LA18;
								j_304253 = res_304301;
								{
									if (!!(((*(*t).sons->data[j_304253]).kind == ((NU8) 3)))) goto LA21;
									asgnRefNoCycle((void**) (&(*t).sons->data[pos]), (*t).sons->data[j_304253]);
									asgnRefNoCycle((void**) (&(*(*t).n).kindU.S6.sons->data[pos]), (*(*t).n).kindU.S6.sons->data[j_304253]);
									pos += ((NI) 1);
								}
								LA21: ;
								res_304301 += ((NI) 1);
							} LA18: ;
						}
					}
					(*t).sons = (Ttypeseq225843*) setLengthSeq(&((*t).sons)->Sup, sizeof(Ttype225847*), ((NI) (pos)));
					(*(*t).n).kindU.S6.sons = (Tnodeseq225803*) setLengthSeq(&((*(*t).n).kindU.S6.sons)->Sup, sizeof(Tnode225809*), ((NI) (pos)));
					goto BeforeRet;
				}
				LA13: ;
				res_304308 += ((NI) 1);
			} LA10: ;
		}
	}
	}BeforeRet: ;
}

N_NIMCALL(void, skipintliteralparams_304336)(Ttype225847* t) {
	{
		NI i_304357;
		NI HEX3Atmp_304409;
		NI LOC2;
		NI res_304412;
		i_304357 = 0;
		HEX3Atmp_304409 = 0;
		LOC2 = 0;
		LOC2 = sonslen_228351(t);
		HEX3Atmp_304409 = (LOC2 - 1);
		res_304412 = ((NI) 0);
		{
			while (1) {
				if (!(res_304412 <= HEX3Atmp_304409)) goto LA4;
				i_304357 = res_304412;
				{
					Ttype225847* p;
					Ttype225847* skipped;
					p = (*t).sons->data[i_304357];
					{
						if (!(p == NIM_NIL)) goto LA8;
						goto LA5;
					}
					LA8: ;
					skipped = skipintlit_274698(p);
					{
						if (!!((skipped == p))) goto LA12;
						asgnRefNoCycle((void**) (&(*t).sons->data[i_304357]), skipped);
						{
							if (!(((NI) 0) < i_304357)) goto LA16;
							asgnRefNoCycle((void**) (&(*(*(*(*t).n).kindU.S6.sons->data[i_304357]).kindU.S4.sym).typ), skipped);
						}
						LA16: ;
					}
					LA12: ;
				} LA5: ;
				res_304412 += ((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_255039((*t).sons->data[((NI) 0)]));
	}
	LA22: ;
}

N_NIMCALL(Ttype225847*, replacetypevarstaux_302590)(Trepltypevars302577* cl, Ttype225847* t) {
	Ttype225847* result;
{	result = 0;
	result = t;
	{
		if (!(t == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		Ttype225847* lookup;
		Tidobj198015* LOC9;
		TNimObject* LOC10;
		if (!((IL64(1151232654746587136) &(IL64(1)<<(((*t).kind)&IL64(63))))!=0)) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_233182((*cl).typemap, LOC9);
		lookup = ((Ttype225847*) (LOC10));
		{
			if (!!((lookup == NIM_NIL))) goto LA13;
			result = lookup;
			goto BeforeRet;
		}
		LA13: ;
	}
	LA7: ;
	switch ((*t).kind) {
	case ((NU8) 9):
	{
		result = handlegenericinvocation_303760(cl, t);
	}
	break;
	case ((NU8) 10):
	{
		NimStringDesc* LOC17;
		LOC17 = 0;
		LOC17 = typetostring_255032(t, ((NU8) 0));
		localerror_196128((*cl).info, ((NU16) 128), LOC17);
		result = errortype_281161((*cl).c);
	}
	break;
	case ((NU8) 60):
	{
		Tnode225809* n;
		{
			if (!(*cl).allowmetatypes) goto LA21;
			goto BeforeRet;
		}
		LA21: ;
		n = preparenode_302807(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_229167((*n).typ, 256);
		}
		goto LA27;
		LA29: ;
		{
			{
				TY393275 LOC36;
				if (!!(((*(*n).typ).kind == ((NU8) 59)))) goto LA34;
				result = newtypes_280220(((NU8) 59), (*cl).c);
				if ((*result).sons) nimGCunrefNoCycle((*result).sons);
				(*result).sons = (Ttypeseq225843*) newSeqRC1((&NTI225843), 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_274698(t);
	}
	break;
	case ((NU8) 8):
	{
		Ttype225847* lookup;
		Tidobj198015* LOC40;
		TNimObject* LOC41;
		LOC40 = 0;
		LOC40 = &t->Sup;
		LOC41 = 0;
		LOC41 = idtableget_233182((*cl).typemap, LOC40);
		lookup = ((Ttype225847*) (LOC41));
		{
			if (!!((lookup == NIM_NIL))) goto LA44;
			result = lookup;
			{
				NIM_BOOL LOC48;
				LOC48 = 0;
				LOC48 = (((*t).flags &(1<<((((NU8) 9))&31)))!=0);
				if (LOC48) goto LA49;
				LOC48 = (*cl).skiptypedesc;
				LA49: ;
				if (!LOC48) goto LA50;
				result = base_255039(result);
			}
			LA50: ;
		}
		goto LA42;
		LA44: ;
		{
			Ttype225847* LOC55;
			if (!!(((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 0)))) goto LA53;
			LOC55 = 0;
			LOC55 = replacetypevarst_302627(cl, (*t).sons->data[((NI) 0)]);
			result = maketypedesc_280683((*cl).c, LOC55);
		}
		goto LA42;
		LA53: ;
		LA42: ;
	}
	break;
	case ((NU8) 52):
	{
		result = t;
	}
	break;
	case ((NU8) 11):
	{
		Tidobj198015* LOC68;
		TNimObject* LOC69;
		Ttype225847* LOC74;
		{
			Tidobj198015* LOC62;
			TNimObject* LOC63;
			if (!(((NI) 100) < (*cl).recursionlimit)) goto LA60;
			LOC62 = 0;
			LOC62 = &t->Sup;
			LOC63 = 0;
			LOC63 = idtableget_233182((*cl).localcache, LOC62);
			result = ((Ttype225847*) (LOC63));
			{
				if (!!((result == NIM_NIL))) goto LA66;
				goto BeforeRet;
			}
			LA66: ;
		}
		LA60: ;
		(*cl).recursionlimit += ((NI) 1);
		result = instcopytype_303694(cl, t);
		LOC68 = 0;
		LOC68 = &t->Sup;
		LOC69 = 0;
		LOC69 = &result->Sup.Sup;
		idtableput_233196((&(*cl).localcache), LOC68, LOC69);
		{
			NI i_304716;
			NI HEX3Atmp_304807;
			NI LOC71;
			NI res_304810;
			i_304716 = 0;
			HEX3Atmp_304807 = 0;
			LOC71 = 0;
			LOC71 = sonslen_228351(result);
			HEX3Atmp_304807 = (LOC71 - 1);
			res_304810 = ((NI) 1);
			{
				while (1) {
					if (!(res_304810 <= HEX3Atmp_304807)) goto LA73;
					i_304716 = res_304810;
					asgnRefNoCycle((void**) (&(*result).sons->data[i_304716]), replacetypevarst_302627(cl, (*result).sons->data[i_304716]));
					res_304810 += ((NI) 1);
				} LA73: ;
			}
		}
		LOC74 = 0;
		LOC74 = lastson_228426(result);
		propagatetoowner_229274(result, LOC74);
	}
	break;
	default:
	{
		{
			NIM_BOOL LOC78;
			Tidobj198015* LOC91;
			TNimObject* LOC92;
			LOC78 = 0;
			LOC78 = containsgenerictype_264310(t);
			if (!LOC78) goto LA79;
			{
				Tidobj198015* LOC85;
				TNimObject* LOC86;
				if (!(((NI) 100) < (*cl).recursionlimit)) goto LA83;
				LOC85 = 0;
				LOC85 = &t->Sup;
				LOC86 = 0;
				LOC86 = idtableget_233182((*cl).localcache, LOC85);
				result = ((Ttype225847*) (LOC86));
				{
					if (!!((result == NIM_NIL))) goto LA89;
					goto BeforeRet;
				}
				LA89: ;
			}
			LA83: ;
			(*cl).recursionlimit += ((NI) 1);
			result = instcopytype_303694(cl, t);
			(*result).size = IL64(-1);
			LOC91 = 0;
			LOC91 = &t->Sup;
			LOC92 = 0;
			LOC92 = &result->Sup.Sup;
			idtableput_233196((&(*cl).localcache), LOC91, LOC92);
			{
				NI i_304752;
				NI HEX3Atmp_304815;
				NI LOC94;
				NI res_304818;
				i_304752 = 0;
				HEX3Atmp_304815 = 0;
				LOC94 = 0;
				LOC94 = sonslen_228351(result);
				HEX3Atmp_304815 = (NI)(LOC94 - ((NI) 1));
				res_304818 = ((NI) 0);
				{
					while (1) {
						if (!(res_304818 <= HEX3Atmp_304815)) goto LA96;
						i_304752 = res_304818;
						{
							Ttype225847* r;
							if (!!(((*result).sons->data[i_304752] == NIM_NIL))) goto LA99;
							r = replacetypevarst_302627(cl, (*result).sons->data[i_304752]);
							{
								Ttype225847* r2;
								if (!((*result).kind == ((NU8) 17))) goto LA103;
								r2 = skiptypes_229167(r, 2048);
								{
									if (!((6291456 &(IL64(1)<<(((*r2).kind)&IL64(63))))!=0)) goto LA107;
									r = skiptypes_229167(r2, 6291456);
								}
								LA107: ;
							}
							LA103: ;
							asgnRefNoCycle((void**) (&(*result).sons->data[i_304752]), r);
							propagatetoowner_229274(result, r);
						}
						LA99: ;
						res_304818 += ((NI) 1);
					} LA96: ;
				}
			}
			asgnRefNoCycle((void**) (&(*result).n), replacetypevarsn_302606(cl, (*result).n));
			switch ((*result).kind) {
			case ((NU8) 16):
			{
				Ttype225847* idx;
				idx = (*result).sons->data[((NI) 0)];
				{
					NimStringDesc* LOC114;
					if (!!(!(((*idx).kind == ((NU8) 59))))) goto LA112;
					LOC114 = 0;
					LOC114 = HEX24_196279(TMP2746);
					internalerror_196191(LOC114);
				}
				LA112: ;
			}
			break;
			case ((NU8) 17):
			case ((NU8) 18):
			{
				propagatefieldflags_304434(result, (*result).n);
			}
			break;
			case ((NU8) 25):
			{
				erasevoidparams_304182(result);
				skipintliteralparams_304336(result);
			}
			break;
			default:
			{
			}
			break;
			}
		}
		LA79: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype225847*, replacetypevarst_302627)(Trepltypevars302577* cl, Ttype225847* t) {
	Ttype225847* result;
	result = 0;
	result = replacetypevarstaux_302590(cl, t);
	return result;
}

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

N_NIMCALL(Tnode225809*, reresolvecallswithtypedescparams_303071)(Trepltypevars302577* cl, Tnode225809* n) {
	Tnode225809* result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode225809* 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_226244(n, ((NI) 0));
		LOC3 = (((*(*LOC5).kindU.S4.sym).flags &(1<<((((NU8) 2))&31)))!=0);
		LA4: ;
		if (!LOC3) goto LA6;
		needsfixing = NIM_FALSE;
		{
			NI i_303119;
			NI HEX3Atmp_303147;
			NI LOC9;
			NI res_303150;
			i_303119 = 0;
			HEX3Atmp_303147 = 0;
			LOC9 = 0;
			LOC9 = safelen_226126(n);
			HEX3Atmp_303147 = (LOC9 - 1);
			res_303150 = ((NI) 1);
			{
				while (1) {
					if (!(res_303150 <= HEX3Atmp_303147)) goto LA11;
					i_303119 = res_303150;
					{
						Tnode225809* LOC14;
						NIM_BOOL LOC15;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_226244(n, i_303119);
						LOC15 = 0;
						LOC15 = istypeparam_302914(LOC14);
						if (!LOC15) goto LA16;
						needsfixing = NIM_TRUE;
					}
					LA16: ;
					res_303150 += ((NI) 1);
				} LA11: ;
			}
		}
		{
			if (!needsfixing) goto LA20;
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_227325((*(*(*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_303144;
		NI HEX3Atmp_303155;
		NI LOC23;
		NI res_303158;
		i_303144 = 0;
		HEX3Atmp_303155 = 0;
		LOC23 = 0;
		LOC23 = safelen_226126(n);
		HEX3Atmp_303155 = (LOC23 - 1);
		res_303158 = ((NI) 0);
		{
			while (1) {
				Tnode225809* LOC26;
				if (!(res_303158 <= HEX3Atmp_303155)) goto LA25;
				i_303144 = res_303158;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_226244(n, i_303144);
				asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_303144]), reresolvecallswithtypedescparams_303071(cl, LOC26));
				res_303158 += ((NI) 1);
			} LA25: ;
		}
	}
	result = n;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode225809*, replacetypevarsn_302606)(Trepltypevars302577* cl, Tnode225809* n_302610) {
	Tnode225809* result;
{	result = 0;
	{
		if (!(n_302610 == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	result = copynode_229660(n_302610);
	{
		if (!!(((*n_302610).typ == NIM_NIL))) goto LA7;
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_302627(cl, (*n_302610).typ));
	}
	LA7: ;
	switch ((*n_302610).kind) {
	case ((NU8) 0) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_302598(cl, (*n_302610).kindU.S4.sym));
		{
			Tnodeseq225803* LOC15;
			if (!((*(*(*result).kindU.S4.sym).typ).kind == ((NU8) 3))) goto LA13;
			LOC15 = 0;
			LOC15 = (Tnodeseq225803*) newSeq((&NTI225803), 0);
			result = newnode_227607(((NU8) 138), (*n_302610).info, LOC15, NIM_NIL);
		}
		LA13: ;
	}
	break;
	case ((NU8) 140):
	{
		Tnode225809* branch;
		branch = NIM_NIL;
		{
			NI i_303447;
			NI HEX3Atmp_303532;
			NI LOC18;
			NI res_303535;
			i_303447 = 0;
			HEX3Atmp_303532 = 0;
			LOC18 = 0;
			LOC18 = sonslen_228387(n_302610);
			HEX3Atmp_303532 = (NI)(LOC18 - ((NI) 1));
			res_303535 = ((NI) 0);
			{
				while (1) {
					Tnode225809* it;
					if (!(res_303535 <= HEX3Atmp_303532)) goto LA20;
					i_303447 = res_303535;
					it = (*n_302610).kindU.S6.sons->data[i_303447];
					{
						if (!(it == NIM_NIL)) goto LA23;
						illformedast_281240(n_302610);
					}
					LA23: ;
					switch ((*it).kind) {
					case ((NU8) 86):
					{
						Tnode225809* cond;
						Tnode225809* e;
						checksonslen_281260(it, ((NI) 2));
						cond = preparenode_302807(cl, (*it).kindU.S6.sons->data[((NI) 0)]);
						e = (*(*cl).c).semconstexpr((*cl).c, cond);
						{
							if (!!(((*e).kind == ((NU8) 6)))) goto LA28;
							internalerror_196172((*e).info, ((NimStringDesc*) &TMP2748));
						}
						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_281260(it, ((NI) 1));
						{
							if (!(branch == NIM_NIL)) goto LA39;
							branch = (*it).kindU.S6.sons->data[((NI) 0)];
						}
						LA39: ;
					}
					break;
					default:
					{
						illformedast_281240(n_302610);
					}
					break;
					}
					res_303535 += ((NI) 1);
				} LA20: ;
			}
		}
		{
			if (!!((branch == NIM_NIL))) goto LA44;
			result = replacetypevarsn_302606(cl, branch);
		}
		goto LA42;
		LA44: ;
		{
			result = newnodei_227351(((NU8) 138), (*n_302610).info);
		}
		LA42: ;
	}
	break;
	case ((NU8) 62):
	{
		Tnode225809* n;
		n = preparenode_302807(cl, n_302610);
		n = reresolvecallswithtypedescparams_303071(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_228387(n_302610);
		{
			if (!(((NI) 0) < length)) goto LA56;
			newsons_228272(result, length);
			{
				NI i_303527;
				NI HEX3Atmp_303540;
				NI res_303543;
				i_303527 = 0;
				HEX3Atmp_303540 = 0;
				HEX3Atmp_303540 = (NI)(length - ((NI) 1));
				res_303543 = ((NI) 0);
				{
					while (1) {
						if (!(res_303543 <= HEX3Atmp_303540)) goto LA60;
						i_303527 = res_303543;
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[i_303527]), replacetypevarsn_302606(cl, (*n_302610).kindU.S6.sons->data[i_303527]));
						res_303543 += ((NI) 1);
					} LA60: ;
				}
			}
		}
		LA56: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode225809*, replacetypesinbody_304862)(Tcontext280023* p, Tidtable225859 pt, Tnode225809* n, Tsym225841* owner) {
	Tnode225809* result;
	Trepltypevars302577 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_304846(p, pt, (*n).info, owner, (&cl));
	pushinfocontext_191578((*n).info);
	result = replacetypevarsn_302606((&cl), n);
	popinfocontext_191597();
	return result;
}

N_NIMCALL(Ttype225847*, generatetypeinstance_304894)(Tcontext280023* p, Tidtable225859 pt, Tlineinfo190352 info, Ttype225847* t) {
	Ttype225847* result;
	Trepltypevars302577 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_304846(p, pt, info, NIM_NIL, (&cl));
	pushinfocontext_191578(info);
	result = replacetypevarst_302627((&cl), t);
	popinfocontext_191597();
	return result;
}

N_NIMCALL(NIM_BOOL, hasgenericarguments_302965)(Tnode225809* 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_303046;
			NI HEX3Atmp_303049;
			NI LOC11;
			NI res_303052;
			i_303046 = 0;
			HEX3Atmp_303049 = 0;
			LOC11 = 0;
			LOC11 = safelen_226126(n);
			HEX3Atmp_303049 = (LOC11 - 1);
			res_303052 = ((NI) 0);
			{
				while (1) {
					if (!(res_303052 <= HEX3Atmp_303049)) goto LA13;
					i_303046 = res_303052;
					{
						NIM_BOOL LOC16;
						LOC16 = 0;
						LOC16 = hasgenericarguments_302965((*n).kindU.S6.sons->data[i_303046]);
						if (!LOC16) goto LA17;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA17: ;
					res_303052 += ((NI) 1);
				} LA13: ;
			}
		}
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, checkconstructedtype_302110)(Tlineinfo190352 info, Ttype225847* typ) {
	Ttype225847* t;
	t = skiptypes_229167(typ, 8192);
	{
		if (!((IL64(574208952489738240) &(IL64(1)<<(((*t).kind)&IL64(63))))!=0)) goto LA3;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		Ttype225847* LOC8;
		LOC6 = 0;
		LOC6 = (((*t).flags &(1<<((((NU8) 4))&31)))!=0);
		if (!(LOC6)) goto LA7;
		LOC8 = 0;
		LOC8 = skiptypes_229167(t, IL64(211106232576256));
		LOC6 = !(((*LOC8).kind == ((NU8) 17)));
		LA7: ;
		if (!LOC6) goto LA9;
		localerror_196128(info, ((NU16) 166), ((NimStringDesc*) &TMP2741));
	}
	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_196128(info, ((NU16) 202), ((NimStringDesc*) &TMP2742));
	}
	goto LA1;
	LA14: ;
	{
		NI64 LOC17;
		NimStringDesc* LOC20;
		LOC17 = 0;
		LOC17 = computesize_255184(t);
		if (!(LOC17 == IL64(-2))) goto LA18;
		LOC20 = 0;
		LOC20 = typetostring_255032(t, ((NU8) 0));
		localerror_196128(info, ((NU16) 127), LOC20);
	}
	goto LA1;
	LA18: ;
	{
		sharedptrcheck_302014(info, t);
	}
	LA1: ;
}
NIM_EXTERNC N_NOINLINE(void, compiler_semtypinstInit000)(void) {
}

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

