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

#include "nimbase.h"
#include <string.h>
typedef struct Tnode214790 Tnode214790;
typedef struct Tcontext264020 Tcontext264020;
typedef struct Intset211035 Intset211035;
typedef struct Trunk211031 Trunk211031;
typedef struct Trunkseq211033 Trunkseq211033;
typedef struct Tsym214822 Tsym214822;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Ttype214828 Ttype214828;
typedef struct Tlineinfo182337 Tlineinfo182337;
typedef struct Tident189012 Tident189012;
typedef struct Tnodeseq214784 Tnodeseq214784;
typedef struct Tidobj189006 Tidobj189006;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq214824 Ttypeseq214824;
typedef struct Tscope214816 Tscope214816;
typedef struct TY214925 TY214925;
typedef struct Tstrtable214794 Tstrtable214794;
typedef struct Tsymseq214792 Tsymseq214792;
typedef struct Tloc214804 Tloc214804;
typedef struct Ropeobj169006 Ropeobj169006;
typedef struct Tlib214808 Tlib214808;
typedef struct Cell47504 Cell47504;
typedef struct Cellseq47520 Cellseq47520;
typedef struct Gcheap49818 Gcheap49818;
typedef struct Gcstack49816 Gcstack49816;
typedef struct Cellset47516 Cellset47516;
typedef struct Pagedesc47512 Pagedesc47512;
typedef struct Memregion29687 Memregion29687;
typedef struct Smallchunk29639 Smallchunk29639;
typedef struct Llchunk29681 Llchunk29681;
typedef struct Bigchunk29641 Bigchunk29641;
typedef struct Intset29614 Intset29614;
typedef struct Trunk29610 Trunk29610;
typedef struct Avlnode29685 Avlnode29685;
typedef struct Gcstat49814 Gcstat49814;
typedef struct Tpasscontext261002 Tpasscontext261002;
typedef struct Tproccon264008 Tproccon264008;
typedef struct Tlinkedlist135016 Tlinkedlist135016;
typedef struct Tlistentry135010 Tlistentry135010;
typedef struct Tidtable214840 Tidtable214840;
typedef struct Tidpairseq214838 Tidpairseq214838;
typedef struct Tctx263036 Tctx263036;
typedef struct TY264140 TY264140;
typedef struct Ttabiter221071 Ttabiter221071;
typedef struct Tidentiter221084 Tidentiter221084;
typedef struct Tinstantiation214812 Tinstantiation214812;
typedef struct Basechunk29637 Basechunk29637;
typedef struct Freecell29629 Freecell29629;
typedef struct Tidpair214836 Tidpair214836;
typedef struct TY263242 TY263242;
typedef struct TY183093 TY183093;
typedef struct PprocHEX3Aobjecttype263221 PprocHEX3Aobjecttype263221;
typedef struct TY263261 TY263261;
typedef struct Tinstantiationpair264010 Tinstantiationpair264010;
typedef struct TY214913 TY214913;
typedef struct TY263222 TY263222;
typedef struct TY263227 TY263227;
typedef struct TY263262 TY263262;
typedef struct Vmargs263030 Vmargs263030;
typedef struct Tblock263018 Tblock263018;
typedef struct TY263202 TY263202;
struct  Intset211035  {
NI counter;
NI max;
Trunk211031* head;
Trunkseq211033* data;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tlineinfo182337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tnode214790  {
Ttype214828* typ;
Tlineinfo182337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym214822* sym;
} S4;
struct {Tident189012* ident;
} S5;
struct {Tnodeseq214784* 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  Tidobj189006  {
  TNimObject Sup;
NI id;
};
struct  Tident189012  {
  Tidobj189006 Sup;
NimStringDesc* s;
Tident189012* next;
NI h;
};
struct  Tstrtable214794  {
NI counter;
Tsymseq214792* data;
};
struct  Tloc214804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype214828* t;
Ropeobj169006* r;
Ropeobj169006* heaproot;
};
struct  Tsym214822  {
  Tidobj189006 Sup;
NU8 kind;
union{
struct {Ttypeseq214824* typeinstcache;
Tscope214816* typscope;
} S1;
struct {TY214925* procinstcache;
Tsym214822* gcunsafetyreason;
} S2;
struct {TY214925* usedgenerics;
Tstrtable214794 tab;
} S3;
struct {Tsym214822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype214828* typ;
Tident189012* name;
Tlineinfo182337 info;
Tsym214822* owner;
NU32 flags;
Tnode214790* ast;
NU32 options;
NI position;
NI offset;
Tloc214804 loc;
Tlib214808* annex;
Tnode214790* constraint;
};
struct  Cell47504  {
NI refcount;
TNimType* typ;
};
struct  Cellseq47520  {
NI len;
NI cap;
Cell47504** d;
};
struct  Cellset47516  {
NI counter;
NI max;
Pagedesc47512* head;
Pagedesc47512** data;
};
typedef Smallchunk29639* TY29702[512];
typedef Trunk29610* Trunkbuckets29612[256];
struct  Intset29614  {
Trunkbuckets29612 data;
};
struct  Memregion29687  {
NI minlargeobj;
NI maxlargeobj;
TY29702 freesmallchunks;
Llchunk29681* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk29641* freechunkslist;
Intset29614 chunkstarts;
Avlnode29685* root;
Avlnode29685* deleted;
Avlnode29685* last;
Avlnode29685* freeavlnodes;
};
struct  Gcstat49814  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap49818  {
Gcstack49816* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq47520 zct;
Cellseq47520 decstack;
Cellset47516 cycleroots;
Cellseq47520 tempstack;
NI recgclock;
Memregion29687 region;
Gcstat49814 stat;
};
typedef N_NIMCALL_PTR(Tsym214822*, TY261049) (Tsym214822* m, NI32 fileidx);
struct  Tpasscontext261002  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Tlinkedlist135016  {
Tlistentry135010* head;
Tlistentry135010* tail;
NI counter;
};
struct  Tidtable214840  {
NI counter;
Tidpairseq214838* data;
};
typedef N_NIMCALL_PTR(Tnode214790*, TY264071) (Tcontext264020* c, Tnode214790* n);
typedef N_NIMCALL_PTR(Tnode214790*, TY264076) (Tcontext264020* c, Tnode214790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode214790*, TY264084) (Tcontext264020* c, Tnode214790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode214790*, TY264092) (Tcontext264020* c, Tnode214790* n);
typedef N_NIMCALL_PTR(Tnode214790*, TY264097) (Tcontext264020* c, Tnode214790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode214790*, TY264105) (Tcontext264020* c, Tnode214790* n);
typedef N_NIMCALL_PTR(Tnode214790*, TY264110) (Tcontext264020* c, Tnode214790* n, Tnode214790* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype214828*, TY264117) (Tcontext264020* c, Tnode214790* n, Ttype214828* prev);
typedef struct {
N_NIMCALL_PTR(Tnode214790*, ClPrc) (Tcontext264020* c, Tidtable214840 pt, Tnode214790* n, void* ClEnv);
void* ClEnv;
} TY264123;
typedef struct {
N_NIMCALL_PTR(Tsym214822*, ClPrc) (Tcontext264020* c, Tsym214822* fn, Tidtable214840 pt, Tlineinfo182337 info, void* ClEnv);
void* ClEnv;
} TY264129;
typedef N_NIMCALL_PTR(Tsym214822*, TY264145) (Tcontext264020* c, Tsym214822* dc, Ttype214828* t, Tlineinfo182337 info, NU8 op);
struct  Tcontext264020  {
  Tpasscontext261002 Sup;
Tsym214822* module;
Tscope214816* currentscope;
Tscope214816* importtable;
Tscope214816* toplevelscope;
Tproccon264008* p;
Tsymseq214792* friendmodules;
NI instcounter;
Intset211035 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq214792* converters;
Tsymseq214792* patterns;
Tlinkedlist135016 optionstack;
Tidtable214840 symmapping;
Tlinkedlist135016 libs;
TY264071 semconstexpr;
TY264076 semexpr;
TY264084 semtryexpr;
TY264092 semtryconstexpr;
TY264097 semoperand;
TY264105 semconstboolexpr;
TY264110 semoverloadedcall;
TY264117 semtypenode;
TY264123 seminferredlambda;
TY264129 semgenerateinstance;
Intset211035 includedfiles;
Tstrtable214794 userpragmas;
Tctx263036* evalcontext;
Intset211035 unknownidents;
TY264140* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY264145 insttypeboundop;
};
struct  Ttabiter221071  {
NI h;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tscope214816  {
NI depthlevel;
Tstrtable214794 symbols;
Tnodeseq214784* usingsyms;
Tscope214816* parent;
};
struct  Ttype214828  {
  Tidobj189006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq214824* sons;
Tnode214790* n;
Tsym214822* owner;
Tsym214822* sym;
Tsym214822* destructor;
Tsym214822* deepcopy;
Tsym214822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc214804 loc;
};
struct  Tidentiter221084  {
NI h;
Tident189012* name;
};
typedef NI TY29618[16];
struct  Trunk211031  {
Trunk211031* next;
NI key;
TY29618 bits;
};
struct  Ropeobj169006  {
  TNimObject Sup;
Ropeobj169006* left;
Ropeobj169006* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry135010  {
  TNimObject Sup;
Tlistentry135010* prev;
Tlistentry135010* next;
};
struct  Tlib214808  {
  Tlistentry135010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj169006* name;
Tnode214790* path;
};
struct  Gcstack49816  {
Gcstack49816* prev;
Gcstack49816* next;
void* starts;
void* pos;
NI maxstacksize;
};
struct  Pagedesc47512  {
Pagedesc47512* next;
NI key;
TY29618 bits;
};
struct  Basechunk29637  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk29639  {
  Basechunk29637 Sup;
Smallchunk29639* next;
Smallchunk29639* prev;
Freecell29629* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk29681  {
NI size;
NI acc;
Llchunk29681* next;
};
struct  Bigchunk29641  {
  Basechunk29637 Sup;
Bigchunk29641* next;
Bigchunk29641* prev;
NI align;
NF data;
};
struct  Trunk29610  {
Trunk29610* next;
NI key;
TY29618 bits;
};
typedef Avlnode29685* TY29692[2];
struct  Avlnode29685  {
TY29692 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon264008  {
Tsym214822* owner;
Tsym214822* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon264008* next;
NIM_BOOL wasforwarded;
Tnode214790* bracketexpr;
};
struct  Tidpair214836  {
Tidobj189006* key;
TNimObject* val;
};
struct  Tctx263036  {
  Tpasscontext261002 Sup;
TY263242* code;
TY183093* debug;
Tnode214790* globals;
Tnode214790* constants;
Ttypeseq214824* types;
Tnode214790* currentexceptiona;
Tnode214790* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype263221* prc;
Tsym214822* module;
Tnode214790* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo182337 comesfromheuristic;
TY263261* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair264010  {
Tsym214822* genericsym;
Tinstantiation214812* inst;
};
struct  Tinstantiation214812  {
Tsym214822* sym;
Ttypeseq214824* concretetypes;
TY214913* usedby;
NI compilesid;
};
struct  Freecell29629  {
Freecell29629* next;
NI zerofield;
};
struct TY263227 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY263227 TY263230[256];
struct  PprocHEX3Aobjecttype263221  {
TY263222* blocks;
Tsym214822* sym;
TY263230 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs263030* args, void* ClEnv);
void* ClEnv;
} Vmcallback263032;
struct TY263262 {
NimStringDesc* Field0;
Vmcallback263032 Field1;
};
struct  Tblock263018  {
Tsym214822* label;
TY263202* fixups;
};
struct  Vmargs263030  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode214790* currentexception;
};
struct Tnodeseq214784 {
  TGenericSeq Sup;
  Tnode214790* data[SEQ_DECL_SIZE];
};
struct Trunkseq211033 {
  TGenericSeq Sup;
  Trunk211031* data[SEQ_DECL_SIZE];
};
struct Ttypeseq214824 {
  TGenericSeq Sup;
  Ttype214828* data[SEQ_DECL_SIZE];
};
struct TY214925 {
  TGenericSeq Sup;
  Tinstantiation214812* data[SEQ_DECL_SIZE];
};
struct Tsymseq214792 {
  TGenericSeq Sup;
  Tsym214822* data[SEQ_DECL_SIZE];
};
struct Tidpairseq214838 {
  TGenericSeq Sup;
  Tidpair214836 data[SEQ_DECL_SIZE];
};
struct TY264140 {
  TGenericSeq Sup;
  Tinstantiationpair264010 data[SEQ_DECL_SIZE];
};
struct TY263242 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY183093 {
  TGenericSeq Sup;
  Tlineinfo182337 data[SEQ_DECL_SIZE];
};
struct TY263261 {
  TGenericSeq Sup;
  TY263262 data[SEQ_DECL_SIZE];
};
struct TY214913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY263222 {
  TGenericSeq Sup;
  Tblock263018 data[SEQ_DECL_SIZE];
};
struct TY263202 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_217351)(Tnode214790* n);
N_NIMCALL(Tsym214822*, myimportmodule_271474)(Tcontext264020* c, Tnode214790* n);
N_NIMCALL(NI32, checkmodulename_271049)(Tnode214790* n);
N_NIMCALL(NimStringDesc*, getmodulename_271009)(Tnode214790* n);
N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(Tident189012*, getident_189441)(NimStringDesc* identifier);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell47504*, usrtocell_51440)(void* usr);
static N_INLINE(void, rtladdzct_53001)(Cell47504* c);
N_NOINLINE(void, addzct_51417)(Cellseq47520* s, Cell47504* 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_233044)(Tnode214790* n, NU8 renderflags);
N_NIMCALL(void, localerror_187080)(Tlineinfo182337 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, findmodule_161484)(NimStringDesc* modulename, NimStringDesc* currentmodule);
N_NIMCALL(NimStringDesc*, tofullpath_183269)(NI32 fileidx);
N_NIMCALL(NI32, fileinfoidx_183017)(NimStringDesc* filename);
N_NIMCALL(Tsym214822*, importmoduleas_271443)(Tnode214790* n, Tsym214822* realmodule);
static N_INLINE(NI, len_215059)(Tnode214790* n);
N_NIMCALL(Tsym214822*, createmodulealias_217838)(Tsym214822* s, Tident189012* newident, Tlineinfo182337 info);
N_NIMCALL(void, message_187095)(Tlineinfo182337 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, adddecl_269445)(Tcontext264020* c, Tsym214822* sym);
N_NIMCALL(void, importallsymbolsexcept_271260)(Tcontext264020* c, Tsym214822* frommod, Intset211035 exceptset);
N_NIMCALL(Tsym214822*, inittabiter_221073)(Ttabiter221071* ti, Tstrtable214794 tab);
N_NIMCALL(void, internalerror_187100)(Tlineinfo182337 info, NimStringDesc* errmsg);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_85009, TNimType* typ);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(NIM_BOOL, isnil_211898)(Intset211035 x);
N_NIMCALL(NIM_BOOL, contains_211811)(Intset211035 s, NI key);
N_NIMCALL(void, rawimportsymbol_271056)(Tcontext264020* c, Tsym214822* s);
N_NIMCALL(Tsym214822*, strtableget_221066)(Tstrtable214794 t, Tident189012* name);
N_NIMCALL(void, incl_211832)(Intset211035* s, NI key);
N_NIMCALL(void, strtableadd_221061)(Tstrtable214794* t, Tsym214822* n);
N_NIMCALL(Tsym214822*, initidentiter_221087)(Tidentiter221084* ti, Tstrtable214794 tab, Tident189012* s);
N_NIMCALL(Tsym214822*, nextidentiter_221093)(Tidentiter221084* ti, Tstrtable214794 tab);
N_NIMCALL(void, addconverter_264440)(Tcontext264020* c, Tsym214822* conv);
static N_INLINE(NIM_BOOL, haspattern_219410)(Tsym214822* s);
static N_INLINE(NIM_BOOL, isroutine_219396)(Tsym214822* s);
N_NIMCALL(void, addpattern_264445)(Tcontext264020* c, Tsym214822* p);
N_NIMCALL(Tsym214822*, nextiter_221078)(Ttabiter221071* ti, Tstrtable214794 tab);
N_NIMCALL(void, checkminsonslen_264962)(Tnode214790* n, NI length);
N_NIMCALL(Tnode214790*, newsymnode_216234)(Tsym214822* sym);
N_NIMCALL(void, initintset_211885)(Intset211035* Result);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(Tident189012*, considerquotedident_269004)(Tnode214790* n);
N_NIMCALL(void, importsymbol_271198)(Tcontext264020* c, Tnode214790* n, Tsym214822* frommod);
N_NIMCALL(void, loadstub_254825)(Tsym214822* s);
STRING_LITERAL(TMP3626, "", 0);
STRING_LITERAL(TMP3627, "as", 2);
STRING_LITERAL(TMP3628, " ", 1);
STRING_LITERAL(TMP3629, ".", 1);
STRING_LITERAL(TMP3630, "/", 1);
STRING_LITERAL(TMP3631, "invalid module name: \'$1\'", 25);
STRING_LITERAL(TMP3632, "module alias must be an identifier", 34);
STRING_LITERAL(TMP3633, "A module cannot import itself", 29);
STRING_LITERAL(TMP3634, "importAllSymbols: ", 18);
STRING_LITERAL(TMP3635, "rawImportSymbol", 15);
STRING_LITERAL(TMP3637, "importSymbol: 2", 15);
STRING_LITERAL(TMP3638, "importSymbol: 3", 15);
extern Gcheap49818 gch_49859;
extern TY261049 gimportmodule_261053;
extern TNimType NTI214435; /* TSymKind */

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

static N_INLINE(void, rtladdzct_53001)(Cell47504* c) {
	addzct_51417((&gch_49859.zct), c);
}

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

N_NIMCALL(NimStringDesc*, getmodulename_271009)(Tnode214790* n) {
	NimStringDesc* result;
{	result = 0;
	switch ((*n).kind) {
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		result = nosunixToNativePath((*n).kindU.S3.strval, ((NimStringDesc*) &TMP3626));
	}
	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;
			Tident189012* LOC9;
			LOC7 = 0;
			LOC7 = ((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 2));
			if (!(LOC7)) goto LA8;
			LOC9 = 0;
			LOC9 = getident_189441(((NimStringDesc*) &TMP3627));
			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 = (Tnodeseq214784*) setLengthSeq(&((*n).kindU.S6.sons)->Sup, sizeof(Tnode214790*), ((NI) 2));
			result = getmodulename_271009((*n).kindU.S6.sons->data[((NI) 0)]);
			goto BeforeRet;
		}
		LA10: ;
		LOC12 = 0;
		LOC12 = rendertree_233044(n, 4);
		result = nsuReplaceStr(LOC12, ((NimStringDesc*) &TMP3628), ((NimStringDesc*) &TMP3626));
	}
	break;
	case ((NU8) 45):
	{
		NimStringDesc* LOC14;
		LOC14 = 0;
		LOC14 = rendertree_233044(n, 4);
		result = nsuReplaceStr(LOC14, ((NimStringDesc*) &TMP3629), ((NimStringDesc*) &TMP3630));
	}
	break;
	case ((NU8) 78):
	{
		result = getmodulename_271009((*n).kindU.S6.sons->data[((NI) 0)]);
	}
	break;
	default:
	{
		NimStringDesc* LOC17;
		NimStringDesc* LOC18;
		LOC17 = 0;
		LOC17 = rendertree_233044(n, 0);
		LOC18 = 0;
		LOC18 = nsuFormatSingleElem(((NimStringDesc*) &TMP3631), LOC17);
		localerror_187080((*n).info, ((NU16) 4), LOC18);
		result = copyString(((NimStringDesc*) &TMP3626));
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI32, checkmodulename_271049)(Tnode214790* n) {
	NI32 result;
	NimStringDesc* modulename;
	NimStringDesc* fullpath;
	NimStringDesc* LOC1;
	result = 0;
	modulename = getmodulename_271009(n);
	LOC1 = 0;
	LOC1 = tofullpath_183269((*n).info.fileindex);
	fullpath = findmodule_161484(modulename, LOC1);
	{
		if (!((fullpath ? fullpath->Sup.len : 0) == ((NI) 0))) goto LA4;
		localerror_187080((*n).info, ((NU16) 3), modulename);
		result = ((NI32) -1);
	}
	goto LA2;
	LA4: ;
	{
		result = fileinfoidx_183017(fullpath);
	}
	LA2: ;
	return result;
}

static N_INLINE(NI, len_215059)(Tnode214790* 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(Tsym214822*, importmoduleas_271443)(Tnode214790* n, Tsym214822* realmodule) {
	Tsym214822* 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_215059(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_187080((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3632));
	}
	goto LA1;
	LA9: ;
	{
		if (!!(((*(*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident).Sup.id == (*(*realmodule).name).Sup.id))) goto LA12;
		result = createmodulealias_217838(realmodule, (*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident, (*realmodule).info);
	}
	goto LA1;
	LA12: ;
	LA1: ;
	return result;
}

N_NIMCALL(Tsym214822*, myimportmodule_271474)(Tcontext264020* c, Tnode214790* n) {
	Tsym214822* result;
	NI32 f;
	result = 0;
	f = checkmodulename_271049(n);
	{
		Tsym214822* LOC5;
		if (!!((f == ((NI32) -1)))) goto LA3;
		LOC5 = 0;
		LOC5 = gimportmodule_261053((*c).module, f);
		result = importmoduleas_271443(n, LOC5);
		{
			if (!((*result).info.fileindex == (*n).info.fileindex)) goto LA8;
			localerror_187080((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3633));
		}
		LA8: ;
		{
			if (!(((*result).flags &(1U<<((NU)(((NU8) 19))&31U)))!=0)) goto LA12;
			message_187095((*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_211898)(Intset211035 x) {
	NIM_BOOL result;
	result = 0;
	result = x.head == 0;
	return result;
}

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

static N_INLINE(NIM_BOOL, haspattern_219410)(Tsym214822* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = isroutine_219396(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_271056)(Tcontext264020* c, Tsym214822* s) {
	Tsym214822* check;
	check = strtableget_221066((*(*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_211832((&(*c).ambiguoussymbols), (*s).Sup.id);
			incl_211832((&(*c).ambiguoussymbols), (*check).Sup.id);
		}
		LA9: ;
	}
	LA5: ;
	strtableadd_221061((&(*(*c).importtable).symbols), s);
	{
		Ttype214828* etyp;
		if (!((*s).kind == ((NU8) 7))) goto LA13;
		etyp = (*s).typ;
		{
			NIM_BOOL LOC17;
			LOC17 = 0;
			LOC17 = ((*etyp).kind == ((NU8) 1) || (*etyp).kind == ((NU8) 14));
			if (!(LOC17)) goto LA18;
			LOC17 = !((((*s).flags &(1U<<((NU)(((NU8) 9))&31U)))!=0));
			LA18: ;
			if (!LOC17) goto LA19;
			{
				NI j_271135;
				NI HEX3Atmp_271191;
				NI LOC22;
				NI res_271194;
				j_271135 = 0;
				HEX3Atmp_271191 = 0;
				LOC22 = 0;
				LOC22 = sonslen_217351((*etyp).n);
				HEX3Atmp_271191 = (NI)(LOC22 - ((NI) 1));
				res_271194 = ((NI) 0);
				{
					while (1) {
						Tsym214822* e;
						Tidentiter221084 it;
						if (!(res_271194 <= HEX3Atmp_271191)) goto LA24;
						j_271135 = res_271194;
						e = (*(*(*etyp).n).kindU.S6.sons->data[j_271135]).kindU.S4.sym;
						{
							if (!!(((*e).kind == ((NU8) 19)))) goto LA27;
							internalerror_187100((*s).info, ((NimStringDesc*) &TMP3635));
						}
						LA27: ;
						memset((void*)(&it), 0, sizeof(it));
						check = initidentiter_221087((&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_221093((&it), (*(*c).importtable).symbols);
							} LA30: ;
						} LA29: ;
						{
							if (!!((e == NIM_NIL))) goto LA37;
							rawimportsymbol_271056(c, e);
						}
						LA37: ;
						res_271194 += ((NI) 1);
					} LA24: ;
				}
			}
		}
		LA19: ;
	}
	goto LA11;
	LA13: ;
	{
		{
			if (!((*s).kind == ((NU8) 15))) goto LA42;
			addconverter_264440(c, s);
		}
		LA42: ;
		{
			NIM_BOOL LOC46;
			LOC46 = 0;
			LOC46 = haspattern_219410(s);
			if (!LOC46) goto LA47;
			addpattern_264445(c, s);
		}
		LA47: ;
	}
	LA11: ;
}

N_NIMCALL(void, importallsymbolsexcept_271260)(Tcontext264020* c, Tsym214822* frommod, Intset211035 exceptset) {
	Ttabiter221071 i;
	Tsym214822* s;
	memset((void*)(&i), 0, sizeof(i));
	s = inittabiter_221073((&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, (&NTI214435))->Sup.len + 18);
appendString(LOC15, ((NimStringDesc*) &TMP3634));
appendString(LOC15, reprEnum((*s).kind, (&NTI214435)));
						internalerror_187100((*s).info, LOC15);
					}
					LA13: ;
					{
						NIM_BOOL LOC18;
						NIM_BOOL LOC20;
						LOC18 = 0;
						LOC18 = isnil_211898(exceptset);
						if (LOC18) goto LA19;
						LOC20 = 0;
						LOC20 = contains_211811(exceptset, (*(*s).name).Sup.id);
						LOC18 = !(LOC20);
						LA19: ;
						if (!LOC18) goto LA21;
						rawimportsymbol_271056(c, s);
					}
					LA21: ;
				}
				LA9: ;
			}
			LA5: ;
			s = nextiter_221078((&i), (*frommod).kindU.S3.tab);
		} LA2: ;
	}
}

N_NIMCALL(Tnode214790*, evalimport_271001)(Tcontext264020* c, Tnode214790* n) {
	Tnode214790* result;
	Intset211035 emptyset;
	result = 0;
	result = n;
	memset((void*)(&emptyset), 0, sizeof(emptyset));
	{
		NI i_271510;
		NI HEX3Atmp_271527;
		NI LOC2;
		NI res_271530;
		i_271510 = 0;
		HEX3Atmp_271527 = 0;
		LOC2 = 0;
		LOC2 = sonslen_217351(n);
		HEX3Atmp_271527 = (NI)(LOC2 - ((NI) 1));
		res_271530 = ((NI) 0);
		{
			while (1) {
				Tsym214822* m;
				if (!(res_271530 <= HEX3Atmp_271527)) goto LA4;
				i_271510 = res_271530;
				m = myimportmodule_271474(c, (*n).kindU.S6.sons->data[i_271510]);
				{
					if (!!((m == NIM_NIL))) goto LA7;
					adddecl_269445(c, m);
					importallsymbolsexcept_271260(c, m, emptyset);
				}
				LA7: ;
				res_271530 += ((NI) 1);
			} LA4: ;
		}
	}
	return result;
}

N_NIMCALL(Tnode214790*, evalimportexcept_271585)(Tcontext264020* c, Tnode214790* n) {
	Tnode214790* result;
	Tsym214822* m;
	result = 0;
	result = n;
	checkminsonslen_264962(n, ((NI) 2));
	m = myimportmodule_271474(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		Intset211035 exceptset;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_216234(m));
		adddecl_269445(c, m);
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		chckNil((void*)(&exceptset));
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		initintset_211885((&exceptset));
		{
			NI i_271617;
			NI HEX3Atmp_271622;
			NI LOC6;
			NI res_271625;
			i_271617 = 0;
			HEX3Atmp_271622 = 0;
			LOC6 = 0;
			LOC6 = sonslen_217351(n);
			HEX3Atmp_271622 = (NI)(LOC6 - ((NI) 1));
			res_271625 = ((NI) 1);
			{
				while (1) {
					Tident189012* ident;
					if (!(res_271625 <= HEX3Atmp_271622)) goto LA8;
					i_271617 = res_271625;
					ident = considerquotedident_269004((*n).kindU.S6.sons->data[i_271617]);
					incl_211832((&exceptset), (*ident).Sup.id);
					res_271625 += ((NI) 1);
				} LA8: ;
			}
		}
		importallsymbolsexcept_271260(c, m, exceptset);
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importsymbol_271198)(Tcontext264020* c, Tnode214790* n, Tsym214822* frommod) {
	Tident189012* ident;
	Tsym214822* s;
	ident = considerquotedident_269004(n);
	s = strtableget_221066((*frommod).kindU.S3.tab, ident);
	{
		if (!(s == NIM_NIL)) goto LA3;
		localerror_187080((*n).info, ((NU16) 63), (*ident).s);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((*s).kind == ((NU8) 22))) goto LA8;
			loadstub_254825(s);
		}
		LA8: ;
		{
			if (!!(((21755776 &(1U<<((NU)((*s).kind)&31U)))!=0))) goto LA12;
			internalerror_187100((*n).info, ((NimStringDesc*) &TMP3637));
		}
		LA12: ;
		switch ((*s).kind) {
		case ((NU8) 12):
		case ((NU8) 17):
		case ((NU8) 16):
		case ((NU8) 14):
		case ((NU8) 13):
		case ((NU8) 15):
		{
			Tidentiter221084 it;
			Tsym214822* e;
			memset((void*)(&it), 0, sizeof(it));
			e = initidentiter_221087((&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_187100((*n).info, ((NimStringDesc*) &TMP3638));
					}
					LA19: ;
					rawimportsymbol_271056(c, e);
					e = nextidentiter_221093((&it), (*frommod).kindU.S3.tab);
				} LA16: ;
			}
		}
		break;
		default:
		{
			rawimportsymbol_271056(c, s);
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(Tnode214790*, evalfrom_271005)(Tcontext264020* c, Tnode214790* n) {
	Tnode214790* result;
	Tsym214822* m;
	result = 0;
	result = n;
	checkminsonslen_264962(n, ((NI) 2));
	m = myimportmodule_271474(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_216234(m));
		adddecl_269445(c, m);
		{
			NI i_271565;
			NI HEX3Atmp_271578;
			NI LOC6;
			NI res_271581;
			i_271565 = 0;
			HEX3Atmp_271578 = 0;
			LOC6 = 0;
			LOC6 = sonslen_217351(n);
			HEX3Atmp_271578 = (NI)(LOC6 - ((NI) 1));
			res_271581 = ((NI) 1);
			{
				while (1) {
					if (!(res_271581 <= HEX3Atmp_271578)) goto LA8;
					i_271565 = res_271581;
					{
						if (!!(((*(*n).kindU.S6.sons->data[i_271565]).kind == ((NU8) 23)))) goto LA11;
						importsymbol_271198(c, (*n).kindU.S6.sons->data[i_271565], m);
					}
					LA11: ;
					res_271581 += ((NI) 1);
				} LA8: ;
			}
		}
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importallsymbols_271322)(Tcontext264020* c, Tsym214822* frommod) {
	Intset211035 exceptset;
	memset((void*)(&exceptset), 0, sizeof(exceptset));
	importallsymbolsexcept_271260(c, frommod, exceptset);
}
NIM_EXTERNC N_NOINLINE(void, compiler_importerInit000)(void) {
}

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

