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

#include "nimbase.h"
#include <string.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg;
typedef struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg {
NI i;
NI prev;
NIM_BOOL notFirst;
};
struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ {
NI Field0;
NI Field1;
};
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__JE6t4x7Z3v2iVz27Nx0MRAmemory)(void* a, int v, NI size);
N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
static N_INLINE(NI, addInt)(NI a, NI b);
N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasNext__ecfBf9bSnUlnf5OQ0NQMxpQ)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg it, NimStringDesc* x);
N_LIB_PRIVATE N_NIMCALL(tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ, next__am1q4dBd9cls9au5CcmkX5oA)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg* it, NimStringDesc* x);
static N_INLINE(NI, subInt)(NI a, NI b);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isSlash__Sl9c33djPmHfV9bnZbQf0QBw)(NimStringDesc* x, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDotDot__Sl9c33djPmHfV9bnZbQf0QBw_2)(NimStringDesc* x, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds);
static N_INLINE(NI, chckRange)(NI i, NI a, NI b);
N_NOINLINE(void, raiseRangeError)(NI64 val);
N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newLen);
static N_INLINE(NIM_CHAR, X5BX5D___okzHJ6GE9cv0bYG3b4r5KCAsystem)(NimStringDesc* s, NI i);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__2yh9cer0ymNRHlOOg8P7IuA)(NimStringDesc* s, NI first, NI last);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, copyMem__M04YC71iJg1N7gBF3HZTngsystem)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDot__Sl9c33djPmHfV9bnZbQf0QBw_3)(NimStringDesc* x, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_LIB_PRIVATE N_NIMCALL(void, addNormalizePath__bx9csIXjBBeHkYSkIUixO1g)(NimStringDesc* x, NimStringDesc** result, NI* state, NIM_CHAR dirSep);
STRING_LITERAL(TM__DfU0iuayCGwHDN1Exp9cbKg_16, ".", 1);
static N_INLINE(void, nimSetMem__JE6t4x7Z3v2iVz27Nx0MRAmemory)(void* a, int v, NI size) {	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {	nimSetMem__JE6t4x7Z3v2iVz27Nx0MRAmemory(p, ((int) 0), size);
}
static N_INLINE(NI, addInt)(NI a, NI b) {	NI result;
{	result = (NI)0;
	result = (NI)((NU32)(a) + (NU32)(b));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 0) <= (NI)(result ^ a));
		if (T3_) goto LA4_;
		T3_ = (((NI) 0) <= (NI)(result ^ b));
		LA4_: ;
		if (!T3_) goto LA5_;
		goto BeforeRet_;
	}
	LA5_: ;
	raiseOverflow();
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasNext__ecfBf9bSnUlnf5OQ0NQMxpQ)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg it, NimStringDesc* x) {	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = (it.i < (x ? x->Sup.len : 0));
	return result;
}
static N_INLINE(NI, subInt)(NI a, NI b) {	NI result;
{	result = (NI)0;
	result = (NI)((NU32)(a) - (NU32)(b));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 0) <= (NI)(result ^ a));
		if (T3_) goto LA4_;
		T3_ = (((NI) 0) <= (NI)(result ^ (NI)((NU32) ~(b))));
		LA4_: ;
		if (!T3_) goto LA5_;
		goto BeforeRet_;
	}
	LA5_: ;
	raiseOverflow();
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ, next__am1q4dBd9cls9au5CcmkX5oA)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg* it, NimStringDesc* x) {	tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ result;
	nimZeroMem((void*)(&result), sizeof(tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ));
	(*it).prev = (*it).i;
	{
		NIM_BOOL T3_;
		NI TM__DfU0iuayCGwHDN1Exp9cbKg_3;
		T3_ = (NIM_BOOL)0;
		T3_ = !((*it).notFirst);
		if (!(T3_)) goto LA4_;
		if ((NU)((*it).i) >= (NU)(x ? x->Sup.len : 0)) raiseIndexError2((*it).i,(x ? x->Sup.len : 0)-1);
		T3_ = (((NU8)(x->data[(*it).i])) == ((NU8)(47)) || ((NU8)(x->data[(*it).i])) == ((NU8)(47)));
		LA4_: ;
		if (!T3_) goto LA5_;
		TM__DfU0iuayCGwHDN1Exp9cbKg_3 = addInt((*it).i, ((NI) 1));
		(*it).i = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_3);
	}
	goto LA1_;
	LA5_: ;
	{
		{
			while (1) {
				NIM_BOOL T10_;
				NI TM__DfU0iuayCGwHDN1Exp9cbKg_4;
				T10_ = (NIM_BOOL)0;
				T10_ = ((*it).i < (x ? x->Sup.len : 0));
				if (!(T10_)) goto LA11_;
				if ((NU)((*it).i) >= (NU)(x ? x->Sup.len : 0)) raiseIndexError2((*it).i,(x ? x->Sup.len : 0)-1);
				T10_ = !((((NU8)(x->data[(*it).i])) == ((NU8)(47)) || ((NU8)(x->data[(*it).i])) == ((NU8)(47))));
				LA11_: ;
				if (!T10_) goto LA9;
				TM__DfU0iuayCGwHDN1Exp9cbKg_4 = addInt((*it).i, ((NI) 1));
				(*it).i = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_4);
			} LA9: ;
		}
	}
	LA1_: ;
	{
		NI colontmp_;
		NI colontmp__2;
		NI TM__DfU0iuayCGwHDN1Exp9cbKg_5;
		if (!((*it).prev < (*it).i)) goto LA14_;
		colontmp_ = (*it).prev;
		TM__DfU0iuayCGwHDN1Exp9cbKg_5 = subInt((*it).i, ((NI) 1));
		colontmp__2 = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_5);
		result.Field0 = colontmp_;
		result.Field1 = colontmp__2;
	}
	goto LA12_;
	LA14_: ;
	{
		NIM_BOOL T17_;
		T17_ = (NIM_BOOL)0;
		T17_ = hasNext__ecfBf9bSnUlnf5OQ0NQMxpQ((*it), x);
		if (!T17_) goto LA18_;
		result = next__am1q4dBd9cls9au5CcmkX5oA(it, x);
	}
	goto LA12_;
	LA18_: ;
	LA12_: ;
	{
		while (1) {
			NIM_BOOL T22_;
			NI TM__DfU0iuayCGwHDN1Exp9cbKg_6;
			T22_ = (NIM_BOOL)0;
			T22_ = ((*it).i < (x ? x->Sup.len : 0));
			if (!(T22_)) goto LA23_;
			if ((NU)((*it).i) >= (NU)(x ? x->Sup.len : 0)) raiseIndexError2((*it).i,(x ? x->Sup.len : 0)-1);
			T22_ = (((NU8)(x->data[(*it).i])) == ((NU8)(47)) || ((NU8)(x->data[(*it).i])) == ((NU8)(47)));
			LA23_: ;
			if (!T22_) goto LA21;
			TM__DfU0iuayCGwHDN1Exp9cbKg_6 = addInt((*it).i, ((NI) 1));
			(*it).i = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_6);
		} LA21: ;
	}
	(*it).notFirst = NIM_TRUE;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isSlash__Sl9c33djPmHfV9bnZbQf0QBw)(NimStringDesc* x, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds) {	NIM_BOOL result;
	NIM_BOOL T1_;
	result = (NIM_BOOL)0;
	T1_ = (NIM_BOOL)0;
	T1_ = (bounds.Field1 == bounds.Field0);
	if (!(T1_)) goto LA2_;
	if ((NU)(bounds.Field0) >= (NU)(x ? x->Sup.len : 0)) raiseIndexError2(bounds.Field0,(x ? x->Sup.len : 0)-1);
	T1_ = (((NU8)(x->data[bounds.Field0])) == ((NU8)(47)) || ((NU8)(x->data[bounds.Field0])) == ((NU8)(47)));
	LA2_: ;
	result = T1_;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDotDot__Sl9c33djPmHfV9bnZbQf0QBw_2)(NimStringDesc* x, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds) {	NIM_BOOL result;
	NIM_BOOL T1_;
	NIM_BOOL T2_;
	NI TM__DfU0iuayCGwHDN1Exp9cbKg_7;
	NI TM__DfU0iuayCGwHDN1Exp9cbKg_8;
	result = (NIM_BOOL)0;
	T1_ = (NIM_BOOL)0;
	T2_ = (NIM_BOOL)0;
	TM__DfU0iuayCGwHDN1Exp9cbKg_7 = addInt(bounds.Field0, ((NI) 1));
	T2_ = (bounds.Field1 == (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_7));
	if (!(T2_)) goto LA3_;
	if ((NU)(bounds.Field0) >= (NU)(x ? x->Sup.len : 0)) raiseIndexError2(bounds.Field0,(x ? x->Sup.len : 0)-1);
	T2_ = ((NU8)(x->data[bounds.Field0]) == (NU8)(46));
	LA3_: ;
	T1_ = T2_;
	if (!(T1_)) goto LA4_;
	TM__DfU0iuayCGwHDN1Exp9cbKg_8 = addInt(bounds.Field0, ((NI) 1));
	if ((NU)((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_8)) >= (NU)(x ? x->Sup.len : 0)) raiseIndexError2((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_8),(x ? x->Sup.len : 0)-1);
	T1_ = ((NU8)(x->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_8)]) == (NU8)(46));
	LA4_: ;
	result = T1_;
	return result;
}
static N_INLINE(NI, chckRange)(NI i, NI a, NI b) {	NI result;
{	result = (NI)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (a <= i);
		if (!(T3_)) goto LA4_;
		T3_ = (i <= b);
		LA4_: ;
		if (!T3_) goto LA5_;
		result = i;
		goto BeforeRet_;
	}
	goto LA1_;
	LA5_: ;
	{
		raiseRangeError(((NI64) (i)));
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_CHAR, X5BX5D___okzHJ6GE9cv0bYG3b4r5KCAsystem)(NimStringDesc* s, NI i) {	NIM_CHAR result;
	NI TM__DfU0iuayCGwHDN1Exp9cbKg_14;
	result = (NIM_CHAR)0;
	TM__DfU0iuayCGwHDN1Exp9cbKg_14 = subInt((s ? s->Sup.len : 0), i);
	if ((NU)((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_14)) >= (NU)(s ? s->Sup.len : 0)) raiseIndexError2((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_14),(s ? s->Sup.len : 0)-1);
	result = s->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_14)];
	return result;
}
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}
static N_INLINE(void, copyMem__M04YC71iJg1N7gBF3HZTngsystem)(void* dest, void* source, NI size) {	nimCopyMem(dest, source, size);
}
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {	{
		if (!!((src == NIM_NIL))) goto LA3_;
		copyMem__M04YC71iJg1N7gBF3HZTngsystem(((void*) ((&(*dest).data[(*dest).Sup.len]))), ((void*) ((*src).data)), ((NI) ((NI)((*src).Sup.len + ((NI) 1)))));
		(*dest).Sup.len += (*src).Sup.len;
	}
	LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDot__Sl9c33djPmHfV9bnZbQf0QBw_3)(NimStringDesc* x, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds) {	NIM_BOOL result;
	NIM_BOOL T1_;
	result = (NIM_BOOL)0;
	T1_ = (NIM_BOOL)0;
	T1_ = (bounds.Field1 == bounds.Field0);
	if (!(T1_)) goto LA2_;
	if ((NU)(bounds.Field0) >= (NU)(x ? x->Sup.len : 0)) raiseIndexError2(bounds.Field0,(x ? x->Sup.len : 0)-1);
	T1_ = ((NU8)(x->data[bounds.Field0]) == (NU8)(46));
	LA2_: ;
	result = T1_;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, addNormalizePath__bx9csIXjBBeHkYSkIUixO1g)(NimStringDesc* x, NimStringDesc** result, NI* state, NIM_CHAR dirSep) {	tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg it;
	nimZeroMem((void*)(&it), sizeof(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg));
	it.notFirst = (((NI) 0) < (NI)((NI32)((*state)) >> (NU32)(((NI) 1))));
	{
		if (!it.notFirst) goto LA3_;
		{
			while (1) {
				NIM_BOOL T7_;
				NI TM__DfU0iuayCGwHDN1Exp9cbKg_2;
				T7_ = (NIM_BOOL)0;
				T7_ = (it.i < (x ? x->Sup.len : 0));
				if (!(T7_)) goto LA8_;
				if ((NU)(it.i) >= (NU)(x ? x->Sup.len : 0)) raiseIndexError2(it.i,(x ? x->Sup.len : 0)-1);
				T7_ = (((NU8)(x->data[it.i])) == ((NU8)(47)) || ((NU8)(x->data[it.i])) == ((NU8)(47)));
				LA8_: ;
				if (!T7_) goto LA6;
				TM__DfU0iuayCGwHDN1Exp9cbKg_2 = addInt(it.i, ((NI) 1));
				it.i = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_2);
			} LA6: ;
		}
	}
	LA3_: ;
	{
		while (1) {
			NIM_BOOL T11_;
			tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ b;
			T11_ = (NIM_BOOL)0;
			T11_ = hasNext__ecfBf9bSnUlnf5OQ0NQMxpQ(it, x);
			if (!T11_) goto LA10;
			b = next__am1q4dBd9cls9au5CcmkX5oA((&it), x);
			{
				NIM_BOOL T14_;
				T14_ = (NIM_BOOL)0;
				T14_ = ((NI)((NI32)((*state)) >> (NU32)(((NI) 1))) == ((NI) 0));
				if (!(T14_)) goto LA15_;
				T14_ = isSlash__Sl9c33djPmHfV9bnZbQf0QBw(x, b);
				LA15_: ;
				if (!T14_) goto LA16_;
				unsureAsgnRef((void**) (&(*result)), addChar((*result), dirSep));
				(*state) = (NI)((*state) | ((NI) 1));
			}
			goto LA12_;
			LA16_: ;
			{
				NIM_BOOL T19_;
				T19_ = (NIM_BOOL)0;
				T19_ = isDotDot__Sl9c33djPmHfV9bnZbQf0QBw_2(x, b);
				if (!T19_) goto LA20_;
				{
					NI d;
					if (!(((NI) 1) <= (NI)((NI32)((*state)) >> (NU32)(((NI) 1))))) goto LA24_;
					d = ((*result) ? (*result)->Sup.len : 0);
					{
						while (1) {
							NIM_BOOL T28_;
							NI TM__DfU0iuayCGwHDN1Exp9cbKg_9;
							NI TM__DfU0iuayCGwHDN1Exp9cbKg_10;
							NI TM__DfU0iuayCGwHDN1Exp9cbKg_11;
							T28_ = (NIM_BOOL)0;
							TM__DfU0iuayCGwHDN1Exp9cbKg_9 = subInt(d, ((NI) 1));
							T28_ = ((NI)((*state) & ((NI) 1)) < (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_9));
							if (!(T28_)) goto LA29_;
							TM__DfU0iuayCGwHDN1Exp9cbKg_10 = subInt(d, ((NI) 1));
							if ((NU)((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_10)) >= (NU)((*result) ? (*result)->Sup.len : 0)) raiseIndexError2((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_10),((*result) ? (*result)->Sup.len : 0)-1);
							T28_ = !((((NU8)((*result)->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_10)])) == ((NU8)(47)) || ((NU8)((*result)->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_10)])) == ((NU8)(47))));
							LA29_: ;
							if (!T28_) goto LA27;
							TM__DfU0iuayCGwHDN1Exp9cbKg_11 = subInt(d, ((NI) 1));
							d = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_11);
						} LA27: ;
					}
					{
						NI TM__DfU0iuayCGwHDN1Exp9cbKg_12;
						NI TM__DfU0iuayCGwHDN1Exp9cbKg_13;
						if (!(((NI) 0) < d)) goto LA32_;
						TM__DfU0iuayCGwHDN1Exp9cbKg_12 = subInt(d, ((NI) 1));
						unsureAsgnRef((void**) (&(*result)), setLengthStr((*result), ((NI)chckRange((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_12), ((NI) 0), ((NI) 2147483647)))));
						TM__DfU0iuayCGwHDN1Exp9cbKg_13 = subInt((*state), ((NI) 2));
						(*state) = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_13);
					}
					LA32_: ;
				}
				goto LA22_;
				LA24_: ;
				{
					NimStringDesc* T42_;
					{
						NIM_BOOL T37_;
						NIM_CHAR T39_;
						T37_ = (NIM_BOOL)0;
						T37_ = (((NI) 0) < ((*result) ? (*result)->Sup.len : 0));
						if (!(T37_)) goto LA38_;
						T39_ = (NIM_CHAR)0;
						T39_ = X5BX5D___okzHJ6GE9cv0bYG3b4r5KCAsystem((*result), ((NI) 1));
						T37_ = !((((NU8)(T39_)) == ((NU8)(47)) || ((NU8)(T39_)) == ((NU8)(47))));
						LA38_: ;
						if (!T37_) goto LA40_;
						unsureAsgnRef((void**) (&(*result)), addChar((*result), dirSep));
					}
					LA40_: ;
					T42_ = (NimStringDesc*)0;
					T42_ = substr__2yh9cer0ymNRHlOOg8P7IuA(x, b.Field0, b.Field1);
					unsureAsgnRef((void**) (&(*result)), resizeString((*result), (T42_ ? T42_->Sup.len : 0) + 0));
appendString((*result), T42_);
				}
				LA22_: ;
			}
			goto LA12_;
			LA20_: ;
			{
				NIM_BOOL T44_;
				T44_ = (NIM_BOOL)0;
				T44_ = isDot__Sl9c33djPmHfV9bnZbQf0QBw_3(x, b);
				if (!T44_) goto LA45_;
			}
			goto LA12_;
			LA45_: ;
			{
				NimStringDesc* T57_;
				NI TM__DfU0iuayCGwHDN1Exp9cbKg_15;
				if (!(b.Field0 <= b.Field1)) goto LA48_;
				{
					NIM_BOOL T52_;
					NIM_CHAR T54_;
					T52_ = (NIM_BOOL)0;
					T52_ = (((NI) 0) < ((*result) ? (*result)->Sup.len : 0));
					if (!(T52_)) goto LA53_;
					T54_ = (NIM_CHAR)0;
					T54_ = X5BX5D___okzHJ6GE9cv0bYG3b4r5KCAsystem((*result), ((NI) 1));
					T52_ = !((((NU8)(T54_)) == ((NU8)(47)) || ((NU8)(T54_)) == ((NU8)(47))));
					LA53_: ;
					if (!T52_) goto LA55_;
					unsureAsgnRef((void**) (&(*result)), addChar((*result), dirSep));
				}
				LA55_: ;
				T57_ = (NimStringDesc*)0;
				T57_ = substr__2yh9cer0ymNRHlOOg8P7IuA(x, b.Field0, b.Field1);
				unsureAsgnRef((void**) (&(*result)), resizeString((*result), (T57_ ? T57_->Sup.len : 0) + 0));
appendString((*result), T57_);
				TM__DfU0iuayCGwHDN1Exp9cbKg_15 = addInt((*state), ((NI) 2));
				(*state) = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_15);
			}
			goto LA12_;
			LA48_: ;
			LA12_: ;
		} LA10: ;
	}
	{
		NIM_BOOL T60_;
		T60_ = (NIM_BOOL)0;
		T60_ = (((*result) ? (*result)->Sup.len : 0) == 0);
		if (!(T60_)) goto LA61_;
		T60_ = !(((x ? x->Sup.len : 0) == 0));
		LA61_: ;
		if (!T60_) goto LA62_;
		unsureAsgnRef((void**) (&(*result)), copyString(((NimStringDesc*) &TM__DfU0iuayCGwHDN1Exp9cbKg_16)));
	}
	LA62_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normalizePath__gol9aBbIZpJYUPc6xBOBJDQ)(NimStringDesc* path, NIM_CHAR dirSep) {	NimStringDesc* result;
	NI state;
	result = (NimStringDesc*)0;
	result = rawNewString(((NI)chckRange((path ? path->Sup.len : 0), ((NI) 0), ((NI) 2147483647))));
	state = ((NI) 0);
	addNormalizePath__bx9csIXjBBeHkYSkIUixO1g(path, (&result), (&state), dirSep);
	return result;
}
