/* 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 Tnode227809 Tnode227809;
typedef struct Tcontext282023 Tcontext282023;
typedef struct Intset224056 Intset224056;
typedef struct Trunk224052 Trunk224052;
typedef struct Trunkseq224054 Trunkseq224054;
typedef struct Tsym227841 Tsym227841;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Ttype227847 Ttype227847;
typedef struct Tlineinfo192352 Tlineinfo192352;
typedef struct Tident200021 Tident200021;
typedef struct Tnodeseq227803 Tnodeseq227803;
typedef struct Tidobj200015 Tidobj200015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq227843 Ttypeseq227843;
typedef struct Tscope227835 Tscope227835;
typedef struct TY227944 TY227944;
typedef struct Tstrtable227813 Tstrtable227813;
typedef struct Tsymseq227811 Tsymseq227811;
typedef struct Tloc227823 Tloc227823;
typedef struct Ropeobj178009 Ropeobj178009;
typedef struct Tlib227827 Tlib227827;
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 Tpasscontext279005 Tpasscontext279005;
typedef struct Tproccon282011 Tproccon282011;
typedef struct Tlinkedlist143028 Tlinkedlist143028;
typedef struct Tlistentry143022 Tlistentry143022;
typedef struct Tidtable227859 Tidtable227859;
typedef struct Tidpairseq227857 Tidpairseq227857;
typedef struct Tctx281048 Tctx281048;
typedef struct TY282143 TY282143;
typedef struct Ttabiter235119 Ttabiter235119;
typedef struct Tidentiter235141 Tidentiter235141;
typedef struct Tinstantiation227831 Tinstantiation227831;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef struct Tidpair227855 Tidpair227855;
typedef struct TY281254 TY281254;
typedef struct TY193420 TY193420;
typedef struct PprocHEX3Aobjecttype281233 PprocHEX3Aobjecttype281233;
typedef struct TY281273 TY281273;
typedef struct Tinstantiationpair282013 Tinstantiationpair282013;
typedef struct TY227932 TY227932;
typedef struct TY281234 TY281234;
typedef struct TY281239 TY281239;
typedef struct TY281274 TY281274;
typedef struct Vmargs281042 Vmargs281042;
typedef struct Tblock281030 Tblock281030;
typedef struct TY281214 TY281214;
struct  Intset224056  {
NI counter;
NI max;
Trunk224052* head;
Trunkseq224054* data;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tlineinfo192352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tnode227809  {
Ttype227847* typ;
Tlineinfo192352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym227841* sym;
} S4;
struct {Tident200021* ident;
} S5;
struct {Tnodeseq227803* 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  Tidobj200015  {
  TNimObject Sup;
NI id;
};
struct  Tident200021  {
  Tidobj200015 Sup;
NimStringDesc* s;
Tident200021* next;
NI h;
};
struct  Tstrtable227813  {
NI counter;
Tsymseq227811* data;
};
struct  Tloc227823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype227847* t;
Ropeobj178009* r;
Ropeobj178009* heaproot;
};
struct  Tsym227841  {
  Tidobj200015 Sup;
NU8 kind;
union{
struct {Ttypeseq227843* typeinstcache;
Tscope227835* typscope;
} S1;
struct {TY227944* procinstcache;
Tsym227841* gcunsafetyreason;
} S2;
struct {TY227944* usedgenerics;
Tstrtable227813 tab;
} S3;
struct {Tsym227841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype227847* typ;
Tident200021* name;
Tlineinfo192352 info;
Tsym227841* owner;
NU32 flags;
Tnode227809* ast;
NU32 options;
NI position;
NI offset;
Tloc227823 loc;
Tlib227827* annex;
Tnode227809* 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(Tsym227841*, TY279064) (Tsym227841* m, NI32 fileidx);
struct  Tpasscontext279005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Tlinkedlist143028  {
Tlistentry143022* head;
Tlistentry143022* tail;
NI counter;
};
struct  Tidtable227859  {
NI counter;
Tidpairseq227857* data;
};
typedef N_NIMCALL_PTR(Tnode227809*, TY282074) (Tcontext282023* c, Tnode227809* n);
typedef N_NIMCALL_PTR(Tnode227809*, TY282079) (Tcontext282023* c, Tnode227809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode227809*, TY282087) (Tcontext282023* c, Tnode227809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode227809*, TY282095) (Tcontext282023* c, Tnode227809* n);
typedef N_NIMCALL_PTR(Tnode227809*, TY282100) (Tcontext282023* c, Tnode227809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode227809*, TY282108) (Tcontext282023* c, Tnode227809* n);
typedef N_NIMCALL_PTR(Tnode227809*, TY282113) (Tcontext282023* c, Tnode227809* n, Tnode227809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype227847*, TY282120) (Tcontext282023* c, Tnode227809* n, Ttype227847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode227809*, ClPrc) (Tcontext282023* c, Tidtable227859 pt, Tnode227809* n, void* ClEnv);
void* ClEnv;
} TY282126;
typedef struct {
N_NIMCALL_PTR(Tsym227841*, ClPrc) (Tcontext282023* c, Tsym227841* fn, Tidtable227859 pt, Tlineinfo192352 info, void* ClEnv);
void* ClEnv;
} TY282132;
typedef N_NIMCALL_PTR(Tsym227841*, TY282148) (Tcontext282023* c, Tsym227841* dc, Ttype227847* t, Tlineinfo192352 info, NU8 op);
struct  Tcontext282023  {
  Tpasscontext279005 Sup;
Tsym227841* module;
Tscope227835* currentscope;
Tscope227835* importtable;
Tscope227835* toplevelscope;
Tproccon282011* p;
Tsymseq227811* friendmodules;
NI instcounter;
Intset224056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq227811* converters;
Tsymseq227811* patterns;
Tlinkedlist143028 optionstack;
Tidtable227859 symmapping;
Tlinkedlist143028 libs;
TY282074 semconstexpr;
TY282079 semexpr;
TY282087 semtryexpr;
TY282095 semtryconstexpr;
TY282100 semoperand;
TY282108 semconstboolexpr;
TY282113 semoverloadedcall;
TY282120 semtypenode;
TY282126 seminferredlambda;
TY282132 semgenerateinstance;
Intset224056 includedfiles;
Tstrtable227813 userpragmas;
Tctx281048* evalcontext;
Intset224056 unknownidents;
TY282143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY282148 insttypeboundop;
};
struct  Ttabiter235119  {
NI h;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tscope227835  {
NI depthlevel;
Tstrtable227813 symbols;
Tnodeseq227803* usingsyms;
Tscope227835* parent;
};
struct  Ttype227847  {
  Tidobj200015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq227843* sons;
Tnode227809* n;
Tsym227841* owner;
Tsym227841* sym;
Tsym227841* destructor;
Tsym227841* deepcopy;
Tsym227841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc227823 loc;
};
struct  Tidentiter235141  {
NI h;
Tident200021* name;
};
typedef NI TY30821[16];
struct  Trunk224052  {
Trunk224052* next;
NI key;
TY30821 bits;
};
struct  Ropeobj178009  {
  TNimObject Sup;
Ropeobj178009* left;
Ropeobj178009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry143022  {
  TNimObject Sup;
Tlistentry143022* prev;
Tlistentry143022* next;
};
struct  Tlib227827  {
  Tlistentry143022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj178009* name;
Tnode227809* 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  Tproccon282011  {
Tsym227841* owner;
Tsym227841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon282011* next;
NIM_BOOL wasforwarded;
Tnode227809* bracketexpr;
};
struct  Tidpair227855  {
Tidobj200015* key;
TNimObject* val;
};
struct  Tctx281048  {
  Tpasscontext279005 Sup;
TY281254* code;
TY193420* debug;
Tnode227809* globals;
Tnode227809* constants;
Ttypeseq227843* types;
Tnode227809* currentexceptiona;
Tnode227809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype281233* prc;
Tsym227841* module;
Tnode227809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo192352 comesfromheuristic;
TY281273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair282013  {
Tsym227841* genericsym;
Tinstantiation227831* inst;
};
struct  Tinstantiation227831  {
Tsym227841* sym;
Ttypeseq227843* concretetypes;
TY227932* usedby;
NI compilesid;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct TY281239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY281239 TY281242[256];
struct  PprocHEX3Aobjecttype281233  {
TY281234* blocks;
Tsym227841* sym;
TY281242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs281042* args, void* ClEnv);
void* ClEnv;
} Vmcallback281044;
struct TY281274 {
NimStringDesc* Field0;
Vmcallback281044 Field1;
};
struct  Tblock281030  {
Tsym227841* label;
TY281214* fixups;
};
struct  Vmargs281042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode227809* currentexception;
};
struct Tnodeseq227803 {
  TGenericSeq Sup;
  Tnode227809* data[SEQ_DECL_SIZE];
};
struct Trunkseq224054 {
  TGenericSeq Sup;
  Trunk224052* data[SEQ_DECL_SIZE];
};
struct Ttypeseq227843 {
  TGenericSeq Sup;
  Ttype227847* data[SEQ_DECL_SIZE];
};
struct TY227944 {
  TGenericSeq Sup;
  Tinstantiation227831* data[SEQ_DECL_SIZE];
};
struct Tsymseq227811 {
  TGenericSeq Sup;
  Tsym227841* data[SEQ_DECL_SIZE];
};
struct Tidpairseq227857 {
  TGenericSeq Sup;
  Tidpair227855 data[SEQ_DECL_SIZE];
};
struct TY282143 {
  TGenericSeq Sup;
  Tinstantiationpair282013 data[SEQ_DECL_SIZE];
};
struct TY281254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY193420 {
  TGenericSeq Sup;
  Tlineinfo192352 data[SEQ_DECL_SIZE];
};
struct TY281273 {
  TGenericSeq Sup;
  TY281274 data[SEQ_DECL_SIZE];
};
struct TY227932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY281234 {
  TGenericSeq Sup;
  Tblock281030 data[SEQ_DECL_SIZE];
};
struct TY281214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_230387)(Tnode227809* n);
N_NIMCALL(Tsym227841*, myimportmodule_290708)(Tcontext282023* c, Tnode227809* n);
N_NIMCALL(NI32, checkmodulename_290064)(Tnode227809* n);
N_NIMCALL(NimStringDesc*, getmodulename_290018)(Tnode227809* n);
N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(Tident200021*, getident_200463)(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_249059)(Tnode227809* n, NU8 renderflags);
N_NIMCALL(void, localerror_198128)(Tlineinfo192352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, findmodule_170549)(NimStringDesc* modulename, NimStringDesc* currentmodule);
N_NIMCALL(NimStringDesc*, tofullpath_193665)(NI32 fileidx);
N_NIMCALL(NI32, fileinfoidx_193254)(NimStringDesc* filename);
N_NIMCALL(Tsym227841*, importmoduleas_290671)(Tnode227809* n, Tsym227841* realmodule);
static N_INLINE(NI, len_228098)(Tnode227809* n);
N_NIMCALL(Tsym227841*, createmodulealias_230844)(Tsym227841* s, Tident200021* newident, Tlineinfo192352 info);
N_NIMCALL(void, message_198161)(Tlineinfo192352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, adddecl_288607)(Tcontext282023* c, Tsym227841* sym);
N_NIMCALL(void, importallsymbolsexcept_290315)(Tcontext282023* c, Tsym227841* frommod, Intset224056 exceptset);
N_NIMCALL(Tsym227841*, inittabiter_235124)(Ttabiter235119* ti, Tstrtable227813 tab);
N_NIMCALL(void, internalerror_198172)(Tlineinfo192352 info, NimStringDesc* errmsg);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_88659, TNimType* typ);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(NIM_BOOL, isnil_224946)(Intset224056 x);
N_NIMCALL(NIM_BOOL, contains_224829)(Intset224056 s, NI key);
N_NIMCALL(void, rawimportsymbol_290077)(Tcontext282023* c, Tsym227841* s);
N_NIMCALL(Tsym227841*, strtableget_235111)(Tstrtable227813 t, Tident200021* name);
N_NIMCALL(void, incl_224856)(Intset224056* s, NI key);
N_NIMCALL(void, strtableadd_235103)(Tstrtable227813* t, Tsym227841* n);
N_NIMCALL(Tsym227841*, initidentiter_235147)(Tidentiter235141* ti, Tstrtable227813 tab, Tident200021* s);
N_NIMCALL(Tsym227841*, nextidentiter_235156)(Tidentiter235141* ti, Tstrtable227813 tab);
N_NIMCALL(void, addconverter_282564)(Tcontext282023* c, Tsym227841* conv);
static N_INLINE(NIM_BOOL, haspattern_232783)(Tsym227841* s);
static N_INLINE(NIM_BOOL, isroutine_232763)(Tsym227841* s);
N_NIMCALL(void, addpattern_282575)(Tcontext282023* c, Tsym227841* p);
N_NIMCALL(Tsym227841*, nextiter_235132)(Ttabiter235119* ti, Tstrtable227813 tab);
N_NIMCALL(void, checkminsonslen_283270)(Tnode227809* n, NI length);
N_NIMCALL(Tnode227809*, newsymnode_229325)(Tsym227841* sym);
N_NIMCALL(void, initintset_224927)(Intset224056* Result);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(Tident200021*, considerquotedident_288010)(Tnode227809* n);
N_NIMCALL(void, importsymbol_290241)(Tcontext282023* c, Tnode227809* n, Tsym227841* frommod);
N_NIMCALL(void, loadstub_273053)(Tsym227841* s);
STRING_LITERAL(TMP3614, "", 0);
STRING_LITERAL(TMP3615, "as", 2);
STRING_LITERAL(TMP3616, " ", 1);
STRING_LITERAL(TMP3617, ".", 1);
STRING_LITERAL(TMP3618, "/", 1);
STRING_LITERAL(TMP3619, "invalid module name: \'$1\'", 25);
STRING_LITERAL(TMP3620, "module alias must be an identifier", 34);
STRING_LITERAL(TMP3621, "A module cannot import itself", 29);
STRING_LITERAL(TMP3622, "importAllSymbols: ", 18);
STRING_LITERAL(TMP3623, "rawImportSymbol", 15);
STRING_LITERAL(TMP3625, "importSymbol: 2", 15);
STRING_LITERAL(TMP3626, "importSymbol: 3", 15);
extern Gcheap51018 gch_51059;
extern TY279064 gimportmodule_279068;
extern TNimType NTI227441; /* 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_290018)(Tnode227809* n) {
	NimStringDesc* result;
{	result = 0;
	switch ((*n).kind) {
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		result = nosunixToNativePath((*n).kindU.S3.strval, ((NimStringDesc*) &TMP3614));
	}
	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;
			Tident200021* LOC9;
			LOC7 = 0;
			LOC7 = ((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 2));
			if (!(LOC7)) goto LA8;
			LOC9 = 0;
			LOC9 = getident_200463(((NimStringDesc*) &TMP3615));
			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 = (Tnodeseq227803*) setLengthSeq(&((*n).kindU.S6.sons)->Sup, sizeof(Tnode227809*), ((NI) 2));
			result = getmodulename_290018((*n).kindU.S6.sons->data[((NI) 0)]);
			goto BeforeRet;
		}
		LA10: ;
		LOC12 = 0;
		LOC12 = rendertree_249059(n, 4);
		result = nsuReplaceStr(LOC12, ((NimStringDesc*) &TMP3616), ((NimStringDesc*) &TMP3614));
	}
	break;
	case ((NU8) 45):
	{
		NimStringDesc* LOC14;
		LOC14 = 0;
		LOC14 = rendertree_249059(n, 4);
		result = nsuReplaceStr(LOC14, ((NimStringDesc*) &TMP3617), ((NimStringDesc*) &TMP3618));
	}
	break;
	case ((NU8) 78):
	{
		result = getmodulename_290018((*n).kindU.S6.sons->data[((NI) 0)]);
	}
	break;
	default:
	{
		NimStringDesc* LOC17;
		NimStringDesc* LOC18;
		LOC17 = 0;
		LOC17 = rendertree_249059(n, 0);
		LOC18 = 0;
		LOC18 = nsuFormatSingleElem(((NimStringDesc*) &TMP3619), LOC17);
		localerror_198128((*n).info, ((NU16) 4), LOC18);
		result = copyString(((NimStringDesc*) &TMP3614));
	}
	break;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI32, checkmodulename_290064)(Tnode227809* n) {
	NI32 result;
	NimStringDesc* modulename;
	NimStringDesc* fullpath;
	NimStringDesc* LOC1;
	result = 0;
	modulename = getmodulename_290018(n);
	LOC1 = 0;
	LOC1 = tofullpath_193665((*n).info.fileindex);
	fullpath = findmodule_170549(modulename, LOC1);
	{
		if (!((fullpath ? fullpath->Sup.len : 0) == ((NI) 0))) goto LA4;
		localerror_198128((*n).info, ((NU16) 3), modulename);
		result = ((NI32) -1);
	}
	goto LA2;
	LA4: ;
	{
		result = fileinfoidx_193254(fullpath);
	}
	LA2: ;
	return result;
}

static N_INLINE(NI, len_228098)(Tnode227809* 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(Tsym227841*, importmoduleas_290671)(Tnode227809* n, Tsym227841* realmodule) {
	Tsym227841* 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_228098(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_198128((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3620));
	}
	goto LA1;
	LA9: ;
	{
		if (!!(((*(*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident).Sup.id == (*(*realmodule).name).Sup.id))) goto LA12;
		result = createmodulealias_230844(realmodule, (*(*n).kindU.S6.sons->data[((NI) 1)]).kindU.S5.ident, (*realmodule).info);
	}
	goto LA1;
	LA12: ;
	LA1: ;
	return result;
}

N_NIMCALL(Tsym227841*, myimportmodule_290708)(Tcontext282023* c, Tnode227809* n) {
	Tsym227841* result;
	NI32 f;
	result = 0;
	f = checkmodulename_290064(n);
	{
		Tsym227841* LOC5;
		if (!!((f == ((NI32) -1)))) goto LA3;
		LOC5 = 0;
		LOC5 = gimportmodule_279068((*c).module, f);
		result = importmoduleas_290671(n, LOC5);
		{
			if (!((*result).info.fileindex == (*n).info.fileindex)) goto LA8;
			localerror_198128((*n).info, ((NU16) 4), ((NimStringDesc*) &TMP3621));
		}
		LA8: ;
		{
			if (!(((*result).flags &(1<<((((NU8) 19))&31)))!=0)) goto LA12;
			message_198161((*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_224946)(Intset224056 x) {
	NIM_BOOL result;
	result = 0;
	result = x.head == 0;
	return result;
}

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

static N_INLINE(NIM_BOOL, haspattern_232783)(Tsym227841* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = isroutine_232763(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_290077)(Tcontext282023* c, Tsym227841* s) {
	Tsym227841* check;
	check = strtableget_235111((*(*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_224856((&(*c).ambiguoussymbols), (*s).Sup.id);
			incl_224856((&(*c).ambiguoussymbols), (*check).Sup.id);
		}
		LA9: ;
	}
	LA5: ;
	strtableadd_235103((&(*(*c).importtable).symbols), s);
	{
		Ttype227847* 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_290157;
				NI HEX3Atmp_290213;
				NI LOC22;
				NI res_290216;
				j_290157 = 0;
				HEX3Atmp_290213 = 0;
				LOC22 = 0;
				LOC22 = sonslen_230387((*etyp).n);
				HEX3Atmp_290213 = (NI)(LOC22 - ((NI) 1));
				res_290216 = ((NI) 0);
				{
					while (1) {
						Tsym227841* e;
						Tidentiter235141 it;
						if (!(res_290216 <= HEX3Atmp_290213)) goto LA24;
						j_290157 = res_290216;
						e = (*(*(*etyp).n).kindU.S6.sons->data[j_290157]).kindU.S4.sym;
						{
							if (!!(((*e).kind == ((NU8) 20)))) goto LA27;
							internalerror_198172((*s).info, ((NimStringDesc*) &TMP3623));
						}
						LA27: ;
						memset((void*)(&it), 0, sizeof(it));
						check = initidentiter_235147((&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_235156((&it), (*(*c).importtable).symbols);
							} LA30: ;
						} LA29: ;
						{
							if (!!((e == NIM_NIL))) goto LA37;
							rawimportsymbol_290077(c, e);
						}
						LA37: ;
						res_290216 += ((NI) 1);
					} LA24: ;
				}
			}
		}
		LA19: ;
	}
	goto LA11;
	LA13: ;
	{
		{
			if (!((*s).kind == ((NU8) 16))) goto LA42;
			addconverter_282564(c, s);
		}
		LA42: ;
		{
			NIM_BOOL LOC46;
			LOC46 = 0;
			LOC46 = haspattern_232783(s);
			if (!LOC46) goto LA47;
			addpattern_282575(c, s);
		}
		LA47: ;
	}
	LA11: ;
}

N_NIMCALL(void, importallsymbolsexcept_290315)(Tcontext282023* c, Tsym227841* frommod, Intset224056 exceptset) {
	Ttabiter235119 i;
	Tsym227841* s;
	memset((void*)(&i), 0, sizeof(i));
	s = inittabiter_235124((&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, (&NTI227441))->Sup.len + 18);
appendString(LOC15, ((NimStringDesc*) &TMP3622));
appendString(LOC15, reprEnum((*s).kind, (&NTI227441)));
						internalerror_198172((*s).info, LOC15);
					}
					LA13: ;
					{
						NIM_BOOL LOC18;
						NIM_BOOL LOC20;
						LOC18 = 0;
						LOC18 = isnil_224946(exceptset);
						if (LOC18) goto LA19;
						LOC20 = 0;
						LOC20 = contains_224829(exceptset, (*(*s).name).Sup.id);
						LOC18 = !(LOC20);
						LA19: ;
						if (!LOC18) goto LA21;
						rawimportsymbol_290077(c, s);
					}
					LA21: ;
				}
				LA9: ;
			}
			LA5: ;
			s = nextiter_235132((&i), (*frommod).kindU.S3.tab);
		} LA2: ;
	}
}

N_NIMCALL(Tnode227809*, evalimport_290004)(Tcontext282023* c, Tnode227809* n) {
	Tnode227809* result;
	Intset224056 emptyset;
	result = 0;
	result = n;
	memset((void*)(&emptyset), 0, sizeof(emptyset));
	{
		NI i_290751;
		NI HEX3Atmp_290768;
		NI LOC2;
		NI res_290771;
		i_290751 = 0;
		HEX3Atmp_290768 = 0;
		LOC2 = 0;
		LOC2 = sonslen_230387(n);
		HEX3Atmp_290768 = (NI)(LOC2 - ((NI) 1));
		res_290771 = ((NI) 0);
		{
			while (1) {
				Tsym227841* m;
				if (!(res_290771 <= HEX3Atmp_290768)) goto LA4;
				i_290751 = res_290771;
				m = myimportmodule_290708(c, (*n).kindU.S6.sons->data[i_290751]);
				{
					if (!!((m == NIM_NIL))) goto LA7;
					adddecl_288607(c, m);
					importallsymbolsexcept_290315(c, m, emptyset);
				}
				LA7: ;
				res_290771 += ((NI) 1);
			} LA4: ;
		}
	}
	return result;
}

N_NIMCALL(Tnode227809*, evalimportexcept_290857)(Tcontext282023* c, Tnode227809* n) {
	Tnode227809* result;
	Tsym227841* m;
	result = 0;
	result = n;
	checkminsonslen_283270(n, ((NI) 2));
	m = myimportmodule_290708(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		Intset224056 exceptset;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_229325(m));
		adddecl_288607(c, m);
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		chckNil((void*)(&exceptset));
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		initintset_224927((&exceptset));
		{
			NI i_290890;
			NI HEX3Atmp_290895;
			NI LOC6;
			NI res_290898;
			i_290890 = 0;
			HEX3Atmp_290895 = 0;
			LOC6 = 0;
			LOC6 = sonslen_230387(n);
			HEX3Atmp_290895 = (NI)(LOC6 - ((NI) 1));
			res_290898 = ((NI) 1);
			{
				while (1) {
					Tident200021* ident;
					if (!(res_290898 <= HEX3Atmp_290895)) goto LA8;
					i_290890 = res_290898;
					ident = considerquotedident_288010((*n).kindU.S6.sons->data[i_290890]);
					incl_224856((&exceptset), (*ident).Sup.id);
					res_290898 += ((NI) 1);
				} LA8: ;
			}
		}
		importallsymbolsexcept_290315(c, m, exceptset);
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importsymbol_290241)(Tcontext282023* c, Tnode227809* n, Tsym227841* frommod) {
	Tident200021* ident;
	Tsym227841* s;
	ident = considerquotedident_288010(n);
	s = strtableget_235111((*frommod).kindU.S3.tab, ident);
	{
		if (!(s == NIM_NIL)) goto LA3;
		localerror_198128((*n).info, ((NU16) 63), (*ident).s);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((*s).kind == ((NU8) 23))) goto LA8;
			loadstub_273053(s);
		}
		LA8: ;
		{
			if (!!(((43513728 &(1<<(((*s).kind)&31)))!=0))) goto LA12;
			internalerror_198172((*n).info, ((NimStringDesc*) &TMP3625));
		}
		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):
		{
			Tidentiter235141 it;
			Tsym227841* e;
			memset((void*)(&it), 0, sizeof(it));
			e = initidentiter_235147((&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_198172((*n).info, ((NimStringDesc*) &TMP3626));
					}
					LA19: ;
					rawimportsymbol_290077(c, e);
					e = nextidentiter_235156((&it), (*frommod).kindU.S3.tab);
				} LA16: ;
			}
		}
		break;
		default:
		{
			rawimportsymbol_290077(c, s);
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(Tnode227809*, evalfrom_290011)(Tcontext282023* c, Tnode227809* n) {
	Tnode227809* result;
	Tsym227841* m;
	result = 0;
	result = n;
	checkminsonslen_283270(n, ((NI) 2));
	m = myimportmodule_290708(c, (*n).kindU.S6.sons->data[((NI) 0)]);
	{
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.sons->data[((NI) 0)]), newsymnode_229325(m));
		adddecl_288607(c, m);
		{
			NI i_290822;
			NI HEX3Atmp_290835;
			NI LOC6;
			NI res_290838;
			i_290822 = 0;
			HEX3Atmp_290835 = 0;
			LOC6 = 0;
			LOC6 = sonslen_230387(n);
			HEX3Atmp_290835 = (NI)(LOC6 - ((NI) 1));
			res_290838 = ((NI) 1);
			{
				while (1) {
					if (!(res_290838 <= HEX3Atmp_290835)) goto LA8;
					i_290822 = res_290838;
					{
						if (!!(((*(*n).kindU.S6.sons->data[i_290822]).kind == ((NU8) 23)))) goto LA11;
						importsymbol_290241(c, (*n).kindU.S6.sons->data[i_290822], m);
					}
					LA11: ;
					res_290838 += ((NI) 1);
				} LA8: ;
			}
		}
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importallsymbols_290389)(Tcontext282023* c, Tsym227841* frommod) {
	Intset224056 exceptset;
	memset((void*)(&exceptset), 0, sizeof(exceptset));
	importallsymbolsexcept_290315(c, frommod, exceptset);
}
NIM_EXTERNC N_NOINLINE(void, compiler_importerInit000)(void) {
}

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

