/* Generated by Nim Compiler v0.10.2 */
/*   (c) 2014 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 64
#include "nimbase.h"

#include <string.h>
typedef struct tnode224816 tnode224816;
typedef struct tcontext289021 tcontext289021;
typedef struct intset221056 intset221056;
typedef struct ttrunk221052 ttrunk221052;
typedef struct ttrunkseq221054 ttrunkseq221054;
typedef struct TGenericSeq TGenericSeq;
typedef struct ttype224852 ttype224852;
typedef struct tlineinfo194539 tlineinfo194539;
typedef struct NimStringDesc NimStringDesc;
typedef struct tsym224846 tsym224846;
typedef struct tident199021 tident199021;
typedef struct tnodeseq224810 tnodeseq224810;
typedef struct tidobj199015 tidobj199015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct ttypeseq224848 ttypeseq224848;
typedef struct tscope224840 tscope224840;
typedef struct TY224947 TY224947;
typedef struct tinstantiation224836 tinstantiation224836;
typedef struct tstrtable224820 tstrtable224820;
typedef struct tsymseq224818 tsymseq224818;
typedef struct tloc224830 tloc224830;
typedef struct trope176009 trope176009;
typedef struct tlib224834 tlib224834;
typedef struct tcell44935 tcell44935;
typedef struct tcellseq44951 tcellseq44951;
typedef struct tgcheap47016 tgcheap47016;
typedef struct tcellset44947 tcellset44947;
typedef struct tpagedesc44943 tpagedesc44943;
typedef struct tmemregion27210 tmemregion27210;
typedef struct tsmallchunk26440 tsmallchunk26440;
typedef struct tllchunk27204 tllchunk27204;
typedef struct tbigchunk26442 tbigchunk26442;
typedef struct tintset26417 tintset26417;
typedef struct ttrunk26413 ttrunk26413;
typedef struct tavlnode27208 tavlnode27208;
typedef struct tgcstat47014 tgcstat47014;
typedef struct tpasscontext285005 tpasscontext285005;
typedef struct tproccon289011 tproccon289011;
typedef struct tlinkedlist126028 tlinkedlist126028;
typedef struct tlistentry126022 tlistentry126022;
typedef struct tidtable224864 tidtable224864;
typedef struct tidpairseq224862 tidpairseq224862;
typedef struct tidpair224860 tidpair224860;
typedef struct tctx288048 tctx288048;
typedef struct TY289133 TY289133;
typedef struct tinstantiationpair289013 tinstantiationpair289013;
typedef struct ttabiter234119 ttabiter234119;
typedef struct tidentiter234141 tidentiter234141;
typedef struct TY224936 TY224936;
typedef struct tbasechunk26438 tbasechunk26438;
typedef struct tfreecell26430 tfreecell26430;
typedef struct TY288250 TY288250;
typedef struct TY195414 TY195414;
typedef struct pprocHEX3Aobjecttype288230 pprocHEX3Aobjecttype288230;
typedef struct TY288269 TY288269;
typedef struct TY288270 TY288270;
typedef struct vmargs288042 vmargs288042;
typedef struct TY288231 TY288231;
typedef struct tblock288030 tblock288030;
typedef struct TY288211 TY288211;
typedef struct TY288237 TY288237;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  intset221056  {
NI Counter;
NI Max;
ttrunk221052* Head;
ttrunkseq221054* Data;
};
struct  tlineinfo194539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  tnode224816  {
ttype224852* Typ;
tlineinfo194539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym224846* Sym;
} S4;
struct {tident199021* Ident;
} S5;
struct {tnodeseq224810* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
typedef N_NIMCALL_PTR(void, TY3089) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3094) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3089 marker;
TY3094 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  tidobj199015  {
  TNimObject Sup;
NI Id;
};
struct  tident199021  {
  tidobj199015 Sup;
NimStringDesc* S;
tident199021* Next;
NI H;
};
struct  tstrtable224820  {
NI Counter;
tsymseq224818* Data;
};
struct  tloc224830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype224852* T;
trope176009* R;
trope176009* Heaproot;
};
struct  tsym224846  {
  tidobj199015 Sup;
NU8 Kind;
union {
struct {ttypeseq224848* Typeinstcache;
tscope224840* Typscope;
} S1;
struct {TY224947* Procinstcache;
tscope224840* Scope;
} S2;
struct {TY224947* Usedgenerics;
tstrtable224820 Tab;
} S3;
struct {tsym224846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype224852* Typ;
tident199021* Name;
tlineinfo194539 Info;
tsym224846* Owner;
NU32 Flags;
tnode224816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc224830 Loc;
tlib224834* Annex;
tnode224816* Constraint;
};
struct  tcell44935  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq44951  {
NI Len;
NI Cap;
tcell44935** D;
};
struct  tcellset44947  {
NI Counter;
NI Max;
tpagedesc44943* Head;
tpagedesc44943** Data;
};
typedef tsmallchunk26440* TY27222[512];
typedef ttrunk26413* ttrunkbuckets26415[256];
struct  tintset26417  {
ttrunkbuckets26415 Data;
};
struct  tmemregion27210  {
NI Minlargeobj;
NI Maxlargeobj;
TY27222 Freesmallchunks;
tllchunk27204* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk26442* Freechunkslist;
tintset26417 Chunkstarts;
tavlnode27208* Root;
tavlnode27208* Deleted;
tavlnode27208* Last;
tavlnode27208* Freeavlnodes;
};
struct  tgcstat47014  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap47016  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq44951 Zct;
tcellseq44951 Decstack;
tcellset44947 Cycleroots;
tcellseq44951 Tempstack;
NI Recgclock;
tmemregion27210 Region;
tgcstat47014 Stat;
};
typedef N_NIMCALL_PTR(tsym224846*, TY285064) (tsym224846* m, NI32 fileidx);
struct  tpasscontext285005  {
  TNimObject Sup;
NIM_BOOL Fromcache;
};
struct  tlinkedlist126028  {
tlistentry126022* Head;
tlistentry126022* Tail;
NI Counter;
};
struct  tidpair224860  {
tidobj199015* Key;
TNimObject* Val;
};
struct  tidtable224864  {
NI Counter;
tidpairseq224862* Data;
};
typedef N_NIMCALL_PTR(tnode224816*, TY289064) (tcontext289021* c, tnode224816* n);
typedef N_NIMCALL_PTR(tnode224816*, TY289069) (tcontext289021* c, tnode224816* n, NU16 flags);
typedef N_NIMCALL_PTR(tnode224816*, TY289077) (tcontext289021* c, tnode224816* n, NU16 flags);
typedef N_NIMCALL_PTR(tnode224816*, TY289085) (tcontext289021* c, tnode224816* n);
typedef N_NIMCALL_PTR(tnode224816*, TY289090) (tcontext289021* c, tnode224816* n, NU16 flags);
typedef N_NIMCALL_PTR(tnode224816*, TY289098) (tcontext289021* c, tnode224816* n);
typedef N_NIMCALL_PTR(tnode224816*, TY289103) (tcontext289021* c, tnode224816* n, tnode224816* norig, NU32 filter);
typedef N_NIMCALL_PTR(ttype224852*, TY289110) (tcontext289021* c, tnode224816* n, ttype224852* prev);
typedef struct {
N_NIMCALL_PTR(tnode224816*, ClPrc) (tcontext289021* c, tidtable224864 pt, tnode224816* n, void* ClEnv);
void* ClEnv;
} TY289116;
typedef struct {
N_NIMCALL_PTR(tsym224846*, ClPrc) (tcontext289021* c, tsym224846* fn, tidtable224864 pt, tlineinfo194539 info, void* ClEnv);
void* ClEnv;
} TY289122;
struct  tinstantiationpair289013  {
tsym224846* Genericsym;
tinstantiation224836* Inst;
};
typedef N_NIMCALL_PTR(tsym224846*, TY289138) (tcontext289021* c, tsym224846* dc, ttype224852* t, tlineinfo194539 info);
struct  tcontext289021  {
  tpasscontext285005 Sup;
tsym224846* Module;
tscope224840* Currentscope;
tscope224840* Importtable;
tscope224840* Toplevelscope;
tproccon289011* P;
tsymseq224818* Friendmodules;
NI Instcounter;
intset221056 Ambiguoussymbols;
NI Intypeclass;
NI Ingenericcontext;
NI Inunrolledcontext;
NI Incompilescontext;
NI Ingenericinst;
tsymseq224818* Converters;
tsymseq224818* Patterns;
tlinkedlist126028 Optionstack;
tidtable224864 Symmapping;
tlinkedlist126028 Libs;
TY289064 Semconstexpr;
TY289069 Semexpr;
TY289077 Semtryexpr;
TY289085 Semtryconstexpr;
TY289090 Semoperand;
TY289098 Semconstboolexpr;
TY289103 Semoverloadedcall;
TY289110 Semtypenode;
TY289116 Seminferredlambda;
TY289122 Semgenerateinstance;
intset221056 Includedfiles;
tstrtable224820 Userpragmas;
tctx288048* Evalcontext;
intset221056 Unknownidents;
TY289133* Generics;
NI Lastgenericidx;
NI Hloloopdetector;
NI Inparallelstmt;
TY289138 Instdeepcopy;
};
struct  ttabiter234119  {
NI H;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tscope224840  {
NI Depthlevel;
tstrtable224820 Symbols;
tnodeseq224810* Usingsyms;
tscope224840* Parent;
};
struct  ttype224852  {
  tidobj199015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq224848* Sons;
tnode224816* N;
tsym224846* Owner;
tsym224846* Sym;
tsym224846* Destructor;
tsym224846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc224830 Loc;
};
struct  tidentiter234141  {
NI H;
tident199021* Name;
};
typedef NI TY26420[8];
struct  ttrunk221052  {
ttrunk221052* Next;
NI Key;
TY26420 Bits;
};
struct  tinstantiation224836  {
tsym224846* Sym;
ttypeseq224848* Concretetypes;
TY224936* Usedby;
};
struct  trope176009  {
  TNimObject Sup;
trope176009* Left;
trope176009* Right;
NI Length;
NimStringDesc* Data;
};
struct  tlistentry126022  {
  TNimObject Sup;
tlistentry126022* Prev;
tlistentry126022* Next;
};
struct  tlib224834  {
  tlistentry126022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope176009* Name;
tnode224816* Path;
};
struct  tpagedesc44943  {
tpagedesc44943* Next;
NI Key;
TY26420 Bits;
};
struct  tbasechunk26438  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk26440  {
  tbasechunk26438 Sup;
tsmallchunk26440* Next;
tsmallchunk26440* Prev;
tfreecell26430* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk27204  {
NI Size;
NI Acc;
tllchunk27204* Next;
};
struct  tbigchunk26442  {
  tbasechunk26438 Sup;
tbigchunk26442* Next;
tbigchunk26442* Prev;
NI Align;
NF Data;
};
struct  ttrunk26413  {
ttrunk26413* Next;
NI Key;
TY26420 Bits;
};
typedef tavlnode27208* TY27214[2];
struct  tavlnode27208  {
TY27214 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  tproccon289011  {
tsym224846* Owner;
tsym224846* Resultsym;
NI Nestedloopcounter;
NI Nestedblockcounter;
NI Intrystmt;
tproccon289011* Next;
};
struct  vmargs288042  {
NI Ra;
NI Rb;
NI Rc;
void* Slots;
tnode224816* Currentexception;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (vmargs288042* args, void* ClEnv);
void* ClEnv;
} vmcallback288044;
struct TY288270 {
NimStringDesc* Field0;
vmcallback288044 Field1;
};
struct  tctx288048  {
  tpasscontext285005 Sup;
TY288250* Code;
TY195414* Debug;
tnode224816* Globals;
tnode224816* Constants;
ttypeseq224848* Types;
tnode224816* Currentexceptiona;
tnode224816* Currentexceptionb;
NI Exceptioninstr;
pprocHEX3Aobjecttype288230* Prc;
tsym224846* Module;
tnode224816* Callsite;
NU8 Mode;
NU8 Features;
NIM_BOOL Traceactive;
NI Loopiterations;
tlineinfo194539 Comesfromheuristic;
TY288269* Callbacks;
NimStringDesc* Errorflag;
};
struct  tfreecell26430  {
tfreecell26430* Next;
NI Zerofield;
};
struct  tblock288030  {
tsym224846* Label;
TY288211* Fixups;
};
struct TY288237 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY288237 TY288234[256];
struct  pprocHEX3Aobjecttype288230  {
TY288231* Blocks;
tsym224846* Sym;
TY288234 Slots;
NI Maxslots;
};
struct ttrunkseq221054 {
  TGenericSeq Sup;
  ttrunk221052* data[SEQ_DECL_SIZE];
};
struct tnodeseq224810 {
  TGenericSeq Sup;
  tnode224816* data[SEQ_DECL_SIZE];
};
struct ttypeseq224848 {
  TGenericSeq Sup;
  ttype224852* data[SEQ_DECL_SIZE];
};
struct TY224947 {
  TGenericSeq Sup;
  tinstantiation224836* data[SEQ_DECL_SIZE];
};
struct tsymseq224818 {
  TGenericSeq Sup;
  tsym224846* data[SEQ_DECL_SIZE];
};
struct tidpairseq224862 {
  TGenericSeq Sup;
  tidpair224860 data[SEQ_DECL_SIZE];
};
struct TY289133 {
  TGenericSeq Sup;
  tinstantiationpair289013 data[SEQ_DECL_SIZE];
};
struct TY224936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY288250 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY195414 {
  TGenericSeq Sup;
  tlineinfo194539 data[SEQ_DECL_SIZE];
};
struct TY288269 {
  TGenericSeq Sup;
  TY288270 data[SEQ_DECL_SIZE];
};
struct TY288211 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
struct TY288231 {
  TGenericSeq Sup;
  tblock288030 data[SEQ_DECL_SIZE];
};
static N_INLINE(NI, sonslen_225249)(tnode224816* n);
N_NIMCALL(tsym224846*, myimportmodule_297991)(tcontext289021* c, tnode224816* n);
N_NIMCALL(NI32, checkmodulename_297237)(tnode224816* n);
N_NIMCALL(NimStringDesc*, getmodulename_297018)(tnode224816* n);
N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(tident199021*, getident_199472)(NimStringDesc* identifier);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(tcell44935*, usrtocell_48646)(void* usr);
static N_INLINE(void, rtladdzct_50204)(tcell44935* c);
N_NOINLINE(void, addzct_48617)(tcellseq44951* s, tcell44935* 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_249058)(tnode224816* n, NU8 renderflags);
N_NIMCALL(void, localerror_196955)(tlineinfo194539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, findmodule_169366)(NimStringDesc* modulename, NimStringDesc* currentmodule);
N_NIMCALL(NimStringDesc*, tofullpath_196037)(NI32 fileidx);
N_NIMCALL(NI32, fileinfoidx_194747)(NimStringDesc* filename);
N_NIMCALL(tsym224846*, importmoduleas_297892)(tnode224816* n, tsym224846* realmodule);
static N_INLINE(NI, len_225364)(tnode224816* n);
N_NIMCALL(tsym224846*, createmodulealias_228287)(tsym224846* s, tident199021* newident, tlineinfo194539 info);
N_NIMCALL(void, message_196976)(tlineinfo194539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, adddecl_294694)(tcontext289021* c, tsym224846* sym);
N_NIMCALL(void, importallsymbolsexcept_297573)(tcontext289021* c, tsym224846* frommod, intset221056* exceptset);
N_NIMCALL(tsym224846*, inittabiter_234124)(ttabiter234119* ti, tstrtable224820 tab);
N_NIMCALL(void, internalerror_196987)(tlineinfo194539 info, NimStringDesc* errmsg);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_80907, TNimType* typ);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(NIM_BOOL, empty_222383)(intset221056* s);
N_NIMCALL(NIM_BOOL, contains_221837)(intset221056* s, NI key);
N_NIMCALL(void, rawimportsymbol_297249)(tcontext289021* c, tsym224846* s);
N_NIMCALL(tsym224846*, strtableget_234111)(tstrtable224820 t, tident199021* name);
N_NIMCALL(void, incl_221869)(intset221056* s, NI key);
N_NIMCALL(void, strtableadd_234103)(tstrtable224820* t, tsym224846* n);
N_NIMCALL(tsym224846*, initidentiter_234147)(tidentiter234141* ti, tstrtable224820 tab, tident199021* s);
N_NIMCALL(tsym224846*, nextidentiter_234156)(tidentiter234141* ti, tstrtable224820 tab);
N_NIMCALL(void, addconverter_289634)(tcontext289021* c, tsym224846* conv);
static N_INLINE(NIM_BOOL, haspattern_231804)(tsym224846* s);
static N_INLINE(NIM_BOOL, isroutine_231781)(tsym224846* s);
N_NIMCALL(void, addpattern_289645)(tcontext289021* c, tsym224846* p);
N_NIMCALL(tsym224846*, nextiter_234132)(ttabiter234119* ti, tstrtable224820 tab);
N_NIMCALL(void, checkminsonslen_290425)(tnode224816* n, NI length);
N_NIMCALL(tnode224816*, newsymnode_225132)(tsym224846* sym);
N_NIMCALL(void, initintset_221950)(intset221056* Result);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(tident199021*, considerquotedident_294010)(tnode224816* n);
N_NIMCALL(void, importsymbol_297450)(tcontext289021* c, tnode224816* n, tsym224846* frommod);
N_NIMCALL(void, loadstub_278260)(tsym224846* s);
STRING_LITERAL(TMP3323, "", 0);
STRING_LITERAL(TMP3324, "as", 2);
STRING_LITERAL(TMP3325, " ", 1);
STRING_LITERAL(TMP3326, ".", 1);
STRING_LITERAL(TMP3327, "/", 1);
STRING_LITERAL(TMP3328, "invalid module name: \'$1\'", 25);
STRING_LITERAL(TMP3329, "module alias must be an identifier", 34);
STRING_LITERAL(TMP3330, "A module cannot import itself", 29);
STRING_LITERAL(TMP3331, "importAllSymbols: ", 18);
STRING_LITERAL(TMP3332, "rawImportSymbol", 15);
STRING_LITERAL(TMP3334, "importSymbol: 2", 15);
STRING_LITERAL(TMP3335, "importSymbol: 3", 15);
extern tgcheap47016 gch_47044;
extern TY285064 gimportmodule_285068;
extern TNimType NTI224445; /* TSymKind */

static N_INLINE(NI, sonslen_225249)(tnode224816* n) {
	NI result;
	result = 0;
	{
		if (!(*n).kindU.S6.Sons == 0) goto LA3;
		result = 0;
	}
	goto LA1;
	LA3: ;
	{
		result = (*n).kindU.S6.Sons->Sup.len;
	}
	LA1: ;
	return result;
}

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

static N_INLINE(void, rtladdzct_50204)(tcell44935* c) {
	addzct_48617((&gch_47044.Zct), c);
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		tcell44935* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_48646(src);
		(*c).Refcount += 8;
	}
	LA3: ;
	{
		tcell44935* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_48646((*dest));
		{
			(*c).Refcount -= 8;
			if (!((NU64)((*c).Refcount) < (NU64)(8))) goto LA11;
			rtladdzct_50204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(NimStringDesc*, getmodulename_297018)(tnode224816* n) {
	NimStringDesc* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		result = nosunixToNativePath((*n).kindU.S3.Strval, ((NimStringDesc*) &TMP3323));
	}
	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):
	{
		NimStringDesc* LOC12;
		{
			NIM_BOOL LOC7;
			tident199021* LOC9;
			LOC7 = 0;
			LOC7 = ((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 2));
			if (!(LOC7)) goto LA8;
			LOC9 = 0;
			LOC9 = getident_199472(((NimStringDesc*) &TMP3324));
			LOC7 = ((*(*(*n).kindU.S6.Sons->data[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[0]), (*n).kindU.S6.Sons->data[1]);
			asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[1]), (*n).kindU.S6.Sons->data[2]);
			(*n).kindU.S6.Sons = (tnodeseq224810*) setLengthSeq(&((*n).kindU.S6.Sons)->Sup, sizeof(tnode224816*), 2);
			result = getmodulename_297018((*n).kindU.S6.Sons->data[0]);
			goto BeforeRet;
		}
		LA10: ;
		LOC12 = 0;
		LOC12 = rendertree_249058(n, 4);
		result = nsuReplaceStr(LOC12, ((NimStringDesc*) &TMP3325), ((NimStringDesc*) &TMP3323));
	}
	break;
	case ((NU8) 45):
	{
		NimStringDesc* LOC14;
		LOC14 = 0;
		LOC14 = rendertree_249058(n, 4);
		result = nsuReplaceStr(LOC14, ((NimStringDesc*) &TMP3326), ((NimStringDesc*) &TMP3327));
	}
	break;
	case ((NU8) 78):
	{
		result = getmodulename_297018((*n).kindU.S6.Sons->data[0]);
	}
	break;
	default:
	{
		NimStringDesc* LOC17;
		NimStringDesc* LOC18;
		LOC17 = 0;
		LOC17 = rendertree_249058(n, 0);
		LOC18 = 0;
		LOC18 = nsuFormatSingleElem(((NimStringDesc*) &TMP3328), LOC17);
		localerror_196955((*n).Info, ((NU16) 4), LOC18);
		result = copyString(((NimStringDesc*) &TMP3323));
	}
	break;
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(NI32, checkmodulename_297237)(tnode224816* n) {
	NI32 result;
	NimStringDesc* modulename;
	NimStringDesc* fullpath;
	NimStringDesc* LOC1;
	result = 0;
	modulename = getmodulename_297018(n);
	LOC1 = 0;
	LOC1 = tofullpath_196037((*n).Info.Fileindex);
	fullpath = findmodule_169366(modulename, LOC1);
	{
		if (!(fullpath->Sup.len == 0)) goto LA4;
		localerror_196955((*n).Info, ((NU16) 3), modulename);
		result = ((NI32) -1);
	}
	goto LA2;
	LA4: ;
	{
		result = fileinfoidx_194747(fullpath);
	}
	LA2: ;
	return result;
}

static N_INLINE(NI, len_225364)(tnode224816* n) {
	NI result;
	result = 0;
	{
		if (!(*n).kindU.S6.Sons == 0) goto LA3;
		result = 0;
	}
	goto LA1;
	LA3: ;
	{
		result = (*n).kindU.S6.Sons->Sup.len;
	}
	LA1: ;
	return result;
}

N_NIMCALL(tsym224846*, importmoduleas_297892)(tnode224816* n, tsym224846* realmodule) {
	tsym224846* 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_225364(n);
		LOC6 = !((LOC7 == 2));
		if (LOC6) goto LA8;
		LOC6 = !(((*(*n).kindU.S6.Sons->data[1]).Kind == ((NU8) 2)));
		LA8: ;
		if (!LOC6) goto LA9;
		localerror_196955((*n).Info, ((NU16) 4), ((NimStringDesc*) &TMP3329));
	}
	goto LA1;
	LA9: ;
	{
		if (!!(((*(*(*n).kindU.S6.Sons->data[1]).kindU.S5.Ident).Sup.Id == (*(*realmodule).Name).Sup.Id))) goto LA12;
		result = createmodulealias_228287(realmodule, (*(*n).kindU.S6.Sons->data[1]).kindU.S5.Ident, (*realmodule).Info);
	}
	goto LA1;
	LA12: ;
	LA1: ;
	return result;
}

N_NIMCALL(tsym224846*, myimportmodule_297991)(tcontext289021* c, tnode224816* n) {
	tsym224846* result;
	NI32 f;
	result = 0;
	f = checkmodulename_297237(n);
	{
		tsym224846* LOC5;
		if (!!((f == ((NI32) -1)))) goto LA3;
		LOC5 = 0;
		LOC5 = gimportmodule_285068((*c).Module, f);
		result = importmoduleas_297892(n, LOC5);
		{
			if (!((*result).Info.Fileindex == (*n).Info.Fileindex)) goto LA8;
			localerror_196955((*n).Info, ((NU16) 4), ((NimStringDesc*) &TMP3330));
		}
		LA8: ;
		{
			if (!(((*result).Flags &(1<<((((NU8) 19))&31)))!=0)) goto LA12;
			message_196976((*n).Info, ((NU16) 234), (*(*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)), (NI64)((*src).Sup.len + 1));
	(*dest).Sup.len += (*src).Sup.len;
}

static N_INLINE(NIM_BOOL, empty_222383)(intset221056* s) {
	NIM_BOOL result;
	result = 0;
	result = ((*s).Counter == 0);
	return result;
}

static N_INLINE(NIM_BOOL, isroutine_231781)(tsym224846* s) {
	NIM_BOOL result;
	result = 0;
	result = ((520192 &(1<<(((*s).Kind)&31)))!=0);
	return result;
}

static N_INLINE(NIM_BOOL, haspattern_231804)(tsym224846* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = isroutine_231781(s);
	if (!(LOC1)) goto LA2;
	LOC1 = !(((*(*(*s).Ast).kindU.S6.Sons->data[1]).Kind == ((NU8) 1)));
	LA2: ;
	result = LOC1;
	return result;
}

N_NIMCALL(void, rawimportsymbol_297249)(tcontext289021* c, tsym224846* s) {
	tsym224846* check;
	check = strtableget_234111((*(*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_221869((&(*c).Ambiguoussymbols), (*s).Sup.Id);
			incl_221869((&(*c).Ambiguoussymbols), (*check).Sup.Id);
		}
		LA9: ;
	}
	LA5: ;
	strtableadd_234103((&(*(*c).Importtable).Symbols), s);
	{
		ttype224852* 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_297336;
				NI HEX3Atmp_297424;
				NI LOC22;
				NI res_297427;
				j_297336 = 0;
				HEX3Atmp_297424 = 0;
				LOC22 = 0;
				LOC22 = sonslen_225249((*etyp).N);
				HEX3Atmp_297424 = (NI64)(LOC22 - 1);
				res_297427 = 0;
				{
					while (1) {
						tsym224846* e;
						tidentiter234141 it;
						if (!(res_297427 <= HEX3Atmp_297424)) goto LA24;
						j_297336 = res_297427;
						e = (*(*(*etyp).N).kindU.S6.Sons->data[j_297336]).kindU.S4.Sym;
						{
							if (!!(((*e).Kind == ((NU8) 20)))) goto LA27;
							internalerror_196987((*s).Info, ((NimStringDesc*) &TMP3332));
						}
						LA27: ;
						memset((void*)(&it), 0, sizeof(it));
						check = initidentiter_234147((&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_234156((&it), (*(*c).Importtable).Symbols);
							} LA30: ;
						} LA29: ;
						{
							if (!!((e == NIM_NIL))) goto LA37;
							rawimportsymbol_297249(c, e);
						}
						LA37: ;
						res_297427 += 1;
					} LA24: ;
				}
			}
		}
		LA19: ;
	}
	goto LA11;
	LA13: ;
	{
		{
			if (!((*s).Kind == ((NU8) 16))) goto LA42;
			addconverter_289634(c, s);
		}
		LA42: ;
		{
			NIM_BOOL LOC46;
			LOC46 = 0;
			LOC46 = haspattern_231804(s);
			if (!LOC46) goto LA47;
			addpattern_289645(c, s);
		}
		LA47: ;
	}
	LA11: ;
}

N_NIMCALL(void, importallsymbolsexcept_297573)(tcontext289021* c, tsym224846* frommod, intset221056* exceptset) {
	ttabiter234119 i;
	tsym224846* s;
	memset((void*)(&i), 0, sizeof(i));
	s = inittabiter_234124((&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, (&NTI224445))->Sup.len + 18);
appendString(LOC15, ((NimStringDesc*) &TMP3331));
appendString(LOC15, reprEnum((*s).Kind, (&NTI224445)));
						internalerror_196987((*s).Info, LOC15);
					}
					LA13: ;
					{
						NIM_BOOL LOC18;
						NIM_BOOL LOC20;
						LOC18 = 0;
						LOC18 = empty_222383(exceptset);
						if (LOC18) goto LA19;
						LOC20 = 0;
						LOC20 = contains_221837(exceptset, (*(*s).Name).Sup.Id);
						LOC18 = !(LOC20);
						LA19: ;
						if (!LOC18) goto LA21;
						rawimportsymbol_297249(c, s);
					}
					LA21: ;
				}
				LA9: ;
			}
			LA5: ;
			s = nextiter_234132((&i), (*frommod).kindU.S3.Tab);
		} LA2: ;
	}
}

N_NIMCALL(tnode224816*, evalimport_297004)(tcontext289021* c, tnode224816* n) {
	tnode224816* result;
	intset221056 emptyset;
	result = 0;
	result = n;
	memset((void*)(&emptyset), 0, sizeof(emptyset));
	{
		NI i_298034;
		NI HEX3Atmp_298069;
		NI LOC2;
		NI res_298072;
		i_298034 = 0;
		HEX3Atmp_298069 = 0;
		LOC2 = 0;
		LOC2 = sonslen_225249(n);
		HEX3Atmp_298069 = (NI64)(LOC2 - 1);
		res_298072 = 0;
		{
			while (1) {
				tsym224846* m;
				if (!(res_298072 <= HEX3Atmp_298069)) goto LA4;
				i_298034 = res_298072;
				m = myimportmodule_297991(c, (*n).kindU.S6.Sons->data[i_298034]);
				{
					if (!!((m == NIM_NIL))) goto LA7;
					adddecl_294694(c, m);
					importallsymbolsexcept_297573(c, m, (&emptyset));
				}
				LA7: ;
				res_298072 += 1;
			} LA4: ;
		}
	}
	return result;
}

N_NIMCALL(tnode224816*, evalimportexcept_298211)(tcontext289021* c, tnode224816* n) {
	tnode224816* result;
	tsym224846* m;
	result = 0;
	result = n;
	checkminsonslen_290425(n, 2);
	m = myimportmodule_297991(c, (*n).kindU.S6.Sons->data[0]);
	{
		intset221056 exceptset;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[0]), newsymnode_225132(m));
		adddecl_294694(c, m);
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		chckNil((void*)(&exceptset));
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		initintset_221950((&exceptset));
		{
			NI i_298275;
			NI HEX3Atmp_298293;
			NI LOC6;
			NI res_298296;
			i_298275 = 0;
			HEX3Atmp_298293 = 0;
			LOC6 = 0;
			LOC6 = sonslen_225249(n);
			HEX3Atmp_298293 = (NI64)(LOC6 - 1);
			res_298296 = 1;
			{
				while (1) {
					tident199021* ident;
					if (!(res_298296 <= HEX3Atmp_298293)) goto LA8;
					i_298275 = res_298296;
					ident = considerquotedident_294010((*n).kindU.S6.Sons->data[i_298275]);
					incl_221869((&exceptset), (*ident).Sup.Id);
					res_298296 += 1;
				} LA8: ;
			}
		}
		importallsymbolsexcept_297573(c, m, (&exceptset));
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importsymbol_297450)(tcontext289021* c, tnode224816* n, tsym224846* frommod) {
	tident199021* ident;
	tsym224846* s;
	ident = considerquotedident_294010(n);
	s = strtableget_234111((*frommod).kindU.S3.Tab, ident);
	{
		if (!(s == NIM_NIL)) goto LA3;
		localerror_196955((*n).Info, ((NU16) 61), (*ident).S);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((*s).Kind == ((NU8) 23))) goto LA8;
			loadstub_278260(s);
		}
		LA8: ;
		{
			if (!!(((43513728 &(1<<(((*s).Kind)&31)))!=0))) goto LA12;
			internalerror_196987((*n).Info, ((NimStringDesc*) &TMP3334));
		}
		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):
		{
			tidentiter234141 it;
			tsym224846* e;
			memset((void*)(&it), 0, sizeof(it));
			e = initidentiter_234147((&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_196987((*n).Info, ((NimStringDesc*) &TMP3335));
					}
					LA19: ;
					rawimportsymbol_297249(c, e);
					e = nextidentiter_234156((&it), (*frommod).kindU.S3.Tab);
				} LA16: ;
			}
		}
		break;
		default:
		{
			rawimportsymbol_297249(c, s);
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(tnode224816*, evalfrom_297011)(tcontext289021* c, tnode224816* n) {
	tnode224816* result;
	tsym224846* m;
	result = 0;
	result = n;
	checkminsonslen_290425(n, 2);
	m = myimportmodule_297991(c, (*n).kindU.S6.Sons->data[0]);
	{
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[0]), newsymnode_225132(m));
		adddecl_294694(c, m);
		{
			NI i_298152;
			NI HEX3Atmp_298191;
			NI LOC6;
			NI res_298194;
			i_298152 = 0;
			HEX3Atmp_298191 = 0;
			LOC6 = 0;
			LOC6 = sonslen_225249(n);
			HEX3Atmp_298191 = (NI64)(LOC6 - 1);
			res_298194 = 1;
			{
				while (1) {
					if (!(res_298194 <= HEX3Atmp_298191)) goto LA8;
					i_298152 = res_298194;
					{
						if (!!(((*(*n).kindU.S6.Sons->data[i_298152]).Kind == ((NU8) 23)))) goto LA11;
						importsymbol_297450(c, (*n).kindU.S6.Sons->data[i_298152], m);
					}
					LA11: ;
					res_298194 += 1;
				} LA8: ;
			}
		}
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importallsymbols_297679)(tcontext289021* c, tsym224846* frommod) {
	intset221056 exceptset;
	memset((void*)(&exceptset), 0, sizeof(exceptset));
	importallsymbolsexcept_297573(c, frommod, (&exceptset));
}
NIM_EXTERNC N_NOINLINE(void, HEX00_importerInit)(void) {
}

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

