/* Generated by Nim Compiler v0.11.2 */
/*   (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 Tnode190813 Tnode190813;
typedef struct Tcontext244023 Tcontext244023;
typedef struct Tidtable190861 Tidtable190861;
typedef struct Tidpairseq190859 Tidpairseq190859;
typedef struct Trepltypevars265544 Trepltypevars265544;
typedef struct Tlineinfo163338 Tlineinfo163338;
typedef struct Ttype190849 Ttype190849;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tsym190843 Tsym190843;
typedef struct Tident167021 Tident167021;
typedef struct Tnodeseq190807 Tnodeseq190807;
typedef struct Tidobj167015 Tidobj167015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq190845 Ttypeseq190845;
typedef struct Tloc190827 Tloc190827;
typedef struct Ropeobj161009 Ropeobj161009;
typedef struct TY86545 TY86545;
typedef struct Tscope190837 Tscope190837;
typedef struct TY190944 TY190944;
typedef struct Tstrtable190817 Tstrtable190817;
typedef struct Tsymseq190815 Tsymseq190815;
typedef struct Tlib190831 Tlib190831;
typedef struct Tcell46547 Tcell46547;
typedef struct Tcellseq46563 Tcellseq46563;
typedef struct Tgcheap48416 Tgcheap48416;
typedef struct Tcellset46559 Tcellset46559;
typedef struct Tpagedesc46555 Tpagedesc46555;
typedef struct Tmemregion28410 Tmemregion28410;
typedef struct Tsmallchunk27640 Tsmallchunk27640;
typedef struct Tllchunk28404 Tllchunk28404;
typedef struct Tbigchunk27642 Tbigchunk27642;
typedef struct Tintset27617 Tintset27617;
typedef struct Ttrunk27613 Ttrunk27613;
typedef struct Tavlnode28408 Tavlnode28408;
typedef struct Tgcstat48414 Tgcstat48414;
typedef struct Tpasscontext241005 Tpasscontext241005;
typedef struct Tproccon244011 Tproccon244011;
typedef struct Intset187056 Intset187056;
typedef struct Ttrunk187052 Ttrunk187052;
typedef struct Ttrunkseq187054 Ttrunkseq187054;
typedef struct Tlinkedlist130028 Tlinkedlist130028;
typedef struct Tlistentry130022 Tlistentry130022;
typedef struct Tctx243048 Tctx243048;
typedef struct TY244141 TY244141;
typedef struct Tidpair190857 Tidpair190857;
typedef struct Tinstantiation190833 Tinstantiation190833;
typedef struct Tbasechunk27638 Tbasechunk27638;
typedef struct Tfreecell27630 Tfreecell27630;
typedef struct TY243253 TY243253;
typedef struct TY164033 TY164033;
typedef struct PprocHEX3Aobjecttype243232 PprocHEX3Aobjecttype243232;
typedef struct TY243272 TY243272;
typedef struct Tinstantiationpair244013 Tinstantiationpair244013;
typedef struct TY190933 TY190933;
typedef struct TY243233 TY243233;
typedef struct TY243239 TY243239;
typedef struct TY243273 TY243273;
typedef struct Vmargs243042 Vmargs243042;
typedef struct Tblock243030 Tblock243030;
typedef struct TY243213 TY243213;
struct  Tidtable190861  {
NI counter;
Tidpairseq190859* data;
};
struct  Tlineinfo163338  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Trepltypevars265544  {
Tcontext244023* c;
Tidtable190861 typemap;
Tidtable190861 symmap;
Tidtable190861 localcache;
Tlineinfo163338 info;
NIM_BOOL allowmetatypes;
NIM_BOOL skiptypedesc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode190813  {
Ttype190849* typ;
Tlineinfo163338 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym190843* sym;
} S4;
struct {Tident167021* ident;
} S5;
struct {Tnodeseq190807* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
typedef N_NIMCALL_PTR(void, TY3289) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3294) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3289 marker;
TY3294 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj167015  {
  TNimObject Sup;
NI id;
};
struct  Tloc190827  {
NU8 k;
NU8 s;
NU16 flags;
Ttype190849* t;
Ropeobj161009* r;
Ropeobj161009* heaproot;
};
struct  Ttype190849  {
  Tidobj167015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq190845* sons;
Tnode190813* n;
Tsym190843* owner;
Tsym190843* sym;
Tsym190843* destructor;
Tsym190843* deepcopy;
Tsym190843* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc190827 loc;
};
struct TY86545 {
NimStringDesc* Field0;
NI Field1;
};
struct  Tstrtable190817  {
NI counter;
Tsymseq190815* data;
};
struct  Tsym190843  {
  Tidobj167015 Sup;
NU8 kind;
union{
struct {Ttypeseq190845* typeinstcache;
Tscope190837* typscope;
} S1;
struct {TY190944* procinstcache;
Tsym190843* gcunsafetyreason;
} S2;
struct {TY190944* usedgenerics;
Tstrtable190817 tab;
} S3;
struct {Tsym190843* guard;
} S4;
} kindU;
NU16 magic;
Ttype190849* typ;
Tident167021* name;
Tlineinfo163338 info;
Tsym190843* owner;
NU32 flags;
Tnode190813* ast;
NU32 options;
NI position;
NI offset;
Tloc190827 loc;
Tlib190831* annex;
Tnode190813* constraint;
};
struct  Tcell46547  {
NI refcount;
TNimType* typ;
};
struct  Tcellseq46563  {
NI len;
NI cap;
Tcell46547** d;
};
struct  Tcellset46559  {
NI counter;
NI max;
Tpagedesc46555* head;
Tpagedesc46555** data;
};
typedef Tsmallchunk27640* TY28422[512];
typedef Ttrunk27613* Ttrunkbuckets27615[256];
struct  Tintset27617  {
Ttrunkbuckets27615 data;
};
struct  Tmemregion28410  {
NI minlargeobj;
NI maxlargeobj;
TY28422 freesmallchunks;
Tllchunk28404* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Tbigchunk27642* freechunkslist;
Tintset27617 chunkstarts;
Tavlnode28408* root;
Tavlnode28408* deleted;
Tavlnode28408* last;
Tavlnode28408* freeavlnodes;
};
struct  Tgcstat48414  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Tgcheap48416  {
void* stackbottom;
NI cyclethreshold;
Tcellseq46563 zct;
Tcellseq46563 decstack;
Tcellset46559 cycleroots;
Tcellseq46563 tempstack;
NI recgclock;
Tmemregion28410 region;
Tgcstat48414 stat;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef Ttype190849* TY349187[1];
struct  Tpasscontext241005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset187056  {
NI counter;
NI max;
Ttrunk187052* head;
Ttrunkseq187054* data;
};
struct  Tlinkedlist130028  {
Tlistentry130022* head;
Tlistentry130022* tail;
NI counter;
};
typedef N_NIMCALL_PTR(Tnode190813*, TY244072) (Tcontext244023* c, Tnode190813* n);
typedef N_NIMCALL_PTR(Tnode190813*, TY244077) (Tcontext244023* c, Tnode190813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode190813*, TY244085) (Tcontext244023* c, Tnode190813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode190813*, TY244093) (Tcontext244023* c, Tnode190813* n);
typedef N_NIMCALL_PTR(Tnode190813*, TY244098) (Tcontext244023* c, Tnode190813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode190813*, TY244106) (Tcontext244023* c, Tnode190813* n);
typedef N_NIMCALL_PTR(Tnode190813*, TY244111) (Tcontext244023* c, Tnode190813* n, Tnode190813* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype190849*, TY244118) (Tcontext244023* c, Tnode190813* n, Ttype190849* prev);
typedef struct {
N_NIMCALL_PTR(Tnode190813*, ClPrc) (Tcontext244023* c, Tidtable190861 pt, Tnode190813* n, void* ClEnv);
void* ClEnv;
} TY244124;
typedef struct {
N_NIMCALL_PTR(Tsym190843*, ClPrc) (Tcontext244023* c, Tsym190843* fn, Tidtable190861 pt, Tlineinfo163338 info, void* ClEnv);
void* ClEnv;
} TY244130;
typedef N_NIMCALL_PTR(Tsym190843*, TY244146) (Tcontext244023* c, Tsym190843* dc, Ttype190849* t, Tlineinfo163338 info, NU8 op);
struct  Tcontext244023  {
  Tpasscontext241005 Sup;
Tsym190843* module;
Tscope190837* currentscope;
Tscope190837* importtable;
Tscope190837* toplevelscope;
Tproccon244011* p;
Tsymseq190815* friendmodules;
NI instcounter;
Intset187056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI incompilescontext;
NI ingenericinst;
Tsymseq190815* converters;
Tsymseq190815* patterns;
Tlinkedlist130028 optionstack;
Tidtable190861 symmapping;
Tlinkedlist130028 libs;
TY244072 semconstexpr;
TY244077 semexpr;
TY244085 semtryexpr;
TY244093 semtryconstexpr;
TY244098 semoperand;
TY244106 semconstboolexpr;
TY244111 semoverloadedcall;
TY244118 semtypenode;
TY244124 seminferredlambda;
TY244130 semgenerateinstance;
Intset187056 includedfiles;
Tstrtable190817 userpragmas;
Tctx243048* evalcontext;
Intset187056 unknownidents;
TY244141* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY244146 insttypeboundop;
};
struct  Tidpair190857  {
Tidobj167015* key;
TNimObject* val;
};
struct  Tident167021  {
  Tidobj167015 Sup;
NimStringDesc* s;
Tident167021* next;
NI h;
};
struct  Ropeobj161009  {
  TNimObject Sup;
Ropeobj161009* left;
Ropeobj161009* right;
NI length;
NimStringDesc* data;
};
struct  Tscope190837  {
NI depthlevel;
Tstrtable190817 symbols;
Tnodeseq190807* usingsyms;
Tscope190837* parent;
};
struct  Tlistentry130022  {
  TNimObject Sup;
Tlistentry130022* prev;
Tlistentry130022* next;
};
struct  Tlib190831  {
  Tlistentry130022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj161009* name;
Tnode190813* path;
};
typedef NI TY27620[8];
struct  Tpagedesc46555  {
Tpagedesc46555* next;
NI key;
TY27620 bits;
};
struct  Tbasechunk27638  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Tsmallchunk27640  {
  Tbasechunk27638 Sup;
Tsmallchunk27640* next;
Tsmallchunk27640* prev;
Tfreecell27630* freelist;
NI free;
NI acc;
NF data;
};
struct  Tllchunk28404  {
NI size;
NI acc;
Tllchunk28404* next;
};
struct  Tbigchunk27642  {
  Tbasechunk27638 Sup;
Tbigchunk27642* next;
Tbigchunk27642* prev;
NI align;
NF data;
};
struct  Ttrunk27613  {
Ttrunk27613* next;
NI key;
TY27620 bits;
};
typedef Tavlnode28408* TY28414[2];
struct  Tavlnode28408  {
TY28414 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon244011  {
Tsym190843* owner;
Tsym190843* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon244011* next;
NIM_BOOL wasforwarded;
Tnode190813* bracketexpr;
};
struct  Ttrunk187052  {
Ttrunk187052* next;
NI key;
TY27620 bits;
};
struct  Tctx243048  {
  Tpasscontext241005 Sup;
TY243253* code;
TY164033* debug;
Tnode190813* globals;
Tnode190813* constants;
Ttypeseq190845* types;
Tnode190813* currentexceptiona;
Tnode190813* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype243232* prc;
Tsym190843* module;
Tnode190813* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo163338 comesfromheuristic;
TY243272* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair244013  {
Tsym190843* genericsym;
Tinstantiation190833* inst;
};
struct  Tinstantiation190833  {
Tsym190843* sym;
Ttypeseq190845* concretetypes;
TY190933* usedby;
};
struct  Tfreecell27630  {
Tfreecell27630* next;
NI zerofield;
};
struct TY243239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY243239 TY243236[256];
struct  PprocHEX3Aobjecttype243232  {
TY243233* blocks;
Tsym190843* sym;
TY243236 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs243042* args, void* ClEnv);
void* ClEnv;
} Vmcallback243044;
struct TY243273 {
NimStringDesc* Field0;
Vmcallback243044 Field1;
};
struct  Tblock243030  {
Tsym190843* label;
TY243213* fixups;
};
struct  Vmargs243042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode190813* currentexception;
};
struct Ttypeseq190845 {
  TGenericSeq Sup;
  Ttype190849* data[SEQ_DECL_SIZE];
};
struct Tnodeseq190807 {
  TGenericSeq Sup;
  Tnode190813* data[SEQ_DECL_SIZE];
};
struct Tidpairseq190859 {
  TGenericSeq Sup;
  Tidpair190857 data[SEQ_DECL_SIZE];
};
struct TY190944 {
  TGenericSeq Sup;
  Tinstantiation190833* data[SEQ_DECL_SIZE];
};
struct Tsymseq190815 {
  TGenericSeq Sup;
  Tsym190843* data[SEQ_DECL_SIZE];
};
struct Ttrunkseq187054 {
  TGenericSeq Sup;
  Ttrunk187052* data[SEQ_DECL_SIZE];
};
struct TY244141 {
  TGenericSeq Sup;
  Tinstantiationpair244013 data[SEQ_DECL_SIZE];
};
struct TY243253 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY164033 {
  TGenericSeq Sup;
  Tlineinfo163338 data[SEQ_DECL_SIZE];
};
struct TY243272 {
  TGenericSeq Sup;
  TY243273 data[SEQ_DECL_SIZE];
};
struct TY190933 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY243233 {
  TGenericSeq Sup;
  Tblock243030 data[SEQ_DECL_SIZE];
};
struct TY243213 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, inittypevars_267602)(Tcontext244023* p, Tidtable190861 pt, Tlineinfo163338 info, Trepltypevars265544* Result);
N_NIMCALL(void, initidtable_194057)(Tidtable190861* x);
N_NIMCALL(void, copyidtable_192091)(Tidtable190861* dest, Tidtable190861 src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, pushinfocontext_164189)(Tlineinfo163338 info);
N_NIMCALL(Tnode190813*, replacetypevarsn_265571)(Trepltypevars265544* cl, Tnode190813* n_265575);
N_NIMCALL(Tnode190813*, copynode_194640)(Tnode190813* src);
N_NIMCALL(Ttype190849*, replacetypevarst_265592)(Trepltypevars265544* cl, Ttype190849* t);
N_NIMCALL(Ttype190849*, replacetypevarstaux_265555)(Trepltypevars265544* cl, Ttype190849* t);
N_NIMCALL(TNimObject*, idtableget_198182)(Tidtable190861 t, Tidobj167015* key);
N_NIMCALL(Ttype190849*, handlegenericinvocation_266535)(Trepltypevars265544* cl, Ttype190849* t);
N_NIMCALL(void, internalerror_165199)(Tlineinfo163338 info, NimStringDesc* errmsg);
N_NIMCALL(Ttype190849*, searchinsttypes_265207)(Ttype190849* key);
N_NIMCALL(void, internalerror_165218)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_165306)(TY86545 x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_229739)(Ttypeseq190845* x, Ttypeseq190845* y);
N_NIMCALL(NIM_BOOL, comparetypes_227047)(Ttype190849* x, Ttype190849* y, NU8 cmp, NU8 flags);
N_NIMCALL(NI, sonslen_193351)(Ttype190849* n);
N_NIMCALL(Ttype190849*, lookuptypevar_266425)(Trepltypevars265544* cl, Ttype190849* t);
N_NIMCALL(void, localerror_165155)(Tlineinfo163338 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, typetostring_220032)(Ttype190849* typ, NU8 prefer);
N_NIMCALL(Ttype190849*, errortype_245150)(Tcontext244023* c);
N_NIMCALL(void, idtableput_198196)(Tidtable190861* t, Tidobj167015* key, TNimObject* val);
N_NIMCALL(Ttype190849*, instcopytype_266470)(Trepltypevars265544* cl, Ttype190849* t);
N_NIMCALL(Ttype190849*, copytype_193549)(Ttype190849* t, Tsym190843* owner, NIM_BOOL keepid);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Tcell46547*, usrtocell_50046)(void* usr);
static N_INLINE(void, rtladdzct_51604)(Tcell46547* c);
N_NOINLINE(void, addzct_50017)(Tcellseq46563* s, Tcell46547* c);
N_NIMCALL(void, propagatetoowner_194274)(Ttype190849* owner, Ttype190849* elem);
N_NIMCALL(Ttype190849*, newtype_193140)(NU8 kind, Tsym190843* owner);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(void, cachetypeinst_265483)(Ttype190849* inst);
N_NIMCALL(void, safeadd_265489)(Ttypeseq190845** x, Ttype190849* y);
N_NIMCALL(void, rawaddson_194478)(Ttype190849* father, Ttype190849* son);
N_NIMCALL(Ttype190849*, lastson_193442)(Ttype190849* n);
N_NIMCALL(NIM_BOOL, isgenericalias_226091)(Ttype190849* t);
N_NIMCALL(Ttype190849*, skipgenericalias_226119)(Ttype190849* t);
N_NIMCALL(void, checkpartialconstructedtype_265063)(Tlineinfo163338 info, Ttype190849* t);
N_NIMCALL(Ttype190849*, skiptypes_194167)(Ttype190849* t, NU64 kinds);
N_NIMCALL(void, sharedptrcheck_265014)(Tlineinfo163338 info, Ttype190849* t);
N_NIMCALL(NI, len_193377)(Ttype190849* n);
static N_INLINE(NIM_BOOL, isgcedmem_194235)(Ttype190849* t);
N_NIMCALL(Tnode190813*, preparenode_265607)(Trepltypevars265544* cl, Tnode190813* n);
N_NIMCALL(Tsym190843*, replacetypevarss_265563)(Trepltypevars265544* cl, Tsym190843* s);
N_NIMCALL(Tsym190843*, copysym_193607)(Tsym190843* s, NIM_BOOL keepid);
static N_INLINE(NI, safelen_191125)(Tnode190813* n);
N_NIMCALL(void, add_191164)(Tnode190813* father, Tnode190813* son);
static N_INLINE(Tnode190813*, HEX5BHEX5D_191244)(Tnode190813* n, NI i);
N_NIMCALL(Ttype190849*, newtypes_244218)(NU8 kind, Tcontext244023* c);
static N_INLINE(Ttype190849*, skipintlit_238698)(Ttype190849* t);
N_NIMCALL(Ttype190849*, getsystype_238030)(NU8 kind);
N_NIMCALL(Ttype190849*, base_220039)(Ttype190849* t);
N_NIMCALL(Ttype190849*, maketypedesc_244681)(Tcontext244023* c, Ttype190849* typ);
N_NIMCALL(NIM_BOOL, containsgenerictype_229310)(Ttype190849* t);
N_NIMCALL(void, propagatefieldflags_267234)(Ttype190849* t, Tnode190813* n);
static N_INLINE(NI, len_191097)(Tnode190813* n);
N_NIMCALL(void, erasevoidparams_266982)(Ttype190849* t);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, skipintliteralparams_267136)(Ttype190849* t);
N_NIMCALL(Tnode190813*, newnode_192607)(NU8 kind, Tlineinfo163338 info, Tnodeseq190807* sons, Ttype190849* typ);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(NI, sonslen_193403)(Tnode190813* n);
N_NIMCALL(void, illformedast_245229)(Tnode190813* n);
N_NIMCALL(void, checksonslen_245249)(Tnode190813* n, NI length);
N_NIMCALL(Tnode190813*, newnodei_192351)(NU8 kind, Tlineinfo163338 info);
N_NIMCALL(Tnode190813*, reresolvecallswithtypedescparams_265871)(Trepltypevars265544* cl, Tnode190813* n);
N_NIMCALL(NIM_BOOL, istypeparam_265714)(Tnode190813* n);
N_NIMCALL(Tnode190813*, newsymnode_192325)(Tsym190843* sym);
N_NIMCALL(void, newsons_193272)(Tnode190813* father, NI length);
N_NIMCALL(void, popinfocontext_164208)(void);
N_NIMCALL(NIM_BOOL, hasgenericarguments_265765)(Tnode190813* n);
N_NIMCALL(NI64, computesize_220184)(Ttype190849* typ);
STRING_LITERAL(TMP2622, "no generic body", 15);
STRING_LITERAL(TMP2624, "semtypinst.nim", 14);
NIM_CONST TY86545 TMP2623 = {((NimStringDesc*) &TMP2624),
((NI) 52)}
;
STRING_LITERAL(TMP2629, "substitution with generic parameter", 35);
STRING_LITERAL(TMP2630, "acyclic", 7);
STRING_LITERAL(TMP2631, "", 0);
STRING_LITERAL(TMP2632, "shared memory may not refer to GC\'ed thread local memory", 56);
NIM_CONST TY86545 TMP2635 = {((NimStringDesc*) &TMP2624),
((NI) 451)}
;
NIM_CONST TY86545 TMP2636 = {((NimStringDesc*) &TMP2624),
((NI) 358)}
;
STRING_LITERAL(TMP2637, "ReplaceTypeVarsN: when condition not a bool", 43);
extern Tgcheap48416 gch_48444;
extern TNimType NTI190845; /* TTypeSeq */
extern TNimType NTI190807; /* TNodeSeq */

N_NIMCALL(void, inittypevars_267602)(Tcontext244023* p, Tidtable190861 pt, Tlineinfo163338 info, Trepltypevars265544* Result) {
	initidtable_194057((&(*Result).symmap));
	copyidtable_192091((&(*Result).typemap), pt);
	initidtable_194057((&(*Result).localcache));
	(*Result).info = info;
	unsureAsgnRef((void**) (&(*Result).c), p);
}

N_NIMCALL(Ttype190849*, searchinsttypes_265207)(Ttype190849* key) {
	Ttype190849* result;
	Ttype190849* 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_165306(TMP2623);
		internalerror_165218(LOC9);
	}
	LA7: ;
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = HEX3DHEX3D_229739((*(*generictyp).sym).kindU.S1.typeinstcache, NIM_NIL);
		if (!LOC12) goto LA13;
		goto BeforeRet;
	}
	LA13: ;
	{
		Ttype190849* inst_265411;
		Ttypeseq190845* HEX3Atmp_265450;
		NI i_265453;
		NI L_265455;
		inst_265411 = 0;
		HEX3Atmp_265450 = 0;
		HEX3Atmp_265450 = (*(*generictyp).sym).kindU.S1.typeinstcache;
		i_265453 = ((NI) 0);
		L_265455 = (HEX3Atmp_265450 ? HEX3Atmp_265450->Sup.len : 0);
		{
			while (1) {
				if (!(i_265453 < L_265455)) goto LA17;
				inst_265411 = HEX3Atmp_265450->data[i_265453];
				{
					if (!((*inst_265411).Sup.id == (*key).Sup.id)) goto LA20;
					result = inst_265411;
					goto BeforeRet;
				}
				LA20: ;
				{
					if (!(((*inst_265411).sons ? (*inst_265411).sons->Sup.len : 0) < ((*key).sons ? (*key).sons->Sup.len : 0))) goto LA24;
					goto BeforeRet;
				}
				LA24: ;
				{
					{
						NI j_265439;
						NI HEX3Atmp_265443;
						NI res_265446;
						j_265439 = 0;
						HEX3Atmp_265443 = 0;
						HEX3Atmp_265443 = ((*key).sons ? ((*key).sons->Sup.len-1) : -1);
						res_265446 = ((NI) 1);
						{
							while (1) {
								if (!(res_265446 <= HEX3Atmp_265443)) goto LA29;
								j_265439 = res_265446;
								{
									NIM_BOOL LOC32;
									LOC32 = 0;
									LOC32 = comparetypes_227047((*inst_265411).sons->data[j_265439], (*key).sons->data[j_265439], ((NU8) 0), 8);
									if (!!(LOC32)) goto LA33;
									goto LA26;
								}
								LA33: ;
								res_265446 += ((NI) 1);
							} LA29: ;
						}
					}
					result = inst_265411;
					goto BeforeRet;
				} LA26: ;
				i_265453 += ((NI) 1);
			} LA17: ;
		}
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype190849*, lookuptypevar_266425)(Trepltypevars265544* cl, Ttype190849* t) {
	Ttype190849* result;
	Tidobj167015* LOC1;
	TNimObject* LOC2;
{	result = 0;
	LOC1 = 0;
	LOC1 = &t->Sup;
	LOC2 = 0;
	LOC2 = idtableget_198182((*cl).typemap, LOC1);
	result = ((Ttype190849*) (LOC2));
	{
		NimStringDesc* LOC13;
		Tidobj167015* 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_220032(t, ((NU8) 0));
		localerror_165155((*(*t).sym).info, ((NU16) 124), LOC13);
		result = errortype_245150((*cl).c);
		LOC14 = 0;
		LOC14 = &t->Sup;
		LOC15 = 0;
		LOC15 = &result->Sup.Sup;
		idtableput_198196((&(*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_165199((*cl).info, ((NimStringDesc*) &TMP2629));
	}
	goto LA3;
	LA19: ;
	LA3: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype190849*, instcopytype_266470)(Trepltypevars265544* cl, Ttype190849* t) {
	Ttype190849* result;
	result = 0;
	result = copytype_193549(t, (*t).owner, (*cl).allowmetatypes);
	(*result).flags |= ((NI32)1)<<((((NU8) 8))%(sizeof(NI32)*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(Tcell46547*, usrtocell_50046)(void* usr) {
	Tcell46547* result;
	result = 0;
	result = ((Tcell46547*) ((NI)((NU64)(((NI) (usr))) - (NU64)(((NI)sizeof(Tcell46547))))));
	return result;
}

static N_INLINE(void, rtladdzct_51604)(Tcell46547* c) {
	addzct_50017((&gch_48444.zct), c);
}

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

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

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

static N_INLINE(NIM_BOOL, isgcedmem_194235)(Ttype190849* 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_265014)(Tlineinfo163338 info, Ttype190849* t) {
	{
		NIM_BOOL LOC3;
		NI LOC5;
		LOC3 = 0;
		LOC3 = ((*t).kind == ((NU8) 21));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = len_193377(t);
		LOC3 = (((NI) 1) < LOC5);
		LA4: ;
		if (!LOC3) goto LA6;
		{
			if (!((*(*(*t).sons->data[((NI) 0)]).sym).magic == ((NU16) 210))) goto LA10;
			(*t).flags |= ((NI32)1)<<((((NU8) 15))%(sizeof(NI32)*8));
			{
				NIM_BOOL LOC14;
				LOC14 = 0;
				LOC14 = (((*t).flags &(1<<((((NU8) 20))&31)))!=0);
				if (LOC14) goto LA15;
				LOC14 = isgcedmem_194235(t);
				LA15: ;
				if (!LOC14) goto LA16;
				localerror_165155(info, ((NU16) 4), ((NimStringDesc*) &TMP2632));
			}
			LA16: ;
		}
		LA10: ;
	}
	LA6: ;
}

N_NIMCALL(void, checkpartialconstructedtype_265063)(Tlineinfo163338 info, Ttype190849* t) {
	{
		NIM_BOOL LOC3;
		Ttype190849* LOC5;
		LOC3 = 0;
		LOC3 = (((*t).flags &(1<<((((NU8) 4))&31)))!=0);
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = skiptypes_194167(t, IL64(211106232576256));
		LOC3 = !(((*LOC5).kind == ((NU8) 17)));
		LA4: ;
		if (!LOC3) goto LA6;
		localerror_165155(info, ((NU16) 162), ((NimStringDesc*) &TMP2630));
	}
	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_165155(info, ((NU16) 197), ((NimStringDesc*) &TMP2631));
	}
	goto LA1;
	LA11: ;
	{
		sharedptrcheck_265014(info, t);
	}
	LA1: ;
}

N_NIMCALL(Ttype190849*, handlegenericinvocation_266535)(Trepltypevars265544* cl, Ttype190849* t) {
	Ttype190849* result;
	Ttype190849* body;
	Ttype190849* header;
	TY349187 LOC46;
	NIM_BOOL oldskiptypedesc;
	Ttype190849* newbody;
	Ttype190849* LOC64;
	Tsym190843* dc;
	Tsym190843* asgn;
{	result = 0;
	body = (*t).sons->data[((NI) 0)];
	{
		if (!!(((*body).kind == ((NU8) 10)))) goto LA3;
		internalerror_165199((*cl).info, ((NimStringDesc*) &TMP2622));
	}
	LA3: ;
	header = t;
	{
		Tidobj167015* LOC9;
		TNimObject* LOC10;
		if (!(*cl).allowmetatypes) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_198182((*cl).localcache, LOC9);
		result = ((Ttype190849*) (LOC10));
	}
	goto LA5;
	LA7: ;
	{
		result = searchinsttypes_265207(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_266611;
		NI HEX3Atmp_266926;
		NI LOC19;
		NI res_266929;
		i_266611 = 0;
		HEX3Atmp_266926 = 0;
		LOC19 = 0;
		LOC19 = sonslen_193351(t);
		HEX3Atmp_266926 = (NI)(LOC19 - ((NI) 1));
		res_266929 = ((NI) 1);
		{
			while (1) {
				Ttype190849* x;
				if (!(res_266929 <= HEX3Atmp_266926)) goto LA21;
				i_266611 = res_266929;
				x = (*t).sons->data[i_266611];
				{
					if (!((*x).kind == ((NU8) 12))) goto LA24;
					x = lookuptypevar_266425(cl, x);
					{
						if (!!((x == NIM_NIL))) goto LA28;
						{
							if (!(header == t)) goto LA32;
							header = instcopytype_266470(cl, t);
						}
						LA32: ;
						asgnRefNoCycle((void**) (&(*header).sons->data[i_266611]), x);
						propagatetoowner_194274(header, x);
					}
					LA28: ;
				}
				goto LA22;
				LA24: ;
				{
					propagatetoowner_194274(header, x);
				}
				LA22: ;
				res_266929 += ((NI) 1);
			} LA21: ;
		}
	}
	{
		if (!!((header == t))) goto LA37;
		result = searchinsttypes_265207(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_266470(cl, t);
	}
	LA35: ;
	result = newtype_193140(((NU8) 11), (*(*t).sons->data[((NI) 0)]).owner);
	(*result).flags = (*header).flags;
	if ((*result).sons) nimGCunrefNoCycle((*result).sons);
	(*result).sons = (Ttypeseq190845*) newSeqRC1((&NTI190845), 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_265483(result);
	}
	goto LA47;
	LA49: ;
	{
		Tidobj167015* LOC52;
		TNimObject* LOC53;
		LOC52 = 0;
		LOC52 = &t->Sup;
		LOC53 = 0;
		LOC53 = &result->Sup.Sup;
		idtableput_198196((&(*cl).localcache), LOC52, LOC53);
	}
	LA47: ;
	oldskiptypedesc = (*cl).skiptypedesc;
	(*cl).skiptypedesc = NIM_TRUE;
	{
		NI i_266730;
		NI HEX3Atmp_266934;
		NI LOC55;
		NI res_266937;
		i_266730 = 0;
		HEX3Atmp_266934 = 0;
		LOC55 = 0;
		LOC55 = sonslen_193351(t);
		HEX3Atmp_266934 = (NI)(LOC55 - ((NI) 1));
		res_266937 = ((NI) 1);
		{
			while (1) {
				Ttype190849* x;
				Tidobj167015* LOC58;
				TNimObject* LOC59;
				if (!(res_266937 <= HEX3Atmp_266934)) goto LA57;
				i_266730 = res_266937;
				x = replacetypevarst_265592(cl, (*t).sons->data[i_266730]);
				asgnRefNoCycle((void**) (&(*header).sons->data[i_266730]), x);
				propagatetoowner_194274(header, x);
				LOC58 = 0;
				LOC58 = &(*body).sons->data[(NI)(i_266730 - ((NI) 1))]->Sup;
				LOC59 = 0;
				LOC59 = &x->Sup.Sup;
				idtableput_198196((&(*cl).typemap), LOC58, LOC59);
				res_266937 += ((NI) 1);
			} LA57: ;
		}
	}
	{
		NI i_266814;
		NI HEX3Atmp_266942;
		NI LOC61;
		NI res_266945;
		i_266814 = 0;
		HEX3Atmp_266942 = 0;
		LOC61 = 0;
		LOC61 = sonslen_193351(t);
		HEX3Atmp_266942 = (NI)(LOC61 - ((NI) 1));
		res_266945 = ((NI) 1);
		{
			while (1) {
				if (!(res_266945 <= HEX3Atmp_266942)) goto LA63;
				i_266814 = res_266945;
				rawaddson_194478(result, (*header).sons->data[i_266814]);
				res_266945 += ((NI) 1);
			} LA63: ;
		}
	}
	LOC64 = 0;
	LOC64 = lastson_193442(body);
	newbody = replacetypevarst_265592(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_226091(newbody);
		if (!LOC67) goto LA68;
		newbody = skipgenericalias_226119(newbody);
	}
	LA68: ;
	rawaddson_194478(result, newbody);
	checkpartialconstructedtype_265063((*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(Tsym190843*, replacetypevarss_265563)(Trepltypevars265544* cl, Tsym190843* s) {
	Tsym190843* result;
	Tidobj167015* LOC5;
	TNimObject* LOC6;
{	result = 0;
	{
		if (!(s == NIM_NIL)) goto LA3;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = &s->Sup;
	LOC6 = 0;
	LOC6 = idtableget_198182((*cl).symmap, LOC5);
	result = ((Tsym190843*) (LOC6));
	{
		Tidobj167015* LOC11;
		TNimObject* LOC12;
		if (!(result == NIM_NIL)) goto LA9;
		result = copysym_193607(s, NIM_FALSE);
		(*result).flags |= ((NI32)1)<<((((NU8) 2))%(sizeof(NI32)*8));
		LOC11 = 0;
		LOC11 = &s->Sup;
		LOC12 = 0;
		LOC12 = &result->Sup.Sup;
		idtableput_198196((&(*cl).symmap), LOC11, LOC12);
		asgnRefNoCycle((void**) (&(*result).owner), (*s).owner);
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_265592(cl, (*s).typ));
		asgnRefNoCycle((void**) (&(*result).ast), replacetypevarsn_265571(cl, (*s).ast));
	}
	LA9: ;
	}BeforeRet: ;
	return result;
}

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

N_NIMCALL(Tnode190813*, preparenode_265607)(Trepltypevars265544* cl, Tnode190813* n) {
	Tnode190813* result;
	Ttype190849* t;
	NIM_BOOL iscall;
{	result = 0;
	t = replacetypevarst_265592(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_194640(n);
	asgnRefNoCycle((void**) (&(*result).typ), t);
	{
		if (!((*result).kind == ((NU8) 3))) goto LA11;
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_265563(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_265688;
		NI HEX3Atmp_265692;
		NI LOC14;
		NI res_265695;
		i_265688 = 0;
		HEX3Atmp_265692 = 0;
		LOC14 = 0;
		LOC14 = safelen_191125(n);
		HEX3Atmp_265692 = (LOC14 - 1);
		res_265695 = ((NI) 0);
		{
			while (1) {
				if (!(res_265695 <= HEX3Atmp_265692)) goto LA16;
				i_265688 = res_265695;
				{
					NIM_BOOL LOC19;
					Tnode190813* LOC23;
					LOC19 = 0;
					LOC19 = iscall;
					if (!(LOC19)) goto LA20;
					LOC19 = (i_265688 == ((NI) 0));
					LA20: ;
					if (!LOC19) goto LA21;
					LOC23 = 0;
					LOC23 = HEX5BHEX5D_191244(n, i_265688);
					add_191164(result, LOC23);
				}
				goto LA17;
				LA21: ;
				{
					Tnode190813* LOC25;
					Tnode190813* LOC26;
					LOC25 = 0;
					LOC25 = HEX5BHEX5D_191244(n, i_265688);
					LOC26 = 0;
					LOC26 = preparenode_265607(cl, LOC25);
					add_191164(result, LOC26);
				}
				LA17: ;
				res_265695 += ((NI) 1);
			} LA16: ;
		}
	}
	}BeforeRet: ;
	return result;
}

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

static N_INLINE(NI, len_191097)(Tnode190813* 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_267234)(Ttype190849* t, Tnode190813* n) {
{	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		NimStringDesc* LOC9;
		if (!!(!(((*n).kind == ((NU8) 140))))) goto LA7;
		LOC9 = 0;
		LOC9 = HEX24_165306(TMP2636);
		internalerror_165218(LOC9);
	}
	LA7: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		propagatetoowner_194274(t, (*(*n).kindU.S4.sym).typ);
	}
	break;
	case ((NU8) 138):
	case ((NU8) 139):
	case ((NU8) 85):
	case ((NU8) 88):
	{
		{
			Tnode190813* son_267265;
			son_267265 = 0;
			{
				NI i_267270;
				NI HEX3Atmp_267272;
				NI LOC14;
				NI res_267274;
				i_267270 = 0;
				HEX3Atmp_267272 = 0;
				LOC14 = 0;
				LOC14 = len_191097(n);
				HEX3Atmp_267272 = (LOC14 - 1);
				res_267274 = ((NI) 0);
				{
					while (1) {
						if (!(res_267274 <= HEX3Atmp_267272)) goto LA16;
						i_267270 = res_267274;
						son_267265 = (*n).kindU.S6.sons->data[i_267270];
						propagatefieldflags_267234(t, son_267265);
						res_267274 += ((NI) 1);
					} LA16: ;
				}
			}
		}
	}
	break;
	default:
	{
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, erasevoidparams_266982)(Ttype190849* 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_267024;
		NI HEX3Atmp_267105;
		NI LOC8;
		NI res_267108;
		i_267024 = 0;
		HEX3Atmp_267105 = 0;
		LOC8 = 0;
		LOC8 = sonslen_193351(t);
		HEX3Atmp_267105 = (LOC8 - 1);
		res_267108 = ((NI) 1);
		{
			while (1) {
				if (!(res_267108 <= HEX3Atmp_267105)) goto LA10;
				i_267024 = res_267108;
				{
					NI pos;
					if (!((*(*t).sons->data[i_267024]).kind == ((NU8) 3))) goto LA13;
					pos = i_267024;
					{
						NI j_267053;
						NI HEX3Atmp_267097;
						NI HEX3Atmp_267098;
						NI LOC16;
						NI res_267101;
						j_267053 = 0;
						HEX3Atmp_267097 = 0;
						HEX3Atmp_267098 = 0;
						HEX3Atmp_267097 = (NI)(i_267024 + ((NI) 1));
						LOC16 = 0;
						LOC16 = sonslen_193351(t);
						HEX3Atmp_267098 = (LOC16 - 1);
						res_267101 = HEX3Atmp_267097;
						{
							while (1) {
								if (!(res_267101 <= HEX3Atmp_267098)) goto LA18;
								j_267053 = res_267101;
								{
									if (!!(((*(*t).sons->data[j_267053]).kind == ((NU8) 3)))) goto LA21;
									asgnRefNoCycle((void**) (&(*t).sons->data[pos]), (*t).sons->data[j_267053]);
									asgnRefNoCycle((void**) (&(*(*t).n).kindU.S6.sons->data[pos]), (*(*t).n).kindU.S6.sons->data[j_267053]);
									pos += ((NI) 1);
								}
								LA21: ;
								res_267101 += ((NI) 1);
							} LA18: ;
						}
					}
					(*t).sons = (Ttypeseq190845*) setLengthSeq(&((*t).sons)->Sup, sizeof(Ttype190849*), ((NI) (pos)));
					(*(*t).n).kindU.S6.sons = (Tnodeseq190807*) setLengthSeq(&((*(*t).n).kindU.S6.sons)->Sup, sizeof(Tnode190813*), ((NI) (pos)));
					goto BeforeRet;
				}
				LA13: ;
				res_267108 += ((NI) 1);
			} LA10: ;
		}
	}
	}BeforeRet: ;
}

N_NIMCALL(void, skipintliteralparams_267136)(Ttype190849* t) {
	{
		NI i_267157;
		NI HEX3Atmp_267209;
		NI LOC2;
		NI res_267212;
		i_267157 = 0;
		HEX3Atmp_267209 = 0;
		LOC2 = 0;
		LOC2 = sonslen_193351(t);
		HEX3Atmp_267209 = (LOC2 - 1);
		res_267212 = ((NI) 0);
		{
			while (1) {
				if (!(res_267212 <= HEX3Atmp_267209)) goto LA4;
				i_267157 = res_267212;
				{
					Ttype190849* p;
					Ttype190849* skipped;
					p = (*t).sons->data[i_267157];
					{
						if (!(p == NIM_NIL)) goto LA8;
						goto LA5;
					}
					LA8: ;
					skipped = skipintlit_238698(p);
					{
						if (!!((skipped == p))) goto LA12;
						asgnRefNoCycle((void**) (&(*t).sons->data[i_267157]), skipped);
						{
							if (!(((NI) 0) < i_267157)) goto LA16;
							asgnRefNoCycle((void**) (&(*(*(*(*t).n).kindU.S6.sons->data[i_267157]).kindU.S4.sym).typ), skipped);
						}
						LA16: ;
					}
					LA12: ;
				} LA5: ;
				res_267212 += ((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_220039((*t).sons->data[((NI) 0)]));
	}
	LA22: ;
}

N_NIMCALL(Ttype190849*, replacetypevarstaux_265555)(Trepltypevars265544* cl, Ttype190849* t) {
	Ttype190849* result;
{	result = 0;
	result = t;
	{
		if (!(t == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		Ttype190849* lookup;
		Tidobj167015* LOC9;
		TNimObject* LOC10;
		if (!((IL64(1151232654746587136) &(IL64(1)<<(((*t).kind)&IL64(63))))!=0)) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_198182((*cl).typemap, LOC9);
		lookup = ((Ttype190849*) (LOC10));
		{
			if (!!((lookup == NIM_NIL))) goto LA13;
			result = lookup;
			goto BeforeRet;
		}
		LA13: ;
	}
	LA7: ;
	switch ((*t).kind) {
	case ((NU8) 9):
	{
		result = handlegenericinvocation_266535(cl, t);
	}
	break;
	case ((NU8) 10):
	{
		NimStringDesc* LOC17;
		LOC17 = 0;
		LOC17 = typetostring_220032(t, ((NU8) 0));
		localerror_165155((*cl).info, ((NU16) 124), LOC17);
		result = errortype_245150((*cl).c);
	}
	break;
	case ((NU8) 60):
	{
		Tnode190813* n;
		{
			if (!(*cl).allowmetatypes) goto LA21;
			goto BeforeRet;
		}
		LA21: ;
		n = preparenode_265607(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_194167((*n).typ, 256);
		}
		goto LA27;
		LA29: ;
		{
			{
				TY349187 LOC36;
				if (!!(((*(*n).typ).kind == ((NU8) 59)))) goto LA34;
				result = newtypes_244218(((NU8) 59), (*cl).c);
				if ((*result).sons) nimGCunrefNoCycle((*result).sons);
				(*result).sons = (Ttypeseq190845*) newSeqRC1((&NTI190845), 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_238698(t);
	}
	break;
	case ((NU8) 8):
	{
		Ttype190849* lookup;
		Tidobj167015* LOC40;
		TNimObject* LOC41;
		LOC40 = 0;
		LOC40 = &t->Sup;
		LOC41 = 0;
		LOC41 = idtableget_198182((*cl).typemap, LOC40);
		lookup = ((Ttype190849*) (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_220039(result);
			}
			LA50: ;
		}
		goto LA42;
		LA44: ;
		{
			Ttype190849* LOC55;
			if (!!(((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 0)))) goto LA53;
			LOC55 = 0;
			LOC55 = replacetypevarst_265592(cl, (*t).sons->data[((NI) 0)]);
			result = maketypedesc_244681((*cl).c, LOC55);
		}
		goto LA42;
		LA53: ;
		LA42: ;
	}
	break;
	case ((NU8) 52):
	{
		result = t;
	}
	break;
	case ((NU8) 11):
	{
		Tidobj167015* LOC58;
		TNimObject* LOC59;
		Tidobj167015* LOC64;
		TNimObject* LOC65;
		Ttype190849* LOC70;
		LOC58 = 0;
		LOC58 = &t->Sup;
		LOC59 = 0;
		LOC59 = idtableget_198182((*cl).localcache, LOC58);
		result = ((Ttype190849*) (LOC59));
		{
			if (!!((result == NIM_NIL))) goto LA62;
			goto BeforeRet;
		}
		LA62: ;
		result = instcopytype_266470(cl, t);
		LOC64 = 0;
		LOC64 = &t->Sup;
		LOC65 = 0;
		LOC65 = &result->Sup.Sup;
		idtableput_198196((&(*cl).localcache), LOC64, LOC65);
		{
			NI i_267506;
			NI HEX3Atmp_267563;
			NI LOC67;
			NI res_267566;
			i_267506 = 0;
			HEX3Atmp_267563 = 0;
			LOC67 = 0;
			LOC67 = sonslen_193351(result);
			HEX3Atmp_267563 = (LOC67 - 1);
			res_267566 = ((NI) 1);
			{
				while (1) {
					if (!(res_267566 <= HEX3Atmp_267563)) goto LA69;
					i_267506 = res_267566;
					asgnRefNoCycle((void**) (&(*result).sons->data[i_267506]), replacetypevarst_265592(cl, (*result).sons->data[i_267506]));
					res_267566 += ((NI) 1);
				} LA69: ;
			}
		}
		LOC70 = 0;
		LOC70 = lastson_193442(result);
		propagatetoowner_194274(result, LOC70);
	}
	break;
	default:
	{
		{
			NIM_BOOL LOC74;
			Tidobj167015* LOC77;
			TNimObject* LOC78;
			Tidobj167015* LOC83;
			TNimObject* LOC84;
			LOC74 = 0;
			LOC74 = containsgenerictype_229310(t);
			if (!LOC74) goto LA75;
			LOC77 = 0;
			LOC77 = &t->Sup;
			LOC78 = 0;
			LOC78 = idtableget_198182((*cl).localcache, LOC77);
			result = ((Ttype190849*) (LOC78));
			{
				if (!!((result == NIM_NIL))) goto LA81;
				goto BeforeRet;
			}
			LA81: ;
			result = instcopytype_266470(cl, t);
			(*result).size = IL64(-1);
			LOC83 = 0;
			LOC83 = &t->Sup;
			LOC84 = 0;
			LOC84 = &result->Sup.Sup;
			idtableput_198196((&(*cl).localcache), LOC83, LOC84);
			{
				NI i_267532;
				NI HEX3Atmp_267571;
				NI LOC86;
				NI res_267574;
				i_267532 = 0;
				HEX3Atmp_267571 = 0;
				LOC86 = 0;
				LOC86 = sonslen_193351(result);
				HEX3Atmp_267571 = (NI)(LOC86 - ((NI) 1));
				res_267574 = ((NI) 0);
				{
					while (1) {
						if (!(res_267574 <= HEX3Atmp_267571)) goto LA88;
						i_267532 = res_267574;
						{
							if (!!(((*result).sons->data[i_267532] == NIM_NIL))) goto LA91;
							asgnRefNoCycle((void**) (&(*result).sons->data[i_267532]), replacetypevarst_265592(cl, (*result).sons->data[i_267532]));
							propagatetoowner_194274(result, (*result).sons->data[i_267532]);
						}
						LA91: ;
						res_267574 += ((NI) 1);
					} LA88: ;
				}
			}
			asgnRefNoCycle((void**) (&(*result).n), replacetypevarsn_265571(cl, (*result).n));
			switch ((*result).kind) {
			case ((NU8) 16):
			{
				Ttype190849* idx;
				idx = (*result).sons->data[((NI) 0)];
				{
					NimStringDesc* LOC98;
					if (!!(!(((*idx).kind == ((NU8) 59))))) goto LA96;
					LOC98 = 0;
					LOC98 = HEX24_165306(TMP2635);
					internalerror_165218(LOC98);
				}
				LA96: ;
			}
			break;
			case ((NU8) 17):
			case ((NU8) 18):
			{
				propagatefieldflags_267234(result, (*result).n);
			}
			break;
			case ((NU8) 25):
			{
				erasevoidparams_266982(result);
				skipintliteralparams_267136(result);
			}
			break;
			default:
			{
			}
			break;
			}
		}
		LA75: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype190849*, replacetypevarst_265592)(Trepltypevars265544* cl, Ttype190849* t) {
	Ttype190849* result;
	result = 0;
	result = replacetypevarstaux_265555(cl, t);
	return result;
}

N_NIMCALL(NIM_BOOL, istypeparam_265714)(Tnode190813* 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(Tnode190813*, reresolvecallswithtypedescparams_265871)(Trepltypevars265544* cl, Tnode190813* n) {
	Tnode190813* result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode190813* 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_191244(n, ((NI) 0));
		LOC3 = (((*(*LOC5).kindU.S4.sym).flags &(1<<((((NU8) 2))&31)))!=0);
		LA4: ;
		if (!LOC3) goto LA6;
		needsfixing = NIM_FALSE;
		{
			NI i_265919;
			NI HEX3Atmp_265947;
			NI LOC9;
			NI res_265950;
			i_265919 = 0;
			HEX3Atmp_265947 = 0;
			LOC9 = 0;
			LOC9 = safelen_191125(n);
			HEX3Atmp_265947 = (LOC9 - 1);
			res_265950 = ((NI) 1);
			{
				while (1) {
					if (!(res_265950 <= HEX3Atmp_265947)) goto LA11;
					i_265919 = res_265950;
					{
						Tnode190813* LOC14;
						NIM_BOOL LOC15;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_191244(n, i_265919);
						LOC15 = 0;
						LOC15 = istypeparam_265714(LOC14);
						if (!LOC15) goto LA16;
						needsfixing = NIM_TRUE;
					}
					LA16: ;
					res_265950 += ((NI) 1);
				} LA11: ;
			}
		}
		{
			if (!needsfixing) goto LA20;
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_192325((*(*(*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_265944;
		NI HEX3Atmp_265955;
		NI LOC23;
		NI res_265958;
		i_265944 = 0;
		HEX3Atmp_265955 = 0;
		LOC23 = 0;
		LOC23 = safelen_191125(n);
		HEX3Atmp_265955 = (LOC23 - 1);
		res_265958 = ((NI) 0);
		{
			while (1) {
				Tnode190813* LOC26;
				if (!(res_265958 <= HEX3Atmp_265955)) goto LA25;
				i_265944 = res_265958;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_191244(n, i_265944);
				asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_265944]), reresolvecallswithtypedescparams_265871(cl, LOC26));
				res_265958 += ((NI) 1);
			} LA25: ;
		}
	}
	result = n;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode190813*, replacetypevarsn_265571)(Trepltypevars265544* cl, Tnode190813* n_265575) {
	Tnode190813* result;
{	result = 0;
	{
		if (!(n_265575 == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	result = copynode_194640(n_265575);
	{
		if (!!(((*n_265575).typ == NIM_NIL))) goto LA7;
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_265592(cl, (*n_265575).typ));
	}
	LA7: ;
	switch ((*n_265575).kind) {
	case ((NU8) 0) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_265563(cl, (*n_265575).kindU.S4.sym));
		{
			Tnodeseq190807* LOC15;
			if (!((*(*(*result).kindU.S4.sym).typ).kind == ((NU8) 3))) goto LA13;
			LOC15 = 0;
			LOC15 = (Tnodeseq190807*) newSeq((&NTI190807), 0);
			result = newnode_192607(((NU8) 138), (*n_265575).info, LOC15, NIM_NIL);
		}
		LA13: ;
	}
	break;
	case ((NU8) 140):
	{
		Tnode190813* branch;
		branch = NIM_NIL;
		{
			NI i_266247;
			NI HEX3Atmp_266332;
			NI LOC18;
			NI res_266335;
			i_266247 = 0;
			HEX3Atmp_266332 = 0;
			LOC18 = 0;
			LOC18 = sonslen_193403(n_265575);
			HEX3Atmp_266332 = (NI)(LOC18 - ((NI) 1));
			res_266335 = ((NI) 0);
			{
				while (1) {
					Tnode190813* it;
					if (!(res_266335 <= HEX3Atmp_266332)) goto LA20;
					i_266247 = res_266335;
					it = (*n_265575).kindU.S6.sons->data[i_266247];
					{
						if (!(it == NIM_NIL)) goto LA23;
						illformedast_245229(n_265575);
					}
					LA23: ;
					switch ((*it).kind) {
					case ((NU8) 86):
					{
						Tnode190813* cond;
						Tnode190813* e;
						checksonslen_245249(it, ((NI) 2));
						cond = preparenode_265607(cl, (*it).kindU.S6.sons->data[((NI) 0)]);
						e = (*(*cl).c).semconstexpr((*cl).c, cond);
						{
							if (!!(((*e).kind == ((NU8) 6)))) goto LA28;
							internalerror_165199((*e).info, ((NimStringDesc*) &TMP2637));
						}
						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_245249(it, ((NI) 1));
						{
							if (!(branch == NIM_NIL)) goto LA39;
							branch = (*it).kindU.S6.sons->data[((NI) 0)];
						}
						LA39: ;
					}
					break;
					default:
					{
						illformedast_245229(n_265575);
					}
					break;
					}
					res_266335 += ((NI) 1);
				} LA20: ;
			}
		}
		{
			if (!!((branch == NIM_NIL))) goto LA44;
			result = replacetypevarsn_265571(cl, branch);
		}
		goto LA42;
		LA44: ;
		{
			result = newnodei_192351(((NU8) 138), (*n_265575).info);
		}
		LA42: ;
	}
	break;
	case ((NU8) 62):
	{
		Tnode190813* n;
		n = preparenode_265607(cl, n_265575);
		n = reresolvecallswithtypedescparams_265871(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_193403(n_265575);
		{
			if (!(((NI) 0) < length)) goto LA56;
			newsons_193272(result, length);
			{
				NI i_266327;
				NI HEX3Atmp_266340;
				NI res_266343;
				i_266327 = 0;
				HEX3Atmp_266340 = 0;
				HEX3Atmp_266340 = (NI)(length - ((NI) 1));
				res_266343 = ((NI) 0);
				{
					while (1) {
						if (!(res_266343 <= HEX3Atmp_266340)) goto LA60;
						i_266327 = res_266343;
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[i_266327]), replacetypevarsn_265571(cl, (*n_265575).kindU.S6.sons->data[i_266327]));
						res_266343 += ((NI) 1);
					} LA60: ;
				}
			}
		}
		LA56: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode190813*, replacetypesinbody_267617)(Tcontext244023* p, Tidtable190861 pt, Tnode190813* n) {
	Tnode190813* result;
	Trepltypevars265544 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_267602(p, pt, (*n).info, (&cl));
	pushinfocontext_164189((*n).info);
	result = replacetypevarsn_265571((&cl), n);
	popinfocontext_164208();
	return result;
}

N_NIMCALL(Ttype190849*, generatetypeinstance_267631)(Tcontext244023* p, Tidtable190861 pt, Tlineinfo163338 info, Ttype190849* t) {
	Ttype190849* result;
	Trepltypevars265544 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_267602(p, pt, info, (&cl));
	pushinfocontext_164189(info);
	result = replacetypevarst_265592((&cl), t);
	popinfocontext_164208();
	return result;
}

N_NIMCALL(NIM_BOOL, hasgenericarguments_265765)(Tnode190813* 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_265846;
			NI HEX3Atmp_265849;
			NI LOC11;
			NI res_265852;
			i_265846 = 0;
			HEX3Atmp_265849 = 0;
			LOC11 = 0;
			LOC11 = safelen_191125(n);
			HEX3Atmp_265849 = (LOC11 - 1);
			res_265852 = ((NI) 0);
			{
				while (1) {
					if (!(res_265852 <= HEX3Atmp_265849)) goto LA13;
					i_265846 = res_265852;
					{
						NIM_BOOL LOC16;
						LOC16 = 0;
						LOC16 = hasgenericarguments_265765((*n).kindU.S6.sons->data[i_265846]);
						if (!LOC16) goto LA17;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA17: ;
					res_265852 += ((NI) 1);
				} LA13: ;
			}
		}
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, checkconstructedtype_265110)(Tlineinfo163338 info, Ttype190849* typ) {
	Ttype190849* t;
	t = skiptypes_194167(typ, 8192);
	{
		if (!((IL64(574208952489738240) &(IL64(1)<<(((*t).kind)&IL64(63))))!=0)) goto LA3;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		Ttype190849* LOC8;
		LOC6 = 0;
		LOC6 = (((*t).flags &(1<<((((NU8) 4))&31)))!=0);
		if (!(LOC6)) goto LA7;
		LOC8 = 0;
		LOC8 = skiptypes_194167(t, IL64(211106232576256));
		LOC6 = !(((*LOC8).kind == ((NU8) 17)));
		LA7: ;
		if (!LOC6) goto LA9;
		localerror_165155(info, ((NU16) 162), ((NimStringDesc*) &TMP2630));
	}
	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_165155(info, ((NU16) 197), ((NimStringDesc*) &TMP2631));
	}
	goto LA1;
	LA14: ;
	{
		NI64 LOC17;
		NimStringDesc* LOC20;
		LOC17 = 0;
		LOC17 = computesize_220184(t);
		if (!(LOC17 == IL64(-2))) goto LA18;
		LOC20 = 0;
		LOC20 = typetostring_220032(t, ((NU8) 0));
		localerror_165155(info, ((NU16) 123), LOC20);
	}
	goto LA1;
	LA18: ;
	{
		sharedptrcheck_265014(info, t);
	}
	LA1: ;
}
NIM_EXTERNC N_NOINLINE(void, nimsrc_semtypinstInit)(void) {
}

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

