/* Generated by Nim Compiler v0.12.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 Tnode223809 Tnode223809;
typedef struct Tcontext278023 Tcontext278023;
typedef struct Intset220056 Intset220056;
typedef struct Trunk220052 Trunk220052;
typedef struct Trunkseq220054 Trunkseq220054;
typedef struct Tsym223841 Tsym223841;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Ttype223847 Ttype223847;
typedef struct Tlineinfo188352 Tlineinfo188352;
typedef struct Tident196021 Tident196021;
typedef struct Tnodeseq223803 Tnodeseq223803;
typedef struct Tidobj196015 Tidobj196015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq223843 Ttypeseq223843;
typedef struct Tscope223835 Tscope223835;
typedef struct TY223944 TY223944;
typedef struct Tstrtable223813 Tstrtable223813;
typedef struct Tsymseq223811 Tsymseq223811;
typedef struct Tloc223823 Tloc223823;
typedef struct Ropeobj174009 Ropeobj174009;
typedef struct Tlib223827 Tlib223827;
typedef struct Cell48947 Cell48947;
typedef struct Cellseq48963 Cellseq48963;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48959 Cellset48959;
typedef struct Pagedesc48955 Pagedesc48955;
typedef struct Memregion30891 Memregion30891;
typedef struct Smallchunk30843 Smallchunk30843;
typedef struct Llchunk30885 Llchunk30885;
typedef struct Bigchunk30845 Bigchunk30845;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30889 Avlnode30889;
typedef struct Gcstat51014 Gcstat51014;
typedef struct Tpasscontext275005 Tpasscontext275005;
typedef struct Tproccon278011 Tproccon278011;
typedef struct Tlinkedlist139028 Tlinkedlist139028;
typedef struct Tlistentry139022 Tlistentry139022;
typedef struct Tidtable223859 Tidtable223859;
typedef struct Tidpairseq223857 Tidpairseq223857;
typedef struct Tctx277048 Tctx277048;
typedef struct TY278143 TY278143;
typedef struct Ttabiter231119 Ttabiter231119;
typedef struct Tidentiter231141 Tidentiter231141;
typedef struct Tinstantiation223831 Tinstantiation223831;
typedef struct Basechunk30841 Basechunk30841;
typedef struct Freecell30833 Freecell30833;
typedef struct Tidpair223855 Tidpair223855;
typedef struct TY277254 TY277254;
typedef struct TY189417 TY189417;
typedef struct PprocHEX3Aobjecttype277233 PprocHEX3Aobjecttype277233;
typedef struct TY277273 TY277273;
typedef struct Tinstantiationpair278013 Tinstantiationpair278013;
typedef struct TY223932 TY223932;
typedef struct TY277234 TY277234;
typedef struct TY277239 TY277239;
typedef struct TY277274 TY277274;
typedef struct Vmargs277042 Vmargs277042;
typedef struct Tblock277030 Tblock277030;
typedef struct TY277214 TY277214;
struct  Intset220056  {
NI counter;
NI max;
Trunk220052* head;
Trunkseq220054* data;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tlineinfo188352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tnode223809  {
Ttype223847* typ;
Tlineinfo188352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym223841* sym;
} S4;
struct {Tident196021* ident;
} S5;
struct {Tnodeseq223803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
typedef N_NIMCALL_PTR(void, TY3889) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3894) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3889 marker;
TY3894 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj196015  {
  TNimObject Sup;
NI id;
};
struct  Tident196021  {
  Tidobj196015 Sup;
NimStringDesc* s;
Tident196021* next;
NI h;
};
struct  Tstrtable223813  {
NI counter;
Tsymseq223811* data;
};
struct  Tloc223823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype223847* t;
Ropeobj174009* r;
Ropeobj174009* heaproot;
};
struct  Tsym223841  {
  Tidobj196015 Sup;
NU8 kind;
union{
struct {Ttypeseq223843* typeinstcache;
Tscope223835* typscope;
} S1;
struct {TY223944* procinstcache;
Tsym223841* gcunsafetyreason;
} S2;
struct {TY223944* usedgenerics;
Tstrtable223813 tab;
} S3;
struct {Tsym223841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype223847* typ;
Tident196021* name;
Tlineinfo188352 info;
Tsym223841* owner;
NU32 flags;
Tnode223809* ast;
NU32 options;
NI position;
NI offset;
Tloc223823 loc;
Tlib223827* annex;
Tnode223809* constraint;
};
struct  Cell48947  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48963  {
NI len;
NI cap;
Cell48947** d;
};
struct  Cellset48959  {
NI counter;
NI max;
Pagedesc48955* head;
Pagedesc48955** data;
};
typedef Smallchunk30843* TY30906[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30891  {
NI minlargeobj;
NI maxlargeobj;
TY30906 freesmallchunks;
Llchunk30885* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30845* freechunkslist;
Intset30817 chunkstarts;
Avlnode30889* root;
Avlnode30889* deleted;
Avlnode30889* last;
Avlnode30889* freeavlnodes;
};
struct  Gcstat51014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap51018  {
Gcstack51016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq48963 zct;
Cellseq48963 decstack;
Cellset48959 cycleroots;
Cellseq48963 tempstack;
NI recgclock;
Memregion30891 region;
Gcstat51014 stat;
};
typedef N_NIMCALL_PTR(Tsym223841*, TY275064) (Tsym223841* m, NI32 fileidx);
struct  Tpasscontext275005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Tlinkedlist139028  {
Tlistentry139022* head;
Tlistentry139022* tail;
NI counter;
};
struct  Tidtable223859  {
NI counter;
Tidpairseq223857* data;
};
typedef N_NIMCALL_PTR(Tnode223809*, TY278074) (Tcontext278023* c, Tnode223809* n);
typedef N_NIMCALL_PTR(Tnode223809*, TY278079) (Tcontext278023* c, Tnode223809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode223809*, TY278087) (Tcontext278023* c, Tnode223809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode223809*, TY278095) (Tcontext278023* c, Tnode223809* n);
typedef N_NIMCALL_PTR(Tnode223809*, TY278100) (Tcontext278023* c, Tnode223809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode223809*, TY278108) (Tcontext278023* c, Tnode223809* n);
typedef N_NIMCALL_PTR(Tnode223809*, TY278113) (Tcontext278023* c, Tnode223809* n, Tnode223809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype223847*, TY278120) (Tcontext278023* c, Tnode223809* n, Ttype223847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode223809*, ClPrc) (Tcontext278023* c, Tidtable223859 pt, Tnode223809* n, void* ClEnv);
void* ClEnv;
} TY278126;
typedef struct {
N_NIMCALL_PTR(Tsym223841*, ClPrc) (Tcontext278023* c, Tsym223841* fn, Tidtable223859 pt, Tlineinfo188352 info, void* ClEnv);
void* ClEnv;
} TY278132;
typedef N_NIMCALL_PTR(Tsym223841*, TY278148) (Tcontext278023* c, Tsym223841* dc, Ttype223847* t, Tlineinfo188352 info, NU8 op);
struct  Tcontext278023  {
  Tpasscontext275005 Sup;
Tsym223841* module;
Tscope223835* currentscope;
Tscope223835* importtable;
Tscope223835* toplevelscope;
Tproccon278011* p;
Tsymseq223811* friendmodules;
NI instcounter;
Intset220056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq223811* converters;
Tsymseq223811* patterns;
Tlinkedlist139028 optionstack;
Tidtable223859 symmapping;
Tlinkedlist139028 libs;
TY278074 semconstexpr;
TY278079 semexpr;
TY278087 semtryexpr;
TY278095 semtryconstexpr;
TY278100 semoperand;
TY278108 semconstboolexpr;
TY278113 semoverloadedcall;
TY278120 semtypenode;
TY278126 seminferredlambda;
TY278132 semgenerateinstance;
Intset220056 includedfiles;
Tstrtable223813 userpragmas;
Tctx277048* evalcontext;
Intset220056 unknownidents;
TY278143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY278148 insttypeboundop;
};
struct  Ttabiter231119  {
NI h;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tscope223835  {
NI depthlevel;
Tstrtable223813 symbols;
Tnodeseq223803* usingsyms;
Tscope223835* parent;
};
struct  Ttype223847  {
  Tidobj196015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq223843* sons;
Tnode223809* n;
Tsym223841* owner;
Tsym223841* sym;
Tsym223841* destructor;
Tsym223841* deepcopy;
Tsym223841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc223823 loc;
};
struct  Tidentiter231141  {
NI h;
Tident196021* name;
};
typedef NI TY30822[8];
struct  Trunk220052  {
Trunk220052* next;
NI key;
TY30822 bits;
};
struct  Ropeobj174009  {
  TNimObject Sup;
Ropeobj174009* left;
Ropeobj174009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry139022  {
  TNimObject Sup;
Tlistentry139022* prev;
Tlistentry139022* next;
};
struct  Tlib223827  {
  Tlistentry139022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj174009* name;
Tnode223809* path;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
struct  Pagedesc48955  {
Pagedesc48955* next;
NI key;
TY30822 bits;
};
struct  Basechunk30841  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30843  {
  Basechunk30841 Sup;
Smallchunk30843* next;
Smallchunk30843* prev;
Freecell30833* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30885  {
NI size;
NI acc;
Llchunk30885* next;
};
struct  Bigchunk30845  {
  Basechunk30841 Sup;
Bigchunk30845* next;
Bigchunk30845* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30822 bits;
};
typedef Avlnode30889* TY30896[2];
struct  Avlnode30889  {
TY30896 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon278011  {
Tsym223841* owner;
Tsym223841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon278011* next;
NIM_BOOL wasforwarded;
Tnode223809* bracketexpr;
};
struct  Tidpair223855  {
Tidobj196015* key;
TNimObject* val;
};
struct  Tctx277048  {
  Tpasscontext275005 Sup;
TY277254* code;
TY189417* debug;
Tnode223809* globals;
Tnode223809* constants;
Ttypeseq223843* types;
Tnode223809* currentexceptiona;
Tnode223809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype277233* prc;
Tsym223841* module;
Tnode223809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo188352 comesfromheuristic;
TY277273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair278013  {
Tsym223841* genericsym;
Tinstantiation223831* inst;
};
struct  Tinstantiation223831  {
Tsym223841* sym;
Ttypeseq223843* concretetypes;
TY223932* usedby;
NI compilesid;
};
struct  Freecell30833  {
Freecell30833* next;
NI zerofield;
};
struct TY277239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY277239 TY277242[256];
struct  PprocHEX3Aobjecttype277233  {
TY277234* blocks;
Tsym223841* sym;
TY277242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs277042* args, void* ClEnv);
void* ClEnv;
} Vmcallback277044;
struct TY277274 {
NimStringDesc* Field0;
Vmcallback277044 Field1;
};
struct  Tblock277030  {
Tsym223841* label;
TY277214* fixups;
};
struct  Vmargs277042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode223809* currentexception;
};
struct Tnodeseq223803 {
  TGenericSeq Sup;
  Tnode223809* data[SEQ_DECL_SIZE];
};
struct Trunkseq220054 {
  TGenericSeq Sup;
  Trunk220052* data[SEQ_DECL_SIZE];
};
struct Ttypeseq223843 {
  TGenericSeq Sup;
  Ttype223847* data[SEQ_DECL_SIZE];
};
struct TY223944 {
  TGenericSeq Sup;
  Tinstantiation223831* data[SEQ_DECL_SIZE];
};
struct Tsymseq223811 {
  TGenericSeq Sup;
  Tsym223841* data[SEQ_DECL_SIZE];
};
struct Tidpairseq223857 {
  TGenericSeq Sup;
  Tidpair223855 data[SEQ_DECL_SIZE];
};
struct TY278143 {
  TGenericSeq Sup;
  Tinstantiationpair278013 data[SEQ_DECL_SIZE];
};
struct TY277254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY189417 {
  TGenericSeq Sup;
  Tlineinfo188352 data[SEQ_DECL_SIZE];
};
struct TY277273 {
  TGenericSeq Sup;
  TY277274 data[SEQ_DECL_SIZE];
};
struct TY223932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY277234 {
  TGenericSeq Sup;
  Tblock277030 data[SEQ_DECL_SIZE];
};
struct TY277214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_226387)(Tnode223809* n);
N_NIMCALL(Tsym223841*, myimportmodule_286708)(Tcontext278023* c, Tnode223809* n);
N_NIMCALL(NI32, checkmodulename_286064)(Tnode223809* n);
N_NIMCALL(NimStringDesc*, getmodulename_286018)(Tnode223809* n);
N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(Tident196021*, getident_196463)(NimStringDesc* identifier);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell48947*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48947* c);
N_NOINLINE(void, addzct_52617)(Cellseq48963* s, Cell48947* 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_245059)(Tnode223809* n, NU8 renderflags);
N_NIMCALL(void, localerror_194128)(Tlineinfo188352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, findmodule_166549)(NimStringDesc* modulename, NimStringDesc* currentmodule);
N_NIMCALL(NimStringDesc*, tofullpath_189662)(NI32 fileidx);
N_NIMCALL(NI32, fileinfoidx_189253)(NimStringDesc* filename);
N_NIMCALL(Tsym223841*, importmoduleas_286671)(Tnode223809* n, Tsym223841* realmodule);
static N_INLINE(NI, len_224098)(Tnode223809* n);
N_NIMCALL(Tsym223841*, createmodulealias_226844)(Tsym223841* s, Tident196021* newident, Tlineinfo188352 info);
N_NIMCALL(void, message_194161)(Tlineinfo188352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, adddecl_284607)(Tcontext278023* c, Tsym223841* sym);
N_NIMCALL(void, importallsymbolsexcept_286315)(Tcontext278023* c, Tsym223841* frommod, Intset220056* exceptset);
N_NIMCALL(Tsym223841*, inittabiter_231124)(Ttabiter231119* ti, Tstrtable223813 tab);
N_NIMCALL(void, internalerror_194172)(Tlineinfo188352 info, NimStringDesc* errmsg);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_86859, TNimType* typ);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(NIM_BOOL, isnil_220946)(Intset220056* x);
N_NIMCALL(NIM_BOOL, contains_220829)(Intset220056* s, NI key);
N_NIMCALL(void, rawimportsymbol_286077)(Tcontext278023* c, Tsym223841* s);
N_NIMCALL(Tsym223841*, strtableget_231111)(Tstrtable223813 t, Tident196021* name);
N_NIMCALL(void, incl_220856)(Intset220056* s, NI key);
N_NIMCALL(void, strtableadd_231103)(Tstrtable223813* t, Tsym223841* n);
N_NIMCALL(Tsym223841*, initidentiter_231147)(Tidentiter231141* ti, Tstrtable223813 tab, Tident196021* s);
N_NIMCALL(Tsym223841*, nextidentiter_231156)(Tidentiter231141* ti, Tstrtable223813 tab);
N_NIMCALL(void, addconverter_278563)(Tcontext278023* c, Tsym223841* conv);
static N_INLINE(NIM_BOOL, haspattern_228784)(Tsym223841* s);
static N_INLINE(NIM_BOOL, isroutine_228764)(Tsym223841* s);
N_NIMCALL(void, addpattern_278574)(Tcontext278023* c, Tsym223841* p);
N_NIMCALL(Tsym223841*, nextiter_231132)(Ttabiter231119* ti, Tstrtable223813 tab);
N_NIMCALL(void, checkminsonslen_279270)(Tnode223809* n, NI length);
N_NIMCALL(Tnode223809*, newsymnode_225325)(Tsym223841* sym);
N_NIMCALL(void, initintset_220927)(Intset220056* Result);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(Tident196021*, considerquotedident_284010)(Tnode223809* n);
N_NIMCALL(void, importsymbol_286241)(Tcontext278023* c, Tnode223809* n, Tsym223841* frommod);
N_NIMCALL(void, loadstub_269052)(Tsym223841* s);
STRING_LITERAL(TMP3613, "", 0);
STRING_LITERAL(TMP3614, "as", 2);
STRING_LITERAL(TMP3615, " ", 1);
STRING_LITERAL(TMP3616, ".", 1);
STRING_LITERAL(TMP3617, "/", 1);
STRING_LITERAL(TMP3618, "invalid module name: \'$1\'", 25);
STRING_LITERAL(TMP3619, "module alias must be an identifier", 34);
STRING_LITERAL(TMP3620, "A module cannot import itself", 29);
STRING_LITERAL(TMP3621, "importAllSymbols: ", 18);
STRING_LITERAL(TMP3622, "rawImportSymbol", 15);
STRING_LITERAL(TMP3624, "importSymbol: 2", 15);
STRING_LITERAL(TMP3625, "importSymbol: 3", 15);
extern Gcheap51018 gch_51059;
extern TY275064 gimportmodule_275068;
extern TNimType NTI223441; /* TSymKind */

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

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

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

N_NIMCALL(NimStringDesc*, getmodulename_286018)(Tnode223809* n) {
	NimStringDesc* result;
{	result = 0;
	switch ((*n).kind) {
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		result = nosunixToNativePath((*n).kindU.S3.strval, ((NimStringDesc*) &TMP3613));
	}
	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;
			Tident196021* LOC9;
			LOC7 = 0;
			LOC7 = ((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 2));
			if (!(LOC7)) goto LA8;
			LOC9 = 0;
			LOC9 = getident_196463(((NimStringDesc*) &TMP3614));
			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 = (Tnodeseq223803*) setLengthSeq(&((*n).kindU.S6.sons)->Sup, sizeof(Tnode223809*), ((NI) 2));
			result = getmodulename_286018((*n).kindU.S6.sons->data[((NI) 0)]);
			goto BeforeRet;
		}
		LA10: ;
		LOC12 = 0;
		LOC12 = rendertree_245059(n, 4);
		result = nsuReplaceStr(LOC12, ((NimStringDesc*) &TMP3615), ((NimStringDesc*) &TMP3613));
	}
	break;
	case ((NU8) 45):
	{
		NimStringDesc* LOC14;
		LOC14 = 0;
		LOC14 = rendertree_245059(n, 4);
		result = nsuReplaceStr(LOC14, ((NimStringDesc*) &TMP3616), ((NimStringDesc*) &TMP3617));
	}
	break;
	case ((NU8) 78):
	{
		result = getmodulename_286018((*n).kindU.S6.sons->data[((NI) 0)]);
	}
	break;
	default:
	{
		NimStringDesc* LOC17;
		NimStringDesc* LOC18;
		LOC17 = 0;
		LOC17 = rendertree_245059(n, 0);
		LOC18 = 0;
		LOC18 = nsuFormatSingleElem(((NimStringDesc*) &TMP3618), LOC17);
		localerror_194128((*n).info, ((NU16) 4), LOC18);
		result = copyString(((NimStringDesc*) &TMP3613));
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI32, checkmodulename_286064)(Tnode223809* n) {
	NI32 result;
	NimStringDesc* modulename;
	NimStringDesc* fullpath;
	NimStringDesc* LOC1;
	result = 0;
	modulename = getmodulename_286018(n);
	LOC1 = 0;
	LOC1 = tofullpath_189662((*n).info.fileindex);
	fullpath = findmodule_166549(modulename, LOC1);
	{
		if (!((fullpath ? fullpath->Sup.len : 0) == ((NI) 0))) goto LA4;
		localerror_194128((*n).info, ((NU16) 3), modulename);
		result = ((NI32) -1);
	}
	goto LA2;
	LA4: ;
	{
		result = fileinfoidx_189253(fullpath);
	}
	LA2: ;
	return result;
}

static N_INLINE(NI, len_224098)(Tnode223809* 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(Tsym223841*, importmoduleas_286671)(Tnode223809* n, Tsym223841* realmodule) {
	Tsym223841* 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_224098(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_194128((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3619));
	}
	goto LA1;
	LA9: ;
	{
		if (!!(((*(*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident).Sup.id == (*(*realmodule).name).Sup.id))) goto LA12;
		result = createmodulealias_226844(realmodule, (*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident, (*realmodule).info);
	}
	goto LA1;
	LA12: ;
	LA1: ;
	return result;
}

N_NIMCALL(Tsym223841*, myimportmodule_286708)(Tcontext278023* c, Tnode223809* n) {
	Tsym223841* result;
	NI32 f;
	result = 0;
	f = checkmodulename_286064(n);
	{
		Tsym223841* LOC5;
		if (!!((f == ((NI32) -1)))) goto LA3;
		LOC5 = 0;
		LOC5 = gimportmodule_275068((*c).module, f);
		result = importmoduleas_286671(n, LOC5);
		{
			if (!((*result).info.fileindex == (*n).info.fileindex)) goto LA8;
			localerror_194128((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3620));
		}
		LA8: ;
		{
			if (!(((*result).flags &(1<<((((NU8) 19))&31)))!=0)) goto LA12;
			message_194161((*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_220946)(Intset220056* x) {
	NIM_BOOL result;
	result = 0;
	result = (*x).head == 0;
	return result;
}

static N_INLINE(NIM_BOOL, isroutine_228764)(Tsym223841* s) {
	NIM_BOOL result;
	result = 0;
	result = ((520192 &(1<<(((*s).kind)&31)))!=0);
	return result;
}

static N_INLINE(NIM_BOOL, haspattern_228784)(Tsym223841* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = isroutine_228764(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_286077)(Tcontext278023* c, Tsym223841* s) {
	Tsym223841* check;
	check = strtableget_231111((*(*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 (!!(((520256 &(1<<(((*s).kind)&31)))!=0))) goto LA9;
			incl_220856((&(*c).ambiguoussymbols), (*s).Sup.id);
			incl_220856((&(*c).ambiguoussymbols), (*check).Sup.id);
		}
		LA9: ;
	}
	LA5: ;
	strtableadd_231103((&(*(*c).importtable).symbols), s);
	{
		Ttype223847* etyp;
		if (!((*s).kind == ((NU8) 7))) goto LA13;
		etyp = (*s).typ;
		{
			NIM_BOOL LOC17;
			LOC17 = 0;
			LOC17 = ((16386 &(IL64(1)<<(((*etyp).kind)&IL64(63))))!=0);
			if (!(LOC17)) goto LA18;
			LOC17 = !((((*s).flags &(1<<((((NU8) 9))&31)))!=0));
			LA18: ;
			if (!LOC17) goto LA19;
			{
				NI j_286157;
				NI HEX3Atmp_286213;
				NI LOC22;
				NI res_286216;
				j_286157 = 0;
				HEX3Atmp_286213 = 0;
				LOC22 = 0;
				LOC22 = sonslen_226387((*etyp).n);
				HEX3Atmp_286213 = (NI)(LOC22 - ((NI) 1));
				res_286216 = ((NI) 0);
				{
					while (1) {
						Tsym223841* e;
						Tidentiter231141 it;
						if (!(res_286216 <= HEX3Atmp_286213)) goto LA24;
						j_286157 = res_286216;
						e = (*(*(*etyp).n).kindU.S6.sons->data[j_286157]).kindU.S4.sym;
						{
							if (!!(((*e).kind == ((NU8) 20)))) goto LA27;
							internalerror_194172((*s).info, ((NimStringDesc*) &TMP3622));
						}
						LA27: ;
						memset((void*)(&it), 0, sizeof(it));
						check = initidentiter_231147((&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_231156((&it), (*(*c).importtable).symbols);
							} LA30: ;
						} LA29: ;
						{
							if (!!((e == NIM_NIL))) goto LA37;
							rawimportsymbol_286077(c, e);
						}
						LA37: ;
						res_286216 += ((NI) 1);
					} LA24: ;
				}
			}
		}
		LA19: ;
	}
	goto LA11;
	LA13: ;
	{
		{
			if (!((*s).kind == ((NU8) 16))) goto LA42;
			addconverter_278563(c, s);
		}
		LA42: ;
		{
			NIM_BOOL LOC46;
			LOC46 = 0;
			LOC46 = haspattern_228784(s);
			if (!LOC46) goto LA47;
			addpattern_278574(c, s);
		}
		LA47: ;
	}
	LA11: ;
}

N_NIMCALL(void, importallsymbolsexcept_286315)(Tcontext278023* c, Tsym223841* frommod, Intset220056* exceptset) {
	Ttabiter231119 i;
	Tsym223841* s;
	memset((void*)(&i), 0, sizeof(i));
	s = inittabiter_231124((&i), (*frommod).kindU.S3.tab);
	{
		while (1) {
			if (!!((s == NIM_NIL))) goto LA2;
			{
				if (!!(((*s).kind == ((NU8) 6)))) goto LA5;
				{
					if (!!(((*s).kind == ((NU8) 20)))) goto LA9;
					{
						NimStringDesc* LOC15;
						if (!!(((43513728 &(1<<(((*s).kind)&31)))!=0))) goto LA13;
						LOC15 = 0;
						LOC15 = rawNewString(reprEnum((*s).kind, (&NTI223441))->Sup.len + 18);
appendString(LOC15, ((NimStringDesc*) &TMP3621));
appendString(LOC15, reprEnum((*s).kind, (&NTI223441)));
						internalerror_194172((*s).info, LOC15);
					}
					LA13: ;
					{
						NIM_BOOL LOC18;
						NIM_BOOL LOC20;
						LOC18 = 0;
						LOC18 = isnil_220946(exceptset);
						if (LOC18) goto LA19;
						LOC20 = 0;
						LOC20 = contains_220829(exceptset, (*(*s).name).Sup.id);
						LOC18 = !(LOC20);
						LA19: ;
						if (!LOC18) goto LA21;
						rawimportsymbol_286077(c, s);
					}
					LA21: ;
				}
				LA9: ;
			}
			LA5: ;
			s = nextiter_231132((&i), (*frommod).kindU.S3.tab);
		} LA2: ;
	}
}

N_NIMCALL(Tnode223809*, evalimport_286004)(Tcontext278023* c, Tnode223809* n) {
	Tnode223809* result;
	Intset220056 emptyset;
	result = 0;
	result = n;
	memset((void*)(&emptyset), 0, sizeof(emptyset));
	{
		NI i_286751;
		NI HEX3Atmp_286768;
		NI LOC2;
		NI res_286771;
		i_286751 = 0;
		HEX3Atmp_286768 = 0;
		LOC2 = 0;
		LOC2 = sonslen_226387(n);
		HEX3Atmp_286768 = (NI)(LOC2 - ((NI) 1));
		res_286771 = ((NI) 0);
		{
			while (1) {
				Tsym223841* m;
				if (!(res_286771 <= HEX3Atmp_286768)) goto LA4;
				i_286751 = res_286771;
				m = myimportmodule_286708(c, (*n).kindU.S6.sons->data[i_286751]);
				{
					if (!!((m == NIM_NIL))) goto LA7;
					adddecl_284607(c, m);
					importallsymbolsexcept_286315(c, m, (&emptyset));
				}
				LA7: ;
				res_286771 += ((NI) 1);
			} LA4: ;
		}
	}
	return result;
}

N_NIMCALL(Tnode223809*, evalimportexcept_286857)(Tcontext278023* c, Tnode223809* n) {
	Tnode223809* result;
	Tsym223841* m;
	result = 0;
	result = n;
	checkminsonslen_279270(n, ((NI) 2));
	m = myimportmodule_286708(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		Intset220056 exceptset;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_225325(m));
		adddecl_284607(c, m);
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		chckNil((void*)(&exceptset));
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		initintset_220927((&exceptset));
		{
			NI i_286890;
			NI HEX3Atmp_286895;
			NI LOC6;
			NI res_286898;
			i_286890 = 0;
			HEX3Atmp_286895 = 0;
			LOC6 = 0;
			LOC6 = sonslen_226387(n);
			HEX3Atmp_286895 = (NI)(LOC6 - ((NI) 1));
			res_286898 = ((NI) 1);
			{
				while (1) {
					Tident196021* ident;
					if (!(res_286898 <= HEX3Atmp_286895)) goto LA8;
					i_286890 = res_286898;
					ident = considerquotedident_284010((*n).kindU.S6.sons->data[i_286890]);
					incl_220856((&exceptset), (*ident).Sup.id);
					res_286898 += ((NI) 1);
				} LA8: ;
			}
		}
		importallsymbolsexcept_286315(c, m, (&exceptset));
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importsymbol_286241)(Tcontext278023* c, Tnode223809* n, Tsym223841* frommod) {
	Tident196021* ident;
	Tsym223841* s;
	ident = considerquotedident_284010(n);
	s = strtableget_231111((*frommod).kindU.S3.tab, ident);
	{
		if (!(s == NIM_NIL)) goto LA3;
		localerror_194128((*n).info, ((NU16) 63), (*ident).s);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((*s).kind == ((NU8) 23))) goto LA8;
			loadstub_269052(s);
		}
		LA8: ;
		{
			if (!!(((43513728 &(1<<(((*s).kind)&31)))!=0))) goto LA12;
			internalerror_194172((*n).info, ((NimStringDesc*) &TMP3624));
		}
		LA12: ;
		switch ((*s).kind) {
		case ((NU8) 12):
		case ((NU8) 18):
		case ((NU8) 17):
		case ((NU8) 14):
		case ((NU8) 15):
		case ((NU8) 13):
		case ((NU8) 16):
		{
			Tidentiter231141 it;
			Tsym223841* e;
			memset((void*)(&it), 0, sizeof(it));
			e = initidentiter_231147((&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_194172((*n).info, ((NimStringDesc*) &TMP3625));
					}
					LA19: ;
					rawimportsymbol_286077(c, e);
					e = nextidentiter_231156((&it), (*frommod).kindU.S3.tab);
				} LA16: ;
			}
		}
		break;
		default:
		{
			rawimportsymbol_286077(c, s);
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(Tnode223809*, evalfrom_286011)(Tcontext278023* c, Tnode223809* n) {
	Tnode223809* result;
	Tsym223841* m;
	result = 0;
	result = n;
	checkminsonslen_279270(n, ((NI) 2));
	m = myimportmodule_286708(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_225325(m));
		adddecl_284607(c, m);
		{
			NI i_286822;
			NI HEX3Atmp_286835;
			NI LOC6;
			NI res_286838;
			i_286822 = 0;
			HEX3Atmp_286835 = 0;
			LOC6 = 0;
			LOC6 = sonslen_226387(n);
			HEX3Atmp_286835 = (NI)(LOC6 - ((NI) 1));
			res_286838 = ((NI) 1);
			{
				while (1) {
					if (!(res_286838 <= HEX3Atmp_286835)) goto LA8;
					i_286822 = res_286838;
					{
						if (!!(((*(*n).kindU.S6.sons->data[i_286822]).kind == ((NU8) 23)))) goto LA11;
						importsymbol_286241(c, (*n).kindU.S6.sons->data[i_286822], m);
					}
					LA11: ;
					res_286838 += ((NI) 1);
				} LA8: ;
			}
		}
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importallsymbols_286389)(Tcontext278023* c, Tsym223841* frommod) {
	Intset220056 exceptset;
	memset((void*)(&exceptset), 0, sizeof(exceptset));
	importallsymbolsexcept_286315(c, frommod, (&exceptset));
}
NIM_EXTERNC N_NOINLINE(void, compiler_importerInit000)(void) {
}

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

