/* 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 tnode225816 tnode225816;
typedef struct tcontext290021 tcontext290021;
typedef struct intset222056 intset222056;
typedef struct ttrunk222052 ttrunk222052;
typedef struct ttrunkseq222054 ttrunkseq222054;
typedef struct TGenericSeq TGenericSeq;
typedef struct ttype225852 ttype225852;
typedef struct tlineinfo195539 tlineinfo195539;
typedef struct NimStringDesc NimStringDesc;
typedef struct tsym225846 tsym225846;
typedef struct tident200021 tident200021;
typedef struct tnodeseq225810 tnodeseq225810;
typedef struct tidobj200015 tidobj200015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct ttypeseq225848 ttypeseq225848;
typedef struct tscope225840 tscope225840;
typedef struct TY225947 TY225947;
typedef struct tinstantiation225836 tinstantiation225836;
typedef struct tstrtable225820 tstrtable225820;
typedef struct tsymseq225818 tsymseq225818;
typedef struct tloc225830 tloc225830;
typedef struct trope177009 trope177009;
typedef struct tlib225834 tlib225834;
typedef struct tcell45135 tcell45135;
typedef struct tcellseq45151 tcellseq45151;
typedef struct tgcheap47216 tgcheap47216;
typedef struct tcellset45147 tcellset45147;
typedef struct tpagedesc45143 tpagedesc45143;
typedef struct tmemregion27410 tmemregion27410;
typedef struct tsmallchunk26640 tsmallchunk26640;
typedef struct tllchunk27404 tllchunk27404;
typedef struct tbigchunk26642 tbigchunk26642;
typedef struct tintset26617 tintset26617;
typedef struct ttrunk26613 ttrunk26613;
typedef struct tavlnode27408 tavlnode27408;
typedef struct tgcstat47214 tgcstat47214;
typedef struct tpasscontext286005 tpasscontext286005;
typedef struct tproccon290011 tproccon290011;
typedef struct tlinkedlist127028 tlinkedlist127028;
typedef struct tlistentry127022 tlistentry127022;
typedef struct tidtable225864 tidtable225864;
typedef struct tidpairseq225862 tidpairseq225862;
typedef struct tidpair225860 tidpair225860;
typedef struct tctx289048 tctx289048;
typedef struct TY290133 TY290133;
typedef struct tinstantiationpair290013 tinstantiationpair290013;
typedef struct ttabiter235119 ttabiter235119;
typedef struct tidentiter235141 tidentiter235141;
typedef struct TY225936 TY225936;
typedef struct tbasechunk26638 tbasechunk26638;
typedef struct tfreecell26630 tfreecell26630;
typedef struct TY289250 TY289250;
typedef struct TY196414 TY196414;
typedef struct pprocHEX3Aobjecttype289230 pprocHEX3Aobjecttype289230;
typedef struct TY289269 TY289269;
typedef struct TY289270 TY289270;
typedef struct vmargs289042 vmargs289042;
typedef struct TY289231 TY289231;
typedef struct tblock289030 tblock289030;
typedef struct TY289211 TY289211;
typedef struct TY289237 TY289237;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  intset222056  {
NI Counter;
NI Max;
ttrunk222052* Head;
ttrunkseq222054* Data;
};
struct  tlineinfo195539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  tnode225816  {
ttype225852* Typ;
tlineinfo195539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym225846* Sym;
} S4;
struct {tident200021* Ident;
} S5;
struct {tnodeseq225810* 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  tidobj200015  {
  TNimObject Sup;
NI Id;
};
struct  tident200021  {
  tidobj200015 Sup;
NimStringDesc* S;
tident200021* Next;
NI H;
};
struct  tstrtable225820  {
NI Counter;
tsymseq225818* Data;
};
struct  tloc225830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype225852* T;
trope177009* R;
trope177009* Heaproot;
};
struct  tsym225846  {
  tidobj200015 Sup;
NU8 Kind;
union {
struct {ttypeseq225848* Typeinstcache;
tscope225840* Typscope;
} S1;
struct {TY225947* Procinstcache;
tscope225840* Scope;
} S2;
struct {TY225947* Usedgenerics;
tstrtable225820 Tab;
} S3;
struct {tsym225846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype225852* Typ;
tident200021* Name;
tlineinfo195539 Info;
tsym225846* Owner;
NU32 Flags;
tnode225816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc225830 Loc;
tlib225834* Annex;
tnode225816* Constraint;
};
struct  tcell45135  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq45151  {
NI Len;
NI Cap;
tcell45135** D;
};
struct  tcellset45147  {
NI Counter;
NI Max;
tpagedesc45143* Head;
tpagedesc45143** Data;
};
typedef tsmallchunk26640* TY27422[512];
typedef ttrunk26613* ttrunkbuckets26615[256];
struct  tintset26617  {
ttrunkbuckets26615 Data;
};
struct  tmemregion27410  {
NI Minlargeobj;
NI Maxlargeobj;
TY27422 Freesmallchunks;
tllchunk27404* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk26642* Freechunkslist;
tintset26617 Chunkstarts;
tavlnode27408* Root;
tavlnode27408* Deleted;
tavlnode27408* Last;
tavlnode27408* Freeavlnodes;
};
struct  tgcstat47214  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap47216  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq45151 Zct;
tcellseq45151 Decstack;
tcellset45147 Cycleroots;
tcellseq45151 Tempstack;
NI Recgclock;
tmemregion27410 Region;
tgcstat47214 Stat;
};
typedef N_NIMCALL_PTR(tsym225846*, TY286064) (tsym225846* m, NI32 fileidx);
struct  tpasscontext286005  {
  TNimObject Sup;
NIM_BOOL Fromcache;
};
struct  tlinkedlist127028  {
tlistentry127022* Head;
tlistentry127022* Tail;
NI Counter;
};
struct  tidpair225860  {
tidobj200015* Key;
TNimObject* Val;
};
struct  tidtable225864  {
NI Counter;
tidpairseq225862* Data;
};
typedef N_NIMCALL_PTR(tnode225816*, TY290064) (tcontext290021* c, tnode225816* n);
typedef N_NIMCALL_PTR(tnode225816*, TY290069) (tcontext290021* c, tnode225816* n, NU16 flags);
typedef N_NIMCALL_PTR(tnode225816*, TY290077) (tcontext290021* c, tnode225816* n, NU16 flags);
typedef N_NIMCALL_PTR(tnode225816*, TY290085) (tcontext290021* c, tnode225816* n);
typedef N_NIMCALL_PTR(tnode225816*, TY290090) (tcontext290021* c, tnode225816* n, NU16 flags);
typedef N_NIMCALL_PTR(tnode225816*, TY290098) (tcontext290021* c, tnode225816* n);
typedef N_NIMCALL_PTR(tnode225816*, TY290103) (tcontext290021* c, tnode225816* n, tnode225816* norig, NU32 filter);
typedef N_NIMCALL_PTR(ttype225852*, TY290110) (tcontext290021* c, tnode225816* n, ttype225852* prev);
typedef struct {
N_NIMCALL_PTR(tnode225816*, ClPrc) (tcontext290021* c, tidtable225864 pt, tnode225816* n, void* ClEnv);
void* ClEnv;
} TY290116;
typedef struct {
N_NIMCALL_PTR(tsym225846*, ClPrc) (tcontext290021* c, tsym225846* fn, tidtable225864 pt, tlineinfo195539 info, void* ClEnv);
void* ClEnv;
} TY290122;
struct  tinstantiationpair290013  {
tsym225846* Genericsym;
tinstantiation225836* Inst;
};
typedef N_NIMCALL_PTR(tsym225846*, TY290138) (tcontext290021* c, tsym225846* dc, ttype225852* t, tlineinfo195539 info);
struct  tcontext290021  {
  tpasscontext286005 Sup;
tsym225846* Module;
tscope225840* Currentscope;
tscope225840* Importtable;
tscope225840* Toplevelscope;
tproccon290011* P;
tsymseq225818* Friendmodules;
NI Instcounter;
intset222056 Ambiguoussymbols;
NI Intypeclass;
NI Ingenericcontext;
NI Inunrolledcontext;
NI Incompilescontext;
NI Ingenericinst;
tsymseq225818* Converters;
tsymseq225818* Patterns;
tlinkedlist127028 Optionstack;
tidtable225864 Symmapping;
tlinkedlist127028 Libs;
TY290064 Semconstexpr;
TY290069 Semexpr;
TY290077 Semtryexpr;
TY290085 Semtryconstexpr;
TY290090 Semoperand;
TY290098 Semconstboolexpr;
TY290103 Semoverloadedcall;
TY290110 Semtypenode;
TY290116 Seminferredlambda;
TY290122 Semgenerateinstance;
intset222056 Includedfiles;
tstrtable225820 Userpragmas;
tctx289048* Evalcontext;
intset222056 Unknownidents;
TY290133* Generics;
NI Lastgenericidx;
NI Hloloopdetector;
NI Inparallelstmt;
TY290138 Instdeepcopy;
};
struct  ttabiter235119  {
NI H;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tscope225840  {
NI Depthlevel;
tstrtable225820 Symbols;
tnodeseq225810* Usingsyms;
tscope225840* Parent;
};
struct  ttype225852  {
  tidobj200015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq225848* Sons;
tnode225816* N;
tsym225846* Owner;
tsym225846* Sym;
tsym225846* Destructor;
tsym225846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc225830 Loc;
};
struct  tidentiter235141  {
NI H;
tident200021* Name;
};
typedef NI TY26620[8];
struct  ttrunk222052  {
ttrunk222052* Next;
NI Key;
TY26620 Bits;
};
struct  tinstantiation225836  {
tsym225846* Sym;
ttypeseq225848* Concretetypes;
TY225936* Usedby;
};
struct  trope177009  {
  TNimObject Sup;
trope177009* Left;
trope177009* Right;
NI Length;
NimStringDesc* Data;
};
struct  tlistentry127022  {
  TNimObject Sup;
tlistentry127022* Prev;
tlistentry127022* Next;
};
struct  tlib225834  {
  tlistentry127022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope177009* Name;
tnode225816* Path;
};
struct  tpagedesc45143  {
tpagedesc45143* Next;
NI Key;
TY26620 Bits;
};
struct  tbasechunk26638  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk26640  {
  tbasechunk26638 Sup;
tsmallchunk26640* Next;
tsmallchunk26640* Prev;
tfreecell26630* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk27404  {
NI Size;
NI Acc;
tllchunk27404* Next;
};
struct  tbigchunk26642  {
  tbasechunk26638 Sup;
tbigchunk26642* Next;
tbigchunk26642* Prev;
NI Align;
NF Data;
};
struct  ttrunk26613  {
ttrunk26613* Next;
NI Key;
TY26620 Bits;
};
typedef tavlnode27408* TY27414[2];
struct  tavlnode27408  {
TY27414 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  tproccon290011  {
tsym225846* Owner;
tsym225846* Resultsym;
NI Nestedloopcounter;
NI Nestedblockcounter;
NI Intrystmt;
tproccon290011* Next;
};
struct  vmargs289042  {
NI Ra;
NI Rb;
NI Rc;
void* Slots;
tnode225816* Currentexception;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (vmargs289042* args, void* ClEnv);
void* ClEnv;
} vmcallback289044;
struct TY289270 {
NimStringDesc* Field0;
vmcallback289044 Field1;
};
struct  tctx289048  {
  tpasscontext286005 Sup;
TY289250* Code;
TY196414* Debug;
tnode225816* Globals;
tnode225816* Constants;
ttypeseq225848* Types;
tnode225816* Currentexceptiona;
tnode225816* Currentexceptionb;
NI Exceptioninstr;
pprocHEX3Aobjecttype289230* Prc;
tsym225846* Module;
tnode225816* Callsite;
NU8 Mode;
NU8 Features;
NIM_BOOL Traceactive;
NI Loopiterations;
tlineinfo195539 Comesfromheuristic;
TY289269* Callbacks;
NimStringDesc* Errorflag;
};
struct  tfreecell26630  {
tfreecell26630* Next;
NI Zerofield;
};
struct  tblock289030  {
tsym225846* Label;
TY289211* Fixups;
};
struct TY289237 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY289237 TY289234[256];
struct  pprocHEX3Aobjecttype289230  {
TY289231* Blocks;
tsym225846* Sym;
TY289234 Slots;
NI Maxslots;
};
struct ttrunkseq222054 {
  TGenericSeq Sup;
  ttrunk222052* data[SEQ_DECL_SIZE];
};
struct tnodeseq225810 {
  TGenericSeq Sup;
  tnode225816* data[SEQ_DECL_SIZE];
};
struct ttypeseq225848 {
  TGenericSeq Sup;
  ttype225852* data[SEQ_DECL_SIZE];
};
struct TY225947 {
  TGenericSeq Sup;
  tinstantiation225836* data[SEQ_DECL_SIZE];
};
struct tsymseq225818 {
  TGenericSeq Sup;
  tsym225846* data[SEQ_DECL_SIZE];
};
struct tidpairseq225862 {
  TGenericSeq Sup;
  tidpair225860 data[SEQ_DECL_SIZE];
};
struct TY290133 {
  TGenericSeq Sup;
  tinstantiationpair290013 data[SEQ_DECL_SIZE];
};
struct TY225936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY289250 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY196414 {
  TGenericSeq Sup;
  tlineinfo195539 data[SEQ_DECL_SIZE];
};
struct TY289269 {
  TGenericSeq Sup;
  TY289270 data[SEQ_DECL_SIZE];
};
struct TY289211 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
struct TY289231 {
  TGenericSeq Sup;
  tblock289030 data[SEQ_DECL_SIZE];
};
static N_INLINE(NI, sonslen_226249)(tnode225816* n);
N_NIMCALL(tsym225846*, myimportmodule_298991)(tcontext290021* c, tnode225816* n);
N_NIMCALL(NI32, checkmodulename_298237)(tnode225816* n);
N_NIMCALL(NimStringDesc*, getmodulename_298018)(tnode225816* n);
N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(tident200021*, getident_200472)(NimStringDesc* identifier);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(tcell45135*, usrtocell_48846)(void* usr);
static N_INLINE(void, rtladdzct_50404)(tcell45135* c);
N_NOINLINE(void, addzct_48817)(tcellseq45151* s, tcell45135* 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_250058)(tnode225816* n, NU8 renderflags);
N_NIMCALL(void, localerror_197955)(tlineinfo195539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, findmodule_170366)(NimStringDesc* modulename, NimStringDesc* currentmodule);
N_NIMCALL(NimStringDesc*, tofullpath_197037)(NI32 fileidx);
N_NIMCALL(NI32, fileinfoidx_195747)(NimStringDesc* filename);
N_NIMCALL(tsym225846*, importmoduleas_298892)(tnode225816* n, tsym225846* realmodule);
static N_INLINE(NI, len_226364)(tnode225816* n);
N_NIMCALL(tsym225846*, createmodulealias_229287)(tsym225846* s, tident200021* newident, tlineinfo195539 info);
N_NIMCALL(void, message_197976)(tlineinfo195539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, adddecl_295694)(tcontext290021* c, tsym225846* sym);
N_NIMCALL(void, importallsymbolsexcept_298573)(tcontext290021* c, tsym225846* frommod, intset222056* exceptset);
N_NIMCALL(tsym225846*, inittabiter_235124)(ttabiter235119* ti, tstrtable225820 tab);
N_NIMCALL(void, internalerror_197987)(tlineinfo195539 info, NimStringDesc* errmsg);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_81107, TNimType* typ);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(NIM_BOOL, empty_223383)(intset222056* s);
N_NIMCALL(NIM_BOOL, contains_222837)(intset222056* s, NI key);
N_NIMCALL(void, rawimportsymbol_298249)(tcontext290021* c, tsym225846* s);
N_NIMCALL(tsym225846*, strtableget_235111)(tstrtable225820 t, tident200021* name);
N_NIMCALL(void, incl_222869)(intset222056* s, NI key);
N_NIMCALL(void, strtableadd_235103)(tstrtable225820* t, tsym225846* n);
N_NIMCALL(tsym225846*, initidentiter_235147)(tidentiter235141* ti, tstrtable225820 tab, tident200021* s);
N_NIMCALL(tsym225846*, nextidentiter_235156)(tidentiter235141* ti, tstrtable225820 tab);
N_NIMCALL(void, addconverter_290634)(tcontext290021* c, tsym225846* conv);
static N_INLINE(NIM_BOOL, haspattern_232804)(tsym225846* s);
static N_INLINE(NIM_BOOL, isroutine_232781)(tsym225846* s);
N_NIMCALL(void, addpattern_290645)(tcontext290021* c, tsym225846* p);
N_NIMCALL(tsym225846*, nextiter_235132)(ttabiter235119* ti, tstrtable225820 tab);
N_NIMCALL(void, checkminsonslen_291425)(tnode225816* n, NI length);
N_NIMCALL(tnode225816*, newsymnode_226132)(tsym225846* sym);
N_NIMCALL(void, initintset_222950)(intset222056* Result);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(tident200021*, considerquotedident_295010)(tnode225816* n);
N_NIMCALL(void, importsymbol_298450)(tcontext290021* c, tnode225816* n, tsym225846* frommod);
N_NIMCALL(void, loadstub_279260)(tsym225846* s);
STRING_LITERAL(TMP3320, "", 0);
STRING_LITERAL(TMP3321, "as", 2);
STRING_LITERAL(TMP3322, " ", 1);
STRING_LITERAL(TMP3323, ".", 1);
STRING_LITERAL(TMP3324, "/", 1);
STRING_LITERAL(TMP3325, "invalid module name: \'$1\'", 25);
STRING_LITERAL(TMP3326, "module alias must be an identifier", 34);
STRING_LITERAL(TMP3327, "A module cannot import itself", 29);
STRING_LITERAL(TMP3328, "importAllSymbols: ", 18);
STRING_LITERAL(TMP3329, "rawImportSymbol", 15);
STRING_LITERAL(TMP3331, "importSymbol: 2", 15);
STRING_LITERAL(TMP3332, "importSymbol: 3", 15);
extern tgcheap47216 gch_47244;
extern TY286064 gimportmodule_286068;
extern TNimType NTI225445; /* TSymKind */

static N_INLINE(NI, sonslen_226249)(tnode225816* 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(tcell45135*, usrtocell_48846)(void* usr) {
	tcell45135* result;
	result = 0;
	result = ((tcell45135*) ((NI)((NU64)(((NI) (usr))) - (NU64)(((NI)sizeof(tcell45135))))));
	return result;
}

static N_INLINE(void, rtladdzct_50404)(tcell45135* c) {
	addzct_48817((&gch_47244.Zct), c);
}

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

N_NIMCALL(NimStringDesc*, getmodulename_298018)(tnode225816* n) {
	NimStringDesc* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		result = nosunixToNativePath((*n).kindU.S3.Strval, ((NimStringDesc*) &TMP3320));
	}
	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;
			tident200021* LOC9;
			LOC7 = 0;
			LOC7 = ((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 2));
			if (!(LOC7)) goto LA8;
			LOC9 = 0;
			LOC9 = getident_200472(((NimStringDesc*) &TMP3321));
			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 = (tnodeseq225810*) setLengthSeq(&((*n).kindU.S6.Sons)->Sup, sizeof(tnode225816*), 2);
			result = getmodulename_298018((*n).kindU.S6.Sons->data[0]);
			goto BeforeRet;
		}
		LA10: ;
		LOC12 = 0;
		LOC12 = rendertree_250058(n, 4);
		result = nsuReplaceStr(LOC12, ((NimStringDesc*) &TMP3322), ((NimStringDesc*) &TMP3320));
	}
	break;
	case ((NU8) 45):
	{
		NimStringDesc* LOC14;
		LOC14 = 0;
		LOC14 = rendertree_250058(n, 4);
		result = nsuReplaceStr(LOC14, ((NimStringDesc*) &TMP3323), ((NimStringDesc*) &TMP3324));
	}
	break;
	case ((NU8) 78):
	{
		result = getmodulename_298018((*n).kindU.S6.Sons->data[0]);
	}
	break;
	default:
	{
		NimStringDesc* LOC17;
		NimStringDesc* LOC18;
		LOC17 = 0;
		LOC17 = rendertree_250058(n, 0);
		LOC18 = 0;
		LOC18 = nsuFormatSingleElem(((NimStringDesc*) &TMP3325), LOC17);
		localerror_197955((*n).Info, ((NU16) 4), LOC18);
		result = copyString(((NimStringDesc*) &TMP3320));
	}
	break;
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(NI32, checkmodulename_298237)(tnode225816* n) {
	NI32 result;
	NimStringDesc* modulename;
	NimStringDesc* fullpath;
	NimStringDesc* LOC1;
	result = 0;
	modulename = getmodulename_298018(n);
	LOC1 = 0;
	LOC1 = tofullpath_197037((*n).Info.Fileindex);
	fullpath = findmodule_170366(modulename, LOC1);
	{
		if (!(fullpath->Sup.len == 0)) goto LA4;
		localerror_197955((*n).Info, ((NU16) 3), modulename);
		result = ((NI32) -1);
	}
	goto LA2;
	LA4: ;
	{
		result = fileinfoidx_195747(fullpath);
	}
	LA2: ;
	return result;
}

static N_INLINE(NI, len_226364)(tnode225816* 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(tsym225846*, importmoduleas_298892)(tnode225816* n, tsym225846* realmodule) {
	tsym225846* 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_226364(n);
		LOC6 = !((LOC7 == 2));
		if (LOC6) goto LA8;
		LOC6 = !(((*(*n).kindU.S6.Sons->data[1]).Kind == ((NU8) 2)));
		LA8: ;
		if (!LOC6) goto LA9;
		localerror_197955((*n).Info, ((NU16) 4), ((NimStringDesc*) &TMP3326));
	}
	goto LA1;
	LA9: ;
	{
		if (!!(((*(*(*n).kindU.S6.Sons->data[1]).kindU.S5.Ident).Sup.Id == (*(*realmodule).Name).Sup.Id))) goto LA12;
		result = createmodulealias_229287(realmodule, (*(*n).kindU.S6.Sons->data[1]).kindU.S5.Ident, (*realmodule).Info);
	}
	goto LA1;
	LA12: ;
	LA1: ;
	return result;
}

N_NIMCALL(tsym225846*, myimportmodule_298991)(tcontext290021* c, tnode225816* n) {
	tsym225846* result;
	NI32 f;
	result = 0;
	f = checkmodulename_298237(n);
	{
		tsym225846* LOC5;
		if (!!((f == ((NI32) -1)))) goto LA3;
		LOC5 = 0;
		LOC5 = gimportmodule_286068((*c).Module, f);
		result = importmoduleas_298892(n, LOC5);
		{
			if (!((*result).Info.Fileindex == (*n).Info.Fileindex)) goto LA8;
			localerror_197955((*n).Info, ((NU16) 4), ((NimStringDesc*) &TMP3327));
		}
		LA8: ;
		{
			if (!(((*result).Flags &(1<<((((NU8) 19))&31)))!=0)) goto LA12;
			message_197976((*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_223383)(intset222056* s) {
	NIM_BOOL result;
	result = 0;
	result = ((*s).Counter == 0);
	return result;
}

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

static N_INLINE(NIM_BOOL, haspattern_232804)(tsym225846* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = isroutine_232781(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_298249)(tcontext290021* c, tsym225846* s) {
	tsym225846* 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_222869((&(*c).Ambiguoussymbols), (*s).Sup.Id);
			incl_222869((&(*c).Ambiguoussymbols), (*check).Sup.Id);
		}
		LA9: ;
	}
	LA5: ;
	strtableadd_235103((&(*(*c).Importtable).Symbols), s);
	{
		ttype225852* 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_298336;
				NI HEX3Atmp_298424;
				NI LOC22;
				NI res_298427;
				j_298336 = 0;
				HEX3Atmp_298424 = 0;
				LOC22 = 0;
				LOC22 = sonslen_226249((*etyp).N);
				HEX3Atmp_298424 = (NI64)(LOC22 - 1);
				res_298427 = 0;
				{
					while (1) {
						tsym225846* e;
						tidentiter235141 it;
						if (!(res_298427 <= HEX3Atmp_298424)) goto LA24;
						j_298336 = res_298427;
						e = (*(*(*etyp).N).kindU.S6.Sons->data[j_298336]).kindU.S4.Sym;
						{
							if (!!(((*e).Kind == ((NU8) 20)))) goto LA27;
							internalerror_197987((*s).Info, ((NimStringDesc*) &TMP3329));
						}
						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_298249(c, e);
						}
						LA37: ;
						res_298427 += 1;
					} LA24: ;
				}
			}
		}
		LA19: ;
	}
	goto LA11;
	LA13: ;
	{
		{
			if (!((*s).Kind == ((NU8) 16))) goto LA42;
			addconverter_290634(c, s);
		}
		LA42: ;
		{
			NIM_BOOL LOC46;
			LOC46 = 0;
			LOC46 = haspattern_232804(s);
			if (!LOC46) goto LA47;
			addpattern_290645(c, s);
		}
		LA47: ;
	}
	LA11: ;
}

N_NIMCALL(void, importallsymbolsexcept_298573)(tcontext290021* c, tsym225846* frommod, intset222056* exceptset) {
	ttabiter235119 i;
	tsym225846* 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, (&NTI225445))->Sup.len + 18);
appendString(LOC15, ((NimStringDesc*) &TMP3328));
appendString(LOC15, reprEnum((*s).Kind, (&NTI225445)));
						internalerror_197987((*s).Info, LOC15);
					}
					LA13: ;
					{
						NIM_BOOL LOC18;
						NIM_BOOL LOC20;
						LOC18 = 0;
						LOC18 = empty_223383(exceptset);
						if (LOC18) goto LA19;
						LOC20 = 0;
						LOC20 = contains_222837(exceptset, (*(*s).Name).Sup.Id);
						LOC18 = !(LOC20);
						LA19: ;
						if (!LOC18) goto LA21;
						rawimportsymbol_298249(c, s);
					}
					LA21: ;
				}
				LA9: ;
			}
			LA5: ;
			s = nextiter_235132((&i), (*frommod).kindU.S3.Tab);
		} LA2: ;
	}
}

N_NIMCALL(tnode225816*, evalimport_298004)(tcontext290021* c, tnode225816* n) {
	tnode225816* result;
	intset222056 emptyset;
	result = 0;
	result = n;
	memset((void*)(&emptyset), 0, sizeof(emptyset));
	{
		NI i_299034;
		NI HEX3Atmp_299069;
		NI LOC2;
		NI res_299072;
		i_299034 = 0;
		HEX3Atmp_299069 = 0;
		LOC2 = 0;
		LOC2 = sonslen_226249(n);
		HEX3Atmp_299069 = (NI64)(LOC2 - 1);
		res_299072 = 0;
		{
			while (1) {
				tsym225846* m;
				if (!(res_299072 <= HEX3Atmp_299069)) goto LA4;
				i_299034 = res_299072;
				m = myimportmodule_298991(c, (*n).kindU.S6.Sons->data[i_299034]);
				{
					if (!!((m == NIM_NIL))) goto LA7;
					adddecl_295694(c, m);
					importallsymbolsexcept_298573(c, m, (&emptyset));
				}
				LA7: ;
				res_299072 += 1;
			} LA4: ;
		}
	}
	return result;
}

N_NIMCALL(tnode225816*, evalimportexcept_299211)(tcontext290021* c, tnode225816* n) {
	tnode225816* result;
	tsym225846* m;
	result = 0;
	result = n;
	checkminsonslen_291425(n, 2);
	m = myimportmodule_298991(c, (*n).kindU.S6.Sons->data[0]);
	{
		intset222056 exceptset;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[0]), newsymnode_226132(m));
		adddecl_295694(c, m);
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		chckNil((void*)(&exceptset));
		memset((void*)(&exceptset), 0, sizeof(exceptset));
		initintset_222950((&exceptset));
		{
			NI i_299275;
			NI HEX3Atmp_299293;
			NI LOC6;
			NI res_299296;
			i_299275 = 0;
			HEX3Atmp_299293 = 0;
			LOC6 = 0;
			LOC6 = sonslen_226249(n);
			HEX3Atmp_299293 = (NI64)(LOC6 - 1);
			res_299296 = 1;
			{
				while (1) {
					tident200021* ident;
					if (!(res_299296 <= HEX3Atmp_299293)) goto LA8;
					i_299275 = res_299296;
					ident = considerquotedident_295010((*n).kindU.S6.Sons->data[i_299275]);
					incl_222869((&exceptset), (*ident).Sup.Id);
					res_299296 += 1;
				} LA8: ;
			}
		}
		importallsymbolsexcept_298573(c, m, (&exceptset));
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importsymbol_298450)(tcontext290021* c, tnode225816* n, tsym225846* frommod) {
	tident200021* ident;
	tsym225846* s;
	ident = considerquotedident_295010(n);
	s = strtableget_235111((*frommod).kindU.S3.Tab, ident);
	{
		if (!(s == NIM_NIL)) goto LA3;
		localerror_197955((*n).Info, ((NU16) 61), (*ident).S);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((*s).Kind == ((NU8) 23))) goto LA8;
			loadstub_279260(s);
		}
		LA8: ;
		{
			if (!!(((43513728 &(1<<(((*s).Kind)&31)))!=0))) goto LA12;
			internalerror_197987((*n).Info, ((NimStringDesc*) &TMP3331));
		}
		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;
			tsym225846* 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_197987((*n).Info, ((NimStringDesc*) &TMP3332));
					}
					LA19: ;
					rawimportsymbol_298249(c, e);
					e = nextidentiter_235156((&it), (*frommod).kindU.S3.Tab);
				} LA16: ;
			}
		}
		break;
		default:
		{
			rawimportsymbol_298249(c, s);
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(tnode225816*, evalfrom_298011)(tcontext290021* c, tnode225816* n) {
	tnode225816* result;
	tsym225846* m;
	result = 0;
	result = n;
	checkminsonslen_291425(n, 2);
	m = myimportmodule_298991(c, (*n).kindU.S6.Sons->data[0]);
	{
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) (&(*n).kindU.S6.Sons->data[0]), newsymnode_226132(m));
		adddecl_295694(c, m);
		{
			NI i_299152;
			NI HEX3Atmp_299191;
			NI LOC6;
			NI res_299194;
			i_299152 = 0;
			HEX3Atmp_299191 = 0;
			LOC6 = 0;
			LOC6 = sonslen_226249(n);
			HEX3Atmp_299191 = (NI64)(LOC6 - 1);
			res_299194 = 1;
			{
				while (1) {
					if (!(res_299194 <= HEX3Atmp_299191)) goto LA8;
					i_299152 = res_299194;
					{
						if (!!(((*(*n).kindU.S6.Sons->data[i_299152]).Kind == ((NU8) 23)))) goto LA11;
						importsymbol_298450(c, (*n).kindU.S6.Sons->data[i_299152], m);
					}
					LA11: ;
					res_299194 += 1;
				} LA8: ;
			}
		}
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importallsymbols_298679)(tcontext290021* c, tsym225846* frommod) {
	intset222056 exceptset;
	memset((void*)(&exceptset), 0, sizeof(exceptset));
	importallsymbolsexcept_298573(c, frommod, (&exceptset));
}
NIM_EXTERNC N_NOINLINE(void, HEX00_importerInit)(void) {
}

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

