/* Generated by Nim Compiler v1.2.4 */
/*   (c) 2020 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks

#include "nimbase.h"
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <errno.h>
#include <sys/wait.h>
#include <setjmp.h>
#include <dirent.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_IndexError__K39aEGuwNdydKn2WFEpUygg tyObject_IndexError__K39aEGuwNdydKn2WFEpUygg;
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__7q7q3E6Oj24ZNVJb9aonhAg tyTuple__7q7q3E6Oj24ZNVJb9aonhAg;
typedef struct tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
typedef struct tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA;
typedef struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA;
typedef struct tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw;
typedef struct tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg;
typedef struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ;
typedef struct tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q;
typedef struct TSafePoint TSafePoint;
typedef struct tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA;
typedef struct tyTuple__flePlH29a9c9cGo1Wdll1KDOQ tyTuple__flePlH29a9c9cGo1Wdll1KDOQ;
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;
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;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
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__SiRwrEKZdLgxqz9a9aoVBglg[512];
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__SiRwrEKZdLgxqz9a9aoVBglg 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_IndexError__K39aEGuwNdydKn2WFEpUygg {
  tyObject_Defect__LbeSGvgPzGzXnW9caIkJqMA Sup;
};
typedef NU8 tySet_tyChar__nmiMWKVIe46vacnhAFrQvw[32];
struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA {
  Exception Sup;
};
struct tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA {
  tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
NI32 errorCode;
};
typedef NU8 tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg;
struct tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw {
  tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
};
struct tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg {
NI i;
NI prev;
NIM_BOOL notFirst;
};
struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ {
NI Field0;
NI Field1;
};
struct tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q {
NI64 seconds;
NI nanosecond;
};
typedef NU8 tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg;
struct TSafePoint {
TSafePoint* prev;
NI status;
jmp_buf context;
};
typedef NU16 tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA;
typedef NU8 tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA;
struct tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA {
NimStringDesc* Field0;
tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA Field1;
};
typedef NIM_CHAR tyArray__dTlC27m9c9aWd5dvuePYanug[256];
struct tyTuple__flePlH29a9c9cGo1Wdll1KDOQ {
NimStringDesc* Field0;
NimStringDesc* Field1;
NCSTRING Field2;
};
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(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, Marker_tySequence__sM4lkSb7zS6F7OVMvW9cffQ)(void* p, NI op);
static N_NIMCALL(void, TM__yu6cxgKBBXbNsTkT9cyMd4g_2)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimRegisterThreadLocalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newLen);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
static N_INLINE(NIM_BOOL, nimAddInt)(NI a, NI b, NI* res);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
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__AT1eRuflKWyTTBdLjEDZbgsystem)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, minuspercent___dgYAo7RfdUVVpvkfKDym8w_2system)(NI x, NI y);
static N_INLINE(NIM_BOOL, ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem)(NI x, NI y);
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__Y66tOYFjgwJ0k4aLz4bc0Q)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr);
static N_INLINE(NIM_BOOL, nimSubInt)(NI a, NI b, NI* res);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str);
N_LIB_PRIVATE N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nimIntToStr)(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__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, pluspercent___dgYAo7RfdUVVpvkfKDym8wsystem)(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__dubrHoRt3C9a0HlJjsxM5ig)(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_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i, NI64 a, NI64 b);
N_LIB_PRIVATE N_NIMCALL(void, joinPathImpl__zwiv42T0z9bOei4bjr58A9cA)(NimStringDesc** result, NI* state, NimStringDesc* tail);
static N_INLINE(NIM_CHAR, X5BX5D___okzHJ6GE9cv0bYG3b4r5KCAsystem)(NimStringDesc* s, NI i);
N_LIB_PRIVATE N_NIMCALL(void, normalizePathEnd__gKUeJXj8CrWvxdeNCA2BXg)(NimStringDesc** path, NIM_BOOL trailingSep);
N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_LIB_PRIVATE N_NIMCALL(void, addNormalizePath__bx9csIXjBBeHkYSkIUixO1g)(NimStringDesc* x, NimStringDesc** result, NI* state, NIM_CHAR dirSep);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getEnv__hhED57tMl0Iaa5bOg9cJaig)(NimStringDesc* key, NimStringDesc* default_0);
N_LIB_PRIVATE N_NIMCALL(NI, findEnvVar__4kc4cxzsC7aY1IOKtOGazA)(NimStringDesc* key);
N_LIB_PRIVATE N_NIMCALL(void, getEnvVarsC__580467zYn32AEdYj9cD4LLA)(void);
static N_INLINE(NIM_BOOL, eqeq___aqip9cmQIuefPKdd25wuEEwsystem)(NCSTRING x, NCSTRING y);
static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__iGg0RIKceRvsmvq8FUHOEw)(NimStringDesc* s, NI first);
N_LIB_PRIVATE N_NIMCALL(NI, nsuFindChar)(NimStringDesc* s, NIM_CHAR sub, NI start, NI last);
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normalizePath__gol9aBbIZpJYUPc6xBOBJDQ)(NimStringDesc* path, NIM_CHAR dirSep);
N_LIB_PRIVATE N_NIMCALL(NI, cmp__NAicU5bAGXmkx2NJujGi7g)(NimStringDesc* x, NimStringDesc* y);
N_LIB_PRIVATE N_NIMCALL(NI, nsuCmpIgnoreCase)(NimStringDesc* a, NimStringDesc* b);
N_LIB_PRIVATE N_NOINLINE(void, chckNil)(void* p);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__2yh9cer0ymNRHlOOg8P7IuA)(NimStringDesc* s, NI first, NI last);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetHomeDir)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, slash___gEyhbzZ1UcxyenWRLJRXNQ)(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*, getApplAux__wpMsAlcjbgVsRya70vX0Ug)(NimStringDesc* procPath);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getApplHeuristic__9bfzMt7nzg9apH9cE9c5SozLJw)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, paramStr__T0ST6UXXTEqaiXY9akIayng)(NI i);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__9bUWNxbcGnToMWA9b79aTXLIw)(void);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg);
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__CWyPYlyH9a6rAuZckFyVxPA)(NI32 errorCode, NimStringDesc* additionalInfo);
N_LIB_PRIVATE N_NOINLINE(tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*, newOSError__JXEuze9ctNbkn51HYBflQLg)(NI32 errorCode, NimStringDesc* additionalInfo);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, osErrorMsg__33xViSVWAmDrexoKkLfMhg)(NI32 errorCode);
N_LIB_PRIVATE N_NIMCALL(void, addQuoted__45fPtFhY4FavRaYwDhRfuA)(NimStringDesc** s, NimStringDesc* x);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normalizePathEnd__cQ9bfE8YwK2s9aQkxFkMKhYg)(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(NI, parentDirPos__sw9aya5BvknC6WiJX9aEYn9ag)(NimStringDesc* path);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
static N_INLINE(NIM_BOOL, equalMem__9bGgqEk7RXXl6eqM9c1HdELAsystem)(void* a, void* b, NI size);
static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosexistsOrCreateDir)(NimStringDesc* dir);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, rawCreateDir__GHseAa61lv8Sp9b2kQD9baYQ)(NimStringDesc* dir);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosexistsDir)(NimStringDesc* dir);
N_LIB_PRIVATE N_NIMCALL(NI, searchExtPos__sw9aya5BvknC6WiJX9aEYn9ag_2)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normExt__5YE1ExrSIVKLWtBPQtnFCw)(NimStringDesc* ext);
static N_INLINE(void, normalizePathAux__Vd3ai1bzXYPREMwN8HbsmQos)(NimStringDesc** path);
N_LIB_PRIVATE N_NIMCALL(void, nosnormalizePath)(NimStringDesc** path);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasNext__ecfBf9bSnUlnf5OQ0NQMxpQ)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg it, NimStringDesc* x);
N_LIB_PRIVATE N_NIMCALL(tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ, next__am1q4dBd9cls9au5CcmkX5oA)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg* it, NimStringDesc* x);
static N_INLINE(NIM_BOOL, contains__Pa9a8m0kZYH6LC8N1EcZJdQsystem)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item);
static N_INLINE(NI, find__31wM5Ui9c8jnrQ5QD4oPxOQsystem)(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__RmQRR8GLDFICboxWoCEpMw)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, checkSymlink__K8A5Y9b9bcyjk7pehBjrT8Kw)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosparentDir)(NimStringDesc* path);
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);
static N_INLINE(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, toTime__ijMjyFbtGRbszYH28YzkiQos)(struct timespec ts);
N_LIB_PRIVATE N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, initTime__JIXNH9cQMG3SbZ0hXqEYDvA)(NI64 unix_0, NI nanosecond);
N_LIB_PRIVATE N_NIMCALL(void, noscopyFile)(NimStringDesc* source, NimStringDesc* dest);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, open__gq12VLhVO0NBzUTnGgz4nw)(FILE** f, NimStringDesc* filename, tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg mode, NI bufSize);
N_LIB_PRIVATE N_NIMCALL(void, close__fU6ZlJAtQ9bre04EDZLdGsA_3)(FILE* f);
N_LIB_PRIVATE N_NOCONV(void*, allocImpl__WrVG9abV9chlTLqkiXYLKwUg_2)(NI size);
N_LIB_PRIVATE N_NIMCALL(NI, readBuffer__Y9atVWUcVyKHG9aBP4D0P9czA_2)(FILE* f, void* buffer, NI len);
N_LIB_PRIVATE N_NIMCALL(NI, writeBuffer__Y9atVWUcVyKHG9aBP4D0P9czA)(FILE* f, void* buffer, NI len);
N_LIB_PRIVATE N_NOCONV(void, deallocImpl__lmwgHsdhTsrQaepFju8wew)(void* p);
N_LIB_PRIVATE N_NIMCALL(void, flushFile__fU6ZlJAtQ9bre04EDZLdGsA_2)(FILE* f);
static N_INLINE(void, pushSafePoint)(TSafePoint* s);
N_LIB_PRIVATE N_NIMCALL(void, nossetFilePermissions)(NimStringDesc* filename, tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA permissions);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___VhyooW9cjC7wNKZM71oRg9cg)(tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA x);
N_LIB_PRIVATE N_NIMCALL(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA, nosgetFilePermissions)(NimStringDesc* filename);
static N_INLINE(void, popSafePoint)(void);
N_LIB_PRIVATE N_NIMCALL(void, reraiseException)(void);
static N_INLINE(void, popCurrentException)(void);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nostryRemoveFile)(NimStringDesc* file);
static N_INLINE(NIM_BOOL, dirExists__AWUc3v8Mlad7tvNYF3Ak8Qos)(NimStringDesc* dir);
N_LIB_PRIVATE N_NIMCALL(void, nosremoveFile)(NimStringDesc* file);
N_LIB_PRIVATE N_NIMCALL(void, nosremoveDir)(NimStringDesc* dir, NIM_BOOL checkDir);
N_LIB_PRIVATE N_NIMCALL(tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg, getSymlinkFileKind__wTnLPNAWjgwVnuiJ9ax0ZGQ)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(void, nimLeaveFinally)(void);
N_LIB_PRIVATE N_NIMCALL(void, rawRemoveDir__wSIx0z80fCn9axX6xdRqD8Q)(NimStringDesc* dir);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, tryMoveFSObject__43wKg5fKy6XSTFw35EBkzA)(NimStringDesc* source, NimStringDesc* dest);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___uRqZ9b9aRtL1gygwVfSa9bmlQ)(tyTuple__flePlH29a9c9cGo1Wdll1KDOQ x);
N_LIB_PRIVATE N_NIMCALL(void, noscopyDir)(NimStringDesc* source, NimStringDesc* dest);
N_LIB_PRIVATE N_NIMCALL(void, noscreateDir)(NimStringDesc* dir);
N_LIB_PRIVATE N_NIMCALL(void, delete__FxJSSlM1HtYUBJdvsqL6Sg)(tySequence__sM4lkSb7zS6F7OVMvW9cffQ** x, NI i);
N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__vmXOHpv9cjOB5AHi6OOlhbw)(int status);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosrelativePath)(NimStringDesc* path, NimStringDesc* base, NIM_CHAR sep);
extern TNimType NTI__77mFvmsOLKik79ci2hXkHEg_;
N_LIB_PRIVATE TNimType NTI__sM4lkSb7zS6F7OVMvW9cffQ_;
extern TNimType NTI__9bTGS9b5gqA3m1IgV71Csl0Q_;
extern TNimType NTI__K39aEGuwNdydKn2WFEpUygg_;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_10, "index out of bounds, the container is empty", 43);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_11, "index ", 6);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_12, " not in 0 .. ", 13);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_14, "\'\'", 2);
static NIM_CONST tySet_tyChar__nmiMWKVIe46vacnhAFrQvw TM__yu6cxgKBBXbNsTkT9cyMd4g_15 = {
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_16, "\'", 1);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_17, "\'\"\'\"\'", 5);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_18, " ", 1);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_27, "/", 1);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_31, "HOME", 4);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_45, "/proc/self/exe", 14);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_46, "PATH", 4);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_51, "os.nim(1346, 19) `bufsize >= 0` ", 32);
extern TNimType NTI__9clYsYwyjCqe2PFTuCI3Ubg_;
extern TNimType NTI__BeJgrOdDsczOwEWOZbRfKA_;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_52, "Additional info: ", 17);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_53, "unknown OS error", 16);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_55, "os.nim(2021, 11) `path != \"\"` ", 30);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_59, "..", 2);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_60, ".", 1);
extern TNimType NTI__HMIVdYjdZYWskTmTQVo5BQ_;
extern TNimType NTI__iLZrPn9anoh9ad1MmO0RczFw_;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_62, "Failed to create \'", 18);
static NIM_CONST tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ TM__yu6cxgKBBXbNsTkT9cyMd4g_68 = {((NI) 0),
((NI) -1)}
;
N_LIB_PRIVATE TNimType NTI__uTVeDpjCH6aWw9c74YkAskA_;
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_94, "XDG_CONFIG_HOME", 15);
STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_95, ".config", 7);
N_LIB_PRIVATE NIM_BOOL envComputed__LLyFo9bsdu1ZXMDvAe8DhrQ;
N_LIB_PRIVATE tySequence__sM4lkSb7zS6F7OVMvW9cffQ* environment__mlhK49b6YMgc9cgrcYkKq9a3g;
extern NCSTRING* environ;
extern int cmdCount;
extern NCSTRING* cmdLine;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__IcYaEuuWivYAS86vFMTS3Q;
extern TSafePoint* excHandler__rqLlY5bs9atDw2OXYqJEn5g;
extern TSafePoint* excHandler__rqLlY5bs9atDw2OXYqJEn5g;
extern TSafePoint* excHandler__rqLlY5bs9atDw2OXYqJEn5g;
extern TSafePoint* excHandler__rqLlY5bs9atDw2OXYqJEn5g;
extern Exception* currException__9bVPeDJlYTi9bQApZpfH8wjg;
extern Exception* currException__9bVPeDJlYTi9bQApZpfH8wjg;
static N_NIMCALL(void, Marker_tySequence__sM4lkSb7zS6F7OVMvW9cffQ)(void* p, NI op) {
	tySequence__sM4lkSb7zS6F7OVMvW9cffQ* a;
	NI T1_;
	a = (tySequence__sM4lkSb7zS6F7OVMvW9cffQ*)p;
	T1_ = (NI)0;
	for (T1_ = 0; T1_ < (a ? a->Sup.len : 0); T1_++) {
	nimGCvisit((void*)a->data[T1_], op);
	}
}
static N_NIMCALL(void, TM__yu6cxgKBBXbNsTkT9cyMd4g_2)(void) {
	nimGCvisit((void*)environment__mlhK49b6YMgc9cgrcYkKq9a3g, 0);
}
static N_INLINE(NIM_BOOL, nimAddInt)(NI a, NI b, NI* res) {
	NIM_BOOL result;
	NI r;
	result = (NIM_BOOL)0;
	r = ((NI) ((NU)((NU64)(((NU) (a))) + (NU64)(((NU) (b))))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 0) <= (NI)(r ^ a));
		if (T3_) goto LA4_;
		T3_ = (((NI) 0) <= (NI)(r ^ b));
		LA4_: ;
		if (!T3_) goto LA5_;
		(*res) = r;
	}
	goto LA1_;
	LA5_: ;
	{
		result = NIM_TRUE;
	}
	LA1_: ;
	return result;
}
static N_INLINE(NI, minuspercent___dgYAo7RfdUVVpvkfKDym8w_2system)(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___hPljn3JCDQ00ua1R07X9bxQsystem)(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__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	addZCT__Y66tOYFjgwJ0k4aLz4bc0Q((&gch__IcYaEuuWivYAS86vFMTS3Q.zct), c);
}
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbgsystem)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = minuspercent___dgYAo7RfdUVVpvkfKDym8w_2system((*c).refcount, ((NI) 8));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem((*c).refcount, ((NI) 8));
		if (!T3_) goto LA4_;
		rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_2system(c);
	}
	LA4_: ;
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr) {
	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
	NI T1_;
	result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
	T1_ = (NI)0;
	T1_ = minuspercent___dgYAo7RfdUVVpvkfKDym8w_2system(((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__QFQqcLB3lgOdwipkv9a60xwsystem(p);
	decRef__AT1eRuflKWyTTBdLjEDZbgsystem(T1_);
}
N_LIB_PRIVATE N_NIMCALL(tySequence__sM4lkSb7zS6F7OVMvW9cffQ*, nosparseCmdLine)(NimStringDesc* c) {
	tySequence__sM4lkSb7zS6F7OVMvW9cffQ* result;
	NI i;
	NimStringDesc* a;
	result = (tySequence__sM4lkSb7zS6F7OVMvW9cffQ*)0;
	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_;
					NI TM__yu6cxgKBBXbNsTkT9cyMd4g_3;
					T5_ = (NIM_BOOL)0;
					T5_ = (i < (c ? c->Sup.len : 0));
					if (!(T5_)) goto LA6_;
					if ((NU)(i) >= (NU)(c ? c->Sup.len : 0)){ raiseIndexError2(i,(c ? c->Sup.len : 0)-1); }
					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;
					if (nimAddInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_3)) { raiseOverflow(); };
					i = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_3);
				} LA4: ;
			}
			{
				if (!((c ? c->Sup.len : 0) <= i)) goto LA9_;
				goto LA1;
			}
			LA9_: ;
			if ((NU)(i) >= (NU)(c ? c->Sup.len : 0)){ raiseIndexError2(i,(c ? c->Sup.len : 0)-1); }
			switch (((NU8)(c->data[i]))) {
			case 39:
			case 34:
			{
				NIM_CHAR delim;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_4;
				if ((NU)(i) >= (NU)(c ? c->Sup.len : 0)){ raiseIndexError2(i,(c ? c->Sup.len : 0)-1); }
				delim = c->data[i];
				if (nimAddInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_4)) { raiseOverflow(); };
				i = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_4);
				{
					while (1) {
						NIM_BOOL T14_;
						NI TM__yu6cxgKBBXbNsTkT9cyMd4g_5;
						T14_ = (NIM_BOOL)0;
						T14_ = (i < (c ? c->Sup.len : 0));
						if (!(T14_)) goto LA15_;
						if ((NU)(i) >= (NU)(c ? c->Sup.len : 0)){ raiseIndexError2(i,(c ? c->Sup.len : 0)-1); }
						T14_ = !(((NU8)(c->data[i]) == (NU8)(delim)));
						LA15_: ;
						if (!T14_) goto LA13;
						if ((NU)(i) >= (NU)(c ? c->Sup.len : 0)){ raiseIndexError2(i,(c ? c->Sup.len : 0)-1); }
						a = addChar(a, c->data[i]);
						if (nimAddInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_5)) { raiseOverflow(); };
						i = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_5);
					} LA13: ;
				}
				{
					NI TM__yu6cxgKBBXbNsTkT9cyMd4g_6;
					if (!(i < (c ? c->Sup.len : 0))) goto LA18_;
					if (nimAddInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_6)) { raiseOverflow(); };
					i = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_6);
				}
				LA18_: ;
			}
			break;
			default:
			{
				{
					while (1) {
						NIM_BOOL T23_;
						NI TM__yu6cxgKBBXbNsTkT9cyMd4g_7;
						T23_ = (NIM_BOOL)0;
						T23_ = (i < (c ? c->Sup.len : 0));
						if (!(T23_)) goto LA24_;
						if ((NU)(i) >= (NU)(c ? c->Sup.len : 0)){ raiseIndexError2(i,(c ? c->Sup.len : 0)-1); }
						T23_ = ((NU8)(32) < (NU8)(c->data[i]));
						LA24_: ;
						if (!T23_) goto LA22;
						if ((NU)(i) >= (NU)(c ? c->Sup.len : 0)){ raiseIndexError2(i,(c ? c->Sup.len : 0)-1); }
						a = addChar(a, c->data[i]);
						if (nimAddInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_7)) { raiseOverflow(); };
						i = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_7);
					} LA22: ;
				}
			}
			break;
			}
			result = (tySequence__sM4lkSb7zS6F7OVMvW9cffQ*) incrSeqV3((TGenericSeq*)(result), (&NTI__sM4lkSb7zS6F7OVMvW9cffQ_));
			T25_ = result->Sup.len++;
			T26_ = (NimStringDesc*)0;
			T26_ = result->data[T25_]; result->data[T25_] = copyStringRC1(a);
			if (T26_) nimGCunrefNoCycle(T26_);
		}
	} LA1: ;
	return result;
}
static N_INLINE(NIM_BOOL, nimSubInt)(NI a, NI b, NI* res) {
	NIM_BOOL result;
	NI r;
	result = (NIM_BOOL)0;
	r = ((NI) ((NU)((NU64)(((NU) (a))) - (NU64)(((NU) (b))))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 0) <= (NI)(r ^ a));
		if (T3_) goto LA4_;
		T3_ = (((NI) 0) <= (NI)(r ^ (NI)((NU64) ~(b))));
		LA4_: ;
		if (!T3_) goto LA5_;
		(*res) = r;
	}
	goto LA1_;
	LA5_: ;
	{
		result = NIM_TRUE;
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, paramCount__LYkRnwMk6UXTCs9c59cPvZsQ)(void) {
	NI result;
	NI TM__yu6cxgKBBXbNsTkT9cyMd4g_8;
	result = (NI)0;
	if (nimSubInt(cmdCount, ((NI32) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_8)) { raiseOverflow(); };
	if (TM__yu6cxgKBBXbNsTkT9cyMd4g_8 < (-2147483647 -1) || TM__yu6cxgKBBXbNsTkT9cyMd4g_8 > 2147483647){ raiseOverflow(); }
	result = ((NI) ((NI32)(TM__yu6cxgKBBXbNsTkT9cyMd4g_8)));
	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__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size) {
	nimCopyMem(dest, source, size);
}
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	{
		if (!!((src == NIM_NIL))) goto LA3_;
		copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(((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___dgYAo7RfdUVVpvkfKDym8wsystem)(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__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = pluspercent___dgYAo7RfdUVVpvkfKDym8wsystem((*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__QFQqcLB3lgOdwipkv9a60xwsystem(src);
		incRef__AT1eRuflKWyTTBdLjEDZbg_3system(T5_);
	}
	LA3_: ;
	{
		tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T10_;
		if (!!(((*dest) == NIM_NIL))) goto LA8_;
		T10_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
		T10_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem((*dest));
		decRef__AT1eRuflKWyTTBdLjEDZbgsystem(T10_);
	}
	LA8_: ;
	(*dest) = src;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, paramStr__T0ST6UXXTEqaiXY9akIayng)(NI i) {
	NimStringDesc* result;
	tyObject_IndexError__K39aEGuwNdydKn2WFEpUygg* T7_;
{	result = (NimStringDesc*)0;
	{
		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 BeforeRet_;
	}
	LA5_: ;
	T7_ = (tyObject_IndexError__K39aEGuwNdydKn2WFEpUygg*)0;
	T7_ = (tyObject_IndexError__K39aEGuwNdydKn2WFEpUygg*) newObj((&NTI__9bTGS9b5gqA3m1IgV71Csl0Q_), sizeof(tyObject_IndexError__K39aEGuwNdydKn2WFEpUygg));
	(*T7_).Sup.Sup.Sup.m_type = (&NTI__K39aEGuwNdydKn2WFEpUygg_);
	(*T7_).Sup.Sup.name = "IndexError";
	{
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_9;
		NimStringDesc* T12_;
		if (nimSubInt(cmdCount, ((NI32) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_9)) { raiseOverflow(); };
		if (TM__yu6cxgKBBXbNsTkT9cyMd4g_9 < (-2147483647 -1) || TM__yu6cxgKBBXbNsTkT9cyMd4g_9 > 2147483647){ raiseOverflow(); }
		if (!((NI32)(TM__yu6cxgKBBXbNsTkT9cyMd4g_9) < ((NI32) 0))) goto LA10_;
		T12_ = (NimStringDesc*)0;
		T12_ = (*T7_).Sup.Sup.message; (*T7_).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_10));
		if (T12_) nimGCunrefNoCycle(T12_);
	}
	goto LA8_;
	LA10_: ;
	{
		NimStringDesc* T14_;
		NimStringDesc* T15_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_13;
		NimStringDesc* T16_;
		T14_ = (NimStringDesc*)0;
		T15_ = (NimStringDesc*)0;
		T15_ = nimIntToStr(i);
		if (nimSubInt(cmdCount, ((NI32) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_13)) { raiseOverflow(); };
		if (TM__yu6cxgKBBXbNsTkT9cyMd4g_13 < (-2147483647 -1) || TM__yu6cxgKBBXbNsTkT9cyMd4g_13 > 2147483647){ raiseOverflow(); }
		T16_ = (NimStringDesc*)0;
		T16_ = nimIntToStr(((NI) ((NI32)(TM__yu6cxgKBBXbNsTkT9cyMd4g_13))));
		T14_ = rawNewString((T15_ ? T15_->Sup.len : 0) + (T16_ ? T16_->Sup.len : 0) + 19);
appendString(T14_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11));
appendString(T14_, T15_);
appendString(T14_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_12));
appendString(T14_, T16_);
		asgnRef((void**) (&(*T7_).Sup.Sup.message), T14_);
	}
	LA8_: ;
	asgnRef((void**) (&(*T7_).Sup.Sup.parent), NIM_NIL);
	raiseExceptionEx((Exception*)T7_, "IndexError", "paramStr", "os.nim", 2738);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShellPosix)(NimStringDesc* s) {
	NimStringDesc* result;
	NIM_BOOL safe;
{	result = (NimStringDesc*)0;
	{
		if (!((s ? s->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = copyString(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_14));
		goto BeforeRet_;
	}
	LA3_: ;
	safe = allCharsInSet__dubrHoRt3C9a0HlJjsxM5ig(s, TM__yu6cxgKBBXbNsTkT9cyMd4g_15);
	{
		if (!safe) goto LA7_;
		result = copyString(s);
		goto BeforeRet_;
	}
	goto LA5_;
	LA7_: ;
	{
		NimStringDesc* T10_;
		NimStringDesc* T11_;
		T10_ = (NimStringDesc*)0;
		T11_ = (NimStringDesc*)0;
		T11_ = nsuReplaceStr(s, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_16), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17));
		T10_ = rawNewString((T11_ ? T11_->Sup.len : 0) + 2);
appendString(T10_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_16));
appendString(T10_, T11_);
appendString(T10_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_16));
		result = T10_;
		goto BeforeRet_;
	}
	LA5_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShell)(NimStringDesc* s) {
	NimStringDesc* result;
{	result = (NimStringDesc*)0;
	result = nospquoteShellPosix(s);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	result = copyString(path);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, quoteShellCommand__hx0vnRJdI6UdpIN1CeQHNw)(NimStringDesc** args, NI argsLen_0) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	{
		NI i;
		NI colontmp_;
		NI i_2;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = argsLen_0;
		i_2 = ((NI) 0);
		{
			while (1) {
				NimStringDesc* T8_;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_19;
				if (!(i_2 < colontmp_)) goto LA3;
				i = i_2;
				{
					if (!(((NI) 0) < i)) goto LA6_;
					result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_18));
				}
				LA6_: ;
				if ((NU)(i) >= (NU)(argsLen_0)){ raiseIndexError2(i,argsLen_0-1); }
				T8_ = (NimStringDesc*)0;
				T8_ = nospquoteShell(args[i]);
				result = resizeString(result, (T8_ ? T8_->Sup.len : 0) + 0);
appendString(result, T8_);
				if (nimAddInt(i_2, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_19)) { raiseOverflow(); };
				i_2 = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_19);
			} LA3: ;
		}
	}
	return result;
}
static N_INLINE(NIM_CHAR, X5BX5D___okzHJ6GE9cv0bYG3b4r5KCAsystem)(NimStringDesc* s, NI i) {
	NIM_CHAR result;
	NI TM__yu6cxgKBBXbNsTkT9cyMd4g_21;
	result = (NIM_CHAR)0;
	if (nimSubInt((s ? s->Sup.len : 0), i, &TM__yu6cxgKBBXbNsTkT9cyMd4g_21)) { raiseOverflow(); };
	if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_21)) >= (NU)(s ? s->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_21),(s ? s->Sup.len : 0)-1); }
	result = s->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_21)];
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, normalizePathEnd__gKUeJXj8CrWvxdeNCA2BXg)(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;
			{
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_22;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_23;
				if (nimSubInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_22)) { raiseOverflow(); };
				if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_22)) >= (NU)((*path) ? (*path)->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_22),((*path) ? (*path)->Sup.len : 0)-1); }
				if (!(((NU8)((*path)->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_22)])) == ((NU8)(47)) || ((NU8)((*path)->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_22)])) == ((NU8)(47)))) goto LA9_;
				if (nimSubInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_23)) { raiseOverflow(); };
				i = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_23);
			}
			goto LA7_;
			LA9_: ;
			{
				NIM_BOOL T12_;
				NIM_BOOL T13_;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_24;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_25;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_26;
				T12_ = (NIM_BOOL)0;
				T13_ = (NIM_BOOL)0;
				if (nimSubInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_24)) { raiseOverflow(); };
				if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_24)) >= (NU)((*path) ? (*path)->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_24),((*path) ? (*path)->Sup.len : 0)-1); }
				T13_ = ((NU8)((*path)->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_24)]) == (NU8)(46));
				if (!(T13_)) goto LA14_;
				T13_ = (((NI) 2) <= i);
				LA14_: ;
				T12_ = T13_;
				if (!(T12_)) goto LA15_;
				if (nimSubInt(i, ((NI) 2), &TM__yu6cxgKBBXbNsTkT9cyMd4g_25)) { raiseOverflow(); };
				if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_25)) >= (NU)((*path) ? (*path)->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_25),((*path) ? (*path)->Sup.len : 0)-1); }
				T12_ = (((NU8)((*path)->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_25)])) == ((NU8)(47)) || ((NU8)((*path)->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_25)])) == ((NU8)(47)));
				LA15_: ;
				if (!T12_) goto LA16_;
				if (nimSubInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_26)) { raiseOverflow(); };
				i = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_26);
			}
			goto LA7_;
			LA16_: ;
			{
				goto LA5;
			}
			LA7_: ;
		} LA6: ;
	} LA5: ;
	{
		if (!trailingSep) goto LA21_;
		if ((i) < ((NI) 0) || (i) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(i, ((NI) 0), ((NI) IL64(9223372036854775807))); }
		unsureAsgnRef((void**) (&(*path)), setLengthStr((*path), ((NI) (i))));
		unsureAsgnRef((void**) (&(*path)), addChar((*path), 47));
	}
	goto LA19_;
	LA21_: ;
	{
		if (!(((NI) 0) < i)) goto LA24_;
		if ((i) < ((NI) 0) || (i) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(i, ((NI) 0), ((NI) IL64(9223372036854775807))); }
		unsureAsgnRef((void**) (&(*path)), setLengthStr((*path), ((NI) (i))));
	}
	goto LA19_;
	LA24_: ;
	{
		unsureAsgnRef((void**) (&(*path)), copyString(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_27)));
	}
	LA19_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, joinPathImpl__zwiv42T0z9bOei4bjr58A9cA)(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___okzHJ6GE9cv0bYG3b4r5KCAsystem(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___okzHJ6GE9cv0bYG3b4r5KCAsystem((*result), ((NI) 1));
	T8_ = (((NU8)(T10_)) == ((NU8)(47)) || ((NU8)(T10_)) == ((NU8)(47)));
	LA9_: ;
	T6_ = T8_;
	LA7_: ;
	T1_ = T6_;
	LA5_: ;
	trailingSep = T1_;
	normalizePathEnd__gKUeJXj8CrWvxdeNCA2BXg(result, NIM_FALSE);
	addNormalizePath__bx9csIXjBBeHkYSkIUixO1g(tail, result, state, 47);
	normalizePathEnd__gKUeJXj8CrWvxdeNCA2BXg(result, trailingSep);
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail) {
	NimStringDesc* result;
	NI TM__yu6cxgKBBXbNsTkT9cyMd4g_20;
	NI state;
	result = (NimStringDesc*)0;
	if (nimAddInt((head ? head->Sup.len : 0), (tail ? tail->Sup.len : 0), &TM__yu6cxgKBBXbNsTkT9cyMd4g_20)) { raiseOverflow(); };
	if (((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_20)) < ((NI) 0) || ((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_20)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_20), ((NI) 0), ((NI) IL64(9223372036854775807))); }
	result = rawNewString(((NI) ((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_20))));
	state = ((NI) 0);
	joinPathImpl__zwiv42T0z9bOei4bjr58A9cA((&result), (&state), head);
	joinPathImpl__zwiv42T0z9bOei4bjr58A9cA((&result), (&state), tail);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, slash___gEyhbzZ1UcxyenWRLJRXNQ)(NimStringDesc* head, NimStringDesc* tail) {
	NimStringDesc* result;
{	result = (NimStringDesc*)0;
	result = nosjoinPath(head, tail);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_BOOL, eqeq___aqip9cmQIuefPKdd25wuEEwsystem)(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;
}
N_LIB_PRIVATE N_NIMCALL(void, getEnvVarsC__580467zYn32AEdYj9cD4LLA)(void) {
	{
		NI i;
		if (!!(envComputed__LLyFo9bsdu1ZXMDvAe8DhrQ)) goto LA3_;
		if (environment__mlhK49b6YMgc9cgrcYkKq9a3g) { nimGCunrefNoCycle(environment__mlhK49b6YMgc9cgrcYkKq9a3g); environment__mlhK49b6YMgc9cgrcYkKq9a3g = NIM_NIL; }
		i = ((NI) 0);
		{
			while (1) {
				NimStringDesc* T12_;
				NI T13_;
				NimStringDesc* T14_;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_28;
				{
					NIM_BOOL T9_;
					T9_ = (NIM_BOOL)0;
					T9_ = eqeq___aqip9cmQIuefPKdd25wuEEwsystem(environ[i], NIM_NIL);
					if (!T9_) goto LA10_;
					goto LA5;
				}
				LA10_: ;
				T12_ = (NimStringDesc*)0;
				T12_ = cstrToNimstr(environ[i]);
				asgnRef((void**) (&environment__mlhK49b6YMgc9cgrcYkKq9a3g), (tySequence__sM4lkSb7zS6F7OVMvW9cffQ*) incrSeqV3((TGenericSeq*)(environment__mlhK49b6YMgc9cgrcYkKq9a3g), (&NTI__sM4lkSb7zS6F7OVMvW9cffQ_)));
				T13_ = environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len++;
				T14_ = (NimStringDesc*)0;
				T14_ = environment__mlhK49b6YMgc9cgrcYkKq9a3g->data[T13_]; environment__mlhK49b6YMgc9cgrcYkKq9a3g->data[T13_] = copyStringRC1(T12_);
				if (T14_) nimGCunrefNoCycle(T14_);
				if (nimAddInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_28)) { raiseOverflow(); };
				i = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_28);
			}
		} LA5: ;
		envComputed__LLyFo9bsdu1ZXMDvAe8DhrQ = NIM_TRUE;
	}
	LA3_: ;
}
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(NI, findEnvVar__4kc4cxzsC7aY1IOKtOGazA)(NimStringDesc* key) {
	NI result;
	NimStringDesc* temp;
	NimStringDesc* T1_;
{	result = (NI)0;
	getEnvVarsC__580467zYn32AEdYj9cD4LLA();
	T1_ = (NimStringDesc*)0;
	T1_ = rawNewString((key ? key->Sup.len : 0) + 1);
appendString(T1_, key);
appendChar(T1_, 61);
	temp = T1_;
	{
		NI i;
		NI colontmp_;
		NI T3_;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		T3_ = ((environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)-1);
		colontmp_ = T3_;
		res = ((NI) 0);
		{
			while (1) {
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_29;
				if (!(res <= colontmp_)) goto LA5;
				i = res;
				{
					NIM_BOOL T8_;
					if ((NU)(i) >= (NU)(environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)){ raiseIndexError2(i,(environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)-1); }
					T8_ = (NIM_BOOL)0;
					T8_ = nsuStartsWith(environment__mlhK49b6YMgc9cgrcYkKq9a3g->data[i], temp);
					if (!T8_) goto LA9_;
					result = i;
					goto BeforeRet_;
				}
				LA9_: ;
				if (nimAddInt(res, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_29)) { raiseOverflow(); };
				res = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_29);
			} LA5: ;
		}
	}
	result = ((NI) -1);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s) {
	NCSTRING result;
	result = (NCSTRING)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (s == 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(NimStringDesc*, getEnv__hhED57tMl0Iaa5bOg9cJaig)(NimStringDesc* key, NimStringDesc* default_0) {
	NimStringDesc* result;
	NI i;
{	result = (NimStringDesc*)0;
	i = findEnvVar__4kc4cxzsC7aY1IOKtOGazA(key);
	{
		NI T5_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_30;
		if (!(((NI) 0) <= i)) goto LA3_;
		if ((NU)(i) >= (NU)(environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)){ raiseIndexError2(i,(environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)-1); }
		if ((NU)(i) >= (NU)(environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)){ raiseIndexError2(i,(environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)-1); }
		T5_ = (NI)0;
		T5_ = nsuFindChar(environment__mlhK49b6YMgc9cgrcYkKq9a3g->data[i], 61, ((NI) 0), ((NI) 0));
		if (nimAddInt(T5_, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_30)) { raiseOverflow(); };
		result = substr__iGg0RIKceRvsmvq8FUHOEw(environment__mlhK49b6YMgc9cgrcYkKq9a3g->data[i], (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_30));
		goto BeforeRet_;
	}
	goto LA1_;
	LA3_: ;
	{
		NCSTRING env;
		env = getenv(nimToCStringConv(key));
		{
			NIM_BOOL T9_;
			T9_ = (NIM_BOOL)0;
			T9_ = eqeq___aqip9cmQIuefPKdd25wuEEwsystem(env, NIM_NIL);
			if (!T9_) goto LA10_;
			result = copyString(default_0);
			goto BeforeRet_;
		}
		LA10_: ;
		result = cstrToNimstr(env);
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetHomeDir)(void) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	NimStringDesc* T2_;
{	result = (NimStringDesc*)0;
	T1_ = (NimStringDesc*)0;
	T2_ = (NimStringDesc*)0;
	T2_ = getEnv__hhED57tMl0Iaa5bOg9cJaig(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_31), ((NimStringDesc*) NIM_NIL));
	T1_ = rawNewString((T2_ ? T2_->Sup.len : 0) + 1);
appendString(T1_, T2_);
appendString(T1_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_27));
	result = T1_;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, noscmpPaths)(NimStringDesc* pathA, NimStringDesc* pathB) {
	NI result;
	NimStringDesc* a;
	NimStringDesc* b;
	result = (NI)0;
	a = normalizePath__gol9aBbIZpJYUPc6xBOBJDQ(pathA, 47);
	b = normalizePath__gol9aBbIZpJYUPc6xBOBJDQ(pathB, 47);
	{
		if (!NIM_TRUE) goto LA3_;
		result = cmp__NAicU5bAGXmkx2NJujGi7g(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;
	chckNil((void*)Result);
	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 TM__yu6cxgKBBXbNsTkT9cyMd4g_32;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		if (nimSubInt((path ? path->Sup.len : 0), ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_32)) { raiseOverflow(); };
		colontmp_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_32);
		res = colontmp_;
		{
			while (1) {
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_39;
				if (!(((NI) 0) <= res)) goto LA3;
				i = res;
				{
					NIM_BOOL T6_;
					T6_ = (NIM_BOOL)0;
					if ((NU)(i) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(i,(path ? path->Sup.len : 0)-1); }
					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_;
						NI TM__yu6cxgKBBXbNsTkT9cyMd4g_34;
						if ((NU)(i) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(i,(path ? path->Sup.len : 0)-1); }
						if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA12_;
						T14_ = (NI)0;
						{
							NIM_BOOL T17_;
							NI TM__yu6cxgKBBXbNsTkT9cyMd4g_33;
							T17_ = (NIM_BOOL)0;
							T17_ = NIM_LIKELY((((NI) 1) <= i));
							if (!T17_) goto LA18_;
							if (nimSubInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_33)) { raiseOverflow(); };
							T14_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_33);
						}
						goto LA15_;
						LA18_: ;
						{
							T14_ = ((NI) 0);
						}
						LA15_: ;
						unsureAsgnRef((void**) (&(*Result).Field0), substr__2yh9cer0ymNRHlOOg8P7IuA(path, ((NI) 0), T14_));
						if (nimAddInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_34)) { raiseOverflow(); };
						namePos = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_34);
					}
					LA12_: ;
					{
						NI TM__yu6cxgKBBXbNsTkT9cyMd4g_35;
						if (!(i < dotPos)) goto LA23_;
						if (nimSubInt(dotPos, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_35)) { raiseOverflow(); };
						unsureAsgnRef((void**) (&(*Result).Field1), substr__2yh9cer0ymNRHlOOg8P7IuA(path, namePos, (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_35)));
						unsureAsgnRef((void**) (&(*Result).Field2), substr__iGg0RIKceRvsmvq8FUHOEw(path, dotPos));
					}
					goto LA21_;
					LA23_: ;
					{
						unsureAsgnRef((void**) (&(*Result).Field1), substr__iGg0RIKceRvsmvq8FUHOEw(path, namePos));
					}
					LA21_: ;
					goto LA1;
				}
				goto LA4_;
				LA8_: ;
				{
					NIM_BOOL T27_;
					NIM_BOOL T28_;
					NIM_BOOL T29_;
					NIM_BOOL T30_;
					NIM_BOOL T31_;
					NI TM__yu6cxgKBBXbNsTkT9cyMd4g_36;
					NI TM__yu6cxgKBBXbNsTkT9cyMd4g_37;
					NI TM__yu6cxgKBBXbNsTkT9cyMd4g_38;
					T27_ = (NIM_BOOL)0;
					T28_ = (NIM_BOOL)0;
					T29_ = (NIM_BOOL)0;
					T30_ = (NIM_BOOL)0;
					T31_ = (NIM_BOOL)0;
					if ((NU)(i) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(i,(path ? path->Sup.len : 0)-1); }
					T31_ = ((NU8)(path->data[i]) == (NU8)(46));
					if (!(T31_)) goto LA32_;
					T31_ = (((NI) 0) < i);
					LA32_: ;
					T30_ = T31_;
					if (!(T30_)) goto LA33_;
					if (nimSubInt((path ? path->Sup.len : 0), ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_36)) { raiseOverflow(); };
					T30_ = (i < (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_36));
					LA33_: ;
					T29_ = T30_;
					if (!(T29_)) goto LA34_;
					if (nimSubInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_37)) { raiseOverflow(); };
					if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_37)) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_37),(path ? path->Sup.len : 0)-1); }
					T29_ = !((((NU8)(path->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_37)])) == ((NU8)(47)) || ((NU8)(path->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_37)])) == ((NU8)(47))));
					LA34_: ;
					T28_ = T29_;
					if (!(T28_)) goto LA35_;
					if (nimAddInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_38)) { raiseOverflow(); };
					if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_38)) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_38),(path ? path->Sup.len : 0)-1); }
					T28_ = !(((NU8)(path->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_38)]) == (NU8)(46)));
					LA35_: ;
					T27_ = T28_;
					if (!(T27_)) goto LA36_;
					T27_ = (dotPos == ((NI) 0));
					LA36_: ;
					if (!T27_) goto LA37_;
					dotPos = i;
				}
				goto LA4_;
				LA37_: ;
				LA4_: ;
				if (nimSubInt(res, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_39)) { raiseOverflow(); };
				res = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_39);
			} LA3: ;
		}
	} LA1: ;
}
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_: ;
	if ((NU)(((NI) 0)) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(((NI) 0),(path ? path->Sup.len : 0)-1); }
	result = ((NU8)(path->data[((NI) 0)]) == (NU8)(47));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, expandTilde__RmQRR8GLDFICboxWoCEpMw)(NimStringDesc* path) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = ((path ? path->Sup.len : 0) == ((NI) 0));
		if (T3_) goto LA4_;
		if ((NU)(((NI) 0)) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(((NI) 0),(path ? path->Sup.len : 0)-1); }
		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 ((NU)(((NI) 1)) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(((NI) 1),(path ? path->Sup.len : 0)-1); }
		if (!(((NU8)(path->data[((NI) 1)])) == ((NU8)(47)) || ((NU8)(path->data[((NI) 1)])) == ((NU8)(47)))) goto LA11_;
		T13_ = (NimStringDesc*)0;
		T13_ = nosgetHomeDir();
		T14_ = (NimStringDesc*)0;
		T14_ = substr__iGg0RIKceRvsmvq8FUHOEw(path, ((NI) 2));
		result = slash___gEyhbzZ1UcxyenWRLJRXNQ(T13_, T14_);
	}
	goto LA1_;
	LA11_: ;
	{
		result = copyString(path);
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nossplitPath)(NimStringDesc* path, tyTuple__UV3llMMYFckfui8YMBuUZA* Result) {
	NI sepPos;
	chckNil((void*)Result);
	unsureAsgnRef((void**)&(*Result).Field0, NIM_NIL);
	unsureAsgnRef((void**)&(*Result).Field1, NIM_NIL);
	sepPos = ((NI) -1);
	{
		NI i;
		NI colontmp_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_40;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		if (nimSubInt((path ? path->Sup.len : 0), ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_40)) { raiseOverflow(); };
		colontmp_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_40);
		res = colontmp_;
		{
			while (1) {
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_41;
				if (!(((NI) 0) <= res)) goto LA3;
				i = res;
				{
					if ((NU)(i) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(i,(path ? path->Sup.len : 0)-1); }
					if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA6_;
					sepPos = i;
					goto LA1;
				}
				LA6_: ;
				if (nimSubInt(res, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_41)) { raiseOverflow(); };
				res = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_41);
			} LA3: ;
		}
	} LA1: ;
	{
		NI T12_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_43;
		if (!(((NI) 0) <= sepPos)) goto LA10_;
		T12_ = (NI)0;
		{
			NIM_BOOL T15_;
			NI TM__yu6cxgKBBXbNsTkT9cyMd4g_42;
			T15_ = (NIM_BOOL)0;
			T15_ = NIM_LIKELY((((NI) 1) <= sepPos));
			if (!T15_) goto LA16_;
			if (nimSubInt(sepPos, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_42)) { raiseOverflow(); };
			T12_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_42);
		}
		goto LA13_;
		LA16_: ;
		{
			T12_ = ((NI) 0);
		}
		LA13_: ;
		unsureAsgnRef((void**) (&(*Result).Field0), substr__2yh9cer0ymNRHlOOg8P7IuA(path, ((NI) 0), T12_));
		if (nimAddInt(sepPos, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_43)) { raiseOverflow(); };
		unsureAsgnRef((void**) (&(*Result).Field1), substr__iGg0RIKceRvsmvq8FUHOEw(path, (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_43)));
	}
	goto LA8_;
	LA10_: ;
	{
		unsureAsgnRef((void**) (&(*Result).Field0), ((NimStringDesc*) NIM_NIL));
		unsureAsgnRef((void**) (&(*Result).Field1), copyString(path));
	}
	LA8_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getApplAux__wpMsAlcjbgVsRya70vX0Ug)(NimStringDesc* procPath) {
	NimStringDesc* result;
	NI len;
	result = (NimStringDesc*)0;
	result = mnewString(((NI) 256));
	len = readlink(nimToCStringConv(procPath), nimToCStringConv(result), ((NI) 256));
	{
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_44;
		if (!(((NI) 256) < len)) goto LA3_;
		if (nimAddInt(len, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_44)) { raiseOverflow(); };
		if (((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_44)) < ((NI) 0) || ((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_44)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_44), ((NI) 0), ((NI) IL64(9223372036854775807))); }
		result = mnewString(((NI) ((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_44))));
		len = readlink(nimToCStringConv(procPath), nimToCStringConv(result), len);
	}
	LA3_: ;
	if ((len) < ((NI) 0) || (len) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(len, ((NI) 0), ((NI) IL64(9223372036854775807))); }
	result = setLengthStr(result, ((NI) (len)));
	return result;
}
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(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__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosexistsFile)(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*, getApplHeuristic__9bfzMt7nzg9apH9cE9c5SozLJw)(void) {
	NimStringDesc* result;
{	result = (NimStringDesc*)0;
	result = paramStr__T0ST6UXXTEqaiXY9akIayng(((NI) 0));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 0) < (result ? result->Sup.len : 0));
		if (!(T3_)) goto LA4_;
		if ((NU)(((NI) 0)) >= (NU)(result ? result->Sup.len : 0)){ raiseIndexError2(((NI) 0),(result ? result->Sup.len : 0)-1); }
		T3_ = !(((NU8)(result->data[((NI) 0)]) == (NU8)(47)));
		LA4_: ;
		if (!T3_) goto LA5_;
		{
			NimStringDesc* p;
			NimStringDesc* colontmp_;
			NI lastX60gensym12885038_;
			NI splitsX60gensym12885039_;
			p = (NimStringDesc*)0;
			colontmp_ = (NimStringDesc*)0;
			colontmp_ = getEnv__hhED57tMl0Iaa5bOg9cJaig(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_46), ((NimStringDesc*) NIM_NIL));
			lastX60gensym12885038_ = ((NI) 0);
			splitsX60gensym12885039_ = ((NI) -1);
			{
				while (1) {
					NI firstX60gensym12885040_;
					NI TM__yu6cxgKBBXbNsTkT9cyMd4g_48;
					NimStringDesc* x;
					NI TM__yu6cxgKBBXbNsTkT9cyMd4g_49;
					NI TM__yu6cxgKBBXbNsTkT9cyMd4g_50;
					if (!(lastX60gensym12885038_ <= (colontmp_ ? colontmp_->Sup.len : 0))) goto LA9;
					firstX60gensym12885040_ = lastX60gensym12885038_;
					{
						while (1) {
							NIM_BOOL T12_;
							NI TM__yu6cxgKBBXbNsTkT9cyMd4g_47;
							T12_ = (NIM_BOOL)0;
							T12_ = (lastX60gensym12885038_ < (colontmp_ ? colontmp_->Sup.len : 0));
							if (!(T12_)) goto LA13_;
							if ((NU)(lastX60gensym12885038_) >= (NU)(colontmp_ ? colontmp_->Sup.len : 0)){ raiseIndexError2(lastX60gensym12885038_,(colontmp_ ? colontmp_->Sup.len : 0)-1); }
							T12_ = !((((NU8)(colontmp_->data[lastX60gensym12885038_])) == ((NU8)(58))));
							LA13_: ;
							if (!T12_) goto LA11;
							if (nimAddInt(lastX60gensym12885038_, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_47)) { raiseOverflow(); };
							lastX60gensym12885038_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_47);
						} LA11: ;
					}
					{
						if (!(splitsX60gensym12885039_ == ((NI) 0))) goto LA16_;
						lastX60gensym12885038_ = (colontmp_ ? colontmp_->Sup.len : 0);
					}
					LA16_: ;
					if (nimSubInt(lastX60gensym12885038_, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_48)) { raiseOverflow(); };
					p = substr__2yh9cer0ymNRHlOOg8P7IuA(colontmp_, firstX60gensym12885040_, (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_48));
					x = nosjoinPath(p, result);
					{
						NIM_BOOL T20_;
						T20_ = (NIM_BOOL)0;
						T20_ = nosexistsFile(x);
						if (!T20_) goto LA21_;
						result = copyString(x);
						goto BeforeRet_;
					}
					LA21_: ;
					{
						if (!(splitsX60gensym12885039_ == ((NI) 0))) goto LA25_;
						goto LA8;
					}
					LA25_: ;
					if (nimSubInt(splitsX60gensym12885039_, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_49)) { raiseOverflow(); };
					splitsX60gensym12885039_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_49);
					if (nimAddInt(lastX60gensym12885038_, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_50)) { raiseOverflow(); };
					lastX60gensym12885038_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_50);
				} LA9: ;
			} LA8: ;
		}
	}
	LA5_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetAppFilename)(void) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	result = getApplAux__wpMsAlcjbgVsRya70vX0Ug(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_45));
	{
		if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = getApplHeuristic__9bfzMt7nzg9apH9cE9c5SozLJw();
	}
	LA3_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetAppDir)(void) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	tyTuple__7q7q3E6Oj24ZNVJb9aonhAg T2_;
	result = (NimStringDesc*)0;
	T1_ = (NimStringDesc*)0;
	T1_ = nosgetAppFilename();
	nimZeroMem((void*)(&T2_), sizeof(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg));
	nossplitFile(T1_, (&T2_));
	result = copyString(T2_.Field0);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__9bUWNxbcGnToMWA9b79aTXLIw)(void) {
	NI32 result;
	result = (NI32)0;
	result = errno;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, osErrorMsg__33xViSVWAmDrexoKkLfMhg)(NI32 errorCode) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	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__JXEuze9ctNbkn51HYBflQLg)(NI32 errorCode, NimStringDesc* additionalInfo) {
	tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA* result;
	tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA* e;
{	result = (tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*)0;
	e = (tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*)0;
	e = (tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*) newObj((&NTI__9clYsYwyjCqe2PFTuCI3Ubg_), sizeof(tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA));
	(*e).Sup.Sup.Sup.m_type = (&NTI__BeJgrOdDsczOwEWOZbRfKA_);
	(*e).Sup.Sup.name = "OSError";
	(*e).errorCode = errorCode;
	asgnRef((void**) (&(*e).Sup.Sup.message), osErrorMsg__33xViSVWAmDrexoKkLfMhg(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___okzHJ6GE9cv0bYG3b4r5KCAsystem((*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_52));
		addQuoted__45fPtFhY4FavRaYwDhRfuA((&(*e).Sup.Sup.message), additionalInfo);
	}
	LA3_: ;
	{
		NimStringDesc* T16_;
		if (!(((*e).Sup.Sup.message ? (*e).Sup.Sup.message->Sup.len : 0) == 0)) goto LA14_;
		T16_ = (NimStringDesc*)0;
		T16_ = (*e).Sup.Sup.message; (*e).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_53));
		if (T16_) nimGCunrefNoCycle(T16_);
	}
	LA14_: ;
	result = e;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__CWyPYlyH9a6rAuZckFyVxPA)(NI32 errorCode, NimStringDesc* additionalInfo) {
	tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA* T1_;
	T1_ = (tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*)0;
	T1_ = newOSError__JXEuze9ctNbkn51HYBflQLg(errorCode, additionalInfo);
	raiseExceptionEx((Exception*)T1_, "OSError", "raiseOSError", "oserr.nim", 94);
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void) {
	NimStringDesc* result;
	NI bufsize;
	result = (NimStringDesc*)0;
	bufsize = ((NI) 1024);
	if ((bufsize) < ((NI) 0) || (bufsize) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(bufsize, ((NI) 0), ((NI) IL64(9223372036854775807))); }
	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___aqip9cmQIuefPKdd25wuEEwsystem(T5_, NIM_NIL);
				if (!!(T6_)) goto LA7_;
				T9_ = (int)0;
				T9_ = strlen(nimToCStringConv(result));
				if ((T9_) < ((NI) 0) || (T9_) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(T9_, ((NI) 0), ((NI) IL64(9223372036854775807))); }
				result = setLengthStr(result, ((NI) (T9_)));
				goto LA1;
			}
			goto LA3_;
			LA7_: ;
			{
				NI32 err;
				err = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
				{
					if (!(err == ERANGE)) goto LA13_;
					bufsize = (NI)((NU64)(bufsize) << (NU64)(((NI) 1)));
					{
						if (!!((((NI) 0) <= bufsize))) goto LA17_;
						failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_51));
					}
					LA17_: ;
					if ((bufsize) < ((NI) 0) || (bufsize) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(bufsize, ((NI) 0), ((NI) IL64(9223372036854775807))); }
					result = mnewString(((NI) (bufsize)));
				}
				goto LA11_;
				LA13_: ;
				{
					NI32 T20_;
					T20_ = (NI32)0;
					T20_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
					raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T20_, ((NimStringDesc*) NIM_NIL));
				}
				LA11_: ;
			}
			LA3_: ;
		}
	} LA1: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosexistsDir)(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_;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normalizePathEnd__cQ9bfE8YwK2s9aQkxFkMKhYg)(NimStringDesc* path, NIM_BOOL trailingSep) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	result = copyString(path);
	normalizePathEnd__gKUeJXj8CrWvxdeNCA2BXg((&result), trailingSep);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosextractFilename)(NimStringDesc* path) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	{
		NIM_BOOL T3_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_54;
		T3_ = (NIM_BOOL)0;
		T3_ = ((path ? path->Sup.len : 0) == ((NI) 0));
		if (T3_) goto LA4_;
		if (nimSubInt((path ? path->Sup.len : 0), ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_54)) { raiseOverflow(); };
		if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_54)) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_54),(path ? path->Sup.len : 0)-1); }
		T3_ = (((NU8)(path->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_54)])) == ((NU8)(47)) || ((NU8)(path->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_54)])) == ((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 = (NimStringDesc*)0;
	path_2 = normalizePathEnd__cQ9bfE8YwK2s9aQkxFkMKhYg(path, NIM_FALSE);
	result = nosextractFilename(path_2);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg, getSymlinkFileKind__wTnLPNAWjgwVnuiJ9ax0ZGQ)(NimStringDesc* path) {
	tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg result;
	struct stat s;
	result = (tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg)0;
	nimZeroMem((void*)(&s), sizeof(struct stat));
	{
		if (!!(!(((path ? path->Sup.len : 0) == 0)))) goto LA3_;
		failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_55));
	}
	LA3_: ;
	{
		NIM_BOOL T7_;
		int T8_;
		T7_ = (NIM_BOOL)0;
		T8_ = (int)0;
		T8_ = stat(nimToCStringConv(path), (&s));
		T7_ = (T8_ == ((NI32) 0));
		if (!(T7_)) goto LA9_;
		T7_ = S_ISDIR(s.st_mode);
		LA9_: ;
		if (!T7_) goto LA10_;
		result = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3);
	}
	goto LA5_;
	LA10_: ;
	{
		result = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1);
	}
	LA5_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosexpandFilename)(NimStringDesc* filename) {
	NimStringDesc* result;
	NCSTRING r;
	result = (NimStringDesc*)0;
	r = realpath(nimToCStringConv(filename), NIM_NIL);
	{
		NI32 T5_;
		if (!(r == 0)) goto LA3_;
		T5_ = (NI32)0;
		T5_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T5_, filename);
	}
	goto LA1_;
	LA3_: ;
	{
		result = cstrToNimstr(r);
		free(((void*) (r)));
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, parentDirPos__sw9aya5BvknC6WiJX9aEYn9ag)(NimStringDesc* path) {
	NI result;
	NI q;
{	result = (NI)0;
	q = ((NI) 1);
	{
		NIM_BOOL T3_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_56;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 1) <= (path ? path->Sup.len : 0));
		if (!(T3_)) goto LA4_;
		if (nimSubInt((path ? path->Sup.len : 0), ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_56)) { raiseOverflow(); };
		if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_56)) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_56),(path ? path->Sup.len : 0)-1); }
		T3_ = (((NU8)(path->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_56)])) == ((NU8)(47)) || ((NU8)(path->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_56)])) == ((NU8)(47)));
		LA4_: ;
		if (!T3_) goto LA5_;
		q = ((NI) 2);
	}
	LA5_: ;
	{
		NI i;
		NI colontmp_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_57;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		if (nimSubInt((path ? path->Sup.len : 0), q, &TM__yu6cxgKBBXbNsTkT9cyMd4g_57)) { raiseOverflow(); };
		colontmp_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_57);
		res = colontmp_;
		{
			while (1) {
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_58;
				if (!(((NI) 0) <= res)) goto LA9;
				i = res;
				{
					if ((NU)(i) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(i,(path ? path->Sup.len : 0)-1); }
					if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA12_;
					result = i;
					goto BeforeRet_;
				}
				LA12_: ;
				if (nimSubInt(res, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_58)) { raiseOverflow(); };
				res = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_58);
			} LA9: ;
		}
	}
	result = ((NI) -1);
	}BeforeRet_: ;
	return result;
}
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__9bGgqEk7RXXl6eqM9c1HdELAsystem)(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__9bGgqEk7RXXl6eqM9c1HdELAsystem(((void*) ((&a->data[((NI) 0)]))), ((void*) ((&b->data[((NI) 0)]))), ((NI) (alen)));
		goto BeforeRet_;
	}
	LA3_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosparentDir)(NimStringDesc* path) {
	NimStringDesc* result;
	NI sepPos;
	result = (NimStringDesc*)0;
	result = normalizePath__gol9aBbIZpJYUPc6xBOBJDQ(path, 47);
	sepPos = parentDirPos__sw9aya5BvknC6WiJX9aEYn9ag(result);
	{
		if (!(((NI) 0) <= sepPos)) goto LA3_;
		result = substr__2yh9cer0ymNRHlOOg8P7IuA(result, ((NI) 0), sepPos);
		normalizePathEnd__gKUeJXj8CrWvxdeNCA2BXg((&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_59));
		if (T8_) goto LA9_;
		T8_ = eqStrings(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_60));
		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___okzHJ6GE9cv0bYG3b4r5KCAsystem(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_60));
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, rawCreateDir__GHseAa61lv8Sp9b2kQD9baYQ)(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__9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(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__GHseAa61lv8Sp9b2kQD9baYQ(dir);
	result = !(T1_);
	{
		if (!result) goto LA4_;
		{
			NIM_BOOL T8_;
			tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw* T11_;
			NimStringDesc* T12_;
			T8_ = (NIM_BOOL)0;
			T8_ = nosexistsDir(dir);
			if (!!(T8_)) goto LA9_;
			T11_ = (tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw*)0;
			T11_ = (tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw*) newObj((&NTI__HMIVdYjdZYWskTmTQVo5BQ_), sizeof(tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw));
			(*T11_).Sup.Sup.Sup.m_type = (&NTI__iLZrPn9anoh9ad1MmO0RczFw_);
			(*T11_).Sup.Sup.name = "IOError";
			T12_ = (NimStringDesc*)0;
			T12_ = rawNewString((dir ? dir->Sup.len : 0) + 19);
appendString(T12_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_62));
appendString(T12_, dir);
appendString(T12_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_16));
			asgnRef((void**) (&(*T11_).Sup.Sup.message), T12_);
			asgnRef((void**) (&(*T11_).Sup.Sup.parent), NIM_NIL);
			raiseExceptionEx((Exception*)T11_, "IOError", "existsOrCreateDir", "os.nim", 2283);
		}
		LA9_: ;
	}
	LA4_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, noscreateDir)(NimStringDesc* dir) {
	NIM_BOOL omitNext;
	omitNext = NIM_FALSE;
	{
		NI i;
		NI colontmp_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_61;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		if (nimSubInt((dir ? dir->Sup.len : 0), ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_61)) { raiseOverflow(); };
		colontmp_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_61);
		res = ((NI) 1);
		{
			while (1) {
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_64;
				if (!(res <= colontmp_)) goto LA3;
				i = res;
				{
					if ((NU)(i) >= (NU)(dir ? dir->Sup.len : 0)){ raiseIndexError2(i,(dir ? dir->Sup.len : 0)-1); }
					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_: ;
					{
						NI TM__yu6cxgKBBXbNsTkT9cyMd4g_63;
						NimStringDesc* T13_;
						NIM_BOOL T14_;
						if (nimSubInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_63)) { raiseOverflow(); };
						T13_ = (NimStringDesc*)0;
						T13_ = substr__2yh9cer0ymNRHlOOg8P7IuA(dir, ((NI) 0), (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_63));
						T14_ = (NIM_BOOL)0;
						T14_ = nosexistsOrCreateDir(T13_);
						(void)(T14_);
					}
					LA8_: ;
				}
				LA6_: ;
				if (nimAddInt(res, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_64)) { raiseOverflow(); };
				res = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_64);
			} 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___okzHJ6GE9cv0bYG3b4r5KCAsystem(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__sw9aya5BvknC6WiJX9aEYn9ag_2)(NimStringDesc* path) {
	NI result;
	result = (NI)0;
	result = ((NI) -1);
	{
		NI i;
		NI colontmp_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_65;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		if (nimSubInt((path ? path->Sup.len : 0), ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_65)) { raiseOverflow(); };
		colontmp_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_65);
		res = colontmp_;
		{
			while (1) {
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_66;
				if (!(((NI) 1) <= res)) goto LA3;
				i = res;
				{
					if ((NU)(i) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(i,(path ? path->Sup.len : 0)-1); }
					if (!((NU8)(path->data[i]) == (NU8)(46))) goto LA6_;
					result = i;
					goto LA1;
				}
				goto LA4_;
				LA6_: ;
				{
					if ((NU)(i) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(i,(path ? path->Sup.len : 0)-1); }
					if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA9_;
					goto LA1;
				}
				goto LA4_;
				LA9_: ;
				LA4_: ;
				if (nimSubInt(res, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_66)) { raiseOverflow(); };
				res = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_66);
			} LA3: ;
		}
	} LA1: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normExt__5YE1ExrSIVKLWtBPQtnFCw)(NimStringDesc* ext) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = ((ext ? ext->Sup.len : 0) == 0);
		if (T3_) goto LA4_;
		if ((NU)(((NI) 0)) >= (NU)(ext ? ext->Sup.len : 0)){ raiseIndexError2(((NI) 0),(ext ? ext->Sup.len : 0)-1); }
		T3_ = ((NU8)(ext->data[((NI) 0)]) == (NU8)(46));
		LA4_: ;
		if (!T3_) goto LA5_;
		result = copyString(ext);
	}
	goto LA1_;
	LA5_: ;
	{
		NimStringDesc* T8_;
		T8_ = (NimStringDesc*)0;
		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 = (NimStringDesc*)0;
	extPos = searchExtPos__sw9aya5BvknC6WiJX9aEYn9ag_2(filename);
	{
		NimStringDesc* T5_;
		NimStringDesc* T6_;
		if (!(extPos < ((NI) 0))) goto LA3_;
		T5_ = (NimStringDesc*)0;
		T6_ = (NimStringDesc*)0;
		T6_ = normExt__5YE1ExrSIVKLWtBPQtnFCw(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_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_67;
		NimStringDesc* T9_;
		NimStringDesc* T10_;
		T8_ = (NimStringDesc*)0;
		if (nimSubInt(extPos, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_67)) { raiseOverflow(); };
		T9_ = (NimStringDesc*)0;
		T9_ = substr__2yh9cer0ymNRHlOOg8P7IuA(filename, ((NI) 0), (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_67));
		T10_ = (NimStringDesc*)0;
		T10_ = normExt__5YE1ExrSIVKLWtBPQtnFCw(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(void, nosnormalizePath)(NimStringDesc** path) {
	unsureAsgnRef((void**) (&(*path)), normalizePath__gol9aBbIZpJYUPc6xBOBJDQ((*path), 47));
}
static N_INLINE(void, normalizePathAux__Vd3ai1bzXYPREMwN8HbsmQos)(NimStringDesc** path) {
	nosnormalizePath(path);
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosrelativePath)(NimStringDesc* path, NimStringDesc* base, NIM_CHAR sep) {
	NimStringDesc* result;
	NimStringDesc* base_2;
	NimStringDesc* path_2;
	tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg f;
	tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg b;
	tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ ff;
	tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bb;
{	result = (NimStringDesc*)0;
	{
		if (!((path ? path->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = ((NimStringDesc*) NIM_NIL);
		goto BeforeRet_;
	}
	LA3_: ;
	{
		if (!eqStrings(base, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_60))) goto LA7_;
		base_2 = ((NimStringDesc*) NIM_NIL);
	}
	goto LA5_;
	LA7_: ;
	{
		base_2 = copyString(base);
	}
	LA5_: ;
	path_2 = copyString(path);
	normalizePathAux__Vd3ai1bzXYPREMwN8HbsmQos((&path_2));
	normalizePathAux__Vd3ai1bzXYPREMwN8HbsmQos((&base_2));
	nimZeroMem((void*)(&f), sizeof(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg));
	nimZeroMem((void*)(&b), sizeof(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg));
	ff = TM__yu6cxgKBBXbNsTkT9cyMd4g_68;
	bb = TM__yu6cxgKBBXbNsTkT9cyMd4g_68;
	if (((path_2 ? path_2->Sup.len : 0)) < ((NI) 0) || ((path_2 ? path_2->Sup.len : 0)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((path_2 ? path_2->Sup.len : 0), ((NI) 0), ((NI) IL64(9223372036854775807))); }
	result = rawNewString(((NI) ((path_2 ? path_2->Sup.len : 0))));
	{
		while (1) {
			NIM_BOOL T12_;
			NI diff;
			NI TM__yu6cxgKBBXbNsTkT9cyMd4g_69;
			NIM_BOOL same;
			NI colontmp_;
			NI colontmp__2;
			NI colontmp__3;
			NI colontmp__4;
			T12_ = (NIM_BOOL)0;
			T12_ = hasNext__ecfBf9bSnUlnf5OQ0NQMxpQ(f, path_2);
			if (!(T12_)) goto LA13_;
			T12_ = hasNext__ecfBf9bSnUlnf5OQ0NQMxpQ(b, base_2);
			LA13_: ;
			if (!T12_) goto LA11;
			ff = next__am1q4dBd9cls9au5CcmkX5oA((&f), path_2);
			bb = next__am1q4dBd9cls9au5CcmkX5oA((&b), base_2);
			if (nimSubInt(ff.Field1, ff.Field0, &TM__yu6cxgKBBXbNsTkT9cyMd4g_69)) { raiseOverflow(); };
			diff = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_69);
			{
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_70;
				if (nimSubInt(bb.Field1, bb.Field0, &TM__yu6cxgKBBXbNsTkT9cyMd4g_70)) { raiseOverflow(); };
				if (!!((diff == (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_70)))) goto LA16_;
				goto LA10;
			}
			LA16_: ;
			same = NIM_TRUE;
			{
				NI i;
				NI res;
				i = (NI)0;
				res = ((NI) 0);
				{
					while (1) {
						NI TM__yu6cxgKBBXbNsTkT9cyMd4g_73;
						if (!(res <= diff)) goto LA20;
						i = res;
						{
							NI TM__yu6cxgKBBXbNsTkT9cyMd4g_71;
							NI TM__yu6cxgKBBXbNsTkT9cyMd4g_72;
							if (nimAddInt(i, ff.Field0, &TM__yu6cxgKBBXbNsTkT9cyMd4g_71)) { raiseOverflow(); };
							if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_71)) >= (NU)(path_2 ? path_2->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_71),(path_2 ? path_2->Sup.len : 0)-1); }
							if (nimAddInt(i, bb.Field0, &TM__yu6cxgKBBXbNsTkT9cyMd4g_72)) { raiseOverflow(); };
							if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_72)) >= (NU)(base_2 ? base_2->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_72),(base_2 ? base_2->Sup.len : 0)-1); }
							if (!!(((NU8)(path_2->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_71)]) == (NU8)(base_2->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_72)])))) goto LA23_;
							same = NIM_FALSE;
							goto LA18;
						}
						LA23_: ;
						if (nimAddInt(res, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_73)) { raiseOverflow(); };
						res = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_73);
					} LA20: ;
				}
			} LA18: ;
			{
				if (!!(same)) goto LA27_;
				goto LA10;
			}
			LA27_: ;
			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;
		} LA11: ;
	} LA10: ;
	{
		while (1) {
			{
				if (!(bb.Field0 <= bb.Field1)) goto LA33_;
				{
					NIM_BOOL T37_;
					NIM_CHAR T39_;
					T37_ = (NIM_BOOL)0;
					T37_ = (((NI) 0) < (result ? result->Sup.len : 0));
					if (!(T37_)) goto LA38_;
					T39_ = (NIM_CHAR)0;
					T39_ = X5BX5D___okzHJ6GE9cv0bYG3b4r5KCAsystem(result, ((NI) 1));
					T37_ = !(((NU8)(T39_) == (NU8)(sep)));
					LA38_: ;
					if (!T37_) goto LA40_;
					result = addChar(result, sep);
				}
				LA40_: ;
				result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_59));
			}
			LA33_: ;
			{
				NIM_BOOL T44_;
				T44_ = (NIM_BOOL)0;
				T44_ = hasNext__ecfBf9bSnUlnf5OQ0NQMxpQ(b, base_2);
				if (!!(T44_)) goto LA45_;
				goto LA29;
			}
			LA45_: ;
			bb = next__am1q4dBd9cls9au5CcmkX5oA((&b), base_2);
		}
	} LA29: ;
	{
		while (1) {
			{
				if (!(ff.Field0 <= ff.Field1)) goto LA51_;
				{
					NIM_BOOL T55_;
					NIM_CHAR T57_;
					T55_ = (NIM_BOOL)0;
					T55_ = (((NI) 0) < (result ? result->Sup.len : 0));
					if (!(T55_)) goto LA56_;
					T57_ = (NIM_CHAR)0;
					T57_ = X5BX5D___okzHJ6GE9cv0bYG3b4r5KCAsystem(result, ((NI) 1));
					T55_ = !(((NU8)(T57_) == (NU8)(sep)));
					LA56_: ;
					if (!T55_) goto LA58_;
					result = addChar(result, sep);
				}
				LA58_: ;
				{
					NI i_2;
					NI colontmp__5;
					NI TM__yu6cxgKBBXbNsTkT9cyMd4g_74;
					NI res_2;
					i_2 = (NI)0;
					colontmp__5 = (NI)0;
					if (nimSubInt(ff.Field1, ff.Field0, &TM__yu6cxgKBBXbNsTkT9cyMd4g_74)) { raiseOverflow(); };
					colontmp__5 = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_74);
					res_2 = ((NI) 0);
					{
						while (1) {
							NI TM__yu6cxgKBBXbNsTkT9cyMd4g_75;
							NI TM__yu6cxgKBBXbNsTkT9cyMd4g_76;
							if (!(res_2 <= colontmp__5)) goto LA62;
							i_2 = res_2;
							if (nimAddInt(i_2, ff.Field0, &TM__yu6cxgKBBXbNsTkT9cyMd4g_75)) { raiseOverflow(); };
							if ((NU)((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_75)) >= (NU)(path_2 ? path_2->Sup.len : 0)){ raiseIndexError2((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_75),(path_2 ? path_2->Sup.len : 0)-1); }
							result = addChar(result, path_2->data[(NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_75)]);
							if (nimAddInt(res_2, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_76)) { raiseOverflow(); };
							res_2 = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_76);
						} LA62: ;
					}
				}
			}
			LA51_: ;
			{
				NIM_BOOL T65_;
				T65_ = (NIM_BOOL)0;
				T65_ = hasNext__ecfBf9bSnUlnf5OQ0NQMxpQ(f, path_2);
				if (!!(T65_)) goto LA66_;
				goto LA47;
			}
			LA66_: ;
			ff = next__am1q4dBd9cls9au5CcmkX5oA((&f), path_2);
		}
	} LA47: ;
	{
		if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA70_;
		result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_60));
	}
	LA70_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext) {
	NimStringDesc* result;
	NI extPos;
	result = (NimStringDesc*)0;
	extPos = searchExtPos__sw9aya5BvknC6WiJX9aEYn9ag_2(filename);
	{
		NimStringDesc* T5_;
		NimStringDesc* T6_;
		if (!(extPos < ((NI) 0))) goto LA3_;
		T5_ = (NimStringDesc*)0;
		T6_ = (NimStringDesc*)0;
		T6_ = normExt__5YE1ExrSIVKLWtBPQtnFCw(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__YVZCqlK3fKyVR367JpYgKA)(NimStringDesc* key, NimStringDesc* val) {
	NI indx;
	indx = findEnvVar__4kc4cxzsC7aY1IOKtOGazA(key);
	{
		NimStringDesc* T5_;
		if (!(((NI) 0) <= indx)) goto LA3_;
		if ((NU)(indx) >= (NU)(environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)){ raiseIndexError2(indx,(environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)-1); }
		T5_ = (NimStringDesc*)0;
		T5_ = rawNewString((key ? key->Sup.len : 0) + (val ? val->Sup.len : 0) + 1);
appendString(T5_, key);
appendChar(T5_, 61);
appendString(T5_, val);
		asgnRef((void**) (&environment__mlhK49b6YMgc9cgrcYkKq9a3g->data[indx]), T5_);
	}
	goto LA1_;
	LA3_: ;
	{
		NimStringDesc* T7_;
		NI T8_;
		NimStringDesc* T9_;
		NI T10_;
		T7_ = (NimStringDesc*)0;
		T7_ = rawNewString((key ? key->Sup.len : 0) + (val ? val->Sup.len : 0) + 1);
appendString(T7_, key);
appendChar(T7_, 61);
appendString(T7_, val);
		asgnRef((void**) (&environment__mlhK49b6YMgc9cgrcYkKq9a3g), (tySequence__sM4lkSb7zS6F7OVMvW9cffQ*) incrSeqV3((TGenericSeq*)(environment__mlhK49b6YMgc9cgrcYkKq9a3g), (&NTI__sM4lkSb7zS6F7OVMvW9cffQ_)));
		T8_ = environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len++;
		T9_ = (NimStringDesc*)0;
		T9_ = environment__mlhK49b6YMgc9cgrcYkKq9a3g->data[T8_]; environment__mlhK49b6YMgc9cgrcYkKq9a3g->data[T8_] = copyStringRC1(T7_);
		if (T9_) nimGCunrefNoCycle(T9_);
		T10_ = ((environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)-1);
		indx = T10_;
	}
	LA1_: ;
	{
		int T13_;
		NI32 T16_;
		if ((NU)(indx) >= (NU)(environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)){ raiseIndexError2(indx,(environment__mlhK49b6YMgc9cgrcYkKq9a3g ? environment__mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len : 0)-1); }
		T13_ = (int)0;
		T13_ = putenv(nimToCStringConv(environment__mlhK49b6YMgc9cgrcYkKq9a3g->data[indx]));
		if (!!((T13_ == ((NI32) 0)))) goto LA14_;
		T16_ = (NI32)0;
		T16_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T16_, ((NimStringDesc*) NIM_NIL));
	}
	LA14_: ;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, existsEnv__HhiDHRQxJ349a6FFxO51gqQ)(NimStringDesc* key) {
	NIM_BOOL result;
{	result = (NIM_BOOL)0;
	{
		NCSTRING T3_;
		NIM_BOOL T4_;
		T3_ = (NCSTRING)0;
		T3_ = getenv(nimToCStringConv(key));
		T4_ = (NIM_BOOL)0;
		T4_ = eqeq___aqip9cmQIuefPKdd25wuEEwsystem(T3_, NIM_NIL);
		if (!!(T4_)) goto LA5_;
		result = NIM_TRUE;
		goto BeforeRet_;
	}
	goto LA1_;
	LA5_: ;
	{
		NI T8_;
		T8_ = (NI)0;
		T8_ = findEnvVar__4kc4cxzsC7aY1IOKtOGazA(key);
		result = (((NI) 0) <= T8_);
		goto BeforeRet_;
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NI, find__31wM5Ui9c8jnrQ5QD4oPxOQsystem)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item) {
	NI result;
{	result = (NI)0;
	{
		NIM_CHAR i;
		NI i_2;
		i = (NIM_CHAR)0;
		i_2 = ((NI) 0);
		{
			while (1) {
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_77;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_78;
				if (!(i_2 < aLen_0)) goto LA3;
				if ((NU)(i_2) >= (NU)(aLen_0)){ raiseIndexError2(i_2,aLen_0-1); }
				i = a[i_2];
				{
					if (!((NU8)(i) == (NU8)(item))) goto LA6_;
					goto BeforeRet_;
				}
				LA6_: ;
				if (nimAddInt(result, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_77)) { raiseOverflow(); };
				result = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_77);
				if (nimAddInt(i_2, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_78)) { raiseOverflow(); };
				i_2 = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_78);
			} LA3: ;
		}
	}
	result = ((NI) -1);
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_BOOL, contains__Pa9a8m0kZYH6LC8N1EcZJdQsystem)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item) {
	NIM_BOOL result;
	NI T1_;
{	result = (NIM_BOOL)0;
	T1_ = (NI)0;
	T1_ = find__31wM5Ui9c8jnrQ5QD4oPxOQsystem(a, aLen_0, item);
	result = (((NI) 0) <= T1_);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, checkSymlink__K8A5Y9b9bcyjk7pehBjrT8Kw)(NimStringDesc* path) {
	NIM_BOOL result;
	struct stat rawInfo;
	result = (NIM_BOOL)0;
	nimZeroMem((void*)(&rawInfo), sizeof(struct stat));
	{
		int T3_;
		T3_ = (int)0;
		T3_ = lstat(nimToCStringConv(path), (&rawInfo));
		if (!(T3_ < ((NI32) 0))) goto LA4_;
		result = NIM_FALSE;
	}
	goto LA1_;
	LA4_: ;
	{
		result = S_ISLNK(rawInfo.st_mode);
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, findExe__9cov9c3aI19bfbEIyMe9bNCSEA)(NimStringDesc* exe, NIM_BOOL followSymlinks, NimStringDesc** extensions, NI extensionsLen_0) {
	NimStringDesc* result;
	NimStringDesc* path;
{	result = (NimStringDesc*)0;
	{
		if (!((exe ? exe->Sup.len : 0) == ((NI) 0))) goto LA3_;
		goto BeforeRet_;
	}
	LA3_: ;
	{
		NIM_BOOL T7_;
		T7_ = (NIM_BOOL)0;
		T7_ = contains__Pa9a8m0kZYH6LC8N1EcZJdQsystem(exe->data, (exe ? exe->Sup.len : 0), 47);
		if (!T7_) goto LA8_;
		{
			NimStringDesc* extX60gensym15105079_;
			NI i;
			extX60gensym15105079_ = (NimStringDesc*)0;
			i = ((NI) 0);
			{
				while (1) {
					NI TM__yu6cxgKBBXbNsTkT9cyMd4g_79;
					if (!(i < extensionsLen_0)) goto LA12;
					if ((NU)(i) >= (NU)(extensionsLen_0)){ raiseIndexError2(i,extensionsLen_0-1); }
					extX60gensym15105079_ = extensions[i];
					result = nosaddFileExt(exe, extX60gensym15105079_);
					{
						NIM_BOOL T15_;
						T15_ = (NIM_BOOL)0;
						T15_ = nosexistsFile(result);
						if (!T15_) goto LA16_;
						goto BeforeRet_;
					}
					LA16_: ;
					if (nimAddInt(i, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_79)) { raiseOverflow(); };
					i = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_79);
				} LA12: ;
			}
		}
	}
	LA8_: ;
	path = getEnv__hhED57tMl0Iaa5bOg9cJaig(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_46), ((NimStringDesc*) NIM_NIL));
	{
		NimStringDesc* candidate;
		NI lastX60gensym12870133_;
		NI splitsX60gensym12870134_;
		candidate = (NimStringDesc*)0;
		lastX60gensym12870133_ = ((NI) 0);
		splitsX60gensym12870134_ = ((NI) -1);
		{
			while (1) {
				NI firstX60gensym12870135_;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_81;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_84;
				NI TM__yu6cxgKBBXbNsTkT9cyMd4g_85;
				if (!(lastX60gensym12870133_ <= (path ? path->Sup.len : 0))) goto LA20;
				firstX60gensym12870135_ = lastX60gensym12870133_;
				{
					while (1) {
						NIM_BOOL T23_;
						NI TM__yu6cxgKBBXbNsTkT9cyMd4g_80;
						T23_ = (NIM_BOOL)0;
						T23_ = (lastX60gensym12870133_ < (path ? path->Sup.len : 0));
						if (!(T23_)) goto LA24_;
						if ((NU)(lastX60gensym12870133_) >= (NU)(path ? path->Sup.len : 0)){ raiseIndexError2(lastX60gensym12870133_,(path ? path->Sup.len : 0)-1); }
						T23_ = !(((NU8)(path->data[lastX60gensym12870133_]) == (NU8)(58)));
						LA24_: ;
						if (!T23_) goto LA22;
						if (nimAddInt(lastX60gensym12870133_, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_80)) { raiseOverflow(); };
						lastX60gensym12870133_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_80);
					} LA22: ;
				}
				{
					if (!(splitsX60gensym12870134_ == ((NI) 0))) goto LA27_;
					lastX60gensym12870133_ = (path ? path->Sup.len : 0);
				}
				LA27_: ;
				if (nimSubInt(lastX60gensym12870133_, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_81)) { raiseOverflow(); };
				candidate = substr__2yh9cer0ymNRHlOOg8P7IuA(path, firstX60gensym12870135_, (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_81));
				{
					NimStringDesc* x;
					NimStringDesc* T34_;
					{
						if (!((candidate ? candidate->Sup.len : 0) == ((NI) 0))) goto LA32_;
						goto LA29;
					}
					LA32_: ;
					T34_ = (NimStringDesc*)0;
					T34_ = expandTilde__RmQRR8GLDFICboxWoCEpMw(candidate);
					x = slash___gEyhbzZ1UcxyenWRLJRXNQ(T34_, exe);
					{
						NimStringDesc* ext;
						NI i_2;
						ext = (NimStringDesc*)0;
						i_2 = ((NI) 0);
						{
							while (1) {
								NimStringDesc* x_2;
								NI TM__yu6cxgKBBXbNsTkT9cyMd4g_83;
								if (!(i_2 < extensionsLen_0)) goto LA37;
								if ((NU)(i_2) >= (NU)(extensionsLen_0)){ raiseIndexError2(i_2,extensionsLen_0-1); }
								ext = extensions[i_2];
								x_2 = nosaddFileExt(x, ext);
								{
									NIM_BOOL T40_;
									T40_ = (NIM_BOOL)0;
									T40_ = nosexistsFile(x_2);
									if (!T40_) goto LA41_;
									{
										while (1) {
											if (!followSymlinks) goto LA44;
											{
												NIM_BOOL T47_;
												NimStringDesc* r;
												NI len;
												T47_ = (NIM_BOOL)0;
												T47_ = checkSymlink__K8A5Y9b9bcyjk7pehBjrT8Kw(x_2);
												if (!T47_) goto LA48_;
												r = mnewString(((NI) 256));
												len = readlink(nimToCStringConv(x_2), nimToCStringConv(r), ((NI) 256));
												{
													NI32 T54_;
													if (!(len < ((NI) 0))) goto LA52_;
													T54_ = (NI32)0;
													T54_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
													raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T54_, exe);
												}
												LA52_: ;
												{
													NI TM__yu6cxgKBBXbNsTkT9cyMd4g_82;
													if (!(((NI) 256) < len)) goto LA57_;
													if (nimAddInt(len, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_82)) { raiseOverflow(); };
													if (((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_82)) < ((NI) 0) || ((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_82)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_82), ((NI) 0), ((NI) IL64(9223372036854775807))); }
													r = mnewString(((NI) ((NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_82))));
													len = readlink(nimToCStringConv(x_2), nimToCStringConv(r), len);
												}
												LA57_: ;
												if ((len) < ((NI) 0) || (len) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(len, ((NI) 0), ((NI) IL64(9223372036854775807))); }
												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_ = (NimStringDesc*)0;
													T65_ = nosparentDir(x_2);
													x_2 = slash___gEyhbzZ1UcxyenWRLJRXNQ(T65_, r);
												}
												LA59_: ;
											}
											goto LA45_;
											LA48_: ;
											{
												goto LA43;
											}
											LA45_: ;
										} LA44: ;
									} LA43: ;
									result = copyString(x_2);
									goto BeforeRet_;
								}
								LA41_: ;
								if (nimAddInt(i_2, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_83)) { raiseOverflow(); };
								i_2 = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_83);
							} LA37: ;
						}
					}
				} LA29: ;
				{
					if (!(splitsX60gensym12870134_ == ((NI) 0))) goto LA69_;
					goto LA19;
				}
				LA69_: ;
				if (nimSubInt(splitsX60gensym12870134_, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_84)) { raiseOverflow(); };
				splitsX60gensym12870134_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_84);
				if (nimAddInt(lastX60gensym12870133_, ((NI) 1), &TM__yu6cxgKBBXbNsTkT9cyMd4g_85)) { raiseOverflow(); };
				lastX60gensym12870133_ = (NI)(TM__yu6cxgKBBXbNsTkT9cyMd4g_85);
			} LA20: ;
		} LA19: ;
	}
	result = ((NimStringDesc*) NIM_NIL);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__vmXOHpv9cjOB5AHi6OOlhbw)(int status) {
	int result;
	result = (int)0;
	{
		NIM_BOOL T3_;
		int T6_;
		NI TM__yu6cxgKBBXbNsTkT9cyMd4g_86;
		T3_ = (NIM_BOOL)0;
		T3_ = WIFSIGNALED(status);
		if (!T3_) goto LA4_;
		T6_ = (int)0;
		T6_ = WTERMSIG(status);
		if (nimAddInt(((NI32) 128), T6_, &TM__yu6cxgKBBXbNsTkT9cyMd4g_86)) { raiseOverflow(); };
		if (TM__yu6cxgKBBXbNsTkT9cyMd4g_86 < (-2147483647 -1) || TM__yu6cxgKBBXbNsTkT9cyMd4g_86 > 2147483647){ raiseOverflow(); }
		result = (NI32)(TM__yu6cxgKBBXbNsTkT9cyMd4g_86);
	}
	goto LA1_;
	LA4_: ;
	{
		result = WEXITSTATUS(status);
	}
	LA1_: ;
	return result;
}
static N_INLINE(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, toTime__ijMjyFbtGRbszYH28YzkiQos)(struct timespec ts) {
	tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q result;
	nimZeroMem((void*)(&result), sizeof(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q));
	if ((ts.tv_nsec) < ((NI) 0) || (ts.tv_nsec) > ((NI) 999999999)){ raiseRangeErrorI(ts.tv_nsec, ((NI) 0), ((NI) 999999999)); }
	result = initTime__JIXNH9cQMG3SbZ0hXqEYDvA(((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__9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T6_, file);
	}
	LA4_: ;
	result = toTime__ijMjyFbtGRbszYH28YzkiQos(res.st_mtim);
	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, noscopyFile)(NimStringDesc* source, NimStringDesc* dest) {
	FILE* d;
	FILE* s;
	void* buf;
	d = (FILE*)0;
	s = (FILE*)0;
	{
		NIM_BOOL T3_;
		NI32 T6_;
		T3_ = (NIM_BOOL)0;
		T3_ = open__gq12VLhVO0NBzUTnGgz4nw(&s, source, ((tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg) 0), ((NI) -1));
		if (!!(T3_)) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T6_, source);
	}
	LA4_: ;
	{
		NIM_BOOL T9_;
		NI32 T12_;
		T9_ = (NIM_BOOL)0;
		T9_ = open__gq12VLhVO0NBzUTnGgz4nw(&d, dest, ((tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg) 1), ((NI) -1));
		if (!!(T9_)) goto LA10_;
		close__fU6ZlJAtQ9bre04EDZLdGsA_3(s);
		T12_ = (NI32)0;
		T12_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T12_, dest);
	}
	LA10_: ;
	buf = allocImpl__WrVG9abV9chlTLqkiXYLKwUg_2(((NI) 8000));
	{
		while (1) {
			NI bytesread;
			bytesread = readBuffer__Y9atVWUcVyKHG9aBP4D0P9czA_2(s, buf, ((NI) 8000));
			{
				NI byteswritten;
				if (!(((NI) 0) < bytesread)) goto LA17_;
				if ((bytesread) < ((NI) 0) || (bytesread) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(bytesread, ((NI) 0), ((NI) IL64(9223372036854775807))); }
				byteswritten = writeBuffer__Y9atVWUcVyKHG9aBP4D0P9czA(d, buf, ((NI) (bytesread)));
				{
					NI32 T23_;
					if (!!((bytesread == byteswritten))) goto LA21_;
					deallocImpl__lmwgHsdhTsrQaepFju8wew(buf);
					close__fU6ZlJAtQ9bre04EDZLdGsA_3(s);
					close__fU6ZlJAtQ9bre04EDZLdGsA_3(d);
					T23_ = (NI32)0;
					T23_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
					raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T23_, dest);
				}
				LA21_: ;
			}
			LA17_: ;
			{
				if (!!((bytesread == ((NI) 8000)))) goto LA26_;
				goto LA13;
			}
			LA26_: ;
		}
	} LA13: ;
	deallocImpl__lmwgHsdhTsrQaepFju8wew(buf);
	close__fU6ZlJAtQ9bre04EDZLdGsA_3(s);
	flushFile__fU6ZlJAtQ9bre04EDZLdGsA_2(d);
	close__fU6ZlJAtQ9bre04EDZLdGsA_3(d);
}
static N_INLINE(void, pushSafePoint)(TSafePoint* s) {
	(*s).prev = excHandler__rqLlY5bs9atDw2OXYqJEn5g;
	excHandler__rqLlY5bs9atDw2OXYqJEn5g = s;
}
N_LIB_PRIVATE N_NIMCALL(void, nossetFilePermissions)(NimStringDesc* filename, tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA permissions) {
	mode_t p;
	p = ((mode_t) 0);
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 2))&15U)))!=0)) goto LA3_;
		p = (NU32)(p | ((mode_t) (S_IRUSR)));
	}
	LA3_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 1))&15U)))!=0)) goto LA7_;
		p = (NU32)(p | ((mode_t) (S_IWUSR)));
	}
	LA7_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 0))&15U)))!=0)) goto LA11_;
		p = (NU32)(p | ((mode_t) (S_IXUSR)));
	}
	LA11_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 5))&15U)))!=0)) goto LA15_;
		p = (NU32)(p | ((mode_t) (S_IRGRP)));
	}
	LA15_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 4))&15U)))!=0)) goto LA19_;
		p = (NU32)(p | ((mode_t) (S_IWGRP)));
	}
	LA19_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 3))&15U)))!=0)) goto LA23_;
		p = (NU32)(p | ((mode_t) (S_IXGRP)));
	}
	LA23_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 8))&15U)))!=0)) goto LA27_;
		p = (NU32)(p | ((mode_t) (S_IROTH)));
	}
	LA27_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 7))&15U)))!=0)) goto LA31_;
		p = (NU32)(p | ((mode_t) (S_IWOTH)));
	}
	LA31_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 6))&15U)))!=0)) goto LA35_;
		p = (NU32)(p | ((mode_t) (S_IXOTH)));
	}
	LA35_: ;
	{
		int T39_;
		NI32 T42_;
		tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA T43_;
		NimStringDesc* T44_;
		T39_ = (int)0;
		T39_ = chmod(nimToCStringConv(filename), ((mode_t) (p)));
		if (!!((T39_ == ((NI32) 0)))) goto LA40_;
		T42_ = (NI32)0;
		T42_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
		nimZeroMem((void*)(&T43_), sizeof(tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA));
		T43_.Field0 = copyString(filename);
		T43_.Field1 = permissions;
		T44_ = (NimStringDesc*)0;
		T44_ = dollar___VhyooW9cjC7wNKZM71oRg9cg(T43_);
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T42_, T44_);
	}
	LA40_: ;
}
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__9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T6_, filename);
	}
	LA4_: ;
	result = 0;
	{
		if (!!(((NU32)(a.st_mode & ((mode_t) (S_IRUSR))) == ((mode_t) 0)))) goto LA9_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 2)) & 15);
	}
	LA9_: ;
	{
		if (!!(((NU32)(a.st_mode & ((mode_t) (S_IWUSR))) == ((mode_t) 0)))) goto LA13_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 1)) & 15);
	}
	LA13_: ;
	{
		if (!!(((NU32)(a.st_mode & ((mode_t) (S_IXUSR))) == ((mode_t) 0)))) goto LA17_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 0)) & 15);
	}
	LA17_: ;
	{
		if (!!(((NU32)(a.st_mode & ((mode_t) (S_IRGRP))) == ((mode_t) 0)))) goto LA21_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 5)) & 15);
	}
	LA21_: ;
	{
		if (!!(((NU32)(a.st_mode & ((mode_t) (S_IWGRP))) == ((mode_t) 0)))) goto LA25_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 4)) & 15);
	}
	LA25_: ;
	{
		if (!!(((NU32)(a.st_mode & ((mode_t) (S_IXGRP))) == ((mode_t) 0)))) goto LA29_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 3)) & 15);
	}
	LA29_: ;
	{
		if (!!(((NU32)(a.st_mode & ((mode_t) (S_IROTH))) == ((mode_t) 0)))) goto LA33_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 8)) & 15);
	}
	LA33_: ;
	{
		if (!!(((NU32)(a.st_mode & ((mode_t) (S_IWOTH))) == ((mode_t) 0)))) goto LA37_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 7)) & 15);
	}
	LA37_: ;
	{
		if (!!(((NU32)(a.st_mode & ((mode_t) (S_IXOTH))) == ((mode_t) 0)))) goto LA41_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 6)) & 15);
	}
	LA41_: ;
	return result;
}
static N_INLINE(void, popSafePoint)(void) {
	excHandler__rqLlY5bs9atDw2OXYqJEn5g = (*excHandler__rqLlY5bs9atDw2OXYqJEn5g).prev;
}
static N_INLINE(void, popCurrentException)(void) {
	asgnRef((void**) (&currException__9bVPeDJlYTi9bQApZpfH8wjg), (*currException__9bVPeDJlYTi9bQApZpfH8wjg).up);
}
N_LIB_PRIVATE N_NIMCALL(void, copyFileWithPermissions__H9b5Dl0Yjd60VeosKvlvXkA)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL ignorePermissionErrors) {
	TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_87;
	noscopyFile(source, dest);
	pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_87);
	TM__yu6cxgKBBXbNsTkT9cyMd4g_87.status = setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_87.context);
	if (TM__yu6cxgKBBXbNsTkT9cyMd4g_87.status == 0) {
		tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA T2_;
		T2_ = nosgetFilePermissions(source);
		nossetFilePermissions(dest, T2_);
		popSafePoint();
	}
	else {
		popSafePoint();
		{
			TM__yu6cxgKBBXbNsTkT9cyMd4g_87.status = 0;
			{
				if (!!(ignorePermissionErrors)) goto LA7_;
				reraiseException();
			}
			LA7_: ;
			popCurrentException();
		}
	}
	if (TM__yu6cxgKBBXbNsTkT9cyMd4g_87.status != 0) reraiseException();
}
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__9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T6_, file);
	}
	LA4_: ;
}
static N_INLINE(NIM_BOOL, dirExists__AWUc3v8Mlad7tvNYF3Ak8Qos)(NimStringDesc* dir) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = nosexistsDir(dir);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, rawRemoveDir__wSIx0z80fCn9axX6xdRqD8Q)(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__9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(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 = (NimStringDesc*)0;
		d = opendir(nimToCStringConv(dir));
		{
			if (!(d == NIM_NIL)) goto LA4_;
			{
				NI32 T10_;
				if (!checkDir) goto LA8_;
				T10_ = (NI32)0;
				T10_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
				raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T10_, dir);
			}
			LA8_: ;
		}
		goto LA2_;
		LA4_: ;
		{
			TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_91;
			pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_91);
			TM__yu6cxgKBBXbNsTkT9cyMd4g_91.status = setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_91.context);
			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_91.status == 0) {
				{
					while (1) {
						{
							struct dirent* x;
							NimStringDesc* y;
							x = readdir(d);
							{
								if (!(x == NIM_NIL)) goto LA18_;
								goto LA13;
							}
							LA18_: ;
							y = cstrToNimstr(((NCSTRING) ((*x).d_name)));
							{
								NIM_BOOL T22_;
								struct stat s;
								NimStringDesc* path_2;
								tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg k;
								T22_ = (NIM_BOOL)0;
								T22_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_60)));
								if (!(T22_)) goto LA23_;
								T22_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_59)));
								LA23_: ;
								if (!T22_) goto LA24_;
								nimZeroMem((void*)(&s), sizeof(struct stat));
								path_2 = slash___gEyhbzZ1UcxyenWRLJRXNQ(dir, y);
								{
									if (!NIM_TRUE) goto LA28_;
									y = copyString(path_2);
								}
								LA28_: ;
								k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 0);
								{
									if (!!(((*x).d_type == ((NI8) 0)))) goto LA32_;
									{
										if (!((*x).d_type == ((NI8) 4))) goto LA36_;
										k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
									}
									LA36_: ;
									{
										if (!((*x).d_type == ((NI8) 10))) goto LA40_;
										{
											NIM_BOOL T44_;
											T44_ = (NIM_BOOL)0;
											T44_ = dirExists__AWUc3v8Mlad7tvNYF3Ak8Qos(path_2);
											if (!T44_) goto LA45_;
											k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3);
										}
										goto LA42_;
										LA45_: ;
										{
											k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1);
										}
										LA42_: ;
									}
									LA40_: ;
									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;
									}
									goto LA15;
								}
								LA32_: ;
								{
									int T52_;
									T52_ = (int)0;
									T52_ = lstat(nimToCStringConv(path_2), (&s));
									if (!(T52_ < ((NI32) 0))) goto LA53_;
									goto LA13;
								}
								LA53_: ;
								{
									NIM_BOOL T57_;
									T57_ = (NIM_BOOL)0;
									T57_ = S_ISDIR(s.st_mode);
									if (!T57_) goto LA58_;
									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
								}
								goto LA55_;
								LA58_: ;
								{
									NIM_BOOL T61_;
									T61_ = (NIM_BOOL)0;
									T61_ = S_ISLNK(s.st_mode);
									if (!T61_) goto LA62_;
									k = getSymlinkFileKind__wTnLPNAWjgwVnuiJ9ax0ZGQ(path_2);
								}
								goto LA55_;
								LA62_: ;
								LA55_: ;
								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;
								}
							}
							LA24_: ;
						} LA15: ;
					}
				} LA13: ;
				popSafePoint();
			}
			else {
				popSafePoint();
			}
			{
				int T68_;
				T68_ = (int)0;
				T68_ = closedir(d);
				(void)(T68_);
				if (TM__yu6cxgKBBXbNsTkT9cyMd4g_91.status != 0) nimLeaveFinally();
			}
			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_91.status != 0) reraiseException();
		}
		LA2_: ;
	}
	rawRemoveDir__wSIx0z80fCn9axX6xdRqD8Q(dir);
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, tryMoveFSObject__43wKg5fKy6XSTFw35EBkzA)(NimStringDesc* source, NimStringDesc* dest) {
	NIM_BOOL result;
{	result = (NIM_BOOL)0;
	{
		int T3_;
		NI32 err;
		T3_ = (int)0;
		T3_ = rename(nimToCStringConv(source), nimToCStringConv(dest));
		if (!!((T3_ == ((NI32) 0)))) goto LA4_;
		err = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
		{
			if (!(err == EXDEV)) goto LA8_;
			result = NIM_FALSE;
			goto BeforeRet_;
		}
		goto LA6_;
		LA8_: ;
		{
			tyTuple__flePlH29a9c9cGo1Wdll1KDOQ T11_;
			NimStringDesc* T12_;
			nimZeroMem((void*)(&T11_), sizeof(tyTuple__flePlH29a9c9cGo1Wdll1KDOQ));
			T11_.Field0 = copyString(source);
			T11_.Field1 = copyString(dest);
			T11_.Field2 = strerror(errno);
			T12_ = (NimStringDesc*)0;
			T12_ = dollar___uRqZ9b9aRtL1gygwVfSa9bmlQ(T11_);
			raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(err, T12_);
		}
		LA6_: ;
	}
	LA4_: ;
	result = NIM_TRUE;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nosmoveFile)(NimStringDesc* source, NimStringDesc* dest) {
	{
		NIM_BOOL T3_;
		TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_92;
		T3_ = (NIM_BOOL)0;
		T3_ = tryMoveFSObject__43wKg5fKy6XSTFw35EBkzA(source, dest);
		if (!!(T3_)) goto LA4_;
		noscopyFile(source, dest);
		pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_92);
		TM__yu6cxgKBBXbNsTkT9cyMd4g_92.status = setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_92.context);
		if (TM__yu6cxgKBBXbNsTkT9cyMd4g_92.status == 0) {
			nosremoveFile(source);
			popSafePoint();
		}
		else {
			popSafePoint();
			{
				NIM_BOOL T9_;
				TM__yu6cxgKBBXbNsTkT9cyMd4g_92.status = 0;
				T9_ = (NIM_BOOL)0;
				T9_ = nostryRemoveFile(dest);
				(void)(T9_);
				reraiseException();
				popCurrentException();
			}
		}
		if (TM__yu6cxgKBBXbNsTkT9cyMd4g_92.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 = (NimStringDesc*)0;
		d = opendir(nimToCStringConv(source));
		{
			if (!(d == NIM_NIL)) goto LA4_;
			{
				NI32 T10_;
				if (!NIM_FALSE) goto LA8_;
				T10_ = (NI32)0;
				T10_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
				raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T10_, source);
			}
			LA8_: ;
		}
		goto LA2_;
		LA4_: ;
		{
			TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_93;
			pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_93);
			TM__yu6cxgKBBXbNsTkT9cyMd4g_93.status = setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_93.context);
			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_93.status == 0) {
				{
					while (1) {
						{
							struct dirent* x;
							NimStringDesc* y;
							x = readdir(d);
							{
								if (!(x == NIM_NIL)) goto LA18_;
								goto LA13;
							}
							LA18_: ;
							y = cstrToNimstr(((NCSTRING) ((*x).d_name)));
							{
								NIM_BOOL T22_;
								struct stat s;
								NimStringDesc* path_2;
								tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg k;
								NimStringDesc* noSource_2;
								tyTuple__UV3llMMYFckfui8YMBuUZA T68_;
								T22_ = (NIM_BOOL)0;
								T22_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_60)));
								if (!(T22_)) goto LA23_;
								T22_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_59)));
								LA23_: ;
								if (!T22_) goto LA24_;
								nimZeroMem((void*)(&s), sizeof(struct stat));
								path_2 = slash___gEyhbzZ1UcxyenWRLJRXNQ(source, y);
								{
									if (!NIM_TRUE) goto LA28_;
									y = copyString(path_2);
								}
								LA28_: ;
								k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 0);
								{
									NimStringDesc* noSource;
									tyTuple__UV3llMMYFckfui8YMBuUZA T48_;
									if (!!(((*x).d_type == ((NI8) 0)))) goto LA32_;
									{
										if (!((*x).d_type == ((NI8) 4))) goto LA36_;
										k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
									}
									LA36_: ;
									{
										if (!((*x).d_type == ((NI8) 10))) goto LA40_;
										{
											NIM_BOOL T44_;
											T44_ = (NIM_BOOL)0;
											T44_ = dirExists__AWUc3v8Mlad7tvNYF3Ak8Qos(path_2);
											if (!T44_) goto LA45_;
											k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3);
										}
										goto LA42_;
										LA45_: ;
										{
											k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1);
										}
										LA42_: ;
									}
									LA40_: ;
									kind = k;
									path = y;
									nimZeroMem((void*)(&T48_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
									nossplitPath(path, (&T48_));
									noSource = copyString(T48_.Field1);
									switch (kind) {
									case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 0):
									{
										NimStringDesc* T50_;
										T50_ = (NimStringDesc*)0;
										T50_ = slash___gEyhbzZ1UcxyenWRLJRXNQ(dest, noSource);
										noscopyFile(path, T50_);
									}
									break;
									case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2):
									{
										NimStringDesc* T52_;
										T52_ = (NimStringDesc*)0;
										T52_ = slash___gEyhbzZ1UcxyenWRLJRXNQ(dest, noSource);
										noscopyDir(path, T52_);
									}
									break;
									default:
									{
									}
									break;
									}
									goto LA15;
								}
								LA32_: ;
								{
									int T56_;
									T56_ = (int)0;
									T56_ = lstat(nimToCStringConv(path_2), (&s));
									if (!(T56_ < ((NI32) 0))) goto LA57_;
									goto LA13;
								}
								LA57_: ;
								{
									NIM_BOOL T61_;
									T61_ = (NIM_BOOL)0;
									T61_ = S_ISDIR(s.st_mode);
									if (!T61_) goto LA62_;
									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
								}
								goto LA59_;
								LA62_: ;
								{
									NIM_BOOL T65_;
									T65_ = (NIM_BOOL)0;
									T65_ = S_ISLNK(s.st_mode);
									if (!T65_) goto LA66_;
									k = getSymlinkFileKind__wTnLPNAWjgwVnuiJ9ax0ZGQ(path_2);
								}
								goto LA59_;
								LA66_: ;
								LA59_: ;
								kind = k;
								path = y;
								nimZeroMem((void*)(&T68_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
								nossplitPath(path, (&T68_));
								noSource_2 = copyString(T68_.Field1);
								switch (kind) {
								case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 0):
								{
									NimStringDesc* T70_;
									T70_ = (NimStringDesc*)0;
									T70_ = slash___gEyhbzZ1UcxyenWRLJRXNQ(dest, noSource_2);
									noscopyFile(path, T70_);
								}
								break;
								case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2):
								{
									NimStringDesc* T72_;
									T72_ = (NimStringDesc*)0;
									T72_ = slash___gEyhbzZ1UcxyenWRLJRXNQ(dest, noSource_2);
									noscopyDir(path, T72_);
								}
								break;
								default:
								{
								}
								break;
								}
							}
							LA24_: ;
						} LA15: ;
					}
				} LA13: ;
				popSafePoint();
			}
			else {
				popSafePoint();
			}
			{
				int T76_;
				T76_ = (int)0;
				T76_ = closedir(d);
				(void)(T76_);
				if (TM__yu6cxgKBBXbNsTkT9cyMd4g_93.status != 0) nimLeaveFinally();
			}
			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_93.status != 0) reraiseException();
		}
		LA2_: ;
	}
}
N_LIB_PRIVATE N_NIMCALL(void, moveDir__ZIkDlvIsvzKWHk1wL9bH1lg)(NimStringDesc* source, NimStringDesc* dest) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = tryMoveFSObject__43wKg5fKy6XSTFw35EBkzA(source, dest);
		if (!!(T3_)) goto LA4_;
		noscopyDir(source, dest);
		nosremoveDir(source, NIM_FALSE);
	}
	LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, delEnv__B4Cfq0UpEu7Wu9cYZh9cgVlw)(NimStringDesc* key) {
	NI indx;
{	indx = findEnvVar__4kc4cxzsC7aY1IOKtOGazA(key);
	{
		if (!(indx < ((NI) 0))) goto LA3_;
		goto BeforeRet_;
	}
	LA3_: ;
	{
		int T7_;
		NI32 T10_;
		T7_ = (int)0;
		T7_ = unsetenv(nimToCStringConv(key));
		if (!!((T7_ == ((NI32) 0)))) goto LA8_;
		T10_ = (NI32)0;
		T10_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T10_, ((NimStringDesc*) NIM_NIL));
	}
	LA8_: ;
	if ((indx) < ((NI) 0) || (indx) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(indx, ((NI) 0), ((NI) IL64(9223372036854775807))); }
	delete__FxJSSlM1HtYUBJdvsqL6Sg((&environment__mlhK49b6YMgc9cgrcYkKq9a3g), ((NI) (indx)));
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetConfigDir)(void) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	NimStringDesc* T2_;
	result = (NimStringDesc*)0;
	T1_ = (NimStringDesc*)0;
	T1_ = getEnv__hhED57tMl0Iaa5bOg9cJaig(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_31), ((NimStringDesc*) NIM_NIL));
	T2_ = (NimStringDesc*)0;
	T2_ = slash___gEyhbzZ1UcxyenWRLJRXNQ(T1_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_95));
	result = getEnv__hhED57tMl0Iaa5bOg9cJaig(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_94), T2_);
	normalizePathEnd__gKUeJXj8CrWvxdeNCA2BXg((&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__sw9aya5BvknC6WiJX9aEYn9ag(path);
	result = (T1_ < ((NI) 0));
	return result;
}
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__vmXOHpv9cjOB5AHi6OOlhbw(T1_);
	result = ((NI) (T2_));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isRelativeTo__7vk6fsmSRQYWfbjkLVX9bnA)(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__gol9aBbIZpJYUPc6xBOBJDQ(path, 47);
	base_2 = normalizePath__gol9aBbIZpJYUPc6xBOBJDQ(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_59));
	T1_ = !(T3_);
	LA2_: ;
	result = T1_;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, stdlib_osInit000)(void) {
{

	nimRegisterThreadLocalMarker(TM__yu6cxgKBBXbNsTkT9cyMd4g_2);

}
}

N_LIB_PRIVATE N_NIMCALL(void, stdlib_osDatInit000)(void) {
static TNimNode* TM__yu6cxgKBBXbNsTkT9cyMd4g_88_9[9];
NI TM__yu6cxgKBBXbNsTkT9cyMd4g_90;
static char* NIM_CONST TM__yu6cxgKBBXbNsTkT9cyMd4g_89[9] = {
"fpUserExec", 
"fpUserWrite", 
"fpUserRead", 
"fpGroupExec", 
"fpGroupWrite", 
"fpGroupRead", 
"fpOthersExec", 
"fpOthersWrite", 
"fpOthersRead"};
static TNimNode TM__yu6cxgKBBXbNsTkT9cyMd4g_0[10];
NTI__sM4lkSb7zS6F7OVMvW9cffQ_.size = sizeof(tySequence__sM4lkSb7zS6F7OVMvW9cffQ*);
NTI__sM4lkSb7zS6F7OVMvW9cffQ_.kind = 24;
NTI__sM4lkSb7zS6F7OVMvW9cffQ_.base = (&NTI__77mFvmsOLKik79ci2hXkHEg_);
NTI__sM4lkSb7zS6F7OVMvW9cffQ_.flags = 2;
NTI__sM4lkSb7zS6F7OVMvW9cffQ_.marker = Marker_tySequence__sM4lkSb7zS6F7OVMvW9cffQ;
NTI__uTVeDpjCH6aWw9c74YkAskA_.size = sizeof(tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA);
NTI__uTVeDpjCH6aWw9c74YkAskA_.kind = 14;
NTI__uTVeDpjCH6aWw9c74YkAskA_.base = 0;
NTI__uTVeDpjCH6aWw9c74YkAskA_.flags = 3;
for (TM__yu6cxgKBBXbNsTkT9cyMd4g_90 = 0; TM__yu6cxgKBBXbNsTkT9cyMd4g_90 < 9; TM__yu6cxgKBBXbNsTkT9cyMd4g_90++) {
TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_90+0].kind = 1;
TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_90+0].offset = TM__yu6cxgKBBXbNsTkT9cyMd4g_90;
TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_90+0].name = TM__yu6cxgKBBXbNsTkT9cyMd4g_89[TM__yu6cxgKBBXbNsTkT9cyMd4g_90];
TM__yu6cxgKBBXbNsTkT9cyMd4g_88_9[TM__yu6cxgKBBXbNsTkT9cyMd4g_90] = &TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_90+0];
}
TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9].len = 9; TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9].kind = 2; TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9].sons = &TM__yu6cxgKBBXbNsTkT9cyMd4g_88_9[0];
NTI__uTVeDpjCH6aWw9c74YkAskA_.node = &TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9];
}

