/* Generated by Nimrod Compiler v0.9.5 */
/*   (c) 2014 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, i386, gcc */
/* Command for C compiler:
   gcc -c  -w -O3 -fno-strict-aliasing  -I/build/nimrod/src/nimrod/lib -o compiler/nimcache/importer.o compiler/nimcache/importer.c */
#define NIM_INTBITS 32
#include "nimbase.h"

#include <string.h>
typedef struct tnode188803 tnode188803;
typedef struct tcontext250019 tcontext250019;
typedef struct tintset185047 tintset185047;
typedef struct ttrunk185043 ttrunk185043;
typedef struct ttrunkseq185045 ttrunkseq185045;
typedef struct TGenericSeq TGenericSeq;
typedef struct ttype188837 ttype188837;
typedef struct tlineinfo163527 tlineinfo163527;
typedef struct NimStringDesc NimStringDesc;
typedef struct tsym188833 tsym188833;
typedef struct tident167019 tident167019;
typedef struct tnodeseq188797 tnodeseq188797;
typedef struct tidobj167013 tidobj167013;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct ttypeseq188835 ttypeseq188835;
typedef struct tscope188827 tscope188827;
typedef struct TY188933 TY188933;
typedef struct tinstantiation188823 tinstantiation188823;
typedef struct tstrtable188807 tstrtable188807;
typedef struct tsymseq188805 tsymseq188805;
typedef struct tloc188817 tloc188817;
typedef struct trope145007 trope145007;
typedef struct tlib188821 tlib188821;
typedef struct tcell41090 tcell41090;
typedef struct tcellseq41106 tcellseq41106;
typedef struct tgcheap43016 tgcheap43016;
typedef struct tcellset41102 tcellset41102;
typedef struct tpagedesc41098 tpagedesc41098;
typedef struct tmemregion23410 tmemregion23410;
typedef struct tsmallchunk22638 tsmallchunk22638;
typedef struct tllchunk23404 tllchunk23404;
typedef struct tbigchunk22640 tbigchunk22640;
typedef struct tintset22615 tintset22615;
typedef struct ttrunk22611 ttrunk22611;
typedef struct tavlnode23408 tavlnode23408;
typedef struct tgcstat43014 tgcstat43014;
typedef struct tpasscontext246003 tpasscontext246003;
typedef struct tproccon250009 tproccon250009;
typedef struct tlinkedlist118023 tlinkedlist118023;
typedef struct tlistentry118017 tlistentry118017;
typedef struct tidtable188849 tidtable188849;
typedef struct tidpairseq188847 tidpairseq188847;
typedef struct tidpair188845 tidpair188845;
typedef struct tctx249037 tctx249037;
typedef struct TY250131 TY250131;
typedef struct tinstantiationpair250011 tinstantiationpair250011;
typedef struct ttabiter197090 ttabiter197090;
typedef struct tidentiter197106 tidentiter197106;
typedef struct TY188922 TY188922;
typedef struct tbasechunk22636 tbasechunk22636;
typedef struct tfreecell22628 tfreecell22628;
typedef struct TY249229 TY249229;
typedef struct TY164208 TY164208;
typedef struct pprocHEX3Aobjecttype249216 pprocHEX3Aobjecttype249216;
typedef struct TY249217 TY249217;
typedef struct tblock249023 tblock249023;
typedef struct TY249198 TY249198;
typedef struct TY249223 TY249223;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  tintset185047  {
NI Counter;
NI Max;
ttrunk185043* Head;
ttrunkseq185045* Data;
};
struct  tlineinfo163527  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  tnode188803  {
ttype188837* Typ;
tlineinfo163527 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym188833* Sym;
} S4;
struct {tident167019* Ident;
} S5;
struct {tnodeseq188797* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
typedef N_NIMCALL_PTR(void, TY2289) (void* p, NI op);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY2289 marker;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  tidobj167013  {
  TNimObject Sup;
NI Id;
};
struct  tident167019  {
  tidobj167013 Sup;
NimStringDesc* S;
tident167019* Next;
NI H;
};
struct  tstrtable188807  {
NI Counter;
tsymseq188805* Data;
};
struct  tloc188817  {
NU8 K;
NU8 S;
NU8 Flags;
ttype188837* T;
trope145007* R;
trope145007* Heaproot;
NI A;
};
struct  tsym188833  {
  tidobj167013 Sup;
NU8 Kind;
union {
struct {ttypeseq188835* Typeinstcache;
tscope188827* Typscope;
} S1;
struct {TY188933* Procinstcache;
tscope188827* Scope;
} S2;
struct {TY188933* Usedgenerics;
tstrtable188807 Tab;
} S3;
} kindU;
NU16 Magic;
ttype188837* Typ;
tident167019* Name;
tlineinfo163527 Info;
tsym188833* Owner;
NU32 Flags;
tnode188803* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc188817 Loc;
tlib188821* Annex;
tnode188803* Constraint;
};
struct  tcell41090  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq41106  {
NI Len;
NI Cap;
tcell41090** D;
};
struct  tcellset41102  {
NI Counter;
NI Max;
tpagedesc41098* Head;
tpagedesc41098** Data;
};
typedef tsmallchunk22638* TY23422[512];
typedef ttrunk22611* ttrunkbuckets22613[256];
struct  tintset22615  {
ttrunkbuckets22613 Data;
};
struct  tmemregion23410  {
NI Minlargeobj;
NI Maxlargeobj;
TY23422 Freesmallchunks;
tllchunk23404* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk22640* Freechunkslist;
tintset22615 Chunkstarts;
tavlnode23408* Root;
tavlnode23408* Deleted;
tavlnode23408* Last;
tavlnode23408* Freeavlnodes;
};
struct  tgcstat43014  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap43016  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq41106 Zct;
tcellseq41106 Decstack;
tcellset41102 Cycleroots;
tcellseq41106 Tempstack;
NI Recgclock;
tmemregion23410 Region;
tgcstat43014 Stat;
};
typedef N_NIMCALL_PTR(tsym188833*, TY246056) (tsym188833* m, NI32 fileidx);
struct  tpasscontext246003  {
  TNimObject Sup;
NIM_BOOL Fromcache;
};
struct  tlinkedlist118023  {
tlistentry118017* Head;
tlistentry118017* Tail;
NI Counter;
};
struct  tidpair188845  {
tidobj167013* Key;
TNimObject* Val;
};
struct  tidtable188849  {
NI Counter;
tidpairseq188847* Data;
};
typedef N_NIMCALL_PTR(tnode188803*, TY250061) (tcontext250019* c, tnode188803* n);
typedef N_NIMCALL_PTR(tnode188803*, TY250066) (tcontext250019* c, tnode188803* n, NU16 flags);
typedef N_NIMCALL_PTR(tnode188803*, TY250074) (tcontext250019* c, tnode188803* n, NU16 flags, NIM_BOOL buffererrors);
typedef N_NIMCALL_PTR(tnode188803*, TY250083) (tcontext250019* c, tnode188803* n);
typedef N_NIMCALL_PTR(tnode188803*, TY250088) (tcontext250019* c, tnode188803* n, NU16 flags);
typedef N_NIMCALL_PTR(tnode188803*, TY250096) (tcontext250019* c, tnode188803* n);
typedef N_NIMCALL_PTR(tnode188803*, TY250101) (tcontext250019* c, tnode188803* n, tnode188803* norig, NU32 filter);
typedef N_NIMCALL_PTR(ttype188837*, TY250108) (tcontext250019* c, tnode188803* n, ttype188837* prev);
typedef struct {
N_NIMCALL_PTR(tnode188803*, ClPrc) (tcontext250019* c, tidtable188849 pt, tnode188803* n, void* ClEnv);
void* ClEnv;
} TY250114;
typedef struct {
N_NIMCALL_PTR(tsym188833*, ClPrc) (tcontext250019* c, tsym188833* fn, tidtable188849 pt, tlineinfo163527 info, void* ClEnv);
void* ClEnv;
} TY250120;
struct  tinstantiationpair250011  {
tsym188833* Genericsym;
tinstantiation188823* Inst;
};
struct  tcontext250019  {
  tpasscontext246003 Sup;
tsym188833* Module;
tscope188827* Currentscope;
tscope188827* Importtable;
tscope188827* Toplevelscope;
tproccon250009* P;
tsym188833* Friendmodule;
NI Instcounter;
tintset185047 Ambiguoussymbols;
NI Intypeclass;
NI Ingenericcontext;
NI Inunrolledcontext;
NI Incompilescontext;
NI Ingenericinst;
tsymseq188805* Converters;
tsymseq188805* Patterns;
tlinkedlist118023 Optionstack;
tidtable188849 Symmapping;
tlinkedlist118023 Libs;
TY250061 Semconstexpr;
TY250066 Semexpr;
TY250074 Semtryexpr;
TY250083 Semtryconstexpr;
TY250088 Semoperand;
TY250096 Semconstboolexpr;
TY250101 Semoverloadedcall;
TY250108 Semtypenode;
TY250114 Seminferredlambda;
TY250120 Semgenerateinstance;
tintset185047 Includedfiles;
tstrtable188807 Userpragmas;
tctx249037* Evalcontext;
tintset185047 Unknownidents;
TY250131* Generics;
NI Lastgenericidx;
NI Hloloopdetector;
};
struct  ttabiter197090  {
NI H;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tscope188827  {
NI Depthlevel;
tstrtable188807 Symbols;
tnodeseq188797* Usingsyms;
tscope188827* Parent;
};
struct  ttype188837  {
  tidobj167013 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq188835* Sons;
tnode188803* N;
tsym188833* Destructor;
tsym188833* Owner;
tsym188833* Sym;
NI64 Size;
NI Align;
tloc188817 Loc;
};
struct  tidentiter197106  {
NI H;
tident167019* Name;
};
typedef NI TY22618[16];
struct  ttrunk185043  {
ttrunk185043* Next;
NI Key;
TY22618 Bits;
};
struct  tinstantiation188823  {
tsym188833* Sym;
ttypeseq188835* Concretetypes;
TY188922* Usedby;
};
struct  trope145007  {
  TNimObject Sup;
trope145007* Left;
trope145007* Right;
NI Length;
NimStringDesc* Data;
};
struct  tlistentry118017  {
  TNimObject Sup;
tlistentry118017* Prev;
tlistentry118017* Next;
};
struct  tlib188821  {
  tlistentry118017 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope145007* Name;
tnode188803* Path;
};
struct  tpagedesc41098  {
tpagedesc41098* Next;
NI Key;
TY22618 Bits;
};
struct  tbasechunk22636  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk22638  {
  tbasechunk22636 Sup;
tsmallchunk22638* Next;
tsmallchunk22638* Prev;
tfreecell22628* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk23404  {
NI Size;
NI Acc;
tllchunk23404* Next;
};
struct  tbigchunk22640  {
  tbasechunk22636 Sup;
tbigchunk22640* Next;
tbigchunk22640* Prev;
NI Align;
NF Data;
};
struct  ttrunk22611  {
ttrunk22611* Next;
NI Key;
TY22618 Bits;
};
typedef tavlnode23408* TY23414[2];
struct  tavlnode23408  {
TY23414 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  tproccon250009  {
tsym188833* Owner;
tsym188833* Resultsym;
NI Nestedloopcounter;
NI Nestedblockcounter;
NI Intrystmt;
tproccon250009* Next;
};
struct  tctx249037  {
  tpasscontext246003 Sup;
TY249229* Code;
TY164208* Debug;
tnode188803* Globals;
tnode188803* Constants;
ttypeseq188835* Types;
tnode188803* Currentexceptiona;
tnode188803* Currentexceptionb;
NI Exceptioninstr;
pprocHEX3Aobjecttype249216* Prc;
tsym188833* Module;
tnode188803* Callsite;
NU8 Mode;
NU8 Features;
NIM_BOOL Traceactive;
NI Loopiterations;
};
struct  tfreecell22628  {
tfreecell22628* Next;
NI Zerofield;
};
struct  tblock249023  {
tsym188833* Label;
TY249198* Fixups;
};
struct TY249223 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY249223 TY249220[256];
struct  pprocHEX3Aobjecttype249216  {
TY249217* Blocks;
tsym188833* Sym;
TY249220 Slots;
NI Maxslots;
};
struct ttrunkseq185045 {
  TGenericSeq Sup;
  ttrunk185043* data[SEQ_DECL_SIZE];
};
struct tnodeseq188797 {
  TGenericSeq Sup;
  tnode188803* data[SEQ_DECL_SIZE];
};
struct ttypeseq188835 {
  TGenericSeq Sup;
  ttype188837* data[SEQ_DECL_SIZE];
};
struct TY188933 {
  TGenericSeq Sup;
  tinstantiation188823* data[SEQ_DECL_SIZE];
};
struct tsymseq188805 {
  TGenericSeq Sup;
  tsym188833* data[SEQ_DECL_SIZE];
};
struct tidpairseq188847 {
  TGenericSeq Sup;
  tidpair188845 data[SEQ_DECL_SIZE];
};
struct TY250131 {
  TGenericSeq Sup;
  tinstantiationpair250011 data[SEQ_DECL_SIZE];
};
struct TY188922 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY249229 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY164208 {
  TGenericSeq Sup;
  tlineinfo163527 data[SEQ_DECL_SIZE];
};
struct TY249198 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
struct TY249217 {
  TGenericSeq Sup;
  tblock249023 data[SEQ_DECL_SIZE];
};
static N_INLINE(NI, sonslen_189181)(tnode188803* n);
N_NIMCALL(tsym188833*, myimportmodule_255973)(tcontext250019* c, tnode188803* n);
N_NIMCALL(NI32, checkmodulename_255227)(tnode188803* n);
N_NIMCALL(NimStringDesc*, getmodulename_255012)(tnode188803* n);
N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(tident167019*, getident_167456)(NimStringDesc* identifier);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(tcell41090*, usrtocell_44443)(void* usr);
static N_INLINE(void, rtladdzct_46002)(tcell41090* c);
N_NOINLINE(void, addzct_44418)(tcellseq41106* s, tcell41090* 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_211051)(tnode188803* n, NU8 renderflags);
N_NIMCALL(void, localerror_165571)(tlineinfo163527 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, findmodule_138312)(NimStringDesc* modulename, NimStringDesc* currentmodule);
N_NIMCALL(NimStringDesc*, tofullpath_164788)(NI32 fileidx);
N_NIMCALL(NI32, fileinfoidx_163721)(NimStringDesc* filename);
N_NIMCALL(tsym188833*, importmoduleas_255864)(tnode188803* n, tsym188833* realmodule);
static N_INLINE(NI, len_189264)(tnode188803* n);
N_NIMCALL(tsym188833*, createmodulealias_191841)(tsym188833* s, tident167019* newident, tlineinfo163527 info);
N_NIMCALL(void, message_165584)(tlineinfo163527 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, adddecl_252550)(tcontext250019* c, tsym188833* sym);
N_NIMCALL(void, importallsymbolsexcept_255529)(tcontext250019* c, tsym188833* frommod, tintset185047 exceptset);
N_NIMCALL(tsym188833*, inittabiter_197093)(ttabiter197090* ti, tstrtable188807 tab);
N_NIMCALL(void, internalerror_165591)(tlineinfo163527 info, NimStringDesc* errmsg);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_75880, TNimType* typ);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(NIM_BOOL, empty_186325)(tintset185047 s);
N_NIMCALL(NIM_BOOL, contains_185821)(tintset185047 s, NI key);
N_NIMCALL(void, rawimportsymbol_255235)(tcontext250019* c, tsym188833* s);
N_NIMCALL(tsym188833*, strtableget_197084)(tstrtable188807 t, tident167019* name);
N_NIMCALL(void, incl_185849)(tintset185047* s, NI key);
N_NIMCALL(void, strtableadd_197078)(tstrtable188807* t, tsym188833* n);
N_NIMCALL(tsym188833*, initidentiter_197110)(tidentiter197106* ti, tstrtable188807 tab, tident167019* s);
N_NIMCALL(tsym188833*, nextidentiter_197117)(tidentiter197106* ti, tstrtable188807 tab);
N_NIMCALL(void, addconverter_250523)(tcontext250019* c, tsym188833* conv);
static N_INLINE(NIM_BOOL, haspattern_195059)(tsym188833* s);
static N_INLINE(NIM_BOOL, isroutine_195040)(tsym188833* s);
N_NIMCALL(void, addpattern_250530)(tcontext250019* c, tsym188833* p);
N_NIMCALL(tsym188833*, nextiter_197099)(ttabiter197090* ti, tstrtable188807 tab);
N_NIMCALL(void, importforwarded_255633)(tcontext250019* c, tnode188803* n, tintset185047 exceptset);
static N_INLINE(NI, safelen_189320)(tnode188803* n);
N_NIMCALL(void, checkminsonslen_251215)(tnode188803* n, NI length);
N_NIMCALL(tnode188803*, newsymnode_189095)(tsym188833* sym);
N_NIMCALL(void, initintset_185918)(tintset185047* Result);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(tident167019*, consideracc_252006)(tnode188803* n);
N_NIMCALL(void, importsymbol_255416)(tcontext250019* c, tnode188803* n, tsym188833* frommod);
N_NIMCALL(void, loadstub_239239)(tsym188833* s);
STRING_LITERAL(TMP3099, "", 0);
STRING_LITERAL(TMP3100, "as", 2);
STRING_LITERAL(TMP3101, " ", 1);
STRING_LITERAL(TMP3102, ".", 1);
STRING_LITERAL(TMP3103, "/", 1);
STRING_LITERAL(TMP3104, "invalid module name: \'$1\'", 25);
STRING_LITERAL(TMP3105, "module alias must be an identifier", 34);
STRING_LITERAL(TMP3106, "importAllSymbols: ", 18);
STRING_LITERAL(TMP3107, "rawImportSymbol", 15);
STRING_LITERAL(TMP3108, "\'export except\' not implemented", 31);
STRING_LITERAL(TMP3110, "importSymbol: 2", 15);
STRING_LITERAL(TMP3111, "importSymbol: 3", 15);
extern tgcheap43016 gch_43044;
extern TY246056 gimportmodule_246060;
extern TNimType NTI188441; /* TSymKind */

static N_INLINE(NI, sonslen_189181)(tnode188803* 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(tcell41090*, usrtocell_44443)(void* usr) {
	tcell41090* result;
	result = 0;
	result = ((tcell41090*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(tcell41090))))));
	return result;
}

static N_INLINE(void, rtladdzct_46002)(tcell41090* c) {
	addzct_44418(&gch_43044.Zct, c);
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		tcell41090* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_44443(src);
		(*c).Refcount += 8;
	}
	LA3: ;
	{
		tcell41090* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_44443((*dest));
		{
			(*c).Refcount -= 8;
			if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA11;
			rtladdzct_46002(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(NimStringDesc*, getmodulename_255012)(tnode188803* n) {
	NimStringDesc* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		result = nosunixToNativePath((*n).kindU.S3.Strval, ((NimStringDesc*) &TMP3099));
	}
	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;
			tident167019* LOC9;
			LOC7 = 0;
			LOC7 = ((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 2));
			if (!(LOC7)) goto LA8;
			LOC9 = 0;
			LOC9 = getident_167456(((NimStringDesc*) &TMP3100));
			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 = (tnodeseq188797*) setLengthSeq(&((*n).kindU.S6.Sons)->Sup, sizeof(tnode188803*), 2);
			result = getmodulename_255012((*n).kindU.S6.Sons->data[0]);
			goto BeforeRet;
		}
		LA10: ;
		LOC12 = 0;
		LOC12 = rendertree_211051(n, 4);
		result = nsuReplaceStr(LOC12, ((NimStringDesc*) &TMP3101), ((NimStringDesc*) &TMP3099));
	}
	break;
	case ((NU8) 45):
	{
		NimStringDesc* LOC14;
		LOC14 = 0;
		LOC14 = rendertree_211051(n, 4);
		result = nsuReplaceStr(LOC14, ((NimStringDesc*) &TMP3102), ((NimStringDesc*) &TMP3103));
	}
	break;
	case ((NU8) 78):
	{
		result = getmodulename_255012((*n).kindU.S6.Sons->data[0]);
	}
	break;
	default:
	{
		NimStringDesc* LOC17;
		NimStringDesc* LOC18;
		LOC17 = 0;
		LOC17 = rendertree_211051(n, 0);
		LOC18 = 0;
		LOC18 = nsuFormatSingleElem(((NimStringDesc*) &TMP3104), LOC17);
		localerror_165571((*n).Info, ((NU16) 4), LOC18);
		result = copyString(((NimStringDesc*) &TMP3099));
	}
	break;
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(NI32, checkmodulename_255227)(tnode188803* n) {
	NI32 result;
	NimStringDesc* modulename;
	NimStringDesc* fullpath;
	NimStringDesc* LOC1;
	result = 0;
	modulename = getmodulename_255012(n);
	LOC1 = 0;
	LOC1 = tofullpath_164788((*n).Info.Fileindex);
	fullpath = findmodule_138312(modulename, LOC1);
	{
		if (!(fullpath->Sup.len == 0)) goto LA4;
		localerror_165571((*n).Info, ((NU16) 3), modulename);
		result = ((NI32) -1);
	}
	goto LA2;
	LA4: ;
	{
		result = fileinfoidx_163721(fullpath);
	}
	LA2: ;
	return result;
}

static N_INLINE(NI, len_189264)(tnode188803* 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(tsym188833*, importmoduleas_255864)(tnode188803* n, tsym188833* realmodule) {
	tsym188833* 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_189264(n);
		LOC6 = !((LOC7 == 2));
		if (LOC6) goto LA8;
		LOC6 = !(((*(*n).kindU.S6.Sons->data[1]).Kind == ((NU8) 2)));
		LA8: ;
		if (!LOC6) goto LA9;
		localerror_165571((*n).Info, ((NU16) 4), ((NimStringDesc*) &TMP3105));
	}
	goto LA1;
	LA9: ;
	{
		if (!!(((*(*(*n).kindU.S6.Sons->data[1]).kindU.S5.Ident).Sup.Id == (*(*realmodule).Name).Sup.Id))) goto LA12;
		result = createmodulealias_191841(realmodule, (*(*n).kindU.S6.Sons->data[1]).kindU.S5.Ident, (*(*n).kindU.S6.Sons->data[1]).Info);
	}
	goto LA1;
	LA12: ;
	LA1: ;
	return result;
}

N_NIMCALL(tsym188833*, myimportmodule_255973)(tcontext250019* c, tnode188803* n) {
	tsym188833* result;
	NI32 f;
	result = 0;
	f = checkmodulename_255227(n);
	{
		tsym188833* LOC5;
		if (!!((f == ((NI32) -1)))) goto LA3;
		LOC5 = 0;
		LOC5 = gimportmodule_246060((*c).Module, f);
		result = importmoduleas_255864(n, LOC5);
		{
			if (!(((*result).Flags &(1<<((((NU8) 19))&31)))!=0)) goto LA8;
			message_165584((*n).Info, ((NU16) 234), (*(*result).Name).S);
		}
		LA8: ;
	}
	LA3: ;
	return result;
}

static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	memcpy(((NCSTRING) (&(*dest).data[((*dest).Sup.len)- 0])), ((NCSTRING) ((*src).data)), (NI32)((*src).Sup.len + 1));
	(*dest).Sup.len += (*src).Sup.len;
}

static N_INLINE(NIM_BOOL, empty_186325)(tintset185047 s) {
	NIM_BOOL result;
	result = 0;
	result = (s.Counter == 0);
	return result;
}

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

static N_INLINE(NIM_BOOL, haspattern_195059)(tsym188833* s) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = isroutine_195040(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_255235)(tcontext250019* c, tsym188833* s) {
	tsym188833* check;
	check = strtableget_197084((*(*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_185849(&(*c).Ambiguoussymbols, (*s).Sup.Id);
			incl_185849(&(*c).Ambiguoussymbols, (*check).Sup.Id);
		}
		LA9: ;
	}
	LA5: ;
	strtableadd_197078(&(*(*c).Importtable).Symbols, s);
	{
		ttype188837* etyp;
		if (!((*s).Kind == ((NU8) 7))) goto LA13;
		etyp = (*s).Typ;
		{
			NIM_BOOL LOC17;
			NI j_255322;
			NI HEX3Atmp_255408;
			NI LOC21;
			NI res_255410;
			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;
			j_255322 = 0;
			HEX3Atmp_255408 = 0;
			LOC21 = 0;
			LOC21 = sonslen_189181((*etyp).N);
			HEX3Atmp_255408 = (NI32)(LOC21 - 1);
			res_255410 = 0;
			while (1) {
				tsym188833* e;
				tidentiter197106 it;
				if (!(res_255410 <= HEX3Atmp_255408)) goto LA22;
				j_255322 = res_255410;
				e = (*(*(*etyp).N).kindU.S6.Sons->data[j_255322]).kindU.S4.Sym;
				{
					if (!!(((*e).Kind == ((NU8) 20)))) goto LA25;
					internalerror_165591((*s).Info, ((NimStringDesc*) &TMP3107));
				}
				LA25: ;
				memset((void*)&it, 0, sizeof(it));
				check = initidentiter_197110(&it, (*(*c).Importtable).Symbols, (*e).Name);
				while (1) {
					if (!!((check == NIM_NIL))) goto LA27;
					{
						if (!((*check).Sup.Id == (*e).Sup.Id)) goto LA30;
						e = NIM_NIL;
						goto LA27;
					}
					LA30: ;
					check = nextidentiter_197117(&it, (*(*c).Importtable).Symbols);
				} LA27: ;
				{
					if (!!((e == NIM_NIL))) goto LA34;
					rawimportsymbol_255235(c, e);
				}
				LA34: ;
				res_255410 += 1;
			} LA22: ;
		}
		LA19: ;
	}
	goto LA11;
	LA13: ;
	{
		{
			if (!((*s).Kind == ((NU8) 16))) goto LA39;
			addconverter_250523(c, s);
		}
		LA39: ;
		{
			NIM_BOOL LOC43;
			LOC43 = 0;
			LOC43 = haspattern_195059(s);
			if (!LOC43) goto LA44;
			addpattern_250530(c, s);
		}
		LA44: ;
	}
	LA11: ;
}

N_NIMCALL(void, importallsymbolsexcept_255529)(tcontext250019* c, tsym188833* frommod, tintset185047 exceptset) {
	ttabiter197090 i;
	tsym188833* s;
	memset((void*)&i, 0, sizeof(i));
	s = inittabiter_197093(&i, (*frommod).kindU.S3.Tab);
	while (1) {
		if (!!((s == NIM_NIL))) goto LA1;
		{
			if (!!(((*s).Kind == ((NU8) 6)))) goto LA4;
			{
				if (!!(((*s).Kind == ((NU8) 20)))) goto LA8;
				{
					NimStringDesc* LOC14;
					if (!!(((9959296 &(1<<(((*s).Kind)&31)))!=0))) goto LA12;
					LOC14 = 0;
					LOC14 = rawNewString(reprEnum((*s).Kind, (&NTI188441))->Sup.len + 18);
appendString(LOC14, ((NimStringDesc*) &TMP3106));
appendString(LOC14, reprEnum((*s).Kind, (&NTI188441)));
					internalerror_165591((*s).Info, LOC14);
				}
				LA12: ;
				{
					NIM_BOOL LOC17;
					NIM_BOOL LOC19;
					LOC17 = 0;
					LOC17 = empty_186325(exceptset);
					if (LOC17) goto LA18;
					LOC19 = 0;
					LOC19 = contains_185821(exceptset, (*(*s).Name).Sup.Id);
					LOC17 = !(LOC19);
					LA18: ;
					if (!LOC17) goto LA20;
					rawimportsymbol_255235(c, s);
				}
				LA20: ;
			}
			LA8: ;
		}
		LA4: ;
		s = nextiter_197099(&i, (*frommod).kindU.S3.Tab);
	} LA1: ;
}

static N_INLINE(NI, safelen_189320)(tnode188803* n) {
	NI result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*n).Kind >= ((NU8) 0) && (*n).Kind <= ((NU8) 23));
		if (LOC3) goto LA4;
		LOC3 = (*n).kindU.S6.Sons == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = 0;
	}
	goto LA1;
	LA5: ;
	{
		result = (*n).kindU.S6.Sons->Sup.len;
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, importforwarded_255633)(tcontext250019* c, tnode188803* n, tintset185047 exceptset) {
	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).Kind) {
	case ((NU8) 117):
	{
		tnode188803* a_255649;
		NI i_255851;
		NI HEX3Atmp_255853;
		NI LOC6;
		NI res_255855;
		a_255649 = 0;
		i_255851 = 0;
		HEX3Atmp_255853 = 0;
		LOC6 = 0;
		LOC6 = len_189264(n);
		HEX3Atmp_255853 = LOC6 - 1;
		res_255855 = 0;
		while (1) {
			tsym188833* s;
			if (!(res_255855 <= HEX3Atmp_255853)) goto LA7;
			i_255851 = res_255855;
			a_255649 = (*n).kindU.S6.Sons->data[i_255851];
			s = (*a_255649).kindU.S4.Sym;
			{
				if (!((*s).Kind == ((NU8) 6))) goto LA10;
				importallsymbolsexcept_255529(c, s, exceptset);
			}
			goto LA8;
			LA10: ;
			{
				NIM_BOOL LOC13;
				NIM_BOOL LOC15;
				LOC13 = 0;
				LOC13 = empty_186325(exceptset);
				if (LOC13) goto LA14;
				LOC15 = 0;
				LOC15 = contains_185821(exceptset, (*(*s).Name).Sup.Id);
				LOC13 = !(LOC15);
				LA14: ;
				if (!LOC13) goto LA16;
				rawimportsymbol_255235(c, s);
			}
			goto LA8;
			LA16: ;
			LA8: ;
			res_255855 += 1;
		} LA7: ;
	}
	break;
	case ((NU8) 118):
	{
		localerror_165571((*n).Info, ((NU16) 4), ((NimStringDesc*) &TMP3108));
	}
	break;
	default:
	{
		NI i_255835;
		NI HEX3Atmp_255856;
		NI LOC20;
		NI res_255858;
		i_255835 = 0;
		HEX3Atmp_255856 = 0;
		LOC20 = 0;
		LOC20 = safelen_189320(n);
		HEX3Atmp_255856 = (NI32)(LOC20 - 1);
		res_255858 = 0;
		while (1) {
			if (!(res_255858 <= HEX3Atmp_255856)) goto LA21;
			i_255835 = res_255858;
			importforwarded_255633(c, (*n).kindU.S6.Sons->data[i_255835], exceptset);
			res_255858 += 1;
		} LA21: ;
	}
	break;
	}
	BeforeRet: ;
}

N_NIMCALL(tnode188803*, evalimport_255002)(tcontext250019* c, tnode188803* n) {
	tnode188803* result;
	tintset185047 emptyset;
	NI i_256012;
	NI HEX3Atmp_256046;
	NI LOC1;
	NI res_256048;
	result = 0;
	result = n;
	memset((void*)&emptyset, 0, sizeof(emptyset));
	i_256012 = 0;
	HEX3Atmp_256046 = 0;
	LOC1 = 0;
	LOC1 = sonslen_189181(n);
	HEX3Atmp_256046 = (NI32)(LOC1 - 1);
	res_256048 = 0;
	while (1) {
		tsym188833* m;
		if (!(res_256048 <= HEX3Atmp_256046)) goto LA2;
		i_256012 = res_256048;
		m = myimportmodule_255973(c, (*n).kindU.S6.Sons->data[i_256012]);
		{
			if (!!((m == NIM_NIL))) goto LA5;
			adddecl_252550(c, m);
			importallsymbolsexcept_255529(c, m, emptyset);
			importforwarded_255633(c, (*m).Ast, emptyset);
		}
		LA5: ;
		res_256048 += 1;
	} LA2: ;
	return result;
}

N_NIMCALL(tnode188803*, evalimportexcept_256161)(tcontext250019* c, tnode188803* n) {
	tnode188803* result;
	tsym188833* m;
	result = 0;
	result = n;
	checkminsonslen_251215(n, 2);
	m = myimportmodule_255973(c, (*n).kindU.S6.Sons->data[0]);
	{
		tintset185047 exceptset;
		NI i_256225;
		NI HEX3Atmp_256242;
		NI LOC5;
		NI res_256244;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) &(*n).kindU.S6.Sons->data[0], newsymnode_189095(m));
		adddecl_252550(c, m);
		chckNil((void*)&exceptset);
		memset((void*)&exceptset, 0, sizeof(exceptset));
		initintset_185918(&exceptset);
		i_256225 = 0;
		HEX3Atmp_256242 = 0;
		LOC5 = 0;
		LOC5 = sonslen_189181(n);
		HEX3Atmp_256242 = (NI32)(LOC5 - 1);
		res_256244 = 1;
		while (1) {
			tident167019* ident;
			if (!(res_256244 <= HEX3Atmp_256242)) goto LA6;
			i_256225 = res_256244;
			ident = consideracc_252006((*n).kindU.S6.Sons->data[i_256225]);
			incl_185849(&exceptset, (*ident).Sup.Id);
			res_256244 += 1;
		} LA6: ;
		importallsymbolsexcept_255529(c, m, exceptset);
		importforwarded_255633(c, (*m).Ast, exceptset);
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importsymbol_255416)(tcontext250019* c, tnode188803* n, tsym188833* frommod) {
	tident167019* ident;
	tsym188833* s;
	ident = consideracc_252006(n);
	s = strtableget_197084((*frommod).kindU.S3.Tab, ident);
	{
		if (!(s == NIM_NIL)) goto LA3;
		localerror_165571((*n).Info, ((NU16) 61), (*ident).S);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((*s).Kind == ((NU8) 23))) goto LA8;
			loadstub_239239(s);
		}
		LA8: ;
		{
			if (!!(((9959296 &(1<<(((*s).Kind)&31)))!=0))) goto LA12;
			internalerror_165591((*n).Info, ((NimStringDesc*) &TMP3110));
		}
		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):
		{
			tidentiter197106 it;
			tsym188833* e;
			memset((void*)&it, 0, sizeof(it));
			e = initidentiter_197110(&it, (*frommod).kindU.S3.Tab, (*s).Name);
			while (1) {
				if (!!((e == NIM_NIL))) goto LA15;
				{
					if (!!(((*(*e).Name).Sup.Id == (*(*s).Name).Sup.Id))) goto LA18;
					internalerror_165591((*n).Info, ((NimStringDesc*) &TMP3111));
				}
				LA18: ;
				rawimportsymbol_255235(c, e);
				e = nextidentiter_197117(&it, (*frommod).kindU.S3.Tab);
			} LA15: ;
		}
		break;
		default:
		{
			rawimportsymbol_255235(c, s);
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(tnode188803*, evalfrom_255007)(tcontext250019* c, tnode188803* n) {
	tnode188803* result;
	tsym188833* m;
	result = 0;
	result = n;
	checkminsonslen_251215(n, 2);
	m = myimportmodule_255973(c, (*n).kindU.S6.Sons->data[0]);
	{
		NI i_256116;
		NI HEX3Atmp_256154;
		NI LOC5;
		NI res_256156;
		if (!!((m == NIM_NIL))) goto LA3;
		asgnRefNoCycle((void**) &(*n).kindU.S6.Sons->data[0], newsymnode_189095(m));
		adddecl_252550(c, m);
		i_256116 = 0;
		HEX3Atmp_256154 = 0;
		LOC5 = 0;
		LOC5 = sonslen_189181(n);
		HEX3Atmp_256154 = (NI32)(LOC5 - 1);
		res_256156 = 1;
		while (1) {
			if (!(res_256156 <= HEX3Atmp_256154)) goto LA6;
			i_256116 = res_256156;
			{
				if (!!(((*(*n).kindU.S6.Sons->data[i_256116]).Kind == ((NU8) 23)))) goto LA9;
				importsymbol_255416(c, (*n).kindU.S6.Sons->data[i_256116], m);
			}
			LA9: ;
			res_256156 += 1;
		} LA6: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, importallsymbols_255625)(tcontext250019* c, tsym188833* frommod) {
	tintset185047 exceptset;
	memset((void*)&exceptset, 0, sizeof(exceptset));
	importallsymbolsexcept_255529(c, frommod, exceptset);
}
N_NOINLINE(void, importerInit)(void) {
}

N_NOINLINE(void, importerDatInit)(void) {
}

