/* 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 Tnode224809 Tnode224809;
typedef struct Tcontext279023 Tcontext279023;
typedef struct Intset221056 Intset221056;
typedef struct Trunk221052 Trunk221052;
typedef struct Trunkseq221054 Trunkseq221054;
typedef struct Tsym224841 Tsym224841;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Ttype224847 Ttype224847;
typedef struct Tlineinfo189352 Tlineinfo189352;
typedef struct Tident197021 Tident197021;
typedef struct Tnodeseq224803 Tnodeseq224803;
typedef struct Tidobj197015 Tidobj197015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq224843 Ttypeseq224843;
typedef struct Tscope224835 Tscope224835;
typedef struct TY224944 TY224944;
typedef struct Tstrtable224813 Tstrtable224813;
typedef struct Tsymseq224811 Tsymseq224811;
typedef struct Tloc224823 Tloc224823;
typedef struct Ropeobj175009 Ropeobj175009;
typedef struct Tlib224827 Tlib224827;
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 Tpasscontext276005 Tpasscontext276005;
typedef struct Tproccon279011 Tproccon279011;
typedef struct Tlinkedlist140028 Tlinkedlist140028;
typedef struct Tlistentry140022 Tlistentry140022;
typedef struct Tidtable224859 Tidtable224859;
typedef struct Tidpairseq224857 Tidpairseq224857;
typedef struct Tctx278048 Tctx278048;
typedef struct TY279143 TY279143;
typedef struct Ttabiter232119 Ttabiter232119;
typedef struct Tidentiter232141 Tidentiter232141;
typedef struct Tinstantiation224831 Tinstantiation224831;
typedef struct Basechunk30841 Basechunk30841;
typedef struct Freecell30833 Freecell30833;
typedef struct Tidpair224855 Tidpair224855;
typedef struct TY278254 TY278254;
typedef struct TY190417 TY190417;
typedef struct PprocHEX3Aobjecttype278233 PprocHEX3Aobjecttype278233;
typedef struct TY278273 TY278273;
typedef struct Tinstantiationpair279013 Tinstantiationpair279013;
typedef struct TY224932 TY224932;
typedef struct TY278234 TY278234;
typedef struct TY278239 TY278239;
typedef struct TY278274 TY278274;
typedef struct Vmargs278042 Vmargs278042;
typedef struct Tblock278030 Tblock278030;
typedef struct TY278214 TY278214;
struct  Intset221056  {
NI counter;
NI max;
Trunk221052* head;
Trunkseq221054* data;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tlineinfo189352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tnode224809  {
Ttype224847* typ;
Tlineinfo189352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym224841* sym;
} S4;
struct {Tident197021* ident;
} S5;
struct {Tnodeseq224803* 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  Tidobj197015  {
  TNimObject Sup;
NI id;
};
struct  Tident197021  {
  Tidobj197015 Sup;
NimStringDesc* s;
Tident197021* next;
NI h;
};
struct  Tstrtable224813  {
NI counter;
Tsymseq224811* data;
};
struct  Tloc224823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype224847* t;
Ropeobj175009* r;
Ropeobj175009* heaproot;
};
struct  Tsym224841  {
  Tidobj197015 Sup;
NU8 kind;
union{
struct {Ttypeseq224843* typeinstcache;
Tscope224835* typscope;
} S1;
struct {TY224944* procinstcache;
Tsym224841* gcunsafetyreason;
} S2;
struct {TY224944* usedgenerics;
Tstrtable224813 tab;
} S3;
struct {Tsym224841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype224847* typ;
Tident197021* name;
Tlineinfo189352 info;
Tsym224841* owner;
NU32 flags;
Tnode224809* ast;
NU32 options;
NI position;
NI offset;
Tloc224823 loc;
Tlib224827* annex;
Tnode224809* 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(Tsym224841*, TY276064) (Tsym224841* m, NI32 fileidx);
struct  Tpasscontext276005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Tlinkedlist140028  {
Tlistentry140022* head;
Tlistentry140022* tail;
NI counter;
};
struct  Tidtable224859  {
NI counter;
Tidpairseq224857* data;
};
typedef N_NIMCALL_PTR(Tnode224809*, TY279074) (Tcontext279023* c, Tnode224809* n);
typedef N_NIMCALL_PTR(Tnode224809*, TY279079) (Tcontext279023* c, Tnode224809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode224809*, TY279087) (Tcontext279023* c, Tnode224809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode224809*, TY279095) (Tcontext279023* c, Tnode224809* n);
typedef N_NIMCALL_PTR(Tnode224809*, TY279100) (Tcontext279023* c, Tnode224809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode224809*, TY279108) (Tcontext279023* c, Tnode224809* n);
typedef N_NIMCALL_PTR(Tnode224809*, TY279113) (Tcontext279023* c, Tnode224809* n, Tnode224809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype224847*, TY279120) (Tcontext279023* c, Tnode224809* n, Ttype224847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode224809*, ClPrc) (Tcontext279023* c, Tidtable224859 pt, Tnode224809* n, void* ClEnv);
void* ClEnv;
} TY279126;
typedef struct {
N_NIMCALL_PTR(Tsym224841*, ClPrc) (Tcontext279023* c, Tsym224841* fn, Tidtable224859 pt, Tlineinfo189352 info, void* ClEnv);
void* ClEnv;
} TY279132;
typedef N_NIMCALL_PTR(Tsym224841*, TY279148) (Tcontext279023* c, Tsym224841* dc, Ttype224847* t, Tlineinfo189352 info, NU8 op);
struct  Tcontext279023  {
  Tpasscontext276005 Sup;
Tsym224841* module;
Tscope224835* currentscope;
Tscope224835* importtable;
Tscope224835* toplevelscope;
Tproccon279011* p;
Tsymseq224811* friendmodules;
NI instcounter;
Intset221056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq224811* converters;
Tsymseq224811* patterns;
Tlinkedlist140028 optionstack;
Tidtable224859 symmapping;
Tlinkedlist140028 libs;
TY279074 semconstexpr;
TY279079 semexpr;
TY279087 semtryexpr;
TY279095 semtryconstexpr;
TY279100 semoperand;
TY279108 semconstboolexpr;
TY279113 semoverloadedcall;
TY279120 semtypenode;
TY279126 seminferredlambda;
TY279132 semgenerateinstance;
Intset221056 includedfiles;
Tstrtable224813 userpragmas;
Tctx278048* evalcontext;
Intset221056 unknownidents;
TY279143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY279148 insttypeboundop;
};
struct  Ttabiter232119  {
NI h;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tscope224835  {
NI depthlevel;
Tstrtable224813 symbols;
Tnodeseq224803* usingsyms;
Tscope224835* parent;
};
struct  Ttype224847  {
  Tidobj197015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq224843* sons;
Tnode224809* n;
Tsym224841* owner;
Tsym224841* sym;
Tsym224841* destructor;
Tsym224841* deepcopy;
Tsym224841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc224823 loc;
};
struct  Tidentiter232141  {
NI h;
Tident197021* name;
};
typedef NI TY30822[8];
struct  Trunk221052  {
Trunk221052* next;
NI key;
TY30822 bits;
};
struct  Ropeobj175009  {
  TNimObject Sup;
Ropeobj175009* left;
Ropeobj175009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry140022  {
  TNimObject Sup;
Tlistentry140022* prev;
Tlistentry140022* next;
};
struct  Tlib224827  {
  Tlistentry140022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj175009* name;
Tnode224809* 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  Tproccon279011  {
Tsym224841* owner;
Tsym224841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon279011* next;
NIM_BOOL wasforwarded;
Tnode224809* bracketexpr;
};
struct  Tidpair224855  {
Tidobj197015* key;
TNimObject* val;
};
struct  Tctx278048  {
  Tpasscontext276005 Sup;
TY278254* code;
TY190417* debug;
Tnode224809* globals;
Tnode224809* constants;
Ttypeseq224843* types;
Tnode224809* currentexceptiona;
Tnode224809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype278233* prc;
Tsym224841* module;
Tnode224809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo189352 comesfromheuristic;
TY278273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair279013  {
Tsym224841* genericsym;
Tinstantiation224831* inst;
};
struct  Tinstantiation224831  {
Tsym224841* sym;
Ttypeseq224843* concretetypes;
TY224932* usedby;
NI compilesid;
};
struct  Freecell30833  {
Freecell30833* next;
NI zerofield;
};
struct TY278239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY278239 TY278242[256];
struct  PprocHEX3Aobjecttype278233  {
TY278234* blocks;
Tsym224841* sym;
TY278242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs278042* args, void* ClEnv);
void* ClEnv;
} Vmcallback278044;
struct TY278274 {
NimStringDesc* Field0;
Vmcallback278044 Field1;
};
struct  Tblock278030  {
Tsym224841* label;
TY278214* fixups;
};
struct  Vmargs278042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode224809* currentexception;
};
struct Tnodeseq224803 {
  TGenericSeq Sup;
  Tnode224809* data[SEQ_DECL_SIZE];
};
struct Trunkseq221054 {
  TGenericSeq Sup;
  Trunk221052* data[SEQ_DECL_SIZE];
};
struct Ttypeseq224843 {
  TGenericSeq Sup;
  Ttype224847* data[SEQ_DECL_SIZE];
};
struct TY224944 {
  TGenericSeq Sup;
  Tinstantiation224831* data[SEQ_DECL_SIZE];
};
struct Tsymseq224811 {
  TGenericSeq Sup;
  Tsym224841* data[SEQ_DECL_SIZE];
};
struct Tidpairseq224857 {
  TGenericSeq Sup;
  Tidpair224855 data[SEQ_DECL_SIZE];
};
struct TY279143 {
  TGenericSeq Sup;
  Tinstantiationpair279013 data[SEQ_DECL_SIZE];
};
struct TY278254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY190417 {
  TGenericSeq Sup;
  Tlineinfo189352 data[SEQ_DECL_SIZE];
};
struct TY278273 {
  TGenericSeq Sup;
  TY278274 data[SEQ_DECL_SIZE];
};
struct TY224932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY278234 {
  TGenericSeq Sup;
  Tblock278030 data[SEQ_DECL_SIZE];
};
struct TY278214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_227387)(Tnode224809* n);
N_NIMCALL(Tsym224841*, myimportmodule_287708)(Tcontext279023* c, Tnode224809* n);
N_NIMCALL(NI32, checkmodulename_287064)(Tnode224809* n);
N_NIMCALL(NimStringDesc*, getmodulename_287018)(Tnode224809* n);
N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(Tident197021*, getident_197463)(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_246059)(Tnode224809* n, NU8 renderflags);
N_NIMCALL(void, localerror_195128)(Tlineinfo189352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, findmodule_167549)(NimStringDesc* modulename, NimStringDesc* currentmodule);
N_NIMCALL(NimStringDesc*, tofullpath_190662)(NI32 fileidx);
N_NIMCALL(NI32, fileinfoidx_190253)(NimStringDesc* filename);
N_NIMCALL(Tsym224841*, importmoduleas_287671)(Tnode224809* n, Tsym224841* realmodule);
static N_INLINE(NI, len_225098)(Tnode224809* n);
N_NIMCALL(Tsym224841*, createmodulealias_227844)(Tsym224841* s, Tident197021* newident, Tlineinfo189352 info);
N_NIMCALL(void, message_195161)(Tlineinfo189352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, adddecl_285607)(Tcontext279023* c, Tsym224841* sym);
N_NIMCALL(void, importallsymbolsexcept_287315)(Tcontext279023* c, Tsym224841* frommod, Intset221056* exceptset);
N_NIMCALL(Tsym224841*, inittabiter_232124)(Ttabiter232119* ti, Tstrtable224813 tab);
N_NIMCALL(void, internalerror_195172)(Tlineinfo189352 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_221946)(Intset221056* x);
N_NIMCALL(NIM_BOOL, contains_221829)(Intset221056* s, NI key);
N_NIMCALL(void, rawimportsymbol_287077)(Tcontext279023* c, Tsym224841* s);
N_NIMCALL(Tsym224841*, strtableget_232111)(Tstrtable224813 t, Tident197021* name);
N_NIMCALL(void, incl_221856)(Intset221056* s, NI key);
N_NIMCALL(void, strtableadd_232103)(Tstrtable224813* t, Tsym224841* n);
N_NIMCALL(Tsym224841*, initidentiter_232147)(Tidentiter232141* ti, Tstrtable224813 tab, Tident197021* s);
N_NIMCALL(Tsym224841*, nextidentiter_232156)(Tidentiter232141* ti, Tstrtable224813 tab);
N_NIMCALL(void, addconverter_279563)(Tcontext279023* c, Tsym224841* conv);
static N_INLINE(NIM_BOOL, haspattern_229784)(Tsym224841* s);
static N_INLINE(NIM_BOOL, isroutine_229764)(Tsym224841* s);
N_NIMCALL(void, addpattern_279574)(Tcontext279023* c, Tsym224841* p);
N_NIMCALL(Tsym224841*, nextiter_232132)(Ttabiter232119* ti, Tstrtable224813 tab);
N_NIMCALL(void, checkminsonslen_280270)(Tnode224809* n, NI length);
N_NIMCALL(Tnode224809*, newsymnode_226325)(Tsym224841* sym);
N_NIMCALL(void, initintset_221927)(Intset221056* Result);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(Tident197021*, considerquotedident_285010)(Tnode224809* n);
N_NIMCALL(void, importsymbol_287241)(Tcontext279023* c, Tnode224809* n, Tsym224841* frommod);
N_NIMCALL(void, loadstub_270052)(Tsym224841* 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 TY276064 gimportmodule_276068;
extern TNimType NTI224441; /* 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_287018)(Tnode224809* 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;
			Tident197021* LOC9;
			LOC7 = 0;
			LOC7 = ((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 2));
			if (!(LOC7)) goto LA8;
			LOC9 = 0;
			LOC9 = getident_197463(((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 = (Tnodeseq224803*) setLengthSeq(&((*n).kindU.S6.sons)->Sup, sizeof(Tnode224809*), ((NI) 2));
			result = getmodulename_287018((*n).kindU.S6.sons->data[((NI) 0)]);
			goto BeforeRet;
		}
		LA10: ;
		LOC12 = 0;
		LOC12 = rendertree_246059(n, 4);
		result = nsuReplaceStr(LOC12, ((NimStringDesc*) &TMP3615), ((NimStringDesc*) &TMP3613));
	}
	break;
	case ((NU8) 45):
	{
		NimStringDesc* LOC14;
		LOC14 = 0;
		LOC14 = rendertree_246059(n, 4);
		result = nsuReplaceStr(LOC14, ((NimStringDesc*) &TMP3616), ((NimStringDesc*) &TMP3617));
	}
	break;
	case ((NU8) 78):
	{
		result = getmodulename_287018((*n).kindU.S6.sons->data[((NI) 0)]);
	}
	break;
	default:
	{
		NimStringDesc* LOC17;
		NimStringDesc* LOC18;
		LOC17 = 0;
		LOC17 = rendertree_246059(n, 0);
		LOC18 = 0;
		LOC18 = nsuFormatSingleElem(((NimStringDesc*) &TMP3618), LOC17);
		localerror_195128((*n).info, ((NU16) 4), LOC18);
		result = copyString(((NimStringDesc*) &TMP3613));
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI32, checkmodulename_287064)(Tnode224809* n) {
	NI32 result;
	NimStringDesc* modulename;
	NimStringDesc* fullpath;
	NimStringDesc* LOC1;
	result = 0;
	modulename = getmodulename_287018(n);
	LOC1 = 0;
	LOC1 = tofullpath_190662((*n).info.fileindex);
	fullpath = findmodule_167549(modulename, LOC1);
	{
		if (!((fullpath ? fullpath->Sup.len : 0) == ((NI) 0))) goto LA4;
		localerror_195128((*n).info, ((NU16) 3), modulename);
		result = ((NI32) -1);
	}
	goto LA2;
	LA4: ;
	{
		result = fileinfoidx_190253(fullpath);
	}
	LA2: ;
	return result;
}

static N_INLINE(NI, len_225098)(Tnode224809* 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(Tsym224841*, importmoduleas_287671)(Tnode224809* n, Tsym224841* realmodule) {
	Tsym224841* 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_225098(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_195128((*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_227844(realmodule, (*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident, (*realmodule).info);
	}
	goto LA1;
	LA12: ;
	LA1: ;
	return result;
}

N_NIMCALL(Tsym224841*, myimportmodule_287708)(Tcontext279023* c, Tnode224809* n) {
	Tsym224841* result;
	NI32 f;
	result = 0;
	f = checkmodulename_287064(n);
	{
		Tsym224841* LOC5;
		if (!!((f == ((NI32) -1)))) goto LA3;
		LOC5 = 0;
		LOC5 = gimportmodule_276068((*c).module, f);
		result = importmoduleas_287671(n, LOC5);
		{
			if (!((*result).info.fileindex == (*n).info.fileindex)) goto LA8;
			localerror_195128((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3620));
		}
		LA8: ;
		{
			if (!(((*result).flags &(1<<((((NU8) 19))&31)))!=0)) goto LA12;
			message_195161((*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_221946)(Intset221056* x) {
	NIM_BOOL result;
	result = 0;
	result = (*x).head == 0;
	return result;
}

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

static N_INLINE(NIM_BOOL, haspattern_229784)(Tsym224841* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = isroutine_229764(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_287077)(Tcontext279023* c, Tsym224841* s) {
	Tsym224841* check;
	check = strtableget_232111((*(*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_221856((&(*c).ambiguoussymbols), (*s).Sup.id);
			incl_221856((&(*c).ambiguoussymbols), (*check).Sup.id);
		}
		LA9: ;
	}
	LA5: ;
	strtableadd_232103((&(*(*c).importtable).symbols), s);
	{
		Ttype224847* 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_287157;
				NI HEX3Atmp_287213;
				NI LOC22;
				NI res_287216;
				j_287157 = 0;
				HEX3Atmp_287213 = 0;
				LOC22 = 0;
				LOC22 = sonslen_227387((*etyp).n);
				HEX3Atmp_287213 = (NI)(LOC22 - ((NI) 1));
				res_287216 = ((NI) 0);
				{
					while (1) {
						Tsym224841* e;
						Tidentiter232141 it;
						if (!(res_287216 <= HEX3Atmp_287213)) goto LA24;
						j_287157 = res_287216;
						e = (*(*(*etyp).n).kindU.S6.sons->data[j_287157]).kindU.S4.sym;
						{
							if (!!(((*e).kind == ((NU8) 20)))) goto LA27;
							internalerror_195172((*s).info, ((NimStringDesc*) &TMP3622));
						}
						LA27: ;
						memset((void*)(&it), 0, sizeof(it));
						check = initidentiter_232147((&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_232156((&it), (*(*c).importtable).symbols);
							} LA30: ;
						} LA29: ;
						{
							if (!!((e == NIM_NIL))) goto LA37;
							rawimportsymbol_287077(c, e);
						}
						LA37: ;
						res_287216 += ((NI) 1);
					} LA24: ;
				}
			}
		}
		LA19: ;
	}
	goto LA11;
	LA13: ;
	{
		{
			if (!((*s).kind == ((NU8) 16))) goto LA42;
			addconverter_279563(c, s);
		}
		LA42: ;
		{
			NIM_BOOL LOC46;
			LOC46 = 0;
			LOC46 = haspattern_229784(s);
			if (!LOC46) goto LA47;
			addpattern_279574(c, s);
		}
		LA47: ;
	}
	LA11: ;
}

N_NIMCALL(void, importallsymbolsexcept_287315)(Tcontext279023* c, Tsym224841* frommod, Intset221056* exceptset) {
	Ttabiter232119 i;
	Tsym224841* s;
	memset((void*)(&i), 0, sizeof(i));
	s = inittabiter_232124((&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, (&NTI224441))->Sup.len + 18);
appendString(LOC15, ((NimStringDesc*) &TMP3621));
appendString(LOC15, reprEnum((*s).kind, (&NTI224441)));
						internalerror_195172((*s).info, LOC15);
					}
					LA13: ;
					{
						NIM_BOOL LOC18;
						NIM_BOOL LOC20;
						LOC18 = 0;
						LOC18 = isnil_221946(exceptset);
						if (LOC18) goto LA19;
						LOC20 = 0;
						LOC20 = contains_221829(exceptset, (*(*s).name).Sup.id);
						LOC18 = !(LOC20);
						LA19: ;
						if (!LOC18) goto LA21;
						rawimportsymbol_287077(c, s);
					}
					LA21: ;
				}
				LA9: ;
			}
			LA5: ;
			s = nextiter_232132((&i), (*frommod).kindU.S3.tab);
		} LA2: ;
	}
}

N_NIMCALL(Tnode224809*, evalimport_287004)(Tcontext279023* c, Tnode224809* n) {
	Tnode224809* result;
	Intset221056 emptyset;
	result = 0;
	result = n;
	memset((void*)(&emptyset), 0, sizeof(emptyset));
	{
		NI i_287751;
		NI HEX3Atmp_287768;
		NI LOC2;
		NI res_287771;
		i_287751 = 0;
		HEX3Atmp_287768 = 0;
		LOC2 = 0;
		LOC2 = sonslen_227387(n);
		HEX3Atmp_287768 = (NI)(LOC2 - ((NI) 1));
		res_287771 = ((NI) 0);
		{
			while (1) {
				Tsym224841* m;
				if (!(res_287771 <= HEX3Atmp_287768)) goto LA4;
				i_287751 = res_287771;
				m = myimportmodule_287708(c, (*n).kindU.S6.sons->data[i_287751]);
				{
					if (!!((m == NIM_NIL))) goto LA7;
					adddecl_285607(c, m);
					importallsymbolsexcept_287315(c, m, (&emptyset));
				}
				LA7: ;
				res_287771 += ((NI) 1);
			} LA4: ;
		}
	}
	return result;
}

N_NIMCALL(Tnode224809*, evalimportexcept_287857)(Tcontext279023* c, Tnode224809* n) {
	Tnode224809* result;
	Tsym224841* m;
	result = 0;
	result = n;
	checkminsonslen_280270(n, ((NI) 2));
	m = myimportmodule_287708(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		Intset221056 exceptset;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_226325(m));
		adddecl_285607(c, m);
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		chckNil((void*)(&exceptset));
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		initintset_221927((&exceptset));
		{
			NI i_287890;
			NI HEX3Atmp_287895;
			NI LOC6;
			NI res_287898;
			i_287890 = 0;
			HEX3Atmp_287895 = 0;
			LOC6 = 0;
			LOC6 = sonslen_227387(n);
			HEX3Atmp_287895 = (NI)(LOC6 - ((NI) 1));
			res_287898 = ((NI) 1);
			{
				while (1) {
					Tident197021* ident;
					if (!(res_287898 <= HEX3Atmp_287895)) goto LA8;
					i_287890 = res_287898;
					ident = considerquotedident_285010((*n).kindU.S6.sons->data[i_287890]);
					incl_221856((&exceptset), (*ident).Sup.id);
					res_287898 += ((NI) 1);
				} LA8: ;
			}
		}
		importallsymbolsexcept_287315(c, m, (&exceptset));
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importsymbol_287241)(Tcontext279023* c, Tnode224809* n, Tsym224841* frommod) {
	Tident197021* ident;
	Tsym224841* s;
	ident = considerquotedident_285010(n);
	s = strtableget_232111((*frommod).kindU.S3.tab, ident);
	{
		if (!(s == NIM_NIL)) goto LA3;
		localerror_195128((*n).info, ((NU16) 63), (*ident).s);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((*s).kind == ((NU8) 23))) goto LA8;
			loadstub_270052(s);
		}
		LA8: ;
		{
			if (!!(((43513728 &(1<<(((*s).kind)&31)))!=0))) goto LA12;
			internalerror_195172((*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):
		{
			Tidentiter232141 it;
			Tsym224841* e;
			memset((void*)(&it), 0, sizeof(it));
			e = initidentiter_232147((&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_195172((*n).info, ((NimStringDesc*) &TMP3625));
					}
					LA19: ;
					rawimportsymbol_287077(c, e);
					e = nextidentiter_232156((&it), (*frommod).kindU.S3.tab);
				} LA16: ;
			}
		}
		break;
		default:
		{
			rawimportsymbol_287077(c, s);
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(Tnode224809*, evalfrom_287011)(Tcontext279023* c, Tnode224809* n) {
	Tnode224809* result;
	Tsym224841* m;
	result = 0;
	result = n;
	checkminsonslen_280270(n, ((NI) 2));
	m = myimportmodule_287708(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_226325(m));
		adddecl_285607(c, m);
		{
			NI i_287822;
			NI HEX3Atmp_287835;
			NI LOC6;
			NI res_287838;
			i_287822 = 0;
			HEX3Atmp_287835 = 0;
			LOC6 = 0;
			LOC6 = sonslen_227387(n);
			HEX3Atmp_287835 = (NI)(LOC6 - ((NI) 1));
			res_287838 = ((NI) 1);
			{
				while (1) {
					if (!(res_287838 <= HEX3Atmp_287835)) goto LA8;
					i_287822 = res_287838;
					{
						if (!!(((*(*n).kindU.S6.sons->data[i_287822]).kind == ((NU8) 23)))) goto LA11;
						importsymbol_287241(c, (*n).kindU.S6.sons->data[i_287822], m);
					}
					LA11: ;
					res_287838 += ((NI) 1);
				} LA8: ;
			}
		}
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importallsymbols_287389)(Tcontext279023* c, Tsym224841* frommod) {
	Intset221056 exceptset;
	memset((void*)(&exceptset), 0, sizeof(exceptset));
	importallsymbolsexcept_287315(c, frommod, (&exceptset));
}
NIM_EXTERNC N_NOINLINE(void, compiler_importerInit000)(void) {
}

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

