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

#include "nimbase.h"
#include <string.h>
typedef struct Tnode213790 Tnode213790;
typedef struct Tcontext263020 Tcontext263020;
typedef struct Intset210035 Intset210035;
typedef struct Trunk210031 Trunk210031;
typedef struct Trunkseq210033 Trunkseq210033;
typedef struct Tsym213822 Tsym213822;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Ttype213828 Ttype213828;
typedef struct Tlineinfo181337 Tlineinfo181337;
typedef struct Tident188012 Tident188012;
typedef struct Tnodeseq213784 Tnodeseq213784;
typedef struct Tidobj188006 Tidobj188006;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq213824 Ttypeseq213824;
typedef struct Tscope213816 Tscope213816;
typedef struct TY213925 TY213925;
typedef struct Tstrtable213794 Tstrtable213794;
typedef struct Tsymseq213792 Tsymseq213792;
typedef struct Tloc213804 Tloc213804;
typedef struct Ropeobj168006 Ropeobj168006;
typedef struct Tlib213808 Tlib213808;
typedef struct Cell47705 Cell47705;
typedef struct Cellseq47721 Cellseq47721;
typedef struct Gcheap50018 Gcheap50018;
typedef struct Gcstack50016 Gcstack50016;
typedef struct Cellset47717 Cellset47717;
typedef struct Pagedesc47713 Pagedesc47713;
typedef struct Memregion29888 Memregion29888;
typedef struct Smallchunk29840 Smallchunk29840;
typedef struct Llchunk29882 Llchunk29882;
typedef struct Bigchunk29842 Bigchunk29842;
typedef struct Intset29814 Intset29814;
typedef struct Trunk29810 Trunk29810;
typedef struct Avlnode29886 Avlnode29886;
typedef struct Gcstat50014 Gcstat50014;
typedef struct Tpasscontext260002 Tpasscontext260002;
typedef struct Tproccon263008 Tproccon263008;
typedef struct Tlinkedlist135016 Tlinkedlist135016;
typedef struct Tlistentry135010 Tlistentry135010;
typedef struct Tidtable213840 Tidtable213840;
typedef struct Tidpairseq213838 Tidpairseq213838;
typedef struct Tctx262036 Tctx262036;
typedef struct TY263140 TY263140;
typedef struct Ttabiter220071 Ttabiter220071;
typedef struct Tidentiter220084 Tidentiter220084;
typedef struct Tinstantiation213812 Tinstantiation213812;
typedef struct Basechunk29838 Basechunk29838;
typedef struct Freecell29830 Freecell29830;
typedef struct Tidpair213836 Tidpair213836;
typedef struct TY262242 TY262242;
typedef struct TY182090 TY182090;
typedef struct PprocHEX3Aobjecttype262221 PprocHEX3Aobjecttype262221;
typedef struct TY262261 TY262261;
typedef struct Tinstantiationpair263010 Tinstantiationpair263010;
typedef struct TY213913 TY213913;
typedef struct TY262222 TY262222;
typedef struct TY262227 TY262227;
typedef struct TY262262 TY262262;
typedef struct Vmargs262030 Vmargs262030;
typedef struct Tblock262018 Tblock262018;
typedef struct TY262202 TY262202;
struct  Intset210035  {
NI counter;
NI max;
Trunk210031* head;
Trunkseq210033* data;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tlineinfo181337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tnode213790  {
Ttype213828* typ;
Tlineinfo181337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym213822* sym;
} S4;
struct {Tident188012* ident;
} S5;
struct {Tnodeseq213784* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
typedef N_NIMCALL_PTR(void, TY3489) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3494) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3489 marker;
TY3494 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj188006  {
  TNimObject Sup;
NI id;
};
struct  Tident188012  {
  Tidobj188006 Sup;
NimStringDesc* s;
Tident188012* next;
NI h;
};
struct  Tstrtable213794  {
NI counter;
Tsymseq213792* data;
};
struct  Tloc213804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype213828* t;
Ropeobj168006* r;
Ropeobj168006* heaproot;
};
struct  Tsym213822  {
  Tidobj188006 Sup;
NU8 kind;
union{
struct {Ttypeseq213824* typeinstcache;
Tscope213816* typscope;
} S1;
struct {TY213925* procinstcache;
Tsym213822* gcunsafetyreason;
} S2;
struct {TY213925* usedgenerics;
Tstrtable213794 tab;
} S3;
struct {Tsym213822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype213828* typ;
Tident188012* name;
Tlineinfo181337 info;
Tsym213822* owner;
NU32 flags;
Tnode213790* ast;
NU32 options;
NI position;
NI offset;
Tloc213804 loc;
Tlib213808* annex;
Tnode213790* constraint;
};
struct  Cell47705  {
NI refcount;
TNimType* typ;
};
struct  Cellseq47721  {
NI len;
NI cap;
Cell47705** d;
};
struct  Cellset47717  {
NI counter;
NI max;
Pagedesc47713* head;
Pagedesc47713** data;
};
typedef Smallchunk29840* TY29903[512];
typedef Trunk29810* Trunkbuckets29812[256];
struct  Intset29814  {
Trunkbuckets29812 data;
};
struct  Memregion29888  {
NI minlargeobj;
NI maxlargeobj;
TY29903 freesmallchunks;
Llchunk29882* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk29842* freechunkslist;
Intset29814 chunkstarts;
Avlnode29886* root;
Avlnode29886* deleted;
Avlnode29886* last;
Avlnode29886* freeavlnodes;
};
struct  Gcstat50014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap50018  {
Gcstack50016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq47721 zct;
Cellseq47721 decstack;
Cellset47717 cycleroots;
Cellseq47721 tempstack;
NI recgclock;
Memregion29888 region;
Gcstat50014 stat;
};
typedef N_NIMCALL_PTR(Tsym213822*, TY260049) (Tsym213822* m, NI32 fileidx);
struct  Tpasscontext260002  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Tlinkedlist135016  {
Tlistentry135010* head;
Tlistentry135010* tail;
NI counter;
};
struct  Tidtable213840  {
NI counter;
Tidpairseq213838* data;
};
typedef N_NIMCALL_PTR(Tnode213790*, TY263071) (Tcontext263020* c, Tnode213790* n);
typedef N_NIMCALL_PTR(Tnode213790*, TY263076) (Tcontext263020* c, Tnode213790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode213790*, TY263084) (Tcontext263020* c, Tnode213790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode213790*, TY263092) (Tcontext263020* c, Tnode213790* n);
typedef N_NIMCALL_PTR(Tnode213790*, TY263097) (Tcontext263020* c, Tnode213790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode213790*, TY263105) (Tcontext263020* c, Tnode213790* n);
typedef N_NIMCALL_PTR(Tnode213790*, TY263110) (Tcontext263020* c, Tnode213790* n, Tnode213790* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype213828*, TY263117) (Tcontext263020* c, Tnode213790* n, Ttype213828* prev);
typedef struct {
N_NIMCALL_PTR(Tnode213790*, ClPrc) (Tcontext263020* c, Tidtable213840 pt, Tnode213790* n, void* ClEnv);
void* ClEnv;
} TY263123;
typedef struct {
N_NIMCALL_PTR(Tsym213822*, ClPrc) (Tcontext263020* c, Tsym213822* fn, Tidtable213840 pt, Tlineinfo181337 info, void* ClEnv);
void* ClEnv;
} TY263129;
typedef N_NIMCALL_PTR(Tsym213822*, TY263145) (Tcontext263020* c, Tsym213822* dc, Ttype213828* t, Tlineinfo181337 info, NU8 op);
struct  Tcontext263020  {
  Tpasscontext260002 Sup;
Tsym213822* module;
Tscope213816* currentscope;
Tscope213816* importtable;
Tscope213816* toplevelscope;
Tproccon263008* p;
Tsymseq213792* friendmodules;
NI instcounter;
Intset210035 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq213792* converters;
Tsymseq213792* patterns;
Tlinkedlist135016 optionstack;
Tidtable213840 symmapping;
Tlinkedlist135016 libs;
TY263071 semconstexpr;
TY263076 semexpr;
TY263084 semtryexpr;
TY263092 semtryconstexpr;
TY263097 semoperand;
TY263105 semconstboolexpr;
TY263110 semoverloadedcall;
TY263117 semtypenode;
TY263123 seminferredlambda;
TY263129 semgenerateinstance;
Intset210035 includedfiles;
Tstrtable213794 userpragmas;
Tctx262036* evalcontext;
Intset210035 unknownidents;
TY263140* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY263145 insttypeboundop;
};
struct  Ttabiter220071  {
NI h;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tscope213816  {
NI depthlevel;
Tstrtable213794 symbols;
Tnodeseq213784* usingsyms;
Tscope213816* parent;
};
struct  Ttype213828  {
  Tidobj188006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq213824* sons;
Tnode213790* n;
Tsym213822* owner;
Tsym213822* sym;
Tsym213822* destructor;
Tsym213822* deepcopy;
Tsym213822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc213804 loc;
};
struct  Tidentiter220084  {
NI h;
Tident188012* name;
};
typedef NI TY29819[8];
struct  Trunk210031  {
Trunk210031* next;
NI key;
TY29819 bits;
};
struct  Ropeobj168006  {
  TNimObject Sup;
Ropeobj168006* left;
Ropeobj168006* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry135010  {
  TNimObject Sup;
Tlistentry135010* prev;
Tlistentry135010* next;
};
struct  Tlib213808  {
  Tlistentry135010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj168006* name;
Tnode213790* path;
};
struct  Gcstack50016  {
Gcstack50016* prev;
Gcstack50016* next;
void* starts;
void* pos;
NI maxstacksize;
};
struct  Pagedesc47713  {
Pagedesc47713* next;
NI key;
TY29819 bits;
};
struct  Basechunk29838  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk29840  {
  Basechunk29838 Sup;
Smallchunk29840* next;
Smallchunk29840* prev;
Freecell29830* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk29882  {
NI size;
NI acc;
Llchunk29882* next;
};
struct  Bigchunk29842  {
  Basechunk29838 Sup;
Bigchunk29842* next;
Bigchunk29842* prev;
NI align;
NF data;
};
struct  Trunk29810  {
Trunk29810* next;
NI key;
TY29819 bits;
};
typedef Avlnode29886* TY29893[2];
struct  Avlnode29886  {
TY29893 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon263008  {
Tsym213822* owner;
Tsym213822* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon263008* next;
NIM_BOOL wasforwarded;
Tnode213790* bracketexpr;
};
struct  Tidpair213836  {
Tidobj188006* key;
TNimObject* val;
};
struct  Tctx262036  {
  Tpasscontext260002 Sup;
TY262242* code;
TY182090* debug;
Tnode213790* globals;
Tnode213790* constants;
Ttypeseq213824* types;
Tnode213790* currentexceptiona;
Tnode213790* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype262221* prc;
Tsym213822* module;
Tnode213790* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo181337 comesfromheuristic;
TY262261* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair263010  {
Tsym213822* genericsym;
Tinstantiation213812* inst;
};
struct  Tinstantiation213812  {
Tsym213822* sym;
Ttypeseq213824* concretetypes;
TY213913* usedby;
NI compilesid;
};
struct  Freecell29830  {
Freecell29830* next;
NI zerofield;
};
struct TY262227 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY262227 TY262230[256];
struct  PprocHEX3Aobjecttype262221  {
TY262222* blocks;
Tsym213822* sym;
TY262230 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs262030* args, void* ClEnv);
void* ClEnv;
} Vmcallback262032;
struct TY262262 {
NimStringDesc* Field0;
Vmcallback262032 Field1;
};
struct  Tblock262018  {
Tsym213822* label;
TY262202* fixups;
};
struct  Vmargs262030  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode213790* currentexception;
};
struct Tnodeseq213784 {
  TGenericSeq Sup;
  Tnode213790* data[SEQ_DECL_SIZE];
};
struct Trunkseq210033 {
  TGenericSeq Sup;
  Trunk210031* data[SEQ_DECL_SIZE];
};
struct Ttypeseq213824 {
  TGenericSeq Sup;
  Ttype213828* data[SEQ_DECL_SIZE];
};
struct TY213925 {
  TGenericSeq Sup;
  Tinstantiation213812* data[SEQ_DECL_SIZE];
};
struct Tsymseq213792 {
  TGenericSeq Sup;
  Tsym213822* data[SEQ_DECL_SIZE];
};
struct Tidpairseq213838 {
  TGenericSeq Sup;
  Tidpair213836 data[SEQ_DECL_SIZE];
};
struct TY263140 {
  TGenericSeq Sup;
  Tinstantiationpair263010 data[SEQ_DECL_SIZE];
};
struct TY262242 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY182090 {
  TGenericSeq Sup;
  Tlineinfo181337 data[SEQ_DECL_SIZE];
};
struct TY262261 {
  TGenericSeq Sup;
  TY262262 data[SEQ_DECL_SIZE];
};
struct TY213913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY262222 {
  TGenericSeq Sup;
  Tblock262018 data[SEQ_DECL_SIZE];
};
struct TY262202 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_216351)(Tnode213790* n);
N_NIMCALL(Tsym213822*, myimportmodule_270474)(Tcontext263020* c, Tnode213790* n);
N_NIMCALL(NI32, checkmodulename_270049)(Tnode213790* n);
N_NIMCALL(NimStringDesc*, getmodulename_270009)(Tnode213790* n);
N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(Tident188012*, getident_188441)(NimStringDesc* identifier);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell47705*, usrtocell_51640)(void* usr);
static N_INLINE(void, rtladdzct_53201)(Cell47705* c);
N_NOINLINE(void, addzct_51617)(Cellseq47721* s, Cell47705* c);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(NimStringDesc*, nsuReplaceStr)(NimStringDesc* s, NimStringDesc* sub, NimStringDesc* by);
N_NIMCALL(NimStringDesc*, rendertree_232044)(Tnode213790* n, NU8 renderflags);
N_NIMCALL(void, localerror_186080)(Tlineinfo181337 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, findmodule_160484)(NimStringDesc* modulename, NimStringDesc* currentmodule);
N_NIMCALL(NimStringDesc*, tofullpath_182266)(NI32 fileidx);
N_NIMCALL(NI32, fileinfoidx_182016)(NimStringDesc* filename);
N_NIMCALL(Tsym213822*, importmoduleas_270443)(Tnode213790* n, Tsym213822* realmodule);
static N_INLINE(NI, len_214059)(Tnode213790* n);
N_NIMCALL(Tsym213822*, createmodulealias_216838)(Tsym213822* s, Tident188012* newident, Tlineinfo181337 info);
N_NIMCALL(void, message_186095)(Tlineinfo181337 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, adddecl_268445)(Tcontext263020* c, Tsym213822* sym);
N_NIMCALL(void, importallsymbolsexcept_270260)(Tcontext263020* c, Tsym213822* frommod, Intset210035* exceptset);
N_NIMCALL(Tsym213822*, inittabiter_220073)(Ttabiter220071* ti, Tstrtable213794 tab);
N_NIMCALL(void, internalerror_186100)(Tlineinfo181337 info, NimStringDesc* errmsg);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_85209, TNimType* typ);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(NIM_BOOL, isnil_210898)(Intset210035* x);
N_NIMCALL(NIM_BOOL, contains_210811)(Intset210035* s, NI key);
N_NIMCALL(void, rawimportsymbol_270056)(Tcontext263020* c, Tsym213822* s);
N_NIMCALL(Tsym213822*, strtableget_220066)(Tstrtable213794 t, Tident188012* name);
N_NIMCALL(void, incl_210832)(Intset210035* s, NI key);
N_NIMCALL(void, strtableadd_220061)(Tstrtable213794* t, Tsym213822* n);
N_NIMCALL(Tsym213822*, initidentiter_220087)(Tidentiter220084* ti, Tstrtable213794 tab, Tident188012* s);
N_NIMCALL(Tsym213822*, nextidentiter_220093)(Tidentiter220084* ti, Tstrtable213794 tab);
N_NIMCALL(void, addconverter_263439)(Tcontext263020* c, Tsym213822* conv);
static N_INLINE(NIM_BOOL, haspattern_218411)(Tsym213822* s);
static N_INLINE(NIM_BOOL, isroutine_218397)(Tsym213822* s);
N_NIMCALL(void, addpattern_263444)(Tcontext263020* c, Tsym213822* p);
N_NIMCALL(Tsym213822*, nextiter_220078)(Ttabiter220071* ti, Tstrtable213794 tab);
N_NIMCALL(void, checkminsonslen_263962)(Tnode213790* n, NI length);
N_NIMCALL(Tnode213790*, newsymnode_215234)(Tsym213822* sym);
N_NIMCALL(void, initintset_210885)(Intset210035* Result);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(Tident188012*, considerquotedident_268004)(Tnode213790* n);
N_NIMCALL(void, importsymbol_270198)(Tcontext263020* c, Tnode213790* n, Tsym213822* frommod);
N_NIMCALL(void, loadstub_253824)(Tsym213822* s);
STRING_LITERAL(TMP3624, "", 0);
STRING_LITERAL(TMP3625, "as", 2);
STRING_LITERAL(TMP3626, " ", 1);
STRING_LITERAL(TMP3627, ".", 1);
STRING_LITERAL(TMP3628, "/", 1);
STRING_LITERAL(TMP3629, "invalid module name: \'$1\'", 25);
STRING_LITERAL(TMP3630, "module alias must be an identifier", 34);
STRING_LITERAL(TMP3631, "A module cannot import itself", 29);
STRING_LITERAL(TMP3632, "importAllSymbols: ", 18);
STRING_LITERAL(TMP3633, "rawImportSymbol", 15);
STRING_LITERAL(TMP3635, "importSymbol: 2", 15);
STRING_LITERAL(TMP3636, "importSymbol: 3", 15);
extern Gcheap50018 gch_50059;
extern TY260049 gimportmodule_260053;
extern TNimType NTI213435; /* TSymKind */

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

static N_INLINE(void, rtladdzct_53201)(Cell47705* c) {
	addzct_51617((&gch_50059.zct), c);
}

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

N_NIMCALL(NimStringDesc*, getmodulename_270009)(Tnode213790* n) {
	NimStringDesc* result;
{	result = 0;
	switch ((*n).kind) {
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		result = nosunixToNativePath((*n).kindU.S3.strval, ((NimStringDesc*) &TMP3624));
	}
	break;
	case ((NU8) 2):
	{
		result = copyString((*(*n).kindU.S5.ident).s);
	}
	break;
	case ((NU8) 3):
	{
		result = copyString((*(*(*n).kindU.S4.sym).name).s);
	}
	break;
	case ((NU8) 29):
	case ((NU8) 30):
	{
		NimStringDesc* LOC12;
		{
			NIM_BOOL LOC7;
			Tident188012* LOC9;
			LOC7 = 0;
			LOC7 = ((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 2));
			if (!(LOC7)) goto LA8;
			LOC9 = 0;
			LOC9 = getident_188441(((NimStringDesc*) &TMP3625));
			LOC7 = ((*(*(*n).kindU.S6.sons->data[((NI) 0)]).kindU.S5.ident).Sup.id == (*LOC9).Sup.id);
			LA8: ;
			if (!LOC7) goto LA10;
			(*n).kind = ((NU8) 78);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), (*n).kindU.S6.sons->data[((NI) 1)]);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 1)]), (*n).kindU.S6.sons->data[((NI) 2)]);
			(*n).kindU.S6.sons = (Tnodeseq213784*) setLengthSeq(&((*n).kindU.S6.sons)->Sup, sizeof(Tnode213790*), ((NI) 2));
			result = getmodulename_270009((*n).kindU.S6.sons->data[((NI) 0)]);
			goto BeforeRet;
		}
		LA10: ;
		LOC12 = 0;
		LOC12 = rendertree_232044(n, 4);
		result = nsuReplaceStr(LOC12, ((NimStringDesc*) &TMP3626), ((NimStringDesc*) &TMP3624));
	}
	break;
	case ((NU8) 45):
	{
		NimStringDesc* LOC14;
		LOC14 = 0;
		LOC14 = rendertree_232044(n, 4);
		result = nsuReplaceStr(LOC14, ((NimStringDesc*) &TMP3627), ((NimStringDesc*) &TMP3628));
	}
	break;
	case ((NU8) 78):
	{
		result = getmodulename_270009((*n).kindU.S6.sons->data[((NI) 0)]);
	}
	break;
	default:
	{
		NimStringDesc* LOC17;
		NimStringDesc* LOC18;
		LOC17 = 0;
		LOC17 = rendertree_232044(n, 0);
		LOC18 = 0;
		LOC18 = nsuFormatSingleElem(((NimStringDesc*) &TMP3629), LOC17);
		localerror_186080((*n).info, ((NU16) 4), LOC18);
		result = copyString(((NimStringDesc*) &TMP3624));
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI32, checkmodulename_270049)(Tnode213790* n) {
	NI32 result;
	NimStringDesc* modulename;
	NimStringDesc* fullpath;
	NimStringDesc* LOC1;
	result = 0;
	modulename = getmodulename_270009(n);
	LOC1 = 0;
	LOC1 = tofullpath_182266((*n).info.fileindex);
	fullpath = findmodule_160484(modulename, LOC1);
	{
		if (!((fullpath ? fullpath->Sup.len : 0) == ((NI) 0))) goto LA4;
		localerror_186080((*n).info, ((NU16) 3), modulename);
		result = ((NI32) -1);
	}
	goto LA2;
	LA4: ;
	{
		result = fileinfoidx_182016(fullpath);
	}
	LA2: ;
	return result;
}

static N_INLINE(NI, len_214059)(Tnode213790* 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(Tsym213822*, importmoduleas_270443)(Tnode213790* n, Tsym213822* realmodule) {
	Tsym213822* result;
	result = 0;
	result = realmodule;
	{
		if (!!(((*n).kind == ((NU8) 78)))) goto LA3;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		NI LOC7;
		LOC6 = 0;
		LOC7 = 0;
		LOC7 = len_214059(n);
		LOC6 = !((LOC7 == ((NI) 2)));
		if (LOC6) goto LA8;
		LOC6 = !(((*(*n).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 2)));
		LA8: ;
		if (!LOC6) goto LA9;
		localerror_186080((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3630));
	}
	goto LA1;
	LA9: ;
	{
		if (!!(((*(*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident).Sup.id == (*(*realmodule).name).Sup.id))) goto LA12;
		result = createmodulealias_216838(realmodule, (*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident, (*realmodule).info);
	}
	goto LA1;
	LA12: ;
	LA1: ;
	return result;
}

N_NIMCALL(Tsym213822*, myimportmodule_270474)(Tcontext263020* c, Tnode213790* n) {
	Tsym213822* result;
	NI32 f;
	result = 0;
	f = checkmodulename_270049(n);
	{
		Tsym213822* LOC5;
		if (!!((f == ((NI32) -1)))) goto LA3;
		LOC5 = 0;
		LOC5 = gimportmodule_260053((*c).module, f);
		result = importmoduleas_270443(n, LOC5);
		{
			if (!((*result).info.fileindex == (*n).info.fileindex)) goto LA8;
			localerror_186080((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3631));
		}
		LA8: ;
		{
			if (!(((*result).flags &(1U<<((NU)(((NU8) 19))&31U)))!=0)) goto LA12;
			message_186095((*n).info, ((NU16) 241), (*(*result).name).s);
		}
		LA12: ;
	}
	LA3: ;
	return result;
}

static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	memcpy(((NCSTRING) ((&(*dest).data[((*dest).Sup.len)- 0]))), ((NCSTRING) ((*src).data)), (NI)((*src).Sup.len + ((NI) 1)));
	(*dest).Sup.len += (*src).Sup.len;
}

static N_INLINE(NIM_BOOL, isnil_210898)(Intset210035* x) {
	NIM_BOOL result;
	result = 0;
	result = (*x).head == 0;
	return result;
}

static N_INLINE(NIM_BOOL, isroutine_218397)(Tsym213822* s) {
	NIM_BOOL result;
	result = 0;
	result = ((258048 &(1U<<((NU)((*s).kind)&31U)))!=0);
	return result;
}

static N_INLINE(NIM_BOOL, haspattern_218411)(Tsym213822* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = isroutine_218397(s);
	if (!(LOC1)) goto LA2;
	LOC1 = !(((*(*(*s).ast).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 1)));
	LA2: ;
	result = LOC1;
	return result;
}

N_NIMCALL(void, rawimportsymbol_270056)(Tcontext263020* c, Tsym213822* s) {
	Tsym213822* check;
	check = strtableget_220066((*(*c).importtable).symbols, (*s).name);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = !((check == NIM_NIL));
		if (!(LOC3)) goto LA4;
		LOC3 = !(((*check).Sup.id == (*s).Sup.id));
		LA4: ;
		if (!LOC3) goto LA5;
		{
			if (!!(((258112 &(1U<<((NU)((*s).kind)&31U)))!=0))) goto LA9;
			incl_210832((&(*c).ambiguoussymbols), (*s).Sup.id);
			incl_210832((&(*c).ambiguoussymbols), (*check).Sup.id);
		}
		LA9: ;
	}
	LA5: ;
	strtableadd_220061((&(*(*c).importtable).symbols), s);
	{
		Ttype213828* etyp;
		if (!((*s).kind == ((NU8) 7))) goto LA13;
		etyp = (*s).typ;
		{
			NIM_BOOL LOC17;
			LOC17 = 0;
			LOC17 = ((16386 &((NU64)1<<((NU)((*etyp).kind)&63U)))!=0);
			if (!(LOC17)) goto LA18;
			LOC17 = !((((*s).flags &(1U<<((NU)(((NU8) 9))&31U)))!=0));
			LA18: ;
			if (!LOC17) goto LA19;
			{
				NI j_270135;
				NI HEX3Atmp_270191;
				NI LOC22;
				NI res_270194;
				j_270135 = 0;
				HEX3Atmp_270191 = 0;
				LOC22 = 0;
				LOC22 = sonslen_216351((*etyp).n);
				HEX3Atmp_270191 = (NI)(LOC22 - ((NI) 1));
				res_270194 = ((NI) 0);
				{
					while (1) {
						Tsym213822* e;
						Tidentiter220084 it;
						if (!(res_270194 <= HEX3Atmp_270191)) goto LA24;
						j_270135 = res_270194;
						e = (*(*(*etyp).n).kindU.S6.sons->data[j_270135]).kindU.S4.sym;
						{
							if (!!(((*e).kind == ((NU8) 19)))) goto LA27;
							internalerror_186100((*s).info, ((NimStringDesc*) &TMP3633));
						}
						LA27: ;
						memset((void*)(&it), 0, sizeof(it));
						check = initidentiter_220087((&it), (*(*c).importtable).symbols, (*e).name);
						{
							while (1) {
								if (!!((check == NIM_NIL))) goto LA30;
								{
									if (!((*check).Sup.id == (*e).Sup.id)) goto LA33;
									e = NIM_NIL;
									goto LA29;
								}
								LA33: ;
								check = nextidentiter_220093((&it), (*(*c).importtable).symbols);
							} LA30: ;
						} LA29: ;
						{
							if (!!((e == NIM_NIL))) goto LA37;
							rawimportsymbol_270056(c, e);
						}
						LA37: ;
						res_270194 += ((NI) 1);
					} LA24: ;
				}
			}
		}
		LA19: ;
	}
	goto LA11;
	LA13: ;
	{
		{
			if (!((*s).kind == ((NU8) 15))) goto LA42;
			addconverter_263439(c, s);
		}
		LA42: ;
		{
			NIM_BOOL LOC46;
			LOC46 = 0;
			LOC46 = haspattern_218411(s);
			if (!LOC46) goto LA47;
			addpattern_263444(c, s);
		}
		LA47: ;
	}
	LA11: ;
}

N_NIMCALL(void, importallsymbolsexcept_270260)(Tcontext263020* c, Tsym213822* frommod, Intset210035* exceptset) {
	Ttabiter220071 i;
	Tsym213822* s;
	memset((void*)(&i), 0, sizeof(i));
	s = inittabiter_220073((&i), (*frommod).kindU.S3.tab);
	{
		while (1) {
			if (!!((s == NIM_NIL))) goto LA2;
			{
				if (!!(((*s).kind == ((NU8) 6)))) goto LA5;
				{
					if (!!(((*s).kind == ((NU8) 19)))) goto LA9;
					{
						NimStringDesc* LOC15;
						if (!!(((21755776 &(1U<<((NU)((*s).kind)&31U)))!=0))) goto LA13;
						LOC15 = 0;
						LOC15 = rawNewString(reprEnum((*s).kind, (&NTI213435))->Sup.len + 18);
appendString(LOC15, ((NimStringDesc*) &TMP3632));
appendString(LOC15, reprEnum((*s).kind, (&NTI213435)));
						internalerror_186100((*s).info, LOC15);
					}
					LA13: ;
					{
						NIM_BOOL LOC18;
						NIM_BOOL LOC20;
						LOC18 = 0;
						LOC18 = isnil_210898(exceptset);
						if (LOC18) goto LA19;
						LOC20 = 0;
						LOC20 = contains_210811(exceptset, (*(*s).name).Sup.id);
						LOC18 = !(LOC20);
						LA19: ;
						if (!LOC18) goto LA21;
						rawimportsymbol_270056(c, s);
					}
					LA21: ;
				}
				LA9: ;
			}
			LA5: ;
			s = nextiter_220078((&i), (*frommod).kindU.S3.tab);
		} LA2: ;
	}
}

N_NIMCALL(Tnode213790*, evalimport_270001)(Tcontext263020* c, Tnode213790* n) {
	Tnode213790* result;
	Intset210035 emptyset;
	result = 0;
	result = n;
	memset((void*)(&emptyset), 0, sizeof(emptyset));
	{
		NI i_270510;
		NI HEX3Atmp_270527;
		NI LOC2;
		NI res_270530;
		i_270510 = 0;
		HEX3Atmp_270527 = 0;
		LOC2 = 0;
		LOC2 = sonslen_216351(n);
		HEX3Atmp_270527 = (NI)(LOC2 - ((NI) 1));
		res_270530 = ((NI) 0);
		{
			while (1) {
				Tsym213822* m;
				if (!(res_270530 <= HEX3Atmp_270527)) goto LA4;
				i_270510 = res_270530;
				m = myimportmodule_270474(c, (*n).kindU.S6.sons->data[i_270510]);
				{
					if (!!((m == NIM_NIL))) goto LA7;
					adddecl_268445(c, m);
					importallsymbolsexcept_270260(c, m, (&emptyset));
				}
				LA7: ;
				res_270530 += ((NI) 1);
			} LA4: ;
		}
	}
	return result;
}

N_NIMCALL(Tnode213790*, evalimportexcept_270585)(Tcontext263020* c, Tnode213790* n) {
	Tnode213790* result;
	Tsym213822* m;
	result = 0;
	result = n;
	checkminsonslen_263962(n, ((NI) 2));
	m = myimportmodule_270474(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		Intset210035 exceptset;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_215234(m));
		adddecl_268445(c, m);
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		chckNil((void*)(&exceptset));
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		initintset_210885((&exceptset));
		{
			NI i_270617;
			NI HEX3Atmp_270622;
			NI LOC6;
			NI res_270625;
			i_270617 = 0;
			HEX3Atmp_270622 = 0;
			LOC6 = 0;
			LOC6 = sonslen_216351(n);
			HEX3Atmp_270622 = (NI)(LOC6 - ((NI) 1));
			res_270625 = ((NI) 1);
			{
				while (1) {
					Tident188012* ident;
					if (!(res_270625 <= HEX3Atmp_270622)) goto LA8;
					i_270617 = res_270625;
					ident = considerquotedident_268004((*n).kindU.S6.sons->data[i_270617]);
					incl_210832((&exceptset), (*ident).Sup.id);
					res_270625 += ((NI) 1);
				} LA8: ;
			}
		}
		importallsymbolsexcept_270260(c, m, (&exceptset));
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importsymbol_270198)(Tcontext263020* c, Tnode213790* n, Tsym213822* frommod) {
	Tident188012* ident;
	Tsym213822* s;
	ident = considerquotedident_268004(n);
	s = strtableget_220066((*frommod).kindU.S3.tab, ident);
	{
		if (!(s == NIM_NIL)) goto LA3;
		localerror_186080((*n).info, ((NU16) 63), (*ident).s);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((*s).kind == ((NU8) 22))) goto LA8;
			loadstub_253824(s);
		}
		LA8: ;
		{
			if (!!(((21755776 &(1U<<((NU)((*s).kind)&31U)))!=0))) goto LA12;
			internalerror_186100((*n).info, ((NimStringDesc*) &TMP3635));
		}
		LA12: ;
		switch ((*s).kind) {
		case ((NU8) 12):
		case ((NU8) 17):
		case ((NU8) 16):
		case ((NU8) 14):
		case ((NU8) 13):
		case ((NU8) 15):
		{
			Tidentiter220084 it;
			Tsym213822* e;
			memset((void*)(&it), 0, sizeof(it));
			e = initidentiter_220087((&it), (*frommod).kindU.S3.tab, (*s).name);
			{
				while (1) {
					if (!!((e == NIM_NIL))) goto LA16;
					{
						if (!!(((*(*e).name).Sup.id == (*(*s).name).Sup.id))) goto LA19;
						internalerror_186100((*n).info, ((NimStringDesc*) &TMP3636));
					}
					LA19: ;
					rawimportsymbol_270056(c, e);
					e = nextidentiter_220093((&it), (*frommod).kindU.S3.tab);
				} LA16: ;
			}
		}
		break;
		default:
		{
			rawimportsymbol_270056(c, s);
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(Tnode213790*, evalfrom_270005)(Tcontext263020* c, Tnode213790* n) {
	Tnode213790* result;
	Tsym213822* m;
	result = 0;
	result = n;
	checkminsonslen_263962(n, ((NI) 2));
	m = myimportmodule_270474(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_215234(m));
		adddecl_268445(c, m);
		{
			NI i_270565;
			NI HEX3Atmp_270578;
			NI LOC6;
			NI res_270581;
			i_270565 = 0;
			HEX3Atmp_270578 = 0;
			LOC6 = 0;
			LOC6 = sonslen_216351(n);
			HEX3Atmp_270578 = (NI)(LOC6 - ((NI) 1));
			res_270581 = ((NI) 1);
			{
				while (1) {
					if (!(res_270581 <= HEX3Atmp_270578)) goto LA8;
					i_270565 = res_270581;
					{
						if (!!(((*(*n).kindU.S6.sons->data[i_270565]).kind == ((NU8) 23)))) goto LA11;
						importsymbol_270198(c, (*n).kindU.S6.sons->data[i_270565], m);
					}
					LA11: ;
					res_270581 += ((NI) 1);
				} LA8: ;
			}
		}
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importallsymbols_270322)(Tcontext263020* c, Tsym213822* frommod) {
	Intset210035 exceptset;
	memset((void*)(&exceptset), 0, sizeof(exceptset));
	importallsymbolsexcept_270260(c, frommod, (&exceptset));
}
NIM_EXTERNC N_NOINLINE(void, compiler_importerInit000)(void) {
}

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

