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

#include "nimbase.h"
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <time.h>
#include <math.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/param.h>
#include <mach-o/dyld.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 tyTuple__7q7q3E6Oj24ZNVJb9aonhAg tyTuple__7q7q3E6Oj24ZNVJb9aonhAg;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct Exception Exception;
typedef struct RootObj RootObj;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ tySequence__3EvzHGO0xyXGnJBUggwfKQ;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content;
typedef struct tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw;
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
typedef NU8 tySet_tyChar__nmiMWKVIe46vacnhAFrQvw[32];
struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg {
	NimStringV2 Field0;
	NimStringV2 Field1;
	NimStringV2 Field2;
};
typedef NimStringV2 tyArray__JskADhex1tJGrspppmc1LA[24];
typedef NimStringV2 tyArray__YgExxhfgKcesA5EOUj1MOA[1];
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_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw {
	NCSTRING procname;
	NI line;
	NCSTRING filename;
};
struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content { NI cap; tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw data[SEQ_DECL_SIZE]; };
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__stdZoserrors_u119)(NI32 errorCode_p0, NimStringV2 additionalInfo_p1);
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__stdZoserrors_u122)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqsink___system_u2760)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, cstrToNimstr)(NCSTRING str_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nospquoteShellPosix)(NimStringV2 s_p0);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, allCharsInSet__pureZstrutils_u1569)(NimStringV2 s_p0, tySet_tyChar__nmiMWKVIe46vacnhAFrQvw theSet_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___system_u2754)(NimStringV2* dest_p0, NimStringV2 src_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(NimStringV2, nsuReplaceStr)(NimStringV2 s_p0, NimStringV2 sub_p1, NimStringV2 by_p2);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, rawNewString)(NI space_p0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__pureZos_u180)(int status_p0);
static N_INLINE(NIM_BOOL, nimAddInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
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);
static N_INLINE(NIM_BOOL, nimMulInt)(NI a_p0, NI b_p1, NI* res_p2);
static N_INLINE(NF, toFloat__system_u1705)(NI i_p0);
static N_INLINE(NF, abs__system_u5188)(NF x_p0);
N_LIB_PRIVATE N_NIMCALL(void, nossplitFile)(NimStringV2 path_p0, tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* Result);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
static N_INLINE(NIM_CHAR, X5BX5D___system_u8519)(NimStringV2 s_p0, NI i_p1);
static N_INLINE(NIM_BOOL, nimSubInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NIMCALL(NI, nsuFindCharSet)(NimStringV2 s_p0, tySet_tyChar__nmiMWKVIe46vacnhAFrQvw chars_p1, NI start_p2, NI last_p3);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZos_u217)(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* dest_p0);
N_LIB_PRIVATE N_NIMCALL(NI, nsuCmpIgnoreCase)(NimStringV2 a_p0, NimStringV2 b_p1);
static N_INLINE(NIM_BOOL, contains__stdZprivateZospaths2_u380)(NIM_CHAR* a_p0, NI a_p0Len_0, NIM_CHAR item_p1);
static N_INLINE(NI, find__stdZprivateZospaths2_u385)(NIM_CHAR* a_p0, NI a_p0Len_0, NIM_CHAR item_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosaddFileExt)(NimStringV2 filename_p0, NimStringV2 ext_p1);
static N_INLINE(void, eqdestroy___system_u281)(NimStringV2 x_p0);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileExists)(NimStringV2 filename_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, getEnv__stdZenvvars_u15)(NimStringV2 key_p0, NimStringV2 default_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, substr__system_u9096)(NimStringV2 s_p0, NI first_p1, NI last_p2);
static N_INLINE(NimStringV2, slash___stdZprivateZospaths2_u88)(NimStringV2 head_p0, NimStringV2 tail_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosjoinPath)(NimStringV2 head_p0, NimStringV2 tail_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, expandTilde__pureZos_u32)(NimStringV2 path_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetHomeDir)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, substr__system_u9109)(NimStringV2 s_p0, NI first_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nossymlinkExists)(NimStringV2 link_p0);
N_NIMCALL(NimStringV2, mnewString)(NI len_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i_p0, NI64 a_p1, NI64 b_p2);
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s_p0, NI newLen_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringV2 path_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___system_u2751)(NimStringV2* dest_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosparentDir)(NimStringV2 path_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetAppFilename)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosexpandFilename)(NimStringV2 filename_p0);
static N_INLINE(NIM_BOOL, isObjDisplayCheck)(TNimTypeV2* source_p0, NI16 targetDepth_p1, NU32 token_p2);
static N_INLINE(Exception*, nimBorrowCurrentException)(void);
static N_INLINE(void, popCurrentException)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___system_u3719)(Exception** dest_p0, Exception* src_p1, NIM_BOOL cyclic_p2);
static const struct {
  NI cap; NIM_CHAR data[0+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_2 = { 0 | NIM_STRLIT_FLAG, "" };
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_3 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_2};
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_4 = { 2 | NIM_STRLIT_FLAG, "\'\'" };
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_5 = {2, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_4};
static NIM_CONST tySet_tyChar__nmiMWKVIe46vacnhAFrQvw TM__yu6cxgKBBXbNsTkT9cyMd4g_6 = {
0x00, 0x00, 0x00, 0x00, 0x20, 0xe8, 0xff, 0x27,
0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
;
static const struct {
  NI cap; NIM_CHAR data[1+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_7 = { 1 | NIM_STRLIT_FLAG, "\'" };
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_8 = {1, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_7};
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_9 = {1, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_7};
static const struct {
  NI cap; NIM_CHAR data[5+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_10 = { 5 | NIM_STRLIT_FLAG, "\'\"\'\"\'" };
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_11 = {5, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_10};
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_12 = {1, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_7};
static NIM_CONST tySet_tyChar__nmiMWKVIe46vacnhAFrQvw TM__yu6cxgKBBXbNsTkT9cyMd4g_18 = {
0x01, 0x00, 0x00, 0x00, 0x04, 0x84, 0x00, 0xd4,
0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
;
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_19 = { 3 | NIM_STRLIT_FLAG, "CON" };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_20 = { 3 | NIM_STRLIT_FLAG, "PRN" };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_21 = { 3 | NIM_STRLIT_FLAG, "AUX" };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_22 = { 3 | NIM_STRLIT_FLAG, "NUL" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_23 = { 4 | NIM_STRLIT_FLAG, "COM0" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_24 = { 4 | NIM_STRLIT_FLAG, "COM1" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_25 = { 4 | NIM_STRLIT_FLAG, "COM2" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_26 = { 4 | NIM_STRLIT_FLAG, "COM3" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_27 = { 4 | NIM_STRLIT_FLAG, "COM4" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_28 = { 4 | NIM_STRLIT_FLAG, "COM5" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_29 = { 4 | NIM_STRLIT_FLAG, "COM6" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_30 = { 4 | NIM_STRLIT_FLAG, "COM7" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_31 = { 4 | NIM_STRLIT_FLAG, "COM8" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_32 = { 4 | NIM_STRLIT_FLAG, "COM9" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_33 = { 4 | NIM_STRLIT_FLAG, "LPT0" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_34 = { 4 | NIM_STRLIT_FLAG, "LPT1" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_35 = { 4 | NIM_STRLIT_FLAG, "LPT2" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_36 = { 4 | NIM_STRLIT_FLAG, "LPT3" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_37 = { 4 | NIM_STRLIT_FLAG, "LPT4" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_38 = { 4 | NIM_STRLIT_FLAG, "LPT5" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_39 = { 4 | NIM_STRLIT_FLAG, "LPT6" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_40 = { 4 | NIM_STRLIT_FLAG, "LPT7" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_41 = { 4 | NIM_STRLIT_FLAG, "LPT8" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_42 = { 4 | NIM_STRLIT_FLAG, "LPT9" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__yu6cxgKBBXbNsTkT9cyMd4g_44 = { 4 | NIM_STRLIT_FLAG, "PATH" };
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_45 = {4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_44};
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_46 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_2};
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_52 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_2};
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_53 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_2};
static const NimStringV2 TM__yu6cxgKBBXbNsTkT9cyMd4g_54 = {0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_2};
N_LIB_PRIVATE NIM_CONST tyArray__JskADhex1tJGrspppmc1LA invalidFilenames__pureZos_u21 = {{3, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_19},
{3, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_20},
{3, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_21},
{3, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_22},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_23},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_24},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_25},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_26},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_27},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_28},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_29},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_30},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_31},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_32},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_33},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_34},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_35},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_36},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_37},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_38},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_39},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_40},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_41},
{4, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_42}}
;
N_LIB_PRIVATE NIM_CONST tyArray__YgExxhfgKcesA5EOUj1MOA ExeExts__pureZos_u72 = {{0, (NimStrPayload*)&TM__yu6cxgKBBXbNsTkT9cyMd4g_2}}
;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4198;
extern NIM_THREADVAR Exception* currException__system_u3686;
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, nosexpandFilename)(NimStringV2 filename_p0) {
	NimStringV2 result;
	NCSTRING r_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = TM__yu6cxgKBBXbNsTkT9cyMd4g_3;
	r_1 = realpath(nimToCStringConv(filename_p0), ((NCSTRING) NIM_NIL));
	{
		NI32 T5_;
		if (!(r_1 == 0)) goto LA3_;
		T5_ = (NI32)0;
		T5_ = osLastError__stdZoserrors_u122();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		raiseOSError__stdZoserrors_u119(T5_, filename_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA1_;
LA3_: ;
	{
		NimStringV2 T7_;
		T7_.len = 0; T7_.p = NIM_NIL;
		T7_ = cstrToNimstr(r_1);
		eqsink___system_u2760((&result), T7_);
		free(((void*) (r_1)));
	}
LA1_: ;
	}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(NimStringV2, nospquoteShellPosix)(NimStringV2 s_p0) {
	NimStringV2 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	{
		if (!(s_p0.len == ((NI)0))) goto LA3_;
		result = TM__yu6cxgKBBXbNsTkT9cyMd4g_5;
	}
	goto LA1_;
LA3_: ;
	{
		NIM_BOOL T6_;
		T6_ = (NIM_BOOL)0;
		T6_ = allCharsInSet__pureZstrutils_u1569(s_p0, TM__yu6cxgKBBXbNsTkT9cyMd4g_6);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!T6_) goto LA7_;
		eqcopy___system_u2754((&result), s_p0);
	}
	goto LA1_;
LA7_: ;
	{
		NimStringV2 colontmpD_;
		NimStringV2 T10_;
		colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
		T10_.len = 0; T10_.p = NIM_NIL;
		colontmpD_ = nsuReplaceStr(s_p0, TM__yu6cxgKBBXbNsTkT9cyMd4g_9, TM__yu6cxgKBBXbNsTkT9cyMd4g_11);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T10_ = rawNewString(colontmpD_.len + 2);
appendString((&T10_), TM__yu6cxgKBBXbNsTkT9cyMd4g_8);
appendString((&T10_), colontmpD_);
appendString((&T10_), TM__yu6cxgKBBXbNsTkT9cyMd4g_12);
		result = T10_;
		if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nospquoteShell)(NimStringV2 s_p0) {
	NimStringV2 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	result = nospquoteShellPosix(s_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}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;
}
N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__pureZos_u180)(int status_p0) {
	int result;
	NI32 colontmpD_;
	int colontmpD__2;
{	result = (int)0;
	colontmpD_ = (NI32)0;
	colontmpD__2 = (int)0;
	{
		NIM_BOOL T3_;
		int T6_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_13;
		T3_ = (NIM_BOOL)0;
		T3_ = WIFSIGNALED(status_p0);
		if (!T3_) goto LA4_;
		T6_ = (int)0;
		T6_ = WTERMSIG(status_p0);
		if (nimAddInt(((NI32)128), T6_, &TM__yu6cxgKBBXbNsTkT9cyMd4g_13)) { raiseOverflow(); goto BeforeRet_;
		};
		if (TM__yu6cxgKBBXbNsTkT9cyMd4g_13 < (-2147483647 -1) || TM__yu6cxgKBBXbNsTkT9cyMd4g_13 > 2147483647){ raiseOverflow(); goto BeforeRet_;
		}
		colontmpD_ = (NI32)(TM__yu6cxgKBBXbNsTkT9cyMd4g_13);
		result = colontmpD_;
	}
	goto LA1_;
LA4_: ;
	{
		colontmpD__2 = WEXITSTATUS(status_p0);
		result = colontmpD__2;
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, nosexecShellCmd)(NimStringV2 command_p0) {
	NI result;
	int T1_;
	int T2_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	T1_ = (int)0;
	T1_ = system(nimToCStringConv(command_p0));
	T2_ = (int)0;
	T2_ = exitStatusLikeShell__pureZos_u180(T1_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	result = ((NI) (T2_));
	}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);
}
static N_INLINE(NF, toFloat__system_u1705)(NI i_p0) {
	NF result;
	result = ((NF) (i_p0));
	return result;
}
static N_INLINE(NF, abs__system_u5188)(NF x_p0) {
	NF result;
	result = (NF)0;
	result = fabs(x_p0);
	return result;
}
static N_INLINE(NIM_BOOL, nimMulInt)(NI a_p0, NI b_p1, NI* res_p2) {
	NIM_BOOL result;
	NI r_1;
	NF floatProd_1;
	NF T1_;
	NF T2_;
	NF resAsFloat_1;
	result = (NIM_BOOL)0;
	r_1 = ((NI) ((NU)((NU64)(((NU) (a_p0))) * (NU64)(((NU) (b_p1))))));
	T1_ = (NF)0;
	T1_ = toFloat__system_u1705(a_p0);
	T2_ = (NF)0;
	T2_ = toFloat__system_u1705(b_p1);
	floatProd_1 = ((NF)(T1_) * (NF)(T2_));
	resAsFloat_1 = toFloat__system_u1705(r_1);
	{
		if (!(resAsFloat_1 == floatProd_1)) goto LA5_;
		(*res_p2) = r_1;
	}
	goto LA3_;
LA5_: ;
	{
		{
			NF T10_;
			NF T11_;
			T10_ = (NF)0;
			T10_ = abs__system_u5188(((NF)(resAsFloat_1) - (NF)(floatProd_1)));
			T11_ = (NF)0;
			T11_ = abs__system_u5188(floatProd_1);
			if (!(((NF)(32.0) * (NF)(T10_)) <= T11_)) goto LA12_;
			(*res_p2) = r_1;
		}
		goto LA8_;
LA12_: ;
		{
			result = NIM_TRUE;
		}
LA8_: ;
	}
LA3_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs_p0) {
	struct timespec a_1;
	struct timespec b_1;
	NI TM__yu6cxgKBBXbNsTkT9cyMd4g_14;
	NI TM__yu6cxgKBBXbNsTkT9cyMd4g_15;
	int T1_;
{	nimZeroMem((void*)(&a_1), sizeof(struct timespec));
	nimZeroMem((void*)(&b_1), sizeof(struct timespec));
	a_1.tv_sec = ((time_t) ((NI)((milsecs_p0) / (((NI)1000)))));
	if (nimMulInt((NI)((milsecs_p0) % (((NI)1000))), ((NI)1000), &TM__yu6cxgKBBXbNsTkT9cyMd4g_14)) { raiseOverflow(); goto BeforeRet_;
	};
	if (nimMulInt((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_14), ((NI)1000), &TM__yu6cxgKBBXbNsTkT9cyMd4g_15)) { raiseOverflow(); goto BeforeRet_;
	};
	a_1.tv_nsec = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_15);
	T1_ = (int)0;
	T1_ = nanosleep((&a_1), (&b_1));
	(void)(T1_);
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NI64, nosgetFileSize)(NimStringV2 file_p0) {
	NI64 result;
	struct stat rawInfo_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI64)0;
	nimZeroMem((void*)(&rawInfo_1), sizeof(struct stat));
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = stat(nimToCStringConv(file_p0), (&rawInfo_1));
		if (!(T3_ < ((NI32)0))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__stdZoserrors_u122();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		raiseOSError__stdZoserrors_u119(T6_, file_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA4_: ;
	result = rawInfo_1.st_size;
	}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;
}
static N_INLINE(NIM_CHAR, X5BX5D___system_u8519)(NimStringV2 s_p0, NI i_p1) {
	NIM_CHAR result;
	NI TM__yu6cxgKBBXbNsTkT9cyMd4g_17;
{	result = (NIM_CHAR)0;
	if (nimSubInt(s_p0.len, i_p1, &TM__yu6cxgKBBXbNsTkT9cyMd4g_17)) { raiseOverflow(); goto BeforeRet_;
	};
	if ((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_17) < 0 || (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_17) >= s_p0.len){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_17),s_p0.len-1); goto BeforeRet_;
	}
	result = s_p0.p->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_17)];
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isValidFilename__pureZos_u505)(NimStringV2 filename_p0, NI maxLen_p1) {
	NIM_BOOL result;
	tyTuple__7q7q3E6Oj24ZNVJb9aonhAg f_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	nimZeroMem((void*)(&f_1), sizeof(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg));
	result = NIM_TRUE;
	nossplitFile(filename_p0, (&f_1));
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	{
		NIM_BOOL T4_;
		NIM_BOOL T5_;
		NIM_BOOL T6_;
		NIM_BOOL T7_;
		NIM_BOOL T8_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_16;
		NIM_CHAR T12_;
		NIM_CHAR T14_;
		NI T16_;
		NIM_BOOL T17_;
		T4_ = (NIM_BOOL)0;
		T5_ = (NIM_BOOL)0;
		T6_ = (NIM_BOOL)0;
		T7_ = (NIM_BOOL)0;
		T8_ = (NIM_BOOL)0;
		if (nimAddInt(f_1.Field1.len, f_1.Field2.len, &TM__yu6cxgKBBXbNsTkT9cyMd4g_16)) { raiseOverflow(); goto LA1_;
		};
		T8_ = (maxLen_p1 < (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_16));
		if (T8_) goto LA9_;
		T8_ = (f_1.Field1.len == ((NI)0));
LA9_: ;
		T7_ = T8_;
		if (T7_) goto LA10_;
		if (((NI)0) < 0 || ((NI)0) >= f_1.Field1.len){ raiseIndexError2(((NI)0),f_1.Field1.len-1); goto LA1_;
		}
		T7_ = ((NU8)(f_1.Field1.p->data[((NI)0)]) == (NU8)(32));
LA10_: ;
		T6_ = T7_;
		if (T6_) goto LA11_;
		T12_ = (NIM_CHAR)0;
		T12_ = X5BX5D___system_u8519(f_1.Field1, ((NI)1));
		if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
		T6_ = ((NU8)(T12_) == (NU8)(32));
LA11_: ;
		T5_ = T6_;
		if (T5_) goto LA13_;
		T14_ = (NIM_CHAR)0;
		T14_ = X5BX5D___system_u8519(f_1.Field1, ((NI)1));
		if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
		T5_ = ((NU8)(T14_) == (NU8)(46));
LA13_: ;
		T4_ = T5_;
		if (T4_) goto LA15_;
		T16_ = (NI)0;
		T16_ = nsuFindCharSet(f_1.Field1, TM__yu6cxgKBBXbNsTkT9cyMd4g_18, ((NI)0), ((NI)-1));
		if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
		T4_ = !((T16_ == ((NI)-1)));
LA15_: ;
		T17_ = (NIM_BOOL)0;
		T17_ = NIM_UNLIKELY(T4_);
		if (!T17_) goto LA18_;
		result = NIM_FALSE;
		eqdestroy___pureZos_u217((&f_1));
		goto BeforeRet_;
	}
LA18_: ;
	{
		NimStringV2 invalid_1;
		NI i_1;
		invalid_1.len = 0; invalid_1.p = NIM_NIL;
		i_1 = ((NI)0);
		{
			while (1) {
				invalid_1 = invalidFilenames__pureZos_u21[(i_1)- 0];
				{
					NI T25_;
					T25_ = (NI)0;
					T25_ = nsuCmpIgnoreCase(f_1.Field1, invalid_1);
					if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
					if (!(T25_ == ((NI)0))) goto LA26_;
					result = NIM_FALSE;
					eqdestroy___pureZos_u217((&f_1));
					goto BeforeRet_;
				}
LA26_: ;
				{
					if (!(((NI)23) <= i_1)) goto LA30_;
					goto LA21;
				}
LA30_: ;
				i_1 += ((NI)1);
			}
		} LA21: ;
	}
	{
		LA1_:;
	}
	{
		eqdestroy___pureZos_u217((&f_1));
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NI, find__stdZprivateZospaths2_u385)(NIM_CHAR* a_p0, NI a_p0Len_0, NIM_CHAR item_p1) {
	NI result;
{	result = ((NI)0);
	{
		NIM_CHAR i_1;
		NI i_2;
		i_1 = (NIM_CHAR)0;
		i_2 = ((NI)0);
		{
			while (1) {
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_43;
				if (!(i_2 < a_p0Len_0)) goto LA3;
				if (i_2 < 0 || i_2 >= a_p0Len_0){ raiseIndexError2(i_2,a_p0Len_0-1); goto BeforeRet_;
				}
				i_1 = a_p0[i_2];
				{
					if (!((NU8)(i_1) == (NU8)(item_p1))) goto LA6_;
					goto BeforeRet_;
				}
LA6_: ;
				if (nimAddInt(result, ((NI)1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_43)) { raiseOverflow(); goto BeforeRet_;
				};
				result = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_43);
				i_2 += ((NI)1);
			} LA3: ;
		}
	}
	result = ((NI)-1);
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_BOOL, contains__stdZprivateZospaths2_u380)(NIM_CHAR* a_p0, NI a_p0Len_0, NIM_CHAR item_p1) {
	NIM_BOOL result;
	NI T1_;
{	T1_ = (NI)0;
	T1_ = find__stdZprivateZospaths2_u385(a_p0, a_p0Len_0, item_p1);
	result = (((NI)0) <= T1_);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, eqdestroy___system_u281)(NimStringV2 x_p0) {
}
static N_INLINE(NimStringV2, slash___stdZprivateZospaths2_u88)(NimStringV2 head_p0, NimStringV2 tail_p1) {
	NimStringV2 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	result = nosjoinPath(head_p0, tail_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, expandTilde__pureZos_u32)(NimStringV2 path_p0) {
	NimStringV2 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (path_p0.len == ((NI)0));
		if (T3_) goto LA4_;
		if (((NI)0) < 0 || ((NI)0) >= path_p0.len){ raiseIndexError2(((NI)0),path_p0.len-1); goto BeforeRet_;
		}
		T3_ = !(((NU8)(path_p0.p->data[((NI)0)]) == (NU8)(126)));
LA4_: ;
		if (!T3_) goto LA5_;
		eqcopy___system_u2754((&result), path_p0);
	}
	goto LA1_;
LA5_: ;
	{
		if (!(path_p0.len == ((NI)1))) goto LA8_;
		result = nosgetHomeDir();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA1_;
LA8_: ;
	{
		NimStringV2 colontmpD_;
		NimStringV2 colontmpD__2;
		if (((NI)1) < 0 || ((NI)1) >= path_p0.len){ raiseIndexError2(((NI)1),path_p0.len-1); goto BeforeRet_;
		}
		if (!(((NU8)(path_p0.p->data[((NI)1)])) == ((NU8)(47)) || ((NU8)(path_p0.p->data[((NI)1)])) == ((NU8)(47)))) goto LA11_;
		colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
		colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
		colontmpD_ = nosgetHomeDir();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		colontmpD__2 = substr__system_u9109(path_p0, ((NI)2));
		result = slash___stdZprivateZospaths2_u88(colontmpD_, colontmpD__2);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (colontmpD__2.p && !(colontmpD__2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__2.p);
}
		if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
	}
	goto LA1_;
LA11_: ;
	{
		eqcopy___system_u2754((&result), path_p0);
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, findExe__pureZos_u73)(NimStringV2 exe_p0, NIM_BOOL followSymlinks_p1, NimStringV2* extensions_p2, NI extensions_p2Len_0) {
	NimStringV2 result;
	NimStringV2 path_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	path_1.len = 0; path_1.p = NIM_NIL;
	{
		if (!(exe_p0.len == ((NI)0))) goto LA4_;
		if (path_1.p && !(path_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(path_1.p);
}
		goto BeforeRet_;
	}
LA4_: ;
	{
		NIM_BOOL T8_;
		T8_ = (NIM_BOOL)0;
		T8_ = contains__stdZprivateZospaths2_u380(((exe_p0).p) ? (exe_p0.p->data) : NIM_NIL, exe_p0.len, 47);
		if (!T8_) goto LA9_;
		{
			NimStringV2* extX60gensym9__1;
			NI i_1;
			extX60gensym9__1 = (NimStringV2*)0;
			i_1 = ((NI)0);
			{
				while (1) {
					NimStringV2 T14_;
					if (!(i_1 < extensions_p2Len_0)) goto LA13;
					if (i_1 < 0 || i_1 >= extensions_p2Len_0){ raiseIndexError2(i_1,extensions_p2Len_0-1); goto LA1_;
					}
					extX60gensym9__1 = (&extensions_p2[i_1]);
					T14_.len = 0; T14_.p = NIM_NIL;
					T14_ = nosaddFileExt(exe_p0, (*extX60gensym9__1));
					if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T14_); goto LA1_;}
					eqsink___system_u2760((&result), T14_);
					{
						NIM_BOOL T17_;
						T17_ = (NIM_BOOL)0;
						T17_ = nosfileExists(result);
						if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
						if (!T17_) goto LA18_;
						if (path_1.p && !(path_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(path_1.p);
}
						goto BeforeRet_;
					}
LA18_: ;
					i_1 += ((NI)1);
				} LA13: ;
			}
		}
	}
LA9_: ;
	path_1 = getEnv__stdZenvvars_u15(TM__yu6cxgKBBXbNsTkT9cyMd4g_45, TM__yu6cxgKBBXbNsTkT9cyMd4g_46);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	{
		NimStringV2 candidate_1;
		NI lastX60gensym34__1;
		NI splitsX60gensym34__1;
		candidate_1.len = 0; candidate_1.p = NIM_NIL;
		lastX60gensym34__1 = ((NI)0);
		splitsX60gensym34__1 = ((NI)-1);
		{
			while (1) {
				NI firstX60gensym34__1;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_48;
				NimStringV2 T32_;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_50;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_51;
				if (!(lastX60gensym34__1 <= path_1.len)) goto LA23;
				firstX60gensym34__1 = lastX60gensym34__1;
				{
					while (1) {
						NIM_BOOL T26_;
						NI TM__yu6cxgKBBXbNsTkT9cyMd4g_47;
						T26_ = (NIM_BOOL)0;
						T26_ = (lastX60gensym34__1 < path_1.len);
						if (!(T26_)) goto LA27_;
						if (lastX60gensym34__1 < 0 || lastX60gensym34__1 >= path_1.len){ raiseIndexError2(lastX60gensym34__1,path_1.len-1); goto LA21_;
						}
						T26_ = !(((NU8)(path_1.p->data[lastX60gensym34__1]) == (NU8)(58)));
LA27_: ;
						if (!T26_) goto LA25;
						if (nimAddInt(lastX60gensym34__1, ((NI)1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_47)) { raiseOverflow(); goto LA21_;
						};
						lastX60gensym34__1 = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_47);
					} LA25: ;
				}
				{
					if (!(splitsX60gensym34__1 == ((NI)0))) goto LA30_;
					lastX60gensym34__1 = path_1.len;
				}
LA30_: ;
				if (nimSubInt(lastX60gensym34__1, ((NI)1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_48)) { raiseOverflow(); goto LA21_;
				};
				T32_.len = 0; T32_.p = NIM_NIL;
				T32_ = substr__system_u9096(path_1, firstX60gensym34__1, (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_48));
				eqsink___system_u2760((&candidate_1), T32_);
				{
					NimStringV2 x_1;
					NimStringV2 colontmpD_;
					x_1.len = 0; x_1.p = NIM_NIL;
					colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
					{
						if (!(candidate_1.len == ((NI)0))) goto LA37_;
						if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
						if (x_1.p && !(x_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(x_1.p);
}
						goto LA33;
					}
LA37_: ;
					colontmpD_ = expandTilde__pureZos_u32(candidate_1);
					if (NIM_UNLIKELY(*nimErr_)) goto LA34_;
					x_1 = slash___stdZprivateZospaths2_u88(colontmpD_, exe_p0);
					if (NIM_UNLIKELY(*nimErr_)) goto LA34_;
					{
						NimStringV2* ext_1;
						NI i_2;
						ext_1 = (NimStringV2*)0;
						i_2 = ((NI)0);
						{
							while (1) {
								NimStringV2 x_2;
								if (!(i_2 < extensions_p2Len_0)) goto LA41;
								x_2.len = 0; x_2.p = NIM_NIL;
								if (i_2 < 0 || i_2 >= extensions_p2Len_0){ raiseIndexError2(i_2,extensions_p2Len_0-1); goto LA42_;
								}
								ext_1 = (&extensions_p2[i_2]);
								x_2 = nosaddFileExt(x_1, (*ext_1));
								if (NIM_UNLIKELY(*nimErr_)) goto LA42_;
								{
									NIM_BOOL T45_;
									T45_ = (NIM_BOOL)0;
									T45_ = nosfileExists(x_2);
									if (NIM_UNLIKELY(*nimErr_)) goto LA42_;
									if (!T45_) goto LA46_;
									{
										while (1) {
											if (!followSymlinks_p1) goto LA49;
											{
												NIM_BOOL T52_;
												NimStringV2 r_1;
												NI len_1;
												T52_ = (NIM_BOOL)0;
												T52_ = nossymlinkExists(x_2);
												if (NIM_UNLIKELY(*nimErr_)) goto LA42_;
												if (!T52_) goto LA53_;
												r_1.len = 0; r_1.p = NIM_NIL;
												r_1 = mnewString(((NI)1024));
												len_1 = readlink(nimToCStringConv(x_2), nimToCStringConv(r_1), ((NI)1024));
												{
													NI32 T60_;
													if (!(len_1 < ((NI)0))) goto LA58_;
													T60_ = (NI32)0;
													T60_ = osLastError__stdZoserrors_u122();
													if (NIM_UNLIKELY(*nimErr_)) goto LA55_;
													raiseOSError__stdZoserrors_u119(T60_, exe_p0);
													if (NIM_UNLIKELY(*nimErr_)) goto LA55_;
												}
LA58_: ;
												{
													NI TM__yu6cxgKBBXbNsTkT9cyMd4g_49;
													NimStringV2 T65_;
													if (!(((NI)1024) < len_1)) goto LA63_;
													if (nimAddInt(len_1, ((NI)1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_49)) { raiseOverflow(); goto LA55_;
													};
													if (((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_49)) < ((NI)0) || ((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_49)) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_49), ((NI)0), ((NI)IL64(9223372036854775807))); goto LA55_;
													}
													T65_.len = 0; T65_.p = NIM_NIL;
													T65_ = mnewString(((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_49)));
													eqsink___system_u2760((&r_1), T65_);
													len_1 = readlink(nimToCStringConv(x_2), nimToCStringConv(r_1), len_1);
												}
LA63_: ;
												if ((len_1) < ((NI)0) || (len_1) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(len_1, ((NI)0), ((NI)IL64(9223372036854775807))); goto LA55_;
												}
												setLengthStrV2((&r_1), (len_1));
												{
													NIM_BOOL T68_;
													T68_ = (NIM_BOOL)0;
													T68_ = nosisAbsolute(r_1);
													if (NIM_UNLIKELY(*nimErr_)) goto LA55_;
													if (!T68_) goto LA69_;
													eqsink___system_u2760((&x_2), r_1);
													eqwasMoved___system_u2751((&r_1));
												}
												goto LA66_;
LA69_: ;
												{
													NimStringV2 colontmpD__2;
													NimStringV2 T72_;
													colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
													colontmpD__2 = nosparentDir(x_2);
													if (NIM_UNLIKELY(*nimErr_)) goto LA55_;
													T72_.len = 0; T72_.p = NIM_NIL;
													T72_ = slash___stdZprivateZospaths2_u88(colontmpD__2, r_1);
													if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T72_); goto LA55_;}
													eqsink___system_u2760((&x_2), T72_);
													if (colontmpD__2.p && !(colontmpD__2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__2.p);
}
												}
LA66_: ;
												{
													LA55_:;
												}
												{
													if (r_1.p && !(r_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(r_1.p);
}
												}
												if (NIM_UNLIKELY(*nimErr_)) goto LA42_;
											}
											goto LA50_;
LA53_: ;
											{
												goto LA48;
											}
LA50_: ;
										} LA49: ;
									} LA48: ;
									result = x_2;
									eqwasMoved___system_u2751((&x_2));
									if (x_2.p && !(x_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(x_2.p);
}
									if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
									if (x_1.p && !(x_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(x_1.p);
}
									if (candidate_1.p && !(candidate_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(candidate_1.p);
}
									if (path_1.p && !(path_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(path_1.p);
}
									goto BeforeRet_;
								}
LA46_: ;
								i_2 += ((NI)1);
								{
									LA42_:;
								}
								{
									if (x_2.p && !(x_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(x_2.p);
}
								}
								if (NIM_UNLIKELY(*nimErr_)) goto LA34_;
							} LA41: ;
						}
					}
					{
						LA34_:;
					}
					{
						if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
						if (x_1.p && !(x_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(x_1.p);
}
					}
					if (NIM_UNLIKELY(*nimErr_)) goto LA21_;
				} LA33: ;
				{
					if (!(splitsX60gensym34__1 == ((NI)0))) goto LA82_;
					goto LA22;
				}
LA82_: ;
				if (nimSubInt(splitsX60gensym34__1, ((NI)1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_50)) { raiseOverflow(); goto LA21_;
				};
				splitsX60gensym34__1 = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_50);
				if (nimAddInt(lastX60gensym34__1, ((NI)1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_51)) { raiseOverflow(); goto LA21_;
				};
				lastX60gensym34__1 = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_51);
			} LA23: ;
		} LA22: ;
		{
			LA21_:;
		}
		{
			if (candidate_1.p && !(candidate_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(candidate_1.p);
}
		}
		if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	}
	result = TM__yu6cxgKBBXbNsTkT9cyMd4g_52;
	{
		LA1_:;
	}
	{
		if (path_1.p && !(path_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(path_1.p);
}
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_BOOL, isObjDisplayCheck)(TNimTypeV2* source_p0, NI16 targetDepth_p1, NU32 token_p2) {
	NIM_BOOL result;
	NIM_BOOL T1_;
	T1_ = (NIM_BOOL)0;
	T1_ = (targetDepth_p1 <= (*source_p0).depth);
	if (!(T1_)) goto LA2_;
	T1_ = ((*source_p0).display[targetDepth_p1] == token_p2);
LA2_: ;
	result = T1_;
	return result;
}
static N_INLINE(Exception*, nimBorrowCurrentException)(void) {
	Exception* result;
	result = currException__system_u3686;
	return result;
}
static N_INLINE(void, popCurrentException)(void) {
	eqcopy___system_u3719(&currException__system_u3686, (*currException__system_u3686).up, NIM_FALSE);
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetAppFilename)(void) {
	NimStringV2 result;
	unsigned int size_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	size_1 = ((NI)0);
	_NSGetExecutablePath(((NCSTRING) NIM_NIL), (&size_1));
	if ((((NI) (size_1))) < ((NI)0) || (((NI) (size_1))) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(((NI) (size_1)), ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
	}
	result = mnewString((((NI) (size_1))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = _NSGetExecutablePath(nimToCStringConv(result), (&size_1));
		if (!T3_) goto LA4_;
		eqsink___system_u2760((&result), TM__yu6cxgKBBXbNsTkT9cyMd4g_53);
	}
LA4_: ;
	{
		NimStringV2 T11_;
		if (!(((NI)0) < result.len)) goto LA8_;
		T11_.len = 0; T11_.p = NIM_NIL;
		T11_ = nosexpandFilename(result);
		if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T11_); goto LA10_;}
		eqsink___system_u2760((&result), T11_);
		if (NIM_UNLIKELY(*nimErr_)) {
			LA10_:;
			if (isObjDisplayCheck(nimBorrowCurrentException()->Sup.m_type, 3, 1079566592)) {
				*nimErr_ = NIM_FALSE;
				eqsink___system_u2760((&result), TM__yu6cxgKBBXbNsTkT9cyMd4g_54);
				popCurrentException();
				LA13_:;
			}
		}
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA8_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetAppDir)(void) {
	NimStringV2 result;
	tyTuple__7q7q3E6Oj24ZNVJb9aonhAg colontmpD_;
	NimStringV2 colontmpD__2;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	nimZeroMem((void*)(&colontmpD_), sizeof(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg));
	colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
	colontmpD__2 = nosgetAppFilename();
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	nossplitFile(colontmpD__2, (&colontmpD_));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	result = colontmpD_.Field0;
	eqwasMoved___system_u2751((&colontmpD_.Field0));
	if (colontmpD__2.p && !(colontmpD__2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__2.p);
}
	eqdestroy___pureZos_u217((&colontmpD_));
	}BeforeRet_: ;
	return result;
}
