/* 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>

#include <stdio.h>
typedef struct tsymseq226818 tsymseq226818;
typedef struct tsym226846 tsym226846;
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 TY612058 TY612058;
typedef struct tmoduleinmemory612017 tmoduleinmemory612017;
typedef struct TY226936 TY226936;
typedef struct tnode226816 tnode226816;
typedef struct tidobj201015 tidobj201015;
typedef struct TNimObject TNimObject;
typedef struct ttypeseq226848 ttypeseq226848;
typedef struct ttype226852 ttype226852;
typedef struct tscope226840 tscope226840;
typedef struct TY226947 TY226947;
typedef struct tinstantiation226836 tinstantiation226836;
typedef struct tstrtable226820 tstrtable226820;
typedef struct tident201021 tident201021;
typedef struct tlineinfo196539 tlineinfo196539;
typedef struct tloc226830 tloc226830;
typedef struct trope178009 trope178009;
typedef struct tlib226834 tlib226834;
typedef struct NimStringDesc NimStringDesc;
typedef struct TY117604 TY117604;
typedef struct trodreader277030 trodreader277030;
typedef struct tllstream212204 tllstream212204;
typedef struct TY84745 TY84745;
typedef struct TY550150 TY550150;
typedef struct tcgen550035 tcgen550035;
typedef struct tbasechunk26438 tbasechunk26438;
typedef struct tfreecell26430 tfreecell26430;
typedef struct tnodeseq226810 tnodeseq226810;
typedef struct tlistentry127022 tlistentry127022;
typedef struct tindex277028 tindex277028;
typedef struct tiitable236274 tiitable236274;
typedef struct tiipairseq236272 tiipairseq236272;
typedef struct tiipair236270 tiipair236270;
typedef struct tidtable226864 tidtable226864;
typedef struct tidpairseq226862 tidpairseq226862;
typedef struct tidpair226860 tidpair226860;
typedef struct memfile275208 memfile275208;
typedef struct tpasscontext287005 tpasscontext287005;
typedef struct intset223056 intset223056;
typedef struct ttrunk223052 ttrunk223052;
typedef struct ttrunkseq223054 ttrunkseq223054;
typedef struct tlinkedlist127028 tlinkedlist127028;
typedef struct tcproc550031 tcproc550031;
typedef struct tnodetable226876 tnodetable226876;
typedef struct tnodepairseq226874 tnodepairseq226874;
typedef struct tnodepair226872 tnodepair226872;
typedef struct TY196552 TY196552;
typedef struct TY550102 TY550102;
typedef struct tblock550029 tblock550029;
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  tmoduleinmemory612017  {
NF Compiledat;
NI32 Crc;
TY226936* Deps;
NU8 Needsrecompile;
NU8 Crcstatus;
};
typedef N_NIMCALL_PTR(tnode226816*, TY287069) (tsym226846* m, NI32 fileidx);
struct  TNimObject  {
TNimType* m_type;
};
struct  tidobj201015  {
  TNimObject Sup;
NI Id;
};
struct  tstrtable226820  {
NI Counter;
tsymseq226818* Data;
};
struct  tlineinfo196539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  tloc226830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype226852* T;
trope178009* R;
trope178009* Heaproot;
};
struct  tsym226846  {
  tidobj201015 Sup;
NU8 Kind;
union {
struct {ttypeseq226848* Typeinstcache;
tscope226840* Typscope;
} S1;
struct {TY226947* Procinstcache;
tscope226840* Scope;
} S2;
struct {TY226947* Usedgenerics;
tstrtable226820 Tab;
} S3;
struct {tsym226846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype226852* Typ;
tident201021* Name;
tlineinfo196539 Info;
tsym226846* Owner;
NU32 Flags;
tnode226816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc226830 Loc;
tlib226834* Annex;
tnode226816* Constraint;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef N_NIMCALL_PTR(tsym226846*, TY287064) (tsym226846* m, NI32 fileidx);
struct TY117604 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct  tident201021  {
  tidobj201015 Sup;
NimStringDesc* S;
tident201021* Next;
NI H;
};
struct TY84745 {
NimStringDesc* Field0;
NI Field1;
};
typedef NI TY26420[8];
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  tnode226816  {
ttype226852* Typ;
tlineinfo196539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym226846* Sym;
} S4;
struct {tident201021* Ident;
} S5;
struct {tnodeseq226810* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
struct  ttype226852  {
  tidobj201015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq226848* Sons;
tnode226816* N;
tsym226846* Owner;
tsym226846* Sym;
tsym226846* Destructor;
tsym226846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc226830 Loc;
};
struct  tscope226840  {
NI Depthlevel;
tstrtable226820 Symbols;
tnodeseq226810* Usingsyms;
tscope226840* Parent;
};
struct  tinstantiation226836  {
tsym226846* Sym;
ttypeseq226848* Concretetypes;
TY226936* Usedby;
};
struct  trope178009  {
  TNimObject Sup;
trope178009* Left;
trope178009* Right;
NI Length;
NimStringDesc* Data;
};
struct  tlistentry127022  {
  TNimObject Sup;
tlistentry127022* Prev;
tlistentry127022* Next;
};
struct  tlib226834  {
  tlistentry127022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope178009* Name;
tnode226816* Path;
};
struct  tiipair236270  {
NI Key;
NI Val;
};
struct  tiitable236274  {
NI Counter;
tiipairseq236272* Data;
};
struct  tindex277028  {
NI Lastidxkey;
NI Lastidxval;
tiitable236274 Tab;
NimStringDesc* R;
NI Offset;
};
struct  tidpair226860  {
tidobj201015* Key;
TNimObject* Val;
};
struct  tidtable226864  {
NI Counter;
tidpairseq226862* Data;
};
struct  memfile275208  {
void* Mem;
NI Size;
int Handle;
};
struct  trodreader277030  {
  TNimObject Sup;
NI Pos;
NCSTRING S;
NU32 Options;
NU8 Reason;
TY226936* Moddeps;
TY226936* Files;
NI Dataidx;
NI Convertersidx;
NI Initidx;
NI Interfidx;
NI Compilerprocsidx;
NI Methodsidx;
NimStringDesc* Filename;
tindex277028 Index;
tindex277028 Imports;
NI Readerindex;
NI Line;
NI Moduleid;
tidtable226864 Syms;
memfile275208 Memfile;
tsymseq226818* Methods;
NimStringDesc* Origfile;
NIM_BOOL Inviewmode;
};
struct  tllstream212204  {
  TNimObject Sup;
NU8 Kind;
FILE* F;
NimStringDesc* S;
NI Rd;
NI Wr;
NI Lineoffset;
};
struct  tpasscontext287005  {
  TNimObject Sup;
NIM_BOOL Fromcache;
};
typedef trope178009* tcfilesections550019[18];
struct  intset223056  {
NI Counter;
NI Max;
ttrunk223052* Head;
ttrunkseq223054* Data;
};
struct  tlinkedlist127028  {
tlistentry127022* Head;
tlistentry127022* Tail;
NI Counter;
};
struct  tnodepair226872  {
NI H;
tnode226816* Key;
NI Val;
};
struct  tnodetable226876  {
NI Counter;
tnodepairseq226874* Data;
};
typedef trope178009* TY550138[10];
struct  tcgen550035  {
  tpasscontext287005 Sup;
tsym226846* Module;
NimStringDesc* Filename;
tcfilesections550019 S;
NIM_BOOL Preventstacktrace;
NIM_BOOL Usesthreadvars;
NIM_BOOL Framedeclared;
NIM_BOOL Isheaderfile;
NIM_BOOL Includesstringh;
NIM_BOOL Objhaskidsvalid;
NimStringDesc* Cfilename;
tidtable226864 Typecache;
tidtable226864 Forwtypecache;
intset223056 Declaredthings;
intset223056 Declaredprotos;
tlinkedlist127028 Headerfiles;
intset223056 Typeinfomarker;
tcproc550031* Initproc;
tcproc550031* Postinitproc;
tcproc550031* Preinitproc;
ttypeseq226848* Typestack;
tnodetable226876 Datacache;
tsymseq226818* Forwardedprocs;
NI Typenodes;
NI Nimtypes;
trope178009* Typenodesname;
trope178009* Nimtypesname;
NI Labels;
TY550138 Extensionloaders;
trope178009* Injectstmt;
};
struct  tfreecell26430  {
tfreecell26430* Next;
NI Zerofield;
};
struct  ttrunk223052  {
ttrunk223052* Next;
NI Key;
TY26420 Bits;
};
typedef trope178009* tcprocsections550023[3];
struct  tblock550029  {
NI Id;
trope178009* Label;
tcprocsections550023 Sections;
NIM_BOOL Isloop;
NI16 Nestedtrystmts;
NI16 Nestedexceptstmts;
NI16 Framelen;
};
struct  tcproc550031  {
tsym226846* Prc;
NIM_BOOL Beforeretneeded;
NIM_BOOL Threadvaraccessed;
tnodeseq226810* Nestedtrystmts;
NI Inexceptblock;
TY196552* Finallysafepoints;
NI Labels;
TY550102* Blocks;
NI Breakidx;
NU32 Options;
NI Maxframelen;
tcgen550035* Module;
NI Withinloop;
NI Gcframeid;
trope178009* Gcframetype;
};
struct tsymseq226818 {
  TGenericSeq Sup;
  tsym226846* data[SEQ_DECL_SIZE];
};
struct TY226936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY612058 {
  TGenericSeq Sup;
  tmoduleinmemory612017 data[SEQ_DECL_SIZE];
};
struct ttypeseq226848 {
  TGenericSeq Sup;
  ttype226852* data[SEQ_DECL_SIZE];
};
struct TY226947 {
  TGenericSeq Sup;
  tinstantiation226836* data[SEQ_DECL_SIZE];
};
struct TY550150 {
  TGenericSeq Sup;
  tcgen550035* data[SEQ_DECL_SIZE];
};
struct tnodeseq226810 {
  TGenericSeq Sup;
  tnode226816* data[SEQ_DECL_SIZE];
};
struct tiipairseq236272 {
  TGenericSeq Sup;
  tiipair236270 data[SEQ_DECL_SIZE];
};
struct tidpairseq226862 {
  TGenericSeq Sup;
  tidpair226860 data[SEQ_DECL_SIZE];
};
struct ttrunkseq223054 {
  TGenericSeq Sup;
  ttrunk223052* data[SEQ_DECL_SIZE];
};
struct tnodepairseq226874 {
  TGenericSeq Sup;
  tnodepair226872 data[SEQ_DECL_SIZE];
};
struct TY196552 {
  TGenericSeq Sup;
  trope178009* data[SEQ_DECL_SIZE];
};
struct TY550102 {
  TGenericSeq Sup;
  tblock550029 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, TMP1003)(void* p, NI op);
N_NIMCALL(tnode226816*, includemodule_612926)(tsym226846* s, NI32 fileidx);
N_NIMCALL(tnode226816*, parsefile_261041)(NI32 fileidx);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, adddep_612182)(tsym226846* x, NI32 dep);
N_NIMCALL(void, safeadd_612216)(TY226936** x_612224, NI32 y_612228);
N_NIMCALL(void, docrc_612164)(NI32 fileidx);
N_NIMCALL(NI32, crcfromfile_177046)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, tofilename_198025)(NI32 fileidx);
N_NIMCALL(tsym226846*, importmodule_612887)(tsym226846* s, NI32 fileidx);
N_NIMCALL(tsym226846*, compilemodule_612776)(NI32 fileidx, NU32 flags);
N_NIMCALL(tsym226846*, getmodule_612085)(NI32 fileidx);
N_NIMCALL(tsym226846*, newmodule_612649)(NI32 fileidx);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(NimStringDesc*, tofullpath_198037)(NI32 fileidx);
N_NIMCALL(tident201021*, getident_201472)(NimStringDesc* identifier);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY117604* Result);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
N_NIMCALL(NIM_BOOL, isnimidentifier_216325)(NimStringDesc* s);
N_NIMCALL(void, rawmessage_198733)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(tlineinfo196539, newlineinfo_197128)(NI32 fileinfoidx, NI line, NI col);
N_NIMCALL(tsym226846*, newsym_227074)(NU8 symkind, tident201021* name, tsym226846* owner, tlineinfo196539 info);
N_NIMCALL(NimStringDesc*, getpackagename_170825)(NimStringDesc* path);
N_NIMCALL(void, initstrtable_227153)(tstrtable226820* x);
N_NIMCALL(void, strtableadd_236103)(tstrtable226820* t, tsym226846* n);
N_NIMCALL(trodreader277030*, handlesymbolfile_277071)(tsym226846* module);
N_NIMCALL(void, internalerror_199006)(NimStringDesc* errmsg);
static N_INLINE(NI, getid_225404)(void);
N_NIMCALL(void, processmodule_287056)(tsym226846* module, tllstream212204* stream, trodreader277030* rd);
N_NIMCALL(NU8, checkdepmem_612462)(NI32 fileidx);
N_NIMCALL(NIM_BOOL, crcchanged_612119)(NI32 fileidx);
N_NIMCALL(NimStringDesc*, HEX24_199126)(TY84745 x_199130);
N_NIMCALL(void, resetmodule_612402)(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_419529)(NI32 fileidx);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_612232)(TY226936* x_612238, TY226936* y_612243);
N_NIMCALL(void, localerror_198955)(tlineinfo196539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, wantmainmodule_613014)(void);
N_NIMCALL(void, fatal_198923)(tlineinfo196539 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NI32, fileinfoidx_196747)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, HEX2F_117299)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(void, compilesystemmodule_612988)(void);
N_NIMCALL(void, resetpackagecache_170605)(void);
STRING_LITERAL(TMP1437, "handleSymbolFile should have set the module\'s ID", 48);
STRING_LITERAL(TMP1440, "compiler/modules.nim", 20);
NIM_CONST TY84745 TMP1439 = {((NimStringDesc*) &TMP1440),
44}
;
STRING_LITERAL(TMP4139, "", 0);
STRING_LITERAL(TMP4140, "nim", 3);
STRING_LITERAL(TMP4141, "system.nim", 10);
STRING_LITERAL(TMP4851, "stdin", 5);
tsymseq226818* gcompiledmodules_612057;
extern TNimType NTI226818; /* TSymSeq */
extern tgcheap47016 gch_47044;
TY612058* gmemcachedata_612079;
TNimType NTI612017; /* TModuleInMemory */
extern TNimType NTI128; /* float */
extern TNimType NTI177010; /* TCrc32 */
extern TNimType NTI226936; /* seq[int32] */
TNimType NTI612013; /* TNeedRecompile */
TNimType NTI612015; /* TCrcStatus */
TNimType NTI612058; /* seq[TModuleInMemory] */
extern TY287069 gincludefile_287073;
extern NU32 gglobaloptions_170118;
extern TY287064 gimportmodule_287068;
extern TNimType NTI226814; /* PSym */
extern TNimType NTI226846; /* TSym */
extern NU8 gcmd_170120;
extern NI gfrontendid_225012;
extern NF glastcmdtime_170131;
extern TY550150* gmodules_550171;
tsym226846* stdinmodule_613092;
extern NimStringDesc* gprojectfull_170236;
extern tlineinfo196539 gcmdlineinfo_197191;
extern NI32 gprojectmainidx_170237;
extern NimStringDesc* libpath_170233;
extern tsym226846* systemmodule_283019;
extern NI32 systemfileidx_196643;

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

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

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

N_NIMCALL(void, adddep_612182)(tsym226846* x, NI32 dep) {
	{
		if (!(gmemcachedata_612079->Sup.len <= ((NI) (dep)))) goto LA3;
		gmemcachedata_612079 = (TY612058*) setLengthSeq(&(gmemcachedata_612079)->Sup, sizeof(tmoduleinmemory612017), ((NI) ((NI32)(dep + ((NI32) 1)))));
	}
	LA3: ;
	safeadd_612216((&gmemcachedata_612079->data[(*x).Position].Deps), dep);
}

N_NIMCALL(void, docrc_612164)(NI32 fileidx) {
	{
		NimStringDesc* LOC5;
		if (!(gmemcachedata_612079->data[fileidx].Crcstatus == ((NU8) 0))) goto LA3;
		LOC5 = 0;
		LOC5 = tofilename_198025(fileidx);
		gmemcachedata_612079->data[fileidx].Crc = crcfromfile_177046(LOC5);
	}
	LA3: ;
}

N_NIMCALL(tnode226816*, includemodule_612926)(tsym226846* s, NI32 fileidx) {
	tnode226816* result;
	result = 0;
	result = parsefile_261041(fileidx);
	{
		if (!((gglobaloptions_170118 &(1<<((((NU8) 15))&31)))!=0)) goto LA3;
		{
			if (!(gmemcachedata_612079->Sup.len <= ((NI) (fileidx)))) goto LA7;
			gmemcachedata_612079 = (TY612058*) setLengthSeq(&(gmemcachedata_612079)->Sup, sizeof(tmoduleinmemory612017), ((NI) ((NI32)(fileidx + ((NI32) 1)))));
		}
		LA7: ;
		adddep_612182(s, fileidx);
		docrc_612164(fileidx);
	}
	LA3: ;
	return result;
}

N_NIMCALL(tsym226846*, getmodule_612085)(NI32 fileidx) {
	tsym226846* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (((NI32) 0) <= fileidx);
		if (!(LOC3)) goto LA4;
		LOC3 = (((NI) (fileidx)) < gcompiledmodules_612057->Sup.len);
		LA4: ;
		if (!LOC3) goto LA5;
		result = gcompiledmodules_612057->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 (!((NU64)((*c).Refcount) < (NU64)(8))) goto LA11;
			rtladdzct_50204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(tsym226846*, newmodule_612649)(NI32 fileidx) {
	tsym226846* result;
	NimStringDesc* filename;
	TY117604 LOC1;
	NimStringDesc* LOC7;
	tident201021* LOC8;
	result = 0;
	result = (tsym226846*) newObj((&NTI226814), sizeof(tsym226846));
	(*result).Sup.Sup.m_type = (&NTI226846);
	(*result).Sup.Id = -1;
	(*result).Kind = ((NU8) 6);
	filename = tofullpath_198037(fileidx);
	memset((void*)(&LOC1), 0, sizeof(LOC1));
	nossplitFile(filename, (&LOC1));
	asgnRefNoCycle((void**) (&(*result).Name), getident_201472(LOC1.Field1));
	{
		NIM_BOOL LOC4;
		LOC4 = 0;
		LOC4 = isnimidentifier_216325((*(*result).Name).S);
		if (!!(LOC4)) goto LA5;
		rawmessage_198733(((NU16) 21), (*(*result).Name).S);
	}
	LA5: ;
	(*result).Info = newlineinfo_197128(fileidx, 1, 1);
	LOC7 = 0;
	LOC7 = getpackagename_170825(filename);
	LOC8 = 0;
	LOC8 = getident_201472(LOC7);
	asgnRefNoCycle((void**) (&(*result).Owner), newsym_227074(((NU8) 24), LOC8, NIM_NIL, (*result).Info));
	(*result).Position = ((NI) (fileidx));
	{
		if (!(gmemcachedata_612079->Sup.len <= ((NI) (fileidx)))) goto LA11;
		gmemcachedata_612079 = (TY612058*) setLengthSeq(&(gmemcachedata_612079)->Sup, sizeof(tmoduleinmemory612017), ((NI) ((NI32)(fileidx + ((NI32) 1)))));
	}
	LA11: ;
	{
		if (!(gcompiledmodules_612057->Sup.len <= ((NI) (fileidx)))) goto LA15;
		gcompiledmodules_612057 = (tsymseq226818*) setLengthSeq(&(gcompiledmodules_612057)->Sup, sizeof(tsym226846*), ((NI) ((NI32)(fileidx + ((NI32) 1)))));
	}
	LA15: ;
	asgnRefNoCycle((void**) (&gcompiledmodules_612057->data[(*result).Position]), result);
	(*result).Flags |= ((NI32)1)<<((((NU8) 0))%(sizeof(NI32)*8));
	initstrtable_227153((&(*result).kindU.S3.Tab));
	strtableadd_236103((&(*result).kindU.S3.Tab), result);
	return result;
}

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

N_NIMCALL(NIM_BOOL, crcchanged_612119)(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_612079->Sup.len);
		LA4: ;
		if (!!(LOC3)) goto LA5;
		LOC7 = 0;
		LOC7 = HEX24_199126(TMP1439);
		internalerror_199006(LOC7);
	}
	LA5: ;
	switch (gmemcachedata_612079->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_198025(fileidx);
		newcrc = crcfromfile_177046(LOC11);
		result = !((newcrc == gmemcachedata_612079->data[fileidx].Crc));
		gmemcachedata_612079->data[fileidx].Crc = newcrc;
		{
			if (!result) goto LA14;
			gmemcachedata_612079->data[fileidx].Crcstatus = ((NU8) 2);
		}
		goto LA12;
		LA14: ;
		{
			gmemcachedata_612079->data[fileidx].Crcstatus = ((NU8) 3);
		}
		LA12: ;
	}
	break;
	case ((NU8) 0):
	{
		NimStringDesc* LOC18;
		LOC18 = 0;
		LOC18 = tofilename_198025(fileidx);
		gmemcachedata_612079->data[fileidx].Crc = crcfromfile_177046(LOC18);
		result = NIM_TRUE;
		{
			if (!result) goto LA21;
			gmemcachedata_612079->data[fileidx].Crcstatus = ((NU8) 2);
		}
		goto LA19;
		LA21: ;
		{
			gmemcachedata_612079->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)((NU64)((*c).Refcount) + (NU64)(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 (!((NU64)((*c).Refcount) < (NU64)(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_612402)(NI32 fileidx) {
	gmemcachedata_612079->data[fileidx].Needsrecompile = ((NU8) 2);
	asgnRefNoCycle((void**) (&gcompiledmodules_612057->data[fileidx]), NIM_NIL);
	asgnRef((void**) (&gmodules_550171->data[fileidx]), NIM_NIL);
	resetsourcemap_419529(fileidx);
}

N_NIMCALL(NU8, checkdepmem_612462)(NI32 fileidx) {
	NU8 result;
	result = 0;
	{
		if (!!((gmemcachedata_612079->data[fileidx].Needsrecompile == ((NU8) 0)))) goto LA3;
		result = gmemcachedata_612079->data[fileidx].Needsrecompile;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = ((gglobaloptions_170118 &(1<<((((NU8) 1))&31)))!=0);
		if (LOC7) goto LA8;
		LOC7 = crcchanged_612119(fileidx);
		LA8: ;
		if (!LOC7) goto LA9;
		resetmodule_612402(fileidx);
		result = ((NU8) 2);
		goto BeforeRet;
	}
	LA9: ;
	{
		NIM_BOOL LOC13;
		LOC13 = 0;
		LOC13 = HEX3DHEX3D_612232(gmemcachedata_612079->data[fileidx].Deps, NIM_NIL);
		if (!!(LOC13)) goto LA14;
		gmemcachedata_612079->data[fileidx].Needsrecompile = ((NU8) 3);
		{
			NI32 dep_612611;
			TY226936* HEX3Atmp_612628;
			NI i_612631;
			NI l_612633;
			dep_612611 = 0;
			HEX3Atmp_612628 = 0;
			HEX3Atmp_612628 = gmemcachedata_612079->data[fileidx].Deps;
			i_612631 = 0;
			l_612633 = HEX3Atmp_612628->Sup.len;
			{
				while (1) {
					NU8 d;
					if (!(i_612631 < l_612633)) goto LA18;
					dep_612611 = HEX3Atmp_612628->data[i_612631];
					d = checkdepmem_612462(dep_612611);
					{
						if (!((20 &(1<<((d)&7)))!=0)) goto LA21;
						resetmodule_612402(fileidx);
						result = ((NU8) 2);
						goto BeforeRet;
					}
					LA21: ;
					i_612631 += 1;
				} LA18: ;
			}
		}
	}
	LA14: ;
	gmemcachedata_612079->data[fileidx].Needsrecompile = ((NU8) 1);
	result = ((NU8) 1);
	goto BeforeRet;
	BeforeRet: ;
	return result;
}

N_NIMCALL(tsym226846*, compilemodule_612776)(NI32 fileidx, NU32 flags) {
	tsym226846* result;
	result = 0;
	result = getmodule_612085(fileidx);
	{
		trodreader277030* rd;
		if (!(result == NIM_NIL)) goto LA3;
		{
			if (!(gmemcachedata_612079->Sup.len <= ((NI) (fileidx)))) goto LA7;
			gmemcachedata_612079 = (TY612058*) setLengthSeq(&(gmemcachedata_612079)->Sup, sizeof(tmoduleinmemory612017), ((NI) ((NI32)(fileidx + ((NI32) 1)))));
		}
		LA7: ;
		gmemcachedata_612079->data[fileidx].Needsrecompile = ((NU8) 3);
		result = newmodule_612649(fileidx);
		rd = 0;
		(*result).Flags = ((*result).Flags | flags);
		{
			if (!((18438 &(1<<((gcmd_170120)&31)))!=0)) goto LA11;
			rd = handlesymbolfile_277071(result);
			{
				if (!((*result).Sup.Id < 0)) goto LA15;
				internalerror_199006(((NimStringDesc*) &TMP1437));
				goto BeforeRet;
			}
			LA15: ;
		}
		goto LA9;
		LA11: ;
		{
			(*result).Sup.Id = getid_225404();
		}
		LA9: ;
		processmodule_287056(result, NIM_NIL, rd);
		{
			if (!((gglobaloptions_170118 &(1<<((((NU8) 15))&31)))!=0)) goto LA20;
			gmemcachedata_612079->data[fileidx].Compiledat = glastcmdtime_170131;
			gmemcachedata_612079->data[fileidx].Needsrecompile = ((NU8) 4);
			docrc_612164(fileidx);
		}
		LA20: ;
	}
	goto LA1;
	LA3: ;
	{
		{
			NU8 LOC25;
			LOC25 = 0;
			LOC25 = checkdepmem_612462(fileidx);
			if (!(LOC25 == ((NU8) 2))) goto LA26;
			result = compilemodule_612776(fileidx, flags);
		}
		goto LA23;
		LA26: ;
		{
			result = gcompiledmodules_612057->data[fileidx];
		}
		LA23: ;
	}
	LA1: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(tsym226846*, importmodule_612887)(tsym226846* s, NI32 fileidx) {
	tsym226846* result;
	result = 0;
	result = compilemodule_612776(fileidx, 0);
	{
		if (!((gglobaloptions_170118 &(1<<((((NU8) 15))&31)))!=0)) goto LA3;
		adddep_612182(s, fileidx);
	}
	LA3: ;
	{
		if (!(((*result).Flags &(1<<((((NU8) 13))&31)))!=0)) goto LA7;
		localerror_198955((*result).Info, ((NU16) 40), (*(*result).Name).S);
	}
	LA7: ;
	return result;
}

N_NIMCALL(void, wantmainmodule_613014)(void) {
	NimStringDesc* LOC5;
	{
		if (!(gprojectfull_170236->Sup.len == 0)) goto LA3;
		fatal_198923(gcmdlineinfo_197191, ((NU16) 186), ((NimStringDesc*) &TMP4139));
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = nosaddFileExt(gprojectfull_170236, ((NimStringDesc*) &TMP4140));
	gprojectmainidx_170237 = fileinfoidx_196747(LOC5);
}

N_NIMCALL(void, compilesystemmodule_612988)(void) {
	{
		NimStringDesc* LOC5;
		tsym226846* LOC6;
		if (!(systemmodule_283019 == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = HEX2F_117299(libpath_170233, ((NimStringDesc*) &TMP4141));
		systemfileidx_196643 = fileinfoidx_196747(LOC5);
		LOC6 = 0;
		LOC6 = compilemodule_612776(systemfileidx_196643, 8192);
	}
	LA3: ;
}

N_NIMCALL(void, compileproject_613077)(NI32 projectfileidx) {
	NI32 systemfileidx;
	NimStringDesc* LOC1;
	NI32 projectfile;
	wantmainmodule_613014();
	LOC1 = 0;
	LOC1 = HEX2F_117299(libpath_170233, ((NimStringDesc*) &TMP4141));
	systemfileidx = fileinfoidx_196747(LOC1);
	{
		if (!(projectfileidx < ((NI32) 0))) goto LA4;
		projectfile = gprojectmainidx_170237;
	}
	goto LA2;
	LA4: ;
	{
		projectfile = projectfileidx;
	}
	LA2: ;
	{
		tsym226846* LOC11;
		if (!(projectfile == systemfileidx)) goto LA9;
		LOC11 = 0;
		LOC11 = compilemodule_612776(projectfile, 12288);
	}
	goto LA7;
	LA9: ;
	{
		tsym226846* LOC13;
		compilesystemmodule_612988();
		LOC13 = 0;
		LOC13 = compilemodule_612776(projectfile, 4096);
	}
	LA7: ;
}

N_NIMCALL(tsym226846*, makestdinmodule_613097)(void) {
	tsym226846* result;
	result = 0;
	{
		NI32 LOC5;
		if (!(stdinmodule_613092 == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = fileinfoidx_196747(((NimStringDesc*) &TMP4851));
		asgnRefNoCycle((void**) (&stdinmodule_613092), newmodule_612649(LOC5));
		(*stdinmodule_613092).Sup.Id = getid_225404();
	}
	LA3: ;
	result = stdinmodule_613092;
	return result;
}

N_NIMCALL(void, resetallmodules_612411)(void) {
	{
		NI i_612423;
		NI HEX3Atmp_612442;
		NI res_612445;
		i_612423 = 0;
		HEX3Atmp_612442 = 0;
		HEX3Atmp_612442 = (gcompiledmodules_612057->Sup.len-1);
		res_612445 = 0;
		{
			while (1) {
				if (!(res_612445 <= HEX3Atmp_612442)) goto LA3;
				i_612423 = res_612445;
				{
					if (!!((gcompiledmodules_612057->data[i_612423] == NIM_NIL))) goto LA6;
					resetmodule_612402(((NI32) (i_612423)));
				}
				LA6: ;
				res_612445 += 1;
			} LA3: ;
		}
	}
	resetpackagecache_170605();
}
NIM_EXTERNC N_NOINLINE(void, HEX00_modulesInit)(void) {
	if (gcompiledmodules_612057) nimGCunrefNoCycle(gcompiledmodules_612057);
	gcompiledmodules_612057 = (tsymseq226818*) newSeqRC1((&NTI226818), 0);
	if (gmemcachedata_612079) nimGCunrefNoCycle(gmemcachedata_612079);
	gmemcachedata_612079 = (TY612058*) newSeqRC1((&NTI612058), 0);
	gincludefile_287073 = includemodule_612926;
	gimportmodule_287068 = importmodule_612887;
}

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

