/* 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 Tnode216790 Tnode216790;
typedef struct Tcontext266020 Tcontext266020;
typedef struct Intset213035 Intset213035;
typedef struct Trunk213031 Trunk213031;
typedef struct Trunkseq213033 Trunkseq213033;
typedef struct Tsym216822 Tsym216822;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Ttype216828 Ttype216828;
typedef struct Tlineinfo184337 Tlineinfo184337;
typedef struct Tident191012 Tident191012;
typedef struct Tnodeseq216784 Tnodeseq216784;
typedef struct Tidobj191006 Tidobj191006;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq216824 Ttypeseq216824;
typedef struct Tscope216816 Tscope216816;
typedef struct TY216925 TY216925;
typedef struct Tstrtable216794 Tstrtable216794;
typedef struct Tsymseq216792 Tsymseq216792;
typedef struct Tloc216804 Tloc216804;
typedef struct Ropeobj172006 Ropeobj172006;
typedef struct Tlib216808 Tlib216808;
typedef struct Cell47304 Cell47304;
typedef struct Cellseq47320 Cellseq47320;
typedef struct Gcheap49618 Gcheap49618;
typedef struct Gcstack49616 Gcstack49616;
typedef struct Cellset47316 Cellset47316;
typedef struct Pagedesc47312 Pagedesc47312;
typedef struct Memregion29487 Memregion29487;
typedef struct Smallchunk29439 Smallchunk29439;
typedef struct Llchunk29481 Llchunk29481;
typedef struct Bigchunk29441 Bigchunk29441;
typedef struct Intset29414 Intset29414;
typedef struct Trunk29410 Trunk29410;
typedef struct Avlnode29485 Avlnode29485;
typedef struct Gcstat49614 Gcstat49614;
typedef struct Tpasscontext263002 Tpasscontext263002;
typedef struct Tproccon266008 Tproccon266008;
typedef struct Tlinkedlist138016 Tlinkedlist138016;
typedef struct Tlistentry138010 Tlistentry138010;
typedef struct Tidtable216840 Tidtable216840;
typedef struct Tidpairseq216838 Tidpairseq216838;
typedef struct Tctx265036 Tctx265036;
typedef struct TY266140 TY266140;
typedef struct Ttabiter223071 Ttabiter223071;
typedef struct Tidentiter223084 Tidentiter223084;
typedef struct Tinstantiation216812 Tinstantiation216812;
typedef struct Basechunk29437 Basechunk29437;
typedef struct Freecell29429 Freecell29429;
typedef struct Tidpair216836 Tidpair216836;
typedef struct TY265242 TY265242;
typedef struct TY185093 TY185093;
typedef struct PprocHEX3Aobjecttype265221 PprocHEX3Aobjecttype265221;
typedef struct TY265261 TY265261;
typedef struct Tinstantiationpair266010 Tinstantiationpair266010;
typedef struct TY216913 TY216913;
typedef struct TY265222 TY265222;
typedef struct TY265227 TY265227;
typedef struct TY265262 TY265262;
typedef struct Vmargs265030 Vmargs265030;
typedef struct Tblock265018 Tblock265018;
typedef struct TY265202 TY265202;
struct  Intset213035  {
NI counter;
NI max;
Trunk213031* head;
Trunkseq213033* data;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tlineinfo184337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tnode216790  {
Ttype216828* typ;
Tlineinfo184337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym216822* sym;
} S4;
struct {Tident191012* ident;
} S5;
struct {Tnodeseq216784* 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  Tidobj191006  {
  TNimObject Sup;
NI id;
};
struct  Tident191012  {
  Tidobj191006 Sup;
NimStringDesc* s;
Tident191012* next;
NI h;
};
struct  Tstrtable216794  {
NI counter;
Tsymseq216792* data;
};
struct  Tloc216804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype216828* t;
Ropeobj172006* r;
Ropeobj172006* heaproot;
};
struct  Tsym216822  {
  Tidobj191006 Sup;
NU8 kind;
union{
struct {Ttypeseq216824* typeinstcache;
Tscope216816* typscope;
} S1;
struct {TY216925* procinstcache;
Tsym216822* gcunsafetyreason;
} S2;
struct {TY216925* usedgenerics;
Tstrtable216794 tab;
} S3;
struct {Tsym216822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype216828* typ;
Tident191012* name;
Tlineinfo184337 info;
Tsym216822* owner;
NU32 flags;
Tnode216790* ast;
NU32 options;
NI position;
NI offset;
Tloc216804 loc;
Tlib216808* annex;
Tnode216790* constraint;
};
struct  Cell47304  {
NI refcount;
TNimType* typ;
};
struct  Cellseq47320  {
NI len;
NI cap;
Cell47304** d;
};
struct  Cellset47316  {
NI counter;
NI max;
Pagedesc47312* head;
Pagedesc47312** data;
};
typedef Smallchunk29439* TY29502[512];
typedef Trunk29410* Trunkbuckets29412[256];
struct  Intset29414  {
Trunkbuckets29412 data;
};
struct  Memregion29487  {
NI minlargeobj;
NI maxlargeobj;
TY29502 freesmallchunks;
Llchunk29481* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk29441* freechunkslist;
Intset29414 chunkstarts;
Avlnode29485* root;
Avlnode29485* deleted;
Avlnode29485* last;
Avlnode29485* freeavlnodes;
};
struct  Gcstat49614  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap49618  {
Gcstack49616* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq47320 zct;
Cellseq47320 decstack;
Cellset47316 cycleroots;
Cellseq47320 tempstack;
NI recgclock;
Memregion29487 region;
Gcstat49614 stat;
};
typedef N_NIMCALL_PTR(Tsym216822*, TY263049) (Tsym216822* m, NI32 fileidx);
struct  Tpasscontext263002  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Tlinkedlist138016  {
Tlistentry138010* head;
Tlistentry138010* tail;
NI counter;
};
struct  Tidtable216840  {
NI counter;
Tidpairseq216838* data;
};
typedef N_NIMCALL_PTR(Tnode216790*, TY266071) (Tcontext266020* c, Tnode216790* n);
typedef N_NIMCALL_PTR(Tnode216790*, TY266076) (Tcontext266020* c, Tnode216790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode216790*, TY266084) (Tcontext266020* c, Tnode216790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode216790*, TY266092) (Tcontext266020* c, Tnode216790* n);
typedef N_NIMCALL_PTR(Tnode216790*, TY266097) (Tcontext266020* c, Tnode216790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode216790*, TY266105) (Tcontext266020* c, Tnode216790* n);
typedef N_NIMCALL_PTR(Tnode216790*, TY266110) (Tcontext266020* c, Tnode216790* n, Tnode216790* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype216828*, TY266117) (Tcontext266020* c, Tnode216790* n, Ttype216828* prev);
typedef struct {
N_NIMCALL_PTR(Tnode216790*, ClPrc) (Tcontext266020* c, Tidtable216840 pt, Tnode216790* n, void* ClEnv);
void* ClEnv;
} TY266123;
typedef struct {
N_NIMCALL_PTR(Tsym216822*, ClPrc) (Tcontext266020* c, Tsym216822* fn, Tidtable216840 pt, Tlineinfo184337 info, void* ClEnv);
void* ClEnv;
} TY266129;
typedef N_NIMCALL_PTR(Tsym216822*, TY266145) (Tcontext266020* c, Tsym216822* dc, Ttype216828* t, Tlineinfo184337 info, NU8 op);
struct  Tcontext266020  {
  Tpasscontext263002 Sup;
Tsym216822* module;
Tscope216816* currentscope;
Tscope216816* importtable;
Tscope216816* toplevelscope;
Tproccon266008* p;
Tsymseq216792* friendmodules;
NI instcounter;
Intset213035 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq216792* converters;
Tsymseq216792* patterns;
Tlinkedlist138016 optionstack;
Tidtable216840 symmapping;
Tlinkedlist138016 libs;
TY266071 semconstexpr;
TY266076 semexpr;
TY266084 semtryexpr;
TY266092 semtryconstexpr;
TY266097 semoperand;
TY266105 semconstboolexpr;
TY266110 semoverloadedcall;
TY266117 semtypenode;
TY266123 seminferredlambda;
TY266129 semgenerateinstance;
Intset213035 includedfiles;
Tstrtable216794 userpragmas;
Tctx265036* evalcontext;
Intset213035 unknownidents;
TY266140* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY266145 insttypeboundop;
};
struct  Ttabiter223071  {
NI h;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tscope216816  {
NI depthlevel;
Tstrtable216794 symbols;
Tnodeseq216784* usingsyms;
Tscope216816* parent;
};
struct  Ttype216828  {
  Tidobj191006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq216824* sons;
Tnode216790* n;
Tsym216822* owner;
Tsym216822* sym;
Tsym216822* destructor;
Tsym216822* deepcopy;
Tsym216822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc216804 loc;
};
struct  Tidentiter223084  {
NI h;
Tident191012* name;
};
typedef NI TY29418[16];
struct  Trunk213031  {
Trunk213031* next;
NI key;
TY29418 bits;
};
struct  Ropeobj172006  {
  TNimObject Sup;
Ropeobj172006* left;
Ropeobj172006* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry138010  {
  TNimObject Sup;
Tlistentry138010* prev;
Tlistentry138010* next;
};
struct  Tlib216808  {
  Tlistentry138010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj172006* name;
Tnode216790* path;
};
struct  Gcstack49616  {
Gcstack49616* prev;
Gcstack49616* next;
void* starts;
void* pos;
NI maxstacksize;
};
struct  Pagedesc47312  {
Pagedesc47312* next;
NI key;
TY29418 bits;
};
struct  Basechunk29437  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk29439  {
  Basechunk29437 Sup;
Smallchunk29439* next;
Smallchunk29439* prev;
Freecell29429* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk29481  {
NI size;
NI acc;
Llchunk29481* next;
};
struct  Bigchunk29441  {
  Basechunk29437 Sup;
Bigchunk29441* next;
Bigchunk29441* prev;
NI align;
NF data;
};
struct  Trunk29410  {
Trunk29410* next;
NI key;
TY29418 bits;
};
typedef Avlnode29485* TY29492[2];
struct  Avlnode29485  {
TY29492 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon266008  {
Tsym216822* owner;
Tsym216822* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon266008* next;
NIM_BOOL wasforwarded;
Tnode216790* bracketexpr;
};
struct  Tidpair216836  {
Tidobj191006* key;
TNimObject* val;
};
struct  Tctx265036  {
  Tpasscontext263002 Sup;
TY265242* code;
TY185093* debug;
Tnode216790* globals;
Tnode216790* constants;
Ttypeseq216824* types;
Tnode216790* currentexceptiona;
Tnode216790* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype265221* prc;
Tsym216822* module;
Tnode216790* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo184337 comesfromheuristic;
TY265261* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair266010  {
Tsym216822* genericsym;
Tinstantiation216812* inst;
};
struct  Tinstantiation216812  {
Tsym216822* sym;
Ttypeseq216824* concretetypes;
TY216913* usedby;
NI compilesid;
};
struct  Freecell29429  {
Freecell29429* next;
NI zerofield;
};
struct TY265227 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY265227 TY265230[256];
struct  PprocHEX3Aobjecttype265221  {
TY265222* blocks;
Tsym216822* sym;
TY265230 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs265030* args, void* ClEnv);
void* ClEnv;
} Vmcallback265032;
struct TY265262 {
NimStringDesc* Field0;
Vmcallback265032 Field1;
};
struct  Tblock265018  {
Tsym216822* label;
TY265202* fixups;
};
struct  Vmargs265030  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode216790* currentexception;
};
struct Tnodeseq216784 {
  TGenericSeq Sup;
  Tnode216790* data[SEQ_DECL_SIZE];
};
struct Trunkseq213033 {
  TGenericSeq Sup;
  Trunk213031* data[SEQ_DECL_SIZE];
};
struct Ttypeseq216824 {
  TGenericSeq Sup;
  Ttype216828* data[SEQ_DECL_SIZE];
};
struct TY216925 {
  TGenericSeq Sup;
  Tinstantiation216812* data[SEQ_DECL_SIZE];
};
struct Tsymseq216792 {
  TGenericSeq Sup;
  Tsym216822* data[SEQ_DECL_SIZE];
};
struct Tidpairseq216838 {
  TGenericSeq Sup;
  Tidpair216836 data[SEQ_DECL_SIZE];
};
struct TY266140 {
  TGenericSeq Sup;
  Tinstantiationpair266010 data[SEQ_DECL_SIZE];
};
struct TY265242 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY185093 {
  TGenericSeq Sup;
  Tlineinfo184337 data[SEQ_DECL_SIZE];
};
struct TY265261 {
  TGenericSeq Sup;
  TY265262 data[SEQ_DECL_SIZE];
};
struct TY216913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY265222 {
  TGenericSeq Sup;
  Tblock265018 data[SEQ_DECL_SIZE];
};
struct TY265202 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_219351)(Tnode216790* n);
N_NIMCALL(Tsym216822*, myimportmodule_273474)(Tcontext266020* c, Tnode216790* n);
N_NIMCALL(NI32, checkmodulename_273049)(Tnode216790* n);
N_NIMCALL(NimStringDesc*, getmodulename_273009)(Tnode216790* n);
N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(Tident191012*, getident_191441)(NimStringDesc* identifier);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell47304*, usrtocell_51240)(void* usr);
static N_INLINE(void, rtladdzct_52801)(Cell47304* c);
N_NOINLINE(void, addzct_51217)(Cellseq47320* s, Cell47304* 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_235044)(Tnode216790* n, NU8 renderflags);
N_NIMCALL(void, localerror_189080)(Tlineinfo184337 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, findmodule_164484)(NimStringDesc* modulename, NimStringDesc* currentmodule);
N_NIMCALL(NimStringDesc*, tofullpath_185269)(NI32 fileidx);
N_NIMCALL(NI32, fileinfoidx_185017)(NimStringDesc* filename);
N_NIMCALL(Tsym216822*, importmoduleas_273443)(Tnode216790* n, Tsym216822* realmodule);
static N_INLINE(NI, len_217059)(Tnode216790* n);
N_NIMCALL(Tsym216822*, createmodulealias_219838)(Tsym216822* s, Tident191012* newident, Tlineinfo184337 info);
N_NIMCALL(void, message_189095)(Tlineinfo184337 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, adddecl_271445)(Tcontext266020* c, Tsym216822* sym);
N_NIMCALL(void, importallsymbolsexcept_273260)(Tcontext266020* c, Tsym216822* frommod, Intset213035 exceptset);
N_NIMCALL(Tsym216822*, inittabiter_223073)(Ttabiter223071* ti, Tstrtable216794 tab);
N_NIMCALL(void, internalerror_189100)(Tlineinfo184337 info, NimStringDesc* errmsg);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_86409, TNimType* typ);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(NIM_BOOL, isnil_213898)(Intset213035 x);
N_NIMCALL(NIM_BOOL, contains_213811)(Intset213035 s, NI key);
N_NIMCALL(void, rawimportsymbol_273056)(Tcontext266020* c, Tsym216822* s);
N_NIMCALL(Tsym216822*, strtableget_223066)(Tstrtable216794 t, Tident191012* name);
N_NIMCALL(void, incl_213832)(Intset213035* s, NI key);
N_NIMCALL(void, strtableadd_223061)(Tstrtable216794* t, Tsym216822* n);
N_NIMCALL(Tsym216822*, initidentiter_223087)(Tidentiter223084* ti, Tstrtable216794 tab, Tident191012* s);
N_NIMCALL(Tsym216822*, nextidentiter_223093)(Tidentiter223084* ti, Tstrtable216794 tab);
N_NIMCALL(void, addconverter_266440)(Tcontext266020* c, Tsym216822* conv);
static N_INLINE(NIM_BOOL, haspattern_221410)(Tsym216822* s);
static N_INLINE(NIM_BOOL, isroutine_221396)(Tsym216822* s);
N_NIMCALL(void, addpattern_266445)(Tcontext266020* c, Tsym216822* p);
N_NIMCALL(Tsym216822*, nextiter_223078)(Ttabiter223071* ti, Tstrtable216794 tab);
N_NIMCALL(void, checkminsonslen_266962)(Tnode216790* n, NI length);
N_NIMCALL(Tnode216790*, newsymnode_218234)(Tsym216822* sym);
N_NIMCALL(void, initintset_213885)(Intset213035* Result);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(Tident191012*, considerquotedident_271004)(Tnode216790* n);
N_NIMCALL(void, importsymbol_273198)(Tcontext266020* c, Tnode216790* n, Tsym216822* frommod);
N_NIMCALL(void, loadstub_256825)(Tsym216822* s);
STRING_LITERAL(TMP3632, "", 0);
STRING_LITERAL(TMP3633, "as", 2);
STRING_LITERAL(TMP3634, " ", 1);
STRING_LITERAL(TMP3635, ".", 1);
STRING_LITERAL(TMP3636, "/", 1);
STRING_LITERAL(TMP3637, "invalid module name: \'$1\'", 25);
STRING_LITERAL(TMP3638, "module alias must be an identifier", 34);
STRING_LITERAL(TMP3639, "A module cannot import itself", 29);
STRING_LITERAL(TMP3640, "importAllSymbols: ", 18);
STRING_LITERAL(TMP3641, "rawImportSymbol", 15);
STRING_LITERAL(TMP3643, "importSymbol: 2", 15);
STRING_LITERAL(TMP3644, "importSymbol: 3", 15);
extern Gcheap49618 gch_49659;
extern TY263049 gimportmodule_263053;
extern TNimType NTI216435; /* TSymKind */

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

static N_INLINE(void, rtladdzct_52801)(Cell47304* c) {
	addzct_51217((&gch_49659.zct), c);
}

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

N_NIMCALL(NimStringDesc*, getmodulename_273009)(Tnode216790* n) {
	NimStringDesc* result;
{	result = 0;
	switch ((*n).kind) {
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		result = nosunixToNativePath((*n).kindU.S3.strval, ((NimStringDesc*) &TMP3632));
	}
	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;
			Tident191012* LOC9;
			LOC7 = 0;
			LOC7 = ((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 2));
			if (!(LOC7)) goto LA8;
			LOC9 = 0;
			LOC9 = getident_191441(((NimStringDesc*) &TMP3633));
			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 = (Tnodeseq216784*) setLengthSeq(&((*n).kindU.S6.sons)->Sup, sizeof(Tnode216790*), ((NI) 2));
			result = getmodulename_273009((*n).kindU.S6.sons->data[((NI) 0)]);
			goto BeforeRet;
		}
		LA10: ;
		LOC12 = 0;
		LOC12 = rendertree_235044(n, 4);
		result = nsuReplaceStr(LOC12, ((NimStringDesc*) &TMP3634), ((NimStringDesc*) &TMP3632));
	}
	break;
	case ((NU8) 45):
	{
		NimStringDesc* LOC14;
		LOC14 = 0;
		LOC14 = rendertree_235044(n, 4);
		result = nsuReplaceStr(LOC14, ((NimStringDesc*) &TMP3635), ((NimStringDesc*) &TMP3636));
	}
	break;
	case ((NU8) 78):
	{
		result = getmodulename_273009((*n).kindU.S6.sons->data[((NI) 0)]);
	}
	break;
	default:
	{
		NimStringDesc* LOC17;
		NimStringDesc* LOC18;
		LOC17 = 0;
		LOC17 = rendertree_235044(n, 0);
		LOC18 = 0;
		LOC18 = nsuFormatSingleElem(((NimStringDesc*) &TMP3637), LOC17);
		localerror_189080((*n).info, ((NU16) 4), LOC18);
		result = copyString(((NimStringDesc*) &TMP3632));
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI32, checkmodulename_273049)(Tnode216790* n) {
	NI32 result;
	NimStringDesc* modulename;
	NimStringDesc* fullpath;
	NimStringDesc* LOC1;
	result = 0;
	modulename = getmodulename_273009(n);
	LOC1 = 0;
	LOC1 = tofullpath_185269((*n).info.fileindex);
	fullpath = findmodule_164484(modulename, LOC1);
	{
		if (!((fullpath ? fullpath->Sup.len : 0) == ((NI) 0))) goto LA4;
		localerror_189080((*n).info, ((NU16) 3), modulename);
		result = ((NI32) -1);
	}
	goto LA2;
	LA4: ;
	{
		result = fileinfoidx_185017(fullpath);
	}
	LA2: ;
	return result;
}

static N_INLINE(NI, len_217059)(Tnode216790* 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(Tsym216822*, importmoduleas_273443)(Tnode216790* n, Tsym216822* realmodule) {
	Tsym216822* 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_217059(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_189080((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3638));
	}
	goto LA1;
	LA9: ;
	{
		if (!!(((*(*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident).Sup.id == (*(*realmodule).name).Sup.id))) goto LA12;
		result = createmodulealias_219838(realmodule, (*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident, (*realmodule).info);
	}
	goto LA1;
	LA12: ;
	LA1: ;
	return result;
}

N_NIMCALL(Tsym216822*, myimportmodule_273474)(Tcontext266020* c, Tnode216790* n) {
	Tsym216822* result;
	NI32 f;
	result = 0;
	f = checkmodulename_273049(n);
	{
		Tsym216822* LOC5;
		if (!!((f == ((NI32) -1)))) goto LA3;
		LOC5 = 0;
		LOC5 = gimportmodule_263053((*c).module, f);
		result = importmoduleas_273443(n, LOC5);
		{
			if (!((*result).info.fileindex == (*n).info.fileindex)) goto LA8;
			localerror_189080((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3639));
		}
		LA8: ;
		{
			if (!(((*result).flags &(1U<<((NU)(((NU8) 19))&31U)))!=0)) goto LA12;
			message_189095((*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_213898)(Intset213035 x) {
	NIM_BOOL result;
	result = 0;
	result = x.head == 0;
	return result;
}

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

static N_INLINE(NIM_BOOL, haspattern_221410)(Tsym216822* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = isroutine_221396(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_273056)(Tcontext266020* c, Tsym216822* s) {
	Tsym216822* check;
	check = strtableget_223066((*(*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_213832((&(*c).ambiguoussymbols), (*s).Sup.id);
			incl_213832((&(*c).ambiguoussymbols), (*check).Sup.id);
		}
		LA9: ;
	}
	LA5: ;
	strtableadd_223061((&(*(*c).importtable).symbols), s);
	{
		Ttype216828* 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_273135;
				NI HEX3Atmp_273191;
				NI LOC22;
				NI res_273194;
				j_273135 = 0;
				HEX3Atmp_273191 = 0;
				LOC22 = 0;
				LOC22 = sonslen_219351((*etyp).n);
				HEX3Atmp_273191 = (NI)(LOC22 - ((NI) 1));
				res_273194 = ((NI) 0);
				{
					while (1) {
						Tsym216822* e;
						Tidentiter223084 it;
						if (!(res_273194 <= HEX3Atmp_273191)) goto LA24;
						j_273135 = res_273194;
						e = (*(*(*etyp).n).kindU.S6.sons->data[j_273135]).kindU.S4.sym;
						{
							if (!!(((*e).kind == ((NU8) 19)))) goto LA27;
							internalerror_189100((*s).info, ((NimStringDesc*) &TMP3641));
						}
						LA27: ;
						memset((void*)(&it), 0, sizeof(it));
						check = initidentiter_223087((&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_223093((&it), (*(*c).importtable).symbols);
							} LA30: ;
						} LA29: ;
						{
							if (!!((e == NIM_NIL))) goto LA37;
							rawimportsymbol_273056(c, e);
						}
						LA37: ;
						res_273194 += ((NI) 1);
					} LA24: ;
				}
			}
		}
		LA19: ;
	}
	goto LA11;
	LA13: ;
	{
		{
			if (!((*s).kind == ((NU8) 15))) goto LA42;
			addconverter_266440(c, s);
		}
		LA42: ;
		{
			NIM_BOOL LOC46;
			LOC46 = 0;
			LOC46 = haspattern_221410(s);
			if (!LOC46) goto LA47;
			addpattern_266445(c, s);
		}
		LA47: ;
	}
	LA11: ;
}

N_NIMCALL(void, importallsymbolsexcept_273260)(Tcontext266020* c, Tsym216822* frommod, Intset213035 exceptset) {
	Ttabiter223071 i;
	Tsym216822* s;
	memset((void*)(&i), 0, sizeof(i));
	s = inittabiter_223073((&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, (&NTI216435))->Sup.len + 18);
appendString(LOC15, ((NimStringDesc*) &TMP3640));
appendString(LOC15, reprEnum((*s).kind, (&NTI216435)));
						internalerror_189100((*s).info, LOC15);
					}
					LA13: ;
					{
						NIM_BOOL LOC18;
						NIM_BOOL LOC20;
						LOC18 = 0;
						LOC18 = isnil_213898(exceptset);
						if (LOC18) goto LA19;
						LOC20 = 0;
						LOC20 = contains_213811(exceptset, (*(*s).name).Sup.id);
						LOC18 = !(LOC20);
						LA19: ;
						if (!LOC18) goto LA21;
						rawimportsymbol_273056(c, s);
					}
					LA21: ;
				}
				LA9: ;
			}
			LA5: ;
			s = nextiter_223078((&i), (*frommod).kindU.S3.tab);
		} LA2: ;
	}
}

N_NIMCALL(Tnode216790*, evalimport_273001)(Tcontext266020* c, Tnode216790* n) {
	Tnode216790* result;
	Intset213035 emptyset;
	result = 0;
	result = n;
	memset((void*)(&emptyset), 0, sizeof(emptyset));
	{
		NI i_273510;
		NI HEX3Atmp_273527;
		NI LOC2;
		NI res_273530;
		i_273510 = 0;
		HEX3Atmp_273527 = 0;
		LOC2 = 0;
		LOC2 = sonslen_219351(n);
		HEX3Atmp_273527 = (NI)(LOC2 - ((NI) 1));
		res_273530 = ((NI) 0);
		{
			while (1) {
				Tsym216822* m;
				if (!(res_273530 <= HEX3Atmp_273527)) goto LA4;
				i_273510 = res_273530;
				m = myimportmodule_273474(c, (*n).kindU.S6.sons->data[i_273510]);
				{
					if (!!((m == NIM_NIL))) goto LA7;
					adddecl_271445(c, m);
					importallsymbolsexcept_273260(c, m, emptyset);
				}
				LA7: ;
				res_273530 += ((NI) 1);
			} LA4: ;
		}
	}
	return result;
}

N_NIMCALL(Tnode216790*, evalimportexcept_273585)(Tcontext266020* c, Tnode216790* n) {
	Tnode216790* result;
	Tsym216822* m;
	result = 0;
	result = n;
	checkminsonslen_266962(n, ((NI) 2));
	m = myimportmodule_273474(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		Intset213035 exceptset;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_218234(m));
		adddecl_271445(c, m);
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		chckNil((void*)(&exceptset));
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		initintset_213885((&exceptset));
		{
			NI i_273617;
			NI HEX3Atmp_273622;
			NI LOC6;
			NI res_273625;
			i_273617 = 0;
			HEX3Atmp_273622 = 0;
			LOC6 = 0;
			LOC6 = sonslen_219351(n);
			HEX3Atmp_273622 = (NI)(LOC6 - ((NI) 1));
			res_273625 = ((NI) 1);
			{
				while (1) {
					Tident191012* ident;
					if (!(res_273625 <= HEX3Atmp_273622)) goto LA8;
					i_273617 = res_273625;
					ident = considerquotedident_271004((*n).kindU.S6.sons->data[i_273617]);
					incl_213832((&exceptset), (*ident).Sup.id);
					res_273625 += ((NI) 1);
				} LA8: ;
			}
		}
		importallsymbolsexcept_273260(c, m, exceptset);
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importsymbol_273198)(Tcontext266020* c, Tnode216790* n, Tsym216822* frommod) {
	Tident191012* ident;
	Tsym216822* s;
	ident = considerquotedident_271004(n);
	s = strtableget_223066((*frommod).kindU.S3.tab, ident);
	{
		if (!(s == NIM_NIL)) goto LA3;
		localerror_189080((*n).info, ((NU16) 63), (*ident).s);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((*s).kind == ((NU8) 22))) goto LA8;
			loadstub_256825(s);
		}
		LA8: ;
		{
			if (!!(((21755776 &(1U<<((NU)((*s).kind)&31U)))!=0))) goto LA12;
			internalerror_189100((*n).info, ((NimStringDesc*) &TMP3643));
		}
		LA12: ;
		switch ((*s).kind) {
		case ((NU8) 12):
		case ((NU8) 17):
		case ((NU8) 16):
		case ((NU8) 14):
		case ((NU8) 13):
		case ((NU8) 15):
		{
			Tidentiter223084 it;
			Tsym216822* e;
			memset((void*)(&it), 0, sizeof(it));
			e = initidentiter_223087((&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_189100((*n).info, ((NimStringDesc*) &TMP3644));
					}
					LA19: ;
					rawimportsymbol_273056(c, e);
					e = nextidentiter_223093((&it), (*frommod).kindU.S3.tab);
				} LA16: ;
			}
		}
		break;
		default:
		{
			rawimportsymbol_273056(c, s);
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(Tnode216790*, evalfrom_273005)(Tcontext266020* c, Tnode216790* n) {
	Tnode216790* result;
	Tsym216822* m;
	result = 0;
	result = n;
	checkminsonslen_266962(n, ((NI) 2));
	m = myimportmodule_273474(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_218234(m));
		adddecl_271445(c, m);
		{
			NI i_273565;
			NI HEX3Atmp_273578;
			NI LOC6;
			NI res_273581;
			i_273565 = 0;
			HEX3Atmp_273578 = 0;
			LOC6 = 0;
			LOC6 = sonslen_219351(n);
			HEX3Atmp_273578 = (NI)(LOC6 - ((NI) 1));
			res_273581 = ((NI) 1);
			{
				while (1) {
					if (!(res_273581 <= HEX3Atmp_273578)) goto LA8;
					i_273565 = res_273581;
					{
						if (!!(((*(*n).kindU.S6.sons->data[i_273565]).kind == ((NU8) 23)))) goto LA11;
						importsymbol_273198(c, (*n).kindU.S6.sons->data[i_273565], m);
					}
					LA11: ;
					res_273581 += ((NI) 1);
				} LA8: ;
			}
		}
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importallsymbols_273322)(Tcontext266020* c, Tsym216822* frommod) {
	Intset213035 exceptset;
	memset((void*)(&exceptset), 0, sizeof(exceptset));
	importallsymbolsexcept_273260(c, frommod, exceptset);
}
NIM_EXTERNC N_NOINLINE(void, compiler_importerInit000)(void) {
}

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

