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

#include "nimbase.h"
#include <string.h>
typedef struct Tnode227809 Tnode227809;
typedef struct Tcontext282023 Tcontext282023;
typedef struct Tidtable227859 Tidtable227859;
typedef struct Tidpairseq227857 Tidpairseq227857;
typedef struct Tsym227841 Tsym227841;
typedef struct Trepltypevars304577 Trepltypevars304577;
typedef struct Tlineinfo192352 Tlineinfo192352;
typedef struct Ttype227847 Ttype227847;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tident200021 Tident200021;
typedef struct Tnodeseq227803 Tnodeseq227803;
typedef struct Tidobj200015 Tidobj200015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq227843 Ttypeseq227843;
typedef struct Tloc227823 Tloc227823;
typedef struct Ropeobj178009 Ropeobj178009;
typedef struct TY92759 TY92759;
typedef struct Tscope227835 Tscope227835;
typedef struct TY227944 TY227944;
typedef struct Tstrtable227813 Tstrtable227813;
typedef struct Tsymseq227811 Tsymseq227811;
typedef struct Tlib227827 Tlib227827;
typedef struct Cell48946 Cell48946;
typedef struct Cellseq48962 Cellseq48962;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48958 Cellset48958;
typedef struct Pagedesc48954 Pagedesc48954;
typedef struct Memregion30890 Memregion30890;
typedef struct Smallchunk30842 Smallchunk30842;
typedef struct Llchunk30884 Llchunk30884;
typedef struct Bigchunk30844 Bigchunk30844;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30888 Avlnode30888;
typedef struct Gcstat51014 Gcstat51014;
typedef struct Tpasscontext279005 Tpasscontext279005;
typedef struct Tproccon282011 Tproccon282011;
typedef struct Intset224056 Intset224056;
typedef struct Trunk224052 Trunk224052;
typedef struct Trunkseq224054 Trunkseq224054;
typedef struct Tlinkedlist143028 Tlinkedlist143028;
typedef struct Tlistentry143022 Tlistentry143022;
typedef struct Tctx281048 Tctx281048;
typedef struct TY282143 TY282143;
typedef struct Tidpair227855 Tidpair227855;
typedef struct Tinstantiation227831 Tinstantiation227831;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef struct TY281254 TY281254;
typedef struct TY193420 TY193420;
typedef struct PprocHEX3Aobjecttype281233 PprocHEX3Aobjecttype281233;
typedef struct TY281273 TY281273;
typedef struct Tinstantiationpair282013 Tinstantiationpair282013;
typedef struct TY227932 TY227932;
typedef struct TY281234 TY281234;
typedef struct TY281239 TY281239;
typedef struct TY281274 TY281274;
typedef struct Vmargs281042 Vmargs281042;
typedef struct Tblock281030 Tblock281030;
typedef struct TY281214 TY281214;
struct  Tidtable227859  {
NI counter;
Tidpairseq227857* data;
};
struct  Tlineinfo192352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Trepltypevars304577  {
Tcontext282023* c;
Tidtable227859 typemap;
Tidtable227859 symmap;
Tidtable227859 localcache;
Tlineinfo192352 info;
NIM_BOOL allowmetatypes;
NIM_BOOL skiptypedesc;
Tsym227841* owner;
NI recursionlimit;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode227809  {
Ttype227847* typ;
Tlineinfo192352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym227841* sym;
} S4;
struct {Tident200021* ident;
} S5;
struct {Tnodeseq227803* 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  Tidobj200015  {
  TNimObject Sup;
NI id;
};
struct  Tloc227823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype227847* t;
Ropeobj178009* r;
Ropeobj178009* heaproot;
};
struct  Ttype227847  {
  Tidobj200015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq227843* sons;
Tnode227809* n;
Tsym227841* owner;
Tsym227841* sym;
Tsym227841* destructor;
Tsym227841* deepcopy;
Tsym227841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc227823 loc;
};
struct TY92759 {
NimStringDesc* Field0;
NI Field1;
};
struct  Tstrtable227813  {
NI counter;
Tsymseq227811* data;
};
struct  Tsym227841  {
  Tidobj200015 Sup;
NU8 kind;
union{
struct {Ttypeseq227843* typeinstcache;
Tscope227835* typscope;
} S1;
struct {TY227944* procinstcache;
Tsym227841* gcunsafetyreason;
} S2;
struct {TY227944* usedgenerics;
Tstrtable227813 tab;
} S3;
struct {Tsym227841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype227847* typ;
Tident200021* name;
Tlineinfo192352 info;
Tsym227841* owner;
NU32 flags;
Tnode227809* ast;
NU32 options;
NI position;
NI offset;
Tloc227823 loc;
Tlib227827* annex;
Tnode227809* constraint;
};
struct  Cell48946  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48962  {
NI len;
NI cap;
Cell48946** d;
};
struct  Cellset48958  {
NI counter;
NI max;
Pagedesc48954* head;
Pagedesc48954** data;
};
typedef Smallchunk30842* TY30905[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30890  {
NI minlargeobj;
NI maxlargeobj;
TY30905 freesmallchunks;
Llchunk30884* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30844* freechunkslist;
Intset30817 chunkstarts;
Avlnode30888* root;
Avlnode30888* deleted;
Avlnode30888* last;
Avlnode30888* freeavlnodes;
};
struct  Gcstat51014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap51018  {
Gcstack51016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq48962 zct;
Cellseq48962 decstack;
Cellset48958 cycleroots;
Cellseq48962 tempstack;
NI recgclock;
Memregion30890 region;
Gcstat51014 stat;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef Ttype227847* TY395275[1];
struct  Tpasscontext279005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset224056  {
NI counter;
NI max;
Trunk224052* head;
Trunkseq224054* data;
};
struct  Tlinkedlist143028  {
Tlistentry143022* head;
Tlistentry143022* tail;
NI counter;
};
typedef N_NIMCALL_PTR(Tnode227809*, TY282074) (Tcontext282023* c, Tnode227809* n);
typedef N_NIMCALL_PTR(Tnode227809*, TY282079) (Tcontext282023* c, Tnode227809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode227809*, TY282087) (Tcontext282023* c, Tnode227809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode227809*, TY282095) (Tcontext282023* c, Tnode227809* n);
typedef N_NIMCALL_PTR(Tnode227809*, TY282100) (Tcontext282023* c, Tnode227809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode227809*, TY282108) (Tcontext282023* c, Tnode227809* n);
typedef N_NIMCALL_PTR(Tnode227809*, TY282113) (Tcontext282023* c, Tnode227809* n, Tnode227809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype227847*, TY282120) (Tcontext282023* c, Tnode227809* n, Ttype227847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode227809*, ClPrc) (Tcontext282023* c, Tidtable227859 pt, Tnode227809* n, void* ClEnv);
void* ClEnv;
} TY282126;
typedef struct {
N_NIMCALL_PTR(Tsym227841*, ClPrc) (Tcontext282023* c, Tsym227841* fn, Tidtable227859 pt, Tlineinfo192352 info, void* ClEnv);
void* ClEnv;
} TY282132;
typedef N_NIMCALL_PTR(Tsym227841*, TY282148) (Tcontext282023* c, Tsym227841* dc, Ttype227847* t, Tlineinfo192352 info, NU8 op);
struct  Tcontext282023  {
  Tpasscontext279005 Sup;
Tsym227841* module;
Tscope227835* currentscope;
Tscope227835* importtable;
Tscope227835* toplevelscope;
Tproccon282011* p;
Tsymseq227811* friendmodules;
NI instcounter;
Intset224056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq227811* converters;
Tsymseq227811* patterns;
Tlinkedlist143028 optionstack;
Tidtable227859 symmapping;
Tlinkedlist143028 libs;
TY282074 semconstexpr;
TY282079 semexpr;
TY282087 semtryexpr;
TY282095 semtryconstexpr;
TY282100 semoperand;
TY282108 semconstboolexpr;
TY282113 semoverloadedcall;
TY282120 semtypenode;
TY282126 seminferredlambda;
TY282132 semgenerateinstance;
Intset224056 includedfiles;
Tstrtable227813 userpragmas;
Tctx281048* evalcontext;
Intset224056 unknownidents;
TY282143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY282148 insttypeboundop;
};
struct  Tidpair227855  {
Tidobj200015* key;
TNimObject* val;
};
struct  Tident200021  {
  Tidobj200015 Sup;
NimStringDesc* s;
Tident200021* next;
NI h;
};
struct  Ropeobj178009  {
  TNimObject Sup;
Ropeobj178009* left;
Ropeobj178009* right;
NI length;
NimStringDesc* data;
};
struct  Tscope227835  {
NI depthlevel;
Tstrtable227813 symbols;
Tnodeseq227803* usingsyms;
Tscope227835* parent;
};
struct  Tlistentry143022  {
  TNimObject Sup;
Tlistentry143022* prev;
Tlistentry143022* next;
};
struct  Tlib227827  {
  Tlistentry143022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj178009* name;
Tnode227809* path;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30821[16];
struct  Pagedesc48954  {
Pagedesc48954* next;
NI key;
TY30821 bits;
};
struct  Basechunk30840  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30842  {
  Basechunk30840 Sup;
Smallchunk30842* next;
Smallchunk30842* prev;
Freecell30832* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30884  {
NI size;
NI acc;
Llchunk30884* next;
};
struct  Bigchunk30844  {
  Basechunk30840 Sup;
Bigchunk30844* next;
Bigchunk30844* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30821 bits;
};
typedef Avlnode30888* TY30895[2];
struct  Avlnode30888  {
TY30895 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon282011  {
Tsym227841* owner;
Tsym227841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon282011* next;
NIM_BOOL wasforwarded;
Tnode227809* bracketexpr;
};
struct  Trunk224052  {
Trunk224052* next;
NI key;
TY30821 bits;
};
struct  Tctx281048  {
  Tpasscontext279005 Sup;
TY281254* code;
TY193420* debug;
Tnode227809* globals;
Tnode227809* constants;
Ttypeseq227843* types;
Tnode227809* currentexceptiona;
Tnode227809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype281233* prc;
Tsym227841* module;
Tnode227809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo192352 comesfromheuristic;
TY281273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair282013  {
Tsym227841* genericsym;
Tinstantiation227831* inst;
};
struct  Tinstantiation227831  {
Tsym227841* sym;
Ttypeseq227843* concretetypes;
TY227932* usedby;
NI compilesid;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct TY281239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY281239 TY281242[256];
struct  PprocHEX3Aobjecttype281233  {
TY281234* blocks;
Tsym227841* sym;
TY281242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs281042* args, void* ClEnv);
void* ClEnv;
} Vmcallback281044;
struct TY281274 {
NimStringDesc* Field0;
Vmcallback281044 Field1;
};
struct  Tblock281030  {
Tsym227841* label;
TY281214* fixups;
};
struct  Vmargs281042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode227809* currentexception;
};
struct Ttypeseq227843 {
  TGenericSeq Sup;
  Ttype227847* data[SEQ_DECL_SIZE];
};
struct Tnodeseq227803 {
  TGenericSeq Sup;
  Tnode227809* data[SEQ_DECL_SIZE];
};
struct Tidpairseq227857 {
  TGenericSeq Sup;
  Tidpair227855 data[SEQ_DECL_SIZE];
};
struct TY227944 {
  TGenericSeq Sup;
  Tinstantiation227831* data[SEQ_DECL_SIZE];
};
struct Tsymseq227811 {
  TGenericSeq Sup;
  Tsym227841* data[SEQ_DECL_SIZE];
};
struct Trunkseq224054 {
  TGenericSeq Sup;
  Trunk224052* data[SEQ_DECL_SIZE];
};
struct TY282143 {
  TGenericSeq Sup;
  Tinstantiationpair282013 data[SEQ_DECL_SIZE];
};
struct TY281254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY193420 {
  TGenericSeq Sup;
  Tlineinfo192352 data[SEQ_DECL_SIZE];
};
struct TY281273 {
  TGenericSeq Sup;
  TY281274 data[SEQ_DECL_SIZE];
};
struct TY227932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY281234 {
  TGenericSeq Sup;
  Tblock281030 data[SEQ_DECL_SIZE];
};
struct TY281214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, inittypevars_306846)(Tcontext282023* p, Tidtable227859 pt, Tlineinfo192352 info, Tsym227841* owner, Trepltypevars304577* Result);
N_NIMCALL(void, initidtable_231057)(Tidtable227859* x);
N_NIMCALL(void, copyidtable_229091)(Tidtable227859* dest, Tidtable227859 src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, pushinfocontext_193581)(Tlineinfo192352 info);
N_NIMCALL(Tnode227809*, replacetypevarsn_304606)(Trepltypevars304577* cl, Tnode227809* n_304610);
N_NIMCALL(Tnode227809*, copynode_231660)(Tnode227809* src);
N_NIMCALL(Ttype227847*, replacetypevarst_304627)(Trepltypevars304577* cl, Ttype227847* t);
N_NIMCALL(Ttype227847*, replacetypevarstaux_304590)(Trepltypevars304577* cl, Ttype227847* t);
N_NIMCALL(TNimObject*, idtableget_235182)(Tidtable227859 t, Tidobj200015* key);
N_NIMCALL(Ttype227847*, handlegenericinvocation_305760)(Trepltypevars304577* cl, Ttype227847* t);
N_NIMCALL(void, internalerror_198172)(Tlineinfo192352 info, NimStringDesc* errmsg);
N_NIMCALL(Ttype227847*, searchinsttypes_304207)(Ttype227847* key);
N_NIMCALL(void, internalerror_198191)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, HEX24_198279)(TY92759 x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_266739)(Ttypeseq227843* x, Ttypeseq227843* y);
N_NIMCALL(NIM_BOOL, comparetypes_264047)(Ttype227847* x, Ttype227847* y, NU8 cmp, NU8 flags);
N_NIMCALL(NI, sonslen_230351)(Ttype227847* n);
N_NIMCALL(Ttype227847*, lookuptypevar_305649)(Trepltypevars304577* cl, Ttype227847* t);
N_NIMCALL(void, localerror_198128)(Tlineinfo192352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, typetostring_257032)(Ttype227847* typ, NU8 prefer);
N_NIMCALL(Ttype227847*, errortype_283161)(Tcontext282023* c);
N_NIMCALL(void, idtableput_235196)(Tidtable227859* t, Tidobj200015* key, TNimObject* val);
N_NIMCALL(Ttype227847*, instcopytype_305694)(Trepltypevars304577* cl, Ttype227847* t);
N_NIMCALL(Ttype227847*, copytype_230542)(Ttype227847* t, Tsym227841* owner, NIM_BOOL keepid);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell48946*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48946* c);
N_NOINLINE(void, addzct_52617)(Cellseq48962* s, Cell48946* c);
N_NIMCALL(void, propagatetoowner_231274)(Ttype227847* owner, Ttype227847* elem);
N_NIMCALL(Ttype227847*, newtype_230140)(NU8 kind, Tsym227841* owner);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(void, cachetypeinst_304483)(Ttype227847* inst);
N_NIMCALL(Ttype227847*, lastson_230426)(Ttype227847* n);
N_NIMCALL(void, safeadd_304522)(Ttypeseq227843** x, Ttype227847* y);
N_NIMCALL(void, rawaddson_231498)(Ttype227847* father, Ttype227847* son);
N_NIMCALL(NIM_BOOL, isgenericalias_263091)(Ttype227847* t);
N_NIMCALL(Ttype227847*, skipgenericalias_263119)(Ttype227847* t);
N_NIMCALL(void, checkpartialconstructedtype_304063)(Tlineinfo192352 info, Ttype227847* t);
N_NIMCALL(Ttype227847*, skiptypes_231167)(Ttype227847* t, NU64 kinds);
N_NIMCALL(void, sharedptrcheck_304014)(Tlineinfo192352 info, Ttype227847* t);
N_NIMCALL(NI, len_230369)(Ttype227847* n);
static N_INLINE(NIM_BOOL, isgcedmem_231235)(Ttype227847* t);
N_NIMCALL(Tnode227809*, preparenode_304807)(Trepltypevars304577* cl, Tnode227809* n);
N_NIMCALL(Tsym227841*, replacetypevarss_304598)(Trepltypevars304577* cl, Tsym227841* s);
N_NIMCALL(Tsym227841*, copysym_230607)(Tsym227841* s, NIM_BOOL keepid);
static N_INLINE(NI, safelen_228126)(Tnode227809* n);
N_NIMCALL(void, add_228165)(Tnode227809* father, Tnode227809* son);
static N_INLINE(Tnode227809*, HEX5BHEX5D_228244)(Tnode227809* n, NI i);
N_NIMCALL(Ttype227847*, newtypes_282221)(NU8 kind, Tcontext282023* c);
static N_INLINE(Ttype227847*, skipintlit_276696)(Ttype227847* t);
N_NIMCALL(Ttype227847*, getsystype_276190)(NU8 kind);
N_NIMCALL(Ttype227847*, base_257039)(Ttype227847* t);
N_NIMCALL(Ttype227847*, maketypedesc_282684)(Tcontext282023* c, Ttype227847* typ);
N_NIMCALL(NIM_BOOL, containsgenerictype_266310)(Ttype227847* t);
N_NIMCALL(void, propagatefieldflags_306434)(Ttype227847* t, Tnode227809* n);
static N_INLINE(NI, len_228098)(Tnode227809* n);
N_NIMCALL(void, erasevoidparams_306182)(Ttype227847* t);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, skipintliteralparams_306336)(Ttype227847* t);
N_NIMCALL(Tnode227809*, newnode_229607)(NU8 kind, Tlineinfo192352 info, Tnodeseq227803* sons, Ttype227847* typ);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(NI, sonslen_230387)(Tnode227809* n);
N_NIMCALL(void, illformedast_283240)(Tnode227809* n);
N_NIMCALL(void, checksonslen_283260)(Tnode227809* n, NI length);
N_NIMCALL(Tnode227809*, newnodei_229351)(NU8 kind, Tlineinfo192352 info);
N_NIMCALL(Tnode227809*, reresolvecallswithtypedescparams_305071)(Trepltypevars304577* cl, Tnode227809* n);
N_NIMCALL(NIM_BOOL, istypeparam_304914)(Tnode227809* n);
N_NIMCALL(Tnode227809*, newsymnode_229325)(Tsym227841* sym);
N_NIMCALL(void, newsons_230272)(Tnode227809* father, NI length);
N_NIMCALL(void, popinfocontext_193600)(void);
N_NIMCALL(NIM_BOOL, hasgenericarguments_304965)(Tnode227809* n);
N_NIMCALL(NI64, computesize_257184)(Ttype227847* typ);
STRING_LITERAL(TMP2739, "no generic body", 15);
STRING_LITERAL(TMP2741, "compiler/semtypinst.nim", 23);
NIM_CONST TY92759 TMP2740 = {((NimStringDesc*) &TMP2741),
((NI) 52)}
;
STRING_LITERAL(TMP2746, "substitution with generic parameter", 35);
STRING_LITERAL(TMP2747, "acyclic", 7);
STRING_LITERAL(TMP2748, "", 0);
STRING_LITERAL(TMP2749, "shared memory may not refer to GC\'ed thread local memory", 56);
NIM_CONST TY92759 TMP2752 = {((NimStringDesc*) &TMP2741),
((NI) 477)}
;
NIM_CONST TY92759 TMP2753 = {((NimStringDesc*) &TMP2741),
((NI) 367)}
;
STRING_LITERAL(TMP2754, "ReplaceTypeVarsN: when condition not a bool", 43);
extern Gcheap51018 gch_51059;
extern TNimType NTI227843; /* TTypeSeq */
extern TNimType NTI227803; /* TNodeSeq */

N_NIMCALL(void, inittypevars_306846)(Tcontext282023* p, Tidtable227859 pt, Tlineinfo192352 info, Tsym227841* owner, Trepltypevars304577* Result) {
	initidtable_231057((&(*Result).symmap));
	copyidtable_229091((&(*Result).typemap), pt);
	initidtable_231057((&(*Result).localcache));
	(*Result).info = info;
	unsureAsgnRef((void**) (&(*Result).c), p);
	unsureAsgnRef((void**) (&(*Result).owner), owner);
}

N_NIMCALL(Ttype227847*, searchinsttypes_304207)(Ttype227847* key) {
	Ttype227847* result;
	Ttype227847* 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_198279(TMP2740);
		internalerror_198191(LOC9);
	}
	LA7: ;
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = HEX3DHEX3D_266739((*(*generictyp).sym).kindU.S1.typeinstcache, NIM_NIL);
		if (!LOC12) goto LA13;
		goto BeforeRet;
	}
	LA13: ;
	{
		Ttype227847* inst_304411;
		Ttypeseq227843* HEX3Atmp_304450;
		NI i_304453;
		NI L_304455;
		inst_304411 = 0;
		HEX3Atmp_304450 = 0;
		HEX3Atmp_304450 = (*(*generictyp).sym).kindU.S1.typeinstcache;
		i_304453 = ((NI) 0);
		L_304455 = (HEX3Atmp_304450 ? HEX3Atmp_304450->Sup.len : 0);
		{
			while (1) {
				if (!(i_304453 < L_304455)) goto LA17;
				inst_304411 = HEX3Atmp_304450->data[i_304453];
				{
					if (!((*inst_304411).Sup.id == (*key).Sup.id)) goto LA20;
					result = inst_304411;
					goto BeforeRet;
				}
				LA20: ;
				{
					if (!(((*inst_304411).sons ? (*inst_304411).sons->Sup.len : 0) < ((*key).sons ? (*key).sons->Sup.len : 0))) goto LA24;
					goto BeforeRet;
				}
				LA24: ;
				{
					{
						NI j_304439;
						NI HEX3Atmp_304443;
						NI res_304446;
						j_304439 = 0;
						HEX3Atmp_304443 = 0;
						HEX3Atmp_304443 = ((*key).sons ? ((*key).sons->Sup.len-1) : -1);
						res_304446 = ((NI) 1);
						{
							while (1) {
								if (!(res_304446 <= HEX3Atmp_304443)) goto LA29;
								j_304439 = res_304446;
								{
									NIM_BOOL LOC32;
									LOC32 = 0;
									LOC32 = comparetypes_264047((*inst_304411).sons->data[j_304439], (*key).sons->data[j_304439], ((NU8) 0), 8);
									if (!!(LOC32)) goto LA33;
									goto LA26;
								}
								LA33: ;
								res_304446 += ((NI) 1);
							} LA29: ;
						}
					}
					result = inst_304411;
					goto BeforeRet;
				} LA26: ;
				i_304453 += ((NI) 1);
			} LA17: ;
		}
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype227847*, lookuptypevar_305649)(Trepltypevars304577* cl, Ttype227847* t) {
	Ttype227847* result;
	Tidobj200015* LOC1;
	TNimObject* LOC2;
{	result = 0;
	LOC1 = 0;
	LOC1 = &t->Sup;
	LOC2 = 0;
	LOC2 = idtableget_235182((*cl).typemap, LOC1);
	result = ((Ttype227847*) (LOC2));
	{
		NimStringDesc* LOC13;
		Tidobj200015* 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_257032(t, ((NU8) 0));
		localerror_198128((*(*t).sym).info, ((NU16) 128), LOC13);
		result = errortype_283161((*cl).c);
		LOC14 = 0;
		LOC14 = &t->Sup;
		LOC15 = 0;
		LOC15 = &result->Sup.Sup;
		idtableput_235196((&(*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_198172((*cl).info, ((NimStringDesc*) &TMP2746));
	}
	goto LA3;
	LA19: ;
	LA3: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype227847*, instcopytype_305694)(Trepltypevars304577* cl, Ttype227847* t) {
	Ttype227847* result;
	result = 0;
	result = copytype_230542(t, (*t).owner, (*cl).allowmetatypes);
	(*result).flags |= ((NU32)1)<<((((NU8) 8))%(sizeof(NU32)*8));
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC5;
		LOC3 = 0;
		LOC3 = ((*t).kind == ((NU8) 6) || (*t).kind == ((NU8) 8) || (*t).kind == ((NU8) 12) || (*t).kind >= ((NU8) 51) && (*t).kind <= ((NU8) 58));
		if (LOC3) goto LA4;
		LOC5 = 0;
		LOC5 = ((*t).kind == ((NU8) 59));
		if (!(LOC5)) goto LA6;
		LOC5 = ((*t).n == NIM_NIL);
		LA6: ;
		LOC3 = LOC5;
		LA4: ;
		if (!!(LOC3)) goto LA7;
		(*result).flags = ((*result).flags & ~ 524288);
	}
	LA7: ;
	return result;
}

static N_INLINE(Cell48946*, usrtocell_52646)(void* usr) {
	Cell48946* result;
	result = 0;
	result = ((Cell48946*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(Cell48946))))));
	return result;
}

static N_INLINE(void, rtladdzct_54204)(Cell48946* c) {
	addzct_52617((&gch_51059.zct), c);
}

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

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

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

static N_INLINE(NIM_BOOL, isgcedmem_231235)(Ttype227847* t) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	NIM_BOOL LOC3;
	result = 0;
	LOC1 = 0;
	LOC1 = ((*t).kind == ((NU8) 28) || (*t).kind == ((NU8) 22) || (*t).kind == ((NU8) 24));
	if (LOC1) goto LA2;
	LOC3 = 0;
	LOC3 = ((*t).kind == ((NU8) 25));
	if (!(LOC3)) goto LA4;
	LOC3 = ((*t).callconv == ((NU8) 8));
	LA4: ;
	LOC1 = LOC3;
	LA2: ;
	result = LOC1;
	return result;
}

N_NIMCALL(void, sharedptrcheck_304014)(Tlineinfo192352 info, Ttype227847* t) {
	{
		NIM_BOOL LOC3;
		NI LOC5;
		LOC3 = 0;
		LOC3 = ((*t).kind == ((NU8) 21));
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = len_230369(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_231235(t);
				LA15: ;
				if (!LOC14) goto LA16;
				localerror_198128(info, ((NU16) 4), ((NimStringDesc*) &TMP2749));
			}
			LA16: ;
		}
		LA10: ;
	}
	LA6: ;
}

N_NIMCALL(void, checkpartialconstructedtype_304063)(Tlineinfo192352 info, Ttype227847* t) {
	{
		NIM_BOOL LOC3;
		Ttype227847* LOC5;
		LOC3 = 0;
		LOC3 = (((*t).flags &(1<<((((NU8) 4))&31)))!=0);
		if (!(LOC3)) goto LA4;
		LOC5 = 0;
		LOC5 = skiptypes_231167(t, IL64(211106232576256));
		LOC3 = !(((*LOC5).kind == ((NU8) 17)));
		LA4: ;
		if (!LOC3) goto LA6;
		localerror_198128(info, ((NU16) 166), ((NimStringDesc*) &TMP2747));
	}
	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_198128(info, ((NU16) 202), ((NimStringDesc*) &TMP2748));
	}
	goto LA1;
	LA11: ;
	{
		sharedptrcheck_304014(info, t);
	}
	LA1: ;
}

N_NIMCALL(Ttype227847*, handlegenericinvocation_305760)(Trepltypevars304577* cl, Ttype227847* t) {
	Ttype227847* result;
	Ttype227847* body;
	Ttype227847* header;
	TY395275 LOC46;
	NIM_BOOL oldskiptypedesc;
	Ttype227847* newbody;
	Ttype227847* LOC64;
	Tsym227841* dc;
	Tsym227841* asgn;
{	result = 0;
	body = (*t).sons->data[((NI) 0)];
	{
		if (!!(((*body).kind == ((NU8) 10)))) goto LA3;
		internalerror_198172((*cl).info, ((NimStringDesc*) &TMP2739));
	}
	LA3: ;
	header = t;
	{
		Tidobj200015* LOC9;
		TNimObject* LOC10;
		if (!(*cl).allowmetatypes) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_235182((*cl).localcache, LOC9);
		result = ((Ttype227847*) (LOC10));
	}
	goto LA5;
	LA7: ;
	{
		result = searchinsttypes_304207(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_305836;
		NI HEX3Atmp_306126;
		NI LOC19;
		NI res_306129;
		i_305836 = 0;
		HEX3Atmp_306126 = 0;
		LOC19 = 0;
		LOC19 = sonslen_230351(t);
		HEX3Atmp_306126 = (NI)(LOC19 - ((NI) 1));
		res_306129 = ((NI) 1);
		{
			while (1) {
				Ttype227847* x;
				if (!(res_306129 <= HEX3Atmp_306126)) goto LA21;
				i_305836 = res_306129;
				x = (*t).sons->data[i_305836];
				{
					if (!((*x).kind == ((NU8) 12))) goto LA24;
					x = lookuptypevar_305649(cl, x);
					{
						if (!!((x == NIM_NIL))) goto LA28;
						{
							if (!(header == t)) goto LA32;
							header = instcopytype_305694(cl, t);
						}
						LA32: ;
						asgnRefNoCycle((void**) (&(*header).sons->data[i_305836]), x);
						propagatetoowner_231274(header, x);
					}
					LA28: ;
				}
				goto LA22;
				LA24: ;
				{
					propagatetoowner_231274(header, x);
				}
				LA22: ;
				res_306129 += ((NI) 1);
			} LA21: ;
		}
	}
	{
		if (!!((header == t))) goto LA37;
		result = searchinsttypes_304207(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_305694(cl, t);
	}
	LA35: ;
	result = newtype_230140(((NU8) 11), (*(*t).sons->data[((NI) 0)]).owner);
	(*result).flags = (*header).flags;
	if ((*result).sons) nimGCunrefNoCycle((*result).sons);
	(*result).sons = (Ttypeseq227843*) newSeqRC1((&NTI227843), 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_304483(result);
	}
	goto LA47;
	LA49: ;
	{
		Tidobj200015* LOC52;
		TNimObject* LOC53;
		LOC52 = 0;
		LOC52 = &t->Sup;
		LOC53 = 0;
		LOC53 = &result->Sup.Sup;
		idtableput_235196((&(*cl).localcache), LOC52, LOC53);
	}
	LA47: ;
	oldskiptypedesc = (*cl).skiptypedesc;
	(*cl).skiptypedesc = NIM_TRUE;
	{
		NI i_305955;
		NI HEX3Atmp_306134;
		NI LOC55;
		NI res_306137;
		i_305955 = 0;
		HEX3Atmp_306134 = 0;
		LOC55 = 0;
		LOC55 = sonslen_230351(t);
		HEX3Atmp_306134 = (NI)(LOC55 - ((NI) 1));
		res_306137 = ((NI) 1);
		{
			while (1) {
				Ttype227847* x;
				Tidobj200015* LOC58;
				TNimObject* LOC59;
				if (!(res_306137 <= HEX3Atmp_306134)) goto LA57;
				i_305955 = res_306137;
				x = replacetypevarst_304627(cl, (*t).sons->data[i_305955]);
				asgnRefNoCycle((void**) (&(*header).sons->data[i_305955]), x);
				propagatetoowner_231274(header, x);
				LOC58 = 0;
				LOC58 = &(*body).sons->data[(NI)(i_305955 - ((NI) 1))]->Sup;
				LOC59 = 0;
				LOC59 = &x->Sup.Sup;
				idtableput_235196((&(*cl).typemap), LOC58, LOC59);
				res_306137 += ((NI) 1);
			} LA57: ;
		}
	}
	{
		NI i_306014;
		NI HEX3Atmp_306142;
		NI LOC61;
		NI res_306145;
		i_306014 = 0;
		HEX3Atmp_306142 = 0;
		LOC61 = 0;
		LOC61 = sonslen_230351(t);
		HEX3Atmp_306142 = (NI)(LOC61 - ((NI) 1));
		res_306145 = ((NI) 1);
		{
			while (1) {
				if (!(res_306145 <= HEX3Atmp_306142)) goto LA63;
				i_306014 = res_306145;
				rawaddson_231498(result, (*header).sons->data[i_306014]);
				res_306145 += ((NI) 1);
			} LA63: ;
		}
	}
	LOC64 = 0;
	LOC64 = lastson_230426(body);
	newbody = replacetypevarst_304627(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_263091(newbody);
		if (!LOC67) goto LA68;
		newbody = skipgenericalias_263119(newbody);
	}
	LA68: ;
	rawaddson_231498(result, newbody);
	checkpartialconstructedtype_304063((*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(Tsym227841*, replacetypevarss_304598)(Trepltypevars304577* cl, Tsym227841* s) {
	Tsym227841* result;
	Tidobj200015* 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_235182((*cl).symmap, LOC11);
	result = ((Tsym227841*) (LOC12));
	{
		Tidobj200015* LOC17;
		TNimObject* LOC18;
		if (!(result == NIM_NIL)) goto LA15;
		result = copysym_230607(s, NIM_FALSE);
		(*result).flags |= ((NU32)1)<<((((NU8) 2))%(sizeof(NU32)*8));
		LOC17 = 0;
		LOC17 = &s->Sup;
		LOC18 = 0;
		LOC18 = &result->Sup.Sup;
		idtableput_235196((&(*cl).symmap), LOC17, LOC18);
		asgnRefNoCycle((void**) (&(*result).owner), (*s).owner);
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_304627(cl, (*s).typ));
		asgnRefNoCycle((void**) (&(*result).ast), replacetypevarsn_304606(cl, (*s).ast));
	}
	LA15: ;
	}BeforeRet: ;
	return result;
}

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

N_NIMCALL(Tnode227809*, preparenode_304807)(Trepltypevars304577* cl, Tnode227809* n) {
	Tnode227809* result;
	Ttype227847* t;
	NIM_BOOL iscall;
{	result = 0;
	t = replacetypevarst_304627(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_231660(n);
	asgnRefNoCycle((void**) (&(*result).typ), t);
	{
		if (!((*result).kind == ((NU8) 3))) goto LA11;
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_304598(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_304888;
		NI HEX3Atmp_304892;
		NI LOC14;
		NI res_304895;
		i_304888 = 0;
		HEX3Atmp_304892 = 0;
		LOC14 = 0;
		LOC14 = safelen_228126(n);
		HEX3Atmp_304892 = (LOC14 - 1);
		res_304895 = ((NI) 0);
		{
			while (1) {
				if (!(res_304895 <= HEX3Atmp_304892)) goto LA16;
				i_304888 = res_304895;
				{
					NIM_BOOL LOC19;
					Tnode227809* LOC23;
					LOC19 = 0;
					LOC19 = iscall;
					if (!(LOC19)) goto LA20;
					LOC19 = (i_304888 == ((NI) 0));
					LA20: ;
					if (!LOC19) goto LA21;
					LOC23 = 0;
					LOC23 = HEX5BHEX5D_228244(n, i_304888);
					add_228165(result, LOC23);
				}
				goto LA17;
				LA21: ;
				{
					Tnode227809* LOC25;
					Tnode227809* LOC26;
					LOC25 = 0;
					LOC25 = HEX5BHEX5D_228244(n, i_304888);
					LOC26 = 0;
					LOC26 = preparenode_304807(cl, LOC25);
					add_228165(result, LOC26);
				}
				LA17: ;
				res_304895 += ((NI) 1);
			} LA16: ;
		}
	}
	}BeforeRet: ;
	return result;
}

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

static N_INLINE(NI, len_228098)(Tnode227809* 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_306434)(Ttype227847* t, Tnode227809* n) {
{	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		NimStringDesc* LOC9;
		if (!!(!(((*n).kind == ((NU8) 140))))) goto LA7;
		LOC9 = 0;
		LOC9 = HEX24_198279(TMP2753);
		internalerror_198191(LOC9);
	}
	LA7: ;
	switch ((*n).kind) {
	case ((NU8) 3):
	{
		propagatetoowner_231274(t, (*(*n).kindU.S4.sym).typ);
	}
	break;
	case ((NU8) 138):
	case ((NU8) 139):
	case ((NU8) 85):
	case ((NU8) 88):
	{
		{
			Tnode227809* son_306465;
			son_306465 = 0;
			{
				NI i_306470;
				NI HEX3Atmp_306472;
				NI LOC14;
				NI res_306474;
				i_306470 = 0;
				HEX3Atmp_306472 = 0;
				LOC14 = 0;
				LOC14 = len_228098(n);
				HEX3Atmp_306472 = (LOC14 - 1);
				res_306474 = ((NI) 0);
				{
					while (1) {
						if (!(res_306474 <= HEX3Atmp_306472)) goto LA16;
						i_306470 = res_306474;
						son_306465 = (*n).kindU.S6.sons->data[i_306470];
						propagatefieldflags_306434(t, son_306465);
						res_306474 += ((NI) 1);
					} LA16: ;
				}
			}
		}
	}
	break;
	default:
	{
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, erasevoidparams_306182)(Ttype227847* 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_306224;
		NI HEX3Atmp_306305;
		NI LOC8;
		NI res_306308;
		i_306224 = 0;
		HEX3Atmp_306305 = 0;
		LOC8 = 0;
		LOC8 = sonslen_230351(t);
		HEX3Atmp_306305 = (LOC8 - 1);
		res_306308 = ((NI) 1);
		{
			while (1) {
				if (!(res_306308 <= HEX3Atmp_306305)) goto LA10;
				i_306224 = res_306308;
				{
					NI pos;
					if (!((*(*t).sons->data[i_306224]).kind == ((NU8) 3))) goto LA13;
					pos = i_306224;
					{
						NI j_306253;
						NI HEX3Atmp_306297;
						NI HEX3Atmp_306298;
						NI LOC16;
						NI res_306301;
						j_306253 = 0;
						HEX3Atmp_306297 = 0;
						HEX3Atmp_306298 = 0;
						HEX3Atmp_306297 = (NI)(i_306224 + ((NI) 1));
						LOC16 = 0;
						LOC16 = sonslen_230351(t);
						HEX3Atmp_306298 = (LOC16 - 1);
						res_306301 = HEX3Atmp_306297;
						{
							while (1) {
								if (!(res_306301 <= HEX3Atmp_306298)) goto LA18;
								j_306253 = res_306301;
								{
									if (!!(((*(*t).sons->data[j_306253]).kind == ((NU8) 3)))) goto LA21;
									asgnRefNoCycle((void**) (&(*t).sons->data[pos]), (*t).sons->data[j_306253]);
									asgnRefNoCycle((void**) (&(*(*t).n).kindU.S6.sons->data[pos]), (*(*t).n).kindU.S6.sons->data[j_306253]);
									pos += ((NI) 1);
								}
								LA21: ;
								res_306301 += ((NI) 1);
							} LA18: ;
						}
					}
					(*t).sons = (Ttypeseq227843*) setLengthSeq(&((*t).sons)->Sup, sizeof(Ttype227847*), ((NI) (pos)));
					(*(*t).n).kindU.S6.sons = (Tnodeseq227803*) setLengthSeq(&((*(*t).n).kindU.S6.sons)->Sup, sizeof(Tnode227809*), ((NI) (pos)));
					goto BeforeRet;
				}
				LA13: ;
				res_306308 += ((NI) 1);
			} LA10: ;
		}
	}
	}BeforeRet: ;
}

N_NIMCALL(void, skipintliteralparams_306336)(Ttype227847* t) {
	{
		NI i_306357;
		NI HEX3Atmp_306409;
		NI LOC2;
		NI res_306412;
		i_306357 = 0;
		HEX3Atmp_306409 = 0;
		LOC2 = 0;
		LOC2 = sonslen_230351(t);
		HEX3Atmp_306409 = (LOC2 - 1);
		res_306412 = ((NI) 0);
		{
			while (1) {
				if (!(res_306412 <= HEX3Atmp_306409)) goto LA4;
				i_306357 = res_306412;
				{
					Ttype227847* p;
					Ttype227847* skipped;
					p = (*t).sons->data[i_306357];
					{
						if (!(p == NIM_NIL)) goto LA8;
						goto LA5;
					}
					LA8: ;
					skipped = skipintlit_276696(p);
					{
						if (!!((skipped == p))) goto LA12;
						asgnRefNoCycle((void**) (&(*t).sons->data[i_306357]), skipped);
						{
							if (!(((NI) 0) < i_306357)) goto LA16;
							asgnRefNoCycle((void**) (&(*(*(*(*t).n).kindU.S6.sons->data[i_306357]).kindU.S4.sym).typ), skipped);
						}
						LA16: ;
					}
					LA12: ;
				} LA5: ;
				res_306412 += ((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_257039((*t).sons->data[((NI) 0)]));
	}
	LA22: ;
}

N_NIMCALL(Ttype227847*, replacetypevarstaux_304590)(Trepltypevars304577* cl, Ttype227847* t) {
	Ttype227847* result;
{	result = 0;
	result = t;
	{
		if (!(t == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		Ttype227847* lookup;
		Tidobj200015* LOC9;
		TNimObject* LOC10;
		if (!((*t).kind == ((NU8) 12) || (*t).kind == ((NU8) 49) || (*t).kind >= ((NU8) 51) && (*t).kind <= ((NU8) 59))) goto LA7;
		LOC9 = 0;
		LOC9 = &t->Sup;
		LOC10 = 0;
		LOC10 = idtableget_235182((*cl).typemap, LOC9);
		lookup = ((Ttype227847*) (LOC10));
		{
			if (!!((lookup == NIM_NIL))) goto LA13;
			result = lookup;
			goto BeforeRet;
		}
		LA13: ;
	}
	LA7: ;
	switch ((*t).kind) {
	case ((NU8) 9):
	{
		result = handlegenericinvocation_305760(cl, t);
	}
	break;
	case ((NU8) 10):
	{
		NimStringDesc* LOC17;
		LOC17 = 0;
		LOC17 = typetostring_257032(t, ((NU8) 0));
		localerror_198128((*cl).info, ((NU16) 128), LOC17);
		result = errortype_283161((*cl).c);
	}
	break;
	case ((NU8) 60):
	{
		Tnode227809* n;
		{
			if (!(*cl).allowmetatypes) goto LA21;
			goto BeforeRet;
		}
		LA21: ;
		n = preparenode_304807(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_231167((*n).typ, 256);
		}
		goto LA27;
		LA29: ;
		{
			{
				TY395275 LOC36;
				if (!!(((*(*n).typ).kind == ((NU8) 59)))) goto LA34;
				result = newtypes_282221(((NU8) 59), (*cl).c);
				if ((*result).sons) nimGCunrefNoCycle((*result).sons);
				(*result).sons = (Ttypeseq227843*) newSeqRC1((&NTI227843), 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_276696(t);
	}
	break;
	case ((NU8) 8):
	{
		Ttype227847* lookup;
		Tidobj200015* LOC40;
		TNimObject* LOC41;
		LOC40 = 0;
		LOC40 = &t->Sup;
		LOC41 = 0;
		LOC41 = idtableget_235182((*cl).typemap, LOC40);
		lookup = ((Ttype227847*) (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_257039(result);
			}
			LA50: ;
		}
		goto LA42;
		LA44: ;
		{
			Ttype227847* LOC55;
			if (!!(((*(*t).sons->data[((NI) 0)]).kind == ((NU8) 0)))) goto LA53;
			LOC55 = 0;
			LOC55 = replacetypevarst_304627(cl, (*t).sons->data[((NI) 0)]);
			result = maketypedesc_282684((*cl).c, LOC55);
		}
		goto LA42;
		LA53: ;
		LA42: ;
	}
	break;
	case ((NU8) 52):
	{
		result = t;
	}
	break;
	case ((NU8) 11):
	{
		Tidobj200015* LOC68;
		TNimObject* LOC69;
		Ttype227847* LOC74;
		{
			Tidobj200015* LOC62;
			TNimObject* LOC63;
			if (!(((NI) 100) < (*cl).recursionlimit)) goto LA60;
			LOC62 = 0;
			LOC62 = &t->Sup;
			LOC63 = 0;
			LOC63 = idtableget_235182((*cl).localcache, LOC62);
			result = ((Ttype227847*) (LOC63));
			{
				if (!!((result == NIM_NIL))) goto LA66;
				goto BeforeRet;
			}
			LA66: ;
		}
		LA60: ;
		(*cl).recursionlimit += ((NI) 1);
		result = instcopytype_305694(cl, t);
		LOC68 = 0;
		LOC68 = &t->Sup;
		LOC69 = 0;
		LOC69 = &result->Sup.Sup;
		idtableput_235196((&(*cl).localcache), LOC68, LOC69);
		{
			NI i_306716;
			NI HEX3Atmp_306807;
			NI LOC71;
			NI res_306810;
			i_306716 = 0;
			HEX3Atmp_306807 = 0;
			LOC71 = 0;
			LOC71 = sonslen_230351(result);
			HEX3Atmp_306807 = (LOC71 - 1);
			res_306810 = ((NI) 1);
			{
				while (1) {
					if (!(res_306810 <= HEX3Atmp_306807)) goto LA73;
					i_306716 = res_306810;
					asgnRefNoCycle((void**) (&(*result).sons->data[i_306716]), replacetypevarst_304627(cl, (*result).sons->data[i_306716]));
					res_306810 += ((NI) 1);
				} LA73: ;
			}
		}
		LOC74 = 0;
		LOC74 = lastson_230426(result);
		propagatetoowner_231274(result, LOC74);
	}
	break;
	default:
	{
		{
			NIM_BOOL LOC78;
			Tidobj200015* LOC91;
			TNimObject* LOC92;
			LOC78 = 0;
			LOC78 = containsgenerictype_266310(t);
			if (!LOC78) goto LA79;
			{
				Tidobj200015* LOC85;
				TNimObject* LOC86;
				if (!(((NI) 100) < (*cl).recursionlimit)) goto LA83;
				LOC85 = 0;
				LOC85 = &t->Sup;
				LOC86 = 0;
				LOC86 = idtableget_235182((*cl).localcache, LOC85);
				result = ((Ttype227847*) (LOC86));
				{
					if (!!((result == NIM_NIL))) goto LA89;
					goto BeforeRet;
				}
				LA89: ;
			}
			LA83: ;
			(*cl).recursionlimit += ((NI) 1);
			result = instcopytype_305694(cl, t);
			(*result).size = IL64(-1);
			LOC91 = 0;
			LOC91 = &t->Sup;
			LOC92 = 0;
			LOC92 = &result->Sup.Sup;
			idtableput_235196((&(*cl).localcache), LOC91, LOC92);
			{
				NI i_306752;
				NI HEX3Atmp_306815;
				NI LOC94;
				NI res_306818;
				i_306752 = 0;
				HEX3Atmp_306815 = 0;
				LOC94 = 0;
				LOC94 = sonslen_230351(result);
				HEX3Atmp_306815 = (NI)(LOC94 - ((NI) 1));
				res_306818 = ((NI) 0);
				{
					while (1) {
						if (!(res_306818 <= HEX3Atmp_306815)) goto LA96;
						i_306752 = res_306818;
						{
							Ttype227847* r;
							if (!!(((*result).sons->data[i_306752] == NIM_NIL))) goto LA99;
							r = replacetypevarst_304627(cl, (*result).sons->data[i_306752]);
							{
								Ttype227847* r2;
								if (!((*result).kind == ((NU8) 17))) goto LA103;
								r2 = skiptypes_231167(r, 2048);
								{
									if (!((*r2).kind == ((NU8) 21) || (*r2).kind == ((NU8) 22))) goto LA107;
									r = skiptypes_231167(r2, 6291456);
								}
								LA107: ;
							}
							LA103: ;
							asgnRefNoCycle((void**) (&(*result).sons->data[i_306752]), r);
							propagatetoowner_231274(result, r);
						}
						LA99: ;
						res_306818 += ((NI) 1);
					} LA96: ;
				}
			}
			asgnRefNoCycle((void**) (&(*result).n), replacetypevarsn_304606(cl, (*result).n));
			switch ((*result).kind) {
			case ((NU8) 16):
			{
				Ttype227847* idx;
				idx = (*result).sons->data[((NI) 0)];
				{
					NimStringDesc* LOC114;
					if (!!(!(((*idx).kind == ((NU8) 59))))) goto LA112;
					LOC114 = 0;
					LOC114 = HEX24_198279(TMP2752);
					internalerror_198191(LOC114);
				}
				LA112: ;
			}
			break;
			case ((NU8) 17):
			case ((NU8) 18):
			{
				propagatefieldflags_306434(result, (*result).n);
			}
			break;
			case ((NU8) 25):
			{
				erasevoidparams_306182(result);
				skipintliteralparams_306336(result);
			}
			break;
			default:
			{
			}
			break;
			}
		}
		LA79: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ttype227847*, replacetypevarst_304627)(Trepltypevars304577* cl, Ttype227847* t) {
	Ttype227847* result;
	result = 0;
	result = replacetypevarstaux_304590(cl, t);
	return result;
}

N_NIMCALL(NIM_BOOL, istypeparam_304914)(Tnode227809* 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(Tnode227809*, reresolvecallswithtypedescparams_305071)(Trepltypevars304577* cl, Tnode227809* n) {
	Tnode227809* result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		Tnode227809* 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_228244(n, ((NI) 0));
		LOC3 = (((*(*LOC5).kindU.S4.sym).flags &(1<<((((NU8) 2))&31)))!=0);
		LA4: ;
		if (!LOC3) goto LA6;
		needsfixing = NIM_FALSE;
		{
			NI i_305119;
			NI HEX3Atmp_305147;
			NI LOC9;
			NI res_305150;
			i_305119 = 0;
			HEX3Atmp_305147 = 0;
			LOC9 = 0;
			LOC9 = safelen_228126(n);
			HEX3Atmp_305147 = (LOC9 - 1);
			res_305150 = ((NI) 1);
			{
				while (1) {
					if (!(res_305150 <= HEX3Atmp_305147)) goto LA11;
					i_305119 = res_305150;
					{
						Tnode227809* LOC14;
						NIM_BOOL LOC15;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_228244(n, i_305119);
						LOC15 = 0;
						LOC15 = istypeparam_304914(LOC14);
						if (!LOC15) goto LA16;
						needsfixing = NIM_TRUE;
					}
					LA16: ;
					res_305150 += ((NI) 1);
				} LA11: ;
			}
		}
		{
			if (!needsfixing) goto LA20;
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_229325((*(*(*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_305144;
		NI HEX3Atmp_305155;
		NI LOC23;
		NI res_305158;
		i_305144 = 0;
		HEX3Atmp_305155 = 0;
		LOC23 = 0;
		LOC23 = safelen_228126(n);
		HEX3Atmp_305155 = (LOC23 - 1);
		res_305158 = ((NI) 0);
		{
			while (1) {
				Tnode227809* LOC26;
				if (!(res_305158 <= HEX3Atmp_305155)) goto LA25;
				i_305144 = res_305158;
				LOC26 = 0;
				LOC26 = HEX5BHEX5D_228244(n, i_305144);
				asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[i_305144]), reresolvecallswithtypedescparams_305071(cl, LOC26));
				res_305158 += ((NI) 1);
			} LA25: ;
		}
	}
	result = n;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode227809*, replacetypevarsn_304606)(Trepltypevars304577* cl, Tnode227809* n_304610) {
	Tnode227809* result;
{	result = 0;
	{
		if (!(n_304610 == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	result = copynode_231660(n_304610);
	{
		if (!!(((*n_304610).typ == NIM_NIL))) goto LA7;
		asgnRefNoCycle((void**) (&(*result).typ), replacetypevarst_304627(cl, (*n_304610).typ));
	}
	LA7: ;
	switch ((*n_304610).kind) {
	case ((NU8) 0) ... ((NU8) 2):
	case ((NU8) 4) ... ((NU8) 23):
	{
	}
	break;
	case ((NU8) 3):
	{
		asgnRefNoCycle((void**) (&(*result).kindU.S4.sym), replacetypevarss_304598(cl, (*n_304610).kindU.S4.sym));
		{
			Tnodeseq227803* LOC15;
			if (!((*(*(*result).kindU.S4.sym).typ).kind == ((NU8) 3))) goto LA13;
			LOC15 = 0;
			LOC15 = (Tnodeseq227803*) newSeq((&NTI227803), 0);
			result = newnode_229607(((NU8) 138), (*n_304610).info, LOC15, NIM_NIL);
		}
		LA13: ;
	}
	break;
	case ((NU8) 140):
	{
		Tnode227809* branch;
		branch = NIM_NIL;
		{
			NI i_305447;
			NI HEX3Atmp_305532;
			NI LOC18;
			NI res_305535;
			i_305447 = 0;
			HEX3Atmp_305532 = 0;
			LOC18 = 0;
			LOC18 = sonslen_230387(n_304610);
			HEX3Atmp_305532 = (NI)(LOC18 - ((NI) 1));
			res_305535 = ((NI) 0);
			{
				while (1) {
					Tnode227809* it;
					if (!(res_305535 <= HEX3Atmp_305532)) goto LA20;
					i_305447 = res_305535;
					it = (*n_304610).kindU.S6.sons->data[i_305447];
					{
						if (!(it == NIM_NIL)) goto LA23;
						illformedast_283240(n_304610);
					}
					LA23: ;
					switch ((*it).kind) {
					case ((NU8) 86):
					{
						Tnode227809* cond;
						Tnode227809* e;
						checksonslen_283260(it, ((NI) 2));
						cond = preparenode_304807(cl, (*it).kindU.S6.sons->data[((NI) 0)]);
						e = (*(*cl).c).semconstexpr((*cl).c, cond);
						{
							if (!!(((*e).kind == ((NU8) 6)))) goto LA28;
							internalerror_198172((*e).info, ((NimStringDesc*) &TMP2754));
						}
						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_283260(it, ((NI) 1));
						{
							if (!(branch == NIM_NIL)) goto LA39;
							branch = (*it).kindU.S6.sons->data[((NI) 0)];
						}
						LA39: ;
					}
					break;
					default:
					{
						illformedast_283240(n_304610);
					}
					break;
					}
					res_305535 += ((NI) 1);
				} LA20: ;
			}
		}
		{
			if (!!((branch == NIM_NIL))) goto LA44;
			result = replacetypevarsn_304606(cl, branch);
		}
		goto LA42;
		LA44: ;
		{
			result = newnodei_229351(((NU8) 138), (*n_304610).info);
		}
		LA42: ;
	}
	break;
	case ((NU8) 62):
	{
		Tnode227809* n;
		n = preparenode_304807(cl, n_304610);
		n = reresolvecallswithtypedescparams_305071(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_230387(n_304610);
		{
			if (!(((NI) 0) < length)) goto LA56;
			newsons_230272(result, length);
			{
				NI i_305527;
				NI HEX3Atmp_305540;
				NI res_305543;
				i_305527 = 0;
				HEX3Atmp_305540 = 0;
				HEX3Atmp_305540 = (NI)(length - ((NI) 1));
				res_305543 = ((NI) 0);
				{
					while (1) {
						if (!(res_305543 <= HEX3Atmp_305540)) goto LA60;
						i_305527 = res_305543;
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[i_305527]), replacetypevarsn_304606(cl, (*n_304610).kindU.S6.sons->data[i_305527]));
						res_305543 += ((NI) 1);
					} LA60: ;
				}
			}
		}
		LA56: ;
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode227809*, replacetypesinbody_306862)(Tcontext282023* p, Tidtable227859 pt, Tnode227809* n, Tsym227841* owner) {
	Tnode227809* result;
	Trepltypevars304577 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_306846(p, pt, (*n).info, owner, (&cl));
	pushinfocontext_193581((*n).info);
	result = replacetypevarsn_304606((&cl), n);
	popinfocontext_193600();
	return result;
}

N_NIMCALL(Ttype227847*, generatetypeinstance_306894)(Tcontext282023* p, Tidtable227859 pt, Tlineinfo192352 info, Ttype227847* t) {
	Ttype227847* result;
	Trepltypevars304577 cl;
	result = 0;
	memset((void*)(&cl), 0, sizeof(cl));
	chckNil((void*)(&cl));
	memset((void*)(&cl), 0, sizeof(cl));
	inittypevars_306846(p, pt, info, NIM_NIL, (&cl));
	pushinfocontext_193581(info);
	result = replacetypevarst_304627((&cl), t);
	popinfocontext_193600();
	return result;
}

N_NIMCALL(NIM_BOOL, hasgenericarguments_304965)(Tnode227809* 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_305046;
			NI HEX3Atmp_305049;
			NI LOC11;
			NI res_305052;
			i_305046 = 0;
			HEX3Atmp_305049 = 0;
			LOC11 = 0;
			LOC11 = safelen_228126(n);
			HEX3Atmp_305049 = (LOC11 - 1);
			res_305052 = ((NI) 0);
			{
				while (1) {
					if (!(res_305052 <= HEX3Atmp_305049)) goto LA13;
					i_305046 = res_305052;
					{
						NIM_BOOL LOC16;
						LOC16 = 0;
						LOC16 = hasgenericarguments_304965((*n).kindU.S6.sons->data[i_305046]);
						if (!LOC16) goto LA17;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA17: ;
					res_305052 += ((NI) 1);
				} LA13: ;
			}
		}
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, checkconstructedtype_304110)(Tlineinfo192352 info, Ttype227847* typ) {
	Ttype227847* t;
	t = skiptypes_231167(typ, 8192);
	{
		if (!((*t).kind == ((NU8) 51) || (*t).kind == ((NU8) 54) || (*t).kind == ((NU8) 52) || (*t).kind == ((NU8) 53) || (*t).kind == ((NU8) 55) || (*t).kind == ((NU8) 56) || (*t).kind == ((NU8) 57) || (*t).kind == ((NU8) 58))) goto LA3;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		Ttype227847* LOC8;
		LOC6 = 0;
		LOC6 = (((*t).flags &(1<<((((NU8) 4))&31)))!=0);
		if (!(LOC6)) goto LA7;
		LOC8 = 0;
		LOC8 = skiptypes_231167(t, IL64(211106232576256));
		LOC6 = !(((*LOC8).kind == ((NU8) 17)));
		LA7: ;
		if (!LOC6) goto LA9;
		localerror_198128(info, ((NU16) 166), ((NimStringDesc*) &TMP2747));
	}
	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_198128(info, ((NU16) 202), ((NimStringDesc*) &TMP2748));
	}
	goto LA1;
	LA14: ;
	{
		NI64 LOC17;
		NimStringDesc* LOC20;
		LOC17 = 0;
		LOC17 = computesize_257184(t);
		if (!(LOC17 == IL64(-2))) goto LA18;
		LOC20 = 0;
		LOC20 = typetostring_257032(t, ((NU8) 0));
		localerror_198128(info, ((NU16) 127), LOC20);
	}
	goto LA1;
	LA18: ;
	{
		sharedptrcheck_304014(info, t);
	}
	LA1: ;
}
NIM_EXTERNC N_NOINLINE(void, compiler_semtypinstInit000)(void) {
}

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

