/* Generated by Nim Compiler v0.13.0 */
/*   (c) 2015 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 32

#include "nimbase.h"
#include <string.h>
#include <glob.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct Tlinkedlist135016 Tlinkedlist135016;
typedef struct Tlistentry135010 Tlistentry135010;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Cell47505 Cell47505;
typedef struct TNimType TNimType;
typedef struct Cellseq47521 Cellseq47521;
typedef struct Gcheap49818 Gcheap49818;
typedef struct Gcstack49816 Gcstack49816;
typedef struct Cellset47517 Cellset47517;
typedef struct Pagedesc47513 Pagedesc47513;
typedef struct Memregion29687 Memregion29687;
typedef struct Smallchunk29639 Smallchunk29639;
typedef struct Llchunk29681 Llchunk29681;
typedef struct Bigchunk29641 Bigchunk29641;
typedef struct Intset29614 Intset29614;
typedef struct Trunk29610 Trunk29610;
typedef struct Avlnode29685 Avlnode29685;
typedef struct Gcstat49814 Gcstat49814;
typedef struct Stringtableobj140209 Stringtableobj140209;
typedef struct TNimNode TNimNode;
typedef struct TY125202 TY125202;
typedef struct Keyvaluepair140205 Keyvaluepair140205;
typedef struct TY118706 TY118706;
typedef struct Exception Exception;
typedef struct TNimObject TNimObject;
typedef struct TSafePoint TSafePoint;
typedef struct Tstrentry135012 Tstrentry135012;
typedef struct Basechunk29637 Basechunk29637;
typedef struct Freecell29629 Freecell29629;
typedef struct Keyvaluepairseq140207 Keyvaluepairseq140207;
struct  Tlinkedlist135016  {
Tlistentry135010* head;
Tlistentry135010* tail;
NI counter;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Cell47505  {
NI refcount;
TNimType* typ;
};
struct  Cellseq47521  {
NI len;
NI cap;
Cell47505** d;
};
struct  Cellset47517  {
NI counter;
NI max;
Pagedesc47513* head;
Pagedesc47513** data;
};
typedef Smallchunk29639* TY29702[512];
typedef Trunk29610* Trunkbuckets29612[256];
struct  Intset29614  {
Trunkbuckets29612 data;
};
struct  Memregion29687  {
NI minlargeobj;
NI maxlargeobj;
TY29702 freesmallchunks;
Llchunk29681* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk29641* freechunkslist;
Intset29614 chunkstarts;
Avlnode29685* root;
Avlnode29685* deleted;
Avlnode29685* last;
Avlnode29685* freeavlnodes;
};
struct  Gcstat49814  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap49818  {
Gcstack49816* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq47521 zct;
Cellseq47521 decstack;
Cellset47517 cycleroots;
Cellseq47521 tempstack;
NI recgclock;
Memregion29687 region;
Gcstat49814 stat;
};
typedef N_NIMCALL_PTR(void, TY3489) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3494) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3489 marker;
TY3494 deepcopy;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct Keyvaluepair140205 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct TY118706 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Exception  {
  TNimObject Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
NimStringDesc* trace;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (Exception* e, void* ClEnv);
void* ClEnv;
} TY17811;
struct  TSafePoint  {
TSafePoint* prev;
NI status;
jmp_buf context;
NIM_BOOL hasRaiseAction;
TY17811 raiseAction;
};
typedef NimStringDesc* TY183752[1];
typedef NimStringDesc* TY184169[2];
struct  Tlistentry135010  {
  TNimObject Sup;
Tlistentry135010* prev;
Tlistentry135010* next;
};
struct  Tstrentry135012  {
  Tlistentry135010 Sup;
NimStringDesc* data;
};
typedef NU8 TY202404[32];
struct  Gcstack49816  {
Gcstack49816* prev;
Gcstack49816* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY29618[16];
struct  Pagedesc47513  {
Pagedesc47513* next;
NI key;
TY29618 bits;
};
struct  Basechunk29637  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk29639  {
  Basechunk29637 Sup;
Smallchunk29639* next;
Smallchunk29639* prev;
Freecell29629* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk29681  {
NI size;
NI acc;
Llchunk29681* next;
};
struct  Bigchunk29641  {
  Basechunk29637 Sup;
Bigchunk29641* next;
Bigchunk29641* prev;
NI align;
NF data;
};
struct  Trunk29610  {
Trunk29610* next;
NI key;
TY29618 bits;
};
typedef Avlnode29685* TY29692[2];
struct  Avlnode29685  {
TY29692 link;
NI key;
NI upperbound;
NI level;
};
struct  Stringtableobj140209  {
  TNimObject Sup;
NI counter;
Keyvaluepairseq140207* data;
NU8 mode;
};
struct  Freecell29629  {
Freecell29629* next;
NI zerofield;
};
struct TY125202 {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq140207 {
  TGenericSeq Sup;
  Keyvaluepair140205 data[SEQ_DECL_SIZE];
};
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(Cell47505*, usrtocell_51440)(void* usr);
static N_INLINE(void, rtladdzct_53001)(Cell47505* c);
N_NOINLINE(void, addzct_51417)(Cellseq47521* s, Cell47505* c);
N_NIMCALL(Stringtableobj140209*, nstnewStringTable)(NU8 mode);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incref_53819)(Cell47505* c);
static N_INLINE(NIM_BOOL, canbecycleroot_51458)(Cell47505* c);
static N_INLINE(void, rtladdcycleroot_52220)(Cell47505* c);
N_NOINLINE(void, incl_48247)(Cellset47517* s, Cell47505* cell);
static N_INLINE(void, decref_53401)(Cell47505* c);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(NimStringDesc*, nosexpandFilename)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, getprefixdir_160295)(void);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, nossplitPath)(NimStringDesc* path, Keyvaluepair140205* Result);
N_NIMCALL(NimStringDesc*, nosgetAppDir)(void);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI start);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI first);
N_NIMCALL(NimStringDesc*, nosparentDir)(NimStringDesc* path);
N_NIMCALL(NIM_BOOL, nsthasKey)(Stringtableobj140209* t, NimStringDesc* key);
N_NIMCALL(NimStringDesc**, nstTake)(Stringtableobj140209* t, NimStringDesc* key);
N_NIMCALL(NimStringDesc*, HEX2F_118465)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY118706* Result);
N_NIMCALL(void, nstPut)(Stringtableobj140209* t, NimStringDesc* key, NimStringDesc* val);
N_NIMCALL(NimStringDesc*, getnimcachedir_160610)(void);
N_NIMCALL(NimStringDesc*, shortendir_160601)(NimStringDesc* dir);
static N_INLINE(void, pushSafePoint)(TSafePoint* s);
N_NIMCALL(void, noscreateDir)(NimStringDesc* dir);
static N_INLINE(void, popSafePoint)(void);
N_NIMCALL(NIM_BOOL, isObj)(TNimType* obj, TNimType* subclass);
static N_INLINE(Exception*, getCurrentException)(void);
static N_INLINE(void, writeline_161405)(FILE* f, NimStringDesc** x, NI xLen0);
N_NIMCALL(void, write_15489)(FILE* f, NimStringDesc* s);
static N_INLINE(void, popCurrentException)(void);
N_NIMCALL(void, reraiseException)(void);
N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NimStringDesc*, nosjoinPathOpenArray)(NimStringDesc** parts, NI partsLen0);
N_NIMCALL(NimStringDesc*, noschangeFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, getpackagename_161006)(NimStringDesc* path);
N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, findfile_161480)(NimStringDesc* f);
N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringDesc* path);
N_NIMCALL(NimStringDesc*, rawfindfile_161448)(NimStringDesc* f);
N_NIMCALL(NimStringDesc*, canonicalizepath_160405)(NimStringDesc* path);
N_NIMCALL(NimStringDesc*, nsuToLowerStr)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, rawfindfile2_161459)(NimStringDesc* f);
N_NIMCALL(void, bringtofront_135693)(Tlinkedlist135016* list, Tlistentry135010* entry);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_79810, NI last);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI first, NI last);
N_NIMCALL(NimStringDesc*, getordefault_140814)(Stringtableobj140209* t, NimStringDesc* key);
N_NIMCALL(NimStringDesc*, canondynlibname_161632)(NimStringDesc* s);
N_NIMCALL(NI, nsuFindCharSet)(NimStringDesc* s, TY202404 chars, NI start);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
N_NIMCALL(NIM_BOOL, nossymlinkExists)(NimStringDesc* link);
N_NIMCALL(NimStringDesc*, findexe_130801)(NimStringDesc* exe);
N_NIMCALL(NimStringDesc*, expandsymlink_131201)(NimStringDesc* symlinkpath);
static N_INLINE(NIM_BOOL, fileexists_121804)(NimStringDesc* filename);
N_NIMCALL(NI, hashString)(NimStringDesc* s);
N_NIMCALL(NI, nsuFindChar)(NimStringDesc* s, NIM_CHAR sub, NI start);
N_NIMCALL(void, libcandidates_161603)(NimStringDesc* s, TY125202** dest);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize);
STRING_LITERAL(TMP41, "", 0);
STRING_LITERAL(TMP1557, "*.nimble", 8);
STRING_LITERAL(TMP1558, "*.babel", 7);
STRING_LITERAL(TMP1559, "nimcache", 8);
STRING_LITERAL(TMP1561, "\012", 1);
STRING_LITERAL(TMP1562, "cannot create directory: ", 25);
STRING_LITERAL(TMP1610, "nim", 3);
STRING_LITERAL(TMP2020, "lib", 3);
static NIM_CONST TY202404 TMP2021 = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
;
STRING_LITERAL(TMP2022, "true", 4);
STRING_LITERAL(TMP2031, "/usr", 4);
STRING_LITERAL(TMP2032, "/usr/lib/nim", 12);
STRING_LITERAL(TMP2033, "/usr/local", 10);
STRING_LITERAL(TMP2034, "/usr/local/lib/nim", 18);
STRING_LITERAL(TMP2035, "system.nim", 10);
STRING_LITERAL(TMP2100, "sug", 3);
STRING_LITERAL(TMP2101, "con", 3);
STRING_LITERAL(TMP2102, "def", 3);
STRING_LITERAL(TMP2103, "use", 3);
STRING_LITERAL(TMP2104, "dus", 3);
STRING_LITERAL(TMP2105, "chk", 3);
STRING_LITERAL(TMP2106, "mod", 3);
STRING_LITERAL(TMP2107, "none", 4);
STRING_LITERAL(TMP2108, "highlight", 9);
STRING_LITERAL(TMP2109, "outline", 7);
NU8 gidecmd_160114;
NU32 goptions_160119;
NU32 gglobaloptions_160121;
NI8 gexitcode_160122;
NU8 gcmd_160123;
NU8 gselectedgc_160124;
Tlinkedlist135016 searchpaths_160125;
Tlinkedlist135016 lazypaths_160126;
NimStringDesc* outfile_160127;
extern Gcheap49818 gch_49859;
NimStringDesc* docseesrcurl_160128;
NimStringDesc* headerfile_160129;
NI gverbosity_160130;
NI gnumberofprocessors_160131;
NIM_BOOL gwholeproject_160132;
NimStringDesc* gevalexpr_160133;
NF glastcmdtime_160134;
NIM_BOOL glistfullpaths_160135;
NIM_BOOL isserving_160136;
NIM_BOOL gnonimblepath_160137;
NIM_BOOL gexperimentalmode_160138;
Stringtableobj140209* gconfigvars_160195;
Stringtableobj140209* gdlloverrides_160196;
NimStringDesc* gprefixdir_160197;
NimStringDesc* libpath_160198;
NimStringDesc* gprojectname_160199;
NimStringDesc* gprojectpath_160200;
NimStringDesc* gprojectfull_160201;
NIM_BOOL gprojectisstdin_160202;
NI32 gprojectmainidx_160203;
NimStringDesc* nimcachedir_160204;
NimStringDesc* command_160205;
TY125202* commandargs_160223;
extern TNimType NTI125202; /* seq[string] */
NIM_BOOL gkeepcomments_160224;
TY125202* implicitimports_160242;
TY125202* implicitincludes_160260;
Stringtableobj140209* packagecache_160801;
TNimType NTI160009; /* TOption */
TNimType NTI160011; /* TOptions */
extern TSafePoint* exchandler_19437;
extern TNimType NTI3630; /* OSError */
extern Exception* currexception_19439;
TNimType NTI160023; /* IdeCmd */

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

static N_INLINE(void, rtladdzct_53001)(Cell47505* c) {
	addzct_51417((&gch_49859.zct), c);
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	Cell47505* c;
	c = usrtocell_51440(p);
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3;
		rtladdzct_53001(c);
	}
	LA3: ;
}

static N_INLINE(NIM_BOOL, canbecycleroot_51458)(Cell47505* c) {
	NIM_BOOL result;
	result = 0;
	result = !((((*(*c).typ).flags &(1U<<((NU)(((NU8) 1))&7U)))!=0));
	return result;
}

static N_INLINE(void, rtladdcycleroot_52220)(Cell47505* c) {
	{
		if (!!((((NI) ((NI)((*c).refcount & ((NI) 3)))) == ((NI) 3)))) goto LA3;
		(*c).refcount = (NI)((NI)((*c).refcount & ((NI) -4)) | ((NI) 3));
		incl_48247((&gch_49859.cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_53819)(Cell47505* c) {
	(*c).refcount = (NI)((NU32)((*c).refcount) + (NU32)(((NI) 8)));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_51458(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_52220(c);
	}
	LA4: ;
}

static N_INLINE(void, decref_53401)(Cell47505* c) {
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3;
		rtladdzct_53001(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_51458(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_52220(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		Cell47505* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_51440(src);
		incref_53819(LOC5);
	}
	LA3: ;
	{
		Cell47505* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_51440((*dest));
		decref_53401(LOC10);
	}
	LA8: ;
	(*dest) = src;
}

N_NIMCALL(NimStringDesc*, canonicalizepath_160405)(NimStringDesc* path) {
	NimStringDesc* result;
	result = 0;
	result = nosexpandFilename(path);
	return result;
}

N_NIMCALL(NimStringDesc*, getprefixdir_160295)(void) {
	NimStringDesc* result;
	result = 0;
	{
		if (!!(((gprefixdir_160197) && (gprefixdir_160197)->Sup.len == 0))) goto LA3;
		result = copyString(gprefixdir_160197);
	}
	goto LA1;
	LA3: ;
	{
		NimStringDesc* LOC6;
		Keyvaluepair140205 LOC7;
		LOC6 = 0;
		LOC6 = nosgetAppDir();
		memset((void*)(&LOC7), 0, sizeof(LOC7));
		nossplitPath(LOC6, (&LOC7));
		result = copyString(LOC7.Field0);
	}
	LA1: ;
	return result;
}

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

static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c) {
	(*dest).data[((*dest).Sup.len)- 0] = c;
	(*dest).data[((NI)((*dest).Sup.len + ((NI) 1)))- 0] = 0;
	(*dest).Sup.len += ((NI) 1);
}

N_NIMCALL(NimStringDesc*, shortendir_160601)(NimStringDesc* dir) {
	NimStringDesc* result;
	NimStringDesc* prefix;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	NimStringDesc* LOC8;
{	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = getprefixdir_160295();
	LOC1 = rawNewString(LOC2->Sup.len + 1);
appendString(LOC1, LOC2);
appendChar(LOC1, 47);
	prefix = LOC1;
	{
		NIM_BOOL LOC5;
		LOC5 = 0;
		LOC5 = nsuStartsWith(dir, prefix);
		if (!LOC5) goto LA6;
		result = copyStr(dir, (prefix ? prefix->Sup.len : 0));
		goto BeforeRet;
	}
	LA6: ;
	LOC8 = 0;
	LOC8 = rawNewString(gprojectpath_160200->Sup.len + 1);
appendString(LOC8, gprojectpath_160200);
appendChar(LOC8, 47);
	prefix = LOC8;
	{
		NIM_BOOL LOC11;
		LOC11 = 0;
		LOC11 = nsuStartsWith(dir, prefix);
		if (!LOC11) goto LA12;
		result = copyStr(dir, (prefix ? prefix->Sup.len : 0));
		goto BeforeRet;
	}
	LA12: ;
	result = copyString(dir);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, getpackagename_161006)(NimStringDesc* path) {
	NimStringDesc* result;
	NI parents;
{	result = 0;
	parents = ((NI) 0);
	{
		{
			NimStringDesc* d_161012;
			NimStringDesc* current_161069;
			d_161012 = 0;
			current_161069 = copyString(path);
			{
				while (1) {
					current_161069 = nosparentDir(current_161069);
					{
						if (!((current_161069 ? current_161069->Sup.len : 0) == ((NI) 0))) goto LA7;
						goto LA3;
					}
					LA7: ;
					d_161012 = current_161069;
					{
						NIM_BOOL LOC11;
						NimStringDesc** LOC14;
						LOC11 = 0;
						LOC11 = nsthasKey(packagecache_160801, d_161012);
						if (!LOC11) goto LA12;
						LOC14 = 0;
						LOC14 = nstTake(packagecache_160801, d_161012);
						result = copyString((*LOC14));
						goto BeforeRet;
					}
					LA12: ;
					parents += ((NI) 1);
					{
						NimStringDesc* file_161022;
						NimStringDesc* HEX3Atmp_161036;
						glob_t f_161040;
						NI res_161042;
						int LOC16;
						file_161022 = 0;
						HEX3Atmp_161036 = 0;
						HEX3Atmp_161036 = HEX2F_118465(d_161012, ((NimStringDesc*) &TMP1557));
						memset((void*)(&f_161040), 0, sizeof(f_161040));
						res_161042 = 0;
						f_161040.gl_offs = ((NI) 0);
						f_161040.gl_pathc = ((NI) 0);
						f_161040.gl_pathv = NIM_NIL;
						LOC16 = 0;
						LOC16 = glob(HEX3Atmp_161036->data, ((int) 0), NIM_NIL, (&f_161040));
						res_161042 = ((NI) (LOC16));
						{
							if (!(res_161042 == ((NI) 0))) goto LA19;
							{
								NI i_161044;
								NI HEX3Atmp_161046;
								NI res_161048;
								i_161044 = 0;
								HEX3Atmp_161046 = 0;
								HEX3Atmp_161046 = (NI)(f_161040.gl_pathc - ((NI) 1));
								res_161048 = ((NI) 0);
								{
									while (1) {
										TY118706 LOC24;
										if (!(res_161048 <= HEX3Atmp_161046)) goto LA23;
										i_161044 = res_161048;
										file_161022 = cstrToNimstr(f_161040.gl_pathv[(i_161044)- 0]);
										memset((void*)(&LOC24), 0, sizeof(LOC24));
										nossplitFile(file_161022, (&LOC24));
										result = copyString(LOC24.Field1);
										goto LA1;
										res_161048 += ((NI) 1);
									} LA23: ;
								}
							}
						}
						LA19: ;
						globfree((&f_161040));
					}
					{
						NimStringDesc* file_161023;
						NimStringDesc* HEX3Atmp_161052;
						glob_t f_161056;
						NI res_161058;
						int LOC26;
						file_161023 = 0;
						HEX3Atmp_161052 = 0;
						HEX3Atmp_161052 = HEX2F_118465(d_161012, ((NimStringDesc*) &TMP1558));
						memset((void*)(&f_161056), 0, sizeof(f_161056));
						res_161058 = 0;
						f_161056.gl_offs = ((NI) 0);
						f_161056.gl_pathc = ((NI) 0);
						f_161056.gl_pathv = NIM_NIL;
						LOC26 = 0;
						LOC26 = glob(HEX3Atmp_161052->data, ((int) 0), NIM_NIL, (&f_161056));
						res_161058 = ((NI) (LOC26));
						{
							if (!(res_161058 == ((NI) 0))) goto LA29;
							{
								NI i_161060;
								NI HEX3Atmp_161062;
								NI res_161064;
								i_161060 = 0;
								HEX3Atmp_161062 = 0;
								HEX3Atmp_161062 = (NI)(f_161056.gl_pathc - ((NI) 1));
								res_161064 = ((NI) 0);
								{
									while (1) {
										TY118706 LOC34;
										if (!(res_161064 <= HEX3Atmp_161062)) goto LA33;
										i_161060 = res_161064;
										file_161023 = cstrToNimstr(f_161056.gl_pathv[(i_161060)- 0]);
										memset((void*)(&LOC34), 0, sizeof(LOC34));
										nossplitFile(file_161023, (&LOC34));
										result = copyString(LOC34.Field1);
										goto LA1;
										res_161064 += ((NI) 1);
									} LA33: ;
								}
							}
						}
						LA29: ;
						globfree((&f_161056));
					}
				}
			} LA3: ;
		}
	} LA1: ;
	{
		if (!result == 0) goto LA37;
		result = copyString(((NimStringDesc*) &TMP41));
	}
	LA37: ;
	{
		NimStringDesc* d_161024;
		NimStringDesc* current_161073;
		d_161024 = 0;
		current_161073 = copyString(path);
		{
			while (1) {
				current_161073 = nosparentDir(current_161073);
				{
					if (!((current_161073 ? current_161073->Sup.len : 0) == ((NI) 0))) goto LA44;
					goto LA40;
				}
				LA44: ;
				d_161024 = current_161073;
				nstPut(packagecache_160801, d_161024, result);
				parents -= ((NI) 1);
				{
					if (!(parents <= ((NI) 0))) goto LA48;
					goto LA39;
				}
				LA48: ;
			}
		} LA40: ;
	} LA39: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, getnimcachedir_160610)(void) {
	NimStringDesc* result;
	result = 0;
	{
		if (!(((NI) 0) < (nimcachedir_160204 ? nimcachedir_160204->Sup.len : 0))) goto LA3;
		result = copyString(nimcachedir_160204);
	}
	goto LA1;
	LA3: ;
	{
		NimStringDesc* LOC6;
		LOC6 = 0;
		LOC6 = shortendir_160601(gprojectpath_160200);
		result = HEX2F_118465(LOC6, ((NimStringDesc*) &TMP1559));
	}
	LA1: ;
	return result;
}

static N_INLINE(void, pushSafePoint)(TSafePoint* s) {
	(*s).hasRaiseAction = NIM_FALSE;
	(*s).prev = exchandler_19437;
	exchandler_19437 = s;
}

static N_INLINE(void, popSafePoint)(void) {
	exchandler_19437 = (*exchandler_19437).prev;
}

static N_INLINE(Exception*, getCurrentException)(void) {
	Exception* result;
	result = 0;
	result = currexception_19439;
	return result;
}

static N_INLINE(void, writeline_161405)(FILE* f, NimStringDesc** x, NI xLen0) {
	{
		NimStringDesc* i_161420;
		NI i_161428;
		i_161420 = 0;
		i_161428 = ((NI) 0);
		{
			while (1) {
				if (!(i_161428 < xLen0)) goto LA3;
				i_161420 = x[i_161428];
				write_15489(f, i_161420);
				i_161428 += ((NI) 1);
			} LA3: ;
		}
	}
	write_15489(f, ((NimStringDesc*) &TMP1561));
}

static N_INLINE(void, popCurrentException)(void) {
	asgnRef((void**) (&currexception_19439), NIM_NIL);
}

N_NIMCALL(NimStringDesc*, completegeneratedfilepath_161201)(NimStringDesc* f, NIM_BOOL createsubdir) {
	NimStringDesc* result;
	Keyvaluepair140205 LOC1;
	NimStringDesc* head;
	NimStringDesc* tail;
	NimStringDesc* subdir;
	result = 0;
	memset((void*)(&LOC1), 0, sizeof(LOC1));
	nossplitPath(f, (&LOC1));
	head = 0;
	head = copyString(LOC1.Field0);
	tail = 0;
	tail = copyString(LOC1.Field1);
	subdir = getnimcachedir_160610();
	{
		TSafePoint TMP1560;
		if (!createsubdir) goto LA4;
		pushSafePoint(&TMP1560);
		TMP1560.status = _setjmp(TMP1560.context);
		if (TMP1560.status == 0) {
			noscreateDir(subdir);
			popSafePoint();
		}
		else {
			popSafePoint();
			if (isObj(getCurrentException()->Sup.m_type, (&NTI3630))) {
				TY183752 LOC9;
				NimStringDesc* LOC10;
				TMP1560.status = 0;
				memset((void*)LOC9, 0, sizeof(LOC9));
				LOC10 = 0;
				LOC10 = rawNewString(subdir->Sup.len + 25);
appendString(LOC10, ((NimStringDesc*) &TMP1562));
appendString(LOC10, subdir);
				LOC9[0] = LOC10;
				writeline_161405(stdout, LOC9, 1);
				exit(((NI) 1));
				popCurrentException();
			}
		}
		if (TMP1560.status != 0) reraiseException();
	}
	LA4: ;
	result = nosjoinPath(subdir, tail);
	return result;
}

N_NIMCALL(NimStringDesc*, togeneratedfile_161082)(NimStringDesc* path, NimStringDesc* ext) {
	NimStringDesc* result;
	Keyvaluepair140205 LOC1;
	NimStringDesc* head;
	NimStringDesc* tail;
	TY184169 LOC2;
	result = 0;
	memset((void*)(&LOC1), 0, sizeof(LOC1));
	nossplitPath(path, (&LOC1));
	head = 0;
	head = copyString(LOC1.Field0);
	tail = 0;
	tail = copyString(LOC1.Field1);
	memset((void*)LOC2, 0, sizeof(LOC2));
	LOC2[0] = getnimcachedir_160610();
	LOC2[1] = noschangeFileExt(tail, ext);
	result = nosjoinPathOpenArray(LOC2, 2);
	return result;
}

N_NIMCALL(NimStringDesc*, withpackagename_161074)(NimStringDesc* path) {
	NimStringDesc* result;
	NimStringDesc* x;
	result = 0;
	x = getpackagename_161006(path);
	{
		if (!((x ? x->Sup.len : 0) == ((NI) 0))) goto LA3;
		result = copyString(path);
	}
	goto LA1;
	LA3: ;
	{
		TY118706 LOC6;
		NimStringDesc* p;
		NimStringDesc* file;
		NimStringDesc* ext;
		NimStringDesc* LOC7;
		NimStringDesc* LOC8;
		NimStringDesc* LOC9;
		memset((void*)(&LOC6), 0, sizeof(LOC6));
		nossplitFile(path, (&LOC6));
		p = 0;
		p = LOC6.Field0;
		file = 0;
		file = LOC6.Field1;
		ext = 0;
		ext = LOC6.Field2;
		LOC7 = 0;
		LOC8 = 0;
		LOC8 = rawNewString(x->Sup.len + file->Sup.len + 1);
appendString(LOC8, x);
appendChar(LOC8, 95);
appendString(LOC8, file);
		LOC9 = 0;
		LOC9 = HEX2F_118465(p, LOC8);
		LOC7 = rawNewString(LOC9->Sup.len + ext->Sup.len + 0);
appendString(LOC7, LOC9);
appendString(LOC7, ext);
		result = LOC7;
	}
	LA1: ;
	return result;
}

N_NIMCALL(NimStringDesc*, rawfindfile_161448)(NimStringDesc* f) {
	NimStringDesc* result;
{	result = 0;
	{
		NimStringDesc* it_161452;
		Tstrentry135012* it_161458;
		it_161452 = 0;
		it_161458 = ((Tstrentry135012*) (searchpaths_160125.head));
		{
			while (1) {
				if (!!((it_161458 == NIM_NIL))) goto LA3;
				it_161452 = (*it_161458).data;
				result = nosjoinPath(it_161452, f);
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = nosexistsFile(result);
					if (!LOC6) goto LA7;
					result = canonicalizepath_160405(result);
					goto BeforeRet;
				}
				LA7: ;
				it_161458 = ((Tstrentry135012*) ((*it_161458).Sup.next));
			} LA3: ;
		}
	}
	result = copyString(((NimStringDesc*) &TMP41));
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, rawfindfile2_161459)(NimStringDesc* f) {
	NimStringDesc* result;
	Tstrentry135012* it;
{	result = 0;
	it = ((Tstrentry135012*) (lazypaths_160126.head));
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA2;
			result = nosjoinPath((*it).data, f);
			{
				NIM_BOOL LOC5;
				Tlistentry135010* LOC8;
				LOC5 = 0;
				LOC5 = nosexistsFile(result);
				if (!LOC5) goto LA6;
				LOC8 = 0;
				LOC8 = &it->Sup;
				bringtofront_135693((&lazypaths_160126), LOC8);
				result = canonicalizepath_160405(result);
				goto BeforeRet;
			}
			LA6: ;
			it = ((Tstrentry135012*) ((*it).Sup.next));
		} LA2: ;
	}
	result = copyString(((NimStringDesc*) &TMP41));
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, findfile_161480)(NimStringDesc* f) {
	NimStringDesc* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = nosisAbsolute(f);
		if (!LOC3) goto LA4;
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = nosexistsFile(f);
			if (!LOC8) goto LA9;
			result = copyString(f);
		}
		goto LA6;
		LA9: ;
		{
			result = copyString(((NimStringDesc*) &TMP41));
		}
		LA6: ;
	}
	goto LA1;
	LA4: ;
	{
		result = rawfindfile_161448(f);
		{
			NimStringDesc* LOC17;
			if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA15;
			LOC17 = 0;
			LOC17 = nsuToLowerStr(f);
			result = rawfindfile_161448(LOC17);
			{
				if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA20;
				result = rawfindfile2_161459(f);
				{
					NimStringDesc* LOC26;
					if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA24;
					LOC26 = 0;
					LOC26 = nsuToLowerStr(f);
					result = rawfindfile2_161459(LOC26);
				}
				LA24: ;
			}
			LA20: ;
		}
		LA15: ;
	}
	LA1: ;
	return result;
}

N_NIMCALL(NimStringDesc*, findmodule_161484)(NimStringDesc* modulename, NimStringDesc* currentmodule) {
	NimStringDesc* result;
	NimStringDesc* m;
	NimStringDesc* currentpath;
	TY118706 LOC1;
	result = 0;
	m = nosaddFileExt(modulename, ((NimStringDesc*) &TMP1610));
	memset((void*)(&LOC1), 0, sizeof(LOC1));
	nossplitFile(currentmodule, (&LOC1));
	currentpath = LOC1.Field0;
	result = HEX2F_118465(currentpath, m);
	{
		NIM_BOOL LOC4;
		LOC4 = 0;
		LOC4 = nosexistsFile(result);
		if (!!(LOC4)) goto LA5;
		result = findfile_161480(m);
	}
	LA5: ;
	return result;
}

N_NIMCALL(NimStringDesc*, removetrailingdirsep_160606)(NimStringDesc* path) {
	NimStringDesc* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (((NI) 0) < (path ? path->Sup.len : 0));
		if (!(LOC3)) goto LA4;
		LOC3 = ((NU8)(path->data[(NI)((path ? path->Sup.len : 0) - ((NI) 1))]) == (NU8)(47));
		LA4: ;
		if (!LOC3) goto LA5;
		result = copyStrLast(path, ((NI) 0), (NI)((path ? path->Sup.len : 0) - ((NI) 2)));
	}
	goto LA1;
	LA5: ;
	{
		result = copyString(path);
	}
	LA1: ;
	return result;
}

N_NIMCALL(NimStringDesc*, getconfigvar_160282)(NimStringDesc* key) {
	NimStringDesc* result;
	result = 0;
	result = getordefault_140814(gconfigvars_160195, key);
	return result;
}

N_NIMCALL(NIM_BOOL, existsconfigvar_160278)(NimStringDesc* key) {
	NIM_BOOL result;
	result = 0;
	result = nsthasKey(gconfigvars_160195, key);
	return result;
}

N_NIMCALL(NimStringDesc*, canondynlibname_161632)(NimStringDesc* s) {
	NimStringDesc* result;
	NI start;
	NI ende;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = nsuStartsWith(s, ((NimStringDesc*) &TMP2020));
		if (!LOC3) goto LA4;
		start = ((NI) 3);
	}
	goto LA1;
	LA4: ;
	{
		start = ((NI) 0);
	}
	LA1: ;
	ende = nsuFindCharSet(s, TMP2021, ((NI) 0));
	{
		if (!(((NI) 0) <= ende)) goto LA9;
		result = copyStrLast(s, start, (NI)(ende - ((NI) 1)));
	}
	goto LA7;
	LA9: ;
	{
		result = copyStr(s, start);
	}
	LA7: ;
	return result;
}

N_NIMCALL(void, incldynliboverride_161639)(NimStringDesc* lib) {
	NimStringDesc* LOC1;
	LOC1 = 0;
	LOC1 = canondynlibname_161632(lib);
	nstPut(gdlloverrides_160196, LOC1, ((NimStringDesc*) &TMP2022));
}

N_NIMCALL(void, setconfigvar_160286)(NimStringDesc* key, NimStringDesc* val) {
	nstPut(gconfigvars_160195, key, val);
}

static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b) {
	NIM_BOOL result;
	NIM_BOOL LOC11;
	int LOC13;
{	result = 0;
	{
		if (!(a == b)) goto LA3;
		result = NIM_TRUE;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = (a == NIM_NIL);
		if (LOC7) goto LA8;
		LOC7 = (b == NIM_NIL);
		LA8: ;
		if (!LOC7) goto LA9;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA9: ;
	LOC11 = 0;
	LOC11 = ((*a).Sup.len == (*b).Sup.len);
	if (!(LOC11)) goto LA12;
	LOC13 = 0;
	LOC13 = memcmp(((NCSTRING) ((*a).data)), ((NCSTRING) ((*b).data)), (*a).Sup.len);
	LOC11 = (LOC13 == ((NI32) 0));
	LA12: ;
	result = LOC11;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		Cell47505* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_51440(src);
		(*c).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Cell47505* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_51440((*dest));
		{
			(*c).refcount -= ((NI) 8);
			if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA11;
			rtladdzct_53001(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

static N_INLINE(NIM_BOOL, fileexists_121804)(NimStringDesc* filename) {
	NIM_BOOL result;
	result = 0;
	result = nosexistsFile(filename);
	return result;
}

N_NIMCALL(void, setdefaultlibpath_160298)(void) {
	{
		NimStringDesc* prefix;
		NimStringDesc* realnimpath;
		NimStringDesc* parentnimlibpath;
		NimStringDesc* LOC23;
		NimStringDesc* LOC24;
		if (!((libpath_160198) && (libpath_160198)->Sup.len == 0)) goto LA3;
		prefix = getprefixdir_160295();
		{
			NimStringDesc* LOC9;
			if (!eqStrings(prefix, ((NimStringDesc*) &TMP2031))) goto LA7;
			LOC9 = 0;
			LOC9 = libpath_160198; libpath_160198 = copyStringRC1(((NimStringDesc*) &TMP2032));
			if (LOC9) nimGCunrefNoCycle(LOC9);
		}
		goto LA5;
		LA7: ;
		{
			NimStringDesc* LOC13;
			if (!eqStrings(prefix, ((NimStringDesc*) &TMP2033))) goto LA11;
			LOC13 = 0;
			LOC13 = libpath_160198; libpath_160198 = copyStringRC1(((NimStringDesc*) &TMP2034));
			if (LOC13) nimGCunrefNoCycle(LOC13);
		}
		goto LA5;
		LA11: ;
		{
			asgnRefNoCycle((void**) (&libpath_160198), nosjoinPath(prefix, ((NimStringDesc*) &TMP2020)));
		}
		LA5: ;
		{
			NimStringDesc* LOC17;
			NIM_BOOL LOC18;
			NimStringDesc* LOC21;
			LOC17 = 0;
			LOC17 = findexe_130801(((NimStringDesc*) &TMP1610));
			LOC18 = 0;
			LOC18 = nossymlinkExists(LOC17);
			if (!LOC18) goto LA19;
			LOC21 = 0;
			LOC21 = findexe_130801(((NimStringDesc*) &TMP1610));
			realnimpath = expandsymlink_131201(LOC21);
		}
		goto LA15;
		LA19: ;
		{
			realnimpath = findexe_130801(((NimStringDesc*) &TMP1610));
		}
		LA15: ;
		LOC23 = 0;
		LOC23 = nosparentDir(realnimpath);
		LOC24 = 0;
		LOC24 = nosparentDir(LOC23);
		parentnimlibpath = HEX2F_118465(LOC24, ((NimStringDesc*) &TMP2020));
		{
			NIM_BOOL LOC27;
			NimStringDesc* LOC28;
			NIM_BOOL LOC29;
			NimStringDesc* LOC31;
			NimStringDesc* LOC34;
			LOC27 = 0;
			LOC28 = 0;
			LOC28 = HEX2F_118465(libpath_160198, ((NimStringDesc*) &TMP2035));
			LOC29 = 0;
			LOC29 = fileexists_121804(LOC28);
			LOC27 = !(LOC29);
			if (!(LOC27)) goto LA30;
			LOC31 = 0;
			LOC31 = HEX2F_118465(parentnimlibpath, ((NimStringDesc*) &TMP2035));
			LOC27 = fileexists_121804(LOC31);
			LA30: ;
			if (!LOC27) goto LA32;
			LOC34 = 0;
			LOC34 = libpath_160198; libpath_160198 = copyStringRC1(parentnimlibpath);
			if (LOC34) nimGCunrefNoCycle(LOC34);
		}
		LA32: ;
	}
	LA3: ;
}

N_NIMCALL(NimStringDesc*, HEX24_161680)(NU8 c) {
	NimStringDesc* result;
	result = 0;
	switch (c) {
	case ((NU8) 1):
	{
		result = copyString(((NimStringDesc*) &TMP2100));
	}
	break;
	case ((NU8) 2):
	{
		result = copyString(((NimStringDesc*) &TMP2101));
	}
	break;
	case ((NU8) 3):
	{
		result = copyString(((NimStringDesc*) &TMP2102));
	}
	break;
	case ((NU8) 4):
	{
		result = copyString(((NimStringDesc*) &TMP2103));
	}
	break;
	case ((NU8) 5):
	{
		result = copyString(((NimStringDesc*) &TMP2104));
	}
	break;
	case ((NU8) 6):
	{
		result = copyString(((NimStringDesc*) &TMP2105));
	}
	break;
	case ((NU8) 7):
	{
		result = copyString(((NimStringDesc*) &TMP2106));
	}
	break;
	case ((NU8) 0):
	{
		result = copyString(((NimStringDesc*) &TMP2107));
	}
	break;
	case ((NU8) 8):
	{
		result = copyString(((NimStringDesc*) &TMP2108));
	}
	break;
	case ((NU8) 9):
	{
		result = copyString(((NimStringDesc*) &TMP2109));
	}
	break;
	}
	return result;
}

N_NIMCALL(NU8, parseidecmd_161676)(NimStringDesc* s) {
	NU8 result;
	result = 0;
	switch (hashString(s) & 15) {
	case 2: 
if (eqStrings(s, ((NimStringDesc*) &TMP2100))) goto LA1;
break;
	case 3: 
if (eqStrings(s, ((NimStringDesc*) &TMP2105))) goto LA6;
break;
	case 6: 
if (eqStrings(s, ((NimStringDesc*) &TMP2109))) goto LA9;
break;
	case 10: 
if (eqStrings(s, ((NimStringDesc*) &TMP2103))) goto LA4;
break;
	case 11: 
if (eqStrings(s, ((NimStringDesc*) &TMP2102))) goto LA3;
break;
	case 12: 
if (eqStrings(s, ((NimStringDesc*) &TMP2101))) goto LA2;
break;
	case 13: 
if (eqStrings(s, ((NimStringDesc*) &TMP2104))) goto LA5;
break;
	case 14: 
if (eqStrings(s, ((NimStringDesc*) &TMP2108))) goto LA8;
break;
	case 15: 
if (eqStrings(s, ((NimStringDesc*) &TMP2106))) goto LA7;
break;
	}
	goto LA10;
	LA1: ;
	{
		result = ((NU8) 1);
	}
	goto LA11;
	LA2: ;
	{
		result = ((NU8) 2);
	}
	goto LA11;
	LA3: ;
	{
		result = ((NU8) 3);
	}
	goto LA11;
	LA4: ;
	{
		result = ((NU8) 4);
	}
	goto LA11;
	LA5: ;
	{
		result = ((NU8) 5);
	}
	goto LA11;
	LA6: ;
	{
		result = ((NU8) 6);
	}
	goto LA11;
	LA7: ;
	{
		result = ((NU8) 7);
	}
	goto LA11;
	LA8: ;
	{
		result = ((NU8) 8);
	}
	goto LA11;
	LA9: ;
	{
		result = ((NU8) 9);
	}
	goto LA11;
	LA10: ;
	{
		result = ((NU8) 0);
	}
	LA11: ;
	return result;
}

N_NIMCALL(NIM_BOOL, isdynliboverride_161642)(NimStringDesc* lib) {
	NIM_BOOL result;
	NimStringDesc* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = canondynlibname_161632(lib);
	result = nsthasKey(gdlloverrides_160196, LOC1);
	return result;
}

N_NIMCALL(void, resetpackagecache_160802)(void) {
	asgnRef((void**) (&packagecache_160801), nstnewStringTable(((NU8) 1)));
}

N_NIMCALL(void, libcandidates_161603)(NimStringDesc* s, TY125202** dest) {
	NI le;
	NI ri;
	le = nsuFindChar(s, 40, ((NI) 0));
	ri = nsuFindChar(s, 41, ((NI) ((NI)(le + ((NI) 1)))));
	{
		NIM_BOOL LOC3;
		NimStringDesc* prefix;
		NimStringDesc* suffix;
		LOC3 = 0;
		LOC3 = (((NI) 0) <= le);
		if (!(LOC3)) goto LA4;
		LOC3 = (le < ri);
		LA4: ;
		if (!LOC3) goto LA5;
		prefix = copyStrLast(s, ((NI) 0), (NI)(le - ((NI) 1)));
		suffix = copyStr(s, (NI)(ri + ((NI) 1)));
		{
			NimStringDesc* middle_161613;
			NimStringDesc* HEX3Atmp_161625;
			NI last_161629;
			middle_161613 = 0;
			HEX3Atmp_161625 = 0;
			HEX3Atmp_161625 = copyStrLast(s, (NI)(le + ((NI) 1)), (NI)(ri - ((NI) 1)));
			last_161629 = ((NI) 0);
			{
				if (!(((NI) 0) < (HEX3Atmp_161625 ? HEX3Atmp_161625->Sup.len : 0))) goto LA10;
				{
					while (1) {
						NI first_161631;
						NimStringDesc* LOC18;
						if (!(last_161629 <= (HEX3Atmp_161625 ? HEX3Atmp_161625->Sup.len : 0))) goto LA13;
						first_161631 = last_161629;
						{
							while (1) {
								NIM_BOOL LOC16;
								LOC16 = 0;
								LOC16 = (last_161629 < (HEX3Atmp_161625 ? HEX3Atmp_161625->Sup.len : 0));
								if (!(LOC16)) goto LA17;
								LOC16 = !(((NU8)(HEX3Atmp_161625->data[last_161629]) == (NU8)(124)));
								LA17: ;
								if (!LOC16) goto LA15;
								last_161629 += ((NI) 1);
							} LA15: ;
						}
						middle_161613 = copyStrLast(HEX3Atmp_161625, first_161631, (NI)(last_161629 - ((NI) 1)));
						LOC18 = 0;
						LOC18 = rawNewString(prefix->Sup.len + middle_161613->Sup.len + suffix->Sup.len + 0);
appendString(LOC18, prefix);
appendString(LOC18, middle_161613);
appendString(LOC18, suffix);
						libcandidates_161603(LOC18, dest);
						last_161629 += ((NI) 1);
					} LA13: ;
				}
			}
			LA10: ;
		}
	}
	goto LA1;
	LA5: ;
	{
		NimStringDesc* LOC20;
		(*dest) = (TY125202*) incrSeqV2(&((*dest))->Sup, sizeof(NimStringDesc*));
		LOC20 = 0;
		LOC20 = (*dest)->data[(*dest)->Sup.len]; (*dest)->data[(*dest)->Sup.len] = copyStringRC1(s);
		if (LOC20) nimGCunrefNoCycle(LOC20);
		++(*dest)->Sup.len;
	}
	LA1: ;
}

N_NIMCALL(NimStringDesc*, getoutfile_160290)(NimStringDesc* filename, NimStringDesc* ext) {
	NimStringDesc* result;
	result = 0;
	{
		if (!!(((outfile_160127) && (outfile_160127)->Sup.len == 0))) goto LA3;
		result = copyString(outfile_160127);
	}
	goto LA1;
	LA3: ;
	{
		result = noschangeFileExt(filename, ext);
	}
	LA1: ;
	return result;
}

N_NIMCALL(NimStringDesc*, maincommandarg_160267)(void) {
	NimStringDesc* result;
	result = 0;
	{
		if (!(((NI) 0) < (commandargs_160223 ? commandargs_160223->Sup.len : 0))) goto LA3;
		result = copyString(commandargs_160223->data[((NI) 0)]);
	}
	goto LA1;
	LA3: ;
	{
		result = copyString(gprojectname_160199);
	}
	LA1: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_optionsInit000)(void) {
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	NimStringDesc* LOC3;
	NimStringDesc* LOC4;
	NimStringDesc* LOC5;
	NimStringDesc* LOC6;
	NimStringDesc* LOC7;
	NimStringDesc* LOC8;
	NimStringDesc* LOC9;
	NimStringDesc* LOC10;
	NimStringDesc* LOC11;
	goptions_160119 = 2202238;
	gglobaloptions_160121 = 16777216;
	gcmd_160123 = ((NU8) 0);
	gselectedgc_160124 = ((NU8) 4);
	LOC1 = 0;
	LOC1 = outfile_160127; outfile_160127 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC1) nimGCunrefNoCycle(LOC1);
	LOC2 = 0;
	LOC2 = docseesrcurl_160128; docseesrcurl_160128 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC2) nimGCunrefNoCycle(LOC2);
	LOC3 = 0;
	LOC3 = headerfile_160129; headerfile_160129 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC3) nimGCunrefNoCycle(LOC3);
	gverbosity_160130 = ((NI) 1);
	LOC4 = 0;
	LOC4 = gevalexpr_160133; gevalexpr_160133 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC4) nimGCunrefNoCycle(LOC4);
	isserving_160136 = NIM_FALSE;
	gnonimblepath_160137 = NIM_FALSE;
	asgnRef((void**) (&gconfigvars_160195), nstnewStringTable(((NU8) 2)));
	asgnRef((void**) (&gdlloverrides_160196), nstnewStringTable(((NU8) 1)));
	LOC5 = 0;
	LOC5 = gprefixdir_160197; gprefixdir_160197 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC5) nimGCunrefNoCycle(LOC5);
	LOC6 = 0;
	LOC6 = libpath_160198; libpath_160198 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC6) nimGCunrefNoCycle(LOC6);
	LOC7 = 0;
	LOC7 = gprojectname_160199; gprojectname_160199 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC7) nimGCunrefNoCycle(LOC7);
	LOC8 = 0;
	LOC8 = gprojectpath_160200; gprojectpath_160200 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC8) nimGCunrefNoCycle(LOC8);
	LOC9 = 0;
	LOC9 = gprojectfull_160201; gprojectfull_160201 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC9) nimGCunrefNoCycle(LOC9);
	gprojectisstdin_160202 = NIM_FALSE;
	LOC10 = 0;
	LOC10 = nimcachedir_160204; nimcachedir_160204 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC10) nimGCunrefNoCycle(LOC10);
	LOC11 = 0;
	LOC11 = command_160205; command_160205 = copyStringRC1(((NimStringDesc*) &TMP41));
	if (LOC11) nimGCunrefNoCycle(LOC11);
	if (commandargs_160223) nimGCunrefNoCycle(commandargs_160223);
	commandargs_160223 = (TY125202*) newSeqRC1((&NTI125202), 0);
	gkeepcomments_160224 = NIM_TRUE;
	if (implicitimports_160242) nimGCunrefNoCycle(implicitimports_160242);
	implicitimports_160242 = (TY125202*) newSeqRC1((&NTI125202), 0);
	if (implicitincludes_160260) nimGCunrefNoCycle(implicitincludes_160260);
	implicitincludes_160260 = (TY125202*) newSeqRC1((&NTI125202), 0);
	asgnRef((void**) (&packagecache_160801), nstnewStringTable(((NU8) 1)));
}

NIM_EXTERNC N_NOINLINE(void, compiler_optionsDatInit000)(void) {
static TNimNode* TMP844[22];
NI TMP846;
static char* NIM_CONST TMP845[22] = {
"optNone", 
"optObjCheck", 
"optFieldCheck", 
"optRangeCheck", 
"optBoundsCheck", 
"optOverflowCheck", 
"optNilCheck", 
"optNaNCheck", 
"optInfCheck", 
"optAssert", 
"optLineDir", 
"optWarns", 
"optHints", 
"optOptimizeSpeed", 
"optOptimizeSize", 
"optStackTrace", 
"optLineTrace", 
"optEndb", 
"optByRef", 
"optProfiler", 
"optImplicitStatic", 
"optPatterns"};
static TNimNode* TMP2769[10];
NI TMP2771;
static char* NIM_CONST TMP2770[10] = {
"ideNone", 
"ideSug", 
"ideCon", 
"ideDef", 
"ideUse", 
"ideDus", 
"ideChk", 
"ideMod", 
"ideHighlight", 
"ideOutline"};
static TNimNode TMP21[35];
NTI160009.size = sizeof(NU8);
NTI160009.kind = 14;
NTI160009.base = 0;
NTI160009.flags = 3;
for (TMP846 = 0; TMP846 < 22; TMP846++) {
TMP21[TMP846+0].kind = 1;
TMP21[TMP846+0].offset = TMP846;
TMP21[TMP846+0].name = TMP845[TMP846];
TMP844[TMP846] = &TMP21[TMP846+0];
}
TMP21[22].len = 22; TMP21[22].kind = 2; TMP21[22].sons = &TMP844[0];
NTI160009.node = &TMP21[22];
NTI160011.size = sizeof(NU32);
NTI160011.kind = 19;
NTI160011.base = (&NTI160009);
NTI160011.flags = 3;
TMP21[23].len = 0; TMP21[23].kind = 0;
NTI160011.node = &TMP21[23];
NTI160023.size = sizeof(NU8);
NTI160023.kind = 14;
NTI160023.base = 0;
NTI160023.flags = 3;
for (TMP2771 = 0; TMP2771 < 10; TMP2771++) {
TMP21[TMP2771+24].kind = 1;
TMP21[TMP2771+24].offset = TMP2771;
TMP21[TMP2771+24].name = TMP2770[TMP2771];
TMP2769[TMP2771] = &TMP21[TMP2771+24];
}
TMP21[34].len = 10; TMP21[34].kind = 2; TMP21[34].sons = &TMP2769[0];
NTI160023.node = &TMP21[34];
}

