/* 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/@pstd@sprivate@sospaths2.nim.c.o /Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/.nimcache/@pstd@sprivate@sospaths2.nim.c */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks

#include "nimbase.h"
#include <string.h>
#include <unistd.h>
#include <errno.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 tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw;
typedef struct tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug;
typedef struct Exception Exception;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ tySequence__3EvzHGO0xyXGnJBUggwfKQ;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content;
typedef struct tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg;
typedef struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ;
typedef struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg tyTuple__7q7q3E6Oj24ZNVJb9aonhAg;
typedef struct tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw;
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
	NimStringV2 Field0;
	NimStringV2 Field1;
};
struct TNimTypeV2 {
	void* destructor;
	NI size;
	NI16 align;
	NI16 depth;
	NU32* display;
	void* traceImpl;
	void* typeInfoV1;
	NI flags;
	void* vTable[SEQ_DECL_SIZE];
};
struct RootObj {
	TNimTypeV2* m_type;
};
struct tySequence__3EvzHGO0xyXGnJBUggwfKQ {
  NI len; tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content* p;
};
struct Exception {
	RootObj Sup;
	Exception* parent;
	NCSTRING name;
	NimStringV2 message;
	tySequence__3EvzHGO0xyXGnJBUggwfKQ trace;
	Exception* up;
};
struct tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug {
	Exception Sup;
};
struct tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw {
	tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug Sup;
};
struct tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg {
	NI i;
	NI prev;
	NIM_BOOL notFirst;
};
struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ {
	NI Field0;
	NI Field1;
};
struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg {
	NimStringV2 Field0;
	NimStringV2 Field1;
	NimStringV2 Field2;
};
struct tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw {
	NCSTRING procname;
	NI line;
	NCSTRING filename;
};
struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content { NI cap; tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
N_NIMCALL(NimStringV2, mnewString)(NI len_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i_p0, NI64 a_p1, NI64 b_p2);
static N_INLINE(NIM_BOOL, eqeq___system_u9048)(NCSTRING x_p0, NCSTRING y_p1);
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorNoArgs)(void);
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s_p0, NI newLen_p1);
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__stdZoserrors_u122)(void);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u95)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqsink___system_u2760)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__stdZoserrors_u119)(NI32 errorCode_p0, NimStringV2 additionalInfo_p1);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
N_LIB_PRIVATE N_NIMCALL(NI, parentDirPos__stdZprivateZospaths2_u163)(NimStringV2 path_p0);
static N_INLINE(NIM_BOOL, nimSubInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normalizePath__pureZpathnorm_u150)(NimStringV2 path_p0, NIM_CHAR dirSep_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, substr__system_u9096)(NimStringV2 s_p0, NI first_p1, NI last_p2);
N_LIB_PRIVATE N_NIMCALL(void, normalizePathEnd__stdZprivateZospaths2_u20)(NimStringV2* path_p0, NIM_BOOL trailingSep_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);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringV2 a_p0, NimStringV2 b_p1);
static N_INLINE(NIM_BOOL, equalMem__system_u1763)(void* a_p0, void* b_p1, NI size_p2);
static N_INLINE(int, nimCmpMem)(void* a_p0, void* b_p1, NI size_p2);
static N_INLINE(NIM_CHAR*, X5BX5D___system_u8571)(NimStringV2* s_p0, NI i_p1);
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimPrepareStrMutationImpl__system_u2493)(NimStringV2* s_p0);
N_LIB_PRIVATE N_NIMCALL(NI, cmp__system_u1571)(NimStringV2 x_p0, NimStringV2 y_p1);
N_LIB_PRIVATE N_NIMCALL(NI, nsuCmpIgnoreCase)(NimStringV2 a_p0, NimStringV2 b_p1);
N_NIMCALL(NimStringV2, rawNewString)(NI cap_p0);
static N_INLINE(NIM_BOOL, nimAddInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NIMCALL(void, joinPathImpl__stdZprivateZospaths2_u49)(NimStringV2* result_p0, NI* state_p1, NimStringV2 tail_p2);
static N_INLINE(NIM_CHAR, X5BX5D___system_u8519)(NimStringV2 s_p0, NI i_p1);
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_NIMCALL(NimStringV2, substr__system_u9109)(NimStringV2 s_p0, NI first_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___system_u2754)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringV2 path_p0);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
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_NIMCALL(void, raiseExceptionEx)(Exception* e_p0, NCSTRING ename_p1, NCSTRING procname_p2, NCSTRING filename_p3, NI line_p4);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosjoinPath)(NimStringV2 head_p0, NimStringV2 tail_p1);
N_LIB_PRIVATE N_NIMCALL(void, nossplitPath)(NimStringV2 path_p0, tyTuple__UV3llMMYFckfui8YMBuUZA* Result);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___system_u2751)(NimStringV2* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZprivateZospaths2_u303)(tyTuple__UV3llMMYFckfui8YMBuUZA* dest_p0);
static N_INLINE(void, normalizePathAux__stdZprivateZospaths2_u15)(NimStringV2* path_p0);
N_LIB_PRIVATE N_NIMCALL(void, nosnormalizePath)(NimStringV2* path_p0);
static N_INLINE(void, eqdestroy___system_u281)(NimStringV2 x_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, absolutePathInternal__stdZprivateZospaths2_u18)(NimStringV2 path_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, absolutePath__stdZprivateZospaths2_u359)(NimStringV2 path_p0, NimStringV2 root_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetCurrentDir)(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);
N_LIB_PRIVATE N_NIMCALL(NIM_CHAR, nsuToLowerAsciiChar)(NIM_CHAR c_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normalizePathEnd__stdZprivateZospaths2_u42)(NimStringV2 path_p0, NIM_BOOL trailingSep_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosextractFilename)(NimStringV2 path_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosrelativePath)(NimStringV2 path_p0, NimStringV2 base_p1, NIM_CHAR sep_p2);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringV2 s_p0, NimStringV2 prefix_p1);
N_LIB_PRIVATE N_NIMCALL(NI, searchExtPos__stdZprivateZospaths2_u242)(NimStringV2 path_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normExt__stdZprivateZospaths2_u239)(NimStringV2 ext_p0);
static N_INLINE(void, appendChar)(NimStringV2* dest_p0, NIM_CHAR c_p1);
static const struct {
  NI cap; NIM_CHAR data[37+1];
} TM__O1zDbSYyG8zQytyoZAh0dg_2 = { 37 | NIM_STRLIT_FLAG, "ospaths2.nim(885, 21) `bufsize >= 0` " };
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_3 = {37, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_2};
static const struct {
  NI cap; NIM_CHAR data[0+1];
} TM__O1zDbSYyG8zQytyoZAh0dg_4 = { 0 | NIM_STRLIT_FLAG, "" };
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_5 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
static const struct {
  NI cap; NIM_CHAR data[1+1];
} TM__O1zDbSYyG8zQytyoZAh0dg_14 = { 1 | NIM_STRLIT_FLAG, "/" };
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_15 = {1, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_14};
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__O1zDbSYyG8zQytyoZAh0dg_16 = { 2 | NIM_STRLIT_FLAG, ".." };
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_17 = {2, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_16};
static const struct {
  NI cap; NIM_CHAR data[1+1];
} TM__O1zDbSYyG8zQytyoZAh0dg_18 = { 1 | NIM_STRLIT_FLAG, "." };
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_19 = {1, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_18};
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_21 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_22 = {1, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_18};
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_29 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
extern TNimTypeV2 NTIv2__YUzEEs8pGqG7cYmcRoc5rw_;
static const struct {
  NI cap; NIM_CHAR data[36+1];
} TM__O1zDbSYyG8zQytyoZAh0dg_30 = { 36 | NIM_STRLIT_FLAG, "The specified root is not absolute: " };
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_31 = {36, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_30};
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_33 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_34 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_35 = {1, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_18};
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_36 = {0, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_4};
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_43 = {2, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_16};
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_47 = {1, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_18};
static const NimStringV2 TM__O1zDbSYyG8zQytyoZAh0dg_56 = {2, (NimStrPayload*)&TM__O1zDbSYyG8zQytyoZAh0dg_16};
static NIM_CONST tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ TM__O1zDbSYyG8zQytyoZAh0dg_37 = {((NI)0),
((NI)-1)}
;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4198;
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZprivateZospaths2_u303)(tyTuple__UV3llMMYFckfui8YMBuUZA* dest_p0) {
	if ((*dest_p0).Field0.p && !((*dest_p0).Field0.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Field0.p);
}
	if ((*dest_p0).Field1.p && !((*dest_p0).Field1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Field1.p);
}
}
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___stdZprivateZospaths2_u300)(tyTuple__UV3llMMYFckfui8YMBuUZA* dest_p0) {
	(*dest_p0).Field0.len = 0; (*dest_p0).Field0.p = NIM_NIL;
	(*dest_p0).Field1.len = 0; (*dest_p0).Field1.p = NIM_NIL;
}
static N_INLINE(NIM_BOOL, eqeq___system_u9048)(NCSTRING x_p0, NCSTRING y_p1) {
	NIM_BOOL result;
	{
		if (!(((void*) (x_p0)) == ((void*) (y_p1)))) goto LA3_;
		result = NIM_TRUE;
	}
	goto LA1_;
LA3_: ;
	{
		NIM_BOOL T6_;
		T6_ = (NIM_BOOL)0;
		T6_ = (((void*) (x_p0)) == NIM_NIL);
		if (T6_) goto LA7_;
		T6_ = (((void*) (y_p1)) == NIM_NIL);
LA7_: ;
		if (!T6_) goto LA8_;
		result = NIM_FALSE;
	}
	goto LA1_;
LA8_: ;
	{
		int T11_;
		T11_ = (int)0;
		T11_ = strcmp(x_p0, y_p1);
		result = (T11_ == ((NI32)0));
	}
LA1_: ;
	return result;
}
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s_p0) {
	NCSTRING result;
	{
		if (!(s_p0.len == ((NI)0))) goto LA3_;
		result = "";
	}
	goto LA1_;
LA3_: ;
	{
		result = ((NCSTRING) ((*s_p0.p).data));
	}
LA1_: ;
	return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4198);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetCurrentDir)(void) {
	NimStringV2 result;
	NI bufsize_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	bufsize_1 = ((NI)1024);
	if ((bufsize_1) < ((NI)0) || (bufsize_1) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(bufsize_1, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
	}
	result = mnewString((bufsize_1));
	{
		while (1) {
			{
				NCSTRING T5_;
				NIM_BOOL T6_;
				size_t T9_;
				T5_ = (NCSTRING)0;
				T5_ = getcwd(nimToCStringConv(result), bufsize_1);
				T6_ = (NIM_BOOL)0;
				T6_ = eqeq___system_u9048(T5_, ((NCSTRING) NIM_NIL));
				if (!!(T6_)) goto LA7_;
				T9_ = (size_t)0;
				T9_ = strlen(nimToCStringConv(result));
				if (T9_ > (size_t)(((NI)IL64(9223372036854775807)))){ raiseRangeErrorNoArgs(); goto BeforeRet_;
				}
				setLengthStrV2((&result), ((NI) (T9_)));
				goto LA1;
			}
			goto LA3_;
LA7_: ;
			{
				NI32 err_1;
				err_1 = osLastError__stdZoserrors_u122();
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				{
					NimStringV2 T19_;
					if (!(err_1 == ERANGE)) goto LA13_;
					bufsize_1 = (NI)((NU64)(bufsize_1) << (NU64)(((NI)1) & (64 - 1)));
					{
						if (!!((((NI)0) <= bufsize_1))) goto LA17_;
						failedAssertImpl__stdZassertions_u95(TM__O1zDbSYyG8zQytyoZAh0dg_3);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					}
LA17_: ;
					if ((bufsize_1) < ((NI)0) || (bufsize_1) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(bufsize_1, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
					}
					T19_.len = 0; T19_.p = NIM_NIL;
					T19_ = mnewString((bufsize_1));
					eqsink___system_u2760((&result), T19_);
				}
				goto LA11_;
LA13_: ;
				{
					NI32 T21_;
					T21_ = (NI32)0;
					T21_ = osLastError__stdZoserrors_u122();
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					raiseOSError__stdZoserrors_u119(T21_, TM__O1zDbSYyG8zQytyoZAh0dg_5);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
LA11_: ;
			}
LA3_: ;
		}
	} LA1: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringV2 path_p0) {
	NIM_BOOL result;
{	{
		if (!(path_p0.len == ((NI)0))) goto LA3_;
		result = NIM_FALSE;
		goto BeforeRet_;
	}
LA3_: ;
	if (((NI)0) < 0 || ((NI)0) >= path_p0.len){ raiseIndexError2(((NI)0),path_p0.len-1); goto BeforeRet_;
	}
	result = ((NU8)(path_p0.p->data[((NI)0)]) == (NU8)(47));
	}BeforeRet_: ;
	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;
}
N_LIB_PRIVATE N_NIMCALL(NI, parentDirPos__stdZprivateZospaths2_u163)(NimStringV2 path_p0) {
	NI result;
	NI q_1;
{	result = (NI)0;
	q_1 = ((NI)1);
	{
		NIM_BOOL T3_;
		NI TM__O1zDbSYyG8zQytyoZAh0dg_6;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI)1) <= path_p0.len);
		if (!(T3_)) goto LA4_;
		if (nimSubInt(path_p0.len, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_6)) { raiseOverflow(); goto BeforeRet_;
		};
		if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_6) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_6) >= path_p0.len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_6),path_p0.len-1); goto BeforeRet_;
		}
		T3_ = (((NU8)(path_p0.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_6)])) == ((NU8)(47)) || ((NU8)(path_p0.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_6)])) == ((NU8)(47)));
LA4_: ;
		if (!T3_) goto LA5_;
		q_1 = ((NI)2);
	}
LA5_: ;
	{
		NI i_1;
		NI colontmp_;
		NI TM__O1zDbSYyG8zQytyoZAh0dg_7;
		NI res_1;
		i_1 = (NI)0;
		colontmp_ = (NI)0;
		if (nimSubInt(path_p0.len, q_1, &TM__O1zDbSYyG8zQytyoZAh0dg_7)) { raiseOverflow(); goto BeforeRet_;
		};
		colontmp_ = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_7);
		res_1 = colontmp_;
		{
			while (1) {
				NI TM__O1zDbSYyG8zQytyoZAh0dg_8;
				if (!(((NI)0) <= res_1)) goto LA9;
				i_1 = ((NI) (res_1));
				{
					if (i_1 < 0 || i_1 >= path_p0.len){ raiseIndexError2(i_1,path_p0.len-1); goto BeforeRet_;
					}
					if (!(((NU8)(path_p0.p->data[i_1])) == ((NU8)(47)) || ((NU8)(path_p0.p->data[i_1])) == ((NU8)(47)))) goto LA12_;
					result = i_1;
					goto BeforeRet_;
				}
LA12_: ;
				if (nimSubInt(res_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_8)) { raiseOverflow(); goto BeforeRet_;
				};
				res_1 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_8);
			} LA9: ;
		}
	}
	result = ((NI)-1);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisRootDir)(NimStringV2 path_p0) {
	NIM_BOOL result;
	NI T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	T1_ = (NI)0;
	T1_ = parentDirPos__stdZprivateZospaths2_u163(path_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	result = (T1_ < ((NI)0));
	}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(void, normalizePathEnd__stdZprivateZospaths2_u20)(NimStringV2* path_p0, NIM_BOOL trailingSep_p1) {
	NI i_1;
{	{
		if (!((*path_p0).len == ((NI)0))) goto LA3_;
		goto BeforeRet_;
	}
LA3_: ;
	i_1 = (*path_p0).len;
	{
		while (1) {
			if (!(((NI)1) <= i_1)) goto LA6;
			{
				NI TM__O1zDbSYyG8zQytyoZAh0dg_9;
				NI TM__O1zDbSYyG8zQytyoZAh0dg_10;
				if (nimSubInt(i_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_9)) { raiseOverflow(); goto BeforeRet_;
				};
				if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_9) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_9) >= (*path_p0).len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_9),(*path_p0).len-1); goto BeforeRet_;
				}
				if (!(((NU8)((*path_p0).p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_9)])) == ((NU8)(47)) || ((NU8)((*path_p0).p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_9)])) == ((NU8)(47)))) goto LA9_;
				if (nimSubInt(i_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_10)) { raiseOverflow(); goto BeforeRet_;
				};
				i_1 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_10);
			}
			goto LA7_;
LA9_: ;
			{
				NIM_BOOL T12_;
				NIM_BOOL T13_;
				NI TM__O1zDbSYyG8zQytyoZAh0dg_11;
				NI TM__O1zDbSYyG8zQytyoZAh0dg_12;
				NI TM__O1zDbSYyG8zQytyoZAh0dg_13;
				T12_ = (NIM_BOOL)0;
				T13_ = (NIM_BOOL)0;
				if (nimSubInt(i_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_11)) { raiseOverflow(); goto BeforeRet_;
				};
				if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_11) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_11) >= (*path_p0).len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_11),(*path_p0).len-1); goto BeforeRet_;
				}
				T13_ = ((NU8)((*path_p0).p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_11)]) == (NU8)(46));
				if (!(T13_)) goto LA14_;
				T13_ = (((NI)2) <= i_1);
LA14_: ;
				T12_ = T13_;
				if (!(T12_)) goto LA15_;
				if (nimSubInt(i_1, ((NI)2), &TM__O1zDbSYyG8zQytyoZAh0dg_12)) { raiseOverflow(); goto BeforeRet_;
				};
				if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_12) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_12) >= (*path_p0).len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_12),(*path_p0).len-1); goto BeforeRet_;
				}
				T12_ = (((NU8)((*path_p0).p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_12)])) == ((NU8)(47)) || ((NU8)((*path_p0).p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_12)])) == ((NU8)(47)));
LA15_: ;
				if (!T12_) goto LA16_;
				if (nimSubInt(i_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_13)) { raiseOverflow(); goto BeforeRet_;
				};
				i_1 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_13);
			}
			goto LA7_;
LA16_: ;
			{
				goto LA5;
			}
LA7_: ;
		} LA6: ;
	} LA5: ;
	{
		if (!trailingSep_p1) goto LA21_;
		if ((i_1) < ((NI)0) || (i_1) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(i_1, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
		}
		setLengthStrV2((&(*path_p0)), (i_1));
		nimAddCharV1((&(*path_p0)), 47);
	}
	goto LA19_;
LA21_: ;
	{
		if (!(((NI)0) < i_1)) goto LA24_;
		if ((i_1) < ((NI)0) || (i_1) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(i_1, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
		}
		setLengthStrV2((&(*path_p0)), (i_1));
	}
	goto LA19_;
LA24_: ;
	{
		eqsink___system_u2760((&(*path_p0)), TM__O1zDbSYyG8zQytyoZAh0dg_15);
	}
LA19_: ;
	}BeforeRet_: ;
}
static N_INLINE(int, nimCmpMem)(void* a_p0, void* b_p1, NI size_p2) {
	int result;
	result = memcmp(a_p0, b_p1, ((size_t) (size_p2)));
	return result;
}
static N_INLINE(NIM_BOOL, equalMem__system_u1763)(void* a_p0, void* b_p1, NI size_p2) {
	NIM_BOOL result;
	int T1_;
	T1_ = (int)0;
	T1_ = nimCmpMem(a_p0, b_p1, size_p2);
	result = (T1_ == ((NI32)0));
	return result;
}
static N_INLINE(NIM_BOOL, eqStrings)(NimStringV2 a_p0, NimStringV2 b_p1) {
	NIM_BOOL result;
	NI alen_1;
	NI blen_1;
{	result = NIM_FALSE;
	alen_1 = a_p0.len;
	blen_1 = b_p1.len;
	{
		if (!(alen_1 == blen_1)) goto LA3_;
		{
			if (!(alen_1 == ((NI)0))) goto LA7_;
			result = NIM_TRUE;
			goto BeforeRet_;
		}
LA7_: ;
		result = equalMem__system_u1763(((void*) ((&a_p0.p->data[((NI)0)]))), ((void*) ((&b_p1.p->data[((NI)0)]))), (alen_1));
		goto BeforeRet_;
	}
LA3_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = !(((*s_p0).p == ((NimStrPayload*) NIM_NIL)));
		if (!(T3_)) goto LA4_;
		T3_ = ((NI)((*(*s_p0).p).cap & ((NI)IL64(4611686018427387904))) == ((NI)IL64(4611686018427387904)));
LA4_: ;
		if (!T3_) goto LA5_;
		nimPrepareStrMutationImpl__system_u2493(s_p0);
	}
LA5_: ;
}
static N_INLINE(NIM_CHAR*, X5BX5D___system_u8571)(NimStringV2* s_p0, NI i_p1) {
	NIM_CHAR* result;
	NI TM__O1zDbSYyG8zQytyoZAh0dg_20;
{	result = (NIM_CHAR*)0;
	nimPrepareStrMutationV2((&(*s_p0)));
	if (nimSubInt((*s_p0).len, i_p1, &TM__O1zDbSYyG8zQytyoZAh0dg_20)) { raiseOverflow(); goto BeforeRet_;
	};
	if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_20) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_20) >= (*s_p0).len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_20),(*s_p0).len-1); goto BeforeRet_;
	}
	result = (&(*s_p0).p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_20)]);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosparentDir)(NimStringV2 path_p0) {
	NimStringV2 result;
	NI sepPos_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	result = normalizePath__pureZpathnorm_u150(path_p0, 47);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	sepPos_1 = parentDirPos__stdZprivateZospaths2_u163(result);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		NimStringV2 T5_;
		if (!(((NI)0) <= sepPos_1)) goto LA3_;
		T5_.len = 0; T5_.p = NIM_NIL;
		T5_ = substr__system_u9096(result, ((NI)0), sepPos_1);
		eqsink___system_u2760((&result), T5_);
		normalizePathEnd__stdZprivateZospaths2_u20((&result), NIM_FALSE);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA1_;
LA3_: ;
	{
		NIM_BOOL T7_;
		NIM_BOOL T8_;
		NIM_BOOL T9_;
		NIM_CHAR* T13_;
		T7_ = (NIM_BOOL)0;
		T8_ = (NIM_BOOL)0;
		T9_ = (NIM_BOOL)0;
		T9_ = eqStrings(result, TM__O1zDbSYyG8zQytyoZAh0dg_17);
		if (T9_) goto LA10_;
		T9_ = eqStrings(result, TM__O1zDbSYyG8zQytyoZAh0dg_19);
LA10_: ;
		T8_ = T9_;
		if (T8_) goto LA11_;
		T8_ = (result.len == ((NI)0));
LA11_: ;
		T7_ = T8_;
		if (T7_) goto LA12_;
		T13_ = (NIM_CHAR*)0;
		T13_ = X5BX5D___system_u8571((&result), ((NI)1));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T7_ = (((NU8)((*T13_))) == ((NU8)(47)) || ((NU8)((*T13_))) == ((NU8)(47)));
LA12_: ;
		if (!T7_) goto LA14_;
		eqsink___system_u2760((&result), TM__O1zDbSYyG8zQytyoZAh0dg_21);
	}
	goto LA1_;
LA14_: ;
	{
		eqsink___system_u2760((&result), TM__O1zDbSYyG8zQytyoZAh0dg_22);
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, noscmpPaths)(NimStringV2 pathA_p0, NimStringV2 pathB_p1) {
	NI result;
	NimStringV2 a_1;
	NimStringV2 b_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	a_1.len = 0; a_1.p = NIM_NIL;
	b_1.len = 0; b_1.p = NIM_NIL;
	a_1 = normalizePath__pureZpathnorm_u150(pathA_p0, 47);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	b_1 = normalizePath__pureZpathnorm_u150(pathB_p1, 47);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!NIM_FALSE) goto LA3_;
		result = cmp__system_u1571(a_1, b_1);
	}
	goto LA1_;
LA3_: ;
	{
		result = nsuCmpIgnoreCase(a_1, b_1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA1_: ;
	if (b_1.p && !(b_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(b_1.p);
}
	if (a_1.p && !(a_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(a_1.p);
}
	}BeforeRet_: ;
	return result;
}
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;
}
static N_INLINE(NIM_CHAR, X5BX5D___system_u8519)(NimStringV2 s_p0, NI i_p1) {
	NIM_CHAR result;
	NI TM__O1zDbSYyG8zQytyoZAh0dg_24;
{	result = (NIM_CHAR)0;
	if (nimSubInt(s_p0.len, i_p1, &TM__O1zDbSYyG8zQytyoZAh0dg_24)) { raiseOverflow(); goto BeforeRet_;
	};
	if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_24) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_24) >= s_p0.len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_24),s_p0.len-1); goto BeforeRet_;
	}
	result = s_p0.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_24)];
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, joinPathImpl__stdZprivateZospaths2_u49)(NimStringV2* result_p0, NI* state_p1, NimStringV2 tail_p2) {
	NIM_BOOL trailingSep_1;
	NIM_BOOL T1_;
	NIM_BOOL T2_;
	NIM_CHAR T4_;
	NIM_BOOL T6_;
	NIM_BOOL T8_;
	NIM_CHAR* T10_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	T1_ = (NIM_BOOL)0;
	T2_ = (NIM_BOOL)0;
	T2_ = (((NI)0) < tail_p2.len);
	if (!(T2_)) goto LA3_;
	T4_ = (NIM_CHAR)0;
	T4_ = X5BX5D___system_u8519(tail_p2, ((NI)1));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T2_ = (((NU8)(T4_)) == ((NU8)(47)) || ((NU8)(T4_)) == ((NU8)(47)));
LA3_: ;
	T1_ = T2_;
	if (T1_) goto LA5_;
	T6_ = (NIM_BOOL)0;
	T6_ = (tail_p2.len == ((NI)0));
	if (!(T6_)) goto LA7_;
	T8_ = (NIM_BOOL)0;
	T8_ = (((NI)0) < (*result_p0).len);
	if (!(T8_)) goto LA9_;
	T10_ = (NIM_CHAR*)0;
	T10_ = X5BX5D___system_u8571(result_p0, ((NI)1));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T8_ = (((NU8)((*T10_))) == ((NU8)(47)) || ((NU8)((*T10_))) == ((NU8)(47)));
LA9_: ;
	T6_ = T8_;
LA7_: ;
	T1_ = T6_;
LA5_: ;
	trailingSep_1 = T1_;
	normalizePathEnd__stdZprivateZospaths2_u20(result_p0, NIM_FALSE);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	addNormalizePath__pureZpathnorm_u86(tail_p2, result_p0, state_p1, 47);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	normalizePathEnd__stdZprivateZospaths2_u20(result_p0, trailingSep_1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosjoinPath)(NimStringV2 head_p0, NimStringV2 tail_p1) {
	NimStringV2 result;
	NI TM__O1zDbSYyG8zQytyoZAh0dg_23;
	NI state_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	if (nimAddInt(head_p0.len, tail_p1.len, &TM__O1zDbSYyG8zQytyoZAh0dg_23)) { raiseOverflow(); goto BeforeRet_;
	};
	if (((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_23)) < ((NI)0) || ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_23)) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_23), ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
	}
	result = rawNewString(((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_23)));
	state_1 = ((NI)0);
	joinPathImpl__stdZprivateZospaths2_u49((&result), (&state_1), head_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	joinPathImpl__stdZprivateZospaths2_u49((&result), (&state_1), tail_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
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);
}
N_LIB_PRIVATE N_NIMCALL(void, nossplitPath)(NimStringV2 path_p0, tyTuple__UV3llMMYFckfui8YMBuUZA* Result) {
	NI sepPos_1;
{	nimZeroMem((void*)Result, sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
	sepPos_1 = ((NI)-1);
	{
		NI i_1;
		NI colontmp_;
		NI TM__O1zDbSYyG8zQytyoZAh0dg_25;
		NI res_1;
		i_1 = (NI)0;
		colontmp_ = (NI)0;
		if (nimSubInt(path_p0.len, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_25)) { raiseOverflow(); goto BeforeRet_;
		};
		colontmp_ = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_25);
		res_1 = colontmp_;
		{
			while (1) {
				NI TM__O1zDbSYyG8zQytyoZAh0dg_26;
				if (!(((NI)0) <= res_1)) goto LA3;
				i_1 = ((NI) (res_1));
				{
					if (i_1 < 0 || i_1 >= path_p0.len){ raiseIndexError2(i_1,path_p0.len-1); goto BeforeRet_;
					}
					if (!(((NU8)(path_p0.p->data[i_1])) == ((NU8)(47)) || ((NU8)(path_p0.p->data[i_1])) == ((NU8)(47)))) goto LA6_;
					sepPos_1 = i_1;
					goto LA1;
				}
LA6_: ;
				if (nimSubInt(res_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_26)) { raiseOverflow(); goto BeforeRet_;
				};
				res_1 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_26);
			} LA3: ;
		}
	} LA1: ;
	{
		NI colontmpD_;
		NI colontmpD__2;
		NI T12_;
		NimStringV2 T19_;
		NI TM__O1zDbSYyG8zQytyoZAh0dg_28;
		NimStringV2 T20_;
		if (!(((NI)0) <= sepPos_1)) goto LA10_;
		colontmpD_ = (NI)0;
		colontmpD__2 = (NI)0;
		T12_ = (NI)0;
		{
			NIM_BOOL T15_;
			NI TM__O1zDbSYyG8zQytyoZAh0dg_27;
			T15_ = (NIM_BOOL)0;
			T15_ = NIM_LIKELY((((NI)1) <= sepPos_1));
			if (!T15_) goto LA16_;
			if (nimSubInt(sepPos_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_27)) { raiseOverflow(); goto BeforeRet_;
			};
			colontmpD_ = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_27);
			T12_ = colontmpD_;
		}
		goto LA13_;
LA16_: ;
		{
			colontmpD__2 = ((NI)0);
			T12_ = colontmpD__2;
		}
LA13_: ;
		T19_.len = 0; T19_.p = NIM_NIL;
		T19_ = substr__system_u9096(path_p0, ((NI)0), T12_);
		eqsink___system_u2760((&(*Result).Field0), T19_);
		if (nimAddInt(sepPos_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_28)) { raiseOverflow(); goto BeforeRet_;
		};
		T20_.len = 0; T20_.p = NIM_NIL;
		T20_ = substr__system_u9109(path_p0, (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_28));
		eqsink___system_u2760((&(*Result).Field1), T20_);
	}
	goto LA8_;
LA10_: ;
	{
		eqsink___system_u2760((&(*Result).Field0), TM__O1zDbSYyG8zQytyoZAh0dg_29);
		eqcopy___system_u2754((&(*Result).Field1), path_p0);
	}
LA8_: ;
	}BeforeRet_: ;
}
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(NimStringV2, absolutePath__stdZprivateZospaths2_u359)(NimStringV2 path_p0, NimStringV2 root_p1) {
	NimStringV2 result;
	NimStringV2 T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	T1_.len = 0; T1_.p = NIM_NIL;
	{
		NIM_BOOL T4_;
		T4_ = (NIM_BOOL)0;
		T4_ = nosisAbsolute(path_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!T4_) goto LA5_;
		eqcopy___system_u2754((&result), path_p0);
	}
	goto LA2_;
LA5_: ;
	{
		{
			NIM_BOOL T10_;
			tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T13_;
			NimStringV2 T14_;
			T10_ = (NIM_BOOL)0;
			T10_ = nosisAbsolute(root_p1);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (!!(T10_)) goto LA11_;
			T13_ = NIM_NIL;
			T13_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
			(*T13_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
			(*T13_).Sup.Sup.name = "ValueError";
			T14_.len = 0; T14_.p = NIM_NIL;
			T14_ = rawNewString(root_p1.len + 36);
appendString((&T14_), TM__O1zDbSYyG8zQytyoZAh0dg_31);
appendString((&T14_), root_p1);
			(*T13_).Sup.Sup.message = T14_;
			(*T13_).Sup.Sup.parent = ((Exception*) NIM_NIL);
			raiseExceptionEx((Exception*)T13_, "ValueError", "absolutePath", "ospaths2.nim", 904);
goto BeforeRet_;
		}
LA11_: ;
		result = nosjoinPath(root_p1, path_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA2_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosextractFilename)(NimStringV2 path_p0) {
	NimStringV2 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	{
		NIM_BOOL T3_;
		NI TM__O1zDbSYyG8zQytyoZAh0dg_32;
		T3_ = (NIM_BOOL)0;
		T3_ = (path_p0.len == ((NI)0));
		if (T3_) goto LA4_;
		if (nimSubInt(path_p0.len, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_32)) { raiseOverflow(); goto BeforeRet_;
		};
		if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_32) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_32) >= path_p0.len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_32),path_p0.len-1); goto BeforeRet_;
		}
		T3_ = (((NU8)(path_p0.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_32)])) == ((NU8)(47)) || ((NU8)(path_p0.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_32)])) == ((NU8)(47)));
LA4_: ;
		if (!T3_) goto LA5_;
		result = TM__O1zDbSYyG8zQytyoZAh0dg_33;
	}
	goto LA1_;
LA5_: ;
	{
		tyTuple__UV3llMMYFckfui8YMBuUZA colontmpD_;
		nimZeroMem((void*)(&colontmpD_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
		nossplitPath(path_p0, (&colontmpD_));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		result = colontmpD_.Field1;
		eqwasMoved___system_u2751((&colontmpD_.Field1));
		eqdestroy___stdZprivateZospaths2_u303((&colontmpD_));
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, eqdestroy___system_u281)(NimStringV2 x_p0) {
}
N_LIB_PRIVATE N_NIMCALL(void, nosnormalizePath)(NimStringV2* path_p0) {
	NimStringV2 T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	T1_.len = 0; T1_.p = NIM_NIL;
	T1_ = normalizePath__pureZpathnorm_u150((*path_p0), 47);
	if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T1_); goto BeforeRet_;}
	eqsink___system_u2760((&(*path_p0)), T1_);
	}BeforeRet_: ;
}
static N_INLINE(void, normalizePathAux__stdZprivateZospaths2_u15)(NimStringV2* path_p0) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nosnormalizePath(path_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, absolutePathInternal__stdZprivateZospaths2_u18)(NimStringV2 path_p0) {
	NimStringV2 result;
	NimStringV2 colontmpD_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	colontmpD_ = nosgetCurrentDir();
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	result = absolutePath__stdZprivateZospaths2_u359(path_p0, colontmpD_);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	{
		LA1_:;
	}
	{
		if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosrelativePath)(NimStringV2 path_p0, NimStringV2 base_p1, NIM_CHAR sep_p2) {
	NimStringV2 result;
	NimStringV2 base_2;
	NimStringV2 path_2;
	NimStringV2 T6_;
	NIM_BOOL a1_1;
	NIM_BOOL a2_1;
	tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg f_1;
	tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg b_1;
	tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ ff_1;
	tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bb_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	base_2.len = 0; base_2.p = NIM_NIL;
	path_2.len = 0; path_2.p = NIM_NIL;
	{
		if (!(path_p0.len == ((NI)0))) goto LA4_;
		result = TM__O1zDbSYyG8zQytyoZAh0dg_34;
		if (path_2.p && !(path_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(path_2.p);
}
		if (base_2.p && !(base_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(base_2.p);
}
		goto BeforeRet_;
	}
LA4_: ;
	T6_.len = 0; T6_.p = NIM_NIL;
	{
		if (!eqStrings(base_p1, TM__O1zDbSYyG8zQytyoZAh0dg_35)) goto LA9_;
		base_2 = TM__O1zDbSYyG8zQytyoZAh0dg_36;
	}
	goto LA7_;
LA9_: ;
	{
		eqcopy___system_u2754((&base_2), base_p1);
	}
LA7_: ;
	eqcopy___system_u2754((&path_2), path_p0);
	normalizePathAux__stdZprivateZospaths2_u15((&path_2));
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	normalizePathAux__stdZprivateZospaths2_u15((&base_2));
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	a1_1 = nosisAbsolute(path_2);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	a2_1 = nosisAbsolute(base_2);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	{
		NIM_BOOL T14_;
		NimStringV2 T18_;
		T14_ = (NIM_BOOL)0;
		T14_ = a1_1;
		if (!(T14_)) goto LA15_;
		T14_ = !(a2_1);
LA15_: ;
		if (!T14_) goto LA16_;
		T18_.len = 0; T18_.p = NIM_NIL;
		T18_ = absolutePathInternal__stdZprivateZospaths2_u18(base_2);
		if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T18_); goto LA1_;}
		eqsink___system_u2760((&base_2), T18_);
	}
	goto LA12_;
LA16_: ;
	{
		NIM_BOOL T20_;
		NimStringV2 T24_;
		T20_ = (NIM_BOOL)0;
		T20_ = a2_1;
		if (!(T20_)) goto LA21_;
		T20_ = !(a1_1);
LA21_: ;
		if (!T20_) goto LA22_;
		T24_.len = 0; T24_.p = NIM_NIL;
		T24_ = absolutePathInternal__stdZprivateZospaths2_u18(path_2);
		if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T24_); goto LA1_;}
		eqsink___system_u2760((&path_2), T24_);
	}
	goto LA12_;
LA22_: ;
LA12_: ;
	nimZeroMem((void*)(&f_1), sizeof(tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg));
	nimZeroMem((void*)(&b_1), sizeof(tyObject_PathIter__3doQ1Hm8seAOLvgTvUQhFg));
	ff_1 = TM__O1zDbSYyG8zQytyoZAh0dg_37;
	bb_1 = TM__O1zDbSYyG8zQytyoZAh0dg_37;
	if ((path_2.len) < ((NI)0) || (path_2.len) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(path_2.len, ((NI)0), ((NI)IL64(9223372036854775807))); goto LA1_;
	}
	result = rawNewString((path_2.len));
	{
		while (1) {
			NIM_BOOL T27_;
			NI diff_1;
			NI TM__O1zDbSYyG8zQytyoZAh0dg_38;
			NIM_BOOL same_1;
			NI colontmp_;
			NI colontmp__2;
			NI colontmp__3;
			NI colontmp__4;
			T27_ = (NIM_BOOL)0;
			T27_ = hasNext__pureZpathnorm_u6(f_1, path_2);
			if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			if (!(T27_)) goto LA28_;
			T27_ = hasNext__pureZpathnorm_u6(b_1, base_2);
			if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
LA28_: ;
			if (!T27_) goto LA26;
			ff_1 = next__pureZpathnorm_u10((&f_1), path_2);
			if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			bb_1 = next__pureZpathnorm_u10((&b_1), base_2);
			if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			if (nimSubInt(ff_1.Field1, ff_1.Field0, &TM__O1zDbSYyG8zQytyoZAh0dg_38)) { raiseOverflow(); goto LA1_;
			};
			diff_1 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_38);
			{
				NI TM__O1zDbSYyG8zQytyoZAh0dg_39;
				if (nimSubInt(bb_1.Field1, bb_1.Field0, &TM__O1zDbSYyG8zQytyoZAh0dg_39)) { raiseOverflow(); goto LA1_;
				};
				if (!!((diff_1 == (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_39)))) goto LA31_;
				goto LA25;
			}
LA31_: ;
			same_1 = NIM_TRUE;
			{
				NI i_1;
				NI res_1;
				i_1 = (NI)0;
				res_1 = ((NI)0);
				{
					while (1) {
						NI TM__O1zDbSYyG8zQytyoZAh0dg_42;
						if (!(res_1 <= diff_1)) goto LA35;
						i_1 = ((NI) (res_1));
						{
							NI TM__O1zDbSYyG8zQytyoZAh0dg_40;
							NIM_CHAR T38_;
							NI TM__O1zDbSYyG8zQytyoZAh0dg_41;
							NIM_CHAR T39_;
							if (nimAddInt(i_1, ff_1.Field0, &TM__O1zDbSYyG8zQytyoZAh0dg_40)) { raiseOverflow(); goto LA1_;
							};
							if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_40) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_40) >= path_2.len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_40),path_2.len-1); goto LA1_;
							}
							T38_ = (NIM_CHAR)0;
							T38_ = nsuToLowerAsciiChar(path_2.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_40)]);
							if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
							if (nimAddInt(i_1, bb_1.Field0, &TM__O1zDbSYyG8zQytyoZAh0dg_41)) { raiseOverflow(); goto LA1_;
							};
							if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_41) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_41) >= base_2.len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_41),base_2.len-1); goto LA1_;
							}
							T39_ = (NIM_CHAR)0;
							T39_ = nsuToLowerAsciiChar(base_2.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_41)]);
							if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
							if (!!(((NU8)(T38_) == (NU8)(T39_)))) goto LA40_;
							same_1 = NIM_FALSE;
							goto LA33;
						}
LA40_: ;
						if (nimAddInt(res_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_42)) { raiseOverflow(); goto LA1_;
						};
						res_1 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_42);
					} LA35: ;
				}
			} LA33: ;
			{
				if (!!(same_1)) goto LA44_;
				goto LA25;
			}
LA44_: ;
			colontmp_ = ((NI)0);
			colontmp__2 = ((NI)-1);
			ff_1.Field0 = colontmp_;
			ff_1.Field1 = colontmp__2;
			colontmp__3 = ((NI)0);
			colontmp__4 = ((NI)-1);
			bb_1.Field0 = colontmp__3;
			bb_1.Field1 = colontmp__4;
		} LA26: ;
	} LA25: ;
	{
		while (1) {
			{
				if (!(bb_1.Field0 <= bb_1.Field1)) goto LA50_;
				{
					NIM_BOOL T54_;
					NIM_CHAR* T56_;
					T54_ = (NIM_BOOL)0;
					T54_ = (((NI)0) < result.len);
					if (!(T54_)) goto LA55_;
					T56_ = (NIM_CHAR*)0;
					T56_ = X5BX5D___system_u8571((&result), ((NI)1));
					if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
					T54_ = !(((NU8)((*T56_)) == (NU8)(sep_p2)));
LA55_: ;
					if (!T54_) goto LA57_;
					nimAddCharV1((&result), sep_p2);
				}
LA57_: ;
				prepareAdd((&result), 2);
appendString((&result), TM__O1zDbSYyG8zQytyoZAh0dg_43);
			}
LA50_: ;
			{
				NIM_BOOL T61_;
				T61_ = (NIM_BOOL)0;
				T61_ = hasNext__pureZpathnorm_u6(b_1, base_2);
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
				if (!!(T61_)) goto LA62_;
				goto LA46;
			}
LA62_: ;
			bb_1 = next__pureZpathnorm_u10((&b_1), base_2);
			if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
		}
	} LA46: ;
	{
		while (1) {
			{
				if (!(ff_1.Field0 <= ff_1.Field1)) goto LA68_;
				{
					NIM_BOOL T72_;
					NIM_CHAR* T74_;
					T72_ = (NIM_BOOL)0;
					T72_ = (((NI)0) < result.len);
					if (!(T72_)) goto LA73_;
					T74_ = (NIM_CHAR*)0;
					T74_ = X5BX5D___system_u8571((&result), ((NI)1));
					if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
					T72_ = !(((NU8)((*T74_)) == (NU8)(sep_p2)));
LA73_: ;
					if (!T72_) goto LA75_;
					nimAddCharV1((&result), sep_p2);
				}
LA75_: ;
				{
					NI i_2;
					NI colontmp__5;
					NI TM__O1zDbSYyG8zQytyoZAh0dg_44;
					NI res_2;
					i_2 = (NI)0;
					colontmp__5 = (NI)0;
					if (nimSubInt(ff_1.Field1, ff_1.Field0, &TM__O1zDbSYyG8zQytyoZAh0dg_44)) { raiseOverflow(); goto LA1_;
					};
					colontmp__5 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_44);
					res_2 = ((NI)0);
					{
						while (1) {
							NI TM__O1zDbSYyG8zQytyoZAh0dg_45;
							NI TM__O1zDbSYyG8zQytyoZAh0dg_46;
							if (!(res_2 <= colontmp__5)) goto LA79;
							i_2 = ((NI) (res_2));
							if (nimAddInt(i_2, ff_1.Field0, &TM__O1zDbSYyG8zQytyoZAh0dg_45)) { raiseOverflow(); goto LA1_;
							};
							if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_45) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_45) >= path_2.len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_45),path_2.len-1); goto LA1_;
							}
							nimAddCharV1((&result), path_2.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_45)]);
							if (nimAddInt(res_2, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_46)) { raiseOverflow(); goto LA1_;
							};
							res_2 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_46);
						} LA79: ;
					}
				}
			}
LA68_: ;
			{
				NIM_BOOL T82_;
				T82_ = (NIM_BOOL)0;
				T82_ = hasNext__pureZpathnorm_u6(f_1, path_2);
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
				if (!!(T82_)) goto LA83_;
				goto LA64;
			}
LA83_: ;
			ff_1 = next__pureZpathnorm_u10((&f_1), path_2);
			if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
		}
	} LA64: ;
	{
		if (!(result.len == ((NI)0))) goto LA87_;
		prepareAdd((&result), 1);
appendString((&result), TM__O1zDbSYyG8zQytyoZAh0dg_47);
	}
LA87_: ;
	{
		LA1_:;
	}
	{
		if (path_2.p && !(path_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(path_2.p);
}
		if (base_2.p && !(base_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(base_2.p);
}
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normalizePathEnd__stdZprivateZospaths2_u42)(NimStringV2 path_p0, NIM_BOOL trailingSep_p1) {
	NimStringV2 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	eqcopy___system_u2754((&result), path_p0);
	normalizePathEnd__stdZprivateZospaths2_u20((&result), trailingSep_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, noslastPathPart)(NimStringV2 path_p0) {
	NimStringV2 result;
	NimStringV2 path_2;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	path_2.len = 0; path_2.p = NIM_NIL;
	path_2 = normalizePathEnd__stdZprivateZospaths2_u42(path_p0, NIM_FALSE);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	result = nosextractFilename(path_2);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	if (path_2.p && !(path_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(path_2.p);
}
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nossplitFile)(NimStringV2 path_p0, tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* Result) {
	NI namePos_1;
	NI dotPos_1;
{	nimZeroMem((void*)Result, sizeof(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg));
	namePos_1 = ((NI)0);
	dotPos_1 = ((NI)0);
	{
		NI i_1;
		NI colontmp_;
		NI TM__O1zDbSYyG8zQytyoZAh0dg_48;
		NI res_1;
		i_1 = (NI)0;
		colontmp_ = (NI)0;
		if (nimSubInt(path_p0.len, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_48)) { raiseOverflow(); goto BeforeRet_;
		};
		colontmp_ = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_48);
		res_1 = colontmp_;
		{
			while (1) {
				NI TM__O1zDbSYyG8zQytyoZAh0dg_55;
				if (!(((NI)0) <= res_1)) goto LA3;
				i_1 = ((NI) (res_1));
				{
					NIM_BOOL T6_;
					T6_ = (NIM_BOOL)0;
					if (i_1 < 0 || i_1 >= path_p0.len){ raiseIndexError2(i_1,path_p0.len-1); goto BeforeRet_;
					}
					T6_ = (((NU8)(path_p0.p->data[i_1])) == ((NU8)(47)) || ((NU8)(path_p0.p->data[i_1])) == ((NU8)(47)));
					if (T6_) goto LA7_;
					T6_ = (i_1 == ((NI)0));
LA7_: ;
					if (!T6_) goto LA8_;
					{
						NI colontmpD_;
						NI colontmpD__2;
						NI T14_;
						NimStringV2 T21_;
						NI TM__O1zDbSYyG8zQytyoZAh0dg_50;
						if (i_1 < 0 || i_1 >= path_p0.len){ raiseIndexError2(i_1,path_p0.len-1); goto BeforeRet_;
						}
						if (!(((NU8)(path_p0.p->data[i_1])) == ((NU8)(47)) || ((NU8)(path_p0.p->data[i_1])) == ((NU8)(47)))) goto LA12_;
						colontmpD_ = (NI)0;
						colontmpD__2 = (NI)0;
						T14_ = (NI)0;
						{
							NIM_BOOL T17_;
							NI TM__O1zDbSYyG8zQytyoZAh0dg_49;
							T17_ = (NIM_BOOL)0;
							T17_ = NIM_LIKELY((((NI)1) <= i_1));
							if (!T17_) goto LA18_;
							if (nimSubInt(i_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_49)) { raiseOverflow(); goto BeforeRet_;
							};
							colontmpD_ = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_49);
							T14_ = colontmpD_;
						}
						goto LA15_;
LA18_: ;
						{
							colontmpD__2 = ((NI)0);
							T14_ = colontmpD__2;
						}
LA15_: ;
						T21_.len = 0; T21_.p = NIM_NIL;
						T21_ = substr__system_u9096(path_p0, ((NI)0), T14_);
						eqsink___system_u2760((&(*Result).Field0), T21_);
						if (nimAddInt(i_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_50)) { raiseOverflow(); goto BeforeRet_;
						};
						namePos_1 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_50);
					}
LA12_: ;
					{
						NI TM__O1zDbSYyG8zQytyoZAh0dg_51;
						NimStringV2 T26_;
						NimStringV2 T27_;
						if (!(i_1 < dotPos_1)) goto LA24_;
						if (nimSubInt(dotPos_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_51)) { raiseOverflow(); goto BeforeRet_;
						};
						T26_.len = 0; T26_.p = NIM_NIL;
						T26_ = substr__system_u9096(path_p0, namePos_1, (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_51));
						eqsink___system_u2760((&(*Result).Field1), T26_);
						T27_.len = 0; T27_.p = NIM_NIL;
						T27_ = substr__system_u9109(path_p0, dotPos_1);
						eqsink___system_u2760((&(*Result).Field2), T27_);
					}
					goto LA22_;
LA24_: ;
					{
						NimStringV2 T29_;
						T29_.len = 0; T29_.p = NIM_NIL;
						T29_ = substr__system_u9109(path_p0, namePos_1);
						eqsink___system_u2760((&(*Result).Field1), T29_);
					}
LA22_: ;
					goto LA1;
				}
				goto LA4_;
LA8_: ;
				{
					NIM_BOOL T31_;
					NIM_BOOL T32_;
					NIM_BOOL T33_;
					NIM_BOOL T34_;
					NIM_BOOL T35_;
					NI TM__O1zDbSYyG8zQytyoZAh0dg_52;
					NI TM__O1zDbSYyG8zQytyoZAh0dg_53;
					NI TM__O1zDbSYyG8zQytyoZAh0dg_54;
					T31_ = (NIM_BOOL)0;
					T32_ = (NIM_BOOL)0;
					T33_ = (NIM_BOOL)0;
					T34_ = (NIM_BOOL)0;
					T35_ = (NIM_BOOL)0;
					if (i_1 < 0 || i_1 >= path_p0.len){ raiseIndexError2(i_1,path_p0.len-1); goto BeforeRet_;
					}
					T35_ = ((NU8)(path_p0.p->data[i_1]) == (NU8)(46));
					if (!(T35_)) goto LA36_;
					T35_ = (((NI)0) < i_1);
LA36_: ;
					T34_ = T35_;
					if (!(T34_)) goto LA37_;
					if (nimSubInt(path_p0.len, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_52)) { raiseOverflow(); goto BeforeRet_;
					};
					T34_ = (i_1 < (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_52));
LA37_: ;
					T33_ = T34_;
					if (!(T33_)) goto LA38_;
					if (nimSubInt(i_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_53)) { raiseOverflow(); goto BeforeRet_;
					};
					if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_53) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_53) >= path_p0.len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_53),path_p0.len-1); goto BeforeRet_;
					}
					T33_ = !((((NU8)(path_p0.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_53)])) == ((NU8)(47)) || ((NU8)(path_p0.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_53)])) == ((NU8)(47))));
LA38_: ;
					T32_ = T33_;
					if (!(T32_)) goto LA39_;
					if (nimAddInt(i_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_54)) { raiseOverflow(); goto BeforeRet_;
					};
					if ((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_54) < 0 || (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_54) >= path_p0.len){ raiseIndexError2((NI)(TM__O1zDbSYyG8zQytyoZAh0dg_54),path_p0.len-1); goto BeforeRet_;
					}
					T32_ = !(((NU8)(path_p0.p->data[(NI)(TM__O1zDbSYyG8zQytyoZAh0dg_54)]) == (NU8)(46)));
LA39_: ;
					T31_ = T32_;
					if (!(T31_)) goto LA40_;
					T31_ = (dotPos_1 == ((NI)0));
LA40_: ;
					if (!T31_) goto LA41_;
					dotPos_1 = i_1;
				}
				goto LA4_;
LA41_: ;
LA4_: ;
				if (nimSubInt(res_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_55)) { raiseOverflow(); goto BeforeRet_;
				};
				res_1 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_55);
			} LA3: ;
		}
	} LA1: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZos_u217)(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* dest_p0) {
	if ((*dest_p0).Field0.p && !((*dest_p0).Field0.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Field0.p);
}
	if ((*dest_p0).Field1.p && !((*dest_p0).Field1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Field1.p);
}
	if ((*dest_p0).Field2.p && !((*dest_p0).Field2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Field2.p);
}
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isRelativeTo__stdZprivateZospaths2_u156)(NimStringV2 path_p0, NimStringV2 base_p1) {
	NIM_BOOL result;
	NimStringV2 path_2;
	NimStringV2 base_2;
	NimStringV2 ret_1;
	NIM_BOOL T2_;
	NIM_BOOL T4_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	path_2.len = 0; path_2.p = NIM_NIL;
	base_2.len = 0; base_2.p = NIM_NIL;
	ret_1.len = 0; ret_1.p = NIM_NIL;
	path_2 = normalizePath__pureZpathnorm_u150(path_p0, 47);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	base_2 = normalizePath__pureZpathnorm_u150(base_p1, 47);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	ret_1 = nosrelativePath(path_2, base_2, 47);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	T2_ = (NIM_BOOL)0;
	T2_ = (((NI)0) < path_2.len);
	if (!(T2_)) goto LA3_;
	T4_ = (NIM_BOOL)0;
	T4_ = nsuStartsWith(ret_1, TM__O1zDbSYyG8zQytyoZAh0dg_56);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	T2_ = !(T4_);
LA3_: ;
	result = T2_;
	{
		LA1_:;
	}
	{
		if (ret_1.p && !(ret_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(ret_1.p);
}
		if (base_2.p && !(base_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(base_2.p);
}
		if (path_2.p && !(path_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(path_2.p);
}
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqsink___stdZprivateZospaths2_u312)(tyTuple__UV3llMMYFckfui8YMBuUZA* dest_p0, tyTuple__UV3llMMYFckfui8YMBuUZA* src_p1) {
	if ((*dest_p0).Field0.p != (*src_p1).Field0.p) {	if ((*dest_p0).Field0.p && !((*dest_p0).Field0.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Field0.p);
}
	}
(*dest_p0).Field0.len = (*src_p1).Field0.len; (*dest_p0).Field0.p = (*src_p1).Field0.p;
	if ((*dest_p0).Field1.p != (*src_p1).Field1.p) {	if ((*dest_p0).Field1.p && !((*dest_p0).Field1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Field1.p);
}
	}
(*dest_p0).Field1.len = (*src_p1).Field1.len; (*dest_p0).Field1.p = (*src_p1).Field1.p;
}
N_LIB_PRIVATE N_NIMCALL(NI, searchExtPos__stdZprivateZospaths2_u242)(NimStringV2 path_p0) {
	NI result;
	NI i_1;
{	result = ((NI)-1);
	i_1 = (path_p0.len-1);
	{
		while (1) {
			NI TM__O1zDbSYyG8zQytyoZAh0dg_57;
			if (!(((NI)1) <= i_1)) goto LA2;
			{
				if (i_1 < 0 || i_1 >= path_p0.len){ raiseIndexError2(i_1,path_p0.len-1); goto BeforeRet_;
				}
				if (!((NU8)(path_p0.p->data[i_1]) == (NU8)(46))) goto LA5_;
				goto LA1;
			}
			goto LA3_;
LA5_: ;
			{
				if (i_1 < 0 || i_1 >= path_p0.len){ raiseIndexError2(i_1,path_p0.len-1); goto BeforeRet_;
				}
				if (!(((NU8)(path_p0.p->data[i_1])) == ((NU8)(47)) || ((NU8)(path_p0.p->data[i_1])) == ((NU8)(47)))) goto LA8_;
				result = ((NI)-1);
				goto BeforeRet_;
			}
			goto LA3_;
LA8_: ;
LA3_: ;
			if (nimSubInt(i_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_57)) { raiseOverflow(); goto BeforeRet_;
			};
			i_1 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_57);
		} LA2: ;
	} LA1: ;
	{
		NI j_1;
		NI colontmp_;
		NI TM__O1zDbSYyG8zQytyoZAh0dg_58;
		NI res_1;
		j_1 = (NI)0;
		colontmp_ = (NI)0;
		if (nimSubInt(i_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_58)) { raiseOverflow(); goto BeforeRet_;
		};
		colontmp_ = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_58);
		res_1 = colontmp_;
		{
			while (1) {
				NI TM__O1zDbSYyG8zQytyoZAh0dg_59;
				if (!(((NI)0) <= res_1)) goto LA12;
				j_1 = ((NI) (res_1));
				{
					if (j_1 < 0 || j_1 >= path_p0.len){ raiseIndexError2(j_1,path_p0.len-1); goto BeforeRet_;
					}
					if (!(((NU8)(path_p0.p->data[j_1])) == ((NU8)(47)) || ((NU8)(path_p0.p->data[j_1])) == ((NU8)(47)))) goto LA15_;
					result = ((NI)-1);
					goto BeforeRet_;
				}
				goto LA13_;
LA15_: ;
				{
					if (j_1 < 0 || j_1 >= path_p0.len){ raiseIndexError2(j_1,path_p0.len-1); goto BeforeRet_;
					}
					if (!!(((NU8)(path_p0.p->data[j_1]) == (NU8)(46)))) goto LA18_;
					result = i_1;
					goto LA10;
				}
				goto LA13_;
LA18_: ;
LA13_: ;
				if (nimSubInt(res_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_59)) { raiseOverflow(); goto BeforeRet_;
				};
				res_1 = (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_59);
			} LA12: ;
		}
	} LA10: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, appendChar)(NimStringV2* dest_p0, NIM_CHAR c_p1) {
	(*(*dest_p0).p).data[(*dest_p0).len] = c_p1;
	(*dest_p0).len += ((NI)1);
	(*(*dest_p0).p).data[(*dest_p0).len] = 0;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normExt__stdZprivateZospaths2_u239)(NimStringV2 ext_p0) {
	NimStringV2 result;
{	result.len = 0; result.p = NIM_NIL;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (ext_p0.len == 0);
		if (T3_) goto LA4_;
		if (((NI)0) < 0 || ((NI)0) >= ext_p0.len){ raiseIndexError2(((NI)0),ext_p0.len-1); goto BeforeRet_;
		}
		T3_ = ((NU8)(ext_p0.p->data[((NI)0)]) == (NU8)(46));
LA4_: ;
		if (!T3_) goto LA5_;
		eqcopy___system_u2754((&result), ext_p0);
	}
	goto LA1_;
LA5_: ;
	{
		NimStringV2 T8_;
		T8_.len = 0; T8_.p = NIM_NIL;
		T8_ = rawNewString(ext_p0.len + 1);
appendChar((&T8_), 46);
appendString((&T8_), ext_p0);
		result = T8_;
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, noschangeFileExt)(NimStringV2 filename_p0, NimStringV2 ext_p1) {
	NimStringV2 result;
	NI extPos_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	extPos_1 = searchExtPos__stdZprivateZospaths2_u242(filename_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		NimStringV2 colontmpD_;
		NimStringV2 T5_;
		if (!(extPos_1 < ((NI)0))) goto LA3_;
		colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
		T5_.len = 0; T5_.p = NIM_NIL;
		colontmpD_ = normExt__stdZprivateZospaths2_u239(ext_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T5_ = rawNewString(filename_p0.len + colontmpD_.len + 0);
appendString((&T5_), filename_p0);
appendString((&T5_), colontmpD_);
		result = T5_;
		if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
	}
	goto LA1_;
LA3_: ;
	{
		NimStringV2 colontmpD__2;
		NimStringV2 colontmpD__3;
		NimStringV2 T7_;
		NI TM__O1zDbSYyG8zQytyoZAh0dg_60;
		colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
		colontmpD__3.len = 0; colontmpD__3.p = NIM_NIL;
		T7_.len = 0; T7_.p = NIM_NIL;
		if (nimSubInt(extPos_1, ((NI)1), &TM__O1zDbSYyG8zQytyoZAh0dg_60)) { raiseOverflow(); goto BeforeRet_;
		};
		colontmpD__2 = substr__system_u9096(filename_p0, ((NI)0), (NI)(TM__O1zDbSYyG8zQytyoZAh0dg_60));
		colontmpD__3 = normExt__stdZprivateZospaths2_u239(ext_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T7_ = rawNewString(colontmpD__2.len + colontmpD__3.len + 0);
appendString((&T7_), colontmpD__2);
appendString((&T7_), colontmpD__3);
		result = T7_;
		if (colontmpD__3.p && !(colontmpD__3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__3.p);
}
		if (colontmpD__2.p && !(colontmpD__2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__2.p);
}
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosaddFileExt)(NimStringV2 filename_p0, NimStringV2 ext_p1) {
	NimStringV2 result;
	NI extPos_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	extPos_1 = searchExtPos__stdZprivateZospaths2_u242(filename_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		NimStringV2 colontmpD_;
		NimStringV2 T5_;
		if (!(extPos_1 < ((NI)0))) goto LA3_;
		colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
		T5_.len = 0; T5_.p = NIM_NIL;
		colontmpD_ = normExt__stdZprivateZospaths2_u239(ext_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T5_ = rawNewString(filename_p0.len + colontmpD_.len + 0);
appendString((&T5_), filename_p0);
appendString((&T5_), colontmpD_);
		result = T5_;
		if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
	}
	goto LA1_;
LA3_: ;
	{
		eqcopy___system_u2754((&result), filename_p0);
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
