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

#include <string.h>

#include <stdio.h>
typedef struct TY184131 TY184131;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tcell41090 tcell41090;
typedef struct tcellseq41106 tcellseq41106;
typedef struct tgcheap43016 tgcheap43016;
typedef struct tcellset41102 tcellset41102;
typedef struct tpagedesc41098 tpagedesc41098;
typedef struct tmemregion23410 tmemregion23410;
typedef struct tsmallchunk22638 tsmallchunk22638;
typedef struct tllchunk23404 tllchunk23404;
typedef struct tbigchunk22640 tbigchunk22640;
typedef struct tintset22615 tintset22615;
typedef struct ttrunk22611 ttrunk22611;
typedef struct tavlnode23408 tavlnode23408;
typedef struct tgcstat43014 tgcstat43014;
typedef struct NimStringDesc NimStringDesc;
typedef struct tlexer180176 tlexer180176;
typedef struct tbaselexer178018 tbaselexer178018;
typedef struct TNimObject TNimObject;
typedef struct tllstream176204 tllstream176204;
typedef struct ttoken180174 ttoken180174;
typedef struct tident167019 tident167019;
typedef struct tidobj167013 tidobj167013;
typedef struct tlineinfo163527 tlineinfo163527;
typedef struct tbasechunk22636 tbasechunk22636;
typedef struct tfreecell22628 tfreecell22628;
struct  TGenericSeq  {
NI len;
NI reserved;
};
typedef N_NIMCALL_PTR(void, TY2289) (void* p, NI op);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY2289 marker;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tcell41090  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq41106  {
NI Len;
NI Cap;
tcell41090** D;
};
struct  tcellset41102  {
NI Counter;
NI Max;
tpagedesc41098* Head;
tpagedesc41098** Data;
};
typedef tsmallchunk22638* TY23422[512];
typedef ttrunk22611* ttrunkbuckets22613[256];
struct  tintset22615  {
ttrunkbuckets22613 Data;
};
struct  tmemregion23410  {
NI Minlargeobj;
NI Maxlargeobj;
TY23422 Freesmallchunks;
tllchunk23404* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk22640* Freechunkslist;
tintset22615 Chunkstarts;
tavlnode23408* Root;
tavlnode23408* Deleted;
tavlnode23408* Last;
tavlnode23408* Freeavlnodes;
};
struct  tgcstat43014  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap43016  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq41106 Zct;
tcellseq41106 Decstack;
tcellset41102 Cycleroots;
tcellseq41106 Tempstack;
NI Recgclock;
tmemregion23410 Region;
tgcstat43014 Stat;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  TNimObject  {
TNimType* m_type;
};
struct  tbaselexer178018  {
  TNimObject Sup;
NI Bufpos;
NCSTRING Buf;
NI Buflen;
tllstream176204* Stream;
NI Linenumber;
NI Sentinel;
NI Linestart;
};
struct  tlexer180176  {
  tbaselexer178018 Sup;
NI32 Fileidx;
NI Indentahead;
NI Currlineindent;
NIM_BOOL Strongspaces;
};
struct  ttoken180174  {
NU8 Toktype;
NI Indent;
tident167019* Ident;
NI64 Inumber;
NF Fnumber;
NU8 Base;
NI8 Strongspacea;
NI8 Strongspaceb;
NimStringDesc* Literal;
NI Line;
NI Col;
};
struct  tidobj167013  {
  TNimObject Sup;
NI Id;
};
struct  tident167019  {
  tidobj167013 Sup;
NimStringDesc* S;
tident167019* Next;
NI H;
};
struct  tlineinfo163527  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
typedef NimStringDesc* TY173034[3];
typedef NI TY22618[16];
struct  tpagedesc41098  {
tpagedesc41098* Next;
NI Key;
TY22618 Bits;
};
struct  tbasechunk22636  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk22638  {
  tbasechunk22636 Sup;
tsmallchunk22638* Next;
tsmallchunk22638* Prev;
tfreecell22628* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk23404  {
NI Size;
NI Acc;
tllchunk23404* Next;
};
struct  tbigchunk22640  {
  tbasechunk22636 Sup;
tbigchunk22640* Next;
tbigchunk22640* Prev;
NI Align;
NF Data;
};
struct  ttrunk22611  {
ttrunk22611* Next;
NI Key;
TY22618 Bits;
};
typedef tavlnode23408* TY23414[2];
struct  tavlnode23408  {
TY23414 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  tllstream176204  {
  TNimObject Sup;
NU8 Kind;
FILE* F;
NimStringDesc* S;
NI Rd;
NI Wr;
NI Lineoffset;
};
struct  tfreecell22628  {
tfreecell22628* Next;
NI Zerofield;
};
struct TY184131 {
  TGenericSeq Sup;
  NIM_BOOL data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, TMP710)(void* p, NI op);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(tcell41090*, usrtocell_44443)(void* usr);
static N_INLINE(void, rtladdzct_46002)(tcell41090* c);
N_NOINLINE(void, addzct_44418)(tcellseq41106* s, tcell41090* c);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(NimStringDesc*, getprefixdir_137330)(void);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
N_NIMCALL(void, readconfigfile_184479)(NimStringDesc* filename);
N_NIMCALL(tllstream176204*, llstreamopen_176227)(NimStringDesc* filename, NU8 mode);
N_NIMCALL(void, inittoken_180417)(ttoken180174* l);
N_NIMCALL(void, openlexer_180238)(tlexer180176* lex, NimStringDesc* filename, tllstream176204* inputstream);
N_NIMCALL(void, conftok_184348)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(void, ppgettok_184008)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(void, rawgettok_180211)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(void, parsedirective_184309)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(NU8, whichkeyword_171360)(tident167019* id);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(NIM_BOOL, evalppif_184113)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(NIM_BOOL, parseexpr_184031)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(NIM_BOOL, parseandexpr_184074)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(NIM_BOOL, parseatom_184038)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(void, lexmessage_180246)(tlexer180176* l, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NIM_BOOL, isdefined_168022)(tident167019* symbol);
N_NIMCALL(void, jumptodirective_184185)(tlexer180176* l, ttoken180174* tok, NU8 dest);
N_NIMCALL(void, doelse_184193)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(void, doelif_184211)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(void, doend_184155)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(void, msgwriteln_164937)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, toktostr_180234)(ttoken180174* tok);
N_NIMCALL(NimStringDesc*, nsuNormalize)(NimStringDesc* s);
N_NIMCALL(void, putenv_111443)(NimStringDesc* key, NimStringDesc* val);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, getenv_111426)(NimStringDesc* key);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(void, parseassignment_184407)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(tident167019*, getident_167456)(NimStringDesc* identifier);
static N_INLINE(tlineinfo163527, getlineinfo_180218)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(tlineinfo163527, newlineinfo_164069)(NI32 fileinfoidx, NI line, NI col);
N_NIMCALL(void, checksymbol_184374)(tlexer180176* l, ttoken180174* tok);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_NIMCALL(void, processswitch_173016)(NimStringDesc* switch_173018, NimStringDesc* arg, NU8 pass, tlineinfo163527 info);
N_NIMCALL(void, closelexer_180225)(tlexer180176* lex);
N_NIMCALL(void, rawmessage_165386)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, getsystemconfigpath_184544)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, nosjoinPathOpenArray)(NimStringDesc** parts, NI partsLen0);
N_NIMCALL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, getuserconfigpath_184536)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, nosgetConfigDir)(void);
N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void);
N_NIMCALL(NimStringDesc*, HEX2F_108477)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NIM_BOOL, nosisRootDir)(NimStringDesc* path);
N_NIMCALL(NimStringDesc*, nosparentDir)(NimStringDesc* path);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_70624, NI last);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI first, NI last);
N_NIMCALL(NimStringDesc*, noschangeFileExt)(NimStringDesc* filename, NimStringDesc* ext);
STRING_LITERAL(TMP1377, "/usr", 4);
STRING_LITERAL(TMP1378, "/usr/lib/nimrod", 15);
STRING_LITERAL(TMP1379, "/usr/local", 10);
STRING_LITERAL(TMP1380, "/usr/local/lib/nimrod", 21);
STRING_LITERAL(TMP1381, "lib", 3);
STRING_LITERAL(TMP1407, "@", 1);
STRING_LITERAL(TMP1408, "\')\'", 3);
STRING_LITERAL(TMP1409, "\':\'", 3);
STRING_LITERAL(TMP1410, "@if", 3);
STRING_LITERAL(TMP1411, "@end", 4);
STRING_LITERAL(TMP1530, "putenv", 6);
STRING_LITERAL(TMP1531, "prependenv", 10);
STRING_LITERAL(TMP1532, "appendenv", 9);
STRING_LITERAL(TMP1533, "-", 1);
STRING_LITERAL(TMP1534, "--", 2);
STRING_LITERAL(TMP1535, "", 0);
STRING_LITERAL(TMP1536, "\']\'", 3);
STRING_LITERAL(TMP1537, "&", 1);
STRING_LITERAL(TMP1538, "config", 6);
STRING_LITERAL(TMP1539, "etc", 3);
STRING_LITERAL(TMP1540, "/etc/", 5);
STRING_LITERAL(TMP1542, "nimrod.cfg", 10);
TY184131* condstack_184152;
extern TNimType NTI134; /* bool */
TNimType NTI184131; /* seq[bool] */
extern tgcheap43016 gch_43044;
extern NimStringDesc* libpath_137205;
extern NU32 gglobaloptions_137111;
extern TNimType NTI180176; /* TLexer */
extern NI gverbosity_137120;
extern NimStringDesc* gprojectpath_137207;
extern NimStringDesc* gprojectname_137206;
extern NimStringDesc* gprojectfull_137208;
N_NIMCALL(void, TMP710)(void* p, NI op) {
	TY184131* a;
	NI LOC1;
	a = (TY184131*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	}
}

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

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

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tcell41090* c;
	c = usrtocell_44443(p);
	{
		(*c).Refcount -= 8;
		if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA3;
		rtladdzct_46002(c);
	}
	LA3: ;
}

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)), (NI32)((*a).Sup.len * 1));
	LOC11 = (LOC13 == ((NI32) 0));
	LA12: ;
	result = LOC11;
	goto BeforeRet;
	BeforeRet: ;
	return result;
}

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

N_NIMCALL(void, ppgettok_184008)(tlexer180176* l, ttoken180174* tok) {
	rawgettok_180211(l, tok);
	while (1) {
		if (!((*tok).Toktype == ((NU8) 111))) goto LA1;
		rawgettok_180211(l, tok);
	} LA1: ;
}

N_NIMCALL(NIM_BOOL, parseatom_184038)(tlexer180176* l, ttoken180174* tok) {
	NIM_BOOL result;
	result = 0;
	{
		if (!((*tok).Toktype == ((NU8) 91))) goto LA3;
		ppgettok_184008(l, tok);
		result = parseexpr_184031(l, tok);
		{
			if (!((*tok).Toktype == ((NU8) 92))) goto LA7;
			ppgettok_184008(l, tok);
		}
		goto LA5;
		LA7: ;
		{
			lexmessage_180246(&(*l), ((NU16) 23), ((NimStringDesc*) &TMP1408));
		}
		LA5: ;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC13;
		if (!((*(*tok).Ident).Sup.Id == 43)) goto LA11;
		ppgettok_184008(l, tok);
		LOC13 = 0;
		LOC13 = parseatom_184038(l, tok);
		result = !(LOC13);
	}
	goto LA1;
	LA11: ;
	{
		result = isdefined_168022((*tok).Ident);
		ppgettok_184008(l, tok);
	}
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, parseandexpr_184074)(tlexer180176* l, ttoken180174* tok) {
	NIM_BOOL result;
	result = 0;
	result = parseatom_184038(l, tok);
	while (1) {
		NIM_BOOL b;
		NIM_BOOL LOC2;
		if (!((*(*tok).Ident).Sup.Id == 2)) goto LA1;
		ppgettok_184008(l, tok);
		b = parseatom_184038(l, tok);
		LOC2 = 0;
		LOC2 = result;
		if (!(LOC2)) goto LA3;
		LOC2 = b;
		LA3: ;
		result = LOC2;
	} LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, parseexpr_184031)(tlexer180176* l, ttoken180174* tok) {
	NIM_BOOL result;
	result = 0;
	result = parseandexpr_184074(l, tok);
	while (1) {
		NIM_BOOL b;
		NIM_BOOL LOC2;
		if (!((*(*tok).Ident).Sup.Id == 47)) goto LA1;
		ppgettok_184008(l, tok);
		b = parseandexpr_184074(l, tok);
		LOC2 = 0;
		LOC2 = result;
		if (LOC2) goto LA3;
		LOC2 = b;
		LA3: ;
		result = LOC2;
	} LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, evalppif_184113)(tlexer180176* l, ttoken180174* tok) {
	NIM_BOOL result;
	result = 0;
	ppgettok_184008(l, tok);
	result = parseexpr_184031(l, tok);
	{
		if (!((*tok).Toktype == ((NU8) 105))) goto LA3;
		ppgettok_184008(l, tok);
	}
	goto LA1;
	LA3: ;
	{
		lexmessage_180246(&(*l), ((NU16) 23), ((NimStringDesc*) &TMP1409));
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, doelse_184193)(tlexer180176* l, ttoken180174* tok) {
	{
		if (!((condstack_184152->Sup.len-1) < 0)) goto LA3;
		lexmessage_180246(&(*l), ((NU16) 23), ((NimStringDesc*) &TMP1410));
	}
	LA3: ;
	ppgettok_184008(l, tok);
	{
		if (!((*tok).Toktype == ((NU8) 105))) goto LA7;
		ppgettok_184008(l, tok);
	}
	LA7: ;
	{
		if (!condstack_184152->data[(condstack_184152->Sup.len-1)]) goto LA11;
		jumptodirective_184185(l, tok, ((NU8) 0));
	}
	LA11: ;
}

N_NIMCALL(void, doelif_184211)(tlexer180176* l, ttoken180174* tok) {
	NIM_BOOL res;
	{
		if (!((condstack_184152->Sup.len-1) < 0)) goto LA3;
		lexmessage_180246(&(*l), ((NU16) 23), ((NimStringDesc*) &TMP1410));
	}
	LA3: ;
	res = evalppif_184113(l, tok);
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = condstack_184152->data[(condstack_184152->Sup.len-1)];
		if (LOC7) goto LA8;
		LOC7 = !(res);
		LA8: ;
		if (!LOC7) goto LA9;
		jumptodirective_184185(l, tok, ((NU8) 1));
	}
	goto LA5;
	LA9: ;
	{
		condstack_184152->data[(condstack_184152->Sup.len-1)] = NIM_TRUE;
	}
	LA5: ;
}

N_NIMCALL(void, doend_184155)(tlexer180176* l, ttoken180174* tok) {
	{
		if (!((condstack_184152->Sup.len-1) < 0)) goto LA3;
		lexmessage_180246(&(*l), ((NU16) 23), ((NimStringDesc*) &TMP1410));
	}
	LA3: ;
	ppgettok_184008(l, tok);
	condstack_184152 = (TY184131*) setLengthSeq(&(condstack_184152)->Sup, sizeof(NIM_BOOL), (condstack_184152->Sup.len-1));
}

N_NIMCALL(void, jumptodirective_184185)(tlexer180176* l, ttoken180174* tok, NU8 dest) {
	NI nestedifs;
	nestedifs = 0;
	while (1) {
		{
			NIM_BOOL LOC4;
			NU8 LOC8;
			LOC4 = 0;
			LOC4 = !(((*tok).Ident == NIM_NIL));
			if (!(LOC4)) goto LA5;
			LOC4 = eqStrings((*(*tok).Ident).S, ((NimStringDesc*) &TMP1407));
			LA5: ;
			if (!LOC4) goto LA6;
			ppgettok_184008(l, tok);
			LOC8 = 0;
			LOC8 = whichkeyword_171360((*tok).Ident);
			switch (LOC8) {
			case ((NU8) 28):
			{
				nestedifs += 1;
			}
			break;
			case ((NU8) 19):
			{
				{
					NIM_BOOL LOC13;
					LOC13 = 0;
					LOC13 = (dest == ((NU8) 1));
					if (!(LOC13)) goto LA14;
					LOC13 = (nestedifs == 0);
					LA14: ;
					if (!LOC13) goto LA15;
					doelse_184193(l, tok);
					goto LA1;
				}
				LA15: ;
			}
			break;
			case ((NU8) 18):
			{
				{
					NIM_BOOL LOC20;
					LOC20 = 0;
					LOC20 = (dest == ((NU8) 1));
					if (!(LOC20)) goto LA21;
					LOC20 = (nestedifs == 0);
					LA21: ;
					if (!LOC20) goto LA22;
					doelif_184211(l, tok);
					goto LA1;
				}
				LA22: ;
			}
			break;
			case ((NU8) 20):
			{
				{
					if (!(nestedifs == 0)) goto LA27;
					doend_184155(l, tok);
					goto LA1;
				}
				LA27: ;
				{
					if (!(0 < nestedifs)) goto LA31;
					nestedifs -= 1;
				}
				LA31: ;
			}
			break;
			default:
			{
			}
			break;
			}
			ppgettok_184008(l, tok);
		}
		goto LA2;
		LA6: ;
		{
			if (!((*tok).Toktype == ((NU8) 1))) goto LA35;
			lexmessage_180246(&(*l), ((NU16) 23), ((NimStringDesc*) &TMP1411));
		}
		goto LA2;
		LA35: ;
		{
			ppgettok_184008(l, tok);
		}
		LA2: ;
	} LA1: ;
}

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

N_NIMCALL(void, parsedirective_184309)(tlexer180176* l, ttoken180174* tok) {
	NU8 LOC1;
	ppgettok_184008(l, tok);
	LOC1 = 0;
	LOC1 = whichkeyword_171360((*tok).Ident);
	switch (LOC1) {
	case ((NU8) 28):
	{
		NIM_BOOL res;
		condstack_184152 = (TY184131*) setLengthSeq(&(condstack_184152)->Sup, sizeof(NIM_BOOL), (NI32)(condstack_184152->Sup.len + 1));
		res = evalppif_184113(l, tok);
		condstack_184152->data[(condstack_184152->Sup.len-1)] = res;
		{
			if (!!(res)) goto LA5;
			jumptodirective_184185(l, tok, ((NU8) 1));
		}
		LA5: ;
	}
	break;
	case ((NU8) 18):
	{
		doelif_184211(l, tok);
	}
	break;
	case ((NU8) 19):
	{
		doelse_184193(l, tok);
	}
	break;
	case ((NU8) 20):
	{
		doend_184155(l, tok);
	}
	break;
	case ((NU8) 175):
	{
		NimStringDesc* LOC11;
		ppgettok_184008(l, tok);
		LOC11 = 0;
		LOC11 = toktostr_180234(&(*tok));
		msgwriteln_164937(LOC11);
		ppgettok_184008(l, tok);
	}
	break;
	default:
	{
		NimStringDesc* LOC13;
		LOC13 = 0;
		LOC13 = nsuNormalize((*(*tok).Ident).S);
		if (eqStrings(LOC13, ((NimStringDesc*) &TMP1530))) goto LA14;
		if (eqStrings(LOC13, ((NimStringDesc*) &TMP1531))) goto LA15;
		if (eqStrings(LOC13, ((NimStringDesc*) &TMP1532))) goto LA16;
		goto LA17;
		LA14: ;
		{
			NimStringDesc* key;
			NimStringDesc* LOC20;
			ppgettok_184008(l, tok);
			key = toktostr_180234(&(*tok));
			ppgettok_184008(l, tok);
			LOC20 = 0;
			LOC20 = toktostr_180234(&(*tok));
			putenv_111443(key, LOC20);
			ppgettok_184008(l, tok);
		}
		goto LA18;
		LA15: ;
		{
			NimStringDesc* key;
			NimStringDesc* LOC22;
			NimStringDesc* LOC23;
			NimStringDesc* LOC24;
			ppgettok_184008(l, tok);
			key = toktostr_180234(&(*tok));
			ppgettok_184008(l, tok);
			LOC22 = 0;
			LOC23 = 0;
			LOC23 = toktostr_180234(&(*tok));
			LOC24 = 0;
			LOC24 = getenv_111426(key);
			LOC22 = rawNewString(LOC23->Sup.len + LOC24->Sup.len + 0);
appendString(LOC22, LOC23);
appendString(LOC22, LOC24);
			putenv_111443(key, LOC22);
			ppgettok_184008(l, tok);
		}
		goto LA18;
		LA16: ;
		{
			NimStringDesc* key;
			NimStringDesc* LOC26;
			NimStringDesc* LOC27;
			NimStringDesc* LOC28;
			ppgettok_184008(l, tok);
			key = toktostr_180234(&(*tok));
			ppgettok_184008(l, tok);
			LOC26 = 0;
			LOC27 = 0;
			LOC27 = getenv_111426(key);
			LOC28 = 0;
			LOC28 = toktostr_180234(&(*tok));
			LOC26 = rawNewString(LOC27->Sup.len + LOC28->Sup.len + 0);
appendString(LOC26, LOC27);
appendString(LOC26, LOC28);
			putenv_111443(key, LOC26);
			ppgettok_184008(l, tok);
		}
		goto LA18;
		LA17: ;
		{
			NimStringDesc* LOC30;
			LOC30 = 0;
			LOC30 = toktostr_180234(&(*tok));
			lexmessage_180246(&(*l), ((NU16) 30), LOC30);
		}
		LA18: ;
	}
	break;
	}
}

N_NIMCALL(void, conftok_184348)(tlexer180176* l, ttoken180174* tok) {
	ppgettok_184008(l, tok);
	while (1) {
		NIM_BOOL LOC2;
		LOC2 = 0;
		LOC2 = !(((*tok).Ident == NIM_NIL));
		if (!(LOC2)) goto LA3;
		LOC2 = eqStrings((*(*tok).Ident).S, ((NimStringDesc*) &TMP1407));
		LA3: ;
		if (!LOC2) goto LA1;
		parsedirective_184309(l, tok);
	} LA1: ;
}

static N_INLINE(tlineinfo163527, getlineinfo_180218)(tlexer180176* l, ttoken180174* tok) {
	tlineinfo163527 result;
	memset((void*)&result, 0, sizeof(result));
	result = newlineinfo_164069((*l).Fileidx, (*tok).Line, (*tok).Col);
	return result;
}

N_NIMCALL(void, checksymbol_184374)(tlexer180176* l, ttoken180174* tok) {
	{
		NimStringDesc* LOC5;
		if (!!(((*tok).Toktype >= ((NU8) 2) && (*tok).Toktype <= ((NU8) 70) || (*tok).Toktype >= ((NU8) 85) && (*tok).Toktype <= ((NU8) 87)))) goto LA3;
		LOC5 = 0;
		LOC5 = toktostr_180234(tok);
		lexmessage_180246(l, ((NU16) 19), LOC5);
	}
	LA3: ;
}

N_NIMCALL(void, parseassignment_184407)(tlexer180176* l, ttoken180174* tok) {
	tlineinfo163527 info;
	NimStringDesc* s;
	NimStringDesc* val;
	{
		NIM_BOOL LOC3;
		tident167019* LOC4;
		tident167019* LOC6;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = getident_167456(((NimStringDesc*) &TMP1533));
		LOC3 = ((*(*tok).Ident).Sup.Id == (*LOC4).Sup.Id);
		if (LOC3) goto LA5;
		LOC6 = 0;
		LOC6 = getident_167456(((NimStringDesc*) &TMP1534));
		LOC3 = ((*(*tok).Ident).Sup.Id == (*LOC6).Sup.Id);
		LA5: ;
		if (!LOC3) goto LA7;
		conftok_184348(l, tok);
	}
	LA7: ;
	info = getlineinfo_180218(&(*l), &(*tok));
	checksymbol_184374(&(*l), &(*tok));
	s = toktostr_180234(&(*tok));
	conftok_184348(l, tok);
	val = copyString(((NimStringDesc*) &TMP1535));
	while (1) {
		NimStringDesc* LOC10;
		if (!((*tok).Toktype == ((NU8) 108))) goto LA9;
		s = addChar(s, 46);
		conftok_184348(l, tok);
		checksymbol_184374(&(*l), &(*tok));
		LOC10 = 0;
		LOC10 = toktostr_180234(&(*tok));
		s = resizeString(s, LOC10->Sup.len + 0);
appendString(s, LOC10);
		conftok_184348(l, tok);
	} LA9: ;
	{
		NimStringDesc* LOC15;
		if (!((*tok).Toktype == ((NU8) 93))) goto LA13;
		conftok_184348(l, tok);
		checksymbol_184374(&(*l), &(*tok));
		LOC15 = 0;
		LOC15 = toktostr_180234(&(*tok));
		val = resizeString(val, LOC15->Sup.len + 0);
appendString(val, LOC15);
		conftok_184348(l, tok);
		{
			if (!((*tok).Toktype == ((NU8) 94))) goto LA18;
			conftok_184348(l, tok);
		}
		goto LA16;
		LA18: ;
		{
			lexmessage_180246(&(*l), ((NU16) 23), ((NimStringDesc*) &TMP1536));
		}
		LA16: ;
		val = addChar(val, 93);
	}
	LA13: ;
	{
		NimStringDesc* LOC29;
		if (!((*tok).Toktype == ((NU8) 105) || (*tok).Toktype == ((NU8) 107))) goto LA23;
		{
			if (!(0 < val->Sup.len)) goto LA27;
			val = addChar(val, 58);
		}
		LA27: ;
		conftok_184348(l, tok);
		checksymbol_184374(&(*l), &(*tok));
		LOC29 = 0;
		LOC29 = toktostr_180234(&(*tok));
		val = resizeString(val, LOC29->Sup.len + 0);
appendString(val, LOC29);
		conftok_184348(l, tok);
		while (1) {
			NIM_BOOL LOC31;
			tident167019* LOC33;
			NimStringDesc* LOC34;
			LOC31 = 0;
			LOC31 = !(((*tok).Ident == NIM_NIL));
			if (!(LOC31)) goto LA32;
			LOC33 = 0;
			LOC33 = getident_167456(((NimStringDesc*) &TMP1537));
			LOC31 = ((*(*tok).Ident).Sup.Id == (*LOC33).Sup.Id);
			LA32: ;
			if (!LOC31) goto LA30;
			conftok_184348(l, tok);
			checksymbol_184374(&(*l), &(*tok));
			LOC34 = 0;
			LOC34 = toktostr_180234(&(*tok));
			val = resizeString(val, LOC34->Sup.len + 0);
appendString(val, LOC34);
			conftok_184348(l, tok);
		} LA30: ;
	}
	LA23: ;
	processswitch_173016(s, val, ((NU8) 2), info);
}

N_NIMCALL(void, readconfigfile_184479)(NimStringDesc* filename) {
	tlexer180176 l;
	ttoken180174 tok;
	tllstream176204* stream;
	memset((void*)&l, 0, sizeof(l));
	l.Sup.Sup.m_type = (&NTI180176);
	memset((void*)&tok, 0, sizeof(tok));
	stream = 0;
	stream = llstreamopen_176227(filename, ((NU8) 0));
	{
		if (!!((stream == NIM_NIL))) goto LA3;
		inittoken_180417(&tok);
		openlexer_180238(&l, filename, stream);
		tok.Toktype = ((NU8) 1);
		conftok_184348(&l, &tok);
		while (1) {
			if (!!((tok.Toktype == ((NU8) 1)))) goto LA5;
			parseassignment_184407(&l, &tok);
		} LA5: ;
		{
			if (!(0 < condstack_184152->Sup.len)) goto LA8;
			lexmessage_180246(&l, ((NU16) 23), ((NimStringDesc*) &TMP1411));
		}
		LA8: ;
		closelexer_180225(&l);
		{
			if (!(1 <= gverbosity_137120)) goto LA12;
			rawmessage_165386(((NU16) 268), filename);
		}
		LA12: ;
	}
	LA3: ;
}

N_NIMCALL(NimStringDesc*, getsystemconfigpath_184544)(NimStringDesc* filename) {
	NimStringDesc* result;
	NimStringDesc* p;
	TY173034 LOC1;
	result = 0;
	p = getprefixdir_137330();
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC1[0] = copyString(p);
	LOC1[1] = copyString(((NimStringDesc*) &TMP1538));
	LOC1[2] = copyString(filename);
	result = nosjoinPathOpenArray(LOC1, 3);
	{
		NIM_BOOL LOC4;
		TY173034 LOC7;
		LOC4 = 0;
		LOC4 = nosexistsFile(result);
		if (!!(LOC4)) goto LA5;
		memset((void*)LOC7, 0, sizeof(LOC7));
		LOC7[0] = copyString(p);
		LOC7[1] = copyString(((NimStringDesc*) &TMP1539));
		LOC7[2] = copyString(filename);
		result = nosjoinPathOpenArray(LOC7, 3);
	}
	LA5: ;
	{
		NIM_BOOL LOC10;
		NimStringDesc* LOC13;
		LOC10 = 0;
		LOC10 = nosexistsFile(result);
		if (!!(LOC10)) goto LA11;
		LOC13 = 0;
		LOC13 = rawNewString(filename->Sup.len + 5);
appendString(LOC13, ((NimStringDesc*) &TMP1540));
appendString(LOC13, filename);
		result = LOC13;
	}
	LA11: ;
	return result;
}

N_NIMCALL(NimStringDesc*, getuserconfigpath_184536)(NimStringDesc* filename) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = nosgetConfigDir();
	result = nosjoinPath(LOC1, filename);
	return result;
}

N_NIMCALL(void, loadconfigs_184607)(NimStringDesc* cfg) {
	NimStringDesc* pd;
	{
		NimStringDesc* prefix;
		if (!((libpath_137205) && (libpath_137205)->Sup.len == 0)) goto LA3;
		prefix = getprefixdir_137330();
		{
			NimStringDesc* LOC9;
			if (!eqStrings(prefix, ((NimStringDesc*) &TMP1377))) goto LA7;
			LOC9 = 0;
			LOC9 = libpath_137205; libpath_137205 = copyStringRC1(((NimStringDesc*) &TMP1378));
			if (LOC9) nimGCunrefNoCycle(LOC9);
		}
		goto LA5;
		LA7: ;
		{
			NimStringDesc* LOC13;
			if (!eqStrings(prefix, ((NimStringDesc*) &TMP1379))) goto LA11;
			LOC13 = 0;
			LOC13 = libpath_137205; libpath_137205 = copyStringRC1(((NimStringDesc*) &TMP1380));
			if (LOC13) nimGCunrefNoCycle(LOC13);
		}
		goto LA5;
		LA11: ;
		{
			asgnRefNoCycle((void**) &libpath_137205, nosjoinPath(prefix, ((NimStringDesc*) &TMP1381)));
		}
		LA5: ;
	}
	LA3: ;
	{
		NimStringDesc* LOC19;
		if (!!(((gglobaloptions_137111 &(1<<((((NU8) 16))&31)))!=0))) goto LA17;
		LOC19 = 0;
		LOC19 = getsystemconfigpath_184544(cfg);
		readconfigfile_184479(LOC19);
	}
	LA17: ;
	{
		NimStringDesc* LOC24;
		if (!!(((gglobaloptions_137111 &(1<<((((NU8) 18))&31)))!=0))) goto LA22;
		LOC24 = 0;
		LOC24 = getuserconfigpath_184536(cfg);
		readconfigfile_184479(LOC24);
	}
	LA22: ;
	{
		if (!(0 < gprojectpath_137207->Sup.len)) goto LA27;
		pd = copyString(gprojectpath_137207);
	}
	goto LA25;
	LA27: ;
	{
		pd = nosgetCurrentDir();
	}
	LA25: ;
	{
		NimStringDesc* dir_184654;
		if (!!(((gglobaloptions_137111 &(1<<((((NU8) 19))&31)))!=0))) goto LA32;
		dir_184654 = 0;
		{
			NimStringDesc* current_184669;
			if (!NIM_FALSE) goto LA36;
			current_184669 = copyString(pd);
			{
				NimStringDesc* LOC42;
				if (!NIM_FALSE) goto LA40;
				dir_184654 = pd;
				LOC42 = 0;
				LOC42 = HEX2F_108477(dir_184654, cfg);
				readconfigfile_184479(LOC42);
			}
			LA40: ;
			while (1) {
				NimStringDesc* LOC49;
				{
					NIM_BOOL LOC46;
					LOC46 = 0;
					LOC46 = nosisRootDir(current_184669);
					if (!LOC46) goto LA47;
					goto LA43;
				}
				LA47: ;
				current_184669 = nosparentDir(current_184669);
				dir_184654 = current_184669;
				LOC49 = 0;
				LOC49 = HEX2F_108477(dir_184654, cfg);
				readconfigfile_184479(LOC49);
			} LA43: ;
		}
		goto LA34;
		LA36: ;
		{
			NI i_184671;
			NI HEX3Atmp_184673;
			NI res_184675;
			i_184671 = 0;
			HEX3Atmp_184673 = 0;
			HEX3Atmp_184673 = (NI32)(pd->Sup.len - 2);
			res_184675 = 0;
			while (1) {
				if (!(res_184675 <= HEX3Atmp_184673)) goto LA51;
				i_184671 = res_184675;
				{
					NIM_BOOL LOC54;
					NIM_BOOL LOC56;
					NimStringDesc* LOC60;
					LOC54 = 0;
					LOC54 = (((NU8)(pd->data[i_184671])) == ((NU8)(47)) || ((NU8)(pd->data[i_184671])) == ((NU8)(47)));
					if (!(LOC54)) goto LA55;
					LOC56 = 0;
					LOC56 = (i_184671 == 0);
					if (LOC56) goto LA57;
					LOC56 = !((((NU8)(pd->data[(NI32)(i_184671 - 1)])) == ((NU8)(47)) || ((NU8)(pd->data[(NI32)(i_184671 - 1)])) == ((NU8)(47))));
					LA57: ;
					LOC54 = LOC56;
					LA55: ;
					if (!LOC54) goto LA58;
					dir_184654 = copyStrLast(pd, 0, i_184671);
					LOC60 = 0;
					LOC60 = HEX2F_108477(dir_184654, cfg);
					readconfigfile_184479(LOC60);
				}
				LA58: ;
				res_184675 += 1;
			} LA51: ;
			{
				NimStringDesc* LOC65;
				if (!NIM_FALSE) goto LA63;
				dir_184654 = pd;
				LOC65 = 0;
				LOC65 = HEX2F_108477(dir_184654, cfg);
				readconfigfile_184479(LOC65);
			}
			LA63: ;
		}
		LA34: ;
	}
	LA32: ;
	{
		NimStringDesc* LOC70;
		if (!!(((gglobaloptions_137111 &(1<<((((NU8) 17))&31)))!=0))) goto LA68;
		LOC70 = 0;
		LOC70 = HEX2F_108477(pd, cfg);
		readconfigfile_184479(LOC70);
		{
			NimStringDesc* LOC75;
			if (!!((gprojectname_137206->Sup.len == 0))) goto LA73;
			LOC75 = 0;
			LOC75 = noschangeFileExt(gprojectfull_137208, ((NimStringDesc*) &TMP1542));
			readconfigfile_184479(LOC75);
		}
		LA73: ;
	}
	LA68: ;
}
N_NOINLINE(void, nimconfInit)(void) {
	if (condstack_184152) nimGCunrefNoCycle(condstack_184152);
	condstack_184152 = (TY184131*) newSeqRC1((&NTI184131), 0);
}

N_NOINLINE(void, nimconfDatInit)(void) {
NTI184131.size = sizeof(TY184131*);
NTI184131.kind = 24;
NTI184131.base = (&NTI134);
NTI184131.flags = 2;
NTI184131.marker = TMP710;
}

