/* Generated by Nim Compiler v1.6.10 */
#define NIM_INTBITS 64

#include "nimbase.h"
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <stdlib.h>
#include <sys/types.h>
                                      #include <sys/sysctl.h>
#include <sys/wait.h>
#include <dirent.h>
#include <setjmp.h>
#include <stdio.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ tySequence__sM4lkSb7zS6F7OVMvW9cffQ;
typedef struct TGenericSeq TGenericSeq;
typedef struct NimStringDesc NimStringDesc;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
typedef struct tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ;
typedef struct tyObject_Defect__LbeSGvgPzGzXnW9caIkJqMA tyObject_Defect__LbeSGvgPzGzXnW9caIkJqMA;
typedef struct Exception Exception;
typedef struct RootObj RootObj;
typedef struct tySequence__uB9b75OUPRENsBAu4AnoePA tySequence__uB9b75OUPRENsBAu4AnoePA;
typedef struct tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
typedef struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg tyTuple__7q7q3E6Oj24ZNVJb9aonhAg;
typedef struct tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw;
typedef struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA;
typedef struct tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA;
typedef struct tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg;
typedef struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ;
typedef struct tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw;
typedef struct TSafePoint TSafePoint;
typedef struct tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q;
typedef struct tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA;
typedef struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SPr7N6UKfuF549bNPiUvSRw[256];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SPr7N6UKfuF549bNPiUvSRw freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
NI gcThreadId;
};
struct RootObj {
TNimType* m_type;
};
struct Exception {
  RootObj Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
tySequence__uB9b75OUPRENsBAu4AnoePA* trace;
Exception* up;
};
struct tyObject_Defect__LbeSGvgPzGzXnW9caIkJqMA {
  Exception Sup;
};
struct tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ {
  tyObject_Defect__LbeSGvgPzGzXnW9caIkJqMA Sup;
};
typedef NU8 tySet_tyChar__nmiMWKVIe46vacnhAFrQvw[32];
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA {
  Exception Sup;
};
struct tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw {
  tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
};
struct tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA {
  tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
NI32 errorCode;
};
struct tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg {
NI i;
NI prev;
NIM_BOOL notFirst;
};
struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ {
NI Field0;
NI Field1;
};
typedef int tyArray__VR9bNthWayFgb5M9avIR8bkA[4];
typedef NU8 tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg;
struct tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw {
  tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
};
typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1];
struct TSafePoint {
TSafePoint* prev;
NI status;
jmp_buf context;
};
typedef NIM_CHAR tyArray__dTlC27m9c9aWd5dvuePYanug[256];
typedef NU8 tySet_tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA;
typedef NU8 tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA;
typedef NU8 tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg;
struct tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q {
NI64 seconds;
NI nanosecond;
};
typedef NU16 tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA;
typedef NU8 tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA;
struct tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA {
NimStringDesc* Field0;
tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA Field1;
};
struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA {
NCSTRING procname;
NI line;
NCSTRING filename;
};
struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
struct tySequence__uB9b75OUPRENsBAu4AnoePA {
  TGenericSeq Sup;
  tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA data[SEQ_DECL_SIZE];
};
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newLen);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_LIB_PRIVATE N_NIMCALL(TGenericSeq*, incrSeqV3)(TGenericSeq* s, TNimType* typ);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(void, decRef__system_5316)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, minuspercent___system_716)(NI x, NI y);
static N_INLINE(NIM_BOOL, ltpercent___system_1005)(NI x, NI y);
static N_INLINE(void, rtlAddZCT__system_5314)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__system_5265)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__system_5271)(void* usr);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str);
N_LIB_PRIVATE N_NOINLINE(void*, newObj)(TNimType* typ, NI size);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, copyMem__system_1727)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___systemZdollars_3)(NI x);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incRef__system_5309)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, pluspercent___system_696)(NI x, NI y);
N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e, NCSTRING ename, NCSTRING procname, NCSTRING filename, NI line);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShellPosix)(NimStringDesc* s);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, allCharsInSet__pureZstrutils_1341)(NimStringDesc* s, tySet_tyChar__nmiMWKVIe46vacnhAFrQvw theSet);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nsuReplaceStr)(NimStringDesc* s, NimStringDesc* sub, NimStringDesc* by);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShell)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_LIB_PRIVATE N_NIMCALL(void, joinPathImpl__pureZos_82)(NimStringDesc** result, NI* state, NimStringDesc* tail);
static N_INLINE(NIM_CHAR, X5BX5D___system_7329)(NimStringDesc* s, NI i);
static N_INLINE(NIM_CHAR*, X5BX5D___system_7362)(NimStringDesc** s, NI i);
N_LIB_PRIVATE N_NIMCALL(void, normalizePathEnd__pureZos_51)(NimStringDesc** path, NIM_BOOL trailingSep);
N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_LIB_PRIVATE N_NIMCALL(void, addNormalizePath__pureZpathnorm_71)(NimStringDesc* x, NimStringDesc** result, NI* state, NIM_CHAR dirSep);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normalizePathEnd__pureZos_71)(NimStringDesc* path, NIM_BOOL trailingSep);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosextractFilename)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(void, nossplitPath)(NimStringDesc* path, tyTuple__UV3llMMYFckfui8YMBuUZA* Result);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__system_7744)(NimStringDesc* s, NI first, NI last);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__system_7756)(NimStringDesc* s, NI first);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normalizePath__pureZpathnorm_127)(NimStringDesc* path, NIM_CHAR dirSep);
N_LIB_PRIVATE N_NIMCALL(NI, cmp__system_1549)(NimStringDesc* x, NimStringDesc* y);
N_LIB_PRIVATE N_NIMCALL(NI, nsuCmpIgnoreCase)(NimStringDesc* a, NimStringDesc* b);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosrelativePath)(NimStringDesc* path, NimStringDesc* base, NIM_CHAR sep);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
static N_INLINE(NIM_BOOL, equalMem__system_1735)(void* a, void* b, NI size);
static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size);
static N_INLINE(void, normalizePathAux__pureZos_31)(NimStringDesc** path);
N_LIB_PRIVATE N_NIMCALL(void, nosnormalizePath)(NimStringDesc** path);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, absolutePathInternal__pureZos_49)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, absolutePath__pureZos_733)(NimStringDesc* path, NimStringDesc* root);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
static N_INLINE(NIM_BOOL, eqeq___system_7724)(NCSTRING x, NCSTRING y);
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s);
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__pureZos_408)(void);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__systemZassertions_56)(NimStringDesc* msg);
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__pureZos_405)(NI32 errorCode, NimStringDesc* additionalInfo);
N_LIB_PRIVATE N_NOINLINE(tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*, newOSError__pureZos_379)(NI32 errorCode, NimStringDesc* additionalInfo);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, osErrorMsg__pureZos_358)(NI32 errorCode);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasNext__pureZpathnorm_6)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg it, NimStringDesc* x);
N_LIB_PRIVATE N_NIMCALL(tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ, next__pureZpathnorm_10)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg* it, NimStringDesc* x);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix);
N_LIB_PRIVATE N_NIMCALL(NI, parentDirPos__pureZos_195)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getEnv__pureZos_418)(NimStringDesc* key, NimStringDesc* default_0);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetHomeDir)(void);
static N_INLINE(NimStringDesc*, slash___pureZos_121)(NimStringDesc* head, NimStringDesc* tail);
N_LIB_PRIVATE N_NIMCALL(void, nossplitFile)(NimStringDesc* path, tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* Result);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetAppFilename)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getApplFreebsd__pureZos_1563)(void);
static N_INLINE(NI, nimCStrLen)(NCSTRING a);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getApplHeuristic__pureZos_1600)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, paramStr__pureZos_1529)(NI i);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileExists)(NimStringDesc* filename);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosexistsOrCreateDir)(NimStringDesc* dir);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, rawCreateDir__pureZos_1409)(NimStringDesc* dir);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosdirExists)(NimStringDesc* dir);
N_LIB_PRIVATE N_NIMCALL(NI, searchExtPos__pureZos_271)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normExt__pureZos_268)(NimStringDesc* ext);
static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___pureZos_429)(tyTuple__UV3llMMYFckfui8YMBuUZA x);
static N_INLINE(NIM_BOOL, contains__pureZos_651)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item);
static N_INLINE(NI, find__pureZos_656)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, expandTilde__pureZos_576)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nossymlinkExists)(NimStringDesc* link);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosparentDir)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nostryRemoveFile)(NimStringDesc* file);
static N_INLINE(void, pushSafePoint)(TSafePoint* s);
N_LIB_PRIVATE N_NIMCALL(tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg, getSymlinkFileKind__pureZos_1227)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(void, nosremoveFile)(NimStringDesc* file);
N_LIB_PRIVATE N_NIMCALL(void, nosremoveDir)(NimStringDesc* dir, NIM_BOOL checkDir);
static N_INLINE(void, popSafePoint)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimLeaveFinally)(void);
N_LIB_PRIVATE N_NIMCALL(void, reraiseException)(void);
N_LIB_PRIVATE N_NIMCALL(void, rawRemoveDir__pureZos_1402)(NimStringDesc* dir);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, tryMoveFSObject__pureZos_1088)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL isDir);
N_LIB_PRIVATE N_NIMCALL(void, noscopyFile)(NimStringDesc* source, NimStringDesc* dest, tySet_tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA options);
static N_INLINE(NI, countBits32)(NU32 n);
static N_INLINE(NI, countSetBitsImpl__systemZcountbits95impl_26)(NU32 x);
N_CDECL(int, __builtin_popcount)(unsigned int x);
N_LIB_PRIVATE N_NIMCALL(void, createSymlink__pureZos_1012)(NimStringDesc* src, NimStringDesc* dest);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, expandSymlink__pureZos_1018)(NimStringDesc* symlinkPath);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, open__systemZio_389)(FILE** f, NimStringDesc* filename, tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg mode, NI bufSize);
N_LIB_PRIVATE N_NIMCALL(void, close__systemZio_217)(FILE* f);
N_LIB_PRIVATE N_NOCONV(void*, allocImpl__system_1743)(NI size);
N_LIB_PRIVATE N_NIMCALL(NI, readBuffer__systemZio_144)(FILE* f, void* buffer, NI len);
N_LIB_PRIVATE N_NIMCALL(NI, writeBuffer__systemZio_176)(FILE* f, void* buffer, NI len);
N_LIB_PRIVATE N_NOCONV(void, dealloc)(void* p);
N_LIB_PRIVATE N_NIMCALL(void, flushFile__systemZio_226)(FILE* f);
static N_INLINE(void, popCurrentException)(void);
N_LIB_PRIVATE N_NIMCALL(void, noscopyDir)(NimStringDesc* source, NimStringDesc* dest);
N_LIB_PRIVATE N_NIMCALL(void, noscreateDir)(NimStringDesc* dir);
static N_INLINE(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, toTime__pureZos_17)(struct timespec ts);
N_LIB_PRIVATE N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, initTime__pureZtimes_895)(NI64 unix_0, NI nanosecond);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, ntLtTime)(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q a, tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q b);
N_LIB_PRIVATE N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, nosgetLastModificationTime)(NimStringDesc* file);
N_LIB_PRIVATE N_NIMCALL(void, nossetFilePermissions)(NimStringDesc* filename, tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA permissions, NIM_BOOL followSymlinks);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___pureZos_871)(tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA x);
N_LIB_PRIVATE N_NIMCALL(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA, nosgetFilePermissions)(NimStringDesc* filename);
N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__pureZos_1101)(int status);
extern TNimType NTIseqLstringT__sM4lkSb7zS6F7OVMvW9cffQ_;
extern TNimType NTIrefindexdefect__RJnHOb9cQV3neNC9cDkRgMyw_;
extern TNimType NTIindexdefect__n6tGEPHKkh7E1AP9bj30WrQ_;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_2, "index out of bounds, the container is empty", 43);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_3, "index ", 6);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_4, " not in 0 .. ", 13);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_5, "\'\'", 2);
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}
;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_7, "\'", 1);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_8, "\'\"\'\"\'", 5);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_9, " ", 1);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_10, "/", 1);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_11, ".", 1);
extern TNimType NTIrefvalueerror__Ie1m0dv1ZHg72IgPRr1cDw_;
extern TNimType NTIvalueerror__yoNlBGx0D2tRizIdhQuENw_;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_12, "The specified root is not absolute: ", 36);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_13, "os.nim(1417, 21) `bufsize >= 0` ", 32);
extern TNimType NTIrefoserror__9clYsYwyjCqe2PFTuCI3Ubg_;
extern TNimType NTIoserror__BeJgrOdDsczOwEWOZbRfKA_;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_14, "Additional info: ", 17);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_15, "unknown OS error", 16);
static NIM_CONST tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ TM__yu6cxgKBBXbNsTkT9cyMd4g_16 = {((NI) 0),
((NI) -1)}
;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_17, "..", 2);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_18, "HOME", 4);
static NIM_CONST tyArray__VR9bNthWayFgb5M9avIR8bkA TM__yu6cxgKBBXbNsTkT9cyMd4g_19 = {((int) 1),
((int) 14),
((int) 12),
((int) -1)}
;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_20, "PATH", 4);
extern TNimType NTIrefioerror__HMIVdYjdZYWskTmTQVo5BQ_;
extern TNimType NTIioerror__iLZrPn9anoh9ad1MmO0RczFw_;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_21, "Failed to create \'", 18);
N_LIB_PRIVATE NIM_CONST tyArray__nHXaesL0DJZHyVS07ARPRA ExeExts__pureZos_643 = {((NimStringDesc*) NIM_NIL)}
;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_23, "os.nim(1851, 12) `card(copyFlagSymlink * options) == 1` There should be exactly one cfSymlink* in options", 105);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_26, "XDG_CONFIG_HOME", 15);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_27, ".config", 7);
N_LIB_PRIVATE TNimType NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_;
extern NCSTRING* environ;
extern int cmdCount;
extern NCSTRING* cmdLine;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__system_5218;
extern TSafePoint* excHandler__system_2565;
extern TSafePoint* excHandler__system_2565;
extern TSafePoint* excHandler__system_2565;
extern TSafePoint* excHandler__system_2565;
extern Exception* currException__system_2566;
extern Exception* currException__system_2566;
static N_INLINE(NI, minuspercent___system_716)(NI x, NI y) {
	NI result;
	result = (NI)0;
	result = ((NI) ((NU)((NU64)(((NU) (x))) - (NU64)(((NU) (y))))));
	return result;
}
static N_INLINE(NIM_BOOL, ltpercent___system_1005)(NI x, NI y) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = ((NU64)(((NU) (x))) < (NU64)(((NU) (y))));
	return result;
}
static N_INLINE(void, rtlAddZCT__system_5314)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	addZCT__system_5265((&gch__system_5218.zct), c);
}
static N_INLINE(void, decRef__system_5316)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = minuspercent___system_716((*c).refcount, ((NI) 8));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = ltpercent___system_1005((*c).refcount, ((NI) 8));
		if (!T3_) goto LA4_;
		rtlAddZCT__system_5314(c);
	}
	LA4_: ;
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__system_5271)(void* usr) {
	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
	NI T1_;
	result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
	T1_ = (NI)0;
	T1_ = minuspercent___system_716(((NI) (ptrdiff_t) (usr)), ((NI) 16));
	result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) (T1_));
	return result;
}
static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T1_;
	T1_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
	T1_ = usrToCell__system_5271(p);
	decRef__system_5316(T1_);
}
N_LIB_PRIVATE N_NIMCALL(tySequence__sM4lkSb7zS6F7OVMvW9cffQ*, nosparseCmdLine)(NimStringDesc* c) {
	tySequence__sM4lkSb7zS6F7OVMvW9cffQ* result;
	NI i;
	NimStringDesc* a;
	result = NIM_NIL;
	result = NIM_NIL;
	i = ((NI) 0);
	a = ((NimStringDesc*) NIM_NIL);
	{
		while (1) {
			NI T25_;
			NimStringDesc* T26_;
			a = setLengthStr(a, ((NI) 0));
			{
				while (1) {
					NIM_BOOL T5_;
					T5_ = (NIM_BOOL)0;
					T5_ = (i < (c ? c->Sup.len : 0));
					if (!(T5_)) goto LA6_;
					T5_ = (((NU8)(c->data[i])) == ((NU8)(32)) || ((NU8)(c->data[i])) == ((NU8)(9)) || ((NU8)(c->data[i])) == ((NU8)(10)) || ((NU8)(c->data[i])) == ((NU8)(13)));
					LA6_: ;
					if (!T5_) goto LA4;
					i += ((NI) 1);
				} LA4: ;
			}
			{
				if (!((c ? c->Sup.len : 0) <= i)) goto LA9_;
				goto LA1;
			}
			LA9_: ;
			switch (((NU8)(c->data[i]))) {
			case 39:
			case 34:
			{
				NIM_CHAR delim;
				delim = c->data[i];
				i += ((NI) 1);
				{
					while (1) {
						NIM_BOOL T14_;
						T14_ = (NIM_BOOL)0;
						T14_ = (i < (c ? c->Sup.len : 0));
						if (!(T14_)) goto LA15_;
						T14_ = !(((NU8)(c->data[i]) == (NU8)(delim)));
						LA15_: ;
						if (!T14_) goto LA13;
						a = addChar(a, c->data[i]);
						i += ((NI) 1);
					} LA13: ;
				}
				{
					if (!(i < (c ? c->Sup.len : 0))) goto LA18_;
					i += ((NI) 1);
				}
				LA18_: ;
			}
			break;
			default:
			{
				{
					while (1) {
						NIM_BOOL T23_;
						T23_ = (NIM_BOOL)0;
						T23_ = (i < (c ? c->Sup.len : 0));
						if (!(T23_)) goto LA24_;
						T23_ = ((NU8)(32) < (NU8)(c->data[i]));
						LA24_: ;
						if (!T23_) goto LA22;
						a = addChar(a, c->data[i]);
						i += ((NI) 1);
					} LA22: ;
				}
			}
			break;
			}
			result = (tySequence__sM4lkSb7zS6F7OVMvW9cffQ*) incrSeqV3((TGenericSeq*)(result), (&NTIseqLstringT__sM4lkSb7zS6F7OVMvW9cffQ_));
			T25_ = result->Sup.len++;
			T26_ = NIM_NIL;
			T26_ = result->data[T25_]; result->data[T25_] = copyStringRC1(a);
			if (T26_) nimGCunrefNoCycle(T26_);
		}
	} LA1: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, paramCount__pureZos_1535)(void) {
	NI result;
	result = (NI)0;
	result = ((NI) ((NI32)(cmdCount - ((NI32) 1))));
	return result;
}
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}
static N_INLINE(void, copyMem__system_1727)(void* dest, void* source, NI size) {
	nimCopyMem(dest, source, size);
}
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	{
		if (!!((src == ((NimStringDesc*) NIM_NIL)))) goto LA3_;
		copyMem__system_1727(((void*) ((&(*dest).data[(*dest).Sup.len]))), ((void*) ((*src).data)), ((NI) ((NI)((*src).Sup.len + ((NI) 1)))));
		(*dest).Sup.len += (*src).Sup.len;
	}
	LA3_: ;
}
static N_INLINE(NI, pluspercent___system_696)(NI x, NI y) {
	NI result;
	result = (NI)0;
	result = ((NI) ((NU)((NU64)(((NU) (x))) + (NU64)(((NU) (y))))));
	return result;
}
static N_INLINE(void, incRef__system_5309)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = pluspercent___system_696((*c).refcount, ((NI) 8));
}
static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T5_;
		if (!!((src == NIM_NIL))) goto LA3_;
		T5_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
		T5_ = usrToCell__system_5271(src);
		incRef__system_5309(T5_);
	}
	LA3_: ;
	{
		tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T10_;
		if (!!(((*dest) == NIM_NIL))) goto LA8_;
		T10_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
		T10_ = usrToCell__system_5271((*dest));
		decRef__system_5316(T10_);
	}
	LA8_: ;
	(*dest) = src;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, paramStr__pureZos_1529)(NI i) {
	NimStringDesc* result;
	result = NIM_NIL;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (i < ((NI) (cmdCount)));
		if (!(T3_)) goto LA4_;
		T3_ = (((NI) 0) <= i);
		LA4_: ;
		if (!T3_) goto LA5_;
		result = cstrToNimstr(cmdLine[i]);
	}
	goto LA1_;
	LA5_: ;
	{
		tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ* T8_;
		T8_ = NIM_NIL;
		T8_ = (tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ*) newObj((&NTIrefindexdefect__RJnHOb9cQV3neNC9cDkRgMyw_), sizeof(tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ));
		(*T8_).Sup.Sup.Sup.m_type = (&NTIindexdefect__n6tGEPHKkh7E1AP9bj30WrQ_);
		(*T8_).Sup.Sup.name = "IndexDefect";
		{
			NimStringDesc* T13_;
			if (!((NI32)(cmdCount - ((NI32) 1)) < ((NI32) 0))) goto LA11_;
			T13_ = NIM_NIL;
			T13_ = (*T8_).Sup.Sup.message; (*T8_).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_2));
			if (T13_) nimGCunrefNoCycle(T13_);
		}
		goto LA9_;
		LA11_: ;
		{
			NimStringDesc* T15_;
			NimStringDesc* T16_;
			NimStringDesc* T17_;
			T15_ = NIM_NIL;
			T16_ = NIM_NIL;
			T16_ = dollar___systemZdollars_3(i);
			T17_ = NIM_NIL;
			T17_ = dollar___systemZdollars_3(((NI) ((NI32)(cmdCount - ((NI32) 1)))));
			T15_ = rawNewString((T16_ ? T16_->Sup.len : 0) + (T17_ ? T17_->Sup.len : 0) + 19);
appendString(T15_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_3));
appendString(T15_, T16_);
appendString(T15_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_4));
appendString(T15_, T17_);
			asgnRef((void**) (&(*T8_).Sup.Sup.message), T15_);
		}
		LA9_: ;
		asgnRef((void**) (&(*T8_).Sup.Sup.parent), ((Exception*) NIM_NIL));
		raiseExceptionEx((Exception*)T8_, "IndexDefect", "paramStr", "os.nim", 2965);
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShellPosix)(NimStringDesc* s) {
	NimStringDesc* result;
	result = NIM_NIL;
	{
		if (!((s ? s->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = copyString(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_5));
	}
	goto LA1_;
	LA3_: ;
	{
		NIM_BOOL T6_;
		T6_ = (NIM_BOOL)0;
		T6_ = allCharsInSet__pureZstrutils_1341(s, TM__yu6cxgKBBXbNsTkT9cyMd4g_6);
		if (!T6_) goto LA7_;
		result = copyString(s);
	}
	goto LA1_;
	LA7_: ;
	{
		NimStringDesc* T10_;
		NimStringDesc* T11_;
		T10_ = NIM_NIL;
		T11_ = NIM_NIL;
		T11_ = nsuReplaceStr(s, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_7), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_8));
		T10_ = rawNewString((T11_ ? T11_->Sup.len : 0) + 2);
appendString(T10_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_7));
appendString(T10_, T11_);
appendString(T10_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_7));
		result = T10_;
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShell)(NimStringDesc* s) {
	NimStringDesc* result;
	result = NIM_NIL;
	result = nospquoteShellPosix(s);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive) {
	NimStringDesc* result;
	result = NIM_NIL;
	result = copyString(path);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, quoteShellCommand__pureZos_601)(NimStringDesc** args, NI argsLen_0) {
	NimStringDesc* result;
	result = NIM_NIL;
	result = ((NimStringDesc*) NIM_NIL);
	{
		NI i;
		NI colontmp_;
		NI i_2;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = argsLen_0;
		i_2 = ((NI) 0);
		{
			while (1) {
				NimStringDesc* T8_;
				if (!(i_2 < colontmp_)) goto LA3;
				i = i_2;
				{
					if (!(((NI) 0) < i)) goto LA6_;
					result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_9));
				}
				LA6_: ;
				T8_ = NIM_NIL;
				T8_ = nospquoteShell(args[i]);
				result = resizeString(result, (T8_ ? T8_->Sup.len : 0) + 0);
appendString(result, T8_);
				i_2 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}
static N_INLINE(NIM_CHAR, X5BX5D___system_7329)(NimStringDesc* s, NI i) {
	NIM_CHAR result;
	result = (NIM_CHAR)0;
	result = s->data[(NI)((s ? s->Sup.len : 0) - i)];
	return result;
}
static N_INLINE(NIM_CHAR*, X5BX5D___system_7362)(NimStringDesc** s, NI i) {
	NIM_CHAR* result;
	result = (NIM_CHAR*)0;
	result = (&(*s)->data[(NI)(((*s) ? (*s)->Sup.len : 0) - i)]);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, normalizePathEnd__pureZos_51)(NimStringDesc** path, NIM_BOOL trailingSep) {
	NI i;
{	{
		if (!(((*path) ? (*path)->Sup.len : 0) == ((NI) 0))) goto LA3_;
		goto BeforeRet_;
	}
	LA3_: ;
	i = ((*path) ? (*path)->Sup.len : 0);
	{
		while (1) {
			if (!(((NI) 1) <= i)) goto LA6;
			{
				if (!(((NU8)((*path)->data[(NI)(i - ((NI) 1))])) == ((NU8)(47)) || ((NU8)((*path)->data[(NI)(i - ((NI) 1))])) == ((NU8)(47)))) goto LA9_;
				i -= ((NI) 1);
			}
			goto LA7_;
			LA9_: ;
			{
				NIM_BOOL T12_;
				NIM_BOOL T13_;
				T12_ = (NIM_BOOL)0;
				T13_ = (NIM_BOOL)0;
				T13_ = ((NU8)((*path)->data[(NI)(i - ((NI) 1))]) == (NU8)(46));
				if (!(T13_)) goto LA14_;
				T13_ = (((NI) 2) <= i);
				LA14_: ;
				T12_ = T13_;
				if (!(T12_)) goto LA15_;
				T12_ = (((NU8)((*path)->data[(NI)(i - ((NI) 2))])) == ((NU8)(47)) || ((NU8)((*path)->data[(NI)(i - ((NI) 2))])) == ((NU8)(47)));
				LA15_: ;
				if (!T12_) goto LA16_;
				i -= ((NI) 1);
			}
			goto LA7_;
			LA16_: ;
			{
				goto LA5;
			}
			LA7_: ;
		} LA6: ;
	} LA5: ;
	{
		if (!trailingSep) goto LA21_;
		unsureAsgnRef((void**) (&(*path)), setLengthStr((*path), ((NI) (i))));
		unsureAsgnRef((void**) (&(*path)), addChar((*path), 47));
	}
	goto LA19_;
	LA21_: ;
	{
		if (!(((NI) 0) < i)) goto LA24_;
		unsureAsgnRef((void**) (&(*path)), setLengthStr((*path), ((NI) (i))));
	}
	goto LA19_;
	LA24_: ;
	{
		unsureAsgnRef((void**) (&(*path)), copyString(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_10)));
	}
	LA19_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, joinPathImpl__pureZos_82)(NimStringDesc** result, NI* state, NimStringDesc* tail) {
	NIM_BOOL trailingSep;
	NIM_BOOL T1_;
	NIM_BOOL T2_;
	NIM_CHAR T4_;
	NIM_BOOL T6_;
	NIM_BOOL T8_;
	NIM_CHAR* T10_;
	T1_ = (NIM_BOOL)0;
	T2_ = (NIM_BOOL)0;
	T2_ = (((NI) 0) < (tail ? tail->Sup.len : 0));
	if (!(T2_)) goto LA3_;
	T4_ = (NIM_CHAR)0;
	T4_ = X5BX5D___system_7329(tail, ((NI) 1));
	T2_ = (((NU8)(T4_)) == ((NU8)(47)) || ((NU8)(T4_)) == ((NU8)(47)));
	LA3_: ;
	T1_ = T2_;
	if (T1_) goto LA5_;
	T6_ = (NIM_BOOL)0;
	T6_ = ((tail ? tail->Sup.len : 0) == ((NI) 0));
	if (!(T6_)) goto LA7_;
	T8_ = (NIM_BOOL)0;
	T8_ = (((NI) 0) < ((*result) ? (*result)->Sup.len : 0));
	if (!(T8_)) goto LA9_;
	T10_ = (NIM_CHAR*)0;
	T10_ = X5BX5D___system_7362(result, ((NI) 1));
	T8_ = (((NU8)((*T10_))) == ((NU8)(47)) || ((NU8)((*T10_))) == ((NU8)(47)));
	LA9_: ;
	T6_ = T8_;
	LA7_: ;
	T1_ = T6_;
	LA5_: ;
	trailingSep = T1_;
	normalizePathEnd__pureZos_51(result, NIM_FALSE);
	addNormalizePath__pureZpathnorm_71(tail, result, state, 47);
	normalizePathEnd__pureZos_51(result, trailingSep);
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail) {
	NimStringDesc* result;
	NI state;
	result = NIM_NIL;
	result = rawNewString(((NI) ((NI)((head ? head->Sup.len : 0) + (tail ? tail->Sup.len : 0)))));
	state = ((NI) 0);
	joinPathImpl__pureZos_82((&result), (&state), head);
	joinPathImpl__pureZos_82((&result), (&state), tail);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normalizePathEnd__pureZos_71)(NimStringDesc* path, NIM_BOOL trailingSep) {
	NimStringDesc* result;
	result = NIM_NIL;
	result = copyString(path);
	normalizePathEnd__pureZos_51((&result), trailingSep);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nossplitPath)(NimStringDesc* path, tyTuple__UV3llMMYFckfui8YMBuUZA* Result) {
	NI sepPos;
	unsureAsgnRef((void**)&(*Result).Field0, NIM_NIL);
	unsureAsgnRef((void**)&(*Result).Field1, NIM_NIL);
	sepPos = ((NI) -1);
	{
		NI i;
		NI colontmp_;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = (NI)((path ? path->Sup.len : 0) - ((NI) 1));
		res = colontmp_;
		{
			while (1) {
				if (!(((NI) 0) <= res)) goto LA3;
				i = res;
				{
					if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA6_;
					sepPos = i;
					goto LA1;
				}
				LA6_: ;
				res -= ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
	{
		NI T12_;
		if (!(((NI) 0) <= sepPos)) goto LA10_;
		T12_ = (NI)0;
		{
			NIM_BOOL T15_;
			T15_ = (NIM_BOOL)0;
			T15_ = NIM_LIKELY((((NI) 1) <= sepPos));
			if (!T15_) goto LA16_;
			T12_ = (NI)(sepPos - ((NI) 1));
		}
		goto LA13_;
		LA16_: ;
		{
			T12_ = ((NI) 0);
		}
		LA13_: ;
		unsureAsgnRef((void**) (&(*Result).Field0), substr__system_7744(path, ((NI) 0), T12_));
		unsureAsgnRef((void**) (&(*Result).Field1), substr__system_7756(path, (NI)(sepPos + ((NI) 1))));
	}
	goto LA8_;
	LA10_: ;
	{
		unsureAsgnRef((void**) (&(*Result).Field0), ((NimStringDesc*) NIM_NIL));
		unsureAsgnRef((void**) (&(*Result).Field1), copyString(path));
	}
	LA8_: ;
}
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
	nimSetMem__systemZmemory_7(p, ((int) 0), size);
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosextractFilename)(NimStringDesc* path) {
	NimStringDesc* result;
	result = NIM_NIL;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = ((path ? path->Sup.len : 0) == ((NI) 0));
		if (T3_) goto LA4_;
		T3_ = (((NU8)(path->data[(NI)((path ? path->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path->data[(NI)((path ? path->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)));
		LA4_: ;
		if (!T3_) goto LA5_;
		result = ((NimStringDesc*) NIM_NIL);
	}
	goto LA1_;
	LA5_: ;
	{
		tyTuple__UV3llMMYFckfui8YMBuUZA T8_;
		nimZeroMem((void*)(&T8_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
		nossplitPath(path, (&T8_));
		result = copyString(T8_.Field1);
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, noslastPathPart)(NimStringDesc* path) {
	NimStringDesc* result;
	NimStringDesc* path_2;
	result = NIM_NIL;
	path_2 = normalizePathEnd__pureZos_71(path, NIM_FALSE);
	result = nosextractFilename(path_2);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, noscmpPaths)(NimStringDesc* pathA, NimStringDesc* pathB) {
	NI result;
	NimStringDesc* a;
	NimStringDesc* b;
	result = (NI)0;
	a = normalizePath__pureZpathnorm_127(pathA, 47);
	b = normalizePath__pureZpathnorm_127(pathB, 47);
	{
		if (!NIM_TRUE) goto LA3_;
		result = cmp__system_1549(a, b);
	}
	goto LA1_;
	LA3_: ;
	{
		result = nsuCmpIgnoreCase(a, b);
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nossplitFile)(NimStringDesc* path, tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* Result) {
	NI namePos;
	NI dotPos;
	unsureAsgnRef((void**)&(*Result).Field0, NIM_NIL);
	unsureAsgnRef((void**)&(*Result).Field1, NIM_NIL);
	unsureAsgnRef((void**)&(*Result).Field2, NIM_NIL);
	namePos = ((NI) 0);
	dotPos = ((NI) 0);
	{
		NI i;
		NI colontmp_;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = (NI)((path ? path->Sup.len : 0) - ((NI) 1));
		res = colontmp_;
		{
			while (1) {
				if (!(((NI) 0) <= res)) goto LA3;
				i = res;
				{
					NIM_BOOL T6_;
					T6_ = (NIM_BOOL)0;
					T6_ = (((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)));
					if (T6_) goto LA7_;
					T6_ = (i == ((NI) 0));
					LA7_: ;
					if (!T6_) goto LA8_;
					{
						NI T14_;
						if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA12_;
						T14_ = (NI)0;
						{
							NIM_BOOL T17_;
							T17_ = (NIM_BOOL)0;
							T17_ = NIM_LIKELY((((NI) 1) <= i));
							if (!T17_) goto LA18_;
							T14_ = (NI)(i - ((NI) 1));
						}
						goto LA15_;
						LA18_: ;
						{
							T14_ = ((NI) 0);
						}
						LA15_: ;
						unsureAsgnRef((void**) (&(*Result).Field0), substr__system_7744(path, ((NI) 0), T14_));
						namePos = (NI)(i + ((NI) 1));
					}
					LA12_: ;
					{
						if (!(i < dotPos)) goto LA23_;
						unsureAsgnRef((void**) (&(*Result).Field1), substr__system_7744(path, namePos, (NI)(dotPos - ((NI) 1))));
						unsureAsgnRef((void**) (&(*Result).Field2), substr__system_7756(path, dotPos));
					}
					goto LA21_;
					LA23_: ;
					{
						unsureAsgnRef((void**) (&(*Result).Field1), substr__system_7756(path, namePos));
					}
					LA21_: ;
					goto LA1;
				}
				goto LA4_;
				LA8_: ;
				{
					NIM_BOOL T27_;
					NIM_BOOL T28_;
					NIM_BOOL T29_;
					NIM_BOOL T30_;
					NIM_BOOL T31_;
					T27_ = (NIM_BOOL)0;
					T28_ = (NIM_BOOL)0;
					T29_ = (NIM_BOOL)0;
					T30_ = (NIM_BOOL)0;
					T31_ = (NIM_BOOL)0;
					T31_ = ((NU8)(path->data[i]) == (NU8)(46));
					if (!(T31_)) goto LA32_;
					T31_ = (((NI) 0) < i);
					LA32_: ;
					T30_ = T31_;
					if (!(T30_)) goto LA33_;
					T30_ = (i < (NI)((path ? path->Sup.len : 0) - ((NI) 1)));
					LA33_: ;
					T29_ = T30_;
					if (!(T29_)) goto LA34_;
					T29_ = !((((NU8)(path->data[(NI)(i - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path->data[(NI)(i - ((NI) 1))])) == ((NU8)(47))));
					LA34_: ;
					T28_ = T29_;
					if (!(T28_)) goto LA35_;
					T28_ = !(((NU8)(path->data[(NI)(i + ((NI) 1))]) == (NU8)(46)));
					LA35_: ;
					T27_ = T28_;
					if (!(T27_)) goto LA36_;
					T27_ = (dotPos == ((NI) 0));
					LA36_: ;
					if (!T27_) goto LA37_;
					dotPos = i;
				}
				goto LA4_;
				LA37_: ;
				LA4_: ;
				res -= ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
}
static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size) {
	int result;
	result = (int)0;
	result = memcmp(a, b, ((size_t) (size)));
	return result;
}
static N_INLINE(NIM_BOOL, equalMem__system_1735)(void* a, void* b, NI size) {
	NIM_BOOL result;
	int T1_;
	result = (NIM_BOOL)0;
	T1_ = (int)0;
	T1_ = nimCmpMem(a, b, size);
	result = (T1_ == ((NI32) 0));
	return result;
}
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b) {
	NIM_BOOL result;
	NI alen;
	NI blen;
{	result = (NIM_BOOL)0;
	alen = (a ? a->Sup.len : 0);
	blen = (b ? b->Sup.len : 0);
	{
		if (!(alen == blen)) goto LA3_;
		{
			if (!(alen == ((NI) 0))) goto LA7_;
			result = NIM_TRUE;
			goto BeforeRet_;
		}
		LA7_: ;
		result = equalMem__system_1735(((void*) ((&a->data[((NI) 0)]))), ((void*) ((&b->data[((NI) 0)]))), ((NI) (alen)));
		goto BeforeRet_;
	}
	LA3_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nosnormalizePath)(NimStringDesc** path) {
	unsureAsgnRef((void**) (&(*path)), normalizePath__pureZpathnorm_127((*path), 47));
}
static N_INLINE(void, normalizePathAux__pureZos_31)(NimStringDesc** path) {
	nosnormalizePath(path);
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringDesc* path) {
	NIM_BOOL result;
{	result = (NIM_BOOL)0;
	{
		if (!((path ? path->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = NIM_FALSE;
		goto BeforeRet_;
	}
	LA3_: ;
	result = ((NU8)(path->data[((NI) 0)]) == (NU8)(47));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, absolutePath__pureZos_733)(NimStringDesc* path, NimStringDesc* root) {
	NimStringDesc* result;
	result = NIM_NIL;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nosisAbsolute(path);
		if (!T3_) goto LA4_;
		result = copyString(path);
	}
	goto LA1_;
	LA4_: ;
	{
		{
			NIM_BOOL T9_;
			tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T12_;
			NimStringDesc* T13_;
			T9_ = (NIM_BOOL)0;
			T9_ = nosisAbsolute(root);
			if (!!(T9_)) goto LA10_;
			T12_ = NIM_NIL;
			T12_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTIrefvalueerror__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
			(*T12_).Sup.Sup.Sup.m_type = (&NTIvalueerror__yoNlBGx0D2tRizIdhQuENw_);
			(*T12_).Sup.Sup.name = "ValueError";
			T13_ = NIM_NIL;
			T13_ = rawNewString((root ? root->Sup.len : 0) + 36);
appendString(T13_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_12));
appendString(T13_, root);
			asgnRef((void**) (&(*T12_).Sup.Sup.message), T13_);
			asgnRef((void**) (&(*T12_).Sup.Sup.parent), ((Exception*) NIM_NIL));
			raiseExceptionEx((Exception*)T12_, "ValueError", "absolutePath", "os.nim", 1455);
		}
		LA10_: ;
		result = nosjoinPath(root, path);
	}
	LA1_: ;
	return result;
}
static N_INLINE(NIM_BOOL, eqeq___system_7724)(NCSTRING x, NCSTRING y) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	{
		if (!(((void*) (x)) == ((void*) (y)))) goto LA3_;
		result = NIM_TRUE;
	}
	goto LA1_;
	LA3_: ;
	{
		NIM_BOOL T6_;
		T6_ = (NIM_BOOL)0;
		T6_ = (x == 0);
		if (T6_) goto LA7_;
		T6_ = (y == 0);
		LA7_: ;
		if (!T6_) goto LA8_;
		result = NIM_FALSE;
	}
	goto LA1_;
	LA8_: ;
	{
		int T11_;
		T11_ = (int)0;
		T11_ = strcmp(x, y);
		result = (T11_ == ((NI32) 0));
	}
	LA1_: ;
	return result;
}
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s) {
	NCSTRING result;
	result = (NCSTRING)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (s == ((NimStringDesc*) NIM_NIL));
		if (T3_) goto LA4_;
		T3_ = ((*s).Sup.len == ((NI) 0));
		LA4_: ;
		if (!T3_) goto LA5_;
		result = "";
	}
	goto LA1_;
	LA5_: ;
	{
		result = ((NCSTRING) ((*s).data));
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__pureZos_408)(void) {
	NI32 result;
	result = (NI32)0;
	result = errno;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, osErrorMsg__pureZos_358)(NI32 errorCode) {
	NimStringDesc* result;
	result = NIM_NIL;
	result = ((NimStringDesc*) NIM_NIL);
	{
		NCSTRING T5_;
		if (!!((errorCode == ((NI32) 0)))) goto LA3_;
		T5_ = (NCSTRING)0;
		T5_ = strerror(errorCode);
		result = cstrToNimstr(T5_);
	}
	LA3_: ;
	return result;
}
N_LIB_PRIVATE N_NOINLINE(tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*, newOSError__pureZos_379)(NI32 errorCode, NimStringDesc* additionalInfo) {
	tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA* result;
	tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA* e;
{	result = NIM_NIL;
	e = NIM_NIL;
	e = (tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*) newObj((&NTIrefoserror__9clYsYwyjCqe2PFTuCI3Ubg_), sizeof(tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA));
	(*e).Sup.Sup.Sup.m_type = (&NTIoserror__BeJgrOdDsczOwEWOZbRfKA_);
	(*e).Sup.Sup.name = "OSError";
	(*e).errorCode = errorCode;
	asgnRef((void**) (&(*e).Sup.Sup.message), osErrorMsg__pureZos_358(errorCode));
	{
		if (!(((NI) 0) < (additionalInfo ? additionalInfo->Sup.len : 0))) goto LA3_;
		{
			NIM_BOOL T7_;
			NIM_CHAR* T9_;
			T7_ = (NIM_BOOL)0;
			T7_ = (((NI) 0) < ((*e).Sup.Sup.message ? (*e).Sup.Sup.message->Sup.len : 0));
			if (!(T7_)) goto LA8_;
			T9_ = (NIM_CHAR*)0;
			T9_ = X5BX5D___system_7362((&(*e).Sup.Sup.message), ((NI) 1));
			T7_ = !(((NU8)((*T9_)) == (NU8)(10)));
			LA8_: ;
			if (!T7_) goto LA10_;
			asgnRef((void**) (&(*e).Sup.Sup.message), addChar((*e).Sup.Sup.message, 10));
		}
		LA10_: ;
		asgnRef((void**) (&(*e).Sup.Sup.message), resizeString((*e).Sup.Sup.message, 17));
appendString((*e).Sup.Sup.message, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_14));
		asgnRef((void**) (&(*e).Sup.Sup.message), resizeString((*e).Sup.Sup.message, (additionalInfo ? additionalInfo->Sup.len : 0) + 0));
appendString((*e).Sup.Sup.message, additionalInfo);
	}
	LA3_: ;
	{
		NimStringDesc* T16_;
		if (!(((*e).Sup.Sup.message ? (*e).Sup.Sup.message->Sup.len : 0) == 0)) goto LA14_;
		T16_ = NIM_NIL;
		T16_ = (*e).Sup.Sup.message; (*e).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_15));
		if (T16_) nimGCunrefNoCycle(T16_);
	}
	LA14_: ;
	result = e;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__pureZos_405)(NI32 errorCode, NimStringDesc* additionalInfo) {
	tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA* T1_;
	T1_ = NIM_NIL;
	T1_ = newOSError__pureZos_379(errorCode, additionalInfo);
	raiseExceptionEx((Exception*)T1_, "OSError", "raiseOSError", "oserr.nim", 95);
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void) {
	NimStringDesc* result;
	NI bufsize;
	result = NIM_NIL;
	bufsize = ((NI) 1024);
	result = mnewString(((NI) (bufsize)));
	{
		while (1) {
			{
				NCSTRING T5_;
				NIM_BOOL T6_;
				int T9_;
				T5_ = (NCSTRING)0;
				T5_ = getcwd(nimToCStringConv(result), bufsize);
				T6_ = (NIM_BOOL)0;
				T6_ = eqeq___system_7724(T5_, ((NCSTRING) NIM_NIL));
				if (!!(T6_)) goto LA7_;
				T9_ = (int)0;
				T9_ = strlen(nimToCStringConv(result));
				result = setLengthStr(result, ((NI) (T9_)));
				goto LA1;
			}
			goto LA3_;
			LA7_: ;
			{
				NI32 err;
				err = osLastError__pureZos_408();
				{
					if (!(err == ERANGE)) goto LA13_;
					bufsize = (NI)((NU64)(bufsize) << (NU64)(((NI) 1)));
					{
						if (!!((((NI) 0) <= bufsize))) goto LA17_;
						failedAssertImpl__systemZassertions_56(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_13));
					}
					LA17_: ;
					result = mnewString(((NI) (bufsize)));
				}
				goto LA11_;
				LA13_: ;
				{
					NI32 T20_;
					T20_ = (NI32)0;
					T20_ = osLastError__pureZos_408();
					raiseOSError__pureZos_405(T20_, ((NimStringDesc*) NIM_NIL));
				}
				LA11_: ;
			}
			LA3_: ;
		}
	} LA1: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, absolutePathInternal__pureZos_49)(NimStringDesc* path) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	result = NIM_NIL;
	T1_ = NIM_NIL;
	T1_ = nosgetCurrentDir();
	result = absolutePath__pureZos_733(path, T1_);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosrelativePath)(NimStringDesc* path, NimStringDesc* base, NIM_CHAR sep) {
	NimStringDesc* result;
	NimStringDesc* base_2;
	NimStringDesc* path_2;
	NIM_BOOL a1;
	NIM_BOOL a2;
	tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg f;
	tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg b;
	tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ ff;
	tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bb;
{	result = NIM_NIL;
	{
		if (!((path ? path->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = ((NimStringDesc*) NIM_NIL);
		goto BeforeRet_;
	}
	LA3_: ;
	{
		if (!eqStrings(base, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11))) goto LA7_;
		base_2 = ((NimStringDesc*) NIM_NIL);
	}
	goto LA5_;
	LA7_: ;
	{
		base_2 = copyString(base);
	}
	LA5_: ;
	path_2 = copyString(path);
	normalizePathAux__pureZos_31((&path_2));
	normalizePathAux__pureZos_31((&base_2));
	a1 = nosisAbsolute(path_2);
	a2 = nosisAbsolute(base_2);
	{
		NIM_BOOL T12_;
		T12_ = (NIM_BOOL)0;
		T12_ = a1;
		if (!(T12_)) goto LA13_;
		T12_ = !(a2);
		LA13_: ;
		if (!T12_) goto LA14_;
		base_2 = absolutePathInternal__pureZos_49(base_2);
	}
	goto LA10_;
	LA14_: ;
	{
		NIM_BOOL T17_;
		T17_ = (NIM_BOOL)0;
		T17_ = a2;
		if (!(T17_)) goto LA18_;
		T17_ = !(a1);
		LA18_: ;
		if (!T17_) goto LA19_;
		path_2 = absolutePathInternal__pureZos_49(path_2);
	}
	goto LA10_;
	LA19_: ;
	LA10_: ;
	nimZeroMem((void*)(&f), sizeof(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg));
	nimZeroMem((void*)(&b), sizeof(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg));
	ff = TM__yu6cxgKBBXbNsTkT9cyMd4g_16;
	bb = TM__yu6cxgKBBXbNsTkT9cyMd4g_16;
	result = rawNewString(((NI) ((path_2 ? path_2->Sup.len : 0))));
	{
		while (1) {
			NIM_BOOL T23_;
			NI diff;
			NIM_BOOL same;
			NI colontmp_;
			NI colontmp__2;
			NI colontmp__3;
			NI colontmp__4;
			T23_ = (NIM_BOOL)0;
			T23_ = hasNext__pureZpathnorm_6(f, path_2);
			if (!(T23_)) goto LA24_;
			T23_ = hasNext__pureZpathnorm_6(b, base_2);
			LA24_: ;
			if (!T23_) goto LA22;
			ff = next__pureZpathnorm_10((&f), path_2);
			bb = next__pureZpathnorm_10((&b), base_2);
			diff = (NI)(ff.Field1 - ff.Field0);
			{
				if (!!((diff == (NI)(bb.Field1 - bb.Field0)))) goto LA27_;
				goto LA21;
			}
			LA27_: ;
			same = NIM_TRUE;
			{
				NI i;
				NI res;
				i = (NI)0;
				res = ((NI) 0);
				{
					while (1) {
						if (!(res <= diff)) goto LA31;
						i = res;
						{
							if (!!(((NU8)(path_2->data[(NI)(i + ff.Field0)]) == (NU8)(base_2->data[(NI)(i + bb.Field0)])))) goto LA34_;
							same = NIM_FALSE;
							goto LA29;
						}
						LA34_: ;
						res += ((NI) 1);
					} LA31: ;
				}
			} LA29: ;
			{
				if (!!(same)) goto LA38_;
				goto LA21;
			}
			LA38_: ;
			colontmp_ = ((NI) 0);
			colontmp__2 = ((NI) -1);
			ff.Field0 = colontmp_;
			ff.Field1 = colontmp__2;
			colontmp__3 = ((NI) 0);
			colontmp__4 = ((NI) -1);
			bb.Field0 = colontmp__3;
			bb.Field1 = colontmp__4;
		} LA22: ;
	} LA21: ;
	{
		while (1) {
			{
				if (!(bb.Field0 <= bb.Field1)) goto LA44_;
				{
					NIM_BOOL T48_;
					NIM_CHAR* T50_;
					T48_ = (NIM_BOOL)0;
					T48_ = (((NI) 0) < (result ? result->Sup.len : 0));
					if (!(T48_)) goto LA49_;
					T50_ = (NIM_CHAR*)0;
					T50_ = X5BX5D___system_7362((&result), ((NI) 1));
					T48_ = !(((NU8)((*T50_)) == (NU8)(sep)));
					LA49_: ;
					if (!T48_) goto LA51_;
					result = addChar(result, sep);
				}
				LA51_: ;
				result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17));
			}
			LA44_: ;
			{
				NIM_BOOL T55_;
				T55_ = (NIM_BOOL)0;
				T55_ = hasNext__pureZpathnorm_6(b, base_2);
				if (!!(T55_)) goto LA56_;
				goto LA40;
			}
			LA56_: ;
			bb = next__pureZpathnorm_10((&b), base_2);
		}
	} LA40: ;
	{
		while (1) {
			{
				if (!(ff.Field0 <= ff.Field1)) goto LA62_;
				{
					NIM_BOOL T66_;
					NIM_CHAR* T68_;
					T66_ = (NIM_BOOL)0;
					T66_ = (((NI) 0) < (result ? result->Sup.len : 0));
					if (!(T66_)) goto LA67_;
					T68_ = (NIM_CHAR*)0;
					T68_ = X5BX5D___system_7362((&result), ((NI) 1));
					T66_ = !(((NU8)((*T68_)) == (NU8)(sep)));
					LA67_: ;
					if (!T66_) goto LA69_;
					result = addChar(result, sep);
				}
				LA69_: ;
				{
					NI i_2;
					NI colontmp__5;
					NI res_2;
					i_2 = (NI)0;
					colontmp__5 = (NI)0;
					colontmp__5 = (NI)(ff.Field1 - ff.Field0);
					res_2 = ((NI) 0);
					{
						while (1) {
							if (!(res_2 <= colontmp__5)) goto LA73;
							i_2 = res_2;
							result = addChar(result, path_2->data[(NI)(i_2 + ff.Field0)]);
							res_2 += ((NI) 1);
						} LA73: ;
					}
				}
			}
			LA62_: ;
			{
				NIM_BOOL T76_;
				T76_ = (NIM_BOOL)0;
				T76_ = hasNext__pureZpathnorm_6(f, path_2);
				if (!!(T76_)) goto LA77_;
				goto LA58;
			}
			LA77_: ;
			ff = next__pureZpathnorm_10((&f), path_2);
		}
	} LA58: ;
	{
		if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA81_;
		result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11));
	}
	LA81_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isRelativeTo__pureZos_188)(NimStringDesc* path, NimStringDesc* base) {
	NIM_BOOL result;
	NimStringDesc* path_2;
	NimStringDesc* base_2;
	NimStringDesc* ret;
	NIM_BOOL T1_;
	NIM_BOOL T3_;
	result = (NIM_BOOL)0;
	path_2 = normalizePath__pureZpathnorm_127(path, 47);
	base_2 = normalizePath__pureZpathnorm_127(base, 47);
	ret = nosrelativePath(path_2, base_2, 47);
	T1_ = (NIM_BOOL)0;
	T1_ = (((NI) 0) < (path_2 ? path_2->Sup.len : 0));
	if (!(T1_)) goto LA2_;
	T3_ = (NIM_BOOL)0;
	T3_ = nsuStartsWith(ret, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17));
	T1_ = !(T3_);
	LA2_: ;
	result = T1_;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, parentDirPos__pureZos_195)(NimStringDesc* path) {
	NI result;
	NI q;
{	result = (NI)0;
	q = ((NI) 1);
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 1) <= (path ? path->Sup.len : 0));
		if (!(T3_)) goto LA4_;
		T3_ = (((NU8)(path->data[(NI)((path ? path->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path->data[(NI)((path ? path->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)));
		LA4_: ;
		if (!T3_) goto LA5_;
		q = ((NI) 2);
	}
	LA5_: ;
	{
		NI i;
		NI colontmp_;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = (NI)((path ? path->Sup.len : 0) - q);
		res = colontmp_;
		{
			while (1) {
				if (!(((NI) 0) <= res)) goto LA9;
				i = res;
				{
					if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA12_;
					result = i;
					goto BeforeRet_;
				}
				LA12_: ;
				res -= ((NI) 1);
			} LA9: ;
		}
	}
	result = ((NI) -1);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosparentDir)(NimStringDesc* path) {
	NimStringDesc* result;
	NI sepPos;
	result = NIM_NIL;
	result = normalizePath__pureZpathnorm_127(path, 47);
	sepPos = parentDirPos__pureZos_195(result);
	{
		if (!(((NI) 0) <= sepPos)) goto LA3_;
		result = substr__system_7744(result, ((NI) 0), sepPos);
		normalizePathEnd__pureZos_51((&result), NIM_FALSE);
	}
	goto LA1_;
	LA3_: ;
	{
		NIM_BOOL T6_;
		NIM_BOOL T7_;
		NIM_BOOL T8_;
		NIM_CHAR* T12_;
		T6_ = (NIM_BOOL)0;
		T7_ = (NIM_BOOL)0;
		T8_ = (NIM_BOOL)0;
		T8_ = eqStrings(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17));
		if (T8_) goto LA9_;
		T8_ = eqStrings(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11));
		LA9_: ;
		T7_ = T8_;
		if (T7_) goto LA10_;
		T7_ = ((result ? result->Sup.len : 0) == ((NI) 0));
		LA10_: ;
		T6_ = T7_;
		if (T6_) goto LA11_;
		T12_ = (NIM_CHAR*)0;
		T12_ = X5BX5D___system_7362((&result), ((NI) 1));
		T6_ = (((NU8)((*T12_))) == ((NU8)(47)) || ((NU8)((*T12_))) == ((NU8)(47)));
		LA11_: ;
		if (!T6_) goto LA13_;
		result = ((NimStringDesc*) NIM_NIL);
	}
	goto LA1_;
	LA13_: ;
	{
		result = copyString(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11));
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileExists)(NimStringDesc* filename) {
	NIM_BOOL result;
	struct stat res;
	NIM_BOOL T1_;
	int T2_;
{	result = (NIM_BOOL)0;
	nimZeroMem((void*)(&res), sizeof(struct stat));
	T1_ = (NIM_BOOL)0;
	T2_ = (int)0;
	T2_ = stat(nimToCStringConv(filename), (&res));
	T1_ = (((NI32) 0) <= T2_);
	if (!(T1_)) goto LA3_;
	T1_ = S_ISREG(res.st_mode);
	LA3_: ;
	result = T1_;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getEnv__pureZos_418)(NimStringDesc* key, NimStringDesc* default_0) {
	NimStringDesc* result;
	NCSTRING env;
{	result = NIM_NIL;
	env = getenv(nimToCStringConv(key));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = eqeq___system_7724(env, ((NCSTRING) NIM_NIL));
		if (!T3_) goto LA4_;
		result = copyString(default_0);
		goto BeforeRet_;
	}
	LA4_: ;
	result = cstrToNimstr(env);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetHomeDir)(void) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	NimStringDesc* T2_;
{	result = NIM_NIL;
	T1_ = NIM_NIL;
	T2_ = NIM_NIL;
	T2_ = getEnv__pureZos_418(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_18), ((NimStringDesc*) NIM_NIL));
	T1_ = rawNewString((T2_ ? T2_->Sup.len : 0) + 1);
appendString(T1_, T2_);
appendString(T1_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_10));
	result = T1_;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NimStringDesc*, slash___pureZos_121)(NimStringDesc* head, NimStringDesc* tail) {
	NimStringDesc* result;
	result = NIM_NIL;
	result = nosjoinPath(head, tail);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, expandTilde__pureZos_576)(NimStringDesc* path) {
	NimStringDesc* result;
	result = NIM_NIL;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = ((path ? path->Sup.len : 0) == ((NI) 0));
		if (T3_) goto LA4_;
		T3_ = !(((NU8)(path->data[((NI) 0)]) == (NU8)(126)));
		LA4_: ;
		if (!T3_) goto LA5_;
		result = copyString(path);
	}
	goto LA1_;
	LA5_: ;
	{
		if (!((path ? path->Sup.len : 0) == ((NI) 1))) goto LA8_;
		result = nosgetHomeDir();
	}
	goto LA1_;
	LA8_: ;
	{
		NimStringDesc* T13_;
		NimStringDesc* T14_;
		if (!(((NU8)(path->data[((NI) 1)])) == ((NU8)(47)) || ((NU8)(path->data[((NI) 1)])) == ((NU8)(47)))) goto LA11_;
		T13_ = NIM_NIL;
		T13_ = nosgetHomeDir();
		T14_ = NIM_NIL;
		T14_ = substr__system_7756(path, ((NI) 2));
		result = slash___pureZos_121(T13_, T14_);
	}
	goto LA1_;
	LA11_: ;
	{
		result = copyString(path);
	}
	LA1_: ;
	return result;
}
static N_INLINE(NI, nimCStrLen)(NCSTRING a) {
	NI result;
	size_t T1_;
	result = (NI)0;
	T1_ = (size_t)0;
	T1_ = strlen(a);
	result = ((NI) (T1_));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getApplFreebsd__pureZos_1563)(void) {
	NimStringDesc* result;
	size_t pathLength;
	tyArray__VR9bNthWayFgb5M9avIR8bkA req;
	int res;
	NI realLen;
{	result = NIM_NIL;
	pathLength = ((size_t) 0);
	nimZeroMem((void*)req, sizeof(tyArray__VR9bNthWayFgb5M9avIR8bkA));
	nimCopyMem((void*)req, (NIM_CONST void*)TM__yu6cxgKBBXbNsTkT9cyMd4g_19, sizeof(tyArray__VR9bNthWayFgb5M9avIR8bkA));
	res = sysctl((&req[(((NI) 0))- 0]), ((unsigned int) 4), NIM_NIL, (&pathLength), NIM_NIL, ((size_t) 0));
	{
		if (!(res < ((NI32) 0))) goto LA3_;
		result = ((NimStringDesc*) NIM_NIL);
		goto BeforeRet_;
	}
	LA3_: ;
	result = setLengthStr(result, ((NI) (pathLength)));
	res = sysctl((&req[(((NI) 0))- 0]), ((unsigned int) 4), ((void*) ((&result->data[((NI) 0)]))), (&pathLength), NIM_NIL, ((size_t) 0));
	{
		if (!(res < ((NI32) 0))) goto LA7_;
		result = ((NimStringDesc*) NIM_NIL);
		goto BeforeRet_;
	}
	LA7_: ;
	realLen = (nimToCStringConv(result) ? nimCStrLen(nimToCStringConv(result)) : 0);
	result = setLengthStr(result, ((NI) (realLen)));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getApplHeuristic__pureZos_1600)(void) {
	NimStringDesc* result;
{	result = NIM_NIL;
	result = paramStr__pureZos_1529(((NI) 0));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 0) < (result ? result->Sup.len : 0));
		if (!(T3_)) goto LA4_;
		T3_ = !(((NU8)(result->data[((NI) 0)]) == (NU8)(47)));
		LA4_: ;
		if (!T3_) goto LA5_;
		{
			NimStringDesc* p;
			NimStringDesc* colontmp_;
			NI lastX60gensym37_;
			NI splitsX60gensym37_;
			p = NIM_NIL;
			colontmp_ = NIM_NIL;
			colontmp_ = getEnv__pureZos_418(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_20), ((NimStringDesc*) NIM_NIL));
			lastX60gensym37_ = ((NI) 0);
			splitsX60gensym37_ = ((NI) -1);
			{
				while (1) {
					NI firstX60gensym37_;
					NimStringDesc* x;
					if (!(lastX60gensym37_ <= (colontmp_ ? colontmp_->Sup.len : 0))) goto LA9;
					firstX60gensym37_ = lastX60gensym37_;
					{
						while (1) {
							NIM_BOOL T12_;
							T12_ = (NIM_BOOL)0;
							T12_ = (lastX60gensym37_ < (colontmp_ ? colontmp_->Sup.len : 0));
							if (!(T12_)) goto LA13_;
							T12_ = !((((NU8)(colontmp_->data[lastX60gensym37_])) == ((NU8)(58))));
							LA13_: ;
							if (!T12_) goto LA11;
							lastX60gensym37_ += ((NI) 1);
						} LA11: ;
					}
					{
						if (!(splitsX60gensym37_ == ((NI) 0))) goto LA16_;
						lastX60gensym37_ = (colontmp_ ? colontmp_->Sup.len : 0);
					}
					LA16_: ;
					p = substr__system_7744(colontmp_, firstX60gensym37_, (NI)(lastX60gensym37_ - ((NI) 1)));
					x = nosjoinPath(p, result);
					{
						NIM_BOOL T20_;
						T20_ = (NIM_BOOL)0;
						T20_ = nosfileExists(x);
						if (!T20_) goto LA21_;
						result = copyString(x);
						goto BeforeRet_;
					}
					LA21_: ;
					{
						if (!(splitsX60gensym37_ == ((NI) 0))) goto LA25_;
						goto LA8;
					}
					LA25_: ;
					splitsX60gensym37_ -= ((NI) 1);
					lastX60gensym37_ += ((NI) 1);
				} LA9: ;
			} LA8: ;
		}
	}
	LA5_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetAppFilename)(void) {
	NimStringDesc* result;
	result = NIM_NIL;
	result = getApplFreebsd__pureZos_1563();
	{
		if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = getApplHeuristic__pureZos_1600();
	}
	LA3_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetAppDir)(void) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	tyTuple__7q7q3E6Oj24ZNVJb9aonhAg T2_;
	result = NIM_NIL;
	T1_ = NIM_NIL;
	T1_ = nosgetAppFilename();
	nimZeroMem((void*)(&T2_), sizeof(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg));
	nossplitFile(T1_, (&T2_));
	result = copyString(T2_.Field0);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosdirExists)(NimStringDesc* dir) {
	NIM_BOOL result;
	struct stat res;
	NIM_BOOL T1_;
	int T2_;
	result = (NIM_BOOL)0;
	nimZeroMem((void*)(&res), sizeof(struct stat));
	T1_ = (NIM_BOOL)0;
	T2_ = (int)0;
	T2_ = stat(nimToCStringConv(dir), (&res));
	T1_ = (((NI32) 0) <= T2_);
	if (!(T1_)) goto LA3_;
	T1_ = S_ISDIR(res.st_mode);
	LA3_: ;
	result = T1_;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg, getSymlinkFileKind__pureZos_1227)(NimStringDesc* path) {
	tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg result;
	struct stat s;
	result = (tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg)0;
	nimZeroMem((void*)(&s), sizeof(struct stat));
	{
		NIM_BOOL T3_;
		int T4_;
		T3_ = (NIM_BOOL)0;
		T4_ = (int)0;
		T4_ = stat(nimToCStringConv(path), (&s));
		T3_ = (T4_ == ((NI32) 0));
		if (!(T3_)) goto LA5_;
		T3_ = S_ISDIR(s.st_mode);
		LA5_: ;
		if (!T3_) goto LA6_;
		result = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3);
	}
	goto LA1_;
	LA6_: ;
	{
		result = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1);
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosexpandFilename)(NimStringDesc* filename) {
	NimStringDesc* result;
	NCSTRING r;
	result = NIM_NIL;
	r = realpath(nimToCStringConv(filename), ((NCSTRING) NIM_NIL));
	{
		NI32 T5_;
		if (!(r == 0)) goto LA3_;
		T5_ = (NI32)0;
		T5_ = osLastError__pureZos_408();
		raiseOSError__pureZos_405(T5_, filename);
	}
	goto LA1_;
	LA3_: ;
	{
		result = cstrToNimstr(r);
		free(((void*) (r)));
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, rawCreateDir__pureZos_1409)(NimStringDesc* dir) {
	NIM_BOOL result;
	int res;
	result = (NIM_BOOL)0;
	res = mkdir(nimToCStringConv(dir), ((mode_t) 511));
	{
		if (!(res == ((NI32) 0))) goto LA3_;
		result = NIM_TRUE;
	}
	goto LA1_;
	LA3_: ;
	{
		if (!(errno == EEXIST)) goto LA6_;
		result = NIM_FALSE;
	}
	goto LA1_;
	LA6_: ;
	{
		NI32 T9_;
		T9_ = (NI32)0;
		T9_ = osLastError__pureZos_408();
		raiseOSError__pureZos_405(T9_, dir);
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosexistsOrCreateDir)(NimStringDesc* dir) {
	NIM_BOOL result;
	NIM_BOOL T1_;
	result = (NIM_BOOL)0;
	T1_ = (NIM_BOOL)0;
	T1_ = rawCreateDir__pureZos_1409(dir);
	result = !(T1_);
	{
		if (!result) goto LA4_;
		{
			NIM_BOOL T8_;
			tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw* T11_;
			NimStringDesc* T12_;
			T8_ = (NIM_BOOL)0;
			T8_ = nosdirExists(dir);
			if (!!(T8_)) goto LA9_;
			T11_ = NIM_NIL;
			T11_ = (tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw*) newObj((&NTIrefioerror__HMIVdYjdZYWskTmTQVo5BQ_), sizeof(tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw));
			(*T11_).Sup.Sup.Sup.m_type = (&NTIioerror__iLZrPn9anoh9ad1MmO0RczFw_);
			(*T11_).Sup.Sup.name = "IOError";
			T12_ = NIM_NIL;
			T12_ = rawNewString((dir ? dir->Sup.len : 0) + 19);
appendString(T12_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_21));
appendString(T12_, dir);
appendString(T12_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_7));
			asgnRef((void**) (&(*T11_).Sup.Sup.message), T12_);
			asgnRef((void**) (&(*T11_).Sup.Sup.parent), ((Exception*) NIM_NIL));
			raiseExceptionEx((Exception*)T11_, "IOError", "existsOrCreateDir", "os.nim", 2526);
		}
		LA9_: ;
	}
	LA4_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, noscreateDir)(NimStringDesc* dir) {
	NIM_BOOL omitNext;
	omitNext = NIM_FALSE;
	{
		NI i;
		NI colontmp_;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = (NI)((dir ? dir->Sup.len : 0) - ((NI) 1));
		res = ((NI) 1);
		{
			while (1) {
				if (!(res <= colontmp_)) goto LA3;
				i = res;
				{
					if (!(((NU8)(dir->data[i])) == ((NU8)(47)) || ((NU8)(dir->data[i])) == ((NU8)(47)))) goto LA6_;
					{
						if (!omitNext) goto LA10_;
						omitNext = NIM_FALSE;
					}
					goto LA8_;
					LA10_: ;
					{
						NimStringDesc* T13_;
						NIM_BOOL T14_;
						T13_ = NIM_NIL;
						T13_ = substr__system_7744(dir, ((NI) 0), (NI)(i - ((NI) 1)));
						T14_ = (NIM_BOOL)0;
						T14_ = nosexistsOrCreateDir(T13_);
						(void)(T14_);
					}
					LA8_: ;
				}
				LA6_: ;
				res += ((NI) 1);
			} LA3: ;
		}
	}
	{
		NIM_BOOL T17_;
		NIM_BOOL T18_;
		NIM_CHAR T21_;
		NIM_BOOL T24_;
		T17_ = (NIM_BOOL)0;
		T18_ = (NIM_BOOL)0;
		T18_ = (((NI) 0) < (dir ? dir->Sup.len : 0));
		if (!(T18_)) goto LA19_;
		T18_ = !(omitNext);
		LA19_: ;
		T17_ = T18_;
		if (!(T17_)) goto LA20_;
		T21_ = (NIM_CHAR)0;
		T21_ = X5BX5D___system_7329(dir, ((NI) 1));
		T17_ = !((((NU8)(T21_)) == ((NU8)(47)) || ((NU8)(T21_)) == ((NU8)(47))));
		LA20_: ;
		if (!T17_) goto LA22_;
		T24_ = (NIM_BOOL)0;
		T24_ = nosexistsOrCreateDir(dir);
		(void)(T24_);
	}
	LA22_: ;
}
N_LIB_PRIVATE N_NIMCALL(NI, searchExtPos__pureZos_271)(NimStringDesc* path) {
	NI result;
	result = (NI)0;
	result = ((NI) -1);
	{
		NI i;
		NI colontmp_;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = (NI)((path ? path->Sup.len : 0) - ((NI) 1));
		res = colontmp_;
		{
			while (1) {
				if (!(((NI) 1) <= res)) goto LA3;
				i = res;
				{
					if (!((NU8)(path->data[i]) == (NU8)(46))) goto LA6_;
					result = i;
					goto LA1;
				}
				goto LA4_;
				LA6_: ;
				{
					if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA9_;
					goto LA1;
				}
				goto LA4_;
				LA9_: ;
				LA4_: ;
				res -= ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
	return result;
}
static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c) {
	(*dest).data[(*dest).Sup.len] = c;
	(*dest).data[(NI)((*dest).Sup.len + ((NI) 1))] = 0;
	(*dest).Sup.len += ((NI) 1);
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normExt__pureZos_268)(NimStringDesc* ext) {
	NimStringDesc* result;
	result = NIM_NIL;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = ((ext ? ext->Sup.len : 0) == 0);
		if (T3_) goto LA4_;
		T3_ = ((NU8)(ext->data[((NI) 0)]) == (NU8)(46));
		LA4_: ;
		if (!T3_) goto LA5_;
		result = copyString(ext);
	}
	goto LA1_;
	LA5_: ;
	{
		NimStringDesc* T8_;
		T8_ = NIM_NIL;
		T8_ = rawNewString((ext ? ext->Sup.len : 0) + 1);
appendChar(T8_, 46);
appendString(T8_, ext);
		result = T8_;
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, noschangeFileExt)(NimStringDesc* filename, NimStringDesc* ext) {
	NimStringDesc* result;
	NI extPos;
	result = NIM_NIL;
	extPos = searchExtPos__pureZos_271(filename);
	{
		NimStringDesc* T5_;
		NimStringDesc* T6_;
		if (!(extPos < ((NI) 0))) goto LA3_;
		T5_ = NIM_NIL;
		T6_ = NIM_NIL;
		T6_ = normExt__pureZos_268(ext);
		T5_ = rawNewString((filename ? filename->Sup.len : 0) + (T6_ ? T6_->Sup.len : 0) + 0);
appendString(T5_, filename);
appendString(T5_, T6_);
		result = T5_;
	}
	goto LA1_;
	LA3_: ;
	{
		NimStringDesc* T8_;
		NimStringDesc* T9_;
		NimStringDesc* T10_;
		T8_ = NIM_NIL;
		T9_ = NIM_NIL;
		T9_ = substr__system_7744(filename, ((NI) 0), (NI)(extPos - ((NI) 1)));
		T10_ = NIM_NIL;
		T10_ = normExt__pureZos_268(ext);
		T8_ = rawNewString((T9_ ? T9_->Sup.len : 0) + (T10_ ? T10_->Sup.len : 0) + 0);
appendString(T8_, T9_);
appendString(T8_, T10_);
		result = T8_;
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext) {
	NimStringDesc* result;
	NI extPos;
	result = NIM_NIL;
	extPos = searchExtPos__pureZos_271(filename);
	{
		NimStringDesc* T5_;
		NimStringDesc* T6_;
		if (!(extPos < ((NI) 0))) goto LA3_;
		T5_ = NIM_NIL;
		T6_ = NIM_NIL;
		T6_ = normExt__pureZos_268(ext);
		T5_ = rawNewString((filename ? filename->Sup.len : 0) + (T6_ ? T6_->Sup.len : 0) + 0);
appendString(T5_, filename);
appendString(T5_, T6_);
		result = T5_;
	}
	goto LA1_;
	LA3_: ;
	{
		result = copyString(filename);
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nostryRemoveFile)(NimStringDesc* file) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = NIM_TRUE;
	{
		NIM_BOOL T3_;
		int T4_;
		T3_ = (NIM_BOOL)0;
		T4_ = (int)0;
		T4_ = unlink(nimToCStringConv(file));
		T3_ = !((T4_ == ((NI32) 0)));
		if (!(T3_)) goto LA5_;
		T3_ = !((errno == ENOENT));
		LA5_: ;
		if (!T3_) goto LA6_;
		result = NIM_FALSE;
	}
	LA6_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, putEnv__pureZos_426)(NimStringDesc* key, NimStringDesc* val) {
	{
		int T3_;
		NI32 T6_;
		tyTuple__UV3llMMYFckfui8YMBuUZA T7_;
		NimStringDesc* T8_;
		T3_ = (int)0;
		T3_ = setenv(nimToCStringConv(key), nimToCStringConv(val), ((NI32) 1));
		if (!!((T3_ == ((NI32) 0)))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__pureZos_408();
		nimZeroMem((void*)(&T7_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
		T7_.Field0 = copyString(key);
		T7_.Field1 = copyString(val);
		T8_ = NIM_NIL;
		T8_ = dollar___pureZos_429(T7_);
		raiseOSError__pureZos_405(T6_, T8_);
	}
	LA4_: ;
}
static N_INLINE(NI, find__pureZos_656)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item) {
	NI result;
{	result = (NI)0;
	result = ((NI) 0);
	{
		NIM_CHAR i;
		NI i_2;
		i = (NIM_CHAR)0;
		i_2 = ((NI) 0);
		{
			while (1) {
				if (!(i_2 < aLen_0)) goto LA3;
				i = a[i_2];
				{
					if (!((NU8)(i) == (NU8)(item))) goto LA6_;
					goto BeforeRet_;
				}
				LA6_: ;
				result += ((NI) 1);
				i_2 += ((NI) 1);
			} LA3: ;
		}
	}
	result = ((NI) -1);
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_BOOL, contains__pureZos_651)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item) {
	NIM_BOOL result;
	NI T1_;
{	result = (NIM_BOOL)0;
	T1_ = (NI)0;
	T1_ = find__pureZos_656(a, aLen_0, item);
	result = (((NI) 0) <= T1_);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nossymlinkExists)(NimStringDesc* link) {
	NIM_BOOL result;
	struct stat res;
	NIM_BOOL T1_;
	int T2_;
	result = (NIM_BOOL)0;
	nimZeroMem((void*)(&res), sizeof(struct stat));
	T1_ = (NIM_BOOL)0;
	T2_ = (int)0;
	T2_ = lstat(nimToCStringConv(link), (&res));
	T1_ = (((NI32) 0) <= T2_);
	if (!(T1_)) goto LA3_;
	T1_ = S_ISLNK(res.st_mode);
	LA3_: ;
	result = T1_;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, findExe__pureZos_644)(NimStringDesc* exe, NIM_BOOL followSymlinks, NimStringDesc** extensions, NI extensionsLen_0) {
	NimStringDesc* result;
	NimStringDesc* path;
{	result = NIM_NIL;
	{
		if (!((exe ? exe->Sup.len : 0) == ((NI) 0))) goto LA3_;
		goto BeforeRet_;
	}
	LA3_: ;
	{
		NIM_BOOL T7_;
		T7_ = (NIM_BOOL)0;
		T7_ = contains__pureZos_651((exe) ? (exe->data) : NIM_NIL, (exe ? exe->Sup.len : 0), 47);
		if (!T7_) goto LA8_;
		{
			NimStringDesc** extX60gensym82_;
			NI i;
			extX60gensym82_ = (NimStringDesc**)0;
			i = ((NI) 0);
			{
				while (1) {
					if (!(i < extensionsLen_0)) goto LA12;
					extX60gensym82_ = (&extensions[i]);
					result = nosaddFileExt(exe, (*extX60gensym82_));
					{
						NIM_BOOL T15_;
						T15_ = (NIM_BOOL)0;
						T15_ = nosfileExists(result);
						if (!T15_) goto LA16_;
						goto BeforeRet_;
					}
					LA16_: ;
					i += ((NI) 1);
				} LA12: ;
			}
		}
	}
	LA8_: ;
	path = getEnv__pureZos_418(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_20), ((NimStringDesc*) NIM_NIL));
	{
		NimStringDesc* candidate;
		NI lastX60gensym34_;
		NI splitsX60gensym34_;
		candidate = NIM_NIL;
		lastX60gensym34_ = ((NI) 0);
		splitsX60gensym34_ = ((NI) -1);
		{
			while (1) {
				NI firstX60gensym34_;
				if (!(lastX60gensym34_ <= (path ? path->Sup.len : 0))) goto LA20;
				firstX60gensym34_ = lastX60gensym34_;
				{
					while (1) {
						NIM_BOOL T23_;
						T23_ = (NIM_BOOL)0;
						T23_ = (lastX60gensym34_ < (path ? path->Sup.len : 0));
						if (!(T23_)) goto LA24_;
						T23_ = !(((NU8)(path->data[lastX60gensym34_]) == (NU8)(58)));
						LA24_: ;
						if (!T23_) goto LA22;
						lastX60gensym34_ += ((NI) 1);
					} LA22: ;
				}
				{
					if (!(splitsX60gensym34_ == ((NI) 0))) goto LA27_;
					lastX60gensym34_ = (path ? path->Sup.len : 0);
				}
				LA27_: ;
				candidate = substr__system_7744(path, firstX60gensym34_, (NI)(lastX60gensym34_ - ((NI) 1)));
				{
					NimStringDesc* x;
					NimStringDesc* T34_;
					{
						if (!((candidate ? candidate->Sup.len : 0) == ((NI) 0))) goto LA32_;
						goto LA29;
					}
					LA32_: ;
					T34_ = NIM_NIL;
					T34_ = expandTilde__pureZos_576(candidate);
					x = slash___pureZos_121(T34_, exe);
					{
						NimStringDesc** ext;
						NI i_2;
						ext = (NimStringDesc**)0;
						i_2 = ((NI) 0);
						{
							while (1) {
								NimStringDesc* x_2;
								if (!(i_2 < extensionsLen_0)) goto LA37;
								ext = (&extensions[i_2]);
								x_2 = nosaddFileExt(x, (*ext));
								{
									NIM_BOOL T40_;
									T40_ = (NIM_BOOL)0;
									T40_ = nosfileExists(x_2);
									if (!T40_) goto LA41_;
									{
										while (1) {
											if (!followSymlinks) goto LA44;
											{
												NIM_BOOL T47_;
												NimStringDesc* r;
												NI len;
												T47_ = (NIM_BOOL)0;
												T47_ = nossymlinkExists(x_2);
												if (!T47_) goto LA48_;
												r = mnewString(((NI) 1024));
												len = readlink(nimToCStringConv(x_2), nimToCStringConv(r), ((NI) 1024));
												{
													NI32 T54_;
													if (!(len < ((NI) 0))) goto LA52_;
													T54_ = (NI32)0;
													T54_ = osLastError__pureZos_408();
													raiseOSError__pureZos_405(T54_, exe);
												}
												LA52_: ;
												{
													if (!(((NI) 1024) < len)) goto LA57_;
													r = mnewString(((NI) ((NI)(len + ((NI) 1)))));
													len = readlink(nimToCStringConv(x_2), nimToCStringConv(r), len);
												}
												LA57_: ;
												r = setLengthStr(r, ((NI) (len)));
												{
													NIM_BOOL T61_;
													T61_ = (NIM_BOOL)0;
													T61_ = nosisAbsolute(r);
													if (!T61_) goto LA62_;
													x_2 = copyString(r);
												}
												goto LA59_;
												LA62_: ;
												{
													NimStringDesc* T65_;
													T65_ = NIM_NIL;
													T65_ = nosparentDir(x_2);
													x_2 = slash___pureZos_121(T65_, r);
												}
												LA59_: ;
											}
											goto LA45_;
											LA48_: ;
											{
												goto LA43;
											}
											LA45_: ;
										} LA44: ;
									} LA43: ;
									result = copyString(x_2);
									goto BeforeRet_;
								}
								LA41_: ;
								i_2 += ((NI) 1);
							} LA37: ;
						}
					}
				} LA29: ;
				{
					if (!(splitsX60gensym34_ == ((NI) 0))) goto LA69_;
					goto LA19;
				}
				LA69_: ;
				splitsX60gensym34_ -= ((NI) 1);
				lastX60gensym34_ += ((NI) 1);
			} LA20: ;
		} LA19: ;
	}
	result = ((NimStringDesc*) NIM_NIL);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nosremoveFile)(NimStringDesc* file) {
	{
		NIM_BOOL T3_;
		NI32 T6_;
		T3_ = (NIM_BOOL)0;
		T3_ = nostryRemoveFile(file);
		if (!!(T3_)) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__pureZos_408();
		raiseOSError__pureZos_405(T6_, file);
	}
	LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, existsEnv__pureZos_423)(NimStringDesc* key) {
	NIM_BOOL result;
	NCSTRING T1_;
	NIM_BOOL T2_;
{	result = (NIM_BOOL)0;
	T1_ = (NCSTRING)0;
	T1_ = getenv(nimToCStringConv(key));
	T2_ = (NIM_BOOL)0;
	T2_ = eqeq___system_7724(T1_, ((NCSTRING) NIM_NIL));
	result = !(T2_);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, delEnv__pureZos_465)(NimStringDesc* key) {
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = unsetenv(nimToCStringConv(key));
		if (!!((T3_ == ((NI32) 0)))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__pureZos_408();
		raiseOSError__pureZos_405(T6_, key);
	}
	LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__pureZos_1101)(int status) {
	int result;
	result = (int)0;
	{
		NIM_BOOL T3_;
		int T6_;
		T3_ = (NIM_BOOL)0;
		T3_ = WIFSIGNALED(status);
		if (!T3_) goto LA4_;
		T6_ = (int)0;
		T6_ = WTERMSIG(status);
		result = (NI32)(((NI32) 128) + T6_);
	}
	goto LA1_;
	LA4_: ;
	{
		result = WEXITSTATUS(status);
	}
	LA1_: ;
	return result;
}
static N_INLINE(void, pushSafePoint)(TSafePoint* s) {
	(*s).prev = excHandler__system_2565;
	excHandler__system_2565 = s;
}
static N_INLINE(void, popSafePoint)(void) {
	excHandler__system_2565 = (*excHandler__system_2565).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, rawRemoveDir__pureZos_1402)(NimStringDesc* dir) {
	{
		NIM_BOOL T3_;
		int T4_;
		NI32 T8_;
		T3_ = (NIM_BOOL)0;
		T4_ = (int)0;
		T4_ = rmdir(nimToCStringConv(dir));
		T3_ = !((T4_ == ((NI32) 0)));
		if (!(T3_)) goto LA5_;
		T3_ = !((errno == ENOENT));
		LA5_: ;
		if (!T3_) goto LA6_;
		T8_ = (NI32)0;
		T8_ = osLastError__pureZos_408();
		raiseOSError__pureZos_405(T8_, dir);
	}
	LA6_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, nosremoveDir)(NimStringDesc* dir, NIM_BOOL checkDir) {
	{
		tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg kind;
		NimStringDesc* path;
		DIR* d;
		kind = (tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg)0;
		path = NIM_NIL;
		d = opendir(nimToCStringConv(dir));
		{
			if (!(d == ((DIR*) NIM_NIL))) goto LA4_;
			{
				NI32 T10_;
				if (!checkDir) goto LA8_;
				T10_ = (NI32)0;
				T10_ = osLastError__pureZos_408();
				raiseOSError__pureZos_405(T10_, dir);
			}
			LA8_: ;
		}
		goto LA2_;
		LA4_: ;
		{
			TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_22;
			pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_22);
			TM__yu6cxgKBBXbNsTkT9cyMd4g_22.status = _setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_22.context);
			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_22.status == 0) {
			{
				while (1) {
					{
						struct dirent* x;
						NimStringDesc* y;
						x = readdir(d);
						{
							if (!(x == ((struct dirent*) NIM_NIL))) goto LA17_;
							goto LA12;
						}
						LA17_: ;
						y = cstrToNimstr(((NCSTRING) ((*x).d_name)));
						{
							NIM_BOOL T21_;
							struct stat s;
							NimStringDesc* path_2;
							tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg k;
							T21_ = (NIM_BOOL)0;
							T21_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11)));
							if (!(T21_)) goto LA22_;
							T21_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17)));
							LA22_: ;
							if (!T21_) goto LA23_;
							nimZeroMem((void*)(&s), sizeof(struct stat));
							path_2 = slash___pureZos_121(dir, y);
							{
								if (!NIM_TRUE) goto LA27_;
								y = copyString(path_2);
							}
							LA27_: ;
							k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 0);
							switch ((*x).d_type) {
							case ((NI) 4):
							{
								k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
							}
							break;
							case ((NI) 10):
							{
								{
									NIM_BOOL T33_;
									T33_ = (NIM_BOOL)0;
									T33_ = nosdirExists(path_2);
									if (!T33_) goto LA34_;
									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3);
								}
								goto LA31_;
								LA34_: ;
								{
									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1);
								}
								LA31_: ;
							}
							break;
							case ((NI) 0):
							{
								{
									int T40_;
									T40_ = (int)0;
									T40_ = lstat(nimToCStringConv(path_2), (&s));
									if (!(T40_ < ((NI32) 0))) goto LA41_;
									goto LA14;
								}
								goto LA38_;
								LA41_: ;
								{
									NIM_BOOL T44_;
									T44_ = (NIM_BOOL)0;
									T44_ = S_ISDIR(s.st_mode);
									if (!T44_) goto LA45_;
									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
								}
								goto LA38_;
								LA45_: ;
								{
									NIM_BOOL T48_;
									T48_ = (NIM_BOOL)0;
									T48_ = S_ISLNK(s.st_mode);
									if (!T48_) goto LA49_;
									k = getSymlinkFileKind__pureZos_1227(path_2);
								}
								goto LA38_;
								LA49_: ;
								LA38_: ;
							}
							break;
							default:
							{
							}
							break;
							}
							kind = k;
							path = y;
							switch (kind) {
							case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 0):
							case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1):
							case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3):
							{
								nosremoveFile(path);
							}
							break;
							case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2):
							{
								nosremoveDir(path, NIM_TRUE);
							}
							break;
							}
						}
						LA23_: ;
					} LA14: ;
				}
			} LA12: ;
			popSafePoint();
			}
			else {
				popSafePoint();
			}
			{
				int T56_;
				T56_ = (int)0;
				T56_ = closedir(d);
				(void)(T56_);
				if (TM__yu6cxgKBBXbNsTkT9cyMd4g_22.status != 0) nimLeaveFinally();
			}
			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_22.status != 0) reraiseException();
		}
		LA2_: ;
	}
	rawRemoveDir__pureZos_1402(dir);
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, tryMoveFSObject__pureZos_1088)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL isDir) {
	NIM_BOOL result;
	int T1_;
	result = (NIM_BOOL)0;
	T1_ = (int)0;
	T1_ = rename(nimToCStringConv(source), nimToCStringConv(dest));
	result = (T1_ == ((NI32) 0));
	{
		NI32 err;
		NIM_BOOL isAccessDeniedError;
		if (!!(result)) goto LA4_;
		err = osLastError__pureZos_408();
		isAccessDeniedError = (err == EXDEV);
		{
			tyTuple__UV3llMMYFckfui8YMBuUZA T10_;
			NimStringDesc* T11_;
			if (!!(isAccessDeniedError)) goto LA8_;
			nimZeroMem((void*)(&T10_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
			T10_.Field0 = copyString(source);
			T10_.Field1 = copyString(dest);
			T11_ = NIM_NIL;
			T11_ = dollar___pureZos_429(T10_);
			raiseOSError__pureZos_405(err, T11_);
		}
		LA8_: ;
	}
	LA4_: ;
	return result;
}
static N_INLINE(NI, countSetBitsImpl__systemZcountbits95impl_26)(NU32 x) {
	NI result;
	int T1_;
	result = (NI)0;
	T1_ = (int)0;
	T1_ = __builtin_popcount(x);
	result = ((NI) (T1_));
	return result;
}
static N_INLINE(NI, countBits32)(NU32 n) {
	NI result;
	result = (NI)0;
	result = countSetBitsImpl__systemZcountbits95impl_26(n);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, createSymlink__pureZos_1012)(NimStringDesc* src, NimStringDesc* dest) {
	{
		int T3_;
		NI32 T6_;
		tyTuple__UV3llMMYFckfui8YMBuUZA T7_;
		NimStringDesc* T8_;
		T3_ = (int)0;
		T3_ = symlink(nimToCStringConv(src), nimToCStringConv(dest));
		if (!!((T3_ == ((NI32) 0)))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__pureZos_408();
		nimZeroMem((void*)(&T7_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
		T7_.Field0 = copyString(src);
		T7_.Field1 = copyString(dest);
		T8_ = NIM_NIL;
		T8_ = dollar___pureZos_429(T7_);
		raiseOSError__pureZos_405(T6_, T8_);
	}
	LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, expandSymlink__pureZos_1018)(NimStringDesc* symlinkPath) {
	NimStringDesc* result;
	NI len;
	result = NIM_NIL;
	result = mnewString(((NI) 1024));
	len = readlink(nimToCStringConv(symlinkPath), nimToCStringConv(result), ((NI) 1024));
	{
		NI32 T5_;
		if (!(len < ((NI) 0))) goto LA3_;
		T5_ = (NI32)0;
		T5_ = osLastError__pureZos_408();
		raiseOSError__pureZos_405(T5_, symlinkPath);
	}
	LA3_: ;
	{
		if (!(((NI) 1024) < len)) goto LA8_;
		result = mnewString(((NI) ((NI)(len + ((NI) 1)))));
		len = readlink(nimToCStringConv(symlinkPath), nimToCStringConv(result), len);
	}
	LA8_: ;
	result = setLengthStr(result, ((NI) (len)));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, noscopyFile)(NimStringDesc* source, NimStringDesc* dest, tySet_tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA options) {
	NIM_BOOL isSymlink;
{	{
		if (!!((countBits32((7 & options)) == ((NI) 1)))) goto LA3_;
		failedAssertImpl__systemZassertions_56(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_23));
	}
	LA3_: ;
	isSymlink = nossymlinkExists(source);
	{
		NIM_BOOL T7_;
		NIM_BOOL T9_;
		T7_ = (NIM_BOOL)0;
		T7_ = isSymlink;
		if (!(T7_)) goto LA8_;
		T9_ = (NIM_BOOL)0;
		T9_ = ((options &((NU8)1<<((NU)(((tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA) 2))&7U)))!=0);
		if (T9_) goto LA10_;
		T9_ = NIM_FALSE;
		LA10_: ;
		T7_ = T9_;
		LA8_: ;
		if (!T7_) goto LA11_;
		goto BeforeRet_;
	}
	LA11_: ;
	{
		NIM_BOOL T15_;
		NimStringDesc* T19_;
		T15_ = (NIM_BOOL)0;
		T15_ = isSymlink;
		if (!(T15_)) goto LA16_;
		T15_ = ((options &((NU8)1<<((NU)(((tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA) 0))&7U)))!=0);
		LA16_: ;
		if (!T15_) goto LA17_;
		T19_ = NIM_NIL;
		T19_ = expandSymlink__pureZos_1018(source);
		createSymlink__pureZos_1012(T19_, dest);
	}
	goto LA13_;
	LA17_: ;
	{
		FILE* d;
		FILE* s;
		void* buf;
		d = (FILE*)0;
		s = (FILE*)0;
		{
			NIM_BOOL T23_;
			NI32 T26_;
			T23_ = (NIM_BOOL)0;
			T23_ = open__systemZio_389(&s, source, ((tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg) 0), ((NI) -1));
			if (!!(T23_)) goto LA24_;
			T26_ = (NI32)0;
			T26_ = osLastError__pureZos_408();
			raiseOSError__pureZos_405(T26_, source);
		}
		LA24_: ;
		{
			NIM_BOOL T29_;
			NI32 T32_;
			T29_ = (NIM_BOOL)0;
			T29_ = open__systemZio_389(&d, dest, ((tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg) 1), ((NI) -1));
			if (!!(T29_)) goto LA30_;
			close__systemZio_217(s);
			T32_ = (NI32)0;
			T32_ = osLastError__pureZos_408();
			raiseOSError__pureZos_405(T32_, dest);
		}
		LA30_: ;
		buf = allocImpl__system_1743(((NI) 8000));
		{
			while (1) {
				NI bytesread;
				bytesread = readBuffer__systemZio_144(s, buf, ((NI) 8000));
				{
					NI byteswritten;
					if (!(((NI) 0) < bytesread)) goto LA37_;
					byteswritten = writeBuffer__systemZio_176(d, buf, ((NI) (bytesread)));
					{
						NI32 T43_;
						if (!!((bytesread == byteswritten))) goto LA41_;
						dealloc(buf);
						close__systemZio_217(s);
						close__systemZio_217(d);
						T43_ = (NI32)0;
						T43_ = osLastError__pureZos_408();
						raiseOSError__pureZos_405(T43_, dest);
					}
					LA41_: ;
				}
				LA37_: ;
				{
					if (!!((bytesread == ((NI) 8000)))) goto LA46_;
					goto LA33;
				}
				LA46_: ;
			}
		} LA33: ;
		dealloc(buf);
		close__systemZio_217(s);
		flushFile__systemZio_226(d);
		close__systemZio_217(d);
	}
	LA13_: ;
	}BeforeRet_: ;
}
static N_INLINE(void, popCurrentException)(void) {
	asgnRef((void**) (&currException__system_2566), (*currException__system_2566).up);
}
N_LIB_PRIVATE N_NIMCALL(void, nosmoveFile)(NimStringDesc* source, NimStringDesc* dest) {
	{
		NIM_BOOL T3_;
		TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_24;
		T3_ = (NIM_BOOL)0;
		T3_ = tryMoveFSObject__pureZos_1088(source, dest, NIM_FALSE);
		if (!!(T3_)) goto LA4_;
		noscopyFile(source, dest, 1);
		pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_24);
		TM__yu6cxgKBBXbNsTkT9cyMd4g_24.status = _setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_24.context);
		if (TM__yu6cxgKBBXbNsTkT9cyMd4g_24.status == 0) {
		nosremoveFile(source);
		popSafePoint();
		}
		else {
			popSafePoint();
			{
				NIM_BOOL T8_;
				TM__yu6cxgKBBXbNsTkT9cyMd4g_24.status = 0;
				T8_ = (NIM_BOOL)0;
				T8_ = nostryRemoveFile(dest);
				(void)(T8_);
				reraiseException();
				popCurrentException();
			}
		}
		if (TM__yu6cxgKBBXbNsTkT9cyMd4g_24.status != 0) reraiseException();
	}
	LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, noscopyDir)(NimStringDesc* source, NimStringDesc* dest) {
	noscreateDir(dest);
	{
		tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg kind;
		NimStringDesc* path;
		DIR* d;
		kind = (tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg)0;
		path = NIM_NIL;
		d = opendir(nimToCStringConv(source));
		{
			if (!(d == ((DIR*) NIM_NIL))) goto LA4_;
			{
				NI32 T10_;
				if (!NIM_FALSE) goto LA8_;
				T10_ = (NI32)0;
				T10_ = osLastError__pureZos_408();
				raiseOSError__pureZos_405(T10_, source);
			}
			LA8_: ;
		}
		goto LA2_;
		LA4_: ;
		{
			TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_25;
			pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_25);
			TM__yu6cxgKBBXbNsTkT9cyMd4g_25.status = _setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_25.context);
			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_25.status == 0) {
			{
				while (1) {
					{
						struct dirent* x;
						NimStringDesc* y;
						x = readdir(d);
						{
							if (!(x == ((struct dirent*) NIM_NIL))) goto LA17_;
							goto LA12;
						}
						LA17_: ;
						y = cstrToNimstr(((NCSTRING) ((*x).d_name)));
						{
							NIM_BOOL T21_;
							struct stat s;
							NimStringDesc* path_2;
							tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg k;
							NimStringDesc* noSource;
							tyTuple__UV3llMMYFckfui8YMBuUZA T52_;
							T21_ = (NIM_BOOL)0;
							T21_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11)));
							if (!(T21_)) goto LA22_;
							T21_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17)));
							LA22_: ;
							if (!T21_) goto LA23_;
							nimZeroMem((void*)(&s), sizeof(struct stat));
							path_2 = slash___pureZos_121(source, y);
							{
								if (!NIM_TRUE) goto LA27_;
								y = copyString(path_2);
							}
							LA27_: ;
							k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 0);
							switch ((*x).d_type) {
							case ((NI) 4):
							{
								k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
							}
							break;
							case ((NI) 10):
							{
								{
									NIM_BOOL T33_;
									T33_ = (NIM_BOOL)0;
									T33_ = nosdirExists(path_2);
									if (!T33_) goto LA34_;
									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3);
								}
								goto LA31_;
								LA34_: ;
								{
									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1);
								}
								LA31_: ;
							}
							break;
							case ((NI) 0):
							{
								{
									int T40_;
									T40_ = (int)0;
									T40_ = lstat(nimToCStringConv(path_2), (&s));
									if (!(T40_ < ((NI32) 0))) goto LA41_;
									goto LA14;
								}
								goto LA38_;
								LA41_: ;
								{
									NIM_BOOL T44_;
									T44_ = (NIM_BOOL)0;
									T44_ = S_ISDIR(s.st_mode);
									if (!T44_) goto LA45_;
									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
								}
								goto LA38_;
								LA45_: ;
								{
									NIM_BOOL T48_;
									T48_ = (NIM_BOOL)0;
									T48_ = S_ISLNK(s.st_mode);
									if (!T48_) goto LA49_;
									k = getSymlinkFileKind__pureZos_1227(path_2);
								}
								goto LA38_;
								LA49_: ;
								LA38_: ;
							}
							break;
							default:
							{
							}
							break;
							}
							kind = k;
							path = y;
							nimZeroMem((void*)(&T52_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
							nossplitPath(path, (&T52_));
							noSource = copyString(T52_.Field1);
							{
								NimStringDesc* T57_;
								if (!(kind == ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2))) goto LA55_;
								T57_ = NIM_NIL;
								T57_ = slash___pureZos_121(dest, noSource);
								noscopyDir(path, T57_);
							}
							goto LA53_;
							LA55_: ;
							{
								NimStringDesc* T59_;
								T59_ = NIM_NIL;
								T59_ = slash___pureZos_121(dest, noSource);
								noscopyFile(path, T59_, 1);
							}
							LA53_: ;
						}
						LA23_: ;
					} LA14: ;
				}
			} LA12: ;
			popSafePoint();
			}
			else {
				popSafePoint();
			}
			{
				int T62_;
				T62_ = (int)0;
				T62_ = closedir(d);
				(void)(T62_);
				if (TM__yu6cxgKBBXbNsTkT9cyMd4g_25.status != 0) nimLeaveFinally();
			}
			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_25.status != 0) reraiseException();
		}
		LA2_: ;
	}
}
N_LIB_PRIVATE N_NIMCALL(void, moveDir__pureZos_1444)(NimStringDesc* source, NimStringDesc* dest) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = tryMoveFSObject__pureZos_1088(source, dest, NIM_TRUE);
		if (!!(T3_)) goto LA4_;
		noscopyDir(source, dest);
		nosremoveDir(source, NIM_FALSE);
	}
	LA4_: ;
}
static N_INLINE(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, toTime__pureZos_17)(struct timespec ts) {
	tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q result;
	nimZeroMem((void*)(&result), sizeof(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q));
	result = initTime__pureZtimes_895(((NI64) (ts.tv_sec)), ((NI) (ts.tv_nsec)));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, nosgetLastModificationTime)(NimStringDesc* file) {
	tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q result;
	struct stat res;
	nimZeroMem((void*)(&result), sizeof(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q));
	nimZeroMem((void*)(&res), sizeof(struct stat));
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = stat(nimToCStringConv(file), (&res));
		if (!(T3_ < ((NI32) 0))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__pureZos_408();
		raiseOSError__pureZos_405(T6_, file);
	}
	LA4_: ;
	result = toTime__pureZos_17(res.st_mtim);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetConfigDir)(void) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	NimStringDesc* T2_;
	result = NIM_NIL;
	T1_ = NIM_NIL;
	T1_ = getEnv__pureZos_418(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_18), ((NimStringDesc*) NIM_NIL));
	T2_ = NIM_NIL;
	T2_ = slash___pureZos_121(T1_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_27));
	result = getEnv__pureZos_418(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_26), T2_);
	normalizePathEnd__pureZos_51((&result), NIM_TRUE);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisRootDir)(NimStringDesc* path) {
	NIM_BOOL result;
	NI T1_;
	result = (NIM_BOOL)0;
	T1_ = (NI)0;
	T1_ = parentDirPos__pureZos_195(path);
	result = (T1_ < ((NI) 0));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileNewer)(NimStringDesc* a, NimStringDesc* b) {
	NIM_BOOL result;
	tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q T1_;
	tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q T2_;
	result = (NIM_BOOL)0;
	T1_ = nosgetLastModificationTime(b);
	T2_ = nosgetLastModificationTime(a);
	result = ntLtTime(T1_, T2_);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nossetFilePermissions)(NimStringDesc* filename, tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA permissions, NIM_BOOL followSymlinks) {
	mode_t p;
	p = ((mode_t) 0);
	{
		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 2))&15U)))!=0)) goto LA3_;
		p = (NU16)(p | ((mode_t) (S_IRUSR)));
	}
	LA3_: ;
	{
		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 1))&15U)))!=0)) goto LA7_;
		p = (NU16)(p | ((mode_t) (S_IWUSR)));
	}
	LA7_: ;
	{
		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 0))&15U)))!=0)) goto LA11_;
		p = (NU16)(p | ((mode_t) (S_IXUSR)));
	}
	LA11_: ;
	{
		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 5))&15U)))!=0)) goto LA15_;
		p = (NU16)(p | ((mode_t) (S_IRGRP)));
	}
	LA15_: ;
	{
		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 4))&15U)))!=0)) goto LA19_;
		p = (NU16)(p | ((mode_t) (S_IWGRP)));
	}
	LA19_: ;
	{
		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 3))&15U)))!=0)) goto LA23_;
		p = (NU16)(p | ((mode_t) (S_IXGRP)));
	}
	LA23_: ;
	{
		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 8))&15U)))!=0)) goto LA27_;
		p = (NU16)(p | ((mode_t) (S_IROTH)));
	}
	LA27_: ;
	{
		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 7))&15U)))!=0)) goto LA31_;
		p = (NU16)(p | ((mode_t) (S_IWOTH)));
	}
	LA31_: ;
	{
		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 6))&15U)))!=0)) goto LA35_;
		p = (NU16)(p | ((mode_t) (S_IXOTH)));
	}
	LA35_: ;
	{
		NIM_BOOL T39_;
		T39_ = (NIM_BOOL)0;
		T39_ = !(followSymlinks);
		if (!(T39_)) goto LA40_;
		T39_ = nossymlinkExists(filename);
		LA40_: ;
		if (!T39_) goto LA41_;
		{
			int T45_;
			NI32 T48_;
			tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA T49_;
			NimStringDesc* T50_;
			T45_ = (int)0;
			T45_ = lchmod(nimToCStringConv(filename), ((mode_t) (p)));
			if (!!((T45_ == ((NI32) 0)))) goto LA46_;
			T48_ = (NI32)0;
			T48_ = osLastError__pureZos_408();
			nimZeroMem((void*)(&T49_), sizeof(tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA));
			T49_.Field0 = copyString(filename);
			T49_.Field1 = permissions;
			T50_ = NIM_NIL;
			T50_ = dollar___pureZos_871(T49_);
			raiseOSError__pureZos_405(T48_, T50_);
		}
		LA46_: ;
	}
	goto LA37_;
	LA41_: ;
	{
		{
			int T54_;
			NI32 T57_;
			tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA T58_;
			NimStringDesc* T59_;
			T54_ = (int)0;
			T54_ = chmod(nimToCStringConv(filename), ((mode_t) (p)));
			if (!!((T54_ == ((NI32) 0)))) goto LA55_;
			T57_ = (NI32)0;
			T57_ = osLastError__pureZos_408();
			nimZeroMem((void*)(&T58_), sizeof(tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA));
			T58_.Field0 = copyString(filename);
			T58_.Field1 = permissions;
			T59_ = NIM_NIL;
			T59_ = dollar___pureZos_871(T58_);
			raiseOSError__pureZos_405(T57_, T59_);
		}
		LA55_: ;
	}
	LA37_: ;
}
N_LIB_PRIVATE N_NIMCALL(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA, nosgetFilePermissions)(NimStringDesc* filename) {
	tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA result;
	struct stat a;
	nimZeroMem((void*)(&result), sizeof(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA));
	nimZeroMem((void*)(&a), sizeof(struct stat));
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = stat(nimToCStringConv(filename), (&a));
		if (!(T3_ < ((NI32) 0))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__pureZos_408();
		raiseOSError__pureZos_405(T6_, filename);
	}
	LA4_: ;
	result = 0;
	{
		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IRUSR))) == ((mode_t) 0)))) goto LA9_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 2)) & 15);
	}
	LA9_: ;
	{
		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IWUSR))) == ((mode_t) 0)))) goto LA13_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 1)) & 15);
	}
	LA13_: ;
	{
		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IXUSR))) == ((mode_t) 0)))) goto LA17_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 0)) & 15);
	}
	LA17_: ;
	{
		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IRGRP))) == ((mode_t) 0)))) goto LA21_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 5)) & 15);
	}
	LA21_: ;
	{
		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IWGRP))) == ((mode_t) 0)))) goto LA25_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 4)) & 15);
	}
	LA25_: ;
	{
		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IXGRP))) == ((mode_t) 0)))) goto LA29_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 3)) & 15);
	}
	LA29_: ;
	{
		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IROTH))) == ((mode_t) 0)))) goto LA33_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 8)) & 15);
	}
	LA33_: ;
	{
		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IWOTH))) == ((mode_t) 0)))) goto LA37_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 7)) & 15);
	}
	LA37_: ;
	{
		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IXOTH))) == ((mode_t) 0)))) goto LA41_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 6)) & 15);
	}
	LA41_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, copyFileWithPermissions__pureZos_1453)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL ignorePermissionErrors, tySet_tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA options) {
	TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_28;
	tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA T1_;
	noscopyFile(source, dest, options);
	pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_28);
	TM__yu6cxgKBBXbNsTkT9cyMd4g_28.status = _setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_28.context);
	if (TM__yu6cxgKBBXbNsTkT9cyMd4g_28.status == 0) {
	T1_ = nosgetFilePermissions(source);
	nossetFilePermissions(dest, T1_, ((options &((NU8)1<<((NU)(((tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA) 1))&7U)))!=0));
	popSafePoint();
	}
	else {
		popSafePoint();
		{
			TM__yu6cxgKBBXbNsTkT9cyMd4g_28.status = 0;
			{
				if (!!(ignorePermissionErrors)) goto LA6_;
				reraiseException();
			}
			LA6_: ;
			popCurrentException();
		}
	}
	if (TM__yu6cxgKBBXbNsTkT9cyMd4g_28.status != 0) reraiseException();
}
N_LIB_PRIVATE N_NIMCALL(NI, nosexecShellCmd)(NimStringDesc* command) {
	NI result;
	int T1_;
	int T2_;
	result = (NI)0;
	T1_ = (int)0;
	T1_ = system(nimToCStringConv(command));
	T2_ = (int)0;
	T2_ = exitStatusLikeShell__pureZos_1101(T1_);
	result = ((NI) (T2_));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatslibatspureatsosdotnim_DatInit000)(void) {
static TNimNode* TM__yu6cxgKBBXbNsTkT9cyMd4g_29_9[9];
NI TM__yu6cxgKBBXbNsTkT9cyMd4g_31;
static char* NIM_CONST TM__yu6cxgKBBXbNsTkT9cyMd4g_30[9] = {
"fpUserExec", 
"fpUserWrite", 
"fpUserRead", 
"fpGroupExec", 
"fpGroupWrite", 
"fpGroupRead", 
"fpOthersExec", 
"fpOthersWrite", 
"fpOthersRead"};
static TNimNode TM__yu6cxgKBBXbNsTkT9cyMd4g_0[10];
NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.size = sizeof(tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA);
NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.align = NIM_ALIGNOF(tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA);
NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.kind = 14;
NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.base = 0;
NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.flags = 3;
for (TM__yu6cxgKBBXbNsTkT9cyMd4g_31 = 0; TM__yu6cxgKBBXbNsTkT9cyMd4g_31 < 9; TM__yu6cxgKBBXbNsTkT9cyMd4g_31++) {
TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_31+0].kind = 1;
TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_31+0].offset = TM__yu6cxgKBBXbNsTkT9cyMd4g_31;
TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_31+0].name = TM__yu6cxgKBBXbNsTkT9cyMd4g_30[TM__yu6cxgKBBXbNsTkT9cyMd4g_31];
TM__yu6cxgKBBXbNsTkT9cyMd4g_29_9[TM__yu6cxgKBBXbNsTkT9cyMd4g_31] = &TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_31+0];
}
TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9].len = 9; TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9].kind = 2; TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9].sons = &TM__yu6cxgKBBXbNsTkT9cyMd4g_29_9[0];
NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.node = &TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9];
}

