/* Generated by Nim Compiler v0.20.0 */
/*   (c) 2019 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 64

#include "nimbase.h"
#include <string.h>
#include <stdlib.h>
#include <FindDirectory.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.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 tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA;
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 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;
NU raiseId;
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 tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA {
NI a;
NI b;
};
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;
};
typedef NU8 tyEnum_FileMode_ZJfK20XeZ9bv2j1pZjw9aswg;
struct tyObject_Time_3y2ZpqsTJLqdZvpC9a0rU2Q {
NI64 seconds;
NI nanosecond;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClP_0) (Exception* e, void* ClE_0);
void* ClE_0;
} tyProc_NT9bSe2DDkjdtx7j9aov2Z6g;
struct TSafePoint {
TSafePoint* prev;
NI status;
jmp_buf context;
NIM_BOOL hasRaiseAction;
tyProc_NT9bSe2DDkjdtx7j9aov2Z6g raiseAction;
};
typedef NU16 tySet_tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA;
typedef NU8 tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA;
typedef NIM_CHAR tyArray_dTlC27m9c9aWd5dvuePYanug[256];
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_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_NIMCALL(void, nimRegisterThreadLocalMarker)(tyProc_T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newLen);
N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
static N_INLINE(NI, addInt)(NI a, NI b);
N_NOINLINE(void, raiseOverflow)(void);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(TGenericSeq*, incrSeqV3)(TGenericSeq* s, TNimType* typ);
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(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(NI, subInt)(NI a, NI b);
N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str);
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_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
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);
N_NIMCALL(void, raiseExceptionEx)(Exception* e, NCSTRING ename, NCSTRING procname, NCSTRING filename, NI line);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShell)(NimStringDesc* s);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShellPosix)(NimStringDesc* s);
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*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
static N_INLINE(NI, chckRange)(NI i, NI a, NI b);
N_NOINLINE(void, raiseRangeError)(NI64 val);
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_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, genericReset)(void* dest, TNimType* mt);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
static N_INLINE(NIM_CHAR, X5BX5D__okzHJ6GE9cv0bYG3b4r5KCAsystem)(NimStringDesc* s, NI i);
N_NIMCALL(NimStringDesc*, nimCharToStr)(NIM_CHAR x);
static N_INLINE(NimStringDesc*, X5BX5D__ogYTOKbgqbjPfyC123US1gsystem)(NimStringDesc* s, tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA x);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
static N_INLINE(tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA, dotdot__xNR8BVBMWzS9bXXNMikmyLgsystem)(NI a, NI b);
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(NimStringDesc*, substr_2yh9cer0ymNRHlOOg8P7IuA)(NimStringDesc* s, NI first, NI last);
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*, getApplHaiku_9bfzMt7nzg9apH9cE9c5SozLJw)(void);
static N_INLINE(size_t, nimCStrLen)(NCSTRING a);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getApplHeuristic_9bfzMt7nzg9apH9cE9c5SozLJw_2)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, paramStr_T0ST6UXXTEqaiXY9akIayng)(NI i);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename);
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_NIMCALL(NimStringDesc*, osErrorMsg_33xViSVWAmDrexoKkLfMhg)(NI32 errorCode);
N_LIB_PRIVATE N_NIMCALL(void, addQuoted_45fPtFhY4FavRaYwDhRfuA)(NimStringDesc** s, NimStringDesc* x);
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(NimStringDesc*, normalizePathEnd_cQ9bfE8YwK2s9aQkxFkMKhYg)(NimStringDesc* path, NIM_BOOL trailingSep);
N_LIB_PRIVATE N_NIMCALL(void, normalizePathEnd_gKUeJXj8CrWvxdeNCA2BXg)(NimStringDesc** path, NIM_BOOL trailingSep);
N_LIB_PRIVATE N_NIMCALL(NI, parentDirPos_sw9aya5BvknC6WiJX9aEYn9ag)(NimStringDesc* path);
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);
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);
N_LIB_PRIVATE N_NIMCALL(NIM_CHAR, nsuToLowerAsciiChar)(NIM_CHAR c);
N_LIB_PRIVATE N_NIMCALL(void, nossplitPath)(NimStringDesc* path, tyTuple_UV3llMMYFckfui8YMBuUZA* Result);
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*, alloc_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, dealloc_lmwgHsdhTsrQaepFju8wew)(void* p);
N_LIB_PRIVATE N_NIMCALL(void, flushFile_fU6ZlJAtQ9bre04EDZLdGsA_2)(FILE* f);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, ntLeTime)(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, NI nanosecond);
static N_INLINE(struct timespec, st_mtim_pE9cdzno9aFK08QQxSwtkHRgposix)(struct stat s);
N_LIB_PRIVATE N_NIMCALL(void, noscopyFile)(NimStringDesc* source, NimStringDesc* dest);
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(tySet_tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA, nosgetFilePermissions)(NimStringDesc* filename);
static N_INLINE(void, popSafePoint)(void);
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, 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(int, exitStatusLikeShell_vmXOHpv9cjOB5AHi6OOlhbw)(int status);
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(tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg, getSymlinkFileKind_wTnLPNAWjgwVnuiJ9ax0ZGQ)(NimStringDesc* path);
N_LIB_PRIVATE N_NIMCALL(void, nosremoveFile)(NimStringDesc* file);
N_LIB_PRIVATE N_NIMCALL(void, nosremoveDir)(NimStringDesc* dir);
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(void, noscopyDir)(NimStringDesc* source, NimStringDesc* dest);
N_LIB_PRIVATE N_NIMCALL(void, noscreateDir)(NimStringDesc* dir);
NIM_BOOL envComputed_LLyFo9bsdu1ZXMDvAe8DhrQ;
tySequence_sM4lkSb7zS6F7OVMvW9cffQ* environment_mlhK49b6YMgc9cgrcYkKq9a3g;
extern TNimType NTI_77mFvmsOLKik79ci2hXkHEg_;
TNimType NTI_sM4lkSb7zS6F7OVMvW9cffQ_;
extern NCSTRING* environ;
extern int cmdCount;
extern NCSTRING* cmdLine;
extern tyObject_GcHeap_1TRH1TZMaVZTnLNcIHuNFQ gch_IcYaEuuWivYAS86vFMTS3Q;
extern TNimType NTI_9bTGS9b5gqA3m1IgV71Csl0Q_;
extern TNimType NTI_K39aEGuwNdydKn2WFEpUygg_;
TNimType NTI_7q7q3E6Oj24ZNVJb9aonhAg_;
TNimType NTI_UV3llMMYFckfui8YMBuUZA_;
extern TNimType NTI_9clYsYwyjCqe2PFTuCI3Ubg_;
extern TNimType NTI_BeJgrOdDsczOwEWOZbRfKA_;
extern TNimType NTI_HMIVdYjdZYWskTmTQVo5BQ_;
extern TNimType NTI_iLZrPn9anoh9ad1MmO0RczFw_;
extern TSafePoint* excHandler_rqLlY5bs9atDw2OXYqJEn5g;
extern TSafePoint* excHandler_rqLlY5bs9atDw2OXYqJEn5g;
extern TSafePoint* excHandler_rqLlY5bs9atDw2OXYqJEn5g;
extern TSafePoint* excHandler_rqLlY5bs9atDw2OXYqJEn5g;
extern Exception* currException_9bVPeDJlYTi9bQApZpfH8wjg;
extern Exception* currException_9bVPeDJlYTi9bQApZpfH8wjg;
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_9, "index ", 6);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_10, " not in 0 .. ", 13);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_12, " ", 1);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_13, "\'\'", 2);
static NIM_CONST tySet_tyChar_nmiMWKVIe46vacnhAFrQvw TM_yu6cxgKBBXbNsTkT9cyMd4g_14 = {
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_15, "\'", 1);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_16, "\'\"\'\"\'", 5);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_22, "HOME", 4);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_23, "/", 1);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_43, "PATH", 4);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_48, "/Users/travis/build/nim-lang/nightlies/nim/e7471cebae2a404f3e42"
"39f199f5a0c422484aac/lib/pure/os.nim(1211, 19) `bufsize >= 0` ", 125);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_49, "Additional info: ", 17);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_50, "unknown OS error", 16);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_51, "/Users/travis/build/nim-lang/nightlies/nim/e7471cebae2a404f3e42"
"39f199f5a0c422484aac/lib/pure/os.nim(1885, 11) `path != \"\"` ", 123);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_59, "Failed to create \'", 18);
NIM_CONST tyTuple_1v9bKyksXWMsm0vNwmZ4EuQ TM_yu6cxgKBBXbNsTkT9cyMd4g_65 = {((NI) 0),
((NI) -1)}
;
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_71, "..", 2);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_87, "XDG_CONFIG_HOME", 15);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_88, ".config", 7);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_90, ".", 1);
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(NI, addInt)(NI a, NI b) {
	NI result;
{	result = (NI)0;
	result = (NI)((NU64)(a) + (NU64)(b));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 0) <= (NI)(result ^ a));
		if (T3_) goto LA4_;
		T3_ = (((NI) 0) <= (NI)(result ^ b));
		LA4_: ;
		if (!T3_) goto LA5_;
		goto BeforeRet_;
	}
	LA5_: ;
	raiseOverflow();
	}BeforeRet_: ;
	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 = (NI)((NU64)((*c).refcount) - (NU64)(((NI) 8)));
	{
		if (!((NU64)((*c).refcount) < (NU64)(((NI) 8)))) goto LA3_;
		rtlAddZCT_AT1eRuflKWyTTBdLjEDZbg_2system(c);
	}
	LA3_: ;
}

static N_INLINE(tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell_QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr) {
	tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g* result;
	result = (tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g*)0;
	result = ((tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g*) ((NI)((NU64)(((NI) (ptrdiff_t) (usr))) - (NU64)(((NI) 16)))));
	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;
					TM_yu6cxgKBBXbNsTkT9cyMd4g_3 = addInt(i, ((NI) 1));
					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];
				TM_yu6cxgKBBXbNsTkT9cyMd4g_4 = addInt(i, ((NI) 1));
				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]);
						TM_yu6cxgKBBXbNsTkT9cyMd4g_5 = addInt(i, ((NI) 1));
						i = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_5);
					} LA13: ;
				}
				{
					NI TM_yu6cxgKBBXbNsTkT9cyMd4g_6;
					if (!(i < (c ? c->Sup.len : 0))) goto LA18_;
					TM_yu6cxgKBBXbNsTkT9cyMd4g_6 = addInt(i, ((NI) 1));
					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]);
						TM_yu6cxgKBBXbNsTkT9cyMd4g_7 = addInt(i, ((NI) 1));
						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(NI, subInt)(NI a, NI b) {
	NI result;
{	result = (NI)0;
	result = (NI)((NU64)(a) - (NU64)(b));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 0) <= (NI)(result ^ a));
		if (T3_) goto LA4_;
		T3_ = (((NI) 0) <= (NI)(result ^ (NI)((NU64) ~(b))));
		LA4_: ;
		if (!T3_) goto LA5_;
		goto BeforeRet_;
	}
	LA5_: ;
	raiseOverflow();
	}BeforeRet_: ;
	return result;
}

N_LIB_PRIVATE N_NIMCALL(NI, paramCount_LYkRnwMk6UXTCs9c59cPvZsQ)(void) {
	NI result;
	NI TM_yu6cxgKBBXbNsTkT9cyMd4g_8;
	result = (NI)0;
	TM_yu6cxgKBBXbNsTkT9cyMd4g_8 = subInt(cmdCount, ((NI32) 1));
	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(void, incRef_AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell_1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = (NI)((NU64)((*c).refcount) + (NU64)(((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* e;
	NimStringDesc* T7_;
	NimStringDesc* T8_;
	NI TM_yu6cxgKBBXbNsTkT9cyMd4g_11;
	NimStringDesc* T9_;
{	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_: ;
	e = (tyObject_IndexError_K39aEGuwNdydKn2WFEpUygg*)0;
	e = (tyObject_IndexError_K39aEGuwNdydKn2WFEpUygg*) newObj((&NTI_9bTGS9b5gqA3m1IgV71Csl0Q_), sizeof(tyObject_IndexError_K39aEGuwNdydKn2WFEpUygg));
	(*e).Sup.Sup.Sup.m_type = (&NTI_K39aEGuwNdydKn2WFEpUygg_);
	(*e).Sup.Sup.name = "IndexError";
	T7_ = (NimStringDesc*)0;
	T8_ = (NimStringDesc*)0;
	T8_ = nimIntToStr(i);
	TM_yu6cxgKBBXbNsTkT9cyMd4g_11 = subInt(cmdCount, ((NI32) 1));
	if (TM_yu6cxgKBBXbNsTkT9cyMd4g_11 < (-2147483647 -1) || TM_yu6cxgKBBXbNsTkT9cyMd4g_11 > 2147483647) raiseOverflow();
	T9_ = (NimStringDesc*)0;
	T9_ = nimIntToStr(((NI) ((NI32)(TM_yu6cxgKBBXbNsTkT9cyMd4g_11))));
	T7_ = rawNewString((T8_ ? T8_->Sup.len : 0) + (T9_ ? T9_->Sup.len : 0) + 19);
appendString(T7_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_9));
appendString(T7_, T8_);
appendString(T7_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_10));
appendString(T7_, T9_);
	asgnRef((void**) (&(*e).Sup.Sup.message), T7_);
	asgnRef((void**) (&(*e).Sup.Sup.parent), NIM_NIL);
	raiseExceptionEx((Exception*)e, "IndexError", "paramStr", "/Users/travis/build/nim-lang/nightlies/nim/e7471cebae2a404f3e42"
"39f199f5a0c422484aac/lib/pure/os.nim", 2587);
	}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*, 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_13));
		goto BeforeRet_;
	}
	LA3_: ;
	safe = allCharsInSet_dubrHoRt3C9a0HlJjsxM5ig(s, TM_yu6cxgKBBXbNsTkT9cyMd4g_14);
	{
		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_15), ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_16));
		T10_ = rawNewString((T11_ ? T11_->Sup.len : 0) + 2);
appendString(T10_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_15));
appendString(T10_, T11_);
appendString(T10_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_15));
		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*, 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_17;
				if (!(i_2 < colontmp_)) goto LA3;
				i = i_2;
				{
					if (!(((NI) 0) < i)) goto LA6_;
					result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_12));
				}
				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_);
				TM_yu6cxgKBBXbNsTkT9cyMd4g_17 = addInt(i_2, ((NI) 1));
				i_2 = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_17);
			} LA3: ;
		}
	}
	return result;
}

static N_INLINE(NI, chckRange)(NI i, NI a, NI b) {
	NI result;
{	result = (NI)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (a <= i);
		if (!(T3_)) goto LA4_;
		T3_ = (i <= b);
		LA4_: ;
		if (!T3_) goto LA5_;
		result = i;
		goto BeforeRet_;
	}
	goto LA1_;
	LA5_: ;
	{
		raiseRangeError(((NI64) (i)));
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}

N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail) {
	NimStringDesc* result;
	NI TM_yu6cxgKBBXbNsTkT9cyMd4g_18;
	NI state;
	result = (NimStringDesc*)0;
	TM_yu6cxgKBBXbNsTkT9cyMd4g_18 = addInt((head ? head->Sup.len : 0), (tail ? tail->Sup.len : 0));
	result = rawNewString(((NI)chckRange((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_18), ((NI) 0), ((NI) IL64(9223372036854775807)))));
	state = ((NI) 0);
	addNormalizePath_bx9csIXjBBeHkYSkIUixO1g(head, (&result), (&state), 47);
	{
		if (!((tail ? tail->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = addChar(result, 47);
	}
	goto LA1_;
	LA3_: ;
	{
		addNormalizePath_bx9csIXjBBeHkYSkIUixO1g(tail, (&result), (&state), 47);
	}
	LA1_: ;
	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_19;
				{
					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_);
				TM_yu6cxgKBBXbNsTkT9cyMd4g_19 = addInt(i, ((NI) 1));
				i = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_19);
			}
		} 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_20;
				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_: ;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_20 = addInt(res, ((NI) 1));
				res = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_20);
			} 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_21;
		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));
		TM_yu6cxgKBBXbNsTkT9cyMd4g_21 = addInt(T5_, ((NI) 1));
		result = substr_iGg0RIKceRvsmvq8FUHOEw(environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[i], (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_21));
		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_22), ((NimStringDesc*) NIM_NIL));
	T1_ = rawNewString((T2_ ? T2_->Sup.len : 0) + 1);
appendString(T1_, T2_);
appendString(T1_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_23));
	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;
}

static N_INLINE(NIM_CHAR, X5BX5D__okzHJ6GE9cv0bYG3b4r5KCAsystem)(NimStringDesc* s, NI i) {
	NIM_CHAR result;
	NI TM_yu6cxgKBBXbNsTkT9cyMd4g_25;
	result = (NIM_CHAR)0;
	TM_yu6cxgKBBXbNsTkT9cyMd4g_25 = subInt((s ? s->Sup.len : 0), i);
	if ((NU)((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_25)) >= (NU)(s ? s->Sup.len : 0)) raiseIndexError2((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_25),(s ? s->Sup.len : 0)-1);
	result = s->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_25)];
	return result;
}

static N_INLINE(NimStringDesc*, X5BX5D__ogYTOKbgqbjPfyC123US1gsystem)(NimStringDesc* s, tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA x) {
	NimStringDesc* result;
	NI a;
	NI L;
	NI TM_yu6cxgKBBXbNsTkT9cyMd4g_26;
	NI TM_yu6cxgKBBXbNsTkT9cyMd4g_27;
	NI TM_yu6cxgKBBXbNsTkT9cyMd4g_28;
	result = (NimStringDesc*)0;
	a = x.a;
	TM_yu6cxgKBBXbNsTkT9cyMd4g_26 = subInt((s ? s->Sup.len : 0), x.b);
	TM_yu6cxgKBBXbNsTkT9cyMd4g_27 = subInt((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_26), a);
	TM_yu6cxgKBBXbNsTkT9cyMd4g_28 = addInt((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_27), ((NI) 1));
	L = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_28);
	result = mnewString(((NI)chckRange(L, ((NI) 0), ((NI) IL64(9223372036854775807)))));
	{
		NI i;
		NI i_2;
		i = (NI)0;
		i_2 = ((NI) 0);
		{
			while (1) {
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_29;
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_30;
				if (!(i_2 < L)) goto LA3;
				i = i_2;
				if ((NU)(i) >= (NU)(result ? result->Sup.len : 0)) raiseIndexError2(i,(result ? result->Sup.len : 0)-1);
				TM_yu6cxgKBBXbNsTkT9cyMd4g_29 = addInt(i, a);
				if ((NU)((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_29)) >= (NU)(s ? s->Sup.len : 0)) raiseIndexError2((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_29),(s ? s->Sup.len : 0)-1);
				result->data[i] = s->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_29)];
				TM_yu6cxgKBBXbNsTkT9cyMd4g_30 = addInt(i_2, ((NI) 1));
				i_2 = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_30);
			} LA3: ;
		}
	}
	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);
}

static N_INLINE(tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA, dotdot__xNR8BVBMWzS9bXXNMikmyLgsystem)(NI a, NI b) {
	tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA result;
	nimZeroMem((void*)(&result), sizeof(tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA));
	chckNil((void*)(&result));
	nimZeroMem((void*)(&result), sizeof(tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA));
	result.a = a;
	result.b = b;
	return result;
}

N_LIB_PRIVATE N_NIMCALL(void, nossplitFile)(NimStringDesc* path, tyTuple_7q7q3E6Oj24ZNVJb9aonhAg* Result) {
	chckNil((void*)Result);
	genericReset((void*)Result, (&NTI_7q7q3E6Oj24ZNVJb9aonhAg_));
	{
		NimStringDesc* colontmp_;
		NimStringDesc* colontmp__2;
		NimStringDesc* colontmp__3;
		if (!((path ? path->Sup.len : 0) == ((NI) 0))) goto LA3_;
		colontmp_ = ((NimStringDesc*) NIM_NIL);
		colontmp__2 = ((NimStringDesc*) NIM_NIL);
		colontmp__3 = ((NimStringDesc*) NIM_NIL);
		unsureAsgnRef((void**) (&(*Result).Field0), copyString(colontmp_));
		unsureAsgnRef((void**) (&(*Result).Field1), copyString(colontmp__2));
		unsureAsgnRef((void**) (&(*Result).Field2), copyString(colontmp__3));
	}
	goto LA1_;
	LA3_: ;
	{
		NIM_CHAR T6_;
		T6_ = (NIM_CHAR)0;
		T6_ = X5BX5D__okzHJ6GE9cv0bYG3b4r5KCAsystem(path, ((NI) 1));
		if (!(((NU8)(T6_)) == ((NU8)(47)) || ((NU8)(T6_)) == ((NU8)(47)))) goto LA7_;
		{
			NimStringDesc* colontmp__4;
			NimStringDesc* colontmp__5;
			NimStringDesc* colontmp__6;
			if (!((path ? path->Sup.len : 0) == ((NI) 1))) goto LA11_;
			if ((NU)(((NI) 0)) >= (NU)(path ? path->Sup.len : 0)) raiseIndexError2(((NI) 0),(path ? path->Sup.len : 0)-1);
			colontmp__4 = nimCharToStr(path->data[((NI) 0)]);
			colontmp__5 = ((NimStringDesc*) NIM_NIL);
			colontmp__6 = ((NimStringDesc*) NIM_NIL);
			unsureAsgnRef((void**) (&(*Result).Field0), copyString(colontmp__4));
			unsureAsgnRef((void**) (&(*Result).Field1), copyString(colontmp__5));
			unsureAsgnRef((void**) (&(*Result).Field2), copyString(colontmp__6));
		}
		goto LA9_;
		LA11_: ;
		{
			NimStringDesc* colontmp__7;
			tyObject_HSlice_EE5dzjqoOrHT6HJhIPXAvA T14_;
			NimStringDesc* colontmp__8;
			NimStringDesc* colontmp__9;
			T14_ = dotdot__xNR8BVBMWzS9bXXNMikmyLgsystem(((NI) 0), ((NI) 2));
			colontmp__7 = X5BX5D__ogYTOKbgqbjPfyC123US1gsystem(path, T14_);
			colontmp__8 = ((NimStringDesc*) NIM_NIL);
			colontmp__9 = ((NimStringDesc*) NIM_NIL);
			unsureAsgnRef((void**) (&(*Result).Field0), copyString(colontmp__7));
			unsureAsgnRef((void**) (&(*Result).Field1), copyString(colontmp__8));
			unsureAsgnRef((void**) (&(*Result).Field2), copyString(colontmp__9));
		}
		LA9_: ;
	}
	goto LA1_;
	LA7_: ;
	{
		NI sepPos;
		NI dotPos;
		NI TM_yu6cxgKBBXbNsTkT9cyMd4g_36;
		NI TM_yu6cxgKBBXbNsTkT9cyMd4g_37;
		sepPos = ((NI) -1);
		dotPos = (path ? path->Sup.len : 0);
		{
			NI i;
			NI colontmp__10;
			NI TM_yu6cxgKBBXbNsTkT9cyMd4g_31;
			NI res;
			i = (NI)0;
			colontmp__10 = (NI)0;
			TM_yu6cxgKBBXbNsTkT9cyMd4g_31 = subInt((path ? path->Sup.len : 0), ((NI) 1));
			colontmp__10 = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_31);
			res = colontmp__10;
			{
				while (1) {
					NI TM_yu6cxgKBBXbNsTkT9cyMd4g_33;
					if (!(((NI) 0) <= res)) goto LA18;
					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 LA21_;
						{
							NIM_BOOL T25_;
							NIM_BOOL T26_;
							NI TM_yu6cxgKBBXbNsTkT9cyMd4g_32;
							T25_ = (NIM_BOOL)0;
							T26_ = (NIM_BOOL)0;
							T26_ = (dotPos == (path ? path->Sup.len : 0));
							if (!(T26_)) goto LA27_;
							T26_ = (((NI) 0) < i);
							LA27_: ;
							T25_ = T26_;
							if (!(T25_)) goto LA28_;
							TM_yu6cxgKBBXbNsTkT9cyMd4g_32 = subInt(i, ((NI) 1));
							if ((NU)((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_32)) >= (NU)(path ? path->Sup.len : 0)) raiseIndexError2((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_32),(path ? path->Sup.len : 0)-1);
							T25_ = !((((NU8)(path->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_32)])) == ((NU8)(47)) || ((NU8)(path->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_32)])) == ((NU8)(47)) || ((NU8)(path->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_32)])) == ((NU8)(46))));
							LA28_: ;
							if (!T25_) goto LA29_;
							dotPos = i;
						}
						LA29_: ;
					}
					goto LA19_;
					LA21_: ;
					{
						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 LA32_;
						sepPos = i;
						goto LA16;
					}
					goto LA19_;
					LA32_: ;
					LA19_: ;
					TM_yu6cxgKBBXbNsTkT9cyMd4g_33 = subInt(res, ((NI) 1));
					res = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_33);
				} LA18: ;
			}
		} LA16: ;
		{
			NI TM_yu6cxgKBBXbNsTkT9cyMd4g_34;
			NI TM_yu6cxgKBBXbNsTkT9cyMd4g_35;
			TM_yu6cxgKBBXbNsTkT9cyMd4g_34 = subInt(sepPos, ((NI) 1));
			if (!(((NI) 0) <= (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_34))) goto LA36_;
			TM_yu6cxgKBBXbNsTkT9cyMd4g_35 = subInt(sepPos, ((NI) 1));
			unsureAsgnRef((void**) (&(*Result).Field0), substr_2yh9cer0ymNRHlOOg8P7IuA(path, ((NI) 0), (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_35)));
		}
		goto LA34_;
		LA36_: ;
		{
			if ((NU)(((NI) 0)) >= (NU)(path ? path->Sup.len : 0)) raiseIndexError2(((NI) 0),(path ? path->Sup.len : 0)-1);
			if (!(((NU8)(path->data[((NI) 0)])) == ((NU8)(47)) || ((NU8)(path->data[((NI) 0)])) == ((NU8)(47)))) goto LA39_;
			if ((NU)(((NI) 0)) >= (NU)(path ? path->Sup.len : 0)) raiseIndexError2(((NI) 0),(path ? path->Sup.len : 0)-1);
			unsureAsgnRef((void**) (&(*Result).Field0), nimCharToStr(path->data[((NI) 0)]));
		}
		goto LA34_;
		LA39_: ;
		LA34_: ;
		TM_yu6cxgKBBXbNsTkT9cyMd4g_36 = addInt(sepPos, ((NI) 1));
		TM_yu6cxgKBBXbNsTkT9cyMd4g_37 = subInt(dotPos, ((NI) 1));
		unsureAsgnRef((void**) (&(*Result).Field1), substr_2yh9cer0ymNRHlOOg8P7IuA(path, (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_36), (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_37)));
		unsureAsgnRef((void**) (&(*Result).Field2), substr_iGg0RIKceRvsmvq8FUHOEw(path, dotPos));
	}
	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(void, nossplitPath)(NimStringDesc* path, tyTuple_UV3llMMYFckfui8YMBuUZA* Result) {
	NI sepPos;
	chckNil((void*)Result);
	genericReset((void*)Result, (&NTI_UV3llMMYFckfui8YMBuUZA_));
	sepPos = ((NI) -1);
	{
		NI i;
		NI colontmp_;
		NI TM_yu6cxgKBBXbNsTkT9cyMd4g_39;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		TM_yu6cxgKBBXbNsTkT9cyMd4g_39 = subInt((path ? path->Sup.len : 0), ((NI) 1));
		colontmp_ = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_39);
		res = colontmp_;
		{
			while (1) {
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_40;
				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_: ;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_40 = subInt(res, ((NI) 1));
				res = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_40);
			} LA3: ;
		}
	} LA1: ;
	{
		NI TM_yu6cxgKBBXbNsTkT9cyMd4g_41;
		NI TM_yu6cxgKBBXbNsTkT9cyMd4g_42;
		if (!(((NI) 0) <= sepPos)) goto LA10_;
		TM_yu6cxgKBBXbNsTkT9cyMd4g_41 = subInt(sepPos, ((NI) 1));
		unsureAsgnRef((void**) (&(*Result).Field0), substr_2yh9cer0ymNRHlOOg8P7IuA(path, ((NI) 0), (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_41)));
		TM_yu6cxgKBBXbNsTkT9cyMd4g_42 = addInt(sepPos, ((NI) 1));
		unsureAsgnRef((void**) (&(*Result).Field1), substr_iGg0RIKceRvsmvq8FUHOEw(path, (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_42)));
	}
	goto LA8_;
	LA10_: ;
	{
		unsureAsgnRef((void**) (&(*Result).Field0), ((NimStringDesc*) NIM_NIL));
		unsureAsgnRef((void**) (&(*Result).Field1), copyString(path));
	}
	LA8_: ;
}

static N_INLINE(size_t, nimCStrLen)(NCSTRING a) {
	size_t result;
	result = (size_t)0;
	result = strlen(a);
	return result;
}

N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getApplHaiku_9bfzMt7nzg9apH9cE9c5SozLJw)(void) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	result = mnewString(((NI) 1024));
	{
		NI32 T3_;
		NI realLen;
		T3_ = (NI32)0;
		T3_ = find_path(NIM_NIL, ((int) 1000), NIM_NIL, nimToCStringConv(result), ((NI) 1024));
		if (!(T3_ == ((NI32) 0))) goto LA4_;
		realLen = (nimToCStringConv(result) ? nimCStrLen(nimToCStringConv(result)) : 0);
		result = setLengthStr(result, ((NI)chckRange(realLen, ((NI) 0), ((NI) IL64(9223372036854775807)))));
	}
	goto LA1_;
	LA4_: ;
	{
		result = ((NimStringDesc*) NIM_NIL);
	}
	LA1_: ;
	return result;
}

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_2)(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 last;
			NI splits;
			p = (NimStringDesc*)0;
			colontmp_ = (NimStringDesc*)0;
			colontmp_ = getEnv_hhED57tMl0Iaa5bOg9cJaig(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_43), ((NimStringDesc*) NIM_NIL));
			last = ((NI) 0);
			splits = ((NI) -1);
			{
				while (1) {
					NI first;
					NI TM_yu6cxgKBBXbNsTkT9cyMd4g_45;
					NimStringDesc* x;
					NI TM_yu6cxgKBBXbNsTkT9cyMd4g_46;
					NI TM_yu6cxgKBBXbNsTkT9cyMd4g_47;
					if (!(last <= (colontmp_ ? colontmp_->Sup.len : 0))) goto LA9;
					first = last;
					{
						while (1) {
							NIM_BOOL T12_;
							NI TM_yu6cxgKBBXbNsTkT9cyMd4g_44;
							T12_ = (NIM_BOOL)0;
							T12_ = (last < (colontmp_ ? colontmp_->Sup.len : 0));
							if (!(T12_)) goto LA13_;
							if ((NU)(last) >= (NU)(colontmp_ ? colontmp_->Sup.len : 0)) raiseIndexError2(last,(colontmp_ ? colontmp_->Sup.len : 0)-1);
							T12_ = !((((NU8)(colontmp_->data[last])) == ((NU8)(58))));
							LA13_: ;
							if (!T12_) goto LA11;
							TM_yu6cxgKBBXbNsTkT9cyMd4g_44 = addInt(last, ((NI) 1));
							last = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_44);
						} LA11: ;
					}
					{
						if (!(splits == ((NI) 0))) goto LA16_;
						last = (colontmp_ ? colontmp_->Sup.len : 0);
					}
					LA16_: ;
					TM_yu6cxgKBBXbNsTkT9cyMd4g_45 = subInt(last, ((NI) 1));
					p = substr_2yh9cer0ymNRHlOOg8P7IuA(colontmp_, first, (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_45));
					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 (!(splits == ((NI) 0))) goto LA25_;
						goto LA8;
					}
					LA25_: ;
					TM_yu6cxgKBBXbNsTkT9cyMd4g_46 = subInt(splits, ((NI) 1));
					splits = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_46);
					TM_yu6cxgKBBXbNsTkT9cyMd4g_47 = addInt(last, ((NI) 1));
					last = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_47);
				} LA9: ;
			} LA8: ;
		}
	}
	LA5_: ;
	}BeforeRet_: ;
	return result;
}

N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetAppFilename)(void) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	result = getApplHaiku_9bfzMt7nzg9apH9cE9c5SozLJw();
	{
		if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = getApplHeuristic_9bfzMt7nzg9apH9cE9c5SozLJw_2();
	}
	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(void, raiseOSError_CWyPYlyH9a6rAuZckFyVxPA)(NI32 errorCode, NimStringDesc* additionalInfo) {
	tyObject_OSError_BeJgrOdDsczOwEWOZbRfKA* e;
	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_49));
		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_50));
		if (T16_) nimGCunrefNoCycle(T16_);
	}
	LA14_: ;
	raiseExceptionEx((Exception*)e, "OSError", "raiseOSError", "/Users/travis/build/nim-lang/nightlies/nim/e7471cebae2a404f3e42"
"39f199f5a0c422484aac/lib/pure/includes/oserr.nim", 85);
}

N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void) {
	NimStringDesc* result;
	NI bufsize;
	result = (NimStringDesc*)0;
	bufsize = ((NI) 1024);
	result = mnewString(((NI)chckRange(bufsize, ((NI) 0), ((NI) IL64(9223372036854775807)))));
	{
		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));
				result = setLengthStr(result, ((NI)chckRange(T9_, ((NI) 0), ((NI) IL64(9223372036854775807)))));
				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_48));
					}
					LA17_: ;
					result = mnewString(((NI)chckRange(bufsize, ((NI) 0), ((NI) IL64(9223372036854775807)))));
				}
				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(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_51));
	}
	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*, 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(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_, ((NimStringDesc*) NIM_NIL));
	}
	goto LA1_;
	LA3_: ;
	{
		result = cstrToNimstr(r);
		free(((void*) (r)));
	}
	LA1_: ;
	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) {
			NIM_BOOL T7_;
			NI TM_yu6cxgKBBXbNsTkT9cyMd4g_52;
			NI TM_yu6cxgKBBXbNsTkT9cyMd4g_53;
			T7_ = (NIM_BOOL)0;
			T7_ = (((NI) 1) <= i);
			if (!(T7_)) goto LA8_;
			TM_yu6cxgKBBXbNsTkT9cyMd4g_52 = subInt(i, ((NI) 1));
			if ((NU)((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_52)) >= (NU)((*path) ? (*path)->Sup.len : 0)) raiseIndexError2((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_52),((*path) ? (*path)->Sup.len : 0)-1);
			T7_ = (((NU8)((*path)->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_52)])) == ((NU8)(47)) || ((NU8)((*path)->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_52)])) == ((NU8)(47)));
			LA8_: ;
			if (!T7_) goto LA6;
			TM_yu6cxgKBBXbNsTkT9cyMd4g_53 = subInt(i, ((NI) 1));
			i = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_53);
		} LA6: ;
	}
	{
		if (!trailingSep) goto LA11_;
		unsureAsgnRef((void**) (&(*path)), setLengthStr((*path), ((NI)chckRange(i, ((NI) 0), ((NI) IL64(9223372036854775807))))));
		unsureAsgnRef((void**) (&(*path)), addChar((*path), 47));
	}
	goto LA9_;
	LA11_: ;
	{
		if (!(((NI) 0) < i)) goto LA14_;
		unsureAsgnRef((void**) (&(*path)), setLengthStr((*path), ((NI)chckRange(i, ((NI) 0), ((NI) IL64(9223372036854775807))))));
	}
	goto LA9_;
	LA14_: ;
	{
		unsureAsgnRef((void**) (&(*path)), copyString(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_23)));
	}
	LA9_: ;
	}BeforeRet_: ;
}

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(NI, parentDirPos_sw9aya5BvknC6WiJX9aEYn9ag)(NimStringDesc* path) {
	NI result;
	NI q;
{	result = (NI)0;
	q = ((NI) 1);
	{
		NIM_BOOL T3_;
		NI TM_yu6cxgKBBXbNsTkT9cyMd4g_54;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI) 1) <= (path ? path->Sup.len : 0));
		if (!(T3_)) goto LA4_;
		TM_yu6cxgKBBXbNsTkT9cyMd4g_54 = subInt((path ? path->Sup.len : 0), ((NI) 1));
		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_;
		q = ((NI) 2);
	}
	LA5_: ;
	{
		NI i;
		NI colontmp_;
		NI TM_yu6cxgKBBXbNsTkT9cyMd4g_55;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		TM_yu6cxgKBBXbNsTkT9cyMd4g_55 = subInt((path ? path->Sup.len : 0), q);
		colontmp_ = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_55);
		res = colontmp_;
		{
			while (1) {
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_56;
				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_: ;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_56 = subInt(res, ((NI) 1));
				res = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_56);
			} LA9: ;
		}
	}
	result = ((NI) -1);
	}BeforeRet_: ;
	return result;
}

N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosparentDir)(NimStringDesc* path) {
	NimStringDesc* result;
	NI sepPos;
	result = (NimStringDesc*)0;
	result = normalizePathEnd_cQ9bfE8YwK2s9aQkxFkMKhYg(path, NIM_FALSE);
	sepPos = parentDirPos_sw9aya5BvknC6WiJX9aEYn9ag(result);
	{
		if (!(((NI) 0) <= sepPos)) goto LA3_;
		{
			while (1) {
				NIM_BOOL T7_;
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_57;
				T7_ = (NIM_BOOL)0;
				T7_ = (((NI) 0) <= sepPos);
				if (!(T7_)) goto LA8_;
				if ((NU)(sepPos) >= (NU)(result ? result->Sup.len : 0)) raiseIndexError2(sepPos,(result ? result->Sup.len : 0)-1);
				T7_ = (((NU8)(result->data[sepPos])) == ((NU8)(47)) || ((NU8)(result->data[sepPos])) == ((NU8)(47)));
				LA8_: ;
				if (!T7_) goto LA6;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_57 = subInt(sepPos, ((NI) 1));
				sepPos = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_57);
			} LA6: ;
		}
		result = substr_2yh9cer0ymNRHlOOg8P7IuA(result, ((NI) 0), sepPos);
	}
	goto LA1_;
	LA3_: ;
	{
		result = ((NimStringDesc*) NIM_NIL);
	}
	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_: ;
	{
		NIM_BOOL T6_;
		T6_ = (NIM_BOOL)0;
		T6_ = (errno == EEXIST);
		if (T6_) goto LA7_;
		T6_ = (errno == EROFS);
		LA7_: ;
		if (!T6_) goto LA8_;
		result = NIM_FALSE;
	}
	goto LA1_;
	LA8_: ;
	{
		NI32 T11_;
		T11_ = (NI32)0;
		T11_ = osLastError_9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError_CWyPYlyH9a6rAuZckFyVxPA(T11_, dir);
	}
	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(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* e;
			NimStringDesc* T11_;
			T8_ = (NIM_BOOL)0;
			T8_ = nosexistsDir(dir);
			if (!!(T8_)) goto LA9_;
			e = (tyObject_IOError_iLZrPn9anoh9ad1MmO0RczFw*)0;
			e = (tyObject_IOError_iLZrPn9anoh9ad1MmO0RczFw*) newObj((&NTI_HMIVdYjdZYWskTmTQVo5BQ_), sizeof(tyObject_IOError_iLZrPn9anoh9ad1MmO0RczFw));
			(*e).Sup.Sup.Sup.m_type = (&NTI_iLZrPn9anoh9ad1MmO0RczFw_);
			(*e).Sup.Sup.name = "IOError";
			T11_ = (NimStringDesc*)0;
			T11_ = rawNewString((dir ? dir->Sup.len : 0) + 19);
appendString(T11_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_59));
appendString(T11_, dir);
appendString(T11_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_15));
			asgnRef((void**) (&(*e).Sup.Sup.message), T11_);
			asgnRef((void**) (&(*e).Sup.Sup.parent), NIM_NIL);
			raiseExceptionEx((Exception*)e, "IOError", "existsOrCreateDir", "/Users/travis/build/nim-lang/nightlies/nim/e7471cebae2a404f3e42"
"39f199f5a0c422484aac/lib/pure/os.nim", 2132);
		}
		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_58;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		TM_yu6cxgKBBXbNsTkT9cyMd4g_58 = subInt((dir ? dir->Sup.len : 0), ((NI) 1));
		colontmp_ = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_58);
		res = ((NI) 1);
		{
			while (1) {
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_61;
				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_60;
						NimStringDesc* T13_;
						NIM_BOOL T14_;
						TM_yu6cxgKBBXbNsTkT9cyMd4g_60 = subInt(i, ((NI) 1));
						T13_ = (NimStringDesc*)0;
						T13_ = substr_2yh9cer0ymNRHlOOg8P7IuA(dir, ((NI) 0), (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_60));
						T14_ = (NIM_BOOL)0;
						T14_ = nosexistsOrCreateDir(T13_);
						(void)(T14_);
					}
					LA8_: ;
				}
				LA6_: ;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_61 = addInt(res, ((NI) 1));
				res = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_61);
			} 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_62;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		TM_yu6cxgKBBXbNsTkT9cyMd4g_62 = subInt((path ? path->Sup.len : 0), ((NI) 1));
		colontmp_ = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_62);
		res = colontmp_;
		{
			while (1) {
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_63;
				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_: ;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_63 = subInt(res, ((NI) 1));
				res = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_63);
			} 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_64;
		NimStringDesc* T9_;
		NimStringDesc* T10_;
		T8_ = (NimStringDesc*)0;
		TM_yu6cxgKBBXbNsTkT9cyMd4g_64 = subInt(extPos, ((NI) 1));
		T9_ = (NimStringDesc*)0;
		T9_ = substr_2yh9cer0ymNRHlOOg8P7IuA(filename, ((NI) 0), (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_64));
		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(NimStringDesc*, nosrelativePath)(NimStringDesc* path, NimStringDesc* base, NIM_CHAR sep) {
	NimStringDesc* result;
	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_: ;
	nimZeroMem((void*)(&f), sizeof(tyObject_PathIter_tllF14xUpDWpqG9ci5sg9bMg));
	nimZeroMem((void*)(&b), sizeof(tyObject_PathIter_tllF14xUpDWpqG9ci5sg9bMg));
	ff = TM_yu6cxgKBBXbNsTkT9cyMd4g_65;
	bb = TM_yu6cxgKBBXbNsTkT9cyMd4g_65;
	result = rawNewString(((NI)chckRange((path ? path->Sup.len : 0), ((NI) 0), ((NI) IL64(9223372036854775807)))));
	{
		while (1) {
			NIM_BOOL T7_;
			NI diff;
			NI TM_yu6cxgKBBXbNsTkT9cyMd4g_66;
			NIM_BOOL same;
			NI colontmp_;
			NI colontmp__2;
			NI colontmp__3;
			NI colontmp__4;
			T7_ = (NIM_BOOL)0;
			T7_ = hasNext_ecfBf9bSnUlnf5OQ0NQMxpQ(f, path);
			if (!(T7_)) goto LA8_;
			T7_ = hasNext_ecfBf9bSnUlnf5OQ0NQMxpQ(b, base);
			LA8_: ;
			if (!T7_) goto LA6;
			ff = next_am1q4dBd9cls9au5CcmkX5oA((&f), path);
			bb = next_am1q4dBd9cls9au5CcmkX5oA((&b), base);
			TM_yu6cxgKBBXbNsTkT9cyMd4g_66 = subInt(ff.Field1, ff.Field0);
			diff = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_66);
			{
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_67;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_67 = subInt(bb.Field1, bb.Field0);
				if (!!((diff == (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_67)))) goto LA11_;
				goto LA5;
			}
			LA11_: ;
			same = NIM_TRUE;
			{
				NI i;
				NI res;
				i = (NI)0;
				res = ((NI) 0);
				{
					while (1) {
						NI TM_yu6cxgKBBXbNsTkT9cyMd4g_70;
						if (!(res <= diff)) goto LA15;
						i = res;
						{
							NI TM_yu6cxgKBBXbNsTkT9cyMd4g_68;
							NIM_CHAR T18_;
							NI TM_yu6cxgKBBXbNsTkT9cyMd4g_69;
							NIM_CHAR T19_;
							TM_yu6cxgKBBXbNsTkT9cyMd4g_68 = addInt(i, ff.Field0);
							if ((NU)((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_68)) >= (NU)(path ? path->Sup.len : 0)) raiseIndexError2((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_68),(path ? path->Sup.len : 0)-1);
							T18_ = (NIM_CHAR)0;
							T18_ = nsuToLowerAsciiChar(path->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_68)]);
							TM_yu6cxgKBBXbNsTkT9cyMd4g_69 = addInt(i, bb.Field0);
							if ((NU)((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_69)) >= (NU)(base ? base->Sup.len : 0)) raiseIndexError2((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_69),(base ? base->Sup.len : 0)-1);
							T19_ = (NIM_CHAR)0;
							T19_ = nsuToLowerAsciiChar(base->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_69)]);
							if (!!(((NU8)(T18_) == (NU8)(T19_)))) goto LA20_;
							same = NIM_FALSE;
							goto LA13;
						}
						LA20_: ;
						TM_yu6cxgKBBXbNsTkT9cyMd4g_70 = addInt(res, ((NI) 1));
						res = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_70);
					} LA15: ;
				}
			} LA13: ;
			{
				if (!!(same)) goto LA24_;
				goto LA5;
			}
			LA24_: ;
			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;
		} LA6: ;
	} LA5: ;
	{
		while (1) {
			{
				if (!(bb.Field0 <= bb.Field1)) goto LA30_;
				{
					NIM_BOOL T34_;
					NIM_CHAR T36_;
					T34_ = (NIM_BOOL)0;
					T34_ = (((NI) 0) < (result ? result->Sup.len : 0));
					if (!(T34_)) goto LA35_;
					T36_ = (NIM_CHAR)0;
					T36_ = X5BX5D__okzHJ6GE9cv0bYG3b4r5KCAsystem(result, ((NI) 1));
					T34_ = !(((NU8)(T36_) == (NU8)(sep)));
					LA35_: ;
					if (!T34_) goto LA37_;
					result = addChar(result, sep);
				}
				LA37_: ;
				result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_71));
			}
			LA30_: ;
			{
				NIM_BOOL T41_;
				T41_ = (NIM_BOOL)0;
				T41_ = hasNext_ecfBf9bSnUlnf5OQ0NQMxpQ(b, base);
				if (!!(T41_)) goto LA42_;
				goto LA26;
			}
			LA42_: ;
			bb = next_am1q4dBd9cls9au5CcmkX5oA((&b), base);
		}
	} LA26: ;
	{
		while (1) {
			{
				if (!(ff.Field0 <= ff.Field1)) goto LA48_;
				{
					NIM_BOOL T52_;
					NIM_CHAR T54_;
					T52_ = (NIM_BOOL)0;
					T52_ = (((NI) 0) < (result ? result->Sup.len : 0));
					if (!(T52_)) goto LA53_;
					T54_ = (NIM_CHAR)0;
					T54_ = X5BX5D__okzHJ6GE9cv0bYG3b4r5KCAsystem(result, ((NI) 1));
					T52_ = !(((NU8)(T54_) == (NU8)(sep)));
					LA53_: ;
					if (!T52_) goto LA55_;
					result = addChar(result, sep);
				}
				LA55_: ;
				{
					NI i_2;
					NI colontmp__5;
					NI TM_yu6cxgKBBXbNsTkT9cyMd4g_72;
					NI res_2;
					i_2 = (NI)0;
					colontmp__5 = (NI)0;
					TM_yu6cxgKBBXbNsTkT9cyMd4g_72 = subInt(ff.Field1, ff.Field0);
					colontmp__5 = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_72);
					res_2 = ((NI) 0);
					{
						while (1) {
							NI TM_yu6cxgKBBXbNsTkT9cyMd4g_73;
							NI TM_yu6cxgKBBXbNsTkT9cyMd4g_74;
							if (!(res_2 <= colontmp__5)) goto LA59;
							i_2 = res_2;
							TM_yu6cxgKBBXbNsTkT9cyMd4g_73 = addInt(i_2, ff.Field0);
							if ((NU)((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_73)) >= (NU)(path ? path->Sup.len : 0)) raiseIndexError2((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_73),(path ? path->Sup.len : 0)-1);
							result = addChar(result, path->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_73)]);
							TM_yu6cxgKBBXbNsTkT9cyMd4g_74 = addInt(res_2, ((NI) 1));
							res_2 = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_74);
						} LA59: ;
					}
				}
			}
			LA48_: ;
			{
				NIM_BOOL T62_;
				T62_ = (NIM_BOOL)0;
				T62_ = hasNext_ecfBf9bSnUlnf5OQ0NQMxpQ(f, path);
				if (!!(T62_)) goto LA63_;
				goto LA44;
			}
			LA63_: ;
			ff = next_am1q4dBd9cls9au5CcmkX5oA((&f), path);
		}
	} LA44: ;
	}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(NimStringDesc*, nosextractFilename)(NimStringDesc* path) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	{
		NIM_BOOL T3_;
		NI TM_yu6cxgKBBXbNsTkT9cyMd4g_75;
		T3_ = (NIM_BOOL)0;
		T3_ = ((path ? path->Sup.len : 0) == ((NI) 0));
		if (T3_) goto LA4_;
		TM_yu6cxgKBBXbNsTkT9cyMd4g_75 = subInt((path ? path->Sup.len : 0), ((NI) 1));
		if ((NU)((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_75)) >= (NU)(path ? path->Sup.len : 0)) raiseIndexError2((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_75),(path ? path->Sup.len : 0)-1);
		T3_ = (((NU8)(path->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_75)])) == ((NU8)(47)) || ((NU8)(path->data[(NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_75)])) == ((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(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;
}

N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell_vmXOHpv9cjOB5AHi6OOlhbw)(int status) {
	int result;
	result = (int)0;
	{
		NIM_BOOL T3_;
		int T6_;
		NI TM_yu6cxgKBBXbNsTkT9cyMd4g_76;
		T3_ = (NIM_BOOL)0;
		T3_ = WIFSIGNALED(status);
		if (!T3_) goto LA4_;
		T6_ = (int)0;
		T6_ = WTERMSIG(status);
		TM_yu6cxgKBBXbNsTkT9cyMd4g_76 = addInt(((NI32) 128), T6_);
		if (TM_yu6cxgKBBXbNsTkT9cyMd4g_76 < (-2147483647 -1) || TM_yu6cxgKBBXbNsTkT9cyMd4g_76 > 2147483647) raiseOverflow();
		result = (NI32)(TM_yu6cxgKBBXbNsTkT9cyMd4g_76);
	}
	goto LA1_;
	LA4_: ;
	{
		result = WEXITSTATUS(status);
	}
	LA1_: ;
	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_, ((NimStringDesc*) NIM_NIL));
	}
	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_, ((NimStringDesc*) NIM_NIL));
	}
	LA10_: ;
	buf = alloc_WrVG9abV9chlTLqkiXYLKwUg_2(((NI) 8000));
	{
		while (1) {
			NI bytesread;
			bytesread = readBuffer_Y9atVWUcVyKHG9aBP4D0P9czA_2(s, buf, ((NI) 8000));
			{
				NI byteswritten;
				if (!(((NI) 0) < bytesread)) goto LA17_;
				byteswritten = writeBuffer_Y9atVWUcVyKHG9aBP4D0P9czA(d, buf, ((NI)chckRange(bytesread, ((NI) 0), ((NI) IL64(9223372036854775807)))));
				{
					NI32 T23_;
					if (!!((bytesread == byteswritten))) goto LA21_;
					dealloc_lmwgHsdhTsrQaepFju8wew(buf);
					close_fU6ZlJAtQ9bre04EDZLdGsA_3(s);
					close_fU6ZlJAtQ9bre04EDZLdGsA_3(d);
					T23_ = (NI32)0;
					T23_ = osLastError_9bUWNxbcGnToMWA9b79aTXLIw();
					raiseOSError_CWyPYlyH9a6rAuZckFyVxPA(T23_, ((NimStringDesc*) NIM_NIL));
				}
				LA21_: ;
			}
			LA17_: ;
			{
				if (!!((bytesread == ((NI) 8000)))) goto LA26_;
				goto LA13;
			}
			LA26_: ;
		}
	} LA13: ;
	dealloc_lmwgHsdhTsrQaepFju8wew(buf);
	close_fU6ZlJAtQ9bre04EDZLdGsA_3(s);
	flushFile_fU6ZlJAtQ9bre04EDZLdGsA_2(d);
	close_fU6ZlJAtQ9bre04EDZLdGsA_3(d);
}

static N_INLINE(tyObject_Time_3y2ZpqsTJLqdZvpC9a0rU2Q, toTime_ijMjyFbtGRbszYH28YzkiQos)(struct timespec ts) {
	tyObject_Time_3y2ZpqsTJLqdZvpC9a0rU2Q result;
	nimZeroMem((void*)(&result), sizeof(tyObject_Time_3y2ZpqsTJLqdZvpC9a0rU2Q));
	result = initTime_JIXNH9cQMG3SbZ0hXqEYDvA(((NI64) (ts.tv_sec)), ((NI)chckRange(ts.tv_nsec, ((NI) 0), ((NI) 999999999))));
	return result;
}

static N_INLINE(struct timespec, st_mtim_pE9cdzno9aFK08QQxSwtkHRgposix)(struct stat s) {
	struct timespec result;
	nimZeroMem((void*)(&result), sizeof(struct timespec));
	result.tv_sec = s.st_mtime;
	return result;
}

N_LIB_PRIVATE N_NIMCALL(tyObject_Time_3y2ZpqsTJLqdZvpC9a0rU2Q, nosgetLastModificationTime)(NimStringDesc* file) {
	tyObject_Time_3y2ZpqsTJLqdZvpC9a0rU2Q result;
	struct stat res;
	struct timespec T7_;
	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_, ((NimStringDesc*) NIM_NIL));
	}
	LA4_: ;
	T7_ = st_mtim_pE9cdzno9aFK08QQxSwtkHRgposix(res);
	result = toTime_ijMjyFbtGRbszYH28YzkiQos(T7_);
	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 = ntLeTime(T1_, T2_);
	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;
}

static N_INLINE(void, pushSafePoint)(TSafePoint* s) {
	(*s).hasRaiseAction = NIM_FALSE;
	(*s).prev = excHandler_rqLlY5bs9atDw2OXYqJEn5g;
	excHandler_rqLlY5bs9atDw2OXYqJEn5g = s;
}

N_LIB_PRIVATE N_NIMCALL(void, nossetFilePermissions)(NimStringDesc* filename, tySet_tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA permissions) {
	NI32 p;
	p = ((NI32) 0);
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 2))&15U)))!=0)) goto LA3_;
		p = (NI32)(p | S_IRUSR);
	}
	LA3_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 1))&15U)))!=0)) goto LA7_;
		p = (NI32)(p | S_IWUSR);
	}
	LA7_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 0))&15U)))!=0)) goto LA11_;
		p = (NI32)(p | S_IXUSR);
	}
	LA11_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 5))&15U)))!=0)) goto LA15_;
		p = (NI32)(p | S_IRGRP);
	}
	LA15_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 4))&15U)))!=0)) goto LA19_;
		p = (NI32)(p | S_IWGRP);
	}
	LA19_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 3))&15U)))!=0)) goto LA23_;
		p = (NI32)(p | S_IXGRP);
	}
	LA23_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 8))&15U)))!=0)) goto LA27_;
		p = (NI32)(p | S_IROTH);
	}
	LA27_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 7))&15U)))!=0)) goto LA31_;
		p = (NI32)(p | S_IWOTH);
	}
	LA31_: ;
	{
		if (!((permissions &(1U<<((NU)(((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 6))&15U)))!=0)) goto LA35_;
		p = (NI32)(p | S_IXOTH);
	}
	LA35_: ;
	{
		int T39_;
		NI32 T42_;
		T39_ = (int)0;
		T39_ = chmod(nimToCStringConv(filename), p);
		if (!!((T39_ == ((NI32) 0)))) goto LA40_;
		T42_ = (NI32)0;
		T42_ = osLastError_9bUWNxbcGnToMWA9b79aTXLIw();
		raiseOSError_CWyPYlyH9a6rAuZckFyVxPA(T42_, ((NimStringDesc*) NIM_NIL));
	}
	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_, ((NimStringDesc*) NIM_NIL));
	}
	LA4_: ;
	result = 0;
	{
		if (!!(((NI32)(a.st_mode & S_IRUSR) == ((NI32) 0)))) goto LA9_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 2)) & 15);
	}
	LA9_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IWUSR) == ((NI32) 0)))) goto LA13_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 1)) & 15);
	}
	LA13_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IXUSR) == ((NI32) 0)))) goto LA17_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 0)) & 15);
	}
	LA17_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IRGRP) == ((NI32) 0)))) goto LA21_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 5)) & 15);
	}
	LA21_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IWGRP) == ((NI32) 0)))) goto LA25_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 4)) & 15);
	}
	LA25_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IXGRP) == ((NI32) 0)))) goto LA29_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 3)) & 15);
	}
	LA29_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IROTH) == ((NI32) 0)))) goto LA33_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 8)) & 15);
	}
	LA33_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IWOTH) == ((NI32) 0)))) goto LA37_;
		result |= ((NU16)1)<<((((tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA) 7)) & 15);
	}
	LA37_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IXOTH) == ((NI32) 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_77;
	noscopyFile(source, dest);
	pushSafePoint(&TM_yu6cxgKBBXbNsTkT9cyMd4g_77);
	TM_yu6cxgKBBXbNsTkT9cyMd4g_77.status = setjmp(TM_yu6cxgKBBXbNsTkT9cyMd4g_77.context);
	if (TM_yu6cxgKBBXbNsTkT9cyMd4g_77.status == 0) {
		tySet_tyEnum_FilePermission_uTVeDpjCH6aWw9c74YkAskA T2_;
		T2_ = nosgetFilePermissions(source);
		nossetFilePermissions(dest, T2_);
		popSafePoint();
	}
	else {
		popSafePoint();
		{
			TM_yu6cxgKBBXbNsTkT9cyMd4g_77.status = 0;
			{
				if (!!(ignorePermissionErrors)) goto LA7_;
				reraiseException();
			}
			LA7_: ;
			popCurrentException();
		}
	}
	if (TM_yu6cxgKBBXbNsTkT9cyMd4g_77.status != 0) reraiseException();
}

N_LIB_PRIVATE N_NIMCALL(void, nosremoveFile)(NimStringDesc* file) {
	{
		NIM_BOOL T3_;
		NI32 T6_;
		NCSTRING T7_;
		NimStringDesc* T8_;
		T3_ = (NIM_BOOL)0;
		T3_ = nostryRemoveFile(file);
		if (!!(T3_)) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError_9bUWNxbcGnToMWA9b79aTXLIw();
		T7_ = (NCSTRING)0;
		T7_ = strerror(errno);
		T8_ = (NimStringDesc*)0;
		T8_ = cstrToNimstr(T7_);
		raiseOSError_CWyPYlyH9a6rAuZckFyVxPA(T6_, T8_);
	}
	LA4_: ;
}

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_78;
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_79;
				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_: ;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_78 = addInt(result, ((NI) 1));
				result = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_78);
				TM_yu6cxgKBBXbNsTkT9cyMd4g_79 = addInt(i_2, ((NI) 1));
				i_2 = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_79);
			} 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* ext;
			NI i;
			ext = (NimStringDesc*)0;
			i = ((NI) 0);
			{
				while (1) {
					NI TM_yu6cxgKBBXbNsTkT9cyMd4g_80;
					if (!(i < extensionsLen_0)) goto LA12;
					if ((NU)(i) >= (NU)(extensionsLen_0)) raiseIndexError2(i,extensionsLen_0-1);
					ext = extensions[i];
					result = nosaddFileExt(exe, ext);
					{
						NIM_BOOL T15_;
						T15_ = (NIM_BOOL)0;
						T15_ = nosexistsFile(result);
						if (!T15_) goto LA16_;
						goto BeforeRet_;
					}
					LA16_: ;
					TM_yu6cxgKBBXbNsTkT9cyMd4g_80 = addInt(i, ((NI) 1));
					i = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_80);
				} LA12: ;
			}
		}
	}
	LA8_: ;
	path = getEnv_hhED57tMl0Iaa5bOg9cJaig(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_43), ((NimStringDesc*) NIM_NIL));
	{
		NimStringDesc* candidate;
		NI last;
		NI splits;
		candidate = (NimStringDesc*)0;
		last = ((NI) 0);
		splits = ((NI) -1);
		{
			while (1) {
				NI first;
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_82;
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_85;
				NI TM_yu6cxgKBBXbNsTkT9cyMd4g_86;
				if (!(last <= (path ? path->Sup.len : 0))) goto LA20;
				first = last;
				{
					while (1) {
						NIM_BOOL T23_;
						NI TM_yu6cxgKBBXbNsTkT9cyMd4g_81;
						T23_ = (NIM_BOOL)0;
						T23_ = (last < (path ? path->Sup.len : 0));
						if (!(T23_)) goto LA24_;
						if ((NU)(last) >= (NU)(path ? path->Sup.len : 0)) raiseIndexError2(last,(path ? path->Sup.len : 0)-1);
						T23_ = !(((NU8)(path->data[last]) == (NU8)(58)));
						LA24_: ;
						if (!T23_) goto LA22;
						TM_yu6cxgKBBXbNsTkT9cyMd4g_81 = addInt(last, ((NI) 1));
						last = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_81);
					} LA22: ;
				}
				{
					if (!(splits == ((NI) 0))) goto LA27_;
					last = (path ? path->Sup.len : 0);
				}
				LA27_: ;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_82 = subInt(last, ((NI) 1));
				candidate = substr_2yh9cer0ymNRHlOOg8P7IuA(path, first, (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_82));
				{
					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_2;
						NI i_2;
						ext_2 = (NimStringDesc*)0;
						i_2 = ((NI) 0);
						{
							while (1) {
								NimStringDesc* x_2;
								NI TM_yu6cxgKBBXbNsTkT9cyMd4g_84;
								if (!(i_2 < extensionsLen_0)) goto LA37;
								if ((NU)(i_2) >= (NU)(extensionsLen_0)) raiseIndexError2(i_2,extensionsLen_0-1);
								ext_2 = extensions[i_2];
								x_2 = nosaddFileExt(x, ext_2);
								{
									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_, ((NimStringDesc*) NIM_NIL));
												}
												LA52_: ;
												{
													NI TM_yu6cxgKBBXbNsTkT9cyMd4g_83;
													if (!(((NI) 256) < len)) goto LA57_;
													TM_yu6cxgKBBXbNsTkT9cyMd4g_83 = addInt(len, ((NI) 1));
													r = mnewString(((NI)chckRange((NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_83), ((NI) 0), ((NI) IL64(9223372036854775807)))));
													len = readlink(nimToCStringConv(x_2), nimToCStringConv(r), len);
												}
												LA57_: ;
												r = setLengthStr(r, ((NI)chckRange(len, ((NI) 0), ((NI) IL64(9223372036854775807)))));
												{
													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_: ;
								TM_yu6cxgKBBXbNsTkT9cyMd4g_84 = addInt(i_2, ((NI) 1));
								i_2 = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_84);
							} LA37: ;
						}
					}
				} LA29: ;
				{
					if (!(splits == ((NI) 0))) goto LA69_;
					goto LA19;
				}
				LA69_: ;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_85 = subInt(splits, ((NI) 1));
				splits = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_85);
				TM_yu6cxgKBBXbNsTkT9cyMd4g_86 = addInt(last, ((NI) 1));
				last = (NI)(TM_yu6cxgKBBXbNsTkT9cyMd4g_86);
			} LA20: ;
		} LA19: ;
	}
	result = ((NimStringDesc*) NIM_NIL);
	}BeforeRet_: ;
	return result;
}

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_22), ((NimStringDesc*) NIM_NIL));
	T2_ = (NimStringDesc*)0;
	T2_ = slash__gEyhbzZ1UcxyenWRLJRXNQ(T1_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_88));
	result = getEnv_hhED57tMl0Iaa5bOg9cJaig(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_87), 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;
}

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(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_, ((NimStringDesc*) NIM_NIL));
	}
	LA6_: ;
}

N_LIB_PRIVATE N_NIMCALL(void, nosremoveDir)(NimStringDesc* dir) {
	{
		tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg kind;
		NimStringDesc* path;
		DIR* d;
		kind = (tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg)0;
		path = (NimStringDesc*)0;
		d = opendir(nimToCStringConv(dir));
		{
			TSafePoint TM_yu6cxgKBBXbNsTkT9cyMd4g_89;
			if (!!((d == NIM_NIL))) goto LA4_;
			pushSafePoint(&TM_yu6cxgKBBXbNsTkT9cyMd4g_89);
			TM_yu6cxgKBBXbNsTkT9cyMd4g_89.status = setjmp(TM_yu6cxgKBBXbNsTkT9cyMd4g_89.context);
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_89.status == 0) {
				{
					while (1) {
						struct dirent* x;
						NimStringDesc* y;
						x = readdir(d);
						{
							if (!(x == NIM_NIL)) goto LA11_;
							goto LA7;
						}
						LA11_: ;
						y = cstrToNimstr(((NCSTRING) ((*x).d_name)));
						{
							NIM_BOOL T15_;
							struct stat s;
							NimStringDesc* path_2;
							tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg k;
							T15_ = (NIM_BOOL)0;
							T15_ = !(eqStrings(y, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_90)));
							if (!(T15_)) goto LA16_;
							T15_ = !(eqStrings(y, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_71)));
							LA16_: ;
							if (!T15_) goto LA17_;
							nimZeroMem((void*)(&s), sizeof(struct stat));
							path_2 = slash__gEyhbzZ1UcxyenWRLJRXNQ(dir, y);
							{
								if (!NIM_TRUE) goto LA21_;
								y = copyString(path_2);
							}
							LA21_: ;
							k = ((tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0);
							{
								int T25_;
								T25_ = (int)0;
								T25_ = lstat(nimToCStringConv(path_2), (&s));
								if (!(T25_ < ((NI32) 0))) goto LA26_;
								goto LA7;
							}
							LA26_: ;
							{
								NIM_BOOL T30_;
								T30_ = (NIM_BOOL)0;
								T30_ = S_ISDIR(s.st_mode);
								if (!T30_) goto LA31_;
								k = ((tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
							}
							goto LA28_;
							LA31_: ;
							{
								NIM_BOOL T34_;
								T34_ = (NIM_BOOL)0;
								T34_ = S_ISLNK(s.st_mode);
								if (!T34_) goto LA35_;
								k = getSymlinkFileKind_wTnLPNAWjgwVnuiJ9ax0ZGQ(path_2);
							}
							goto LA28_;
							LA35_: ;
							LA28_: ;
							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);
							}
							break;
							}
						}
						LA17_: ;
					}
				} LA7: ;
				popSafePoint();
			}
			else {
				popSafePoint();
			}
			{
				int T41_;
				T41_ = (int)0;
				T41_ = closedir(d);
				(void)(T41_);
			}
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_89.status != 0) reraiseException();
		}
		LA4_: ;
	}
	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_: ;
		{
			NCSTRING T11_;
			NimStringDesc* T12_;
			T11_ = (NCSTRING)0;
			T11_ = strerror(errno);
			T12_ = (NimStringDesc*)0;
			T12_ = cstrToNimstr(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_91;
		T3_ = (NIM_BOOL)0;
		T3_ = tryMoveFSObject_43wKg5fKy6XSTFw35EBkzA(source, dest);
		if (!!(T3_)) goto LA4_;
		noscopyFile(source, dest);
		pushSafePoint(&TM_yu6cxgKBBXbNsTkT9cyMd4g_91);
		TM_yu6cxgKBBXbNsTkT9cyMd4g_91.status = setjmp(TM_yu6cxgKBBXbNsTkT9cyMd4g_91.context);
		if (TM_yu6cxgKBBXbNsTkT9cyMd4g_91.status == 0) {
			nosremoveFile(source);
			popSafePoint();
		}
		else {
			popSafePoint();
			{
				NIM_BOOL T9_;
				TM_yu6cxgKBBXbNsTkT9cyMd4g_91.status = 0;
				T9_ = (NIM_BOOL)0;
				T9_ = nostryRemoveFile(dest);
				(void)(T9_);
				reraiseException();
				popCurrentException();
			}
		}
		if (TM_yu6cxgKBBXbNsTkT9cyMd4g_91.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));
		{
			TSafePoint TM_yu6cxgKBBXbNsTkT9cyMd4g_92;
			if (!!((d == NIM_NIL))) goto LA4_;
			pushSafePoint(&TM_yu6cxgKBBXbNsTkT9cyMd4g_92);
			TM_yu6cxgKBBXbNsTkT9cyMd4g_92.status = setjmp(TM_yu6cxgKBBXbNsTkT9cyMd4g_92.context);
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_92.status == 0) {
				{
					while (1) {
						struct dirent* x;
						NimStringDesc* y;
						x = readdir(d);
						{
							if (!(x == NIM_NIL)) goto LA11_;
							goto LA7;
						}
						LA11_: ;
						y = cstrToNimstr(((NCSTRING) ((*x).d_name)));
						{
							NIM_BOOL T15_;
							struct stat s;
							NimStringDesc* path_2;
							tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg k;
							NimStringDesc* noSource;
							tyTuple_UV3llMMYFckfui8YMBuUZA T37_;
							T15_ = (NIM_BOOL)0;
							T15_ = !(eqStrings(y, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_90)));
							if (!(T15_)) goto LA16_;
							T15_ = !(eqStrings(y, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_71)));
							LA16_: ;
							if (!T15_) goto LA17_;
							nimZeroMem((void*)(&s), sizeof(struct stat));
							path_2 = slash__gEyhbzZ1UcxyenWRLJRXNQ(source, y);
							{
								if (!NIM_TRUE) goto LA21_;
								y = copyString(path_2);
							}
							LA21_: ;
							k = ((tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0);
							{
								int T25_;
								T25_ = (int)0;
								T25_ = lstat(nimToCStringConv(path_2), (&s));
								if (!(T25_ < ((NI32) 0))) goto LA26_;
								goto LA7;
							}
							LA26_: ;
							{
								NIM_BOOL T30_;
								T30_ = (NIM_BOOL)0;
								T30_ = S_ISDIR(s.st_mode);
								if (!T30_) goto LA31_;
								k = ((tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
							}
							goto LA28_;
							LA31_: ;
							{
								NIM_BOOL T34_;
								T34_ = (NIM_BOOL)0;
								T34_ = S_ISLNK(s.st_mode);
								if (!T34_) goto LA35_;
								k = getSymlinkFileKind_wTnLPNAWjgwVnuiJ9ax0ZGQ(path_2);
							}
							goto LA28_;
							LA35_: ;
							LA28_: ;
							kind = k;
							path = y;
							nimZeroMem((void*)(&T37_), sizeof(tyTuple_UV3llMMYFckfui8YMBuUZA));
							nossplitPath(path, (&T37_));
							noSource = copyString(T37_.Field1);
							switch (kind) {
							case ((tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
							{
								NimStringDesc* T39_;
								T39_ = (NimStringDesc*)0;
								T39_ = slash__gEyhbzZ1UcxyenWRLJRXNQ(dest, noSource);
								noscopyFile(path, T39_);
							}
							break;
							case ((tyEnum_PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
							{
								NimStringDesc* T41_;
								T41_ = (NimStringDesc*)0;
								T41_ = slash__gEyhbzZ1UcxyenWRLJRXNQ(dest, noSource);
								noscopyDir(path, T41_);
							}
							break;
							default:
							{
							}
							break;
							}
						}
						LA17_: ;
					}
				} LA7: ;
				popSafePoint();
			}
			else {
				popSafePoint();
			}
			{
				int T45_;
				T45_ = (int)0;
				T45_ = closedir(d);
				(void)(T45_);
			}
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_92.status != 0) reraiseException();
		}
		LA4_: ;
	}
}

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);
	}
	LA4_: ;
}
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_24_3[3];
static TNimNode* TM_yu6cxgKBBXbNsTkT9cyMd4g_38_2[2];
static TNimNode TM_yu6cxgKBBXbNsTkT9cyMd4g_0[7];
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_7q7q3E6Oj24ZNVJb9aonhAg_.size = sizeof(tyTuple_7q7q3E6Oj24ZNVJb9aonhAg);
NTI_7q7q3E6Oj24ZNVJb9aonhAg_.kind = 18;
NTI_7q7q3E6Oj24ZNVJb9aonhAg_.base = 0;
NTI_7q7q3E6Oj24ZNVJb9aonhAg_.flags = 2;
TM_yu6cxgKBBXbNsTkT9cyMd4g_24_3[0] = &TM_yu6cxgKBBXbNsTkT9cyMd4g_0[1];
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[1].kind = 1;
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[1].offset = offsetof(tyTuple_7q7q3E6Oj24ZNVJb9aonhAg, Field0);
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[1].typ = (&NTI_77mFvmsOLKik79ci2hXkHEg_);
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[1].name = "Field0";
TM_yu6cxgKBBXbNsTkT9cyMd4g_24_3[1] = &TM_yu6cxgKBBXbNsTkT9cyMd4g_0[2];
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[2].kind = 1;
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[2].offset = offsetof(tyTuple_7q7q3E6Oj24ZNVJb9aonhAg, Field1);
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[2].typ = (&NTI_77mFvmsOLKik79ci2hXkHEg_);
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[2].name = "Field1";
TM_yu6cxgKBBXbNsTkT9cyMd4g_24_3[2] = &TM_yu6cxgKBBXbNsTkT9cyMd4g_0[3];
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[3].kind = 1;
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[3].offset = offsetof(tyTuple_7q7q3E6Oj24ZNVJb9aonhAg, Field2);
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[3].typ = (&NTI_77mFvmsOLKik79ci2hXkHEg_);
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[3].name = "Field2";
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[0].len = 3; TM_yu6cxgKBBXbNsTkT9cyMd4g_0[0].kind = 2; TM_yu6cxgKBBXbNsTkT9cyMd4g_0[0].sons = &TM_yu6cxgKBBXbNsTkT9cyMd4g_24_3[0];
NTI_7q7q3E6Oj24ZNVJb9aonhAg_.node = &TM_yu6cxgKBBXbNsTkT9cyMd4g_0[0];
NTI_UV3llMMYFckfui8YMBuUZA_.size = sizeof(tyTuple_UV3llMMYFckfui8YMBuUZA);
NTI_UV3llMMYFckfui8YMBuUZA_.kind = 18;
NTI_UV3llMMYFckfui8YMBuUZA_.base = 0;
NTI_UV3llMMYFckfui8YMBuUZA_.flags = 2;
TM_yu6cxgKBBXbNsTkT9cyMd4g_38_2[0] = &TM_yu6cxgKBBXbNsTkT9cyMd4g_0[5];
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[5].kind = 1;
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[5].offset = offsetof(tyTuple_UV3llMMYFckfui8YMBuUZA, Field0);
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[5].typ = (&NTI_77mFvmsOLKik79ci2hXkHEg_);
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[5].name = "Field0";
TM_yu6cxgKBBXbNsTkT9cyMd4g_38_2[1] = &TM_yu6cxgKBBXbNsTkT9cyMd4g_0[6];
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[6].kind = 1;
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[6].offset = offsetof(tyTuple_UV3llMMYFckfui8YMBuUZA, Field1);
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[6].typ = (&NTI_77mFvmsOLKik79ci2hXkHEg_);
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[6].name = "Field1";
TM_yu6cxgKBBXbNsTkT9cyMd4g_0[4].len = 2; TM_yu6cxgKBBXbNsTkT9cyMd4g_0[4].kind = 2; TM_yu6cxgKBBXbNsTkT9cyMd4g_0[4].sons = &TM_yu6cxgKBBXbNsTkT9cyMd4g_38_2[0];
NTI_UV3llMMYFckfui8YMBuUZA_.node = &TM_yu6cxgKBBXbNsTkT9cyMd4g_0[4];
}

