/* Generated by Nim Compiler v0.17.0 */
/*   (c) 2017 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, i386, gcc */
/* Command for C compiler:
   gcc -c  -w -O3 -fno-strict-aliasing -fPIC  -I/build/nim/src/Nim-0.17.0/lib -o lib/nimcache/stdlib_os.o lib/nimcache/stdlib_os.c */
#define NIM_NEW_MANGLING_RULES
#define NIM_INTBITS 32

#include "nimbase.h"
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <setjmp.h>
#include <dirent.h>
#undef linux
#undef near
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct OSError_3XwRQvmzCEOC4QnT706q1g OSError_3XwRQvmzCEOC4QnT706q1g;
typedef struct SystemError_Fjf9b9b2IlzRO2tspHxG3tgg SystemError_Fjf9b9b2IlzRO2tspHxG3tgg;
typedef struct Exception Exception;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Cell_1zcF9cV8XIAtbN8h5HRUB8g Cell_1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct TSafePoint TSafePoint;
typedef struct TY_sM4lkSb7zS6F7OVMvW9cffQ TY_sM4lkSb7zS6F7OVMvW9cffQ;
typedef struct IOError_9czoZw3pzPyrBmb5zTHY1OQ IOError_9czoZw3pzPyrBmb5zTHY1OQ;
typedef struct TY_7q7q3E6Oj24ZNVJb9aonhAg TY_7q7q3E6Oj24ZNVJb9aonhAg;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 TNimKind_jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 TNimTypeFlag_v8QUszD1sWlSIWZz7mC4bQ_Set;
typedef N_NIMCALL_PTR(void, TY_ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY_WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct  TNimType  {
NI size;
TNimKind_jIBKr1ejBgsfM33Kxw4j7A kind;
TNimTypeFlag_v8QUszD1sWlSIWZz7mC4bQ_Set flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY_ojoeKfW4VYIm36I9cpDTQIg marker;
TY_WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Exception  {
  TNimObject Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
NimStringDesc* trace;
};
struct  SystemError_Fjf9b9b2IlzRO2tspHxG3tgg  {
  Exception Sup;
};
struct  OSError_3XwRQvmzCEOC4QnT706q1g  {
  SystemError_Fjf9b9b2IlzRO2tspHxG3tgg Sup;
NI32 errorCode;
};
typedef NU8 TNimNodeKind_unfNsxrcATrufDZmpBq4HQ;
struct  TNimNode  {
TNimNodeKind_unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Cell_1zcF9cV8XIAtbN8h5HRUB8g  {
NI refcount;
TNimType* typ;
};
typedef NU8 FileMode_fVUBHvW79bXUw1j55Oo9avSQ;
typedef NU16 FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set;
typedef NU8 FilePermission_uTVeDpjCH6aWw9c74YkAskA;
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClP_0) (Exception* e, void* ClE_0);
void* ClE_0;
} TY_KeeAOYBd84Ofsw6Y7LizaQ;
struct  TSafePoint  {
TSafePoint* prev;
NI status;
jmp_buf context;
NIM_BOOL hasRaiseAction;
TY_KeeAOYBd84Ofsw6Y7LizaQ raiseAction;
};
typedef N_NIMCALL_PTR(void, TY_T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
typedef NU8 PathComponent_9c1SIU9cO1wHcl09b703A9cDrg;
typedef NIM_CHAR TY_dTlC27m9c9aWd5dvuePYanug[256];
struct  IOError_9czoZw3pzPyrBmb5zTHY1OQ  {
  SystemError_Fjf9b9b2IlzRO2tspHxG3tgg Sup;
};
struct TY_7q7q3E6Oj24ZNVJb9aonhAg {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct TY_sM4lkSb7zS6F7OVMvW9cffQ {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
N_LIB_EXPORT N_CDECL(NimStringDesc*, nososErrorMsg)(void);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_copyString)(NimStringDesc* src);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_cstrToNimstr)(NCSTRING str);
N_LIB_EXPORT N_NOINLINE(void, nosraiseOSError)(NimStringDesc* msg);
N_LIB_EXPORT N_CDECL(void*, nimrtl_newObj)(TNimType* typ, NI size);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(Cell_1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell_yB9aH5WIlwd0xkYrcdPeXrQsystem)(void* usr);
N_LIB_EXPORT N_CDECL(void, nimrtl_rtlAddZCT)(Cell_1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incRef_9cAA5YuQAAC3MVbnGeV86swsystem)(Cell_1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, decRef_MV4BBk6J1qu70IbBxwEn4wsystem)(Cell_1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_EXPORT N_CDECL(void, nimrtl_raiseException)(Exception* e, NCSTRING ename);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nosexistsDir)(NimStringDesc* dir);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nossymlinkExists)(NimStringDesc* link);
N_LIB_EXPORT N_CDECL(time_t, nosgetLastModificationTime)(NimStringDesc* file);
N_NOINLINE(void, raiseOSError_86HIIOlD5N61CWaO5GBgqA)(NI32 errorCode, NimStringDesc* additionalInfo);
N_NIMCALL(NimStringDesc*, osErrorMsg_v9awlLNgSl9aayKENuY0r8AA)(NI32 errorCode);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, copyMem_fPlwH3r9agN9aEHB6yCPMh0wsystem)(void* dest, void* source, NI size);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(NI32, osLastError_YyC2FKP9bqQiUDq2XVqW9acA)(void);
static N_INLINE(time_t, st_mtime_d9amWXYkQ1xK9aLGpB9cMCmOAos)(struct stat* s);
N_LIB_EXPORT N_CDECL(time_t, nosgetLastAccessTime)(NimStringDesc* file);
static N_INLINE(time_t, st_atime_d9amWXYkQ1xK9aLGpB9cMCmOA_2os)(struct stat* s);
N_LIB_EXPORT N_CDECL(time_t, nosgetCreationTime)(NimStringDesc* file);
static N_INLINE(time_t, st_ctime_d9amWXYkQ1xK9aLGpB9cMCmOA_3os)(struct stat* s);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nosfileNewer)(NimStringDesc* a, NimStringDesc* b);
N_LIB_EXPORT N_CDECL(NI64, ntDiffTime)(time_t a, time_t b);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetCurrentDir)(void);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
static N_INLINE(NIM_BOOL, eqeq__9ccNWqrTIE9bcAqE2Q0ro7zgos)(NCSTRING x, NCSTRING y);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_setLengthStr)(NimStringDesc* s, NI newLen);
N_NOINLINE(void, raiseAssert_PpfSiTIeNpMAb9a5o6SglJw_2)(NimStringDesc* msg);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosexpandFilename)(NimStringDesc* filename);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nossameFile)(NimStringDesc* path1, NimStringDesc* path2);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nossameFileContent)(NimStringDesc* path1, NimStringDesc* path2);
N_NIMCALL(NIM_BOOL, open_sEp0GH2306oGo9bqBpj5oTQ)(FILE** f, NimStringDesc* filename, FileMode_fVUBHvW79bXUw1j55Oo9avSQ mode, NI bufSize);
N_NIMCALL(void, close_BWnr8V7RERYno9bIdPmw8Hw_2)(FILE* f);
N_LIB_EXPORT N_NOCONV(void*, nimrtl_alloc)(NI size);
N_NIMCALL(NI, readBuffer_nZ0pNe9cd9cXtoayexCiaDtA)(FILE* f, void* buffer, NI len);
static N_INLINE(NIM_BOOL, equalMem_DCrUjdaMvFDHaR1hs7sQGwstrutils)(void* a, void* b, NI size);
N_LIB_EXPORT N_NOCONV(void, nimrtl_dealloc)(void* p);
N_LIB_EXPORT N_CDECL(FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set, nosgetFilePermissions)(NimStringDesc* filename);
N_LIB_EXPORT N_CDECL(void, nossetFilePermissions)(NimStringDesc* filename, FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions);
N_LIB_EXPORT N_CDECL(void, noscopyFile)(NimStringDesc* source, NimStringDesc* dest);
N_NIMCALL(NI, writeBuffer_nZ0pNe9cd9cXtoayexCiaDtA_2)(FILE* f, void* buffer, NI len);
N_NIMCALL(void, flushFile_BWnr8V7RERYno9bIdPmw8Hw_3)(FILE* f);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nostryRemoveFile)(NimStringDesc* file);
N_LIB_EXPORT N_CDECL(void, nosremoveFile)(NimStringDesc* file);
N_LIB_EXPORT N_CDECL(void, nosmoveFile)(NimStringDesc* source, NimStringDesc* dest);
N_LIB_EXPORT N_CDECL(void, nimrtl_pushSafePoint)(TSafePoint* s);
N_LIB_EXPORT N_CDECL(void, nimrtl_popSafePoint)(void);
N_LIB_EXPORT N_CDECL(void, nimrtl_reraiseException)(void);
N_LIB_EXPORT N_CDECL(void, nimrtl_popCurrentException)(void);
N_LIB_EXPORT N_CDECL(NI, nosexecShellCmd)(NimStringDesc* command);
N_LIB_EXPORT N_CDECL(void, nimrtl_nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM_yu6cxgKBBXbNsTkT9cyMd4g_7)(void);
N_NIMCALL(void, nimRegisterGlobalMarker)(TY_T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_EXPORT N_CDECL(void, nosremoveDir)(NimStringDesc* dir);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(NimStringDesc*, slash__lXoMhn1ZYc9cAJa9bfA61msg)(NimStringDesc* head, NimStringDesc* tail);
static N_INLINE(NIM_BOOL, dirExists_wf0Ae3eLXw0lSNEFJMV3ogos)(NimStringDesc* dir);
N_NIMCALL(PathComponent_9c1SIU9cO1wHcl09b703A9cDrg, getSymlinkFileKind_WoXOp8qmMec1P4MyA3LBKg)(NimStringDesc* path);
N_NIMCALL(void, rawRemoveDir_P9aOuM3pg25yKqgBUm7qKng)(NimStringDesc* dir);
N_LIB_EXPORT N_CDECL(void, noscreateDir)(NimStringDesc* dir);
N_NIMCALL(NIM_BOOL, existsOrCreateDir_V86QyZrcGMPX0W9bv1Q53ww)(NimStringDesc* dir);
N_NIMCALL(NIM_BOOL, rawCreateDir_V86QyZrcGMPX0W9bv1Q53ww_2)(NimStringDesc* dir);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_nimIntToStr)(NI x);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start, NI last);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI first, NI last);
N_LIB_EXPORT N_CDECL(void, noscopyDir)(NimStringDesc* source, NimStringDesc* dest);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI start);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI first);
N_LIB_EXPORT N_CDECL(TY_sM4lkSb7zS6F7OVMvW9cffQ*, nosparseCmdLine)(NimStringDesc* c);
N_LIB_EXPORT N_CDECL(void*, nimrtl_newSeq)(TNimType* typ, NI len);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemSize);
N_LIB_EXPORT N_CDECL(void, noscopyDirWithPermissions)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL ignorePermissionErrors);
N_NIMCALL(void, copyFileWithPermissions_ocr9chMejxLldaYNB2fMsHw)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL ignorePermissionErrors);
N_LIB_EXPORT N_CDECL(void, nosinclFilePermissions)(NimStringDesc* filename, FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions);
N_LIB_EXPORT N_CDECL(void, nosexclFilePermissions)(NimStringDesc* filename, FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetHomeDir)(void);
N_NIMCALL(NimStringDesc*, getEnv_8zNgT9bxx7m9cTt2TeVdTdIw)(NimStringDesc* key);
N_NIMCALL(NI, findEnvVar_cmJJ3H7KloA4DztTvzWyCw)(NimStringDesc* key);
N_NIMCALL(void, getEnvVarsC_xlXgIeBHBOL9cl4MJcFJ8xA)(void);
N_LIB_EXPORT N_CDECL(void*, nimrtl_newSeqRC1)(TNimType* typ, NI len);
static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix);
N_LIB_EXPORT N_CDECL(NI, nsuFindChar)(NimStringDesc* s, NIM_CHAR sub, NI start, NI last);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetConfigDir)(void);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetTempDir)(void);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetAppFilename)(void);
N_NIMCALL(NimStringDesc*, getApplAux_Cd6LaCdd4j2y8pff6G0r9aw)(NimStringDesc* procPath);
N_NIMCALL(NimStringDesc*, getApplHeuristic_cIsnssr9auuNc29cT9bLoxiqg)(void);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetApplicationFilename)(void);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetApplicationDir)(void);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY_7q7q3E6Oj24ZNVJb9aonhAg* Result);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetAppDir)(void);
N_LIB_EXPORT N_CDECL(void, nossleep)(NI milsecs);
N_LIB_EXPORT N_CDECL(NI64, nosgetFileSize)(NimStringDesc* file);
N_NIMCALL(NI64, getFileSize_XePgC9ccBXCgb9bEHXZpnMqA)(FILE* f);
extern TNimType NTI_Qx9aKy4vZ9bVz9bnG9brQcRHGA_;
extern TNimType NTI_3XwRQvmzCEOC4QnT706q1g_;
NIM_BOOL envComputed_LLyFo9bsdu1ZXMDvAe8DhrQ;
TY_sM4lkSb7zS6F7OVMvW9cffQ* environment_mlhK49b6YMgc9cgrcYkKq9a3g;
extern TNimType NTI_sM4lkSb7zS6F7OVMvW9cffQ_;
extern NCSTRING* environ;
extern TNimType NTI_HX2M9cQhE3jaovp9aYJDdslA_;
extern TNimType NTI_9czoZw3pzPyrBmb5zTHY1OQ_;
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_2, "", 0);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_3, "unknown OS error", 16);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_4, "\012Additional info: ", 18);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_5, "\012  0 <= bufsize ", 16);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_9, ".", 1);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_10, "..", 2);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_11, "Failed to create the directory", 30);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_16, "HOME", 4);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_17, "/", 1);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_18, "/.config/", 9);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_19, "/tmp/", 5);
STRING_LITERAL(TM_yu6cxgKBBXbNsTkT9cyMd4g_20, "/proc/self/exe", 14);

N_LIB_EXPORT N_CDECL(NimStringDesc*, nososErrorMsg)(void) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	result = nimrtl_copyString(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	{
		NCSTRING T5_;
		if (!!((errno == ((NI32) 0)))) goto LA3_;
		T5_ = (NCSTRING)0;
		T5_ = strerror(errno);
		result = nimrtl_cstrToNimstr(T5_);
	}
	LA3_: ;
	return result;
}

static N_INLINE(Cell_1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell_yB9aH5WIlwd0xkYrcdPeXrQsystem)(void* usr) {
	Cell_1zcF9cV8XIAtbN8h5HRUB8g* result;
	result = (Cell_1zcF9cV8XIAtbN8h5HRUB8g*)0;
	result = ((Cell_1zcF9cV8XIAtbN8h5HRUB8g*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(Cell_1zcF9cV8XIAtbN8h5HRUB8g))))));
	return result;
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	Cell_1zcF9cV8XIAtbN8h5HRUB8g* c;
	c = usrToCell_yB9aH5WIlwd0xkYrcdPeXrQsystem(p);
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3_;
		nimrtl_rtlAddZCT(c);
	}
	LA3_: ;
}

static N_INLINE(void, incRef_9cAA5YuQAAC3MVbnGeV86swsystem)(Cell_1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = (NI)((NU32)((*c).refcount) + (NU32)(((NI) 8)));
}

static N_INLINE(void, decRef_MV4BBk6J1qu70IbBxwEn4wsystem)(Cell_1zcF9cV8XIAtbN8h5HRUB8g* c) {
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3_;
		nimrtl_rtlAddZCT(c);
	}
	LA3_: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		Cell_1zcF9cV8XIAtbN8h5HRUB8g* T5_;
		if (!!((src == NIM_NIL))) goto LA3_;
		T5_ = (Cell_1zcF9cV8XIAtbN8h5HRUB8g*)0;
		T5_ = usrToCell_yB9aH5WIlwd0xkYrcdPeXrQsystem(src);
		incRef_9cAA5YuQAAC3MVbnGeV86swsystem(T5_);
	}
	LA3_: ;
	{
		Cell_1zcF9cV8XIAtbN8h5HRUB8g* T10_;
		if (!!(((*dest) == NIM_NIL))) goto LA8_;
		T10_ = (Cell_1zcF9cV8XIAtbN8h5HRUB8g*)0;
		T10_ = usrToCell_yB9aH5WIlwd0xkYrcdPeXrQsystem((*dest));
		decRef_MV4BBk6J1qu70IbBxwEn4wsystem(T10_);
	}
	LA8_: ;
	(*dest) = src;
}

N_LIB_EXPORT N_NOINLINE(void, nosraiseOSError)(NimStringDesc* msg) {
	{
		NimStringDesc* m;
		OSError_3XwRQvmzCEOC4QnT706q1g* e;
		if (!((msg ? msg->Sup.len : 0) == ((NI) 0))) goto LA3_;
		m = nososErrorMsg();
		e = (OSError_3XwRQvmzCEOC4QnT706q1g*)0;
		e = (OSError_3XwRQvmzCEOC4QnT706q1g*) nimrtl_newObj((&NTI_Qx9aKy4vZ9bVz9bnG9brQcRHGA_), sizeof(OSError_3XwRQvmzCEOC4QnT706q1g));
		(*e).Sup.Sup.Sup.m_type = (&NTI_3XwRQvmzCEOC4QnT706q1g_);
		{
			NimStringDesc* T9_;
			if (!(((NI) 0) < (m ? m->Sup.len : 0))) goto LA7_;
			T9_ = (NimStringDesc*)0;
			T9_ = (*e).Sup.Sup.message; (*e).Sup.Sup.message = nimrtl_copyStringRC1(m);
			if (T9_) nimGCunrefNoCycle(T9_);
		}
		goto LA5_;
		LA7_: ;
		{
			NimStringDesc* T11_;
			T11_ = (NimStringDesc*)0;
			T11_ = (*e).Sup.Sup.message; (*e).Sup.Sup.message = nimrtl_copyStringRC1(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_3));
			if (T11_) nimGCunrefNoCycle(T11_);
		}
		LA5_: ;
		asgnRef((void**) (&(*e).Sup.Sup.parent), NIM_NIL);
		nimrtl_raiseException((Exception*)e, "OSError");
	}
	goto LA1_;
	LA3_: ;
	{
		OSError_3XwRQvmzCEOC4QnT706q1g* e_2;
		NimStringDesc* T13_;
		e_2 = (OSError_3XwRQvmzCEOC4QnT706q1g*)0;
		e_2 = (OSError_3XwRQvmzCEOC4QnT706q1g*) nimrtl_newObj((&NTI_Qx9aKy4vZ9bVz9bnG9brQcRHGA_), sizeof(OSError_3XwRQvmzCEOC4QnT706q1g));
		(*e_2).Sup.Sup.Sup.m_type = (&NTI_3XwRQvmzCEOC4QnT706q1g_);
		T13_ = (NimStringDesc*)0;
		T13_ = (*e_2).Sup.Sup.message; (*e_2).Sup.Sup.message = nimrtl_copyStringRC1(msg);
		if (T13_) nimGCunrefNoCycle(T13_);
		asgnRef((void**) (&(*e_2).Sup.Sup.parent), NIM_NIL);
		nimrtl_raiseException((Exception*)e_2, "OSError");
	}
	LA1_: ;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename) {
	NIM_BOOL result;
	struct stat res;
	NIM_BOOL T1_;
	int T2_;
{	result = (NIM_BOOL)0;
	memset((void*)(&res), 0, sizeof(res));
	T1_ = (NIM_BOOL)0;
	T2_ = (int)0;
	T2_ = stat(filename->data, (&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_EXPORT N_CDECL(NIM_BOOL, nosexistsDir)(NimStringDesc* dir) {
	NIM_BOOL result;
	struct stat res;
	NIM_BOOL T1_;
	int T2_;
{	result = (NIM_BOOL)0;
	memset((void*)(&res), 0, sizeof(res));
	T1_ = (NIM_BOOL)0;
	T2_ = (int)0;
	T2_ = stat(dir->data, (&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_EXPORT N_CDECL(NIM_BOOL, nossymlinkExists)(NimStringDesc* link) {
	NIM_BOOL result;
	struct stat res;
	NIM_BOOL T1_;
	int T2_;
{	result = (NIM_BOOL)0;
	memset((void*)(&res), 0, sizeof(res));
	T1_ = (NIM_BOOL)0;
	T2_ = (int)0;
	T2_ = lstat(link->data, (&res));
	T1_ = (((NI32) 0) <= T2_);
	if (!(T1_)) goto LA3_;
	T1_ = S_ISLNK(res.st_mode);
	LA3_: ;
	result = T1_;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}

N_NIMCALL(NimStringDesc*, osErrorMsg_v9awlLNgSl9aayKENuY0r8AA)(NI32 errorCode) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	result = nimrtl_copyString(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	{
		NCSTRING T5_;
		if (!!((errorCode == ((NI32) 0)))) goto LA3_;
		T5_ = (NCSTRING)0;
		T5_ = strerror(errorCode);
		result = nimrtl_cstrToNimstr(T5_);
	}
	LA3_: ;
	return result;
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		Cell_1zcF9cV8XIAtbN8h5HRUB8g* c;
		if (!!((src == NIM_NIL))) goto LA3_;
		c = usrToCell_yB9aH5WIlwd0xkYrcdPeXrQsystem(src);
		(*c).refcount += ((NI) 8);
	}
	LA3_: ;
	{
		Cell_1zcF9cV8XIAtbN8h5HRUB8g* c_2;
		if (!!(((*dest) == NIM_NIL))) goto LA7_;
		c_2 = usrToCell_yB9aH5WIlwd0xkYrcdPeXrQsystem((*dest));
		{
			(*c_2).refcount -= ((NI) 8);
			if (!((NU32)((*c_2).refcount) < (NU32)(((NI) 8)))) goto LA11_;
			nimrtl_rtlAddZCT(c_2);
		}
		LA11_: ;
	}
	LA7_: ;
	(*dest) = src;
}

static N_INLINE(void, copyMem_fPlwH3r9agN9aEHB6yCPMh0wsystem)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}

static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	copyMem_fPlwH3r9agN9aEHB6yCPMh0wsystem(((void*) ((&(*dest).data[((*dest).Sup.len)- 0]))), ((void*) ((*src).data)), ((NI) ((NI)((*src).Sup.len + ((NI) 1)))));
	(*dest).Sup.len += (*src).Sup.len;
}

N_NOINLINE(void, raiseOSError_86HIIOlD5N61CWaO5GBgqA)(NI32 errorCode, NimStringDesc* additionalInfo) {
	OSError_3XwRQvmzCEOC4QnT706q1g* e;
	e = (OSError_3XwRQvmzCEOC4QnT706q1g*)0;
	e = (OSError_3XwRQvmzCEOC4QnT706q1g*) nimrtl_newObj((&NTI_Qx9aKy4vZ9bVz9bnG9brQcRHGA_), sizeof(OSError_3XwRQvmzCEOC4QnT706q1g));
	(*e).Sup.Sup.Sup.m_type = (&NTI_3XwRQvmzCEOC4QnT706q1g_);
	(*e).errorCode = errorCode;
	{
		if (!((additionalInfo ? additionalInfo->Sup.len : 0) == ((NI) 0))) goto LA3_;
		asgnRefNoCycle((void**) (&(*e).Sup.Sup.message), osErrorMsg_v9awlLNgSl9aayKENuY0r8AA(errorCode));
	}
	goto LA1_;
	LA3_: ;
	{
		NimStringDesc* T6_;
		NimStringDesc* T7_;
		T6_ = (NimStringDesc*)0;
		T7_ = (NimStringDesc*)0;
		T7_ = osErrorMsg_v9awlLNgSl9aayKENuY0r8AA(errorCode);
		T6_ = rawNewString(T7_->Sup.len + additionalInfo->Sup.len + 18);
appendString(T6_, T7_);
appendString(T6_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_4));
appendString(T6_, additionalInfo);
		asgnRefNoCycle((void**) (&(*e).Sup.Sup.message), T6_);
	}
	LA1_: ;
	{
		NimStringDesc* T12_;
		if (!(((*e).Sup.Sup.message) && ((*e).Sup.Sup.message)->Sup.len == 0)) goto LA10_;
		T12_ = (NimStringDesc*)0;
		T12_ = (*e).Sup.Sup.message; (*e).Sup.Sup.message = nimrtl_copyStringRC1(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_3));
		if (T12_) nimGCunrefNoCycle(T12_);
	}
	LA10_: ;
	nimrtl_raiseException((Exception*)e, "OSError");
}

N_NIMCALL(NI32, osLastError_YyC2FKP9bqQiUDq2XVqW9acA)(void) {
	NI32 result;
	result = (NI32)0;
	result = errno;
	return result;
}

static N_INLINE(time_t, st_mtime_d9amWXYkQ1xK9aLGpB9cMCmOAos)(struct stat* s) {
	time_t result;
	result = (time_t)0;
	result = (*s).st_mtim.tv_sec;
	return result;
}

N_LIB_EXPORT N_CDECL(time_t, nosgetLastModificationTime)(NimStringDesc* file) {
	time_t result;
	struct stat res;
{	result = (time_t)0;
	memset((void*)(&res), 0, sizeof(res));
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = stat(file->data, (&res));
		if (!(T3_ < ((NI32) 0))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T6_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4_: ;
	result = st_mtime_d9amWXYkQ1xK9aLGpB9cMCmOAos((&res));
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}

static N_INLINE(time_t, st_atime_d9amWXYkQ1xK9aLGpB9cMCmOA_2os)(struct stat* s) {
	time_t result;
	result = (time_t)0;
	result = (*s).st_atim.tv_sec;
	return result;
}

N_LIB_EXPORT N_CDECL(time_t, nosgetLastAccessTime)(NimStringDesc* file) {
	time_t result;
	struct stat res;
{	result = (time_t)0;
	memset((void*)(&res), 0, sizeof(res));
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = stat(file->data, (&res));
		if (!(T3_ < ((NI32) 0))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T6_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4_: ;
	result = st_atime_d9amWXYkQ1xK9aLGpB9cMCmOA_2os((&res));
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}

static N_INLINE(time_t, st_ctime_d9amWXYkQ1xK9aLGpB9cMCmOA_3os)(struct stat* s) {
	time_t result;
	result = (time_t)0;
	result = (*s).st_ctim.tv_sec;
	return result;
}

N_LIB_EXPORT N_CDECL(time_t, nosgetCreationTime)(NimStringDesc* file) {
	time_t result;
	struct stat res;
{	result = (time_t)0;
	memset((void*)(&res), 0, sizeof(res));
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = stat(file->data, (&res));
		if (!(T3_ < ((NI32) 0))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T6_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4_: ;
	result = st_ctime_d9amWXYkQ1xK9aLGpB9cMCmOA_3os((&res));
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nosfileNewer)(NimStringDesc* a, NimStringDesc* b) {
	NIM_BOOL result;
	time_t T1_;
	time_t T2_;
	NI64 T3_;
	result = (NIM_BOOL)0;
	T1_ = (time_t)0;
	T1_ = nosgetLastModificationTime(a);
	T2_ = (time_t)0;
	T2_ = nosgetLastModificationTime(b);
	T3_ = (NI64)0;
	T3_ = ntDiffTime(T1_, T2_);
	result = (IL64(0) <= T3_);
	return result;
}

static N_INLINE(NIM_BOOL, eqeq__9ccNWqrTIE9bcAqE2Q0ro7zgos)(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_EXPORT N_CDECL(NimStringDesc*, nosgetCurrentDir)(void) {
	NimStringDesc* result;
	NI bufsize;
	result = (NimStringDesc*)0;
	bufsize = ((NI) 1024);
	result = mnewString(((NI) (bufsize)));
	{
		while (1) {
			{
				NCSTRING T5_;
				NIM_BOOL T6_;
				int T9_;
				T5_ = (NCSTRING)0;
				T5_ = getcwd(result->data, bufsize);
				T6_ = (NIM_BOOL)0;
				T6_ = eqeq__9ccNWqrTIE9bcAqE2Q0ro7zgos(T5_, NIM_NIL);
				if (!!(T6_)) goto LA7_;
				T9_ = (int)0;
				T9_ = strlen(result->data);
				result = nimrtl_setLengthStr(result, ((NI) (T9_)));
				goto LA1;
			}
			goto LA3_;
			LA7_: ;
			{
				NI32 err;
				err = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
				{
					if (!(err == ERANGE)) goto LA13_;
					bufsize = (NI)((NU32)(bufsize) << (NU32)(((NI) 1)));
					{
						if (!!((((NI) 0) <= bufsize))) goto LA17_;
						raiseAssert_PpfSiTIeNpMAb9a5o6SglJw_2(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_5));
					}
					LA17_: ;
					result = mnewString(((NI) (bufsize)));
				}
				goto LA11_;
				LA13_: ;
				{
					NI32 T20_;
					T20_ = (NI32)0;
					T20_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
					raiseOSError_86HIIOlD5N61CWaO5GBgqA(T20_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
				}
				LA11_: ;
			}
			LA3_: ;
		}
	} LA1: ;
	return result;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosexpandFilename)(NimStringDesc* filename) {
	NimStringDesc* result;
	NCSTRING r;
	result = (NimStringDesc*)0;
	r = realpath(filename->data, NIM_NIL);
	{
		NI32 T5_;
		if (!(r == 0)) goto LA3_;
		T5_ = (NI32)0;
		T5_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T5_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	goto LA1_;
	LA3_: ;
	{
		result = nimrtl_cstrToNimstr(r);
		free(((void*) (r)));
	}
	LA1_: ;
	return result;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nossameFile)(NimStringDesc* path1, NimStringDesc* path2) {
	NIM_BOOL result;
	struct stat a;
	struct stat b;
	result = (NIM_BOOL)0;
	memset((void*)(&a), 0, sizeof(a));
	memset((void*)(&b), 0, sizeof(b));
	{
		NIM_BOOL T3_;
		int T4_;
		int T6_;
		NI32 T9_;
		T3_ = (NIM_BOOL)0;
		T4_ = (int)0;
		T4_ = stat(path1->data, (&a));
		T3_ = (T4_ < ((NI32) 0));
		if (T3_) goto LA5_;
		T6_ = (int)0;
		T6_ = stat(path2->data, (&b));
		T3_ = (T6_ < ((NI32) 0));
		LA5_: ;
		if (!T3_) goto LA7_;
		T9_ = (NI32)0;
		T9_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T9_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	goto LA1_;
	LA7_: ;
	{
		NIM_BOOL T11_;
		T11_ = (NIM_BOOL)0;
		T11_ = (a.st_dev == b.st_dev);
		if (!(T11_)) goto LA12_;
		T11_ = (a.st_ino == b.st_ino);
		LA12_: ;
		result = T11_;
	}
	LA1_: ;
	return result;
}

static N_INLINE(NIM_BOOL, equalMem_DCrUjdaMvFDHaR1hs7sQGwstrutils)(void* a, void* b, NI size) {
	NIM_BOOL result;
	int T1_;
	result = (NIM_BOOL)0;
	T1_ = (int)0;
	T1_ = memcmp(a, b, ((size_t) (size)));
	result = (T1_ == ((NI32) 0));
	return result;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nossameFileContent)(NimStringDesc* path1, NimStringDesc* path2) {
	NIM_BOOL result;
	FILE* a;
	FILE* b;
	void* bufA;
	void* bufB;
{	result = (NIM_BOOL)0;
	a = (FILE*)0;
	b = (FILE*)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = open_sEp0GH2306oGo9bqBpj5oTQ(&a, path1, ((FileMode_fVUBHvW79bXUw1j55Oo9avSQ) 0), ((NI) -1));
		if (!!(T3_)) goto LA4_;
		result = NIM_FALSE;
		goto BeforeRet_;
	}
	LA4_: ;
	{
		NIM_BOOL T8_;
		T8_ = (NIM_BOOL)0;
		T8_ = open_sEp0GH2306oGo9bqBpj5oTQ(&b, path2, ((FileMode_fVUBHvW79bXUw1j55Oo9avSQ) 0), ((NI) -1));
		if (!!(T8_)) goto LA9_;
		close_BWnr8V7RERYno9bIdPmw8Hw_2(a);
		result = NIM_FALSE;
		goto BeforeRet_;
	}
	LA9_: ;
	bufA = nimrtl_alloc(((NI) 8192));
	bufB = nimrtl_alloc(((NI) 8192));
	{
		while (1) {
			NI readA;
			NI readB;
			readA = readBuffer_nZ0pNe9cd9cXtoayexCiaDtA(a, bufA, ((NI) 8192));
			readB = readBuffer_nZ0pNe9cd9cXtoayexCiaDtA(b, bufB, ((NI) 8192));
			{
				if (!!((readA == readB))) goto LA15_;
				result = NIM_FALSE;
				goto LA11;
			}
			LA15_: ;
			{
				if (!(readA == ((NI) 0))) goto LA19_;
				result = NIM_TRUE;
				goto LA11;
			}
			LA19_: ;
			result = equalMem_DCrUjdaMvFDHaR1hs7sQGwstrutils(bufA, bufB, ((NI) (readA)));
			{
				if (!!(result)) goto LA23_;
				goto LA11;
			}
			LA23_: ;
			{
				if (!!((readA == ((NI) 8192)))) goto LA27_;
				goto LA11;
			}
			LA27_: ;
		}
	} LA11: ;
	nimrtl_dealloc(bufA);
	nimrtl_dealloc(bufB);
	close_BWnr8V7RERYno9bIdPmw8Hw_2(a);
	close_BWnr8V7RERYno9bIdPmw8Hw_2(b);
	}BeforeRet_: ;
	return result;
}

N_LIB_EXPORT N_CDECL(FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set, nosgetFilePermissions)(NimStringDesc* filename) {
	FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set result;
	struct stat a;
	memset((void*)(&result), 0, sizeof(result));
	memset((void*)(&a), 0, sizeof(a));
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = stat(filename->data, (&a));
		if (!(T3_ < ((NI32) 0))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T6_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4_: ;
	result = 0;
	{
		if (!!(((NI32)(a.st_mode & S_IRUSR) == ((NI32) 0)))) goto LA9_;
		result |= ((NU16)1)<<((((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 2))%(sizeof(NU16)*8));
	}
	LA9_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IWUSR) == ((NI32) 0)))) goto LA13_;
		result |= ((NU16)1)<<((((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 1))%(sizeof(NU16)*8));
	}
	LA13_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IXUSR) == ((NI32) 0)))) goto LA17_;
		result |= ((NU16)1)<<((((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 0))%(sizeof(NU16)*8));
	}
	LA17_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IRGRP) == ((NI32) 0)))) goto LA21_;
		result |= ((NU16)1)<<((((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 5))%(sizeof(NU16)*8));
	}
	LA21_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IWGRP) == ((NI32) 0)))) goto LA25_;
		result |= ((NU16)1)<<((((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 4))%(sizeof(NU16)*8));
	}
	LA25_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IXGRP) == ((NI32) 0)))) goto LA29_;
		result |= ((NU16)1)<<((((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 3))%(sizeof(NU16)*8));
	}
	LA29_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IROTH) == ((NI32) 0)))) goto LA33_;
		result |= ((NU16)1)<<((((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 8))%(sizeof(NU16)*8));
	}
	LA33_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IWOTH) == ((NI32) 0)))) goto LA37_;
		result |= ((NU16)1)<<((((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 7))%(sizeof(NU16)*8));
	}
	LA37_: ;
	{
		if (!!(((NI32)(a.st_mode & S_IXOTH) == ((NI32) 0)))) goto LA41_;
		result |= ((NU16)1)<<((((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 6))%(sizeof(NU16)*8));
	}
	LA41_: ;
	return result;
}

N_LIB_EXPORT N_CDECL(void, nossetFilePermissions)(NimStringDesc* filename, FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions) {
	NI32 p;
	p = ((NI32) 0);
	{
		if (!((permissions &(1U<<((NU)(((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 2))&15U)))!=0)) goto LA3_;
		p = (NI32)(p | S_IRUSR);
	}
	LA3_: ;
	{
		if (!((permissions &(1U<<((NU)(((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 1))&15U)))!=0)) goto LA7_;
		p = (NI32)(p | S_IWUSR);
	}
	LA7_: ;
	{
		if (!((permissions &(1U<<((NU)(((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 0))&15U)))!=0)) goto LA11_;
		p = (NI32)(p | S_IXUSR);
	}
	LA11_: ;
	{
		if (!((permissions &(1U<<((NU)(((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 5))&15U)))!=0)) goto LA15_;
		p = (NI32)(p | S_IRGRP);
	}
	LA15_: ;
	{
		if (!((permissions &(1U<<((NU)(((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 4))&15U)))!=0)) goto LA19_;
		p = (NI32)(p | S_IWGRP);
	}
	LA19_: ;
	{
		if (!((permissions &(1U<<((NU)(((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 3))&15U)))!=0)) goto LA23_;
		p = (NI32)(p | S_IXGRP);
	}
	LA23_: ;
	{
		if (!((permissions &(1U<<((NU)(((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 8))&15U)))!=0)) goto LA27_;
		p = (NI32)(p | S_IROTH);
	}
	LA27_: ;
	{
		if (!((permissions &(1U<<((NU)(((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 7))&15U)))!=0)) goto LA31_;
		p = (NI32)(p | S_IWOTH);
	}
	LA31_: ;
	{
		if (!((permissions &(1U<<((NU)(((FilePermission_uTVeDpjCH6aWw9c74YkAskA) 6))&15U)))!=0)) goto LA35_;
		p = (NI32)(p | S_IXOTH);
	}
	LA35_: ;
	{
		int T39_;
		NI32 T42_;
		T39_ = (int)0;
		T39_ = chmod(filename->data, p);
		if (!!((T39_ == ((NI32) 0)))) goto LA40_;
		T42_ = (NI32)0;
		T42_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T42_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA40_: ;
}

N_LIB_EXPORT N_CDECL(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_sEp0GH2306oGo9bqBpj5oTQ(&s, source, ((FileMode_fVUBHvW79bXUw1j55Oo9avSQ) 0), ((NI) -1));
		if (!!(T3_)) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T6_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4_: ;
	{
		NIM_BOOL T9_;
		NI32 T12_;
		T9_ = (NIM_BOOL)0;
		T9_ = open_sEp0GH2306oGo9bqBpj5oTQ(&d, dest, ((FileMode_fVUBHvW79bXUw1j55Oo9avSQ) 1), ((NI) -1));
		if (!!(T9_)) goto LA10_;
		close_BWnr8V7RERYno9bIdPmw8Hw_2(s);
		T12_ = (NI32)0;
		T12_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T12_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA10_: ;
	buf = nimrtl_alloc(((NI) 8000));
	{
		while (1) {
			NI bytesread;
			bytesread = readBuffer_nZ0pNe9cd9cXtoayexCiaDtA(s, buf, ((NI) 8000));
			{
				NI byteswritten;
				if (!(((NI) 0) < bytesread)) goto LA17_;
				byteswritten = writeBuffer_nZ0pNe9cd9cXtoayexCiaDtA_2(d, buf, ((NI) (bytesread)));
				{
					NI32 T23_;
					if (!!((bytesread == byteswritten))) goto LA21_;
					nimrtl_dealloc(buf);
					close_BWnr8V7RERYno9bIdPmw8Hw_2(s);
					close_BWnr8V7RERYno9bIdPmw8Hw_2(d);
					T23_ = (NI32)0;
					T23_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
					raiseOSError_86HIIOlD5N61CWaO5GBgqA(T23_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
				}
				LA21_: ;
			}
			LA17_: ;
			{
				if (!!((bytesread == ((NI) 8000)))) goto LA26_;
				goto LA13;
			}
			LA26_: ;
		}
	} LA13: ;
	nimrtl_dealloc(buf);
	close_BWnr8V7RERYno9bIdPmw8Hw_2(s);
	flushFile_BWnr8V7RERYno9bIdPmw8Hw_3(d);
	close_BWnr8V7RERYno9bIdPmw8Hw_2(d);
}

N_LIB_EXPORT N_CDECL(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_ = remove(file->data);
		T3_ = !((T4_ == ((NI32) 0)));
		if (!(T3_)) goto LA5_;
		T3_ = !((errno == ENOENT));
		LA5_: ;
		if (!T3_) goto LA6_;
		result = NIM_FALSE;
	}
	LA6_: ;
	return result;
}

N_LIB_EXPORT N_CDECL(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_YyC2FKP9bqQiUDq2XVqW9acA();
		T7_ = (NCSTRING)0;
		T7_ = strerror(errno);
		T8_ = (NimStringDesc*)0;
		T8_ = nimrtl_cstrToNimstr(T7_);
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T6_, T8_);
	}
	LA4_: ;
}

N_LIB_EXPORT N_CDECL(void, nosmoveFile)(NimStringDesc* source, NimStringDesc* dest) {
	{
		int T3_;
		NI32 err;
		T3_ = (int)0;
		T3_ = rename(source->data, dest->data);
		if (!!((T3_ == ((NI32) 0)))) goto LA4_;
		err = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		{
			TSafePoint TM_yu6cxgKBBXbNsTkT9cyMd4g_6;
			if (!(err == EXDEV)) goto LA8_;
			noscopyFile(source, dest);
			nimrtl_pushSafePoint(&TM_yu6cxgKBBXbNsTkT9cyMd4g_6);
			TM_yu6cxgKBBXbNsTkT9cyMd4g_6.status = setjmp(TM_yu6cxgKBBXbNsTkT9cyMd4g_6.context);
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_6.status == 0) {
				nosremoveFile(source);
				nimrtl_popSafePoint();
			}
			else {
				nimrtl_popSafePoint();
				{
					NIM_BOOL T13_;
					TM_yu6cxgKBBXbNsTkT9cyMd4g_6.status = 0;
					T13_ = (NIM_BOOL)0;
					T13_ = nostryRemoveFile(dest);
					nimrtl_reraiseException();
					nimrtl_popCurrentException();
				}
			}
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_6.status != 0) nimrtl_reraiseException();
		}
		goto LA6_;
		LA8_: ;
		{
			NCSTRING T15_;
			NimStringDesc* T16_;
			T15_ = (NCSTRING)0;
			T15_ = strerror(errno);
			T16_ = (NimStringDesc*)0;
			T16_ = nimrtl_cstrToNimstr(T15_);
			raiseOSError_86HIIOlD5N61CWaO5GBgqA(err, T16_);
		}
		LA6_: ;
	}
	LA4_: ;
}

N_LIB_EXPORT N_CDECL(NI, nosexecShellCmd)(NimStringDesc* command) {
	NI result;
	int T1_;
	result = (NI)0;
	T1_ = (int)0;
	T1_ = system(command->data);
	result = ((NI) ((NI32)((NU32)(T1_) >> (NU32)(((NI) 8)))));
	return result;
}
static N_NIMCALL(void, TM_yu6cxgKBBXbNsTkT9cyMd4g_7)(void) {
	nimrtl_nimGCvisit((void*)environment_mlhK49b6YMgc9cgrcYkKq9a3g, 0);
}

static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b) {
	NIM_BOOL result;
	NIM_BOOL T11_;
{	result = (NIM_BOOL)0;
	{
		if (!(a == b)) goto LA3_;
		result = NIM_TRUE;
		goto BeforeRet_;
	}
	LA3_: ;
	{
		NIM_BOOL T7_;
		T7_ = (NIM_BOOL)0;
		T7_ = (a == NIM_NIL);
		if (T7_) goto LA8_;
		T7_ = (b == NIM_NIL);
		LA8_: ;
		if (!T7_) goto LA9_;
		result = NIM_FALSE;
		goto BeforeRet_;
	}
	LA9_: ;
	T11_ = (NIM_BOOL)0;
	T11_ = ((*a).Sup.len == (*b).Sup.len);
	if (!(T11_)) goto LA12_;
	T11_ = equalMem_DCrUjdaMvFDHaR1hs7sQGwstrutils(((void*) ((*a).data)), ((void*) ((*b).data)), ((NI) ((*a).Sup.len)));
	LA12_: ;
	result = T11_;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}

static N_INLINE(NIM_BOOL, dirExists_wf0Ae3eLXw0lSNEFJMV3ogos)(NimStringDesc* dir) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = nosexistsDir(dir);
	return result;
}

N_NIMCALL(PathComponent_9c1SIU9cO1wHcl09b703A9cDrg, getSymlinkFileKind_WoXOp8qmMec1P4MyA3LBKg)(NimStringDesc* path) {
	PathComponent_9c1SIU9cO1wHcl09b703A9cDrg result;
	struct stat s;
	result = (PathComponent_9c1SIU9cO1wHcl09b703A9cDrg)0;
	memset((void*)(&s), 0, sizeof(s));
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = stat(path->data, (&s));
		if (!(T3_ < ((NI32) 0))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T6_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4_: ;
	{
		NIM_BOOL T9_;
		T9_ = (NIM_BOOL)0;
		T9_ = S_ISDIR(s.st_mode);
		if (!T9_) goto LA10_;
		result = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 3);
	}
	goto LA7_;
	LA10_: ;
	{
		result = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 1);
	}
	LA7_: ;
	return result;
}

N_NIMCALL(void, rawRemoveDir_P9aOuM3pg25yKqgBUm7qKng)(NimStringDesc* dir) {
	{
		NIM_BOOL T3_;
		int T4_;
		NI32 T8_;
		T3_ = (NIM_BOOL)0;
		T4_ = (int)0;
		T4_ = rmdir(dir->data);
		T3_ = !((T4_ == ((NI32) 0)));
		if (!(T3_)) goto LA5_;
		T3_ = !((errno == ENOENT));
		LA5_: ;
		if (!T3_) goto LA6_;
		T8_ = (NI32)0;
		T8_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T8_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA6_: ;
}

N_LIB_EXPORT N_CDECL(void, nosremoveDir)(NimStringDesc* dir) {
	{
		PathComponent_9c1SIU9cO1wHcl09b703A9cDrg kind;
		NimStringDesc* path;
		DIR* d;
		kind = (PathComponent_9c1SIU9cO1wHcl09b703A9cDrg)0;
		path = (NimStringDesc*)0;
		d = opendir(dir->data);
		{
			TSafePoint TM_yu6cxgKBBXbNsTkT9cyMd4g_8;
			if (!!((d == NIM_NIL))) goto LA4_;
			nimrtl_pushSafePoint(&TM_yu6cxgKBBXbNsTkT9cyMd4g_8);
			TM_yu6cxgKBBXbNsTkT9cyMd4g_8.status = setjmp(TM_yu6cxgKBBXbNsTkT9cyMd4g_8.context);
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_8.status == 0) {
				{
					while (1) {
						{
							struct dirent* x;
							NimStringDesc* volatile y;
							x = readdir(d);
							{
								if (!(x == NIM_NIL)) goto LA12_;
								goto LA7;
							}
							LA12_: ;
							y = nimrtl_cstrToNimstr(((NCSTRING) ((*x).d_name)));
							{
								NIM_BOOL T16_;
								struct stat s;
								PathComponent_9c1SIU9cO1wHcl09b703A9cDrg volatile k;
								T16_ = (NIM_BOOL)0;
								T16_ = !(eqStrings(y, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_9)));
								if (!(T16_)) goto LA17_;
								T16_ = !(eqStrings(y, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_10)));
								LA17_: ;
								if (!T16_) goto LA18_;
								memset((void*)(&s), 0, sizeof(s));
								{
									if (!NIM_TRUE) goto LA22_;
									y = slash__lXoMhn1ZYc9cAJa9bfA61msg(dir, y);
								}
								LA22_: ;
								k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0);
								{
									if (!!(((*x).d_type == ((NI8) 0)))) goto LA26_;
									{
										if (!((*x).d_type == ((NI8) 4))) goto LA30_;
										k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
									}
									LA30_: ;
									{
										if (!((*x).d_type == ((NI8) 10))) goto LA34_;
										{
											NIM_BOOL T38_;
											T38_ = (NIM_BOOL)0;
											T38_ = dirExists_wf0Ae3eLXw0lSNEFJMV3ogos(y);
											if (!T38_) goto LA39_;
											k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 3);
										}
										goto LA36_;
										LA39_: ;
										{
											k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 1);
										}
										LA36_: ;
									}
									LA34_: ;
									kind = k;
									path = y;
									switch (kind) {
									case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
									case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 1):
									case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 3):
									{
										nosremoveFile(path);
									}
									break;
									case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
									{
										nosremoveDir(path);
									}
									break;
									}
									goto LA9;
								}
								LA26_: ;
								{
									int T46_;
									T46_ = (int)0;
									T46_ = lstat(y->data, (&s));
									if (!(T46_ < ((NI32) 0))) goto LA47_;
									goto LA7;
								}
								LA47_: ;
								{
									NIM_BOOL T51_;
									T51_ = (NIM_BOOL)0;
									T51_ = S_ISDIR(s.st_mode);
									if (!T51_) goto LA52_;
									k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
								}
								goto LA49_;
								LA52_: ;
								{
									NIM_BOOL T55_;
									T55_ = (NIM_BOOL)0;
									T55_ = S_ISLNK(s.st_mode);
									if (!T55_) goto LA56_;
									k = getSymlinkFileKind_WoXOp8qmMec1P4MyA3LBKg(y);
								}
								goto LA49_;
								LA56_: ;
								LA49_: ;
								kind = k;
								path = y;
								switch (kind) {
								case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
								case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 1):
								case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 3):
								{
									nosremoveFile(path);
								}
								break;
								case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
								{
									nosremoveDir(path);
								}
								break;
								}
							}
							LA18_: ;
						} LA9: ;
					}
				} LA7: ;
				nimrtl_popSafePoint();
			}
			else {
				nimrtl_popSafePoint();
			}
			{
				int T62_;
				T62_ = (int)0;
				T62_ = closedir(d);
			}
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_8.status != 0) nimrtl_reraiseException();
		}
		LA4_: ;
	}
	rawRemoveDir_P9aOuM3pg25yKqgBUm7qKng(dir);
}

N_NIMCALL(NIM_BOOL, rawCreateDir_V86QyZrcGMPX0W9bv1Q53ww_2)(NimStringDesc* dir) {
	NIM_BOOL result;
	int res;
	result = (NIM_BOOL)0;
	res = mkdir(dir->data, ((mode_t) 511));
	{
		if (!(res == ((NI32) 0))) goto LA3_;
		result = NIM_TRUE;
	}
	goto LA1_;
	LA3_: ;
	{
		if (!(errno == EEXIST)) goto LA6_;
		result = NIM_FALSE;
	}
	goto LA1_;
	LA6_: ;
	{
		NimStringDesc* T9_;
		NI32 T10_;
		T9_ = (NimStringDesc*)0;
		T9_ = nimrtl_nimIntToStr(((NI) (res)));
		printf("%s\012", T9_? (T9_)->data:"nil");
		fflush(stdout);
		T10_ = (NI32)0;
		T10_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T10_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA1_: ;
	return result;
}

N_NIMCALL(NIM_BOOL, existsOrCreateDir_V86QyZrcGMPX0W9bv1Q53ww)(NimStringDesc* dir) {
	NIM_BOOL result;
	NIM_BOOL T1_;
	result = (NIM_BOOL)0;
	T1_ = (NIM_BOOL)0;
	T1_ = rawCreateDir_V86QyZrcGMPX0W9bv1Q53ww_2(dir);
	result = !(T1_);
	{
		if (!result) goto LA4_;
		{
			NIM_BOOL T8_;
			IOError_9czoZw3pzPyrBmb5zTHY1OQ* e;
			NimStringDesc* T11_;
			T8_ = (NIM_BOOL)0;
			T8_ = nosexistsDir(dir);
			if (!!(T8_)) goto LA9_;
			e = (IOError_9czoZw3pzPyrBmb5zTHY1OQ*)0;
			e = (IOError_9czoZw3pzPyrBmb5zTHY1OQ*) nimrtl_newObj((&NTI_HX2M9cQhE3jaovp9aYJDdslA_), sizeof(IOError_9czoZw3pzPyrBmb5zTHY1OQ));
			(*e).Sup.Sup.Sup.m_type = (&NTI_9czoZw3pzPyrBmb5zTHY1OQ_);
			T11_ = (NimStringDesc*)0;
			T11_ = (*e).Sup.Sup.message; (*e).Sup.Sup.message = nimrtl_copyStringRC1(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_11));
			if (T11_) nimGCunrefNoCycle(T11_);
			asgnRef((void**) (&(*e).Sup.Sup.parent), NIM_NIL);
			nimrtl_raiseException((Exception*)e, "IOError");
		}
		LA9_: ;
	}
	LA4_: ;
	return result;
}

N_LIB_EXPORT N_CDECL(void, noscreateDir)(NimStringDesc* dir) {
	NIM_BOOL omitNext;
	omitNext = NIM_FALSE;
	{
		NI i;
		NI colontmp_;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = (NI)((dir ? dir->Sup.len : 0) - ((NI) 1));
		res = ((NI) 1);
		{
			while (1) {
				if (!(res <= colontmp_)) goto LA3;
				i = res;
				{
					if (!(((NU8)(dir->data[i])) == ((NU8)(47)) || ((NU8)(dir->data[i])) == ((NU8)(47)))) goto LA6_;
					{
						if (!omitNext) goto LA10_;
						omitNext = NIM_FALSE;
					}
					goto LA8_;
					LA10_: ;
					{
						NimStringDesc* T13_;
						NIM_BOOL T14_;
						T13_ = (NimStringDesc*)0;
						T13_ = copyStrLast(dir, ((NI) 0), (NI)(i - ((NI) 1)));
						T14_ = (NIM_BOOL)0;
						T14_ = existsOrCreateDir_V86QyZrcGMPX0W9bv1Q53ww(T13_);
					}
					LA8_: ;
				}
				LA6_: ;
				res += ((NI) 1);
			} LA3: ;
		}
	}
	{
		NIM_BOOL T17_;
		NIM_BOOL T18_;
		NIM_BOOL T23_;
		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_;
		T17_ = !((((NU8)(dir->data[(NI)((dir ? dir->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(dir->data[(NI)((dir ? dir->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47))));
		LA20_: ;
		if (!T17_) goto LA21_;
		T23_ = (NIM_BOOL)0;
		T23_ = existsOrCreateDir_V86QyZrcGMPX0W9bv1Q53ww(dir);
	}
	LA21_: ;
}

N_LIB_EXPORT N_CDECL(void, noscopyDir)(NimStringDesc* source, NimStringDesc* dest) {
	noscreateDir(dest);
	{
		PathComponent_9c1SIU9cO1wHcl09b703A9cDrg kind;
		NimStringDesc* path;
		DIR* d;
		kind = (PathComponent_9c1SIU9cO1wHcl09b703A9cDrg)0;
		path = (NimStringDesc*)0;
		d = opendir(source->data);
		{
			TSafePoint TM_yu6cxgKBBXbNsTkT9cyMd4g_12;
			if (!!((d == NIM_NIL))) goto LA4_;
			nimrtl_pushSafePoint(&TM_yu6cxgKBBXbNsTkT9cyMd4g_12);
			TM_yu6cxgKBBXbNsTkT9cyMd4g_12.status = setjmp(TM_yu6cxgKBBXbNsTkT9cyMd4g_12.context);
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_12.status == 0) {
				{
					while (1) {
						{
							struct dirent* x;
							NimStringDesc* volatile y;
							x = readdir(d);
							{
								if (!(x == NIM_NIL)) goto LA12_;
								goto LA7;
							}
							LA12_: ;
							y = nimrtl_cstrToNimstr(((NCSTRING) ((*x).d_name)));
							{
								NIM_BOOL T16_;
								struct stat s;
								PathComponent_9c1SIU9cO1wHcl09b703A9cDrg volatile k;
								NimStringDesc* noSource_2;
								T16_ = (NIM_BOOL)0;
								T16_ = !(eqStrings(y, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_9)));
								if (!(T16_)) goto LA17_;
								T16_ = !(eqStrings(y, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_10)));
								LA17_: ;
								if (!T16_) goto LA18_;
								memset((void*)(&s), 0, sizeof(s));
								{
									if (!NIM_TRUE) goto LA22_;
									y = slash__lXoMhn1ZYc9cAJa9bfA61msg(source, y);
								}
								LA22_: ;
								k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0);
								{
									NimStringDesc* noSource;
									if (!!(((*x).d_type == ((NI8) 0)))) goto LA26_;
									{
										if (!((*x).d_type == ((NI8) 4))) goto LA30_;
										k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
									}
									LA30_: ;
									{
										if (!((*x).d_type == ((NI8) 10))) goto LA34_;
										{
											NIM_BOOL T38_;
											T38_ = (NIM_BOOL)0;
											T38_ = dirExists_wf0Ae3eLXw0lSNEFJMV3ogos(y);
											if (!T38_) goto LA39_;
											k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 3);
										}
										goto LA36_;
										LA39_: ;
										{
											k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 1);
										}
										LA36_: ;
									}
									LA34_: ;
									kind = k;
									path = y;
									noSource = copyStr(path, (NI)((source ? source->Sup.len : 0) + ((NI) 1)));
									switch (kind) {
									case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
									{
										NimStringDesc* T43_;
										T43_ = (NimStringDesc*)0;
										T43_ = slash__lXoMhn1ZYc9cAJa9bfA61msg(dest, noSource);
										noscopyFile(path, T43_);
									}
									break;
									case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
									{
										NimStringDesc* T45_;
										T45_ = (NimStringDesc*)0;
										T45_ = slash__lXoMhn1ZYc9cAJa9bfA61msg(dest, noSource);
										noscopyDir(path, T45_);
									}
									break;
									default:
									{
									}
									break;
									}
									goto LA9;
								}
								LA26_: ;
								{
									int T49_;
									T49_ = (int)0;
									T49_ = lstat(y->data, (&s));
									if (!(T49_ < ((NI32) 0))) goto LA50_;
									goto LA7;
								}
								LA50_: ;
								{
									NIM_BOOL T54_;
									T54_ = (NIM_BOOL)0;
									T54_ = S_ISDIR(s.st_mode);
									if (!T54_) goto LA55_;
									k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
								}
								goto LA52_;
								LA55_: ;
								{
									NIM_BOOL T58_;
									T58_ = (NIM_BOOL)0;
									T58_ = S_ISLNK(s.st_mode);
									if (!T58_) goto LA59_;
									k = getSymlinkFileKind_WoXOp8qmMec1P4MyA3LBKg(y);
								}
								goto LA52_;
								LA59_: ;
								LA52_: ;
								kind = k;
								path = y;
								noSource_2 = copyStr(path, (NI)((source ? source->Sup.len : 0) + ((NI) 1)));
								switch (kind) {
								case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
								{
									NimStringDesc* T62_;
									T62_ = (NimStringDesc*)0;
									T62_ = slash__lXoMhn1ZYc9cAJa9bfA61msg(dest, noSource_2);
									noscopyFile(path, T62_);
								}
								break;
								case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
								{
									NimStringDesc* T64_;
									T64_ = (NimStringDesc*)0;
									T64_ = slash__lXoMhn1ZYc9cAJa9bfA61msg(dest, noSource_2);
									noscopyDir(path, T64_);
								}
								break;
								default:
								{
								}
								break;
								}
							}
							LA18_: ;
						} LA9: ;
					}
				} LA7: ;
				nimrtl_popSafePoint();
			}
			else {
				nimrtl_popSafePoint();
			}
			{
				int T68_;
				T68_ = (int)0;
				T68_ = closedir(d);
			}
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_12.status != 0) nimrtl_reraiseException();
		}
		LA4_: ;
	}
}

N_LIB_EXPORT N_CDECL(TY_sM4lkSb7zS6F7OVMvW9cffQ*, nosparseCmdLine)(NimStringDesc* c) {
	TY_sM4lkSb7zS6F7OVMvW9cffQ* result;
	NI i;
	NimStringDesc* a;
	result = (TY_sM4lkSb7zS6F7OVMvW9cffQ*)0;
	result = (TY_sM4lkSb7zS6F7OVMvW9cffQ*) nimrtl_newSeq((&NTI_sM4lkSb7zS6F7OVMvW9cffQ_), 0);
	i = ((NI) 0);
	a = nimrtl_copyString(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	{
		while (1) {
			NimStringDesc* T24_;
			a = nimrtl_setLengthStr(a, ((NI) 0));
			{
				while (1) {
					NIM_BOOL T5_;
					NIM_BOOL T6_;
					NIM_BOOL T7_;
					T5_ = (NIM_BOOL)0;
					T6_ = (NIM_BOOL)0;
					T7_ = (NIM_BOOL)0;
					T7_ = ((NU8)(c->data[i]) == (NU8)(32));
					if (T7_) goto LA8_;
					T7_ = ((NU8)(c->data[i]) == (NU8)(9));
					LA8_: ;
					T6_ = T7_;
					if (T6_) goto LA9_;
					T6_ = ((NU8)(c->data[i]) == (NU8)(10));
					LA9_: ;
					T5_ = T6_;
					if (T5_) goto LA10_;
					T5_ = ((NU8)(c->data[i]) == (NU8)(13));
					LA10_: ;
					if (!T5_) goto LA4;
					i += ((NI) 1);
				} LA4: ;
			}
			switch (((NU8)(c->data[i]))) {
			case 39:
			case 34:
			{
				NIM_CHAR delim;
				delim = c->data[i];
				i += ((NI) 1);
				{
					while (1) {
						NIM_BOOL T14_;
						T14_ = (NIM_BOOL)0;
						T14_ = !(((NU8)(c->data[i]) == (NU8)(0)));
						if (!(T14_)) goto LA15_;
						T14_ = !(((NU8)(c->data[i]) == (NU8)(delim)));
						LA15_: ;
						if (!T14_) goto LA13;
						a = addChar(a, c->data[i]);
						i += ((NI) 1);
					} LA13: ;
				}
				{
					if (!!(((NU8)(c->data[i]) == (NU8)(0)))) goto LA18_;
					i += ((NI) 1);
				}
				LA18_: ;
			}
			break;
			case 0:
			{
				goto LA1;
			}
			break;
			default:
			{
				{
					while (1) {
						if (!((NU8)(32) < (NU8)(c->data[i]))) goto LA23;
						a = addChar(a, c->data[i]);
						i += ((NI) 1);
					} LA23: ;
				}
			}
			break;
			}
			result = (TY_sM4lkSb7zS6F7OVMvW9cffQ*) incrSeqV2(&(result)->Sup, sizeof(NimStringDesc*));
			T24_ = (NimStringDesc*)0;
			T24_ = result->data[result->Sup.len]; result->data[result->Sup.len] = nimrtl_copyStringRC1(a);
			if (T24_) nimGCunrefNoCycle(T24_);
			++result->Sup.len;
		}
	} LA1: ;
	return result;
}

N_NIMCALL(void, copyFileWithPermissions_ocr9chMejxLldaYNB2fMsHw)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL ignorePermissionErrors) {
	TSafePoint TM_yu6cxgKBBXbNsTkT9cyMd4g_15;
	noscopyFile(source, dest);
	nimrtl_pushSafePoint(&TM_yu6cxgKBBXbNsTkT9cyMd4g_15);
	TM_yu6cxgKBBXbNsTkT9cyMd4g_15.status = setjmp(TM_yu6cxgKBBXbNsTkT9cyMd4g_15.context);
	if (TM_yu6cxgKBBXbNsTkT9cyMd4g_15.status == 0) {
		FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set T2_;
		T2_ = nosgetFilePermissions(source);
		nossetFilePermissions(dest, T2_);
		nimrtl_popSafePoint();
	}
	else {
		nimrtl_popSafePoint();
		{
			TM_yu6cxgKBBXbNsTkT9cyMd4g_15.status = 0;
			{
				if (!!(ignorePermissionErrors)) goto LA7_;
				nimrtl_reraiseException();
			}
			LA7_: ;
			nimrtl_popCurrentException();
		}
	}
	if (TM_yu6cxgKBBXbNsTkT9cyMd4g_15.status != 0) nimrtl_reraiseException();
}

N_LIB_EXPORT N_CDECL(void, noscopyDirWithPermissions)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL ignorePermissionErrors) {
	TSafePoint TM_yu6cxgKBBXbNsTkT9cyMd4g_13;
	noscreateDir(dest);
	nimrtl_pushSafePoint(&TM_yu6cxgKBBXbNsTkT9cyMd4g_13);
	TM_yu6cxgKBBXbNsTkT9cyMd4g_13.status = setjmp(TM_yu6cxgKBBXbNsTkT9cyMd4g_13.context);
	if (TM_yu6cxgKBBXbNsTkT9cyMd4g_13.status == 0) {
		FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set T2_;
		T2_ = nosgetFilePermissions(source);
		nossetFilePermissions(dest, T2_);
		nimrtl_popSafePoint();
	}
	else {
		nimrtl_popSafePoint();
		{
			TM_yu6cxgKBBXbNsTkT9cyMd4g_13.status = 0;
			{
				if (!!(ignorePermissionErrors)) goto LA7_;
				nimrtl_reraiseException();
			}
			LA7_: ;
			nimrtl_popCurrentException();
		}
	}
	if (TM_yu6cxgKBBXbNsTkT9cyMd4g_13.status != 0) nimrtl_reraiseException();
	{
		PathComponent_9c1SIU9cO1wHcl09b703A9cDrg kind;
		NimStringDesc* path;
		DIR* d;
		kind = (PathComponent_9c1SIU9cO1wHcl09b703A9cDrg)0;
		path = (NimStringDesc*)0;
		d = opendir(source->data);
		{
			TSafePoint TM_yu6cxgKBBXbNsTkT9cyMd4g_14;
			if (!!((d == NIM_NIL))) goto LA12_;
			nimrtl_pushSafePoint(&TM_yu6cxgKBBXbNsTkT9cyMd4g_14);
			TM_yu6cxgKBBXbNsTkT9cyMd4g_14.status = setjmp(TM_yu6cxgKBBXbNsTkT9cyMd4g_14.context);
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_14.status == 0) {
				{
					while (1) {
						{
							struct dirent* x;
							NimStringDesc* volatile y;
							x = readdir(d);
							{
								if (!(x == NIM_NIL)) goto LA20_;
								goto LA15;
							}
							LA20_: ;
							y = nimrtl_cstrToNimstr(((NCSTRING) ((*x).d_name)));
							{
								NIM_BOOL T24_;
								struct stat s;
								PathComponent_9c1SIU9cO1wHcl09b703A9cDrg volatile k;
								NimStringDesc* noSource_2;
								T24_ = (NIM_BOOL)0;
								T24_ = !(eqStrings(y, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_9)));
								if (!(T24_)) goto LA25_;
								T24_ = !(eqStrings(y, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_10)));
								LA25_: ;
								if (!T24_) goto LA26_;
								memset((void*)(&s), 0, sizeof(s));
								{
									if (!NIM_TRUE) goto LA30_;
									y = slash__lXoMhn1ZYc9cAJa9bfA61msg(source, y);
								}
								LA30_: ;
								k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0);
								{
									NimStringDesc* noSource;
									if (!!(((*x).d_type == ((NI8) 0)))) goto LA34_;
									{
										if (!((*x).d_type == ((NI8) 4))) goto LA38_;
										k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
									}
									LA38_: ;
									{
										if (!((*x).d_type == ((NI8) 10))) goto LA42_;
										{
											NIM_BOOL T46_;
											T46_ = (NIM_BOOL)0;
											T46_ = dirExists_wf0Ae3eLXw0lSNEFJMV3ogos(y);
											if (!T46_) goto LA47_;
											k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 3);
										}
										goto LA44_;
										LA47_: ;
										{
											k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 1);
										}
										LA44_: ;
									}
									LA42_: ;
									kind = k;
									path = y;
									noSource = copyStr(path, (NI)((source ? source->Sup.len : 0) + ((NI) 1)));
									switch (kind) {
									case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
									{
										NimStringDesc* T51_;
										T51_ = (NimStringDesc*)0;
										T51_ = slash__lXoMhn1ZYc9cAJa9bfA61msg(dest, noSource);
										copyFileWithPermissions_ocr9chMejxLldaYNB2fMsHw(path, T51_, ignorePermissionErrors);
									}
									break;
									case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
									{
										NimStringDesc* T53_;
										T53_ = (NimStringDesc*)0;
										T53_ = slash__lXoMhn1ZYc9cAJa9bfA61msg(dest, noSource);
										noscopyDirWithPermissions(path, T53_, ignorePermissionErrors);
									}
									break;
									default:
									{
									}
									break;
									}
									goto LA17;
								}
								LA34_: ;
								{
									int T57_;
									T57_ = (int)0;
									T57_ = lstat(y->data, (&s));
									if (!(T57_ < ((NI32) 0))) goto LA58_;
									goto LA15;
								}
								LA58_: ;
								{
									NIM_BOOL T62_;
									T62_ = (NIM_BOOL)0;
									T62_ = S_ISDIR(s.st_mode);
									if (!T62_) goto LA63_;
									k = ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
								}
								goto LA60_;
								LA63_: ;
								{
									NIM_BOOL T66_;
									T66_ = (NIM_BOOL)0;
									T66_ = S_ISLNK(s.st_mode);
									if (!T66_) goto LA67_;
									k = getSymlinkFileKind_WoXOp8qmMec1P4MyA3LBKg(y);
								}
								goto LA60_;
								LA67_: ;
								LA60_: ;
								kind = k;
								path = y;
								noSource_2 = copyStr(path, (NI)((source ? source->Sup.len : 0) + ((NI) 1)));
								switch (kind) {
								case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
								{
									NimStringDesc* T70_;
									T70_ = (NimStringDesc*)0;
									T70_ = slash__lXoMhn1ZYc9cAJa9bfA61msg(dest, noSource_2);
									copyFileWithPermissions_ocr9chMejxLldaYNB2fMsHw(path, T70_, ignorePermissionErrors);
								}
								break;
								case ((PathComponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
								{
									NimStringDesc* T72_;
									T72_ = (NimStringDesc*)0;
									T72_ = slash__lXoMhn1ZYc9cAJa9bfA61msg(dest, noSource_2);
									noscopyDirWithPermissions(path, T72_, ignorePermissionErrors);
								}
								break;
								default:
								{
								}
								break;
								}
							}
							LA26_: ;
						} LA17: ;
					}
				} LA15: ;
				nimrtl_popSafePoint();
			}
			else {
				nimrtl_popSafePoint();
			}
			{
				int T76_;
				T76_ = (int)0;
				T76_ = closedir(d);
			}
			if (TM_yu6cxgKBBXbNsTkT9cyMd4g_14.status != 0) nimrtl_reraiseException();
		}
		LA12_: ;
	}
}

N_LIB_EXPORT N_CDECL(void, nosinclFilePermissions)(NimStringDesc* filename, FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions) {
	FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set T1_;
	T1_ = nosgetFilePermissions(filename);
	nossetFilePermissions(filename, (T1_ | permissions));
}

N_LIB_EXPORT N_CDECL(void, nosexclFilePermissions)(NimStringDesc* filename, FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions) {
	FilePermission_uTVeDpjCH6aWw9c74YkAskA_Set T1_;
	T1_ = nosgetFilePermissions(filename);
	nossetFilePermissions(filename, (T1_ & ~ permissions));
}

N_NIMCALL(void, getEnvVarsC_xlXgIeBHBOL9cl4MJcFJ8xA)(void) {
	{
		NI i;
		if (!!(envComputed_LLyFo9bsdu1ZXMDvAe8DhrQ)) goto LA3_;
		if (environment_mlhK49b6YMgc9cgrcYkKq9a3g) nimGCunrefNoCycle(environment_mlhK49b6YMgc9cgrcYkKq9a3g);
		environment_mlhK49b6YMgc9cgrcYkKq9a3g = (TY_sM4lkSb7zS6F7OVMvW9cffQ*) nimrtl_newSeqRC1((&NTI_sM4lkSb7zS6F7OVMvW9cffQ_), 0);
		i = ((NI) 0);
		{
			while (1) {
				NimStringDesc* T12_;
				NimStringDesc* T13_;
				{
					NIM_BOOL T9_;
					T9_ = (NIM_BOOL)0;
					T9_ = eqeq__9ccNWqrTIE9bcAqE2Q0ro7zgos(environ[(i)- 0], NIM_NIL);
					if (!T9_) goto LA10_;
					goto LA5;
				}
				LA10_: ;
				T12_ = (NimStringDesc*)0;
				T12_ = nimrtl_cstrToNimstr(environ[(i)- 0]);
				environment_mlhK49b6YMgc9cgrcYkKq9a3g = (TY_sM4lkSb7zS6F7OVMvW9cffQ*) incrSeqV2(&(environment_mlhK49b6YMgc9cgrcYkKq9a3g)->Sup, sizeof(NimStringDesc*));
				T13_ = (NimStringDesc*)0;
				T13_ = environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[environment_mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len]; environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[environment_mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len] = nimrtl_copyStringRC1(T12_);
				if (T13_) nimGCunrefNoCycle(T13_);
				++environment_mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len;
				i += ((NI) 1);
			}
		} LA5: ;
		envComputed_LLyFo9bsdu1ZXMDvAe8DhrQ = NIM_TRUE;
	}
	LA3_: ;
}

static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c) {
	(*dest).data[((*dest).Sup.len)- 0] = c;
	(*dest).data[((NI)((*dest).Sup.len + ((NI) 1)))- 0] = 0;
	(*dest).Sup.len += ((NI) 1);
}

N_NIMCALL(NI, findEnvVar_cmJJ3H7KloA4DztTvzWyCw)(NimStringDesc* key) {
	NI result;
	NimStringDesc* temp;
	NimStringDesc* T1_;
{	result = (NI)0;
	getEnvVarsC_xlXgIeBHBOL9cl4MJcFJ8xA();
	T1_ = (NimStringDesc*)0;
	T1_ = rawNewString(key->Sup.len + 1);
appendString(T1_, key);
appendChar(T1_, 61);
	temp = T1_;
	{
		NI i;
		NI colontmp_;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = (environment_mlhK49b6YMgc9cgrcYkKq9a3g ? (environment_mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len-1) : -1);
		res = ((NI) 0);
		{
			while (1) {
				if (!(res <= colontmp_)) goto LA4;
				i = res;
				{
					NIM_BOOL T7_;
					T7_ = (NIM_BOOL)0;
					T7_ = nsuStartsWith(environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[i], temp);
					if (!T7_) goto LA8_;
					result = i;
					goto BeforeRet_;
				}
				LA8_: ;
				res += ((NI) 1);
			} LA4: ;
		}
	}
	result = ((NI) -1);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}

N_NIMCALL(NimStringDesc*, getEnv_8zNgT9bxx7m9cTt2TeVdTdIw)(NimStringDesc* key) {
	NimStringDesc* result;
	NI i;
{	result = (NimStringDesc*)0;
	i = findEnvVar_cmJJ3H7KloA4DztTvzWyCw(key);
	{
		NI T5_;
		if (!(((NI) 0) <= i)) goto LA3_;
		T5_ = (NI)0;
		T5_ = nsuFindChar(environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[i], 61, ((NI) 0), ((NI) 0));
		result = copyStr(environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[i], (NI)(T5_ + ((NI) 1)));
		goto BeforeRet_;
	}
	goto LA1_;
	LA3_: ;
	{
		NCSTRING env;
		env = getenv(key->data);
		{
			NIM_BOOL T9_;
			T9_ = (NIM_BOOL)0;
			T9_ = eqeq__9ccNWqrTIE9bcAqE2Q0ro7zgos(env, NIM_NIL);
			if (!T9_) goto LA10_;
			result = nimrtl_copyString(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
			goto BeforeRet_;
		}
		LA10_: ;
		result = nimrtl_cstrToNimstr(env);
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetHomeDir)(void) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	NimStringDesc* T2_;
{	result = (NimStringDesc*)0;
	T1_ = (NimStringDesc*)0;
	T2_ = (NimStringDesc*)0;
	T2_ = getEnv_8zNgT9bxx7m9cTt2TeVdTdIw(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_16));
	T1_ = rawNewString(T2_->Sup.len + 1);
appendString(T1_, T2_);
appendString(T1_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_17));
	result = T1_;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetConfigDir)(void) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	NimStringDesc* T2_;
{	result = (NimStringDesc*)0;
	T1_ = (NimStringDesc*)0;
	T2_ = (NimStringDesc*)0;
	T2_ = getEnv_8zNgT9bxx7m9cTt2TeVdTdIw(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_16));
	T1_ = rawNewString(T2_->Sup.len + 9);
appendString(T1_, T2_);
appendString(T1_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_18));
	result = T1_;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetTempDir)(void) {
	NimStringDesc* result;
{	result = (NimStringDesc*)0;
	result = nimrtl_copyString(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_19));
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}

N_NIMCALL(NimStringDesc*, getApplAux_Cd6LaCdd4j2y8pff6G0r9aw)(NimStringDesc* procPath) {
	NimStringDesc* result;
	NI len;
	result = (NimStringDesc*)0;
	result = mnewString(((NI) 256));
	len = readlink(procPath->data, result->data, ((NI) 256));
	{
		if (!(((NI) 256) < len)) goto LA3_;
		result = mnewString(((NI) ((NI)(len + ((NI) 1)))));
		len = readlink(procPath->data, result->data, len);
	}
	LA3_: ;
	result = nimrtl_setLengthStr(result, ((NI) (len)));
	return result;
}

N_NIMCALL(NimStringDesc*, getApplHeuristic_cIsnssr9auuNc29cT9bLoxiqg)(void) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	result = nimrtl_copyString(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	return result;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetAppFilename)(void) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	result = getApplAux_Cd6LaCdd4j2y8pff6G0r9aw(((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_20));
	{
		if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = getApplHeuristic_cIsnssr9auuNc29cT9bLoxiqg();
	}
	LA3_: ;
	return result;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetApplicationFilename)(void) {
	NimStringDesc* result;
	result = (NimStringDesc*)0;
	result = nosgetAppFilename();
	return result;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetApplicationDir)(void) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	TY_7q7q3E6Oj24ZNVJb9aonhAg T2_;
	result = (NimStringDesc*)0;
	T1_ = (NimStringDesc*)0;
	T1_ = nosgetAppFilename();
	memset((void*)(&T2_), 0, sizeof(T2_));
	nossplitFile(T1_, (&T2_));
	result = nimrtl_copyString(T2_.Field0);
	return result;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetAppDir)(void) {
	NimStringDesc* result;
	NimStringDesc* T1_;
	TY_7q7q3E6Oj24ZNVJb9aonhAg T2_;
	result = (NimStringDesc*)0;
	T1_ = (NimStringDesc*)0;
	T1_ = nosgetAppFilename();
	memset((void*)(&T2_), 0, sizeof(T2_));
	nossplitFile(T1_, (&T2_));
	result = nimrtl_copyString(T2_.Field0);
	return result;
}

N_LIB_EXPORT N_CDECL(void, nossleep)(NI milsecs) {
	struct timespec a;
	struct timespec b;
	int T1_;
	memset((void*)(&a), 0, sizeof(a));
	memset((void*)(&b), 0, sizeof(b));
	a.tv_sec = (NI)(milsecs / ((NI) 1000));
	a.tv_nsec = ((NI) ((NI)(((NI) ((NI)(((NI) ((NI)(milsecs % ((NI) 1000)))) * ((NI) 1000)))) * ((NI) 1000))));
	T1_ = (int)0;
	T1_ = nanosleep((&a), (&b));
}

N_LIB_EXPORT N_CDECL(NI64, nosgetFileSize)(NimStringDesc* file) {
	NI64 result;
	FILE* f;
	result = (NI64)0;
	f = (FILE*)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = open_sEp0GH2306oGo9bqBpj5oTQ(&f, file, ((FileMode_fVUBHvW79bXUw1j55Oo9avSQ) 0), ((NI) -1));
		if (!T3_) goto LA4_;
		result = getFileSize_XePgC9ccBXCgb9bEHXZpnMqA(f);
		close_BWnr8V7RERYno9bIdPmw8Hw_2(f);
	}
	goto LA1_;
	LA4_: ;
	{
		NI32 T7_;
		T7_ = (NI32)0;
		T7_ = osLastError_YyC2FKP9bqQiUDq2XVqW9acA();
		raiseOSError_86HIIOlD5N61CWaO5GBgqA(T7_, ((NimStringDesc*) &TM_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA1_: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, stdlib_osInit000)(void) {
nimRegisterGlobalMarker(TM_yu6cxgKBBXbNsTkT9cyMd4g_7);
}

NIM_EXTERNC N_NOINLINE(void, stdlib_osDatInit000)(void) {
}

