/* Generated by Nim Compiler v0.12.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 Tnode225809 Tnode225809;
typedef struct Tcontext280023 Tcontext280023;
typedef struct Intset222056 Intset222056;
typedef struct Trunk222052 Trunk222052;
typedef struct Trunkseq222054 Trunkseq222054;
typedef struct Tsym225841 Tsym225841;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Ttype225847 Ttype225847;
typedef struct Tlineinfo190352 Tlineinfo190352;
typedef struct Tident198021 Tident198021;
typedef struct Tnodeseq225803 Tnodeseq225803;
typedef struct Tidobj198015 Tidobj198015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq225843 Ttypeseq225843;
typedef struct Tscope225835 Tscope225835;
typedef struct TY225944 TY225944;
typedef struct Tstrtable225813 Tstrtable225813;
typedef struct Tsymseq225811 Tsymseq225811;
typedef struct Tloc225823 Tloc225823;
typedef struct Ropeobj176009 Ropeobj176009;
typedef struct Tlib225827 Tlib225827;
typedef struct Cell48946 Cell48946;
typedef struct Cellseq48962 Cellseq48962;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48958 Cellset48958;
typedef struct Pagedesc48954 Pagedesc48954;
typedef struct Memregion30890 Memregion30890;
typedef struct Smallchunk30842 Smallchunk30842;
typedef struct Llchunk30884 Llchunk30884;
typedef struct Bigchunk30844 Bigchunk30844;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30888 Avlnode30888;
typedef struct Gcstat51014 Gcstat51014;
typedef struct Tpasscontext277005 Tpasscontext277005;
typedef struct Tproccon280011 Tproccon280011;
typedef struct Tlinkedlist140028 Tlinkedlist140028;
typedef struct Tlistentry140022 Tlistentry140022;
typedef struct Tidtable225859 Tidtable225859;
typedef struct Tidpairseq225857 Tidpairseq225857;
typedef struct Tctx279048 Tctx279048;
typedef struct TY280143 TY280143;
typedef struct Ttabiter233119 Ttabiter233119;
typedef struct Tidentiter233141 Tidentiter233141;
typedef struct Tinstantiation225831 Tinstantiation225831;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef struct Tidpair225855 Tidpair225855;
typedef struct TY279254 TY279254;
typedef struct TY191420 TY191420;
typedef struct PprocHEX3Aobjecttype279233 PprocHEX3Aobjecttype279233;
typedef struct TY279273 TY279273;
typedef struct Tinstantiationpair280013 Tinstantiationpair280013;
typedef struct TY225932 TY225932;
typedef struct TY279234 TY279234;
typedef struct TY279239 TY279239;
typedef struct TY279274 TY279274;
typedef struct Vmargs279042 Vmargs279042;
typedef struct Tblock279030 Tblock279030;
typedef struct TY279214 TY279214;
struct  Intset222056  {
NI counter;
NI max;
Trunk222052* head;
Trunkseq222054* data;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tlineinfo190352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tnode225809  {
Ttype225847* typ;
Tlineinfo190352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym225841* sym;
} S4;
struct {Tident198021* ident;
} S5;
struct {Tnodeseq225803* 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  Tidobj198015  {
  TNimObject Sup;
NI id;
};
struct  Tident198021  {
  Tidobj198015 Sup;
NimStringDesc* s;
Tident198021* next;
NI h;
};
struct  Tstrtable225813  {
NI counter;
Tsymseq225811* data;
};
struct  Tloc225823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype225847* t;
Ropeobj176009* r;
Ropeobj176009* heaproot;
};
struct  Tsym225841  {
  Tidobj198015 Sup;
NU8 kind;
union{
struct {Ttypeseq225843* typeinstcache;
Tscope225835* typscope;
} S1;
struct {TY225944* procinstcache;
Tsym225841* gcunsafetyreason;
} S2;
struct {TY225944* usedgenerics;
Tstrtable225813 tab;
} S3;
struct {Tsym225841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype225847* typ;
Tident198021* name;
Tlineinfo190352 info;
Tsym225841* owner;
NU32 flags;
Tnode225809* ast;
NU32 options;
NI position;
NI offset;
Tloc225823 loc;
Tlib225827* annex;
Tnode225809* constraint;
};
struct  Cell48946  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48962  {
NI len;
NI cap;
Cell48946** d;
};
struct  Cellset48958  {
NI counter;
NI max;
Pagedesc48954* head;
Pagedesc48954** data;
};
typedef Smallchunk30842* TY30905[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30890  {
NI minlargeobj;
NI maxlargeobj;
TY30905 freesmallchunks;
Llchunk30884* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30844* freechunkslist;
Intset30817 chunkstarts;
Avlnode30888* root;
Avlnode30888* deleted;
Avlnode30888* last;
Avlnode30888* 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;
Cellseq48962 zct;
Cellseq48962 decstack;
Cellset48958 cycleroots;
Cellseq48962 tempstack;
NI recgclock;
Memregion30890 region;
Gcstat51014 stat;
};
typedef N_NIMCALL_PTR(Tsym225841*, TY277064) (Tsym225841* m, NI32 fileidx);
struct  Tpasscontext277005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Tlinkedlist140028  {
Tlistentry140022* head;
Tlistentry140022* tail;
NI counter;
};
struct  Tidtable225859  {
NI counter;
Tidpairseq225857* data;
};
typedef N_NIMCALL_PTR(Tnode225809*, TY280074) (Tcontext280023* c, Tnode225809* n);
typedef N_NIMCALL_PTR(Tnode225809*, TY280079) (Tcontext280023* c, Tnode225809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode225809*, TY280087) (Tcontext280023* c, Tnode225809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode225809*, TY280095) (Tcontext280023* c, Tnode225809* n);
typedef N_NIMCALL_PTR(Tnode225809*, TY280100) (Tcontext280023* c, Tnode225809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode225809*, TY280108) (Tcontext280023* c, Tnode225809* n);
typedef N_NIMCALL_PTR(Tnode225809*, TY280113) (Tcontext280023* c, Tnode225809* n, Tnode225809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype225847*, TY280120) (Tcontext280023* c, Tnode225809* n, Ttype225847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode225809*, ClPrc) (Tcontext280023* c, Tidtable225859 pt, Tnode225809* n, void* ClEnv);
void* ClEnv;
} TY280126;
typedef struct {
N_NIMCALL_PTR(Tsym225841*, ClPrc) (Tcontext280023* c, Tsym225841* fn, Tidtable225859 pt, Tlineinfo190352 info, void* ClEnv);
void* ClEnv;
} TY280132;
typedef N_NIMCALL_PTR(Tsym225841*, TY280148) (Tcontext280023* c, Tsym225841* dc, Ttype225847* t, Tlineinfo190352 info, NU8 op);
struct  Tcontext280023  {
  Tpasscontext277005 Sup;
Tsym225841* module;
Tscope225835* currentscope;
Tscope225835* importtable;
Tscope225835* toplevelscope;
Tproccon280011* p;
Tsymseq225811* friendmodules;
NI instcounter;
Intset222056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq225811* converters;
Tsymseq225811* patterns;
Tlinkedlist140028 optionstack;
Tidtable225859 symmapping;
Tlinkedlist140028 libs;
TY280074 semconstexpr;
TY280079 semexpr;
TY280087 semtryexpr;
TY280095 semtryconstexpr;
TY280100 semoperand;
TY280108 semconstboolexpr;
TY280113 semoverloadedcall;
TY280120 semtypenode;
TY280126 seminferredlambda;
TY280132 semgenerateinstance;
Intset222056 includedfiles;
Tstrtable225813 userpragmas;
Tctx279048* evalcontext;
Intset222056 unknownidents;
TY280143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY280148 insttypeboundop;
};
struct  Ttabiter233119  {
NI h;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tscope225835  {
NI depthlevel;
Tstrtable225813 symbols;
Tnodeseq225803* usingsyms;
Tscope225835* parent;
};
struct  Ttype225847  {
  Tidobj198015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq225843* sons;
Tnode225809* n;
Tsym225841* owner;
Tsym225841* sym;
Tsym225841* destructor;
Tsym225841* deepcopy;
Tsym225841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc225823 loc;
};
struct  Tidentiter233141  {
NI h;
Tident198021* name;
};
typedef NI TY30821[16];
struct  Trunk222052  {
Trunk222052* next;
NI key;
TY30821 bits;
};
struct  Ropeobj176009  {
  TNimObject Sup;
Ropeobj176009* left;
Ropeobj176009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry140022  {
  TNimObject Sup;
Tlistentry140022* prev;
Tlistentry140022* next;
};
struct  Tlib225827  {
  Tlistentry140022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj176009* name;
Tnode225809* path;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
struct  Pagedesc48954  {
Pagedesc48954* next;
NI key;
TY30821 bits;
};
struct  Basechunk30840  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30842  {
  Basechunk30840 Sup;
Smallchunk30842* next;
Smallchunk30842* prev;
Freecell30832* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30884  {
NI size;
NI acc;
Llchunk30884* next;
};
struct  Bigchunk30844  {
  Basechunk30840 Sup;
Bigchunk30844* next;
Bigchunk30844* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30821 bits;
};
typedef Avlnode30888* TY30895[2];
struct  Avlnode30888  {
TY30895 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon280011  {
Tsym225841* owner;
Tsym225841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon280011* next;
NIM_BOOL wasforwarded;
Tnode225809* bracketexpr;
};
struct  Tidpair225855  {
Tidobj198015* key;
TNimObject* val;
};
struct  Tctx279048  {
  Tpasscontext277005 Sup;
TY279254* code;
TY191420* debug;
Tnode225809* globals;
Tnode225809* constants;
Ttypeseq225843* types;
Tnode225809* currentexceptiona;
Tnode225809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype279233* prc;
Tsym225841* module;
Tnode225809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo190352 comesfromheuristic;
TY279273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair280013  {
Tsym225841* genericsym;
Tinstantiation225831* inst;
};
struct  Tinstantiation225831  {
Tsym225841* sym;
Ttypeseq225843* concretetypes;
TY225932* usedby;
NI compilesid;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct TY279239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY279239 TY279242[256];
struct  PprocHEX3Aobjecttype279233  {
TY279234* blocks;
Tsym225841* sym;
TY279242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs279042* args, void* ClEnv);
void* ClEnv;
} Vmcallback279044;
struct TY279274 {
NimStringDesc* Field0;
Vmcallback279044 Field1;
};
struct  Tblock279030  {
Tsym225841* label;
TY279214* fixups;
};
struct  Vmargs279042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode225809* currentexception;
};
struct Tnodeseq225803 {
  TGenericSeq Sup;
  Tnode225809* data[SEQ_DECL_SIZE];
};
struct Trunkseq222054 {
  TGenericSeq Sup;
  Trunk222052* data[SEQ_DECL_SIZE];
};
struct Ttypeseq225843 {
  TGenericSeq Sup;
  Ttype225847* data[SEQ_DECL_SIZE];
};
struct TY225944 {
  TGenericSeq Sup;
  Tinstantiation225831* data[SEQ_DECL_SIZE];
};
struct Tsymseq225811 {
  TGenericSeq Sup;
  Tsym225841* data[SEQ_DECL_SIZE];
};
struct Tidpairseq225857 {
  TGenericSeq Sup;
  Tidpair225855 data[SEQ_DECL_SIZE];
};
struct TY280143 {
  TGenericSeq Sup;
  Tinstantiationpair280013 data[SEQ_DECL_SIZE];
};
struct TY279254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY191420 {
  TGenericSeq Sup;
  Tlineinfo190352 data[SEQ_DECL_SIZE];
};
struct TY279273 {
  TGenericSeq Sup;
  TY279274 data[SEQ_DECL_SIZE];
};
struct TY225932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY279234 {
  TGenericSeq Sup;
  Tblock279030 data[SEQ_DECL_SIZE];
};
struct TY279214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_228387)(Tnode225809* n);
N_NIMCALL(Tsym225841*, myimportmodule_288708)(Tcontext280023* c, Tnode225809* n);
N_NIMCALL(NI32, checkmodulename_288064)(Tnode225809* n);
N_NIMCALL(NimStringDesc*, getmodulename_288018)(Tnode225809* n);
N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(Tident198021*, getident_198463)(NimStringDesc* identifier);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell48946*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48946* c);
N_NOINLINE(void, addzct_52617)(Cellseq48962* s, Cell48946* 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_247059)(Tnode225809* n, NU8 renderflags);
N_NIMCALL(void, localerror_196128)(Tlineinfo190352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, findmodule_168549)(NimStringDesc* modulename, NimStringDesc* currentmodule);
N_NIMCALL(NimStringDesc*, tofullpath_191665)(NI32 fileidx);
N_NIMCALL(NI32, fileinfoidx_191254)(NimStringDesc* filename);
N_NIMCALL(Tsym225841*, importmoduleas_288671)(Tnode225809* n, Tsym225841* realmodule);
static N_INLINE(NI, len_226098)(Tnode225809* n);
N_NIMCALL(Tsym225841*, createmodulealias_228844)(Tsym225841* s, Tident198021* newident, Tlineinfo190352 info);
N_NIMCALL(void, message_196161)(Tlineinfo190352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, adddecl_286607)(Tcontext280023* c, Tsym225841* sym);
N_NIMCALL(void, importallsymbolsexcept_288315)(Tcontext280023* c, Tsym225841* frommod, Intset222056 exceptset);
N_NIMCALL(Tsym225841*, inittabiter_233124)(Ttabiter233119* ti, Tstrtable225813 tab);
N_NIMCALL(void, internalerror_196172)(Tlineinfo190352 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_222946)(Intset222056 x);
N_NIMCALL(NIM_BOOL, contains_222829)(Intset222056 s, NI key);
N_NIMCALL(void, rawimportsymbol_288077)(Tcontext280023* c, Tsym225841* s);
N_NIMCALL(Tsym225841*, strtableget_233111)(Tstrtable225813 t, Tident198021* name);
N_NIMCALL(void, incl_222856)(Intset222056* s, NI key);
N_NIMCALL(void, strtableadd_233103)(Tstrtable225813* t, Tsym225841* n);
N_NIMCALL(Tsym225841*, initidentiter_233147)(Tidentiter233141* ti, Tstrtable225813 tab, Tident198021* s);
N_NIMCALL(Tsym225841*, nextidentiter_233156)(Tidentiter233141* ti, Tstrtable225813 tab);
N_NIMCALL(void, addconverter_280564)(Tcontext280023* c, Tsym225841* conv);
static N_INLINE(NIM_BOOL, haspattern_230783)(Tsym225841* s);
static N_INLINE(NIM_BOOL, isroutine_230763)(Tsym225841* s);
N_NIMCALL(void, addpattern_280575)(Tcontext280023* c, Tsym225841* p);
N_NIMCALL(Tsym225841*, nextiter_233132)(Ttabiter233119* ti, Tstrtable225813 tab);
N_NIMCALL(void, checkminsonslen_281270)(Tnode225809* n, NI length);
N_NIMCALL(Tnode225809*, newsymnode_227325)(Tsym225841* sym);
N_NIMCALL(void, initintset_222927)(Intset222056* Result);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(Tident198021*, considerquotedident_286010)(Tnode225809* n);
N_NIMCALL(void, importsymbol_288241)(Tcontext280023* c, Tnode225809* n, Tsym225841* frommod);
N_NIMCALL(void, loadstub_271053)(Tsym225841* s);
STRING_LITERAL(TMP3615, "", 0);
STRING_LITERAL(TMP3616, "as", 2);
STRING_LITERAL(TMP3617, " ", 1);
STRING_LITERAL(TMP3618, ".", 1);
STRING_LITERAL(TMP3619, "/", 1);
STRING_LITERAL(TMP3620, "invalid module name: \'$1\'", 25);
STRING_LITERAL(TMP3621, "module alias must be an identifier", 34);
STRING_LITERAL(TMP3622, "A module cannot import itself", 29);
STRING_LITERAL(TMP3623, "importAllSymbols: ", 18);
STRING_LITERAL(TMP3624, "rawImportSymbol", 15);
STRING_LITERAL(TMP3626, "importSymbol: 2", 15);
STRING_LITERAL(TMP3627, "importSymbol: 3", 15);
extern Gcheap51018 gch_51059;
extern TY277064 gimportmodule_277068;
extern TNimType NTI225441; /* TSymKind */

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

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

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

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

N_NIMCALL(NI32, checkmodulename_288064)(Tnode225809* n) {
	NI32 result;
	NimStringDesc* modulename;
	NimStringDesc* fullpath;
	NimStringDesc* LOC1;
	result = 0;
	modulename = getmodulename_288018(n);
	LOC1 = 0;
	LOC1 = tofullpath_191665((*n).info.fileindex);
	fullpath = findmodule_168549(modulename, LOC1);
	{
		if (!((fullpath ? fullpath->Sup.len : 0) == ((NI) 0))) goto LA4;
		localerror_196128((*n).info, ((NU16) 3), modulename);
		result = ((NI32) -1);
	}
	goto LA2;
	LA4: ;
	{
		result = fileinfoidx_191254(fullpath);
	}
	LA2: ;
	return result;
}

static N_INLINE(NI, len_226098)(Tnode225809* 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(Tsym225841*, importmoduleas_288671)(Tnode225809* n, Tsym225841* realmodule) {
	Tsym225841* 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_226098(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_196128((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3621));
	}
	goto LA1;
	LA9: ;
	{
		if (!!(((*(*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident).Sup.id == (*(*realmodule).name).Sup.id))) goto LA12;
		result = createmodulealias_228844(realmodule, (*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident, (*realmodule).info);
	}
	goto LA1;
	LA12: ;
	LA1: ;
	return result;
}

N_NIMCALL(Tsym225841*, myimportmodule_288708)(Tcontext280023* c, Tnode225809* n) {
	Tsym225841* result;
	NI32 f;
	result = 0;
	f = checkmodulename_288064(n);
	{
		Tsym225841* LOC5;
		if (!!((f == ((NI32) -1)))) goto LA3;
		LOC5 = 0;
		LOC5 = gimportmodule_277068((*c).module, f);
		result = importmoduleas_288671(n, LOC5);
		{
			if (!((*result).info.fileindex == (*n).info.fileindex)) goto LA8;
			localerror_196128((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3622));
		}
		LA8: ;
		{
			if (!(((*result).flags &(1<<((((NU8) 19))&31)))!=0)) goto LA12;
			message_196161((*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_222946)(Intset222056 x) {
	NIM_BOOL result;
	result = 0;
	result = x.head == 0;
	return result;
}

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

static N_INLINE(NIM_BOOL, haspattern_230783)(Tsym225841* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = isroutine_230763(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_288077)(Tcontext280023* c, Tsym225841* s) {
	Tsym225841* check;
	check = strtableget_233111((*(*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_222856((&(*c).ambiguoussymbols), (*s).Sup.id);
			incl_222856((&(*c).ambiguoussymbols), (*check).Sup.id);
		}
		LA9: ;
	}
	LA5: ;
	strtableadd_233103((&(*(*c).importtable).symbols), s);
	{
		Ttype225847* 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 &(1<<((((NU8) 9))&31)))!=0));
			LA18: ;
			if (!LOC17) goto LA19;
			{
				NI j_288157;
				NI HEX3Atmp_288213;
				NI LOC22;
				NI res_288216;
				j_288157 = 0;
				HEX3Atmp_288213 = 0;
				LOC22 = 0;
				LOC22 = sonslen_228387((*etyp).n);
				HEX3Atmp_288213 = (NI)(LOC22 - ((NI) 1));
				res_288216 = ((NI) 0);
				{
					while (1) {
						Tsym225841* e;
						Tidentiter233141 it;
						if (!(res_288216 <= HEX3Atmp_288213)) goto LA24;
						j_288157 = res_288216;
						e = (*(*(*etyp).n).kindU.S6.sons->data[j_288157]).kindU.S4.sym;
						{
							if (!!(((*e).kind == ((NU8) 20)))) goto LA27;
							internalerror_196172((*s).info, ((NimStringDesc*) &TMP3624));
						}
						LA27: ;
						memset((void*)(&it), 0, sizeof(it));
						check = initidentiter_233147((&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_233156((&it), (*(*c).importtable).symbols);
							} LA30: ;
						} LA29: ;
						{
							if (!!((e == NIM_NIL))) goto LA37;
							rawimportsymbol_288077(c, e);
						}
						LA37: ;
						res_288216 += ((NI) 1);
					} LA24: ;
				}
			}
		}
		LA19: ;
	}
	goto LA11;
	LA13: ;
	{
		{
			if (!((*s).kind == ((NU8) 16))) goto LA42;
			addconverter_280564(c, s);
		}
		LA42: ;
		{
			NIM_BOOL LOC46;
			LOC46 = 0;
			LOC46 = haspattern_230783(s);
			if (!LOC46) goto LA47;
			addpattern_280575(c, s);
		}
		LA47: ;
	}
	LA11: ;
}

N_NIMCALL(void, importallsymbolsexcept_288315)(Tcontext280023* c, Tsym225841* frommod, Intset222056 exceptset) {
	Ttabiter233119 i;
	Tsym225841* s;
	memset((void*)(&i), 0, sizeof(i));
	s = inittabiter_233124((&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, (&NTI225441))->Sup.len + 18);
appendString(LOC15, ((NimStringDesc*) &TMP3623));
appendString(LOC15, reprEnum((*s).kind, (&NTI225441)));
						internalerror_196172((*s).info, LOC15);
					}
					LA13: ;
					{
						NIM_BOOL LOC18;
						NIM_BOOL LOC20;
						LOC18 = 0;
						LOC18 = isnil_222946(exceptset);
						if (LOC18) goto LA19;
						LOC20 = 0;
						LOC20 = contains_222829(exceptset, (*(*s).name).Sup.id);
						LOC18 = !(LOC20);
						LA19: ;
						if (!LOC18) goto LA21;
						rawimportsymbol_288077(c, s);
					}
					LA21: ;
				}
				LA9: ;
			}
			LA5: ;
			s = nextiter_233132((&i), (*frommod).kindU.S3.tab);
		} LA2: ;
	}
}

N_NIMCALL(Tnode225809*, evalimport_288004)(Tcontext280023* c, Tnode225809* n) {
	Tnode225809* result;
	Intset222056 emptyset;
	result = 0;
	result = n;
	memset((void*)(&emptyset), 0, sizeof(emptyset));
	{
		NI i_288751;
		NI HEX3Atmp_288768;
		NI LOC2;
		NI res_288771;
		i_288751 = 0;
		HEX3Atmp_288768 = 0;
		LOC2 = 0;
		LOC2 = sonslen_228387(n);
		HEX3Atmp_288768 = (NI)(LOC2 - ((NI) 1));
		res_288771 = ((NI) 0);
		{
			while (1) {
				Tsym225841* m;
				if (!(res_288771 <= HEX3Atmp_288768)) goto LA4;
				i_288751 = res_288771;
				m = myimportmodule_288708(c, (*n).kindU.S6.sons->data[i_288751]);
				{
					if (!!((m == NIM_NIL))) goto LA7;
					adddecl_286607(c, m);
					importallsymbolsexcept_288315(c, m, emptyset);
				}
				LA7: ;
				res_288771 += ((NI) 1);
			} LA4: ;
		}
	}
	return result;
}

N_NIMCALL(Tnode225809*, evalimportexcept_288857)(Tcontext280023* c, Tnode225809* n) {
	Tnode225809* result;
	Tsym225841* m;
	result = 0;
	result = n;
	checkminsonslen_281270(n, ((NI) 2));
	m = myimportmodule_288708(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		Intset222056 exceptset;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_227325(m));
		adddecl_286607(c, m);
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		chckNil((void*)(&exceptset));
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		initintset_222927((&exceptset));
		{
			NI i_288890;
			NI HEX3Atmp_288895;
			NI LOC6;
			NI res_288898;
			i_288890 = 0;
			HEX3Atmp_288895 = 0;
			LOC6 = 0;
			LOC6 = sonslen_228387(n);
			HEX3Atmp_288895 = (NI)(LOC6 - ((NI) 1));
			res_288898 = ((NI) 1);
			{
				while (1) {
					Tident198021* ident;
					if (!(res_288898 <= HEX3Atmp_288895)) goto LA8;
					i_288890 = res_288898;
					ident = considerquotedident_286010((*n).kindU.S6.sons->data[i_288890]);
					incl_222856((&exceptset), (*ident).Sup.id);
					res_288898 += ((NI) 1);
				} LA8: ;
			}
		}
		importallsymbolsexcept_288315(c, m, exceptset);
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importsymbol_288241)(Tcontext280023* c, Tnode225809* n, Tsym225841* frommod) {
	Tident198021* ident;
	Tsym225841* s;
	ident = considerquotedident_286010(n);
	s = strtableget_233111((*frommod).kindU.S3.tab, ident);
	{
		if (!(s == NIM_NIL)) goto LA3;
		localerror_196128((*n).info, ((NU16) 63), (*ident).s);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((*s).kind == ((NU8) 23))) goto LA8;
			loadstub_271053(s);
		}
		LA8: ;
		{
			if (!!(((43513728 &(1<<(((*s).kind)&31)))!=0))) goto LA12;
			internalerror_196172((*n).info, ((NimStringDesc*) &TMP3626));
		}
		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):
		{
			Tidentiter233141 it;
			Tsym225841* e;
			memset((void*)(&it), 0, sizeof(it));
			e = initidentiter_233147((&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_196172((*n).info, ((NimStringDesc*) &TMP3627));
					}
					LA19: ;
					rawimportsymbol_288077(c, e);
					e = nextidentiter_233156((&it), (*frommod).kindU.S3.tab);
				} LA16: ;
			}
		}
		break;
		default:
		{
			rawimportsymbol_288077(c, s);
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(Tnode225809*, evalfrom_288011)(Tcontext280023* c, Tnode225809* n) {
	Tnode225809* result;
	Tsym225841* m;
	result = 0;
	result = n;
	checkminsonslen_281270(n, ((NI) 2));
	m = myimportmodule_288708(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_227325(m));
		adddecl_286607(c, m);
		{
			NI i_288822;
			NI HEX3Atmp_288835;
			NI LOC6;
			NI res_288838;
			i_288822 = 0;
			HEX3Atmp_288835 = 0;
			LOC6 = 0;
			LOC6 = sonslen_228387(n);
			HEX3Atmp_288835 = (NI)(LOC6 - ((NI) 1));
			res_288838 = ((NI) 1);
			{
				while (1) {
					if (!(res_288838 <= HEX3Atmp_288835)) goto LA8;
					i_288822 = res_288838;
					{
						if (!!(((*(*n).kindU.S6.sons->data[i_288822]).kind == ((NU8) 23)))) goto LA11;
						importsymbol_288241(c, (*n).kindU.S6.sons->data[i_288822], m);
					}
					LA11: ;
					res_288838 += ((NI) 1);
				} LA8: ;
			}
		}
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importallsymbols_288389)(Tcontext280023* c, Tsym225841* frommod) {
	Intset222056 exceptset;
	memset((void*)(&exceptset), 0, sizeof(exceptset));
	importallsymbolsexcept_288315(c, frommod, exceptset);
}
NIM_EXTERNC N_NOINLINE(void, compiler_importerInit000)(void) {
}

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

