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

#include <string.h>

#include <stdio.h>
typedef struct tsymseq224818 tsymseq224818;
typedef struct tsym224846 tsym224846;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
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 TY610058 TY610058;
typedef struct tmoduleinmemory610017 tmoduleinmemory610017;
typedef struct TY224936 TY224936;
typedef struct tnode224816 tnode224816;
typedef struct tidobj199015 tidobj199015;
typedef struct TNimObject TNimObject;
typedef struct ttypeseq224848 ttypeseq224848;
typedef struct ttype224852 ttype224852;
typedef struct tscope224840 tscope224840;
typedef struct TY224947 TY224947;
typedef struct tinstantiation224836 tinstantiation224836;
typedef struct tstrtable224820 tstrtable224820;
typedef struct tident199021 tident199021;
typedef struct tlineinfo194539 tlineinfo194539;
typedef struct tloc224830 tloc224830;
typedef struct trope176009 trope176009;
typedef struct tlib224834 tlib224834;
typedef struct NimStringDesc NimStringDesc;
typedef struct TY116604 TY116604;
typedef struct trodreader275030 trodreader275030;
typedef struct tllstream210204 tllstream210204;
typedef struct TY84745 TY84745;
typedef struct TY548150 TY548150;
typedef struct tcgen548035 tcgen548035;
typedef struct tbasechunk26438 tbasechunk26438;
typedef struct tfreecell26430 tfreecell26430;
typedef struct tnodeseq224810 tnodeseq224810;
typedef struct tlistentry126022 tlistentry126022;
typedef struct tindex275028 tindex275028;
typedef struct tiitable234274 tiitable234274;
typedef struct tiipairseq234272 tiipairseq234272;
typedef struct tiipair234270 tiipair234270;
typedef struct tidtable224864 tidtable224864;
typedef struct tidpairseq224862 tidpairseq224862;
typedef struct tidpair224860 tidpair224860;
typedef struct memfile273208 memfile273208;
typedef struct tpasscontext285005 tpasscontext285005;
typedef struct intset221056 intset221056;
typedef struct ttrunk221052 ttrunk221052;
typedef struct ttrunkseq221054 ttrunkseq221054;
typedef struct tlinkedlist126028 tlinkedlist126028;
typedef struct tcproc548031 tcproc548031;
typedef struct tnodetable224876 tnodetable224876;
typedef struct tnodepairseq224874 tnodepairseq224874;
typedef struct tnodepair224872 tnodepair224872;
typedef struct TY194552 TY194552;
typedef struct TY548102 TY548102;
typedef struct tblock548029 tblock548029;
struct  TGenericSeq  {
NI len;
NI reserved;
};
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  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
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;
};
struct  tmoduleinmemory610017  {
NF Compiledat;
NI32 Crc;
TY224936* Deps;
NU8 Needsrecompile;
NU8 Crcstatus;
};
typedef N_NIMCALL_PTR(tnode224816*, TY285069) (tsym224846* m, NI32 fileidx);
struct  TNimObject  {
TNimType* m_type;
};
struct  tidobj199015  {
  TNimObject Sup;
NI Id;
};
struct  tstrtable224820  {
NI Counter;
tsymseq224818* Data;
};
struct  tlineinfo194539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
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  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef N_NIMCALL_PTR(tsym224846*, TY285064) (tsym224846* m, NI32 fileidx);
struct TY116604 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct  tident199021  {
  tidobj199015 Sup;
NimStringDesc* S;
tident199021* Next;
NI H;
};
struct TY84745 {
NimStringDesc* Field0;
NI Field1;
};
typedef NI TY26420[16];
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  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;
};
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  tscope224840  {
NI Depthlevel;
tstrtable224820 Symbols;
tnodeseq224810* Usingsyms;
tscope224840* Parent;
};
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  tiipair234270  {
NI Key;
NI Val;
};
struct  tiitable234274  {
NI Counter;
tiipairseq234272* Data;
};
struct  tindex275028  {
NI Lastidxkey;
NI Lastidxval;
tiitable234274 Tab;
NimStringDesc* R;
NI Offset;
};
struct  tidpair224860  {
tidobj199015* Key;
TNimObject* Val;
};
struct  tidtable224864  {
NI Counter;
tidpairseq224862* Data;
};
struct  memfile273208  {
void* Mem;
NI Size;
int Handle;
};
struct  trodreader275030  {
  TNimObject Sup;
NI Pos;
NCSTRING S;
NU32 Options;
NU8 Reason;
TY224936* Moddeps;
TY224936* Files;
NI Dataidx;
NI Convertersidx;
NI Initidx;
NI Interfidx;
NI Compilerprocsidx;
NI Methodsidx;
NimStringDesc* Filename;
tindex275028 Index;
tindex275028 Imports;
NI Readerindex;
NI Line;
NI Moduleid;
tidtable224864 Syms;
memfile273208 Memfile;
tsymseq224818* Methods;
NimStringDesc* Origfile;
NIM_BOOL Inviewmode;
};
struct  tllstream210204  {
  TNimObject Sup;
NU8 Kind;
FILE* F;
NimStringDesc* S;
NI Rd;
NI Wr;
NI Lineoffset;
};
struct  tpasscontext285005  {
  TNimObject Sup;
NIM_BOOL Fromcache;
};
typedef trope176009* tcfilesections548019[18];
struct  intset221056  {
NI Counter;
NI Max;
ttrunk221052* Head;
ttrunkseq221054* Data;
};
struct  tlinkedlist126028  {
tlistentry126022* Head;
tlistentry126022* Tail;
NI Counter;
};
struct  tnodepair224872  {
NI H;
tnode224816* Key;
NI Val;
};
struct  tnodetable224876  {
NI Counter;
tnodepairseq224874* Data;
};
typedef trope176009* TY548138[10];
struct  tcgen548035  {
  tpasscontext285005 Sup;
tsym224846* Module;
NimStringDesc* Filename;
tcfilesections548019 S;
NIM_BOOL Preventstacktrace;
NIM_BOOL Usesthreadvars;
NIM_BOOL Framedeclared;
NIM_BOOL Isheaderfile;
NIM_BOOL Includesstringh;
NIM_BOOL Objhaskidsvalid;
NimStringDesc* Cfilename;
tidtable224864 Typecache;
tidtable224864 Forwtypecache;
intset221056 Declaredthings;
intset221056 Declaredprotos;
tlinkedlist126028 Headerfiles;
intset221056 Typeinfomarker;
tcproc548031* Initproc;
tcproc548031* Postinitproc;
tcproc548031* Preinitproc;
ttypeseq224848* Typestack;
tnodetable224876 Datacache;
tsymseq224818* Forwardedprocs;
NI Typenodes;
NI Nimtypes;
trope176009* Typenodesname;
trope176009* Nimtypesname;
NI Labels;
TY548138 Extensionloaders;
trope176009* Injectstmt;
};
struct  tfreecell26430  {
tfreecell26430* Next;
NI Zerofield;
};
struct  ttrunk221052  {
ttrunk221052* Next;
NI Key;
TY26420 Bits;
};
typedef trope176009* tcprocsections548023[3];
struct  tblock548029  {
NI Id;
trope176009* Label;
tcprocsections548023 Sections;
NIM_BOOL Isloop;
NI16 Nestedtrystmts;
NI16 Nestedexceptstmts;
NI16 Framelen;
};
struct  tcproc548031  {
tsym224846* Prc;
NIM_BOOL Beforeretneeded;
NIM_BOOL Threadvaraccessed;
tnodeseq224810* Nestedtrystmts;
NI Inexceptblock;
TY194552* Finallysafepoints;
NI Labels;
TY548102* Blocks;
NI Breakidx;
NU32 Options;
NI Maxframelen;
tcgen548035* Module;
NI Withinloop;
NI Gcframeid;
trope176009* Gcframetype;
};
struct tsymseq224818 {
  TGenericSeq Sup;
  tsym224846* data[SEQ_DECL_SIZE];
};
struct TY224936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY610058 {
  TGenericSeq Sup;
  tmoduleinmemory610017 data[SEQ_DECL_SIZE];
};
struct ttypeseq224848 {
  TGenericSeq Sup;
  ttype224852* data[SEQ_DECL_SIZE];
};
struct TY224947 {
  TGenericSeq Sup;
  tinstantiation224836* data[SEQ_DECL_SIZE];
};
struct TY548150 {
  TGenericSeq Sup;
  tcgen548035* data[SEQ_DECL_SIZE];
};
struct tnodeseq224810 {
  TGenericSeq Sup;
  tnode224816* data[SEQ_DECL_SIZE];
};
struct tiipairseq234272 {
  TGenericSeq Sup;
  tiipair234270 data[SEQ_DECL_SIZE];
};
struct tidpairseq224862 {
  TGenericSeq Sup;
  tidpair224860 data[SEQ_DECL_SIZE];
};
struct ttrunkseq221054 {
  TGenericSeq Sup;
  ttrunk221052* data[SEQ_DECL_SIZE];
};
struct tnodepairseq224874 {
  TGenericSeq Sup;
  tnodepair224872 data[SEQ_DECL_SIZE];
};
struct TY194552 {
  TGenericSeq Sup;
  trope176009* data[SEQ_DECL_SIZE];
};
struct TY548102 {
  TGenericSeq Sup;
  tblock548029 data[SEQ_DECL_SIZE];
};
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
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(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP1001)(void* p, NI op);
N_NIMCALL(tnode224816*, includemodule_610926)(tsym224846* s, NI32 fileidx);
N_NIMCALL(tnode224816*, parsefile_259041)(NI32 fileidx);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, adddep_610182)(tsym224846* x, NI32 dep);
N_NIMCALL(void, safeadd_610216)(TY224936** x_610224, NI32 y_610228);
N_NIMCALL(void, docrc_610164)(NI32 fileidx);
N_NIMCALL(NI32, crcfromfile_175046)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, tofilename_196025)(NI32 fileidx);
N_NIMCALL(tsym224846*, importmodule_610887)(tsym224846* s, NI32 fileidx);
N_NIMCALL(tsym224846*, compilemodule_610776)(NI32 fileidx, NU32 flags);
N_NIMCALL(tsym224846*, getmodule_610085)(NI32 fileidx);
N_NIMCALL(tsym224846*, newmodule_610649)(NI32 fileidx);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(NimStringDesc*, tofullpath_196037)(NI32 fileidx);
N_NIMCALL(tident199021*, getident_199472)(NimStringDesc* identifier);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY116604* Result);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
N_NIMCALL(NIM_BOOL, isnimidentifier_214325)(NimStringDesc* s);
N_NIMCALL(void, rawmessage_196733)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(tlineinfo194539, newlineinfo_195129)(NI32 fileinfoidx, NI line, NI col);
N_NIMCALL(tsym224846*, newsym_225074)(NU8 symkind, tident199021* name, tsym224846* owner, tlineinfo194539 info);
N_NIMCALL(NimStringDesc*, getpackagename_168825)(NimStringDesc* path);
N_NIMCALL(void, initstrtable_225153)(tstrtable224820* x);
N_NIMCALL(void, strtableadd_234103)(tstrtable224820* t, tsym224846* n);
N_NIMCALL(trodreader275030*, handlesymbolfile_275071)(tsym224846* module);
N_NIMCALL(void, internalerror_197006)(NimStringDesc* errmsg);
static N_INLINE(NI, getid_223404)(void);
N_NIMCALL(void, processmodule_285056)(tsym224846* module, tllstream210204* stream, trodreader275030* rd);
N_NIMCALL(NU8, checkdepmem_610463)(NI32 fileidx);
N_NIMCALL(NIM_BOOL, crcchanged_610119)(NI32 fileidx);
N_NIMCALL(NimStringDesc*, HEX24_197126)(TY84745 x_197130);
N_NIMCALL(void, resetmodule_610402)(NI32 fileidx);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incref_51025)(tcell44935* c);
static N_INLINE(NIM_BOOL, canbecycleroot_48667)(tcell44935* c);
static N_INLINE(void, rtladdcycleroot_49429)(tcell44935* c);
N_NOINLINE(void, incl_45671)(tcellset44947* s, tcell44935* cell);
static N_INLINE(void, decref_50604)(tcell44935* c);
N_NIMCALL(void, resetsourcemap_417529)(NI32 fileidx);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_610232)(TY224936* x_610238, TY224936* y_610243);
N_NIMCALL(void, localerror_196955)(tlineinfo194539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, wantmainmodule_611014)(void);
N_NIMCALL(void, fatal_196923)(tlineinfo194539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NI32, fileinfoidx_194747)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, HEX2F_116299)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(void, compilesystemmodule_610988)(void);
N_NIMCALL(void, resetpackagecache_168605)(void);
STRING_LITERAL(TMP1435, "handleSymbolFile should have set the module\'s ID", 48);
STRING_LITERAL(TMP1438, "compiler/modules.nim", 20);
NIM_CONST TY84745 TMP1437 = {((NimStringDesc*) &TMP1438),
44}
;
STRING_LITERAL(TMP4137, "", 0);
STRING_LITERAL(TMP4138, "nim", 3);
STRING_LITERAL(TMP4139, "system.nim", 10);
STRING_LITERAL(TMP4849, "stdin", 5);
tsymseq224818* gcompiledmodules_610057;
extern TNimType NTI224818; /* TSymSeq */
extern tgcheap47016 gch_47044;
TY610058* gmemcachedata_610079;
TNimType NTI610017; /* TModuleInMemory */
extern TNimType NTI128; /* float */
extern TNimType NTI175010; /* TCrc32 */
extern TNimType NTI224936; /* seq[int32] */
TNimType NTI610013; /* TNeedRecompile */
TNimType NTI610015; /* TCrcStatus */
TNimType NTI610058; /* seq[TModuleInMemory] */
extern TY285069 gincludefile_285073;
extern NU32 gglobaloptions_168118;
extern TY285064 gimportmodule_285068;
extern TNimType NTI224814; /* PSym */
extern TNimType NTI224846; /* TSym */
extern NU8 gcmd_168120;
extern NI gfrontendid_223012;
extern NF glastcmdtime_168131;
extern TY548150* gmodules_548171;
tsym224846* stdinmodule_611092;
extern NimStringDesc* gprojectfull_168236;
extern tlineinfo194539 gcmdlineinfo_195192;
extern NI32 gprojectmainidx_168237;
extern NimStringDesc* libpath_168233;
extern tsym224846* systemmodule_281019;
extern NI32 systemfileidx_194643;

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

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

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tcell44935* c;
	c = usrtocell_48646(p);
	{
		(*c).Refcount -= 8;
		if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA3;
		rtladdzct_50204(c);
	}
	LA3: ;
}
N_NIMCALL(void, TMP1001)(void* p, NI op) {
	TY610058* a;
	NI LOC1;
	a = (TY610058*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	nimGCvisit((void*)a->data[LOC1].Deps, op);
	}
}

N_NIMCALL(void, adddep_610182)(tsym224846* x, NI32 dep) {
	{
		if (!(gmemcachedata_610079->Sup.len <= ((NI) (dep)))) goto LA3;
		gmemcachedata_610079 = (TY610058*) setLengthSeq(&(gmemcachedata_610079)->Sup, sizeof(tmoduleinmemory610017), ((NI) ((NI32)(dep + ((NI32) 1)))));
	}
	LA3: ;
	safeadd_610216((&gmemcachedata_610079->data[(*x).Position].Deps), dep);
}

N_NIMCALL(void, docrc_610164)(NI32 fileidx) {
	{
		NimStringDesc* LOC5;
		if (!(gmemcachedata_610079->data[fileidx].Crcstatus == ((NU8) 0))) goto LA3;
		LOC5 = 0;
		LOC5 = tofilename_196025(fileidx);
		gmemcachedata_610079->data[fileidx].Crc = crcfromfile_175046(LOC5);
	}
	LA3: ;
}

N_NIMCALL(tnode224816*, includemodule_610926)(tsym224846* s, NI32 fileidx) {
	tnode224816* result;
	result = 0;
	result = parsefile_259041(fileidx);
	{
		if (!((gglobaloptions_168118 &(1<<((((NU8) 15))&31)))!=0)) goto LA3;
		{
			if (!(gmemcachedata_610079->Sup.len <= ((NI) (fileidx)))) goto LA7;
			gmemcachedata_610079 = (TY610058*) setLengthSeq(&(gmemcachedata_610079)->Sup, sizeof(tmoduleinmemory610017), ((NI) ((NI32)(fileidx + ((NI32) 1)))));
		}
		LA7: ;
		adddep_610182(s, fileidx);
		docrc_610164(fileidx);
	}
	LA3: ;
	return result;
}

N_NIMCALL(tsym224846*, getmodule_610085)(NI32 fileidx) {
	tsym224846* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (((NI32) 0) <= fileidx);
		if (!(LOC3)) goto LA4;
		LOC3 = (((NI) (fileidx)) < gcompiledmodules_610057->Sup.len);
		LA4: ;
		if (!LOC3) goto LA5;
		result = gcompiledmodules_610057->data[fileidx];
	}
	LA5: ;
	return result;
}

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 (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA11;
			rtladdzct_50204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(tsym224846*, newmodule_610649)(NI32 fileidx) {
	tsym224846* result;
	NimStringDesc* filename;
	TY116604 LOC1;
	NimStringDesc* LOC7;
	tident199021* LOC8;
	result = 0;
	result = (tsym224846*) newObj((&NTI224814), sizeof(tsym224846));
	(*result).Sup.Sup.m_type = (&NTI224846);
	(*result).Sup.Id = -1;
	(*result).Kind = ((NU8) 6);
	filename = tofullpath_196037(fileidx);
	memset((void*)(&LOC1), 0, sizeof(LOC1));
	nossplitFile(filename, (&LOC1));
	asgnRefNoCycle((void**) (&(*result).Name), getident_199472(LOC1.Field1));
	{
		NIM_BOOL LOC4;
		LOC4 = 0;
		LOC4 = isnimidentifier_214325((*(*result).Name).S);
		if (!!(LOC4)) goto LA5;
		rawmessage_196733(((NU16) 21), (*(*result).Name).S);
	}
	LA5: ;
	(*result).Info = newlineinfo_195129(fileidx, 1, 1);
	LOC7 = 0;
	LOC7 = getpackagename_168825(filename);
	LOC8 = 0;
	LOC8 = getident_199472(LOC7);
	asgnRefNoCycle((void**) (&(*result).Owner), newsym_225074(((NU8) 24), LOC8, NIM_NIL, (*result).Info));
	(*result).Position = ((NI) (fileidx));
	{
		if (!(gmemcachedata_610079->Sup.len <= ((NI) (fileidx)))) goto LA11;
		gmemcachedata_610079 = (TY610058*) setLengthSeq(&(gmemcachedata_610079)->Sup, sizeof(tmoduleinmemory610017), ((NI) ((NI32)(fileidx + ((NI32) 1)))));
	}
	LA11: ;
	{
		if (!(gcompiledmodules_610057->Sup.len <= ((NI) (fileidx)))) goto LA15;
		gcompiledmodules_610057 = (tsymseq224818*) setLengthSeq(&(gcompiledmodules_610057)->Sup, sizeof(tsym224846*), ((NI) ((NI32)(fileidx + ((NI32) 1)))));
	}
	LA15: ;
	asgnRefNoCycle((void**) (&gcompiledmodules_610057->data[(*result).Position]), result);
	(*result).Flags |= ((NI32)1)<<((((NU8) 0))%(sizeof(NI32)*8));
	initstrtable_225153((&(*result).kindU.S3.Tab));
	strtableadd_234103((&(*result).kindU.S3.Tab), result);
	return result;
}

static N_INLINE(NI, getid_223404)(void) {
	NI result;
	result = 0;
	result = gfrontendid_223012;
	gfrontendid_223012 += 1;
	return result;
}

N_NIMCALL(NIM_BOOL, crcchanged_610119)(NI32 fileidx) {
	NIM_BOOL result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NimStringDesc* LOC7;
		LOC3 = 0;
		LOC3 = (((NI32) 0) <= fileidx);
		if (!(LOC3)) goto LA4;
		LOC3 = (((NI) (fileidx)) < gmemcachedata_610079->Sup.len);
		LA4: ;
		if (!!(LOC3)) goto LA5;
		LOC7 = 0;
		LOC7 = HEX24_197126(TMP1437);
		internalerror_197006(LOC7);
	}
	LA5: ;
	switch (gmemcachedata_610079->data[fileidx].Crcstatus) {
	case ((NU8) 2):
	{
		result = NIM_TRUE;
	}
	break;
	case ((NU8) 3):
	{
		result = NIM_FALSE;
	}
	break;
	case ((NU8) 1):
	{
		NI32 newcrc;
		NimStringDesc* LOC11;
		LOC11 = 0;
		LOC11 = tofilename_196025(fileidx);
		newcrc = crcfromfile_175046(LOC11);
		result = !((newcrc == gmemcachedata_610079->data[fileidx].Crc));
		gmemcachedata_610079->data[fileidx].Crc = newcrc;
		{
			if (!result) goto LA14;
			gmemcachedata_610079->data[fileidx].Crcstatus = ((NU8) 2);
		}
		goto LA12;
		LA14: ;
		{
			gmemcachedata_610079->data[fileidx].Crcstatus = ((NU8) 3);
		}
		LA12: ;
	}
	break;
	case ((NU8) 0):
	{
		NimStringDesc* LOC18;
		LOC18 = 0;
		LOC18 = tofilename_196025(fileidx);
		gmemcachedata_610079->data[fileidx].Crc = crcfromfile_175046(LOC18);
		result = NIM_TRUE;
		{
			if (!result) goto LA21;
			gmemcachedata_610079->data[fileidx].Crcstatus = ((NU8) 2);
		}
		goto LA19;
		LA21: ;
		{
			gmemcachedata_610079->data[fileidx].Crcstatus = ((NU8) 3);
		}
		LA19: ;
	}
	break;
	}
	return result;
}

static N_INLINE(NIM_BOOL, canbecycleroot_48667)(tcell44935* c) {
	NIM_BOOL result;
	result = 0;
	result = !((((*(*c).Typ).flags &(1<<((((NU8) 1))&7)))!=0));
	return result;
}

static N_INLINE(void, rtladdcycleroot_49429)(tcell44935* c) {
	{
		if (!!((((NI) ((NI)((*c).Refcount & 3))) == 3))) goto LA3;
		(*c).Refcount = (NI)((NI)((*c).Refcount & -4) | 3);
		incl_45671((&gch_47044.Cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_51025)(tcell44935* c) {
	(*c).Refcount = (NI)((NU32)((*c).Refcount) + (NU32)(8));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_48667(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_49429(c);
	}
	LA4: ;
}

static N_INLINE(void, decref_50604)(tcell44935* c) {
	{
		(*c).Refcount -= 8;
		if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA3;
		rtladdzct_50204(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_48667(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_49429(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tcell44935* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_48646(src);
		incref_51025(LOC5);
	}
	LA3: ;
	{
		tcell44935* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_48646((*dest));
		decref_50604(LOC10);
	}
	LA8: ;
	(*dest) = src;
}

N_NIMCALL(void, resetmodule_610402)(NI32 fileidx) {
	gmemcachedata_610079->data[fileidx].Needsrecompile = ((NU8) 2);
	asgnRefNoCycle((void**) (&gcompiledmodules_610057->data[fileidx]), NIM_NIL);
	asgnRef((void**) (&gmodules_548171->data[fileidx]), NIM_NIL);
	resetsourcemap_417529(fileidx);
}

N_NIMCALL(NU8, checkdepmem_610463)(NI32 fileidx) {
	NU8 result;
	result = 0;
	{
		if (!!((gmemcachedata_610079->data[fileidx].Needsrecompile == ((NU8) 0)))) goto LA3;
		result = gmemcachedata_610079->data[fileidx].Needsrecompile;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = ((gglobaloptions_168118 &(1<<((((NU8) 1))&31)))!=0);
		if (LOC7) goto LA8;
		LOC7 = crcchanged_610119(fileidx);
		LA8: ;
		if (!LOC7) goto LA9;
		resetmodule_610402(fileidx);
		result = ((NU8) 2);
		goto BeforeRet;
	}
	LA9: ;
	{
		NIM_BOOL LOC13;
		LOC13 = 0;
		LOC13 = HEX3DHEX3D_610232(gmemcachedata_610079->data[fileidx].Deps, NIM_NIL);
		if (!!(LOC13)) goto LA14;
		gmemcachedata_610079->data[fileidx].Needsrecompile = ((NU8) 3);
		{
			NI32 dep_610611;
			TY224936* HEX3Atmp_610628;
			NI i_610631;
			NI l_610633;
			dep_610611 = 0;
			HEX3Atmp_610628 = 0;
			HEX3Atmp_610628 = gmemcachedata_610079->data[fileidx].Deps;
			i_610631 = 0;
			l_610633 = HEX3Atmp_610628->Sup.len;
			{
				while (1) {
					NU8 d;
					if (!(i_610631 < l_610633)) goto LA18;
					dep_610611 = HEX3Atmp_610628->data[i_610631];
					d = checkdepmem_610463(dep_610611);
					{
						if (!((20 &(1<<((d)&7)))!=0)) goto LA21;
						resetmodule_610402(fileidx);
						result = ((NU8) 2);
						goto BeforeRet;
					}
					LA21: ;
					i_610631 += 1;
				} LA18: ;
			}
		}
	}
	LA14: ;
	gmemcachedata_610079->data[fileidx].Needsrecompile = ((NU8) 1);
	result = ((NU8) 1);
	goto BeforeRet;
	BeforeRet: ;
	return result;
}

N_NIMCALL(tsym224846*, compilemodule_610776)(NI32 fileidx, NU32 flags) {
	tsym224846* result;
	result = 0;
	result = getmodule_610085(fileidx);
	{
		trodreader275030* rd;
		if (!(result == NIM_NIL)) goto LA3;
		{
			if (!(gmemcachedata_610079->Sup.len <= ((NI) (fileidx)))) goto LA7;
			gmemcachedata_610079 = (TY610058*) setLengthSeq(&(gmemcachedata_610079)->Sup, sizeof(tmoduleinmemory610017), ((NI) ((NI32)(fileidx + ((NI32) 1)))));
		}
		LA7: ;
		gmemcachedata_610079->data[fileidx].Needsrecompile = ((NU8) 3);
		result = newmodule_610649(fileidx);
		rd = 0;
		(*result).Flags = ((*result).Flags | flags);
		{
			if (!((18438 &(1<<((gcmd_168120)&31)))!=0)) goto LA11;
			rd = handlesymbolfile_275071(result);
			{
				if (!((*result).Sup.Id < 0)) goto LA15;
				internalerror_197006(((NimStringDesc*) &TMP1435));
				goto BeforeRet;
			}
			LA15: ;
		}
		goto LA9;
		LA11: ;
		{
			(*result).Sup.Id = getid_223404();
		}
		LA9: ;
		processmodule_285056(result, NIM_NIL, rd);
		{
			if (!((gglobaloptions_168118 &(1<<((((NU8) 15))&31)))!=0)) goto LA20;
			gmemcachedata_610079->data[fileidx].Compiledat = glastcmdtime_168131;
			gmemcachedata_610079->data[fileidx].Needsrecompile = ((NU8) 4);
			docrc_610164(fileidx);
		}
		LA20: ;
	}
	goto LA1;
	LA3: ;
	{
		{
			NU8 LOC25;
			LOC25 = 0;
			LOC25 = checkdepmem_610463(fileidx);
			if (!(LOC25 == ((NU8) 2))) goto LA26;
			result = compilemodule_610776(fileidx, flags);
		}
		goto LA23;
		LA26: ;
		{
			result = gcompiledmodules_610057->data[fileidx];
		}
		LA23: ;
	}
	LA1: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(tsym224846*, importmodule_610887)(tsym224846* s, NI32 fileidx) {
	tsym224846* result;
	result = 0;
	result = compilemodule_610776(fileidx, 0);
	{
		if (!((gglobaloptions_168118 &(1<<((((NU8) 15))&31)))!=0)) goto LA3;
		adddep_610182(s, fileidx);
	}
	LA3: ;
	{
		if (!(((*result).Flags &(1<<((((NU8) 13))&31)))!=0)) goto LA7;
		localerror_196955((*result).Info, ((NU16) 40), (*(*result).Name).S);
	}
	LA7: ;
	return result;
}

N_NIMCALL(void, wantmainmodule_611014)(void) {
	NimStringDesc* LOC5;
	{
		if (!(gprojectfull_168236->Sup.len == 0)) goto LA3;
		fatal_196923(gcmdlineinfo_195192, ((NU16) 186), ((NimStringDesc*) &TMP4137));
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = nosaddFileExt(gprojectfull_168236, ((NimStringDesc*) &TMP4138));
	gprojectmainidx_168237 = fileinfoidx_194747(LOC5);
}

N_NIMCALL(void, compilesystemmodule_610988)(void) {
	{
		NimStringDesc* LOC5;
		tsym224846* LOC6;
		if (!(systemmodule_281019 == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = HEX2F_116299(libpath_168233, ((NimStringDesc*) &TMP4139));
		systemfileidx_194643 = fileinfoidx_194747(LOC5);
		LOC6 = 0;
		LOC6 = compilemodule_610776(systemfileidx_194643, 8192);
	}
	LA3: ;
}

N_NIMCALL(void, compileproject_611077)(NI32 projectfileidx) {
	NI32 systemfileidx;
	NimStringDesc* LOC1;
	NI32 projectfile;
	wantmainmodule_611014();
	LOC1 = 0;
	LOC1 = HEX2F_116299(libpath_168233, ((NimStringDesc*) &TMP4139));
	systemfileidx = fileinfoidx_194747(LOC1);
	{
		if (!(projectfileidx < ((NI32) 0))) goto LA4;
		projectfile = gprojectmainidx_168237;
	}
	goto LA2;
	LA4: ;
	{
		projectfile = projectfileidx;
	}
	LA2: ;
	{
		tsym224846* LOC11;
		if (!(projectfile == systemfileidx)) goto LA9;
		LOC11 = 0;
		LOC11 = compilemodule_610776(projectfile, 12288);
	}
	goto LA7;
	LA9: ;
	{
		tsym224846* LOC13;
		compilesystemmodule_610988();
		LOC13 = 0;
		LOC13 = compilemodule_610776(projectfile, 4096);
	}
	LA7: ;
}

N_NIMCALL(tsym224846*, makestdinmodule_611097)(void) {
	tsym224846* result;
	result = 0;
	{
		NI32 LOC5;
		if (!(stdinmodule_611092 == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = fileinfoidx_194747(((NimStringDesc*) &TMP4849));
		asgnRefNoCycle((void**) (&stdinmodule_611092), newmodule_610649(LOC5));
		(*stdinmodule_611092).Sup.Id = getid_223404();
	}
	LA3: ;
	result = stdinmodule_611092;
	return result;
}

N_NIMCALL(void, resetallmodules_610411)(void) {
	{
		NI i_610423;
		NI HEX3Atmp_610443;
		NI res_610446;
		i_610423 = 0;
		HEX3Atmp_610443 = 0;
		HEX3Atmp_610443 = (gcompiledmodules_610057->Sup.len-1);
		res_610446 = 0;
		{
			while (1) {
				if (!(res_610446 <= HEX3Atmp_610443)) goto LA3;
				i_610423 = res_610446;
				{
					if (!!((gcompiledmodules_610057->data[i_610423] == NIM_NIL))) goto LA6;
					resetmodule_610402(((NI32) (i_610423)));
				}
				LA6: ;
				res_610446 += 1;
			} LA3: ;
		}
	}
	resetpackagecache_168605();
}
NIM_EXTERNC N_NOINLINE(void, HEX00_modulesInit)(void) {
	if (gcompiledmodules_610057) nimGCunrefNoCycle(gcompiledmodules_610057);
	gcompiledmodules_610057 = (tsymseq224818*) newSeqRC1((&NTI224818), 0);
	if (gmemcachedata_610079) nimGCunrefNoCycle(gmemcachedata_610079);
	gmemcachedata_610079 = (TY610058*) newSeqRC1((&NTI610058), 0);
	gincludefile_285073 = includemodule_610926;
	gimportmodule_285068 = importmodule_610887;
}

NIM_EXTERNC N_NOINLINE(void, HEX00_modulesDatInit)(void) {
static TNimNode* TMP994[5];
static TNimNode* TMP995[5];
NI TMP997;
static char* NIM_CONST TMP996[5] = {
"Maybe", 
"No", 
"Yes", 
"Probing", 
"Recompiled"};
static TNimNode* TMP998[4];
NI TMP1000;
static char* NIM_CONST TMP999[4] = {
"crcNotTaken", 
"crcCached", 
"crcHasChanged", 
"crcNotChanged"};
static TNimNode TMP992[17];
NTI610017.size = sizeof(tmoduleinmemory610017);
NTI610017.kind = 18;
NTI610017.base = 0;
NTI610017.flags = 2;
TMP994[0] = &TMP992[1];
TMP992[1].kind = 1;
TMP992[1].offset = offsetof(tmoduleinmemory610017, Compiledat);
TMP992[1].typ = (&NTI128);
TMP992[1].name = "compiledAt";
TMP994[1] = &TMP992[2];
TMP992[2].kind = 1;
TMP992[2].offset = offsetof(tmoduleinmemory610017, Crc);
TMP992[2].typ = (&NTI175010);
TMP992[2].name = "crc";
TMP994[2] = &TMP992[3];
TMP992[3].kind = 1;
TMP992[3].offset = offsetof(tmoduleinmemory610017, Deps);
TMP992[3].typ = (&NTI224936);
TMP992[3].name = "deps";
TMP994[3] = &TMP992[4];
NTI610013.size = sizeof(NU8);
NTI610013.kind = 14;
NTI610013.base = 0;
NTI610013.flags = 3;
for (TMP997 = 0; TMP997 < 5; TMP997++) {
TMP992[TMP997+5].kind = 1;
TMP992[TMP997+5].offset = TMP997;
TMP992[TMP997+5].name = TMP996[TMP997];
TMP995[TMP997] = &TMP992[TMP997+5];
}
TMP992[10].len = 5; TMP992[10].kind = 2; TMP992[10].sons = &TMP995[0];
NTI610013.node = &TMP992[10];
TMP992[4].kind = 1;
TMP992[4].offset = offsetof(tmoduleinmemory610017, Needsrecompile);
TMP992[4].typ = (&NTI610013);
TMP992[4].name = "needsRecompile";
TMP994[4] = &TMP992[11];
NTI610015.size = sizeof(NU8);
NTI610015.kind = 14;
NTI610015.base = 0;
NTI610015.flags = 3;
for (TMP1000 = 0; TMP1000 < 4; TMP1000++) {
TMP992[TMP1000+12].kind = 1;
TMP992[TMP1000+12].offset = TMP1000;
TMP992[TMP1000+12].name = TMP999[TMP1000];
TMP998[TMP1000] = &TMP992[TMP1000+12];
}
TMP992[16].len = 4; TMP992[16].kind = 2; TMP992[16].sons = &TMP998[0];
NTI610015.node = &TMP992[16];
TMP992[11].kind = 1;
TMP992[11].offset = offsetof(tmoduleinmemory610017, Crcstatus);
TMP992[11].typ = (&NTI610015);
TMP992[11].name = "crcStatus";
TMP992[0].len = 5; TMP992[0].kind = 2; TMP992[0].sons = &TMP994[0];
NTI610017.node = &TMP992[0];
NTI610058.size = sizeof(TY610058*);
NTI610058.kind = 24;
NTI610058.base = (&NTI610017);
NTI610058.flags = 2;
NTI610058.marker = TMP1001;
}

