/* Generated by Nim Compiler v2.2.10 */
/* Compiled for: MacOSX, arm64, clang */
/* Command for C compiler:
   clang -c  -w -ferror-limit=3 -fno-strict-aliasing -pthread -isysroot /Applications/Xcode_16.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -target arm64-apple-darwin24.2.0 -O3   -I/Users/runner/work/nightlies/nightlies/nim-2.2.10/lib -I/Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/src -o /Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/.nimcache/@ppathnorm.nim.c.o /Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/.nimcache/@ppathnorm.nim.c */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks

#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
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg;
typedef struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ;
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
struct tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg {
	NI i;
	NI prev;
	NIM_BOOL notFirst;
};
struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ {
	NI Field0;
	NI Field1;
};
N_NIMCALL(NimStringV2, rawNewString)(NI cap_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i_p0, NI64 a_p1, NI64 b_p2);
N_LIB_PRIVATE N_NIMCALL(void, addNormalizePath__pureZpathnorm_u86)(NimStringV2 x_p0, NimStringV2* result_p1, NI* state_p2, NIM_CHAR dirSep_p3);
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1);
static N_INLINE(void, nimSetMem__system_u2188)(void* a_p0, int v_p1, NI size_p2);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
static N_INLINE(NIM_BOOL, nimAddInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasNext__pureZpathnorm_u6)(tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg it_p0, NimStringV2 x_p1);
N_LIB_PRIVATE N_NIMCALL(tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ, next__pureZpathnorm_u10)(tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg* it_p0, NimStringV2 x_p1);
static N_INLINE(NIM_BOOL, nimSubInt)(NI a_p0, NI b_p1, NI* res_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isSlash__pureZpathnorm_u78)(NimStringV2 x_p0, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds_p1);
static N_INLINE(void, nimAddCharV1)(NimStringV2* s_p0, NIM_CHAR c_p1);
N_LIB_PRIVATE N_NIMCALL(void, prepareAdd)(NimStringV2* s_p0, NI addLen_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDotDot__pureZpathnorm_u74)(NimStringV2 x_p0, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds_p1);
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s_p0, NI newLen_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, substr__system_u9096)(NimStringV2 s_p0, NI first_p1, NI last_p2);
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1);
static N_INLINE(void, copyMem__system_u1755)(void* dest_p0, void* source_p1, NI size_p2);
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDot__pureZpathnorm_u70)(NimStringV2 x_p0, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqsink___system_u2760)(NimStringV2* dest_p0, NimStringV2 src_p1);
static const struct {
  NI cap; NIM_CHAR data[1+1];
} TM__DfU0iuayCGwHDN1Exp9cbKg_18 = { 1 | NIM_STRLIT_FLAG, "." };
static const NimStringV2 TM__DfU0iuayCGwHDN1Exp9cbKg_19 = {1, (NimStrPayload*)&TM__DfU0iuayCGwHDN1Exp9cbKg_18};
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4198;
static N_INLINE(void, nimSetMem__system_u2188)(void* a_p0, int v_p1, NI size_p2) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
	nimSetMem__system_u2188(p_p0, ((int)0), size_p1);
}
static N_INLINE(NIM_BOOL, nimAddInt)(NI a_p0, NI b_p1, NI* res_p2) {
	NIM_BOOL result;
	NI r_1;
	result = (NIM_BOOL)0;
	r_1 = ((NI) ((NU)((NU64)(((NU) (a_p0))) + (NU64)(((NU) (b_p1))))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI)0) <= (NI)(r_1 ^ a_p0));
		if (T3_) goto LA4_;
		T3_ = (((NI)0) <= (NI)(r_1 ^ b_p1));
LA4_: ;
		if (!T3_) goto LA5_;
		(*res_p2) = r_1;
	}
	goto LA1_;
LA5_: ;
	{
		result = NIM_TRUE;
	}
LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasNext__pureZpathnorm_u6)(tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg it_p0, NimStringV2 x_p1) {
	NIM_BOOL result;
	result = (it_p0.i < x_p1.len);
	return result;
}
static N_INLINE(NIM_BOOL, nimSubInt)(NI a_p0, NI b_p1, NI* res_p2) {
	NIM_BOOL result;
	NI r_1;
	result = (NIM_BOOL)0;
	r_1 = ((NI) ((NU)((NU64)(((NU) (a_p0))) - (NU64)(((NU) (b_p1))))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI)0) <= (NI)(r_1 ^ a_p0));
		if (T3_) goto LA4_;
		T3_ = (((NI)0) <= (NI)(r_1 ^ (NI)((NU64) ~(b_p1))));
LA4_: ;
		if (!T3_) goto LA5_;
		(*res_p2) = r_1;
	}
	goto LA1_;
LA5_: ;
	{
		result = NIM_TRUE;
	}
LA1_: ;
	return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4198);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ, next__pureZpathnorm_u10)(tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg* it_p0, NimStringV2 x_p1) {
	tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ result;
	NI colontmp_;
	NI colontmp__2;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	colontmp_ = ((NI)0);
	colontmp__2 = ((NI)0);
	result.Field0 = colontmp_;
	result.Field1 = colontmp__2;
	(*it_p0).prev = (*it_p0).i;
	{
		NIM_BOOL T3_;
		NI TM__DfU0iuayCGwHDN1Exp9cbKg_3;
		T3_ = (NIM_BOOL)0;
		T3_ = !((*it_p0).notFirst);
		if (!(T3_)) goto LA4_;
		if ((*it_p0).i < 0 || (*it_p0).i >= x_p1.len){ raiseIndexError2((*it_p0).i,x_p1.len-1); goto BeforeRet_;
		}
		T3_ = (((NU8)(x_p1.p->data[(*it_p0).i])) == ((NU8)(47)) || ((NU8)(x_p1.p->data[(*it_p0).i])) == ((NU8)(47)));
LA4_: ;
		if (!T3_) goto LA5_;
		if (nimAddInt((*it_p0).i, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_3)) { raiseOverflow(); goto BeforeRet_;
		};
		(*it_p0).i = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_3);
	}
	goto LA1_;
LA5_: ;
	{
		{
			while (1) {
				NIM_BOOL T10_;
				NI TM__DfU0iuayCGwHDN1Exp9cbKg_4;
				T10_ = (NIM_BOOL)0;
				T10_ = ((*it_p0).i < x_p1.len);
				if (!(T10_)) goto LA11_;
				if ((*it_p0).i < 0 || (*it_p0).i >= x_p1.len){ raiseIndexError2((*it_p0).i,x_p1.len-1); goto BeforeRet_;
				}
				T10_ = !((((NU8)(x_p1.p->data[(*it_p0).i])) == ((NU8)(47)) || ((NU8)(x_p1.p->data[(*it_p0).i])) == ((NU8)(47))));
LA11_: ;
				if (!T10_) goto LA9;
				if (nimAddInt((*it_p0).i, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_4)) { raiseOverflow(); goto BeforeRet_;
				};
				(*it_p0).i = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_4);
			} LA9: ;
		}
	}
LA1_: ;
	{
		NI colontmp__3;
		NI colontmp__4;
		NI TM__DfU0iuayCGwHDN1Exp9cbKg_5;
		if (!((*it_p0).prev < (*it_p0).i)) goto LA14_;
		colontmp__3 = (*it_p0).prev;
		if (nimSubInt((*it_p0).i, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_5)) { raiseOverflow(); goto BeforeRet_;
		};
		colontmp__4 = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_5);
		result.Field0 = colontmp__3;
		result.Field1 = colontmp__4;
	}
	goto LA12_;
LA14_: ;
	{
		NIM_BOOL T17_;
		T17_ = (NIM_BOOL)0;
		T17_ = hasNext__pureZpathnorm_u6((*it_p0), x_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!T17_) goto LA18_;
		result = next__pureZpathnorm_u10(it_p0, x_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA12_;
LA18_: ;
LA12_: ;
	{
		while (1) {
			NIM_BOOL T22_;
			NI TM__DfU0iuayCGwHDN1Exp9cbKg_6;
			T22_ = (NIM_BOOL)0;
			T22_ = ((*it_p0).i < x_p1.len);
			if (!(T22_)) goto LA23_;
			if ((*it_p0).i < 0 || (*it_p0).i >= x_p1.len){ raiseIndexError2((*it_p0).i,x_p1.len-1); goto BeforeRet_;
			}
			T22_ = (((NU8)(x_p1.p->data[(*it_p0).i])) == ((NU8)(47)) || ((NU8)(x_p1.p->data[(*it_p0).i])) == ((NU8)(47)));
LA23_: ;
			if (!T22_) goto LA21;
			if (nimAddInt((*it_p0).i, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_6)) { raiseOverflow(); goto BeforeRet_;
			};
			(*it_p0).i = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_6);
		} LA21: ;
	}
	(*it_p0).notFirst = NIM_TRUE;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isSlash__pureZpathnorm_u78)(NimStringV2 x_p0, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds_p1) {
	NIM_BOOL result;
	NIM_BOOL T1_;
{	T1_ = (NIM_BOOL)0;
	T1_ = (bounds_p1.Field1 == bounds_p1.Field0);
	if (!(T1_)) goto LA2_;
	if (bounds_p1.Field0 < 0 || bounds_p1.Field0 >= x_p0.len){ raiseIndexError2(bounds_p1.Field0,x_p0.len-1); goto BeforeRet_;
	}
	T1_ = (((NU8)(x_p0.p->data[bounds_p1.Field0])) == ((NU8)(47)) || ((NU8)(x_p0.p->data[bounds_p1.Field0])) == ((NU8)(47)));
LA2_: ;
	result = T1_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, nimAddCharV1)(NimStringV2* s_p0, NIM_CHAR c_p1) {
	prepareAdd(s_p0, ((NI)1));
	(*(*s_p0).p).data[(*s_p0).len] = c_p1;
	(*s_p0).len += ((NI)1);
	(*(*s_p0).p).data[(*s_p0).len] = 0;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDotDot__pureZpathnorm_u74)(NimStringV2 x_p0, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds_p1) {
	NIM_BOOL result;
	NIM_BOOL T1_;
	NIM_BOOL T2_;
	NI TM__DfU0iuayCGwHDN1Exp9cbKg_8;
	NI TM__DfU0iuayCGwHDN1Exp9cbKg_9;
{	result = (NIM_BOOL)0;
	T1_ = (NIM_BOOL)0;
	T2_ = (NIM_BOOL)0;
	if (nimAddInt(bounds_p1.Field0, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_8)) { raiseOverflow(); goto BeforeRet_;
	};
	T2_ = (bounds_p1.Field1 == (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_8));
	if (!(T2_)) goto LA3_;
	if (bounds_p1.Field0 < 0 || bounds_p1.Field0 >= x_p0.len){ raiseIndexError2(bounds_p1.Field0,x_p0.len-1); goto BeforeRet_;
	}
	T2_ = ((NU8)(x_p0.p->data[bounds_p1.Field0]) == (NU8)(46));
LA3_: ;
	T1_ = T2_;
	if (!(T1_)) goto LA4_;
	if (nimAddInt(bounds_p1.Field0, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_9)) { raiseOverflow(); goto BeforeRet_;
	};
	if ((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_9) < 0 || (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_9) >= x_p0.len){ raiseIndexError2((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_9),x_p0.len-1); goto BeforeRet_;
	}
	T1_ = ((NU8)(x_p0.p->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_9)]) == (NU8)(46));
LA4_: ;
	result = T1_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest_p0, source_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, copyMem__system_u1755)(void* dest_p0, void* source_p1, NI size_p2) {
	nimCopyMem(dest_p0, source_p1, size_p2);
}
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1) {
	{
		if (!(((NI)0) < src_p1.len)) goto LA3_;
		copyMem__system_u1755(((void*) ((&(*(*dest_p0).p).data[(*dest_p0).len]))), ((void*) ((&(*src_p1.p).data[((NI)0)]))), (src_p1.len));
		(*dest_p0).len += src_p1.len;
		(*(*dest_p0).p).data[(*dest_p0).len] = 0;
	}
LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDot__pureZpathnorm_u70)(NimStringV2 x_p0, tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bounds_p1) {
	NIM_BOOL result;
	NIM_BOOL T1_;
{	T1_ = (NIM_BOOL)0;
	T1_ = (bounds_p1.Field1 == bounds_p1.Field0);
	if (!(T1_)) goto LA2_;
	if (bounds_p1.Field0 < 0 || bounds_p1.Field0 >= x_p0.len){ raiseIndexError2(bounds_p1.Field0,x_p0.len-1); goto BeforeRet_;
	}
	T1_ = ((NU8)(x_p0.p->data[bounds_p1.Field0]) == (NU8)(46));
LA2_: ;
	result = T1_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, addNormalizePath__pureZpathnorm_u86)(NimStringV2 x_p0, NimStringV2* result_p1, NI* state_p2, NIM_CHAR dirSep_p3) {
	tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg it_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&it_1), sizeof(tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg));
	it_1.notFirst = (((NI)0) < (NI)((NI64)((*state_p2)) >> (NU64)(((NI)1) & (64 - 1))));
	{
		if (!it_1.notFirst) goto LA3_;
		{
			while (1) {
				NIM_BOOL T7_;
				NI TM__DfU0iuayCGwHDN1Exp9cbKg_2;
				T7_ = (NIM_BOOL)0;
				T7_ = (it_1.i < x_p0.len);
				if (!(T7_)) goto LA8_;
				if (it_1.i < 0 || it_1.i >= x_p0.len){ raiseIndexError2(it_1.i,x_p0.len-1); goto BeforeRet_;
				}
				T7_ = (((NU8)(x_p0.p->data[it_1.i])) == ((NU8)(47)) || ((NU8)(x_p0.p->data[it_1.i])) == ((NU8)(47)));
LA8_: ;
				if (!T7_) goto LA6;
				if (nimAddInt(it_1.i, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_2)) { raiseOverflow(); goto BeforeRet_;
				};
				it_1.i = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_2);
			} LA6: ;
		}
	}
LA3_: ;
	{
		while (1) {
			NIM_BOOL T11_;
			tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ b_1;
			T11_ = (NIM_BOOL)0;
			T11_ = hasNext__pureZpathnorm_u6(it_1, x_p0);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (!T11_) goto LA10;
			b_1 = next__pureZpathnorm_u10((&it_1), x_p0);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			{
				NIM_BOOL T14_;
				T14_ = (NIM_BOOL)0;
				T14_ = ((NI)((NI64)((*state_p2)) >> (NU64)(((NI)1) & (64 - 1))) == ((NI)0));
				if (!(T14_)) goto LA15_;
				T14_ = isSlash__pureZpathnorm_u78(x_p0, b_1);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
LA15_: ;
				if (!T14_) goto LA16_;
				{
					NIM_BOOL T20_;
					NI TM__DfU0iuayCGwHDN1Exp9cbKg_7;
					T20_ = (NIM_BOOL)0;
					T20_ = ((*result_p1).len == ((NI)0));
					if (T20_) goto LA21_;
					if (nimSubInt((*result_p1).len, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_7)) { raiseOverflow(); goto BeforeRet_;
					};
					if ((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_7) < 0 || (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_7) >= (*result_p1).len){ raiseIndexError2((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_7),(*result_p1).len-1); goto BeforeRet_;
					}
					T20_ = !((((NU8)((*result_p1).p->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_7)])) == ((NU8)(47)) || ((NU8)((*result_p1).p->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_7)])) == ((NU8)(47))));
LA21_: ;
					if (!T20_) goto LA22_;
					nimAddCharV1((&(*result_p1)), dirSep_p3);
				}
LA22_: ;
				(*state_p2) = (NI)((*state_p2) | ((NI)1));
			}
			goto LA12_;
LA16_: ;
			{
				NIM_BOOL T25_;
				T25_ = (NIM_BOOL)0;
				T25_ = isDotDot__pureZpathnorm_u74(x_p0, b_1);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				if (!T25_) goto LA26_;
				{
					NI d_1;
					if (!(((NI)1) <= (NI)((NI64)((*state_p2)) >> (NU64)(((NI)1) & (64 - 1))))) goto LA30_;
					d_1 = (*result_p1).len;
					{
						while (1) {
							NIM_BOOL T34_;
							NI TM__DfU0iuayCGwHDN1Exp9cbKg_10;
							NI TM__DfU0iuayCGwHDN1Exp9cbKg_11;
							NI TM__DfU0iuayCGwHDN1Exp9cbKg_12;
							T34_ = (NIM_BOOL)0;
							if (nimSubInt(d_1, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_10)) { raiseOverflow(); goto BeforeRet_;
							};
							T34_ = ((NI)((*state_p2) & ((NI)1)) < (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_10));
							if (!(T34_)) goto LA35_;
							if (nimSubInt(d_1, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_11)) { raiseOverflow(); goto BeforeRet_;
							};
							if ((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_11) < 0 || (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_11) >= (*result_p1).len){ raiseIndexError2((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_11),(*result_p1).len-1); goto BeforeRet_;
							}
							T34_ = !((((NU8)((*result_p1).p->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_11)])) == ((NU8)(47)) || ((NU8)((*result_p1).p->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_11)])) == ((NU8)(47))));
LA35_: ;
							if (!T34_) goto LA33;
							if (nimSubInt(d_1, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_12)) { raiseOverflow(); goto BeforeRet_;
							};
							d_1 = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_12);
						} LA33: ;
					}
					{
						NI TM__DfU0iuayCGwHDN1Exp9cbKg_13;
						NI TM__DfU0iuayCGwHDN1Exp9cbKg_14;
						if (!(((NI)0) < d_1)) goto LA38_;
						if (nimSubInt(d_1, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_13)) { raiseOverflow(); goto BeforeRet_;
						};
						if (((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_13)) < ((NI)0) || ((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_13)) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_13), ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
						}
						setLengthStrV2((&(*result_p1)), ((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_13)));
						if (nimSubInt((*state_p2), ((NI)2), &TM__DfU0iuayCGwHDN1Exp9cbKg_14)) { raiseOverflow(); goto BeforeRet_;
						};
						(*state_p2) = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_14);
					}
LA38_: ;
				}
				goto LA28_;
LA30_: ;
				{
					NimStringV2 colontmpD_;
					colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
					{
						NIM_BOOL T43_;
						NI TM__DfU0iuayCGwHDN1Exp9cbKg_15;
						T43_ = (NIM_BOOL)0;
						T43_ = (((NI)0) < (*result_p1).len);
						if (!(T43_)) goto LA44_;
						if (nimSubInt((*result_p1).len, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_15)) { raiseOverflow(); goto BeforeRet_;
						};
						if ((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_15) < 0 || (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_15) >= (*result_p1).len){ raiseIndexError2((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_15),(*result_p1).len-1); goto BeforeRet_;
						}
						T43_ = !((((NU8)((*result_p1).p->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_15)])) == ((NU8)(47)) || ((NU8)((*result_p1).p->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_15)])) == ((NU8)(47))));
LA44_: ;
						if (!T43_) goto LA45_;
						nimAddCharV1((&(*result_p1)), dirSep_p3);
					}
LA45_: ;
					colontmpD_ = substr__system_u9096(x_p0, b_1.Field0, b_1.Field1);
					prepareAdd((&(*result_p1)), colontmpD_.len + 0);
appendString((&(*result_p1)), colontmpD_);
					if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
				}
LA28_: ;
			}
			goto LA12_;
LA26_: ;
			{
				NIM_BOOL T48_;
				T48_ = (NIM_BOOL)0;
				T48_ = isDot__pureZpathnorm_u70(x_p0, b_1);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				if (!T48_) goto LA49_;
			}
			goto LA12_;
LA49_: ;
			{
				NimStringV2 colontmpD__2;
				NI TM__DfU0iuayCGwHDN1Exp9cbKg_17;
				if (!(b_1.Field0 <= b_1.Field1)) goto LA52_;
				colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
				{
					NIM_BOOL T56_;
					NI TM__DfU0iuayCGwHDN1Exp9cbKg_16;
					T56_ = (NIM_BOOL)0;
					T56_ = (((NI)0) < (*result_p1).len);
					if (!(T56_)) goto LA57_;
					if (nimSubInt((*result_p1).len, ((NI)1), &TM__DfU0iuayCGwHDN1Exp9cbKg_16)) { raiseOverflow(); goto BeforeRet_;
					};
					if ((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_16) < 0 || (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_16) >= (*result_p1).len){ raiseIndexError2((NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_16),(*result_p1).len-1); goto BeforeRet_;
					}
					T56_ = !((((NU8)((*result_p1).p->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_16)])) == ((NU8)(47)) || ((NU8)((*result_p1).p->data[(NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_16)])) == ((NU8)(47))));
LA57_: ;
					if (!T56_) goto LA58_;
					nimAddCharV1((&(*result_p1)), dirSep_p3);
				}
LA58_: ;
				colontmpD__2 = substr__system_u9096(x_p0, b_1.Field0, b_1.Field1);
				prepareAdd((&(*result_p1)), colontmpD__2.len + 0);
appendString((&(*result_p1)), colontmpD__2);
				if (nimAddInt((*state_p2), ((NI)2), &TM__DfU0iuayCGwHDN1Exp9cbKg_17)) { raiseOverflow(); goto BeforeRet_;
				};
				(*state_p2) = (NI)(TM__DfU0iuayCGwHDN1Exp9cbKg_17);
				if (colontmpD__2.p && !(colontmpD__2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__2.p);
}
			}
			goto LA12_;
LA52_: ;
LA12_: ;
		} LA10: ;
	}
	{
		NIM_BOOL T62_;
		T62_ = (NIM_BOOL)0;
		T62_ = ((*result_p1).len == 0);
		if (!(T62_)) goto LA63_;
		T62_ = !((x_p0.len == 0));
LA63_: ;
		if (!T62_) goto LA64_;
		eqsink___system_u2760((&(*result_p1)), TM__DfU0iuayCGwHDN1Exp9cbKg_19);
	}
LA64_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normalizePath__pureZpathnorm_u150)(NimStringV2 path_p0, NIM_CHAR dirSep_p1) {
	NimStringV2 result;
	NI state_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	if ((path_p0.len) < ((NI)0) || (path_p0.len) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(path_p0.len, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
	}
	result = rawNewString((path_p0.len));
	state_1 = ((NI)0);
	addNormalizePath__pureZpathnorm_u86(path_p0, (&result), (&state_1), dirSep_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
