/* Generated by Nim Compiler v0.12.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 <stdio.h>
typedef struct TY221169 TY221169;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Cell48947 Cell48947;
typedef struct Cellseq48963 Cellseq48963;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48959 Cellset48959;
typedef struct Pagedesc48955 Pagedesc48955;
typedef struct Memregion30890 Memregion30890;
typedef struct Smallchunk30842 Smallchunk30842;
typedef struct Llchunk30884 Llchunk30884;
typedef struct Bigchunk30844 Bigchunk30844;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30888 Avlnode30888;
typedef struct Gcstat51014 Gcstat51014;
typedef struct NimStringDesc NimStringDesc;
typedef struct Tlexer216185 Tlexer216185;
typedef struct Tbaselexer214024 Tbaselexer214024;
typedef struct TNimObject TNimObject;
typedef struct Tllstream213204 Tllstream213204;
typedef struct Tlineinfo190352 Tlineinfo190352;
typedef struct Ttoken216181 Ttoken216181;
typedef struct Tident198021 Tident198021;
typedef struct Tidobj198015 Tidobj198015;
typedef struct Stringtableobj145212 Stringtableobj145212;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef struct Keyvaluepairseq145210 Keyvaluepairseq145210;
typedef struct Keyvaluepair145208 Keyvaluepair145208;
struct  TGenericSeq  {
NI len;
NI reserved;
};
typedef N_NIMCALL_PTR(void, TY3889) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3894) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3889 marker;
TY3894 deepcopy;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Cell48947  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48963  {
NI len;
NI cap;
Cell48947** d;
};
struct  Cellset48959  {
NI counter;
NI max;
Pagedesc48955* head;
Pagedesc48955** data;
};
typedef Smallchunk30842* TY30905[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30890  {
NI minlargeobj;
NI maxlargeobj;
TY30905 freesmallchunks;
Llchunk30884* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30844* freechunkslist;
Intset30817 chunkstarts;
Avlnode30888* root;
Avlnode30888* deleted;
Avlnode30888* last;
Avlnode30888* freeavlnodes;
};
struct  Gcstat51014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap51018  {
Gcstack51016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq48963 zct;
Cellseq48963 decstack;
Cellset48959 cycleroots;
Cellseq48963 tempstack;
NI recgclock;
Memregion30890 region;
Gcstat51014 stat;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tbaselexer214024  {
  TNimObject Sup;
NI bufpos;
NCSTRING buf;
NI buflen;
Tllstream213204* stream;
NI linenumber;
NI sentinel;
NI linestart;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Tlineinfo190352 info, NU16 msg, NimStringDesc* arg, void* ClEnv);
void* ClEnv;
} Terrorhandler216183;
struct  Tlexer216185  {
  Tbaselexer214024 Sup;
NI32 fileidx;
NI indentahead;
NI currlineindent;
NIM_BOOL strongspaces;
Terrorhandler216183 errorhandler;
};
struct  Ttoken216181  {
NU8 toktype;
NI indent;
Tident198021* ident;
NI64 inumber;
NF fnumber;
NU8 base;
NI8 strongspacea;
NI8 strongspaceb;
NimStringDesc* literal;
NI line;
NI col;
};
struct  Tidobj198015  {
  TNimObject Sup;
NI id;
};
struct  Tident198021  {
  Tidobj198015 Sup;
NimStringDesc* s;
Tident198021* next;
NI h;
};
struct  Tlineinfo190352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
typedef NimStringDesc* TY193293[3];
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30821[16];
struct  Pagedesc48955  {
Pagedesc48955* next;
NI key;
TY30821 bits;
};
struct  Basechunk30840  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30842  {
  Basechunk30840 Sup;
Smallchunk30842* next;
Smallchunk30842* prev;
Freecell30832* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30884  {
NI size;
NI acc;
Llchunk30884* next;
};
struct  Bigchunk30844  {
  Basechunk30840 Sup;
Bigchunk30844* next;
Bigchunk30844* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30821 bits;
};
typedef Avlnode30888* TY30895[2];
struct  Avlnode30888  {
TY30895 link;
NI key;
NI upperbound;
NI level;
};
struct  Tllstream213204  {
  TNimObject Sup;
NU8 kind;
FILE* f;
NimStringDesc* s;
NI rd;
NI wr;
NI lineoffset;
};
struct  Stringtableobj145212  {
  TNimObject Sup;
NI counter;
Keyvaluepairseq145210* data;
NU8 mode;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct Keyvaluepair145208 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct TY221169 {
  TGenericSeq Sup;
  NIM_BOOL data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq145210 {
  TGenericSeq Sup;
  Keyvaluepair145208 data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, TMP798)(void* p, NI op);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(Cell48947*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48947* c);
N_NOINLINE(void, addzct_52617)(Cellseq48963* s, Cell48947* c);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(void, setdefaultlibpath_167375)(void);
N_NIMCALL(void, readconfigfile_221520)(NimStringDesc* filename);
N_NIMCALL(Tllstream213204*, llstreamopen_213256)(NimStringDesc* filename, NU8 mode);
N_NIMCALL(void, inittoken_216369)(Ttoken216181* L);
N_NIMCALL(void, openlexer_216410)(Tlexer216185* lex, NimStringDesc* filename, Tllstream213204* inputstream);
N_NIMCALL(void, conftok_221377)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(void, ppgettok_221009)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(void, rawgettok_219848)(Tlexer216185* L, Ttoken216181* tok);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(void, parsedirective_221342)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(NU16, whichkeyword_206390)(Tident198021* id);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(NIM_BOOL, evalppif_221147)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(NIM_BOOL, parseexpr_221039)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(NIM_BOOL, parseandexpr_221088)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(NIM_BOOL, parseatom_221048)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(void, lexmessage_216481)(Tlexer216185* L, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NIM_BOOL, isdefined_199167)(Tident198021* symbol);
N_NIMCALL(void, jumptodirective_221220)(Tlexer216185* L, Ttoken216181* tok, NU8 dest);
N_NIMCALL(void, doelse_221230)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(void, doelif_221251)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(void, doend_221191)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(void, msgwriteln_191915)(NimStringDesc* s, NU8 flags);
N_NIMCALL(NimStringDesc*, nstFormat)(NimStringDesc* f, Stringtableobj145212* t, NU8 flags);
N_NIMCALL(NimStringDesc*, toktostr_216323)(Ttoken216181* tok);
N_NIMCALL(NimStringDesc*, nsuNormalize)(NimStringDesc* s);
N_NIMCALL(void, putenv_131069)(NimStringDesc* key, NimStringDesc* val);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, getenv_131044)(NimStringDesc* key);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(void, parseassignment_221439)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(Tident198021*, getident_198463)(NimStringDesc* identifier);
static N_INLINE(Tlineinfo190352, getlineinfo_216218)(Tlexer216185* L, Ttoken216181* tok);
N_NIMCALL(Tlineinfo190352, newlineinfo_191267)(NI32 fileinfoidx, NI line, NI col);
N_NIMCALL(void, checksymbol_221408)(Tlexer216185* L, Ttoken216181* 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_211040)(NimStringDesc* switch_211042, NimStringDesc* arg, NU8 pass, Tlineinfo190352 info);
N_NIMCALL(void, closelexer_216422)(Tlexer216185* lex);
N_NIMCALL(void, rawmessage_194636)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, getsystemconfigpath_221590)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, getprefixdir_167366)(void);
N_NIMCALL(NimStringDesc*, nosjoinPathOpenArray)(NimStringDesc** parts, NI partsLen0);
N_NIMCALL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, getuserconfigpath_221578)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NimStringDesc*, nosgetConfigDir)(void);
N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void);
N_NIMCALL(NimStringDesc*, HEX2F_123481)(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_81016, NI last);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI first, NI last);
N_NIMCALL(NimStringDesc*, noschangeFileExt)(NimStringDesc* filename, NimStringDesc* ext);
static N_INLINE(NIM_BOOL, fileexists_127010)(NimStringDesc* filename);
STRING_LITERAL(TMP2002, "@", 1);
STRING_LITERAL(TMP2003, "\')\'", 3);
STRING_LITERAL(TMP2004, "\':\'", 3);
STRING_LITERAL(TMP2005, "@if", 3);
STRING_LITERAL(TMP2006, "@end", 4);
STRING_LITERAL(TMP2008, "putenv", 6);
STRING_LITERAL(TMP2009, "prependenv", 10);
STRING_LITERAL(TMP2010, "appendenv", 9);
STRING_LITERAL(TMP2011, "-", 1);
STRING_LITERAL(TMP2012, "--", 2);
STRING_LITERAL(TMP2013, "", 0);
STRING_LITERAL(TMP2014, "\']\'", 3);
STRING_LITERAL(TMP2015, "%=", 2);
STRING_LITERAL(TMP2016, "&", 1);
STRING_LITERAL(TMP2017, "config", 6);
STRING_LITERAL(TMP2018, "etc", 3);
STRING_LITERAL(TMP2019, "/etc/", 5);
STRING_LITERAL(TMP2021, "nimcfg", 6);
STRING_LITERAL(TMP2022, "nim.cfg", 7);
STRING_LITERAL(TMP2023, "nimrod.cfg", 10);
TY221169* condstack_221186;
extern TNimType NTI138; /* bool */
TNimType NTI221169; /* seq[bool] */
extern Gcheap51018 gch_51059;
extern NU32 gglobaloptions_167132;
extern TNimType NTI216185; /* TLexer */
extern Stringtableobj145212* gconfigvars_167230;
extern NimStringDesc* gprojectpath_167235;
extern NimStringDesc* gprojectname_167234;
extern NimStringDesc* gprojectfull_167236;
N_NIMCALL(void, TMP798)(void* p, NI op) {
	TY221169* a;
	NI LOC1;
	a = (TY221169*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	}
}

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

static N_INLINE(void, rtladdzct_54204)(Cell48947* c) {
	addzct_52617((&gch_51059.zct), c);
}

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

N_NIMCALL(void, ppgettok_221009)(Tlexer216185* L, Ttoken216181* tok) {
	rawgettok_219848(L, tok);
	{
		while (1) {
			if (!((*tok).toktype == ((NU8) 113))) goto LA2;
			rawgettok_219848(L, tok);
		} LA2: ;
	}
}

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;
}

N_NIMCALL(NIM_BOOL, parseatom_221048)(Tlexer216185* L, Ttoken216181* tok) {
	NIM_BOOL result;
	result = 0;
	{
		if (!((*tok).toktype == ((NU8) 93))) goto LA3;
		ppgettok_221009(L, tok);
		result = parseexpr_221039(L, tok);
		{
			if (!((*tok).toktype == ((NU8) 94))) goto LA7;
			ppgettok_221009(L, tok);
		}
		goto LA5;
		LA7: ;
		{
			lexmessage_216481((&(*L)), ((NU16) 24), ((NimStringDesc*) &TMP2003));
		}
		LA5: ;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC13;
		if (!((*(*tok).ident).Sup.id == ((NI) 45))) goto LA11;
		ppgettok_221009(L, tok);
		LOC13 = 0;
		LOC13 = parseatom_221048(L, tok);
		result = !(LOC13);
	}
	goto LA1;
	LA11: ;
	{
		result = isdefined_199167((*tok).ident);
		ppgettok_221009(L, tok);
	}
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, parseandexpr_221088)(Tlexer216185* L, Ttoken216181* tok) {
	NIM_BOOL result;
	result = 0;
	result = parseatom_221048(L, tok);
	{
		while (1) {
			NIM_BOOL b;
			NIM_BOOL LOC3;
			if (!((*(*tok).ident).Sup.id == ((NI) 2))) goto LA2;
			ppgettok_221009(L, tok);
			b = parseatom_221048(L, tok);
			LOC3 = 0;
			LOC3 = result;
			if (!(LOC3)) goto LA4;
			LOC3 = b;
			LA4: ;
			result = LOC3;
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NIM_BOOL, parseexpr_221039)(Tlexer216185* L, Ttoken216181* tok) {
	NIM_BOOL result;
	result = 0;
	result = parseandexpr_221088(L, tok);
	{
		while (1) {
			NIM_BOOL b;
			NIM_BOOL LOC3;
			if (!((*(*tok).ident).Sup.id == ((NI) 49))) goto LA2;
			ppgettok_221009(L, tok);
			b = parseandexpr_221088(L, tok);
			LOC3 = 0;
			LOC3 = result;
			if (LOC3) goto LA4;
			LOC3 = b;
			LA4: ;
			result = LOC3;
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NIM_BOOL, evalppif_221147)(Tlexer216185* L, Ttoken216181* tok) {
	NIM_BOOL result;
	result = 0;
	ppgettok_221009(L, tok);
	result = parseexpr_221039(L, tok);
	{
		if (!((*tok).toktype == ((NU8) 107))) goto LA3;
		ppgettok_221009(L, tok);
	}
	goto LA1;
	LA3: ;
	{
		lexmessage_216481((&(*L)), ((NU16) 24), ((NimStringDesc*) &TMP2004));
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, doelse_221230)(Tlexer216185* L, Ttoken216181* tok) {
	{
		if (!((condstack_221186 ? (condstack_221186->Sup.len-1) : -1) < ((NI) 0))) goto LA3;
		lexmessage_216481((&(*L)), ((NU16) 24), ((NimStringDesc*) &TMP2005));
	}
	LA3: ;
	ppgettok_221009(L, tok);
	{
		if (!((*tok).toktype == ((NU8) 107))) goto LA7;
		ppgettok_221009(L, tok);
	}
	LA7: ;
	{
		if (!condstack_221186->data[(condstack_221186 ? (condstack_221186->Sup.len-1) : -1)]) goto LA11;
		jumptodirective_221220(L, tok, ((NU8) 0));
	}
	LA11: ;
}

N_NIMCALL(void, doelif_221251)(Tlexer216185* L, Ttoken216181* tok) {
	NIM_BOOL res;
	{
		if (!((condstack_221186 ? (condstack_221186->Sup.len-1) : -1) < ((NI) 0))) goto LA3;
		lexmessage_216481((&(*L)), ((NU16) 24), ((NimStringDesc*) &TMP2005));
	}
	LA3: ;
	res = evalppif_221147(L, tok);
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = condstack_221186->data[(condstack_221186 ? (condstack_221186->Sup.len-1) : -1)];
		if (LOC7) goto LA8;
		LOC7 = !(res);
		LA8: ;
		if (!LOC7) goto LA9;
		jumptodirective_221220(L, tok, ((NU8) 1));
	}
	goto LA5;
	LA9: ;
	{
		condstack_221186->data[(condstack_221186 ? (condstack_221186->Sup.len-1) : -1)] = NIM_TRUE;
	}
	LA5: ;
}

N_NIMCALL(void, doend_221191)(Tlexer216185* L, Ttoken216181* tok) {
	{
		if (!((condstack_221186 ? (condstack_221186->Sup.len-1) : -1) < ((NI) 0))) goto LA3;
		lexmessage_216481((&(*L)), ((NU16) 24), ((NimStringDesc*) &TMP2005));
	}
	LA3: ;
	ppgettok_221009(L, tok);
	condstack_221186 = (TY221169*) setLengthSeq(&(condstack_221186)->Sup, sizeof(NIM_BOOL), ((NI) ((condstack_221186 ? (condstack_221186->Sup.len-1) : -1))));
}

N_NIMCALL(void, jumptodirective_221220)(Tlexer216185* L, Ttoken216181* tok, NU8 dest) {
	NI nestedifs;
	nestedifs = ((NI) 0);
	{
		while (1) {
			{
				NIM_BOOL LOC5;
				NU16 LOC9;
				LOC5 = 0;
				LOC5 = !(((*tok).ident == NIM_NIL));
				if (!(LOC5)) goto LA6;
				LOC5 = eqStrings((*(*tok).ident).s, ((NimStringDesc*) &TMP2002));
				LA6: ;
				if (!LOC5) goto LA7;
				ppgettok_221009(L, tok);
				LOC9 = 0;
				LOC9 = whichkeyword_206390((*tok).ident);
				switch (LOC9) {
				case ((NU16) 31):
				{
					nestedifs += ((NI) 1);
				}
				break;
				case ((NU16) 21):
				{
					{
						NIM_BOOL LOC14;
						LOC14 = 0;
						LOC14 = (dest == ((NU8) 1));
						if (!(LOC14)) goto LA15;
						LOC14 = (nestedifs == ((NI) 0));
						LA15: ;
						if (!LOC14) goto LA16;
						doelse_221230(L, tok);
						goto LA1;
					}
					LA16: ;
				}
				break;
				case ((NU16) 20):
				{
					{
						NIM_BOOL LOC21;
						LOC21 = 0;
						LOC21 = (dest == ((NU8) 1));
						if (!(LOC21)) goto LA22;
						LOC21 = (nestedifs == ((NI) 0));
						LA22: ;
						if (!LOC21) goto LA23;
						doelif_221251(L, tok);
						goto LA1;
					}
					LA23: ;
				}
				break;
				case ((NU16) 22):
				{
					{
						if (!(nestedifs == ((NI) 0))) goto LA28;
						doend_221191(L, tok);
						goto LA1;
					}
					LA28: ;
					{
						if (!(((NI) 0) < nestedifs)) goto LA32;
						nestedifs -= ((NI) 1);
					}
					LA32: ;
				}
				break;
				default:
				{
				}
				break;
				}
				ppgettok_221009(L, tok);
			}
			goto LA3;
			LA7: ;
			{
				if (!((*tok).toktype == ((NU8) 1))) goto LA36;
				lexmessage_216481((&(*L)), ((NU16) 24), ((NimStringDesc*) &TMP2006));
			}
			goto LA3;
			LA36: ;
			{
				ppgettok_221009(L, tok);
			}
			LA3: ;
		}
	} LA1: ;
}

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;
}

N_NIMCALL(void, parsedirective_221342)(Tlexer216185* L, Ttoken216181* tok) {
	NU16 LOC1;
	ppgettok_221009(L, tok);
	LOC1 = 0;
	LOC1 = whichkeyword_206390((*tok).ident);
	switch (LOC1) {
	case ((NU16) 31):
	{
		NIM_BOOL res;
		condstack_221186 = (TY221169*) setLengthSeq(&(condstack_221186)->Sup, sizeof(NIM_BOOL), ((NI) ((NI)((condstack_221186 ? condstack_221186->Sup.len : 0) + ((NI) 1)))));
		res = evalppif_221147(L, tok);
		condstack_221186->data[(condstack_221186 ? (condstack_221186->Sup.len-1) : -1)] = res;
		{
			if (!!(res)) goto LA5;
			jumptodirective_221220(L, tok, ((NU8) 1));
		}
		LA5: ;
	}
	break;
	case ((NU16) 20):
	{
		doelif_221251(L, tok);
	}
	break;
	case ((NU16) 21):
	{
		doelse_221230(L, tok);
	}
	break;
	case ((NU16) 22):
	{
		doend_221191(L, tok);
	}
	break;
	case ((NU16) 183):
	{
		NimStringDesc* LOC11;
		NimStringDesc* LOC12;
		ppgettok_221009(L, tok);
		LOC11 = 0;
		LOC11 = toktostr_216323((&(*tok)));
		LOC12 = 0;
		LOC12 = nstFormat(LOC11, gconfigvars_167230, 5);
		msgwriteln_191915(LOC12, 0);
		ppgettok_221009(L, tok);
	}
	break;
	default:
	{
		NimStringDesc* LOC14;
		LOC14 = 0;
		LOC14 = nsuNormalize((*(*tok).ident).s);
		if (eqStrings(LOC14, ((NimStringDesc*) &TMP2008))) goto LA15;
		if (eqStrings(LOC14, ((NimStringDesc*) &TMP2009))) goto LA16;
		if (eqStrings(LOC14, ((NimStringDesc*) &TMP2010))) goto LA17;
		goto LA18;
		LA15: ;
		{
			NimStringDesc* key;
			NimStringDesc* LOC21;
			ppgettok_221009(L, tok);
			key = toktostr_216323((&(*tok)));
			ppgettok_221009(L, tok);
			LOC21 = 0;
			LOC21 = toktostr_216323((&(*tok)));
			putenv_131069(key, LOC21);
			ppgettok_221009(L, tok);
		}
		goto LA19;
		LA16: ;
		{
			NimStringDesc* key;
			NimStringDesc* LOC23;
			NimStringDesc* LOC24;
			NimStringDesc* LOC25;
			ppgettok_221009(L, tok);
			key = toktostr_216323((&(*tok)));
			ppgettok_221009(L, tok);
			LOC23 = 0;
			LOC24 = 0;
			LOC24 = toktostr_216323((&(*tok)));
			LOC25 = 0;
			LOC25 = getenv_131044(key);
			LOC23 = rawNewString(LOC24->Sup.len + LOC25->Sup.len + 0);
appendString(LOC23, LOC24);
appendString(LOC23, LOC25);
			putenv_131069(key, LOC23);
			ppgettok_221009(L, tok);
		}
		goto LA19;
		LA17: ;
		{
			NimStringDesc* key;
			NimStringDesc* LOC27;
			NimStringDesc* LOC28;
			NimStringDesc* LOC29;
			ppgettok_221009(L, tok);
			key = toktostr_216323((&(*tok)));
			ppgettok_221009(L, tok);
			LOC27 = 0;
			LOC28 = 0;
			LOC28 = getenv_131044(key);
			LOC29 = 0;
			LOC29 = toktostr_216323((&(*tok)));
			LOC27 = rawNewString(LOC28->Sup.len + LOC29->Sup.len + 0);
appendString(LOC27, LOC28);
appendString(LOC27, LOC29);
			putenv_131069(key, LOC27);
			ppgettok_221009(L, tok);
		}
		goto LA19;
		LA18: ;
		{
			NimStringDesc* LOC31;
			LOC31 = 0;
			LOC31 = toktostr_216323((&(*tok)));
			lexmessage_216481((&(*L)), ((NU16) 31), LOC31);
		}
		LA19: ;
	}
	break;
	}
}

N_NIMCALL(void, conftok_221377)(Tlexer216185* L, Ttoken216181* tok) {
	ppgettok_221009(L, tok);
	{
		while (1) {
			NIM_BOOL LOC3;
			LOC3 = 0;
			LOC3 = !(((*tok).ident == NIM_NIL));
			if (!(LOC3)) goto LA4;
			LOC3 = eqStrings((*(*tok).ident).s, ((NimStringDesc*) &TMP2002));
			LA4: ;
			if (!LOC3) goto LA2;
			parsedirective_221342(L, tok);
		} LA2: ;
	}
}

static N_INLINE(Tlineinfo190352, getlineinfo_216218)(Tlexer216185* L, Ttoken216181* tok) {
	Tlineinfo190352 result;
	memset((void*)(&result), 0, sizeof(result));
	result = newlineinfo_191267((*L).fileidx, (*tok).line, (*tok).col);
	return result;
}

N_NIMCALL(void, checksymbol_221408)(Tlexer216185* L, Ttoken216181* tok) {
	{
		NimStringDesc* LOC5;
		if (!!(((*tok).toktype >= ((NU8) 2) && (*tok).toktype <= ((NU8) 72) || (*tok).toktype >= ((NU8) 87) && (*tok).toktype <= ((NU8) 89)))) goto LA3;
		LOC5 = 0;
		LOC5 = toktostr_216323(tok);
		lexmessage_216481(L, ((NU16) 20), LOC5);
	}
	LA3: ;
}

N_NIMCALL(void, parseassignment_221439)(Tlexer216185* L, Ttoken216181* tok) {
	Tlineinfo190352 info;
	NimStringDesc* s;
	NimStringDesc* val;
	NIM_BOOL percent;
	Tident198021* LOC22;
	{
		NIM_BOOL LOC3;
		Tident198021* LOC4;
		Tident198021* LOC6;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = getident_198463(((NimStringDesc*) &TMP2011));
		LOC3 = ((*(*tok).ident).Sup.id == (*LOC4).Sup.id);
		if (LOC3) goto LA5;
		LOC6 = 0;
		LOC6 = getident_198463(((NimStringDesc*) &TMP2012));
		LOC3 = ((*(*tok).ident).Sup.id == (*LOC6).Sup.id);
		LA5: ;
		if (!LOC3) goto LA7;
		conftok_221377(L, tok);
	}
	LA7: ;
	info = getlineinfo_216218((&(*L)), (&(*tok)));
	checksymbol_221408((&(*L)), (&(*tok)));
	s = toktostr_216323((&(*tok)));
	conftok_221377(L, tok);
	val = copyString(((NimStringDesc*) &TMP2013));
	{
		while (1) {
			NimStringDesc* LOC11;
			if (!((*tok).toktype == ((NU8) 110))) goto LA10;
			s = addChar(s, 46);
			conftok_221377(L, tok);
			checksymbol_221408((&(*L)), (&(*tok)));
			LOC11 = 0;
			LOC11 = toktostr_216323((&(*tok)));
			s = resizeString(s, LOC11->Sup.len + 0);
appendString(s, LOC11);
			conftok_221377(L, tok);
		} LA10: ;
	}
	{
		NimStringDesc* LOC16;
		if (!((*tok).toktype == ((NU8) 95))) goto LA14;
		conftok_221377(L, tok);
		checksymbol_221408((&(*L)), (&(*tok)));
		LOC16 = 0;
		LOC16 = toktostr_216323((&(*tok)));
		val = resizeString(val, LOC16->Sup.len + 0);
appendString(val, LOC16);
		conftok_221377(L, tok);
		{
			if (!((*tok).toktype == ((NU8) 96))) goto LA19;
			conftok_221377(L, tok);
		}
		goto LA17;
		LA19: ;
		{
			lexmessage_216481((&(*L)), ((NU16) 24), ((NimStringDesc*) &TMP2014));
		}
		LA17: ;
		val = addChar(val, 93);
	}
	LA14: ;
	LOC22 = 0;
	LOC22 = getident_198463(((NimStringDesc*) &TMP2015));
	percent = ((*(*tok).ident).Sup.id == (*LOC22).Sup.id);
	{
		NIM_BOOL LOC25;
		NimStringDesc* LOC33;
		LOC25 = 0;
		LOC25 = ((*tok).toktype == ((NU8) 107) || (*tok).toktype == ((NU8) 109));
		if (LOC25) goto LA26;
		LOC25 = percent;
		LA26: ;
		if (!LOC25) goto LA27;
		{
			if (!(((NI) 0) < (val ? val->Sup.len : 0))) goto LA31;
			val = addChar(val, 58);
		}
		LA31: ;
		conftok_221377(L, tok);
		checksymbol_221408((&(*L)), (&(*tok)));
		LOC33 = 0;
		LOC33 = toktostr_216323((&(*tok)));
		val = resizeString(val, LOC33->Sup.len + 0);
appendString(val, LOC33);
		conftok_221377(L, tok);
		{
			while (1) {
				NIM_BOOL LOC36;
				Tident198021* LOC38;
				NimStringDesc* LOC39;
				LOC36 = 0;
				LOC36 = !(((*tok).ident == NIM_NIL));
				if (!(LOC36)) goto LA37;
				LOC38 = 0;
				LOC38 = getident_198463(((NimStringDesc*) &TMP2016));
				LOC36 = ((*(*tok).ident).Sup.id == (*LOC38).Sup.id);
				LA37: ;
				if (!LOC36) goto LA35;
				conftok_221377(L, tok);
				checksymbol_221408((&(*L)), (&(*tok)));
				LOC39 = 0;
				LOC39 = toktostr_216323((&(*tok)));
				val = resizeString(val, LOC39->Sup.len + 0);
appendString(val, LOC39);
				conftok_221377(L, tok);
			} LA35: ;
		}
	}
	LA27: ;
	{
		NimStringDesc* LOC44;
		if (!percent) goto LA42;
		LOC44 = 0;
		LOC44 = nstFormat(val, gconfigvars_167230, 3);
		processswitch_211040(s, LOC44, ((NU8) 2), info);
	}
	goto LA40;
	LA42: ;
	{
		processswitch_211040(s, val, ((NU8) 2), info);
	}
	LA40: ;
}

N_NIMCALL(void, readconfigfile_221520)(NimStringDesc* filename) {
	Tlexer216185 L;
	Ttoken216181 tok;
	Tllstream213204* stream;
	memset((void*)(&L), 0, sizeof(L));
	L.Sup.Sup.m_type = (&NTI216185);
	memset((void*)(&tok), 0, sizeof(tok));
	stream = 0;
	stream = llstreamopen_213256(filename, ((NU8) 0));
	{
		if (!!((stream == NIM_NIL))) goto LA3;
		inittoken_216369((&tok));
		openlexer_216410((&L), filename, stream);
		tok.toktype = ((NU8) 1);
		conftok_221377((&L), (&tok));
		{
			while (1) {
				if (!!((tok.toktype == ((NU8) 1)))) goto LA6;
				parseassignment_221439((&L), (&tok));
			} LA6: ;
		}
		{
			if (!(((NI) 0) < (condstack_221186 ? condstack_221186->Sup.len : 0))) goto LA9;
			lexmessage_216481((&L), ((NU16) 24), ((NimStringDesc*) &TMP2006));
		}
		LA9: ;
		closelexer_216422((&L));
		rawmessage_194636(((NU16) 279), filename);
	}
	LA3: ;
}

N_NIMCALL(NimStringDesc*, getsystemconfigpath_221590)(NimStringDesc* filename) {
	NimStringDesc* result;
	NimStringDesc* p;
	TY193293 LOC1;
	result = 0;
	p = getprefixdir_167366();
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC1[0] = copyString(p);
	LOC1[1] = copyString(((NimStringDesc*) &TMP2017));
	LOC1[2] = copyString(filename);
	result = nosjoinPathOpenArray(LOC1, 3);
	{
		NIM_BOOL LOC4;
		TY193293 LOC7;
		LOC4 = 0;
		LOC4 = nosexistsFile(result);
		if (!!(LOC4)) goto LA5;
		memset((void*)LOC7, 0, sizeof(LOC7));
		LOC7[0] = copyString(p);
		LOC7[1] = copyString(((NimStringDesc*) &TMP2018));
		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*) &TMP2019));
appendString(LOC13, filename);
		result = LOC13;
	}
	LA11: ;
	return result;
}

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

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

N_NIMCALL(void, loadconfigs_221609)(NimStringDesc* cfg) {
	NimStringDesc* pd;
	setdefaultlibpath_167375();
	{
		NimStringDesc* LOC5;
		if (!!(((gglobaloptions_167132 &(1<<((((NU8) 16))&31)))!=0))) goto LA3;
		LOC5 = 0;
		LOC5 = getsystemconfigpath_221590(cfg);
		readconfigfile_221520(LOC5);
	}
	LA3: ;
	{
		NimStringDesc* LOC10;
		if (!!(((gglobaloptions_167132 &(1<<((((NU8) 18))&31)))!=0))) goto LA8;
		LOC10 = 0;
		LOC10 = getuserconfigpath_221578(cfg);
		readconfigfile_221520(LOC10);
	}
	LA8: ;
	{
		if (!(((NI) 0) < (gprojectpath_167235 ? gprojectpath_167235->Sup.len : 0))) goto LA13;
		pd = copyString(gprojectpath_167235);
	}
	goto LA11;
	LA13: ;
	{
		pd = nosgetCurrentDir();
	}
	LA11: ;
	{
		if (!!(((gglobaloptions_167132 &(1<<((((NU8) 19))&31)))!=0))) goto LA18;
		{
			NimStringDesc* dir_221643;
			dir_221643 = 0;
			{
				NimStringDesc* current_221660;
				if (!NIM_FALSE) goto LA23;
				current_221660 = copyString(pd);
				{
					NimStringDesc* LOC29;
					if (!NIM_FALSE) goto LA27;
					dir_221643 = pd;
					LOC29 = 0;
					LOC29 = HEX2F_123481(dir_221643, cfg);
					readconfigfile_221520(LOC29);
				}
				LA27: ;
				{
					while (1) {
						NimStringDesc* LOC37;
						{
							NIM_BOOL LOC34;
							LOC34 = 0;
							LOC34 = nosisRootDir(current_221660);
							if (!LOC34) goto LA35;
							goto LA30;
						}
						LA35: ;
						current_221660 = nosparentDir(current_221660);
						dir_221643 = current_221660;
						LOC37 = 0;
						LOC37 = HEX2F_123481(dir_221643, cfg);
						readconfigfile_221520(LOC37);
					}
				} LA30: ;
			}
			goto LA21;
			LA23: ;
			{
				{
					NI i_221662;
					NI HEX3Atmp_221664;
					NI res_221666;
					i_221662 = 0;
					HEX3Atmp_221664 = 0;
					HEX3Atmp_221664 = (NI)((pd ? pd->Sup.len : 0) - ((NI) 2));
					res_221666 = ((NI) 0);
					{
						while (1) {
							if (!(res_221666 <= HEX3Atmp_221664)) goto LA41;
							i_221662 = res_221666;
							{
								NIM_BOOL LOC44;
								NIM_BOOL LOC46;
								NimStringDesc* LOC50;
								LOC44 = 0;
								LOC44 = (((NU8)(pd->data[i_221662])) == ((NU8)(47)) || ((NU8)(pd->data[i_221662])) == ((NU8)(47)));
								if (!(LOC44)) goto LA45;
								LOC46 = 0;
								LOC46 = (i_221662 == ((NI) 0));
								if (LOC46) goto LA47;
								LOC46 = !((((NU8)(pd->data[(NI)(i_221662 - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(pd->data[(NI)(i_221662 - ((NI) 1))])) == ((NU8)(47))));
								LA47: ;
								LOC44 = LOC46;
								LA45: ;
								if (!LOC44) goto LA48;
								dir_221643 = copyStrLast(pd, ((NI) 0), i_221662);
								LOC50 = 0;
								LOC50 = HEX2F_123481(dir_221643, cfg);
								readconfigfile_221520(LOC50);
							}
							LA48: ;
							res_221666 += ((NI) 1);
						} LA41: ;
					}
				}
				{
					NimStringDesc* LOC55;
					if (!NIM_FALSE) goto LA53;
					dir_221643 = pd;
					LOC55 = 0;
					LOC55 = HEX2F_123481(dir_221643, cfg);
					readconfigfile_221520(LOC55);
				}
				LA53: ;
			}
			LA21: ;
		}
	}
	LA18: ;
	{
		NimStringDesc* LOC60;
		if (!!(((gglobaloptions_167132 &(1<<((((NU8) 17))&31)))!=0))) goto LA58;
		LOC60 = 0;
		LOC60 = HEX2F_123481(pd, cfg);
		readconfigfile_221520(LOC60);
		{
			NimStringDesc* projectconfig;
			if (!!(((gprojectname_167234 ? gprojectname_167234->Sup.len : 0) == ((NI) 0)))) goto LA63;
			projectconfig = noschangeFileExt(gprojectfull_167236, ((NimStringDesc*) &TMP2021));
			{
				NIM_BOOL LOC67;
				LOC67 = 0;
				LOC67 = fileexists_127010(projectconfig);
				if (!!(LOC67)) goto LA68;
				projectconfig = noschangeFileExt(gprojectfull_167236, ((NimStringDesc*) &TMP2022));
			}
			LA68: ;
			{
				NIM_BOOL LOC72;
				LOC72 = 0;
				LOC72 = fileexists_127010(projectconfig);
				if (!!(LOC72)) goto LA73;
				projectconfig = noschangeFileExt(gprojectfull_167236, ((NimStringDesc*) &TMP2023));
				{
					NIM_BOOL LOC77;
					LOC77 = 0;
					LOC77 = fileexists_127010(projectconfig);
					if (!LOC77) goto LA78;
					rawmessage_194636(((NU16) 241), projectconfig);
				}
				LA78: ;
			}
			LA73: ;
			readconfigfile_221520(projectconfig);
		}
		LA63: ;
	}
	LA58: ;
}
NIM_EXTERNC N_NOINLINE(void, compiler_nimconfInit000)(void) {
	if (condstack_221186) nimGCunrefNoCycle(condstack_221186);
	condstack_221186 = (TY221169*) newSeqRC1((&NTI221169), 0);
}

NIM_EXTERNC N_NOINLINE(void, compiler_nimconfDatInit000)(void) {
NTI221169.size = sizeof(TY221169*);
NTI221169.kind = 24;
NTI221169.base = (&NTI138);
NTI221169.flags = 2;
NTI221169.marker = TMP798;
}

