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

#include "nimbase.h"
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
#include <setjmp.h>
#undef linux
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct TY_UV3llMMYFckfui8YMBuUZA TY_UV3llMMYFckfui8YMBuUZA;
typedef struct TY_7q7q3E6Oj24ZNVJb9aonhAg TY_7q7q3E6Oj24ZNVJb9aonhAg;
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 TY_sM4lkSb7zS6F7OVMvW9cffQ TY_sM4lkSb7zS6F7OVMvW9cffQ;
typedef struct TSafePoint TSafePoint;
typedef struct Ioerror_9czoZw3pzPyrBmb5zTHY1OQ Ioerror_9czoZw3pzPyrBmb5zTHY1OQ;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct TY_UV3llMMYFckfui8YMBuUZA {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct TY_7q7q3E6Oj24ZNVJb9aonhAg {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
typedef NU8 Tnimkind_jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 Tnimtypeflag_v8QUszD1sWlSIWZz7mC4bQ_Set;
typedef N_NIMCALL_PTR(void, TY_ojoeKfW4VYIm36I9cpDTQIg) (void* p0, NI op0);
typedef N_NIMCALL_PTR(void*, TY_WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p0);
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 N_NIMCALL_PTR(void, TY_T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
typedef NU8 Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg;
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (Exception* e0, void* ClEnv);
void* ClEnv;
} TY_KeeAOYBd84Ofsw6Y7LizaQ;
struct  TSafePoint  {
TSafePoint* prev;
NI status;
jmp_buf context;
NIM_BOOL hasRaiseAction;
TY_KeeAOYBd84Ofsw6Y7LizaQ raiseAction;
};
typedef NIM_CHAR TY_dTlC27m9c9aWd5dvuePYanug[256];
struct  Ioerror_9czoZw3pzPyrBmb5zTHY1OQ  {
  Systemerror_Fjf9b9b2IlzRO2tspHxG3tgg Sup;
};
struct TY_sM4lkSb7zS6F7OVMvW9cffQ {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosjoinPath)(NimStringDesc* head0, NimStringDesc* tail0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_copyString)(NimStringDesc* src0);
static N_INLINE(void, appendString)(NimStringDesc* dest0, NimStringDesc* src0);
static N_INLINE(void, copymem_fPlwH3r9agN9aEHB6yCPMh0wsystem)(void* dest0, void* source0, NI size0);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s0, NI start0);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s0, NI first0);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space0);
static N_INLINE(void, appendChar)(NimStringDesc* dest0, NIM_CHAR c0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosjoinPathOpenArray)(NimStringDesc** parts0, NI parts0Len0);
N_LIB_EXPORT N_CDECL(void, nossplitPath)(NimStringDesc* path0, TY_UV3llMMYFckfui8YMBuUZA* Result);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s0, NI start_WPWyPKk58Cr5a6XFFviMjg, NI last0);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s0, NI first0, NI last0);
N_NIMCALL(void, unsureAsgnRef)(void** dest0, void* src0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosparentDir)(NimStringDesc* path0);
N_NIMCALL(NI, parentdirpos_DqTO9byr8jfMuX9cD2FnlVFQ)(NimStringDesc* path0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nostailDir)(NimStringDesc* path0);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nosisRootDir)(NimStringDesc* path0);
N_LIB_EXPORT N_CDECL(void, nossplitFile)(NimStringDesc* path0, TY_7q7q3E6Oj24ZNVJb9aonhAg* Result);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosextractFilename)(NimStringDesc* path0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, noschangeFileExt)(NimStringDesc* filename0, NimStringDesc* ext0);
N_NIMCALL(NI, searchextpos_AlmWoA52oxWnFTorxtz9caA)(NimStringDesc* s0);
N_NIMCALL(NimStringDesc*, normext_g9aFI0nT0uI8DMfFxBPaZZg)(NimStringDesc* ext0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename0, NimStringDesc* ext0);
N_LIB_EXPORT N_CDECL(NI, noscmpPaths)(NimStringDesc* patha0, NimStringDesc* pathb0);
N_NIMCALL(NI, cmp_xEnKsp9cfvO7Do9cTYXo8eJw)(NimStringDesc* x0, NimStringDesc* y0);
N_LIB_EXPORT N_CDECL(NI, nsuCmpIgnoreCase)(NimStringDesc* a0, NimStringDesc* b0);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nosisAbsolute)(NimStringDesc* path0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path0, NimStringDesc* drive0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nososErrorMsg)(void);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_cstrToNimstr)(NCSTRING str0);
N_LIB_EXPORT N_NOINLINE(void, nosraiseOSError)(NimStringDesc* msg0);
N_LIB_EXPORT N_CDECL(void*, nimrtl_newObj)(TNimType* typ0, NI size0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_copyStringRC1)(NimStringDesc* src0);
static N_INLINE(void, nimGCunrefNoCycle)(void* p0);
static N_INLINE(Cell_1zcF9cV8XIAtbN8h5HRUB8g*, usrtocell_yB9aH5WIlwd0xkYrcdPeXrQsystem)(void* usr0);
N_LIB_EXPORT N_CDECL(void, nimrtl_rtlAddZCT)(Cell_1zcF9cV8XIAtbN8h5HRUB8g* c0);
N_LIB_EXPORT N_CDECL(void, nimrtl_raiseException)(Exception* e0, NCSTRING ename0);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename0);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nosexistsDir)(NimStringDesc* dir0);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nossymlinkExists)(NimStringDesc* link0);
N_LIB_EXPORT N_CDECL(time_t, nosgetLastModificationTime)(NimStringDesc* file0);
N_NOINLINE(void, raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA)(NI32 errorcode0, NimStringDesc* additionalinfo0);
N_NIMCALL(NimStringDesc*, oserrormsg_9cO757MdTrYxfurMy5qIoAg)(NI32 errorcode0);
static N_INLINE(void, asgnRefNoCycle)(void** dest0, void* src0);
N_NIMCALL(NI32, oslasterror_pMOMIZAQaKFp1XoL58mjVg)(void);
N_LIB_EXPORT N_CDECL(time_t, nosgetLastAccessTime)(NimStringDesc* file0);
N_LIB_EXPORT N_CDECL(time_t, nosgetCreationTime)(NimStringDesc* file0);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nosfileNewer)(NimStringDesc* a0, NimStringDesc* b0);
N_LIB_EXPORT N_CDECL(NI64, ntDiffTime)(time_t a0, time_t b0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetCurrentDir)(void);
N_NIMCALL(NimStringDesc*, mnewString)(NI len0);
N_NIMCALL(NimStringDesc*, mnewString)(NI len0);
static N_INLINE(NIM_BOOL, HEX3DHEX3D_9ccNWqrTIE9bcAqE2Q0ro7zgos)(NCSTRING x0, NCSTRING y0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_setLengthStr)(NimStringDesc* s0, NI newlen0);
N_NOINLINE(void, raiseassert_PpfSiTIeNpMAb9a5o6SglJw)(NimStringDesc* msg0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosexpandFilename)(NimStringDesc* filename0);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nossameFile)(NimStringDesc* path10, NimStringDesc* path20);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nossameFileContent)(NimStringDesc* path10, NimStringDesc* path20);
N_NIMCALL(NIM_BOOL, open_sEp0GH2306oGo9bqBpj5oTQ)(FILE** f0, NimStringDesc* filename0, Filemode_fVUBHvW79bXUw1j55Oo9avSQ mode0, NI bufsize0);
N_NIMCALL(void, close_BWnr8V7RERYno9bIdPmw8Hw)(FILE* f0);
N_LIB_EXPORT N_NOCONV(void*, nimrtl_alloc)(NI size0);
N_NIMCALL(NI, readbuffer_nZ0pNe9cd9cXtoayexCiaDtA)(FILE* f0, void* buffer0, NI len0);
static N_INLINE(NIM_BOOL, equalmem_DCrUjdaMvFDHaR1hs7sQGwstrutils)(void* a0, void* b0, NI size0);
N_LIB_EXPORT N_NOCONV(void, nimrtl_dealloc)(void* p0);
N_LIB_EXPORT N_CDECL(Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set, nosgetFilePermissions)(NimStringDesc* filename0);
N_LIB_EXPORT N_CDECL(void, nossetFilePermissions)(NimStringDesc* filename0, Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions0);
N_LIB_EXPORT N_CDECL(void, noscopyFile)(NimStringDesc* source0, NimStringDesc* dest0);
N_NIMCALL(NI, writebuffer_nZ0pNe9cd9cXtoayexCiaDtA_2)(FILE* f0, void* buffer0, NI len0);
N_NIMCALL(void, flushfile_BWnr8V7RERYno9bIdPmw8Hw_2)(FILE* f0);
N_LIB_EXPORT N_CDECL(void, nosmoveFile)(NimStringDesc* source0, NimStringDesc* dest0);
N_LIB_EXPORT N_CDECL(void, nosremoveFile)(NimStringDesc* file0);
N_LIB_EXPORT N_CDECL(NI, nosexecShellCmd)(NimStringDesc* command0);
N_LIB_EXPORT N_CDECL(void, nimrtl_nimGCvisit)(void* d0, NI op0);
static N_NIMCALL(void, T_yu6cxgKBBXbNsTkT9cyMd4g_6)(void);
N_NIMCALL(void, nimRegisterGlobalMarker)(TY_T4eqaYlFJYZUv9aG9b1TV0bQ markerproc0);
N_LIB_EXPORT N_CDECL(void, nosremoveDir)(NimStringDesc* dir0);
N_LIB_EXPORT N_CDECL(void, nimrtl_pushSafePoint)(TSafePoint* s0);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a0, NimStringDesc* b0);
N_NIMCALL(NimStringDesc*, HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ)(NimStringDesc* head0, NimStringDesc* tail0);
static N_INLINE(NIM_BOOL, direxists_wf0Ae3eLXw0lSNEFJMV3ogos)(NimStringDesc* dir0);
N_NIMCALL(Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg, getsymlinkfilekind_WoXOp8qmMec1P4MyA3LBKg)(NimStringDesc* path0);
N_LIB_EXPORT N_CDECL(void, nimrtl_popSafePoint)(void);
N_LIB_EXPORT N_CDECL(void, nimrtl_reraiseException)(void);
N_NIMCALL(void, rawremovedir_P9aOuM3pg25yKqgBUm7qKng)(NimStringDesc* dir0);
N_LIB_EXPORT N_CDECL(void, noscreateDir)(NimStringDesc* dir0);
N_NIMCALL(NIM_BOOL, existsorcreatedir_V86QyZrcGMPX0W9bv1Q53ww)(NimStringDesc* dir0);
N_NIMCALL(NIM_BOOL, rawcreatedir_V86QyZrcGMPX0W9bv1Q53ww_2)(NimStringDesc* dir0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_nimIntToStr)(NI x0);
N_LIB_EXPORT N_CDECL(void, noscopyDir)(NimStringDesc* source0, NimStringDesc* dest0);
N_LIB_EXPORT N_CDECL(TY_sM4lkSb7zS6F7OVMvW9cffQ*, nosparseCmdLine)(NimStringDesc* c0);
N_LIB_EXPORT N_CDECL(void*, nimrtl_newSeq)(TNimType* typ0, NI len0);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s0, NIM_CHAR c0);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq0, NI elemsize0);
N_LIB_EXPORT N_CDECL(void, noscopyDirWithPermissions)(NimStringDesc* source0, NimStringDesc* dest0, NIM_BOOL ignorepermissionerrors0);
N_LIB_EXPORT N_CDECL(void, nimrtl_popCurrentException)(void);
N_NIMCALL(void, copyfilewithpermissions_ocr9chMejxLldaYNB2fMsHw)(NimStringDesc* source0, NimStringDesc* dest0, NIM_BOOL ignorepermissionerrors0);
N_LIB_EXPORT N_CDECL(void, nosinclFilePermissions)(NimStringDesc* filename0, Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions0);
N_LIB_EXPORT N_CDECL(void, nosexclFilePermissions)(NimStringDesc* filename0, Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetHomeDir)(void);
N_NIMCALL(NimStringDesc*, getenv_8zNgT9bxx7m9cTt2TeVdTdIw)(NimStringDesc* key0);
N_NIMCALL(NI, findenvvar_cmJJ3H7KloA4DztTvzWyCw)(NimStringDesc* key0);
N_NIMCALL(void, getenvvarsc_xlXgIeBHBOL9cl4MJcFJ8xA)(void);
N_LIB_EXPORT N_CDECL(void*, nimrtl_newSeqRC1)(TNimType* typ0, NI len0);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s0, NimStringDesc* prefix0);
N_LIB_EXPORT N_CDECL(NI, nsuFindChar)(NimStringDesc* s0, NIM_CHAR sub0, NI start0);
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* procpath0);
N_NIMCALL(NimStringDesc*, getapplheuristic_cIsnssr9auuNc29cT9bLoxiqg)(void);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetApplicationFilename)(void);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetApplicationDir)(void);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetAppDir)(void);
N_LIB_EXPORT N_CDECL(void, nossleep)(NI milsecs0);
N_LIB_EXPORT N_CDECL(NI64, nosgetFileSize)(NimStringDesc* file0);
N_NIMCALL(NI64, getfilesize_XePgC9ccBXCgb9bEHXZpnMqA)(FILE* f0);
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(T_yu6cxgKBBXbNsTkT9cyMd4g_2, "", 0);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_3, "unknown OS error", 16);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_4, "\012Additional info: ", 18);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_5, "\012  0 <= bufsize ", 16);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_8, ".", 1);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_9, "..", 2);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_10, "Failed to create the directory", 30);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_15, "HOME", 4);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_16, "/", 1);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_17, "/.config/", 9);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_18, "/tmp/", 5);
STRING_LITERAL(T_yu6cxgKBBXbNsTkT9cyMd4g_19, "/proc/self/exe", 14);

static N_INLINE(void, copymem_fPlwH3r9agN9aEHB6yCPMh0wsystem)(void* dest0, void* source0, NI size0) {
	void* LOC1;
	LOC1 = (void*)0;
	LOC1 = memcpy(dest0, source0, ((size_t) (size0)));
}

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

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

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosjoinPath)(NimStringDesc* head0, NimStringDesc* tail0) {
	NimStringDesc* result0;
	result0 = (NimStringDesc*)0;
	{
		if (!((head0 ? head0->Sup.len : 0) == ((NI) 0))) goto LA3;
		result0 = nimrtl_copyString(tail0);
	}
	goto LA1;
	LA3: ;
	{
		if (!(((NU8)(head0->data[(NI)((head0 ? head0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(head0->data[(NI)((head0 ? head0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)))) goto LA6;
		{
			NimStringDesc* LOC12;
			NimStringDesc* LOC13;
			if (!(((NU8)(tail0->data[((NI) 0)])) == ((NU8)(47)) || ((NU8)(tail0->data[((NI) 0)])) == ((NU8)(47)))) goto LA10;
			LOC12 = (NimStringDesc*)0;
			LOC13 = (NimStringDesc*)0;
			LOC13 = copyStr(tail0, ((NI) 1));
			LOC12 = rawNewString(head0->Sup.len + LOC13->Sup.len + 0);
appendString(LOC12, head0);
appendString(LOC12, LOC13);
			result0 = LOC12;
		}
		goto LA8;
		LA10: ;
		{
			NimStringDesc* LOC15;
			LOC15 = (NimStringDesc*)0;
			LOC15 = rawNewString(head0->Sup.len + tail0->Sup.len + 0);
appendString(LOC15, head0);
appendString(LOC15, tail0);
			result0 = LOC15;
		}
		LA8: ;
	}
	goto LA1;
	LA6: ;
	{
		{
			NimStringDesc* LOC21;
			if (!(((NU8)(tail0->data[((NI) 0)])) == ((NU8)(47)) || ((NU8)(tail0->data[((NI) 0)])) == ((NU8)(47)))) goto LA19;
			LOC21 = (NimStringDesc*)0;
			LOC21 = rawNewString(head0->Sup.len + tail0->Sup.len + 0);
appendString(LOC21, head0);
appendString(LOC21, tail0);
			result0 = LOC21;
		}
		goto LA17;
		LA19: ;
		{
			NimStringDesc* LOC23;
			LOC23 = (NimStringDesc*)0;
			LOC23 = rawNewString(head0->Sup.len + tail0->Sup.len + 1);
appendString(LOC23, head0);
appendChar(LOC23, 47);
appendString(LOC23, tail0);
			result0 = LOC23;
		}
		LA17: ;
	}
	LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosjoinPathOpenArray)(NimStringDesc** parts0, NI parts0Len0) {
	NimStringDesc* result0;
	result0 = (NimStringDesc*)0;
	result0 = nimrtl_copyString(parts0[((NI) 0)]);
	{
		NI i_uRpZpRasd2AS4VVcmkOdEQ;
		NI HEX3Atmp_SDwb5ajFd20DU9b0F06Tbwg;
		NI res_PQctTd1UoEHQ9cP9bv9cBWHpQ;
		i_uRpZpRasd2AS4VVcmkOdEQ = (NI)0;
		HEX3Atmp_SDwb5ajFd20DU9b0F06Tbwg = (NI)0;
		HEX3Atmp_SDwb5ajFd20DU9b0F06Tbwg = (parts0Len0-1);
		res_PQctTd1UoEHQ9cP9bv9cBWHpQ = ((NI) 1);
		{
			while (1) {
				if (!(res_PQctTd1UoEHQ9cP9bv9cBWHpQ <= HEX3Atmp_SDwb5ajFd20DU9b0F06Tbwg)) goto LA3;
				i_uRpZpRasd2AS4VVcmkOdEQ = res_PQctTd1UoEHQ9cP9bv9cBWHpQ;
				result0 = nosjoinPath(result0, parts0[i_uRpZpRasd2AS4VVcmkOdEQ]);
				res_PQctTd1UoEHQ9cP9bv9cBWHpQ += ((NI) 1);
			} LA3: ;
		}
	}
	return result0;
}

N_LIB_EXPORT N_CDECL(void, nossplitPath)(NimStringDesc* path0, TY_UV3llMMYFckfui8YMBuUZA* Result) {
	NI seppos0;
	seppos0 = ((NI) -1);
	{
		NI i_PU9a9a9b9ayxLUu9czuig0ggZVg;
		NI HEX3Atmp_qi0JGA3QNuBuU7hHq9aaCAg;
		NI res_mg8ARupfA5R2j58N4jwiiA;
		i_PU9a9a9b9ayxLUu9czuig0ggZVg = (NI)0;
		HEX3Atmp_qi0JGA3QNuBuU7hHq9aaCAg = (NI)0;
		HEX3Atmp_qi0JGA3QNuBuU7hHq9aaCAg = (NI)((path0 ? path0->Sup.len : 0) - ((NI) 1));
		res_mg8ARupfA5R2j58N4jwiiA = HEX3Atmp_qi0JGA3QNuBuU7hHq9aaCAg;
		{
			while (1) {
				if (!(((NI) 0) <= res_mg8ARupfA5R2j58N4jwiiA)) goto LA3;
				i_PU9a9a9b9ayxLUu9czuig0ggZVg = res_mg8ARupfA5R2j58N4jwiiA;
				{
					if (!(((NU8)(path0->data[i_PU9a9a9b9ayxLUu9czuig0ggZVg])) == ((NU8)(47)) || ((NU8)(path0->data[i_PU9a9a9b9ayxLUu9czuig0ggZVg])) == ((NU8)(47)))) goto LA6;
					seppos0 = i_PU9a9a9b9ayxLUu9czuig0ggZVg;
					goto LA1;
				}
				LA6: ;
				res_mg8ARupfA5R2j58N4jwiiA -= ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
	{
		if (!(((NI) 0) <= seppos0)) goto LA10;
		unsureAsgnRef((void**) (&(*Result).Field0), copyStrLast(path0, ((NI) 0), (NI)(seppos0 - ((NI) 1))));
		unsureAsgnRef((void**) (&(*Result).Field1), copyStr(path0, (NI)(seppos0 + ((NI) 1))));
	}
	goto LA8;
	LA10: ;
	{
		unsureAsgnRef((void**) (&(*Result).Field0), nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2)));
		unsureAsgnRef((void**) (&(*Result).Field1), nimrtl_copyString(path0));
	}
	LA8: ;
}

N_NIMCALL(NI, parentdirpos_DqTO9byr8jfMuX9cD2FnlVFQ)(NimStringDesc* path0) {
	NI result0;
	NI q0;
{	result0 = (NI)0;
	q0 = ((NI) 1);
	{
		NIM_BOOL LOC3;
		LOC3 = (NIM_BOOL)0;
		LOC3 = (((NI) 1) <= (path0 ? path0->Sup.len : 0));
		if (!(LOC3)) goto LA4;
		LOC3 = (((NU8)(path0->data[(NI)((path0 ? path0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path0->data[(NI)((path0 ? path0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)));
		LA4: ;
		if (!LOC3) goto LA5;
		q0 = ((NI) 2);
	}
	LA5: ;
	{
		NI i_WxgcWd2Exz8KkJdIEhEwag;
		NI HEX3Atmp_svAarcCWD8m2rrDIUxDWRQ;
		NI res_ZbndgrJU9c18Iu9c5JbbaFxA;
		i_WxgcWd2Exz8KkJdIEhEwag = (NI)0;
		HEX3Atmp_svAarcCWD8m2rrDIUxDWRQ = (NI)0;
		HEX3Atmp_svAarcCWD8m2rrDIUxDWRQ = (NI)((path0 ? path0->Sup.len : 0) - q0);
		res_ZbndgrJU9c18Iu9c5JbbaFxA = HEX3Atmp_svAarcCWD8m2rrDIUxDWRQ;
		{
			while (1) {
				if (!(((NI) 0) <= res_ZbndgrJU9c18Iu9c5JbbaFxA)) goto LA9;
				i_WxgcWd2Exz8KkJdIEhEwag = res_ZbndgrJU9c18Iu9c5JbbaFxA;
				{
					if (!(((NU8)(path0->data[i_WxgcWd2Exz8KkJdIEhEwag])) == ((NU8)(47)) || ((NU8)(path0->data[i_WxgcWd2Exz8KkJdIEhEwag])) == ((NU8)(47)))) goto LA12;
					result0 = i_WxgcWd2Exz8KkJdIEhEwag;
					goto BeforeRet;
				}
				LA12: ;
				res_ZbndgrJU9c18Iu9c5JbbaFxA -= ((NI) 1);
			} LA9: ;
		}
	}
	result0 = ((NI) -1);
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosparentDir)(NimStringDesc* path0) {
	NimStringDesc* result0;
	NI seppos0;
	result0 = (NimStringDesc*)0;
	seppos0 = parentdirpos_DqTO9byr8jfMuX9cD2FnlVFQ(path0);
	{
		if (!(((NI) 0) <= seppos0)) goto LA3;
		result0 = copyStrLast(path0, ((NI) 0), (NI)(seppos0 - ((NI) 1)));
	}
	goto LA1;
	LA3: ;
	{
		result0 = nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nostailDir)(NimStringDesc* path0) {
	NimStringDesc* result0;
	NI q0;
{	result0 = (NimStringDesc*)0;
	q0 = ((NI) 1);
	{
		NIM_BOOL LOC3;
		LOC3 = (NIM_BOOL)0;
		LOC3 = (((NI) 1) <= (path0 ? path0->Sup.len : 0));
		if (!(LOC3)) goto LA4;
		LOC3 = (((NU8)(path0->data[(NI)((path0 ? path0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path0->data[(NI)((path0 ? path0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)));
		LA4: ;
		if (!LOC3) goto LA5;
		q0 = ((NI) 2);
	}
	LA5: ;
	{
		NI i_hehl9aJUoC2tLJ7YzY9cl9b5w;
		NI HEX3Atmp_fsc89adWipeNuXIeVHK5gAw;
		NI res_2qCQCPxu3xBKfVoqzAIrYQ;
		i_hehl9aJUoC2tLJ7YzY9cl9b5w = (NI)0;
		HEX3Atmp_fsc89adWipeNuXIeVHK5gAw = (NI)0;
		HEX3Atmp_fsc89adWipeNuXIeVHK5gAw = (NI)((path0 ? path0->Sup.len : 0) - q0);
		res_2qCQCPxu3xBKfVoqzAIrYQ = ((NI) 0);
		{
			while (1) {
				if (!(res_2qCQCPxu3xBKfVoqzAIrYQ <= HEX3Atmp_fsc89adWipeNuXIeVHK5gAw)) goto LA9;
				i_hehl9aJUoC2tLJ7YzY9cl9b5w = res_2qCQCPxu3xBKfVoqzAIrYQ;
				{
					if (!(((NU8)(path0->data[i_hehl9aJUoC2tLJ7YzY9cl9b5w])) == ((NU8)(47)) || ((NU8)(path0->data[i_hehl9aJUoC2tLJ7YzY9cl9b5w])) == ((NU8)(47)))) goto LA12;
					result0 = copyStr(path0, (NI)(i_hehl9aJUoC2tLJ7YzY9cl9b5w + ((NI) 1)));
					goto BeforeRet;
				}
				LA12: ;
				res_2qCQCPxu3xBKfVoqzAIrYQ += ((NI) 1);
			} LA9: ;
		}
	}
	result0 = nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nosisRootDir)(NimStringDesc* path0) {
	NIM_BOOL result0;
	NI LOC1;
	result0 = (NIM_BOOL)0;
	LOC1 = (NI)0;
	LOC1 = parentdirpos_DqTO9byr8jfMuX9cD2FnlVFQ(path0);
	result0 = (LOC1 < ((NI) 0));
	return result0;
}

N_LIB_EXPORT N_CDECL(void, nossplitFile)(NimStringDesc* path0, TY_7q7q3E6Oj24ZNVJb9aonhAg* Result) {
	{
		NIM_BOOL LOC3;
		LOC3 = (NIM_BOOL)0;
		LOC3 = ((path0 ? path0->Sup.len : 0) == ((NI) 0));
		if (LOC3) goto LA4;
		LOC3 = (((NU8)(path0->data[(NI)((path0 ? path0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path0->data[(NI)((path0 ? path0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)));
		LA4: ;
		if (!LOC3) goto LA5;
		unsureAsgnRef((void**) (&(*Result).Field0), nimrtl_copyString(path0));
		unsureAsgnRef((void**) (&(*Result).Field1), nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2)));
		unsureAsgnRef((void**) (&(*Result).Field2), nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2)));
	}
	goto LA1;
	LA5: ;
	{
		NI seppos0;
		NI dotpos0;
		seppos0 = ((NI) -1);
		dotpos0 = (path0 ? path0->Sup.len : 0);
		{
			NI i_RvAXC8pcRrjQVcLzMy7Fhw;
			NI HEX3Atmp_yDPmQODHSEiGYJLOLrehCg;
			NI res_FD5o2nBImp9bjBTg5egPNBA;
			i_RvAXC8pcRrjQVcLzMy7Fhw = (NI)0;
			HEX3Atmp_yDPmQODHSEiGYJLOLrehCg = (NI)0;
			HEX3Atmp_yDPmQODHSEiGYJLOLrehCg = (NI)((path0 ? path0->Sup.len : 0) - ((NI) 1));
			res_FD5o2nBImp9bjBTg5egPNBA = HEX3Atmp_yDPmQODHSEiGYJLOLrehCg;
			{
				while (1) {
					if (!(((NI) 0) <= res_FD5o2nBImp9bjBTg5egPNBA)) goto LA10;
					i_RvAXC8pcRrjQVcLzMy7Fhw = res_FD5o2nBImp9bjBTg5egPNBA;
					{
						if (!((NU8)(path0->data[i_RvAXC8pcRrjQVcLzMy7Fhw]) == (NU8)(46))) goto LA13;
						{
							NIM_BOOL LOC17;
							NIM_BOOL LOC18;
							LOC17 = (NIM_BOOL)0;
							LOC18 = (NIM_BOOL)0;
							LOC18 = (dotpos0 == (path0 ? path0->Sup.len : 0));
							if (!(LOC18)) goto LA19;
							LOC18 = (((NI) 0) < i_RvAXC8pcRrjQVcLzMy7Fhw);
							LA19: ;
							LOC17 = LOC18;
							if (!(LOC17)) goto LA20;
							LOC17 = !((((NU8)(path0->data[(NI)(i_RvAXC8pcRrjQVcLzMy7Fhw - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path0->data[(NI)(i_RvAXC8pcRrjQVcLzMy7Fhw - ((NI) 1))])) == ((NU8)(47))));
							LA20: ;
							if (!LOC17) goto LA21;
							dotpos0 = i_RvAXC8pcRrjQVcLzMy7Fhw;
						}
						LA21: ;
					}
					goto LA11;
					LA13: ;
					{
						if (!(((NU8)(path0->data[i_RvAXC8pcRrjQVcLzMy7Fhw])) == ((NU8)(47)) || ((NU8)(path0->data[i_RvAXC8pcRrjQVcLzMy7Fhw])) == ((NU8)(47)))) goto LA24;
						seppos0 = i_RvAXC8pcRrjQVcLzMy7Fhw;
						goto LA8;
					}
					goto LA11;
					LA24: ;
					LA11: ;
					res_FD5o2nBImp9bjBTg5egPNBA -= ((NI) 1);
				} LA10: ;
			}
		} LA8: ;
		unsureAsgnRef((void**) (&(*Result).Field0), copyStrLast(path0, ((NI) 0), (NI)(seppos0 - ((NI) 1))));
		unsureAsgnRef((void**) (&(*Result).Field1), copyStrLast(path0, (NI)(seppos0 + ((NI) 1)), (NI)(dotpos0 - ((NI) 1))));
		unsureAsgnRef((void**) (&(*Result).Field2), copyStr(path0, dotpos0));
	}
	LA1: ;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosextractFilename)(NimStringDesc* path0) {
	NimStringDesc* result0;
	result0 = (NimStringDesc*)0;
	{
		NIM_BOOL LOC3;
		LOC3 = (NIM_BOOL)0;
		LOC3 = ((path0 ? path0->Sup.len : 0) == ((NI) 0));
		if (LOC3) goto LA4;
		LOC3 = (((NU8)(path0->data[(NI)((path0 ? path0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path0->data[(NI)((path0 ? path0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)));
		LA4: ;
		if (!LOC3) goto LA5;
		result0 = nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	goto LA1;
	LA5: ;
	{
		TY_UV3llMMYFckfui8YMBuUZA LOC8;
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		nossplitPath(path0, (&LOC8));
		result0 = nimrtl_copyString(LOC8.Field1);
	}
	LA1: ;
	return result0;
}

N_NIMCALL(NI, searchextpos_AlmWoA52oxWnFTorxtz9caA)(NimStringDesc* s0) {
	NI result0;
	result0 = (NI)0;
	result0 = ((NI) -1);
	{
		NI i_XQE9aiUWOFdx4JhYiIhgMdQ;
		NI HEX3Atmp_wwRFqz9cAap5nYm4hxa9a9cyQ;
		NI res_c104hbjlw03oZVhljBpoGA;
		i_XQE9aiUWOFdx4JhYiIhgMdQ = (NI)0;
		HEX3Atmp_wwRFqz9cAap5nYm4hxa9a9cyQ = (NI)0;
		HEX3Atmp_wwRFqz9cAap5nYm4hxa9a9cyQ = (NI)((s0 ? s0->Sup.len : 0) - ((NI) 1));
		res_c104hbjlw03oZVhljBpoGA = HEX3Atmp_wwRFqz9cAap5nYm4hxa9a9cyQ;
		{
			while (1) {
				if (!(((NI) 1) <= res_c104hbjlw03oZVhljBpoGA)) goto LA3;
				i_XQE9aiUWOFdx4JhYiIhgMdQ = res_c104hbjlw03oZVhljBpoGA;
				{
					if (!((NU8)(s0->data[i_XQE9aiUWOFdx4JhYiIhgMdQ]) == (NU8)(46))) goto LA6;
					result0 = i_XQE9aiUWOFdx4JhYiIhgMdQ;
					goto LA1;
				}
				goto LA4;
				LA6: ;
				{
					if (!(((NU8)(s0->data[i_XQE9aiUWOFdx4JhYiIhgMdQ])) == ((NU8)(47)) || ((NU8)(s0->data[i_XQE9aiUWOFdx4JhYiIhgMdQ])) == ((NU8)(47)))) goto LA9;
					goto LA1;
				}
				goto LA4;
				LA9: ;
				LA4: ;
				res_c104hbjlw03oZVhljBpoGA -= ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
	return result0;
}

N_NIMCALL(NimStringDesc*, normext_g9aFI0nT0uI8DMfFxBPaZZg)(NimStringDesc* ext0) {
	NimStringDesc* result0;
	result0 = (NimStringDesc*)0;
	{
		NIM_BOOL LOC3;
		LOC3 = (NIM_BOOL)0;
		LOC3 = ((ext0) && (ext0)->Sup.len == 0);
		if (LOC3) goto LA4;
		LOC3 = ((NU8)(ext0->data[((NI) 0)]) == (NU8)(46));
		LA4: ;
		if (!LOC3) goto LA5;
		result0 = nimrtl_copyString(ext0);
	}
	goto LA1;
	LA5: ;
	{
		NimStringDesc* LOC8;
		LOC8 = (NimStringDesc*)0;
		LOC8 = rawNewString(ext0->Sup.len + 1);
appendChar(LOC8, 46);
appendString(LOC8, ext0);
		result0 = LOC8;
	}
	LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, noschangeFileExt)(NimStringDesc* filename0, NimStringDesc* ext0) {
	NimStringDesc* result0;
	NI extpos0;
	result0 = (NimStringDesc*)0;
	extpos0 = searchextpos_AlmWoA52oxWnFTorxtz9caA(filename0);
	{
		NimStringDesc* LOC5;
		NimStringDesc* LOC6;
		if (!(extpos0 < ((NI) 0))) goto LA3;
		LOC5 = (NimStringDesc*)0;
		LOC6 = (NimStringDesc*)0;
		LOC6 = normext_g9aFI0nT0uI8DMfFxBPaZZg(ext0);
		LOC5 = rawNewString(filename0->Sup.len + LOC6->Sup.len + 0);
appendString(LOC5, filename0);
appendString(LOC5, LOC6);
		result0 = LOC5;
	}
	goto LA1;
	LA3: ;
	{
		NimStringDesc* LOC8;
		NimStringDesc* LOC9;
		NimStringDesc* LOC10;
		LOC8 = (NimStringDesc*)0;
		LOC9 = (NimStringDesc*)0;
		LOC9 = copyStrLast(filename0, ((NI) 0), (NI)(extpos0 - ((NI) 1)));
		LOC10 = (NimStringDesc*)0;
		LOC10 = normext_g9aFI0nT0uI8DMfFxBPaZZg(ext0);
		LOC8 = rawNewString(LOC9->Sup.len + LOC10->Sup.len + 0);
appendString(LOC8, LOC9);
appendString(LOC8, LOC10);
		result0 = LOC8;
	}
	LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename0, NimStringDesc* ext0) {
	NimStringDesc* result0;
	NI extpos0;
	result0 = (NimStringDesc*)0;
	extpos0 = searchextpos_AlmWoA52oxWnFTorxtz9caA(filename0);
	{
		NimStringDesc* LOC5;
		NimStringDesc* LOC6;
		if (!(extpos0 < ((NI) 0))) goto LA3;
		LOC5 = (NimStringDesc*)0;
		LOC6 = (NimStringDesc*)0;
		LOC6 = normext_g9aFI0nT0uI8DMfFxBPaZZg(ext0);
		LOC5 = rawNewString(filename0->Sup.len + LOC6->Sup.len + 0);
appendString(LOC5, filename0);
appendString(LOC5, LOC6);
		result0 = LOC5;
	}
	goto LA1;
	LA3: ;
	{
		result0 = nimrtl_copyString(filename0);
	}
	LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NI, noscmpPaths)(NimStringDesc* patha0, NimStringDesc* pathb0) {
	NI result0;
	result0 = (NI)0;
	{
		if (!NIM_TRUE) goto LA3;
		result0 = cmp_xEnKsp9cfvO7Do9cTYXo8eJw(patha0, pathb0);
	}
	goto LA1;
	LA3: ;
	{
		result0 = nsuCmpIgnoreCase(patha0, pathb0);
	}
	LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nosisAbsolute)(NimStringDesc* path0) {
	NIM_BOOL result0;
	result0 = (NIM_BOOL)0;
	result0 = ((NU8)(path0->data[((NI) 0)]) == (NU8)(47));
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path0, NimStringDesc* drive0) {
	NimStringDesc* result0;
	result0 = (NimStringDesc*)0;
	result0 = nimrtl_copyString(path0);
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nososErrorMsg)(void) {
	NimStringDesc* result0;
	result0 = (NimStringDesc*)0;
	result0 = nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	{
		NCSTRING LOC5;
		if (!!((errno == ((NI32) 0)))) goto LA3;
		LOC5 = (NCSTRING)0;
		LOC5 = strerror(errno);
		result0 = nimrtl_cstrToNimstr(LOC5);
	}
	LA3: ;
	return result0;
}

static N_INLINE(Cell_1zcF9cV8XIAtbN8h5HRUB8g*, usrtocell_yB9aH5WIlwd0xkYrcdPeXrQsystem)(void* usr0) {
	Cell_1zcF9cV8XIAtbN8h5HRUB8g* result0;
	result0 = (Cell_1zcF9cV8XIAtbN8h5HRUB8g*)0;
	result0 = ((Cell_1zcF9cV8XIAtbN8h5HRUB8g*) ((NI)((NU32)(((NI) (usr0))) - (NU32)(((NI)sizeof(Cell_1zcF9cV8XIAtbN8h5HRUB8g))))));
	return result0;
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p0) {
	Cell_1zcF9cV8XIAtbN8h5HRUB8g* c0;
	c0 = usrtocell_yB9aH5WIlwd0xkYrcdPeXrQsystem(p0);
	{
		(*c0).refcount -= ((NI) 8);
		if (!((NU32)((*c0).refcount) < (NU32)(((NI) 8)))) goto LA3;
		nimrtl_rtlAddZCT(c0);
	}
	LA3: ;
}

N_LIB_EXPORT N_NOINLINE(void, nosraiseOSError)(NimStringDesc* msg0) {
	{
		NimStringDesc* m0;
		Oserror_3XwRQvmzCEOC4QnT706q1g* e_QFaxakZ1I9a4KWif8o6ouHg;
		if (!((msg0 ? msg0->Sup.len : 0) == ((NI) 0))) goto LA3;
		m0 = nososErrorMsg();
		e_QFaxakZ1I9a4KWif8o6ouHg = (Oserror_3XwRQvmzCEOC4QnT706q1g*)0;
		e_QFaxakZ1I9a4KWif8o6ouHg = (Oserror_3XwRQvmzCEOC4QnT706q1g*) nimrtl_newObj((&NTI_Qx9aKy4vZ9bVz9bnG9brQcRHGA), sizeof(Oserror_3XwRQvmzCEOC4QnT706q1g));
		(*e_QFaxakZ1I9a4KWif8o6ouHg).Sup.Sup.Sup.m_type = (&NTI_3XwRQvmzCEOC4QnT706q1g);
		{
			NimStringDesc* LOC9;
			if (!(((NI) 0) < (m0 ? m0->Sup.len : 0))) goto LA7;
			LOC9 = (NimStringDesc*)0;
			LOC9 = (*e_QFaxakZ1I9a4KWif8o6ouHg).Sup.Sup.message; (*e_QFaxakZ1I9a4KWif8o6ouHg).Sup.Sup.message = nimrtl_copyStringRC1(m0);
			if (LOC9) nimGCunrefNoCycle(LOC9);
		}
		goto LA5;
		LA7: ;
		{
			NimStringDesc* LOC11;
			LOC11 = (NimStringDesc*)0;
			LOC11 = (*e_QFaxakZ1I9a4KWif8o6ouHg).Sup.Sup.message; (*e_QFaxakZ1I9a4KWif8o6ouHg).Sup.Sup.message = nimrtl_copyStringRC1(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_3));
			if (LOC11) nimGCunrefNoCycle(LOC11);
		}
		LA5: ;
		nimrtl_raiseException((Exception*)e_QFaxakZ1I9a4KWif8o6ouHg, "OSError");
	}
	goto LA1;
	LA3: ;
	{
		Oserror_3XwRQvmzCEOC4QnT706q1g* e_QFaxakZ1I9a4KWif8o6ouHg_2;
		NimStringDesc* LOC13;
		e_QFaxakZ1I9a4KWif8o6ouHg_2 = (Oserror_3XwRQvmzCEOC4QnT706q1g*)0;
		e_QFaxakZ1I9a4KWif8o6ouHg_2 = (Oserror_3XwRQvmzCEOC4QnT706q1g*) nimrtl_newObj((&NTI_Qx9aKy4vZ9bVz9bnG9brQcRHGA), sizeof(Oserror_3XwRQvmzCEOC4QnT706q1g));
		(*e_QFaxakZ1I9a4KWif8o6ouHg_2).Sup.Sup.Sup.m_type = (&NTI_3XwRQvmzCEOC4QnT706q1g);
		LOC13 = (NimStringDesc*)0;
		LOC13 = (*e_QFaxakZ1I9a4KWif8o6ouHg_2).Sup.Sup.message; (*e_QFaxakZ1I9a4KWif8o6ouHg_2).Sup.Sup.message = nimrtl_copyStringRC1(msg0);
		if (LOC13) nimGCunrefNoCycle(LOC13);
		nimrtl_raiseException((Exception*)e_QFaxakZ1I9a4KWif8o6ouHg_2, "OSError");
	}
	LA1: ;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename0) {
	NIM_BOOL result0;
	struct stat res0;
	NIM_BOOL LOC1;
	int LOC2;
{	result0 = (NIM_BOOL)0;
	memset((void*)(&res0), 0, sizeof(res0));
	LOC1 = (NIM_BOOL)0;
	LOC2 = (int)0;
	LOC2 = stat(filename0->data, (&res0));
	LOC1 = (((NI32) 0) <= LOC2);
	if (!(LOC1)) goto LA3;
	LOC1 = S_ISREG(res0.st_mode);
	LA3: ;
	result0 = LOC1;
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nosexistsDir)(NimStringDesc* dir0) {
	NIM_BOOL result0;
	struct stat res0;
	NIM_BOOL LOC1;
	int LOC2;
{	result0 = (NIM_BOOL)0;
	memset((void*)(&res0), 0, sizeof(res0));
	LOC1 = (NIM_BOOL)0;
	LOC2 = (int)0;
	LOC2 = stat(dir0->data, (&res0));
	LOC1 = (((NI32) 0) <= LOC2);
	if (!(LOC1)) goto LA3;
	LOC1 = S_ISDIR(res0.st_mode);
	LA3: ;
	result0 = LOC1;
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nossymlinkExists)(NimStringDesc* link0) {
	NIM_BOOL result0;
	struct stat res0;
	NIM_BOOL LOC1;
	int LOC2;
{	result0 = (NIM_BOOL)0;
	memset((void*)(&res0), 0, sizeof(res0));
	LOC1 = (NIM_BOOL)0;
	LOC2 = (int)0;
	LOC2 = lstat(link0->data, (&res0));
	LOC1 = (((NI32) 0) <= LOC2);
	if (!(LOC1)) goto LA3;
	LOC1 = S_ISLNK(res0.st_mode);
	LA3: ;
	result0 = LOC1;
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_NIMCALL(NimStringDesc*, oserrormsg_9cO757MdTrYxfurMy5qIoAg)(NI32 errorcode0) {
	NimStringDesc* result0;
	result0 = (NimStringDesc*)0;
	result0 = nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	{
		NCSTRING LOC5;
		if (!!((errorcode0 == ((NI32) 0)))) goto LA3;
		LOC5 = (NCSTRING)0;
		LOC5 = strerror(errorcode0);
		result0 = nimrtl_cstrToNimstr(LOC5);
	}
	LA3: ;
	return result0;
}

static N_INLINE(void, asgnRefNoCycle)(void** dest0, void* src0) {
	{
		Cell_1zcF9cV8XIAtbN8h5HRUB8g* c0;
		if (!!((src0 == NIM_NIL))) goto LA3;
		c0 = usrtocell_yB9aH5WIlwd0xkYrcdPeXrQsystem(src0);
		(*c0).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Cell_1zcF9cV8XIAtbN8h5HRUB8g* c0;
		if (!!(((*dest0) == NIM_NIL))) goto LA7;
		c0 = usrtocell_yB9aH5WIlwd0xkYrcdPeXrQsystem((*dest0));
		{
			(*c0).refcount -= ((NI) 8);
			if (!((NU32)((*c0).refcount) < (NU32)(((NI) 8)))) goto LA11;
			nimrtl_rtlAddZCT(c0);
		}
		LA11: ;
	}
	LA7: ;
	(*dest0) = src0;
}

N_NOINLINE(void, raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA)(NI32 errorcode0, NimStringDesc* additionalinfo0) {
	Oserror_3XwRQvmzCEOC4QnT706q1g* e0;
	e0 = (Oserror_3XwRQvmzCEOC4QnT706q1g*)0;
	e0 = (Oserror_3XwRQvmzCEOC4QnT706q1g*) nimrtl_newObj((&NTI_Qx9aKy4vZ9bVz9bnG9brQcRHGA), sizeof(Oserror_3XwRQvmzCEOC4QnT706q1g));
	(*e0).Sup.Sup.Sup.m_type = (&NTI_3XwRQvmzCEOC4QnT706q1g);
	(*e0).errorcode = errorcode0;
	{
		if (!((additionalinfo0 ? additionalinfo0->Sup.len : 0) == ((NI) 0))) goto LA3;
		asgnRefNoCycle((void**) (&(*e0).Sup.Sup.message), oserrormsg_9cO757MdTrYxfurMy5qIoAg(errorcode0));
	}
	goto LA1;
	LA3: ;
	{
		NimStringDesc* LOC6;
		NimStringDesc* LOC7;
		LOC6 = (NimStringDesc*)0;
		LOC7 = (NimStringDesc*)0;
		LOC7 = oserrormsg_9cO757MdTrYxfurMy5qIoAg(errorcode0);
		LOC6 = rawNewString(LOC7->Sup.len + additionalinfo0->Sup.len + 18);
appendString(LOC6, LOC7);
appendString(LOC6, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_4));
appendString(LOC6, additionalinfo0);
		asgnRefNoCycle((void**) (&(*e0).Sup.Sup.message), LOC6);
	}
	LA1: ;
	{
		NimStringDesc* LOC12;
		if (!(((*e0).Sup.Sup.message) && ((*e0).Sup.Sup.message)->Sup.len == 0)) goto LA10;
		LOC12 = (NimStringDesc*)0;
		LOC12 = (*e0).Sup.Sup.message; (*e0).Sup.Sup.message = nimrtl_copyStringRC1(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_3));
		if (LOC12) nimGCunrefNoCycle(LOC12);
	}
	LA10: ;
	nimrtl_raiseException((Exception*)e0, "OSError");
}

N_NIMCALL(NI32, oslasterror_pMOMIZAQaKFp1XoL58mjVg)(void) {
	NI32 result0;
	result0 = (NI32)0;
	result0 = errno;
	return result0;
}

N_LIB_EXPORT N_CDECL(time_t, nosgetLastModificationTime)(NimStringDesc* file0) {
	time_t result0;
	struct stat res0;
{	result0 = (time_t)0;
	memset((void*)(&res0), 0, sizeof(res0));
	{
		int LOC3;
		NI32 LOC6;
		LOC3 = (int)0;
		LOC3 = stat(file0->data, (&res0));
		if (!(LOC3 < ((NI32) 0))) goto LA4;
		LOC6 = (NI32)0;
		LOC6 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC6, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4: ;
	result0 = res0.st_mtime;
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(time_t, nosgetLastAccessTime)(NimStringDesc* file0) {
	time_t result0;
	struct stat res0;
{	result0 = (time_t)0;
	memset((void*)(&res0), 0, sizeof(res0));
	{
		int LOC3;
		NI32 LOC6;
		LOC3 = (int)0;
		LOC3 = stat(file0->data, (&res0));
		if (!(LOC3 < ((NI32) 0))) goto LA4;
		LOC6 = (NI32)0;
		LOC6 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC6, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4: ;
	result0 = res0.st_atime;
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(time_t, nosgetCreationTime)(NimStringDesc* file0) {
	time_t result0;
	struct stat res0;
{	result0 = (time_t)0;
	memset((void*)(&res0), 0, sizeof(res0));
	{
		int LOC3;
		NI32 LOC6;
		LOC3 = (int)0;
		LOC3 = stat(file0->data, (&res0));
		if (!(LOC3 < ((NI32) 0))) goto LA4;
		LOC6 = (NI32)0;
		LOC6 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC6, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4: ;
	result0 = res0.st_ctime;
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nosfileNewer)(NimStringDesc* a0, NimStringDesc* b0) {
	NIM_BOOL result0;
	time_t LOC1;
	time_t LOC2;
	NI64 LOC3;
	result0 = (NIM_BOOL)0;
	LOC1 = (time_t)0;
	LOC1 = nosgetLastModificationTime(a0);
	LOC2 = (time_t)0;
	LOC2 = nosgetLastModificationTime(b0);
	LOC3 = (NI64)0;
	LOC3 = ntDiffTime(LOC1, LOC2);
	result0 = (IL64(0) <= LOC3);
	return result0;
}

static N_INLINE(NIM_BOOL, HEX3DHEX3D_9ccNWqrTIE9bcAqE2Q0ro7zgos)(NCSTRING x0, NCSTRING y0) {
	NIM_BOOL result0;
	result0 = (NIM_BOOL)0;
	{
		if (!(((void*) (x0)) == ((void*) (y0)))) goto LA3;
		result0 = NIM_TRUE;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = (NIM_BOOL)0;
		LOC6 = (x0 == 0);
		if (LOC6) goto LA7;
		LOC6 = (y0 == 0);
		LA7: ;
		if (!LOC6) goto LA8;
		result0 = NIM_FALSE;
	}
	goto LA1;
	LA8: ;
	{
		int LOC11;
		LOC11 = (int)0;
		LOC11 = strcmp(x0, y0);
		result0 = (LOC11 == ((NI32) 0));
	}
	LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetCurrentDir)(void) {
	NimStringDesc* result0;
	NI bufsize0;
	result0 = (NimStringDesc*)0;
	bufsize0 = ((NI) 1024);
	result0 = mnewString(((NI) (bufsize0)));
	{
		while (1) {
			{
				NCSTRING LOC5;
				NIM_BOOL LOC6;
				int LOC9;
				LOC5 = (NCSTRING)0;
				LOC5 = getcwd(result0->data, bufsize0);
				LOC6 = (NIM_BOOL)0;
				LOC6 = HEX3DHEX3D_9ccNWqrTIE9bcAqE2Q0ro7zgos(LOC5, NIM_NIL);
				if (!!(LOC6)) goto LA7;
				LOC9 = (int)0;
				LOC9 = strlen(result0->data);
				result0 = nimrtl_setLengthStr(result0, ((NI) (LOC9)));
				goto LA1;
			}
			goto LA3;
			LA7: ;
			{
				NI32 err0;
				err0 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
				{
					if (!(err0 == ERANGE)) goto LA13;
					bufsize0 = (NI)((NU32)(bufsize0) << (NU32)(((NI) 1)));
					{
						if (!!((((NI) 0) <= bufsize0))) goto LA17;
						raiseassert_PpfSiTIeNpMAb9a5o6SglJw(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_5));
					}
					LA17: ;
					result0 = mnewString(((NI) (bufsize0)));
				}
				goto LA11;
				LA13: ;
				{
					NI32 LOC20;
					LOC20 = (NI32)0;
					LOC20 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
					raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC20, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
				}
				LA11: ;
			}
			LA3: ;
		}
	} LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosexpandFilename)(NimStringDesc* filename0) {
	NimStringDesc* result0;
	NCSTRING r0;
	result0 = (NimStringDesc*)0;
	r0 = realpath(filename0->data, NIM_NIL);
	{
		NI32 LOC5;
		if (!(r0 == 0)) goto LA3;
		LOC5 = (NI32)0;
		LOC5 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC5, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	goto LA1;
	LA3: ;
	{
		result0 = nimrtl_cstrToNimstr(r0);
		free(((void*) (r0)));
	}
	LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nossameFile)(NimStringDesc* path10, NimStringDesc* path20) {
	NIM_BOOL result0;
	struct stat a0;
	struct stat b0;
	result0 = (NIM_BOOL)0;
	memset((void*)(&a0), 0, sizeof(a0));
	memset((void*)(&b0), 0, sizeof(b0));
	{
		NIM_BOOL LOC3;
		int LOC4;
		int LOC6;
		NI32 LOC9;
		LOC3 = (NIM_BOOL)0;
		LOC4 = (int)0;
		LOC4 = stat(path10->data, (&a0));
		LOC3 = (LOC4 < ((NI32) 0));
		if (LOC3) goto LA5;
		LOC6 = (int)0;
		LOC6 = stat(path20->data, (&b0));
		LOC3 = (LOC6 < ((NI32) 0));
		LA5: ;
		if (!LOC3) goto LA7;
		LOC9 = (NI32)0;
		LOC9 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC9, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	goto LA1;
	LA7: ;
	{
		NIM_BOOL LOC11;
		LOC11 = (NIM_BOOL)0;
		LOC11 = (a0.st_dev == b0.st_dev);
		if (!(LOC11)) goto LA12;
		LOC11 = (a0.st_ino == b0.st_ino);
		LA12: ;
		result0 = LOC11;
	}
	LA1: ;
	return result0;
}

static N_INLINE(NIM_BOOL, equalmem_DCrUjdaMvFDHaR1hs7sQGwstrutils)(void* a0, void* b0, NI size0) {
	NIM_BOOL result0;
	int LOC1;
	result0 = (NIM_BOOL)0;
	LOC1 = (int)0;
	LOC1 = memcmp(a0, b0, ((size_t) (size0)));
	result0 = (LOC1 == ((NI32) 0));
	return result0;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nossameFileContent)(NimStringDesc* path10, NimStringDesc* path20) {
	NIM_BOOL result0;
	FILE* a0;
	FILE* b0;
	void* bufa0;
	void* bufb0;
{	result0 = (NIM_BOOL)0;
	a0 = (FILE*)0;
	b0 = (FILE*)0;
	{
		NIM_BOOL LOC3;
		LOC3 = (NIM_BOOL)0;
		LOC3 = open_sEp0GH2306oGo9bqBpj5oTQ(&a0, path10, ((Filemode_fVUBHvW79bXUw1j55Oo9avSQ) 0), ((NI) -1));
		if (!!(LOC3)) goto LA4;
		result0 = NIM_FALSE;
		goto BeforeRet;
	}
	LA4: ;
	{
		NIM_BOOL LOC8;
		LOC8 = (NIM_BOOL)0;
		LOC8 = open_sEp0GH2306oGo9bqBpj5oTQ(&b0, path20, ((Filemode_fVUBHvW79bXUw1j55Oo9avSQ) 0), ((NI) -1));
		if (!!(LOC8)) goto LA9;
		close_BWnr8V7RERYno9bIdPmw8Hw(a0);
		result0 = NIM_FALSE;
		goto BeforeRet;
	}
	LA9: ;
	bufa0 = nimrtl_alloc(((NI) 8192));
	bufb0 = nimrtl_alloc(((NI) 8192));
	{
		while (1) {
			NI reada0;
			NI readb0;
			reada0 = readbuffer_nZ0pNe9cd9cXtoayexCiaDtA(a0, bufa0, ((NI) 8192));
			readb0 = readbuffer_nZ0pNe9cd9cXtoayexCiaDtA(b0, bufb0, ((NI) 8192));
			{
				if (!!((reada0 == readb0))) goto LA15;
				result0 = NIM_FALSE;
				goto LA11;
			}
			LA15: ;
			{
				if (!(reada0 == ((NI) 0))) goto LA19;
				result0 = NIM_TRUE;
				goto LA11;
			}
			LA19: ;
			result0 = equalmem_DCrUjdaMvFDHaR1hs7sQGwstrutils(bufa0, bufb0, ((NI) (reada0)));
			{
				if (!!(result0)) goto LA23;
				goto LA11;
			}
			LA23: ;
			{
				if (!!((reada0 == ((NI) 8192)))) goto LA27;
				goto LA11;
			}
			LA27: ;
		}
	} LA11: ;
	nimrtl_dealloc(bufa0);
	nimrtl_dealloc(bufb0);
	close_BWnr8V7RERYno9bIdPmw8Hw(a0);
	close_BWnr8V7RERYno9bIdPmw8Hw(b0);
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set, nosgetFilePermissions)(NimStringDesc* filename0) {
	Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set result0;
	struct stat a0;
	memset((void*)(&result0), 0, sizeof(result0));
	memset((void*)(&a0), 0, sizeof(a0));
	{
		int LOC3;
		NI32 LOC6;
		LOC3 = (int)0;
		LOC3 = stat(filename0->data, (&a0));
		if (!(LOC3 < ((NI32) 0))) goto LA4;
		LOC6 = (NI32)0;
		LOC6 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC6, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4: ;
	result0 = 0;
	{
		if (!!(((NI32)(a0.st_mode & S_IRUSR) == ((NI32) 0)))) goto LA9;
		result0 |= ((NU16)1)<<((((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 2))%(sizeof(NU16)*8));
	}
	LA9: ;
	{
		if (!!(((NI32)(a0.st_mode & S_IWUSR) == ((NI32) 0)))) goto LA13;
		result0 |= ((NU16)1)<<((((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 1))%(sizeof(NU16)*8));
	}
	LA13: ;
	{
		if (!!(((NI32)(a0.st_mode & S_IXUSR) == ((NI32) 0)))) goto LA17;
		result0 |= ((NU16)1)<<((((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 0))%(sizeof(NU16)*8));
	}
	LA17: ;
	{
		if (!!(((NI32)(a0.st_mode & S_IRGRP) == ((NI32) 0)))) goto LA21;
		result0 |= ((NU16)1)<<((((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 5))%(sizeof(NU16)*8));
	}
	LA21: ;
	{
		if (!!(((NI32)(a0.st_mode & S_IWGRP) == ((NI32) 0)))) goto LA25;
		result0 |= ((NU16)1)<<((((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 4))%(sizeof(NU16)*8));
	}
	LA25: ;
	{
		if (!!(((NI32)(a0.st_mode & S_IXGRP) == ((NI32) 0)))) goto LA29;
		result0 |= ((NU16)1)<<((((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 3))%(sizeof(NU16)*8));
	}
	LA29: ;
	{
		if (!!(((NI32)(a0.st_mode & S_IROTH) == ((NI32) 0)))) goto LA33;
		result0 |= ((NU16)1)<<((((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 8))%(sizeof(NU16)*8));
	}
	LA33: ;
	{
		if (!!(((NI32)(a0.st_mode & S_IWOTH) == ((NI32) 0)))) goto LA37;
		result0 |= ((NU16)1)<<((((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 7))%(sizeof(NU16)*8));
	}
	LA37: ;
	{
		if (!!(((NI32)(a0.st_mode & S_IXOTH) == ((NI32) 0)))) goto LA41;
		result0 |= ((NU16)1)<<((((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 6))%(sizeof(NU16)*8));
	}
	LA41: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(void, nossetFilePermissions)(NimStringDesc* filename0, Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions0) {
	NI32 p0;
	p0 = ((NI32) 0);
	{
		if (!((permissions0 &(1U<<((NU)(((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 2))&15U)))!=0)) goto LA3;
		p0 = (NI32)(p0 | S_IRUSR);
	}
	LA3: ;
	{
		if (!((permissions0 &(1U<<((NU)(((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 1))&15U)))!=0)) goto LA7;
		p0 = (NI32)(p0 | S_IWUSR);
	}
	LA7: ;
	{
		if (!((permissions0 &(1U<<((NU)(((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 0))&15U)))!=0)) goto LA11;
		p0 = (NI32)(p0 | S_IXUSR);
	}
	LA11: ;
	{
		if (!((permissions0 &(1U<<((NU)(((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 5))&15U)))!=0)) goto LA15;
		p0 = (NI32)(p0 | S_IRGRP);
	}
	LA15: ;
	{
		if (!((permissions0 &(1U<<((NU)(((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 4))&15U)))!=0)) goto LA19;
		p0 = (NI32)(p0 | S_IWGRP);
	}
	LA19: ;
	{
		if (!((permissions0 &(1U<<((NU)(((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 3))&15U)))!=0)) goto LA23;
		p0 = (NI32)(p0 | S_IXGRP);
	}
	LA23: ;
	{
		if (!((permissions0 &(1U<<((NU)(((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 8))&15U)))!=0)) goto LA27;
		p0 = (NI32)(p0 | S_IROTH);
	}
	LA27: ;
	{
		if (!((permissions0 &(1U<<((NU)(((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 7))&15U)))!=0)) goto LA31;
		p0 = (NI32)(p0 | S_IWOTH);
	}
	LA31: ;
	{
		if (!((permissions0 &(1U<<((NU)(((Filepermission_uTVeDpjCH6aWw9c74YkAskA) 6))&15U)))!=0)) goto LA35;
		p0 = (NI32)(p0 | S_IXOTH);
	}
	LA35: ;
	{
		int LOC39;
		NI32 LOC42;
		LOC39 = (int)0;
		LOC39 = chmod(filename0->data, p0);
		if (!!((LOC39 == ((NI32) 0)))) goto LA40;
		LOC42 = (NI32)0;
		LOC42 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC42, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA40: ;
}

N_LIB_EXPORT N_CDECL(void, noscopyFile)(NimStringDesc* source0, NimStringDesc* dest0) {
	FILE* d0;
	FILE* s0;
	void* buf0;
	d0 = (FILE*)0;
	s0 = (FILE*)0;
	{
		NIM_BOOL LOC3;
		NI32 LOC6;
		LOC3 = (NIM_BOOL)0;
		LOC3 = open_sEp0GH2306oGo9bqBpj5oTQ(&s0, source0, ((Filemode_fVUBHvW79bXUw1j55Oo9avSQ) 0), ((NI) -1));
		if (!!(LOC3)) goto LA4;
		LOC6 = (NI32)0;
		LOC6 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC6, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4: ;
	{
		NIM_BOOL LOC9;
		NI32 LOC12;
		LOC9 = (NIM_BOOL)0;
		LOC9 = open_sEp0GH2306oGo9bqBpj5oTQ(&d0, dest0, ((Filemode_fVUBHvW79bXUw1j55Oo9avSQ) 1), ((NI) -1));
		if (!!(LOC9)) goto LA10;
		close_BWnr8V7RERYno9bIdPmw8Hw(s0);
		LOC12 = (NI32)0;
		LOC12 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC12, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA10: ;
	buf0 = nimrtl_alloc(((NI) 8000));
	{
		while (1) {
			NI bytesread0;
			bytesread0 = readbuffer_nZ0pNe9cd9cXtoayexCiaDtA(s0, buf0, ((NI) 8000));
			{
				NI byteswritten0;
				if (!(((NI) 0) < bytesread0)) goto LA17;
				byteswritten0 = writebuffer_nZ0pNe9cd9cXtoayexCiaDtA_2(d0, buf0, ((NI) (bytesread0)));
				{
					NI32 LOC23;
					if (!!((bytesread0 == byteswritten0))) goto LA21;
					nimrtl_dealloc(buf0);
					close_BWnr8V7RERYno9bIdPmw8Hw(s0);
					close_BWnr8V7RERYno9bIdPmw8Hw(d0);
					LOC23 = (NI32)0;
					LOC23 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
					raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC23, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
				}
				LA21: ;
			}
			LA17: ;
			{
				if (!!((bytesread0 == ((NI) 8000)))) goto LA26;
				goto LA13;
			}
			LA26: ;
		}
	} LA13: ;
	nimrtl_dealloc(buf0);
	close_BWnr8V7RERYno9bIdPmw8Hw(s0);
	flushfile_BWnr8V7RERYno9bIdPmw8Hw_2(d0);
	close_BWnr8V7RERYno9bIdPmw8Hw(d0);
}

N_LIB_EXPORT N_CDECL(void, nosmoveFile)(NimStringDesc* source0, NimStringDesc* dest0) {
	{
		int LOC3;
		NI32 LOC6;
		NCSTRING LOC7;
		NimStringDesc* LOC8;
		LOC3 = (int)0;
		LOC3 = rename(source0->data, dest0->data);
		if (!!((LOC3 == ((NI32) 0)))) goto LA4;
		LOC6 = (NI32)0;
		LOC6 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		LOC7 = (NCSTRING)0;
		LOC7 = strerror(errno);
		LOC8 = (NimStringDesc*)0;
		LOC8 = nimrtl_cstrToNimstr(LOC7);
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC6, LOC8);
	}
	LA4: ;
}

N_LIB_EXPORT N_CDECL(void, nosremoveFile)(NimStringDesc* file0) {
	{
		NIM_BOOL LOC3;
		int LOC4;
		NI32 LOC8;
		NCSTRING LOC9;
		NimStringDesc* LOC10;
		LOC3 = (NIM_BOOL)0;
		LOC4 = (int)0;
		LOC4 = remove(file0->data);
		LOC3 = !((LOC4 == ((NI32) 0)));
		if (!(LOC3)) goto LA5;
		LOC3 = !((errno == ENOENT));
		LA5: ;
		if (!LOC3) goto LA6;
		LOC8 = (NI32)0;
		LOC8 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		LOC9 = (NCSTRING)0;
		LOC9 = strerror(errno);
		LOC10 = (NimStringDesc*)0;
		LOC10 = nimrtl_cstrToNimstr(LOC9);
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC8, LOC10);
	}
	LA6: ;
}

N_LIB_EXPORT N_CDECL(NI, nosexecShellCmd)(NimStringDesc* command0) {
	NI result0;
	int LOC1;
	result0 = (NI)0;
	LOC1 = (int)0;
	LOC1 = system(command0->data);
	result0 = ((NI) ((NI32)((NU32)(LOC1) >> (NU32)(((NI) 8)))));
	return result0;
}
static N_NIMCALL(void, T_yu6cxgKBBXbNsTkT9cyMd4g_6)(void) {
	nimrtl_nimGCvisit((void*)environment_mlhK49b6YMgc9cgrcYkKq9a3g, 0);
}

static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a0, NimStringDesc* b0) {
	NIM_BOOL result0;
	NIM_BOOL LOC11;
{	result0 = (NIM_BOOL)0;
	{
		if (!(a0 == b0)) goto LA3;
		result0 = NIM_TRUE;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = (NIM_BOOL)0;
		LOC7 = (a0 == NIM_NIL);
		if (LOC7) goto LA8;
		LOC7 = (b0 == NIM_NIL);
		LA8: ;
		if (!LOC7) goto LA9;
		result0 = NIM_FALSE;
		goto BeforeRet;
	}
	LA9: ;
	LOC11 = (NIM_BOOL)0;
	LOC11 = ((*a0).Sup.len == (*b0).Sup.len);
	if (!(LOC11)) goto LA12;
	LOC11 = equalmem_DCrUjdaMvFDHaR1hs7sQGwstrutils(((void*) ((*a0).data)), ((void*) ((*b0).data)), ((NI) ((*a0).Sup.len)));
	LA12: ;
	result0 = LOC11;
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_NIMCALL(NimStringDesc*, HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ)(NimStringDesc* head0, NimStringDesc* tail0) {
	NimStringDesc* result0;
{	result0 = (NimStringDesc*)0;
	result0 = nosjoinPath(head0, tail0);
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

static N_INLINE(NIM_BOOL, direxists_wf0Ae3eLXw0lSNEFJMV3ogos)(NimStringDesc* dir0) {
	NIM_BOOL result0;
	result0 = (NIM_BOOL)0;
	result0 = nosexistsDir(dir0);
	return result0;
}

N_NIMCALL(Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg, getsymlinkfilekind_WoXOp8qmMec1P4MyA3LBKg)(NimStringDesc* path0) {
	Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg result0;
	struct stat s0;
	result0 = (Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg)0;
	memset((void*)(&s0), 0, sizeof(s0));
	{
		int LOC3;
		NI32 LOC6;
		LOC3 = (int)0;
		LOC3 = stat(path0->data, (&s0));
		if (!(LOC3 < ((NI32) 0))) goto LA4;
		LOC6 = (NI32)0;
		LOC6 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC6, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA4: ;
	{
		NIM_BOOL LOC9;
		LOC9 = (NIM_BOOL)0;
		LOC9 = S_ISDIR(s0.st_mode);
		if (!LOC9) goto LA10;
		result0 = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 3);
	}
	goto LA7;
	LA10: ;
	{
		result0 = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 1);
	}
	LA7: ;
	return result0;
}

N_NIMCALL(void, rawremovedir_P9aOuM3pg25yKqgBUm7qKng)(NimStringDesc* dir0) {
	{
		NIM_BOOL LOC3;
		int LOC4;
		NI32 LOC8;
		LOC3 = (NIM_BOOL)0;
		LOC4 = (int)0;
		LOC4 = rmdir(dir0->data);
		LOC3 = !((LOC4 == ((NI32) 0)));
		if (!(LOC3)) goto LA5;
		LOC3 = !((errno == ENOENT));
		LA5: ;
		if (!LOC3) goto LA6;
		LOC8 = (NI32)0;
		LOC8 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC8, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA6: ;
}

N_LIB_EXPORT N_CDECL(void, nosremoveDir)(NimStringDesc* dir0) {
	{
		Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg kind_CgYWYOGBi9cm9cxet9aP24amQ;
		NimStringDesc* path_PjxD5WVfFUdiLYTKKL9acYg;
		DIR* d_Snew50d2sxhgjxplaladWA;
		kind_CgYWYOGBi9cm9cxet9aP24amQ = (Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg)0;
		path_PjxD5WVfFUdiLYTKKL9acYg = (NimStringDesc*)0;
		d_Snew50d2sxhgjxplaladWA = opendir(dir0->data);
		{
			TSafePoint T_yu6cxgKBBXbNsTkT9cyMd4g_7;
			if (!!((d_Snew50d2sxhgjxplaladWA == NIM_NIL))) goto LA4;
			nimrtl_pushSafePoint(&T_yu6cxgKBBXbNsTkT9cyMd4g_7);
			T_yu6cxgKBBXbNsTkT9cyMd4g_7.status = setjmp(T_yu6cxgKBBXbNsTkT9cyMd4g_7.context);
			if (T_yu6cxgKBBXbNsTkT9cyMd4g_7.status == 0) {
				{
					while (1) {
						{
							struct dirent* x_aQYTEBuHrMi9cGfwwrddjfg;
							NimStringDesc* volatile y_nqt04gTLPSvk7lCmOg2cqg;
							x_aQYTEBuHrMi9cGfwwrddjfg = readdir(d_Snew50d2sxhgjxplaladWA);
							{
								if (!(x_aQYTEBuHrMi9cGfwwrddjfg == NIM_NIL)) goto LA12;
								goto LA7;
							}
							LA12: ;
							y_nqt04gTLPSvk7lCmOg2cqg = nimrtl_cstrToNimstr(((NCSTRING) ((*x_aQYTEBuHrMi9cGfwwrddjfg).d_name)));
							{
								NIM_BOOL LOC16;
								struct stat s_9bKnK2sM9am7zFpvRgFLncWA;
								Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg volatile k_3L6up3asmYrsS0W9b26IJmg;
								LOC16 = (NIM_BOOL)0;
								LOC16 = !(eqStrings(y_nqt04gTLPSvk7lCmOg2cqg, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_8)));
								if (!(LOC16)) goto LA17;
								LOC16 = !(eqStrings(y_nqt04gTLPSvk7lCmOg2cqg, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_9)));
								LA17: ;
								if (!LOC16) goto LA18;
								memset((void*)(&s_9bKnK2sM9am7zFpvRgFLncWA), 0, sizeof(s_9bKnK2sM9am7zFpvRgFLncWA));
								{
									if (!NIM_TRUE) goto LA22;
									y_nqt04gTLPSvk7lCmOg2cqg = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(dir0, y_nqt04gTLPSvk7lCmOg2cqg);
								}
								LA22: ;
								k_3L6up3asmYrsS0W9b26IJmg = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 0);
								{
									if (!!(((*x_aQYTEBuHrMi9cGfwwrddjfg).d_type == ((NI8) 0)))) goto LA26;
									{
										if (!((*x_aQYTEBuHrMi9cGfwwrddjfg).d_type == ((NI8) 4))) goto LA30;
										k_3L6up3asmYrsS0W9b26IJmg = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
									}
									LA30: ;
									{
										if (!((*x_aQYTEBuHrMi9cGfwwrddjfg).d_type == ((NI8) 10))) goto LA34;
										{
											NIM_BOOL LOC38;
											LOC38 = (NIM_BOOL)0;
											LOC38 = direxists_wf0Ae3eLXw0lSNEFJMV3ogos(y_nqt04gTLPSvk7lCmOg2cqg);
											if (!LOC38) goto LA39;
											k_3L6up3asmYrsS0W9b26IJmg = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 3);
										}
										goto LA36;
										LA39: ;
										{
											k_3L6up3asmYrsS0W9b26IJmg = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 1);
										}
										LA36: ;
									}
									LA34: ;
									kind_CgYWYOGBi9cm9cxet9aP24amQ = k_3L6up3asmYrsS0W9b26IJmg;
									path_PjxD5WVfFUdiLYTKKL9acYg = y_nqt04gTLPSvk7lCmOg2cqg;
									switch (kind_CgYWYOGBi9cm9cxet9aP24amQ) {
									case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
									case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 1):
									case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 3):
									{
										nosremoveFile(path_PjxD5WVfFUdiLYTKKL9acYg);
									}
									break;
									case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
									{
										nosremoveDir(path_PjxD5WVfFUdiLYTKKL9acYg);
									}
									break;
									}
									goto LA9;
								}
								LA26: ;
								{
									int LOC46;
									LOC46 = (int)0;
									LOC46 = lstat(y_nqt04gTLPSvk7lCmOg2cqg->data, (&s_9bKnK2sM9am7zFpvRgFLncWA));
									if (!(LOC46 < ((NI32) 0))) goto LA47;
									goto LA7;
								}
								LA47: ;
								{
									NIM_BOOL LOC51;
									LOC51 = (NIM_BOOL)0;
									LOC51 = S_ISDIR(s_9bKnK2sM9am7zFpvRgFLncWA.st_mode);
									if (!LOC51) goto LA52;
									k_3L6up3asmYrsS0W9b26IJmg = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
								}
								goto LA49;
								LA52: ;
								{
									NIM_BOOL LOC55;
									LOC55 = (NIM_BOOL)0;
									LOC55 = S_ISLNK(s_9bKnK2sM9am7zFpvRgFLncWA.st_mode);
									if (!LOC55) goto LA56;
									k_3L6up3asmYrsS0W9b26IJmg = getsymlinkfilekind_WoXOp8qmMec1P4MyA3LBKg(y_nqt04gTLPSvk7lCmOg2cqg);
								}
								goto LA49;
								LA56: ;
								LA49: ;
								kind_CgYWYOGBi9cm9cxet9aP24amQ = k_3L6up3asmYrsS0W9b26IJmg;
								path_PjxD5WVfFUdiLYTKKL9acYg = y_nqt04gTLPSvk7lCmOg2cqg;
								switch (kind_CgYWYOGBi9cm9cxet9aP24amQ) {
								case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
								case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 1):
								case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 3):
								{
									nosremoveFile(path_PjxD5WVfFUdiLYTKKL9acYg);
								}
								break;
								case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
								{
									nosremoveDir(path_PjxD5WVfFUdiLYTKKL9acYg);
								}
								break;
								}
							}
							LA18: ;
						} LA9: ;
					}
				} LA7: ;
				nimrtl_popSafePoint();
			}
			else {
				nimrtl_popSafePoint();
			}
			{
				int LOC62;
				LOC62 = (int)0;
				LOC62 = closedir(d_Snew50d2sxhgjxplaladWA);
			}
			if (T_yu6cxgKBBXbNsTkT9cyMd4g_7.status != 0) nimrtl_reraiseException();
		}
		LA4: ;
	}
	rawremovedir_P9aOuM3pg25yKqgBUm7qKng(dir0);
}

N_NIMCALL(NIM_BOOL, rawcreatedir_V86QyZrcGMPX0W9bv1Q53ww_2)(NimStringDesc* dir0) {
	NIM_BOOL result0;
	int res0;
	result0 = (NIM_BOOL)0;
	res0 = mkdir(dir0->data, ((mode_t) 511));
	{
		if (!(res0 == ((NI32) 0))) goto LA3;
		result0 = NIM_TRUE;
	}
	goto LA1;
	LA3: ;
	{
		if (!(errno == EEXIST)) goto LA6;
		result0 = NIM_FALSE;
	}
	goto LA1;
	LA6: ;
	{
		NimStringDesc* LOC9;
		NI32 LOC10;
		LOC9 = (NimStringDesc*)0;
		LOC9 = nimrtl_nimIntToStr(((NI) (res0)));
		printf("%s\012", LOC9? (LOC9)->data:"nil");
		fflush(stdout);
		LOC10 = (NI32)0;
		LOC10 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC10, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA1: ;
	return result0;
}

N_NIMCALL(NIM_BOOL, existsorcreatedir_V86QyZrcGMPX0W9bv1Q53ww)(NimStringDesc* dir0) {
	NIM_BOOL result0;
	NIM_BOOL LOC1;
	result0 = (NIM_BOOL)0;
	LOC1 = (NIM_BOOL)0;
	LOC1 = rawcreatedir_V86QyZrcGMPX0W9bv1Q53ww_2(dir0);
	result0 = !(LOC1);
	{
		if (!result0) goto LA4;
		{
			NIM_BOOL LOC8;
			Ioerror_9czoZw3pzPyrBmb5zTHY1OQ* e_4he5nelRQAcl1XtPfaowrQ;
			NimStringDesc* LOC11;
			LOC8 = (NIM_BOOL)0;
			LOC8 = nosexistsDir(dir0);
			if (!!(LOC8)) goto LA9;
			e_4he5nelRQAcl1XtPfaowrQ = (Ioerror_9czoZw3pzPyrBmb5zTHY1OQ*)0;
			e_4he5nelRQAcl1XtPfaowrQ = (Ioerror_9czoZw3pzPyrBmb5zTHY1OQ*) nimrtl_newObj((&NTI_HX2M9cQhE3jaovp9aYJDdslA), sizeof(Ioerror_9czoZw3pzPyrBmb5zTHY1OQ));
			(*e_4he5nelRQAcl1XtPfaowrQ).Sup.Sup.Sup.m_type = (&NTI_9czoZw3pzPyrBmb5zTHY1OQ);
			LOC11 = (NimStringDesc*)0;
			LOC11 = (*e_4he5nelRQAcl1XtPfaowrQ).Sup.Sup.message; (*e_4he5nelRQAcl1XtPfaowrQ).Sup.Sup.message = nimrtl_copyStringRC1(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_10));
			if (LOC11) nimGCunrefNoCycle(LOC11);
			nimrtl_raiseException((Exception*)e_4he5nelRQAcl1XtPfaowrQ, "IOError");
		}
		LA9: ;
	}
	LA4: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(void, noscreateDir)(NimStringDesc* dir0) {
	NIM_BOOL omitnext0;
	omitnext0 = NIM_FALSE;
	{
		NI i_Qc01IR3dOH3flfNCE6VLpw;
		NI HEX3Atmp_ywziRWYrreLWHtJ4hoirLA;
		NI res_9bWCBWZ3aqeaop9bwMLK1Y7A;
		i_Qc01IR3dOH3flfNCE6VLpw = (NI)0;
		HEX3Atmp_ywziRWYrreLWHtJ4hoirLA = (NI)0;
		HEX3Atmp_ywziRWYrreLWHtJ4hoirLA = (NI)((dir0 ? dir0->Sup.len : 0) - ((NI) 1));
		res_9bWCBWZ3aqeaop9bwMLK1Y7A = ((NI) 1);
		{
			while (1) {
				if (!(res_9bWCBWZ3aqeaop9bwMLK1Y7A <= HEX3Atmp_ywziRWYrreLWHtJ4hoirLA)) goto LA3;
				i_Qc01IR3dOH3flfNCE6VLpw = res_9bWCBWZ3aqeaop9bwMLK1Y7A;
				{
					if (!(((NU8)(dir0->data[i_Qc01IR3dOH3flfNCE6VLpw])) == ((NU8)(47)) || ((NU8)(dir0->data[i_Qc01IR3dOH3flfNCE6VLpw])) == ((NU8)(47)))) goto LA6;
					{
						if (!omitnext0) goto LA10;
						omitnext0 = NIM_FALSE;
					}
					goto LA8;
					LA10: ;
					{
						NimStringDesc* LOC13;
						NIM_BOOL LOC14;
						LOC13 = (NimStringDesc*)0;
						LOC13 = copyStrLast(dir0, ((NI) 0), (NI)(i_Qc01IR3dOH3flfNCE6VLpw - ((NI) 1)));
						LOC14 = (NIM_BOOL)0;
						LOC14 = existsorcreatedir_V86QyZrcGMPX0W9bv1Q53ww(LOC13);
					}
					LA8: ;
				}
				LA6: ;
				res_9bWCBWZ3aqeaop9bwMLK1Y7A += ((NI) 1);
			} LA3: ;
		}
	}
	{
		NIM_BOOL LOC17;
		NIM_BOOL LOC18;
		NIM_BOOL LOC23;
		LOC17 = (NIM_BOOL)0;
		LOC18 = (NIM_BOOL)0;
		LOC18 = (((NI) 0) < (dir0 ? dir0->Sup.len : 0));
		if (!(LOC18)) goto LA19;
		LOC18 = !(omitnext0);
		LA19: ;
		LOC17 = LOC18;
		if (!(LOC17)) goto LA20;
		LOC17 = !((((NU8)(dir0->data[(NI)((dir0 ? dir0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(dir0->data[(NI)((dir0 ? dir0->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47))));
		LA20: ;
		if (!LOC17) goto LA21;
		LOC23 = (NIM_BOOL)0;
		LOC23 = existsorcreatedir_V86QyZrcGMPX0W9bv1Q53ww(dir0);
	}
	LA21: ;
}

N_LIB_EXPORT N_CDECL(void, noscopyDir)(NimStringDesc* source0, NimStringDesc* dest0) {
	noscreateDir(dest0);
	{
		Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg kind_gd2y49bK85jLehwsTMQuB4A;
		NimStringDesc* path_9c7AzyvKcyE3R8aoYoit8GA;
		DIR* d_4MPlW3lbXy4ds0e5pfkArw;
		kind_gd2y49bK85jLehwsTMQuB4A = (Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg)0;
		path_9c7AzyvKcyE3R8aoYoit8GA = (NimStringDesc*)0;
		d_4MPlW3lbXy4ds0e5pfkArw = opendir(source0->data);
		{
			TSafePoint T_yu6cxgKBBXbNsTkT9cyMd4g_11;
			if (!!((d_4MPlW3lbXy4ds0e5pfkArw == NIM_NIL))) goto LA4;
			nimrtl_pushSafePoint(&T_yu6cxgKBBXbNsTkT9cyMd4g_11);
			T_yu6cxgKBBXbNsTkT9cyMd4g_11.status = setjmp(T_yu6cxgKBBXbNsTkT9cyMd4g_11.context);
			if (T_yu6cxgKBBXbNsTkT9cyMd4g_11.status == 0) {
				{
					while (1) {
						{
							struct dirent* x_It69c26KPHDCcNHZrKwJQKg;
							NimStringDesc* volatile y_YFMhiTF5nHv8ChASxf9clIg;
							x_It69c26KPHDCcNHZrKwJQKg = readdir(d_4MPlW3lbXy4ds0e5pfkArw);
							{
								if (!(x_It69c26KPHDCcNHZrKwJQKg == NIM_NIL)) goto LA12;
								goto LA7;
							}
							LA12: ;
							y_YFMhiTF5nHv8ChASxf9clIg = nimrtl_cstrToNimstr(((NCSTRING) ((*x_It69c26KPHDCcNHZrKwJQKg).d_name)));
							{
								NIM_BOOL LOC16;
								struct stat s_RuNVTKvdly9cZfIOe4n2UxA;
								Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg volatile k_UOHphKaSJmtigrE5yH2PSA;
								NimStringDesc* nosource_9bHWThqrv2fptZLRwWGNtUQ_2;
								LOC16 = (NIM_BOOL)0;
								LOC16 = !(eqStrings(y_YFMhiTF5nHv8ChASxf9clIg, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_8)));
								if (!(LOC16)) goto LA17;
								LOC16 = !(eqStrings(y_YFMhiTF5nHv8ChASxf9clIg, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_9)));
								LA17: ;
								if (!LOC16) goto LA18;
								memset((void*)(&s_RuNVTKvdly9cZfIOe4n2UxA), 0, sizeof(s_RuNVTKvdly9cZfIOe4n2UxA));
								{
									if (!NIM_TRUE) goto LA22;
									y_YFMhiTF5nHv8ChASxf9clIg = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(source0, y_YFMhiTF5nHv8ChASxf9clIg);
								}
								LA22: ;
								k_UOHphKaSJmtigrE5yH2PSA = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 0);
								{
									NimStringDesc* nosource_9bHWThqrv2fptZLRwWGNtUQ;
									if (!!(((*x_It69c26KPHDCcNHZrKwJQKg).d_type == ((NI8) 0)))) goto LA26;
									{
										if (!((*x_It69c26KPHDCcNHZrKwJQKg).d_type == ((NI8) 4))) goto LA30;
										k_UOHphKaSJmtigrE5yH2PSA = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
									}
									LA30: ;
									{
										if (!((*x_It69c26KPHDCcNHZrKwJQKg).d_type == ((NI8) 10))) goto LA34;
										{
											NIM_BOOL LOC38;
											LOC38 = (NIM_BOOL)0;
											LOC38 = direxists_wf0Ae3eLXw0lSNEFJMV3ogos(y_YFMhiTF5nHv8ChASxf9clIg);
											if (!LOC38) goto LA39;
											k_UOHphKaSJmtigrE5yH2PSA = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 3);
										}
										goto LA36;
										LA39: ;
										{
											k_UOHphKaSJmtigrE5yH2PSA = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 1);
										}
										LA36: ;
									}
									LA34: ;
									kind_gd2y49bK85jLehwsTMQuB4A = k_UOHphKaSJmtigrE5yH2PSA;
									path_9c7AzyvKcyE3R8aoYoit8GA = y_YFMhiTF5nHv8ChASxf9clIg;
									nosource_9bHWThqrv2fptZLRwWGNtUQ = copyStr(path_9c7AzyvKcyE3R8aoYoit8GA, (NI)((source0 ? source0->Sup.len : 0) + ((NI) 1)));
									switch (kind_gd2y49bK85jLehwsTMQuB4A) {
									case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
									{
										NimStringDesc* LOC43;
										LOC43 = (NimStringDesc*)0;
										LOC43 = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(dest0, nosource_9bHWThqrv2fptZLRwWGNtUQ);
										noscopyFile(path_9c7AzyvKcyE3R8aoYoit8GA, LOC43);
									}
									break;
									case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
									{
										NimStringDesc* LOC45;
										LOC45 = (NimStringDesc*)0;
										LOC45 = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(dest0, nosource_9bHWThqrv2fptZLRwWGNtUQ);
										noscopyDir(path_9c7AzyvKcyE3R8aoYoit8GA, LOC45);
									}
									break;
									default:
									{
									}
									break;
									}
									goto LA9;
								}
								LA26: ;
								{
									int LOC49;
									LOC49 = (int)0;
									LOC49 = lstat(y_YFMhiTF5nHv8ChASxf9clIg->data, (&s_RuNVTKvdly9cZfIOe4n2UxA));
									if (!(LOC49 < ((NI32) 0))) goto LA50;
									goto LA7;
								}
								LA50: ;
								{
									NIM_BOOL LOC54;
									LOC54 = (NIM_BOOL)0;
									LOC54 = S_ISDIR(s_RuNVTKvdly9cZfIOe4n2UxA.st_mode);
									if (!LOC54) goto LA55;
									k_UOHphKaSJmtigrE5yH2PSA = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
								}
								goto LA52;
								LA55: ;
								{
									NIM_BOOL LOC58;
									LOC58 = (NIM_BOOL)0;
									LOC58 = S_ISLNK(s_RuNVTKvdly9cZfIOe4n2UxA.st_mode);
									if (!LOC58) goto LA59;
									k_UOHphKaSJmtigrE5yH2PSA = getsymlinkfilekind_WoXOp8qmMec1P4MyA3LBKg(y_YFMhiTF5nHv8ChASxf9clIg);
								}
								goto LA52;
								LA59: ;
								LA52: ;
								kind_gd2y49bK85jLehwsTMQuB4A = k_UOHphKaSJmtigrE5yH2PSA;
								path_9c7AzyvKcyE3R8aoYoit8GA = y_YFMhiTF5nHv8ChASxf9clIg;
								nosource_9bHWThqrv2fptZLRwWGNtUQ_2 = copyStr(path_9c7AzyvKcyE3R8aoYoit8GA, (NI)((source0 ? source0->Sup.len : 0) + ((NI) 1)));
								switch (kind_gd2y49bK85jLehwsTMQuB4A) {
								case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
								{
									NimStringDesc* LOC62;
									LOC62 = (NimStringDesc*)0;
									LOC62 = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(dest0, nosource_9bHWThqrv2fptZLRwWGNtUQ_2);
									noscopyFile(path_9c7AzyvKcyE3R8aoYoit8GA, LOC62);
								}
								break;
								case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
								{
									NimStringDesc* LOC64;
									LOC64 = (NimStringDesc*)0;
									LOC64 = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(dest0, nosource_9bHWThqrv2fptZLRwWGNtUQ_2);
									noscopyDir(path_9c7AzyvKcyE3R8aoYoit8GA, LOC64);
								}
								break;
								default:
								{
								}
								break;
								}
							}
							LA18: ;
						} LA9: ;
					}
				} LA7: ;
				nimrtl_popSafePoint();
			}
			else {
				nimrtl_popSafePoint();
			}
			{
				int LOC68;
				LOC68 = (int)0;
				LOC68 = closedir(d_4MPlW3lbXy4ds0e5pfkArw);
			}
			if (T_yu6cxgKBBXbNsTkT9cyMd4g_11.status != 0) nimrtl_reraiseException();
		}
		LA4: ;
	}
}

N_LIB_EXPORT N_CDECL(TY_sM4lkSb7zS6F7OVMvW9cffQ*, nosparseCmdLine)(NimStringDesc* c0) {
	TY_sM4lkSb7zS6F7OVMvW9cffQ* result0;
	NI i0;
	NimStringDesc* a0;
	result0 = (TY_sM4lkSb7zS6F7OVMvW9cffQ*)0;
	result0 = (TY_sM4lkSb7zS6F7OVMvW9cffQ*) nimrtl_newSeq((&NTI_sM4lkSb7zS6F7OVMvW9cffQ), 0);
	i0 = ((NI) 0);
	a0 = nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	{
		while (1) {
			NimStringDesc* LOC24;
			a0 = nimrtl_setLengthStr(a0, ((NI) 0));
			{
				while (1) {
					NIM_BOOL LOC5;
					NIM_BOOL LOC6;
					NIM_BOOL LOC7;
					LOC5 = (NIM_BOOL)0;
					LOC6 = (NIM_BOOL)0;
					LOC7 = (NIM_BOOL)0;
					LOC7 = ((NU8)(c0->data[i0]) == (NU8)(32));
					if (LOC7) goto LA8;
					LOC7 = ((NU8)(c0->data[i0]) == (NU8)(9));
					LA8: ;
					LOC6 = LOC7;
					if (LOC6) goto LA9;
					LOC6 = ((NU8)(c0->data[i0]) == (NU8)(10));
					LA9: ;
					LOC5 = LOC6;
					if (LOC5) goto LA10;
					LOC5 = ((NU8)(c0->data[i0]) == (NU8)(13));
					LA10: ;
					if (!LOC5) goto LA4;
					i0 += ((NI) 1);
				} LA4: ;
			}
			switch (((NU8)(c0->data[i0]))) {
			case 39:
			case 34:
			{
				NIM_CHAR delim0;
				delim0 = c0->data[i0];
				i0 += ((NI) 1);
				{
					while (1) {
						NIM_BOOL LOC14;
						LOC14 = (NIM_BOOL)0;
						LOC14 = !(((NU8)(c0->data[i0]) == (NU8)(0)));
						if (!(LOC14)) goto LA15;
						LOC14 = !(((NU8)(c0->data[i0]) == (NU8)(delim0)));
						LA15: ;
						if (!LOC14) goto LA13;
						a0 = addChar(a0, c0->data[i0]);
						i0 += ((NI) 1);
					} LA13: ;
				}
				{
					if (!!(((NU8)(c0->data[i0]) == (NU8)(0)))) goto LA18;
					i0 += ((NI) 1);
				}
				LA18: ;
			}
			break;
			case 0:
			{
				goto LA1;
			}
			break;
			default:
			{
				{
					while (1) {
						if (!((NU8)(32) < (NU8)(c0->data[i0]))) goto LA23;
						a0 = addChar(a0, c0->data[i0]);
						i0 += ((NI) 1);
					} LA23: ;
				}
			}
			break;
			}
			result0 = (TY_sM4lkSb7zS6F7OVMvW9cffQ*) incrSeqV2(&(result0)->Sup, sizeof(NimStringDesc*));
			LOC24 = (NimStringDesc*)0;
			LOC24 = result0->data[result0->Sup.len]; result0->data[result0->Sup.len] = nimrtl_copyStringRC1(a0);
			if (LOC24) nimGCunrefNoCycle(LOC24);
			++result0->Sup.len;
		}
	} LA1: ;
	return result0;
}

N_NIMCALL(void, copyfilewithpermissions_ocr9chMejxLldaYNB2fMsHw)(NimStringDesc* source0, NimStringDesc* dest0, NIM_BOOL ignorepermissionerrors0) {
	TSafePoint T_yu6cxgKBBXbNsTkT9cyMd4g_14;
	noscopyFile(source0, dest0);
	nimrtl_pushSafePoint(&T_yu6cxgKBBXbNsTkT9cyMd4g_14);
	T_yu6cxgKBBXbNsTkT9cyMd4g_14.status = setjmp(T_yu6cxgKBBXbNsTkT9cyMd4g_14.context);
	if (T_yu6cxgKBBXbNsTkT9cyMd4g_14.status == 0) {
		Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set LOC2;
		LOC2 = nosgetFilePermissions(source0);
		nossetFilePermissions(dest0, LOC2);
		nimrtl_popSafePoint();
	}
	else {
		nimrtl_popSafePoint();
		{
			T_yu6cxgKBBXbNsTkT9cyMd4g_14.status = 0;
			{
				if (!!(ignorepermissionerrors0)) goto LA7;
				nimrtl_reraiseException();
			}
			LA7: ;
			nimrtl_popCurrentException();
		}
	}
	if (T_yu6cxgKBBXbNsTkT9cyMd4g_14.status != 0) nimrtl_reraiseException();
}

N_LIB_EXPORT N_CDECL(void, noscopyDirWithPermissions)(NimStringDesc* source0, NimStringDesc* dest0, NIM_BOOL ignorepermissionerrors0) {
	TSafePoint T_yu6cxgKBBXbNsTkT9cyMd4g_12;
	noscreateDir(dest0);
	nimrtl_pushSafePoint(&T_yu6cxgKBBXbNsTkT9cyMd4g_12);
	T_yu6cxgKBBXbNsTkT9cyMd4g_12.status = setjmp(T_yu6cxgKBBXbNsTkT9cyMd4g_12.context);
	if (T_yu6cxgKBBXbNsTkT9cyMd4g_12.status == 0) {
		Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set LOC2;
		LOC2 = nosgetFilePermissions(source0);
		nossetFilePermissions(dest0, LOC2);
		nimrtl_popSafePoint();
	}
	else {
		nimrtl_popSafePoint();
		{
			T_yu6cxgKBBXbNsTkT9cyMd4g_12.status = 0;
			{
				if (!!(ignorepermissionerrors0)) goto LA7;
				nimrtl_reraiseException();
			}
			LA7: ;
			nimrtl_popCurrentException();
		}
	}
	if (T_yu6cxgKBBXbNsTkT9cyMd4g_12.status != 0) nimrtl_reraiseException();
	{
		Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg kind_9cd2coShRESGOuft9b4m6RzQ;
		NimStringDesc* path_qXmgI7VKMFvSzqoZx3c0yQ;
		DIR* d_MvYGjeUSlG12wLFKtvjHKQ;
		kind_9cd2coShRESGOuft9b4m6RzQ = (Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg)0;
		path_qXmgI7VKMFvSzqoZx3c0yQ = (NimStringDesc*)0;
		d_MvYGjeUSlG12wLFKtvjHKQ = opendir(source0->data);
		{
			TSafePoint T_yu6cxgKBBXbNsTkT9cyMd4g_13;
			if (!!((d_MvYGjeUSlG12wLFKtvjHKQ == NIM_NIL))) goto LA12;
			nimrtl_pushSafePoint(&T_yu6cxgKBBXbNsTkT9cyMd4g_13);
			T_yu6cxgKBBXbNsTkT9cyMd4g_13.status = setjmp(T_yu6cxgKBBXbNsTkT9cyMd4g_13.context);
			if (T_yu6cxgKBBXbNsTkT9cyMd4g_13.status == 0) {
				{
					while (1) {
						{
							struct dirent* x_PLtpQVd3aixULAjS7T26xQ;
							NimStringDesc* volatile y_b9bAkwEYCzkHyCBl82NqA6Q;
							x_PLtpQVd3aixULAjS7T26xQ = readdir(d_MvYGjeUSlG12wLFKtvjHKQ);
							{
								if (!(x_PLtpQVd3aixULAjS7T26xQ == NIM_NIL)) goto LA20;
								goto LA15;
							}
							LA20: ;
							y_b9bAkwEYCzkHyCBl82NqA6Q = nimrtl_cstrToNimstr(((NCSTRING) ((*x_PLtpQVd3aixULAjS7T26xQ).d_name)));
							{
								NIM_BOOL LOC24;
								struct stat s_Cn7ZiYoc6hwjvjvtz1LdIg;
								Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg volatile k_dTJKE4xsCKGLDRCTSgal3w;
								NimStringDesc* nosource_v7FsyEMDa9cXdx9cI4VPa4FQ_2;
								LOC24 = (NIM_BOOL)0;
								LOC24 = !(eqStrings(y_b9bAkwEYCzkHyCBl82NqA6Q, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_8)));
								if (!(LOC24)) goto LA25;
								LOC24 = !(eqStrings(y_b9bAkwEYCzkHyCBl82NqA6Q, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_9)));
								LA25: ;
								if (!LOC24) goto LA26;
								memset((void*)(&s_Cn7ZiYoc6hwjvjvtz1LdIg), 0, sizeof(s_Cn7ZiYoc6hwjvjvtz1LdIg));
								{
									if (!NIM_TRUE) goto LA30;
									y_b9bAkwEYCzkHyCBl82NqA6Q = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(source0, y_b9bAkwEYCzkHyCBl82NqA6Q);
								}
								LA30: ;
								k_dTJKE4xsCKGLDRCTSgal3w = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 0);
								{
									NimStringDesc* nosource_v7FsyEMDa9cXdx9cI4VPa4FQ;
									if (!!(((*x_PLtpQVd3aixULAjS7T26xQ).d_type == ((NI8) 0)))) goto LA34;
									{
										if (!((*x_PLtpQVd3aixULAjS7T26xQ).d_type == ((NI8) 4))) goto LA38;
										k_dTJKE4xsCKGLDRCTSgal3w = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
									}
									LA38: ;
									{
										if (!((*x_PLtpQVd3aixULAjS7T26xQ).d_type == ((NI8) 10))) goto LA42;
										{
											NIM_BOOL LOC46;
											LOC46 = (NIM_BOOL)0;
											LOC46 = direxists_wf0Ae3eLXw0lSNEFJMV3ogos(y_b9bAkwEYCzkHyCBl82NqA6Q);
											if (!LOC46) goto LA47;
											k_dTJKE4xsCKGLDRCTSgal3w = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 3);
										}
										goto LA44;
										LA47: ;
										{
											k_dTJKE4xsCKGLDRCTSgal3w = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 1);
										}
										LA44: ;
									}
									LA42: ;
									kind_9cd2coShRESGOuft9b4m6RzQ = k_dTJKE4xsCKGLDRCTSgal3w;
									path_qXmgI7VKMFvSzqoZx3c0yQ = y_b9bAkwEYCzkHyCBl82NqA6Q;
									nosource_v7FsyEMDa9cXdx9cI4VPa4FQ = copyStr(path_qXmgI7VKMFvSzqoZx3c0yQ, (NI)((source0 ? source0->Sup.len : 0) + ((NI) 1)));
									switch (kind_9cd2coShRESGOuft9b4m6RzQ) {
									case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
									{
										NimStringDesc* LOC51;
										LOC51 = (NimStringDesc*)0;
										LOC51 = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(dest0, nosource_v7FsyEMDa9cXdx9cI4VPa4FQ);
										copyfilewithpermissions_ocr9chMejxLldaYNB2fMsHw(path_qXmgI7VKMFvSzqoZx3c0yQ, LOC51, ignorepermissionerrors0);
									}
									break;
									case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
									{
										NimStringDesc* LOC53;
										LOC53 = (NimStringDesc*)0;
										LOC53 = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(dest0, nosource_v7FsyEMDa9cXdx9cI4VPa4FQ);
										noscopyDirWithPermissions(path_qXmgI7VKMFvSzqoZx3c0yQ, LOC53, ignorepermissionerrors0);
									}
									break;
									default:
									{
									}
									break;
									}
									goto LA17;
								}
								LA34: ;
								{
									int LOC57;
									LOC57 = (int)0;
									LOC57 = lstat(y_b9bAkwEYCzkHyCBl82NqA6Q->data, (&s_Cn7ZiYoc6hwjvjvtz1LdIg));
									if (!(LOC57 < ((NI32) 0))) goto LA58;
									goto LA15;
								}
								LA58: ;
								{
									NIM_BOOL LOC62;
									LOC62 = (NIM_BOOL)0;
									LOC62 = S_ISDIR(s_Cn7ZiYoc6hwjvjvtz1LdIg.st_mode);
									if (!LOC62) goto LA63;
									k_dTJKE4xsCKGLDRCTSgal3w = ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2);
								}
								goto LA60;
								LA63: ;
								{
									NIM_BOOL LOC66;
									LOC66 = (NIM_BOOL)0;
									LOC66 = S_ISLNK(s_Cn7ZiYoc6hwjvjvtz1LdIg.st_mode);
									if (!LOC66) goto LA67;
									k_dTJKE4xsCKGLDRCTSgal3w = getsymlinkfilekind_WoXOp8qmMec1P4MyA3LBKg(y_b9bAkwEYCzkHyCBl82NqA6Q);
								}
								goto LA60;
								LA67: ;
								LA60: ;
								kind_9cd2coShRESGOuft9b4m6RzQ = k_dTJKE4xsCKGLDRCTSgal3w;
								path_qXmgI7VKMFvSzqoZx3c0yQ = y_b9bAkwEYCzkHyCBl82NqA6Q;
								nosource_v7FsyEMDa9cXdx9cI4VPa4FQ_2 = copyStr(path_qXmgI7VKMFvSzqoZx3c0yQ, (NI)((source0 ? source0->Sup.len : 0) + ((NI) 1)));
								switch (kind_9cd2coShRESGOuft9b4m6RzQ) {
								case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 0):
								{
									NimStringDesc* LOC70;
									LOC70 = (NimStringDesc*)0;
									LOC70 = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(dest0, nosource_v7FsyEMDa9cXdx9cI4VPa4FQ_2);
									copyfilewithpermissions_ocr9chMejxLldaYNB2fMsHw(path_qXmgI7VKMFvSzqoZx3c0yQ, LOC70, ignorepermissionerrors0);
								}
								break;
								case ((Pathcomponent_9c1SIU9cO1wHcl09b703A9cDrg) 2):
								{
									NimStringDesc* LOC72;
									LOC72 = (NimStringDesc*)0;
									LOC72 = HEX2F_BsTQv9c9anbxt9bKmR0aN1elQ(dest0, nosource_v7FsyEMDa9cXdx9cI4VPa4FQ_2);
									noscopyDirWithPermissions(path_qXmgI7VKMFvSzqoZx3c0yQ, LOC72, ignorepermissionerrors0);
								}
								break;
								default:
								{
								}
								break;
								}
							}
							LA26: ;
						} LA17: ;
					}
				} LA15: ;
				nimrtl_popSafePoint();
			}
			else {
				nimrtl_popSafePoint();
			}
			{
				int LOC76;
				LOC76 = (int)0;
				LOC76 = closedir(d_MvYGjeUSlG12wLFKtvjHKQ);
			}
			if (T_yu6cxgKBBXbNsTkT9cyMd4g_13.status != 0) nimrtl_reraiseException();
		}
		LA12: ;
	}
}

N_LIB_EXPORT N_CDECL(void, nosinclFilePermissions)(NimStringDesc* filename0, Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions0) {
	Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set LOC1;
	LOC1 = nosgetFilePermissions(filename0);
	nossetFilePermissions(filename0, (LOC1 | permissions0));
}

N_LIB_EXPORT N_CDECL(void, nosexclFilePermissions)(NimStringDesc* filename0, Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set permissions0) {
	Filepermission_uTVeDpjCH6aWw9c74YkAskA_Set LOC1;
	LOC1 = nosgetFilePermissions(filename0);
	nossetFilePermissions(filename0, (LOC1 & ~ permissions0));
}

N_NIMCALL(void, getenvvarsc_xlXgIeBHBOL9cl4MJcFJ8xA)(void) {
	{
		NI i0;
		if (!!(envcomputed_LLyFo9bsdu1ZXMDvAe8DhrQ)) goto LA3;
		if (environment_mlhK49b6YMgc9cgrcYkKq9a3g) nimGCunrefNoCycle(environment_mlhK49b6YMgc9cgrcYkKq9a3g);
		environment_mlhK49b6YMgc9cgrcYkKq9a3g = (TY_sM4lkSb7zS6F7OVMvW9cffQ*) nimrtl_newSeqRC1((&NTI_sM4lkSb7zS6F7OVMvW9cffQ), 0);
		i0 = ((NI) 0);
		{
			while (1) {
				NimStringDesc* LOC12;
				NimStringDesc* LOC13;
				{
					NIM_BOOL LOC9;
					LOC9 = (NIM_BOOL)0;
					LOC9 = HEX3DHEX3D_9ccNWqrTIE9bcAqE2Q0ro7zgos(environ[(i0)- 0], NIM_NIL);
					if (!LOC9) goto LA10;
					goto LA5;
				}
				LA10: ;
				LOC12 = (NimStringDesc*)0;
				LOC12 = nimrtl_cstrToNimstr(environ[(i0)- 0]);
				environment_mlhK49b6YMgc9cgrcYkKq9a3g = (TY_sM4lkSb7zS6F7OVMvW9cffQ*) incrSeqV2(&(environment_mlhK49b6YMgc9cgrcYkKq9a3g)->Sup, sizeof(NimStringDesc*));
				LOC13 = (NimStringDesc*)0;
				LOC13 = environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[environment_mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len]; environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[environment_mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len] = nimrtl_copyStringRC1(LOC12);
				if (LOC13) nimGCunrefNoCycle(LOC13);
				++environment_mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len;
				i0 += ((NI) 1);
			}
		} LA5: ;
		envcomputed_LLyFo9bsdu1ZXMDvAe8DhrQ = NIM_TRUE;
	}
	LA3: ;
}

N_NIMCALL(NI, findenvvar_cmJJ3H7KloA4DztTvzWyCw)(NimStringDesc* key0) {
	NI result0;
	NimStringDesc* temp0;
	NimStringDesc* LOC1;
{	result0 = (NI)0;
	getenvvarsc_xlXgIeBHBOL9cl4MJcFJ8xA();
	LOC1 = (NimStringDesc*)0;
	LOC1 = rawNewString(key0->Sup.len + 1);
appendString(LOC1, key0);
appendChar(LOC1, 61);
	temp0 = LOC1;
	{
		NI i_QFpQyCBMTAf3RQiHRTCtRA;
		NI HEX3Atmp_8z2i61QBqrTxJYp9bXCSF9aA;
		NI res_9cO4Qfuzy9c4z8ih7joizeqg;
		i_QFpQyCBMTAf3RQiHRTCtRA = (NI)0;
		HEX3Atmp_8z2i61QBqrTxJYp9bXCSF9aA = (NI)0;
		HEX3Atmp_8z2i61QBqrTxJYp9bXCSF9aA = (environment_mlhK49b6YMgc9cgrcYkKq9a3g ? (environment_mlhK49b6YMgc9cgrcYkKq9a3g->Sup.len-1) : -1);
		res_9cO4Qfuzy9c4z8ih7joizeqg = ((NI) 0);
		{
			while (1) {
				if (!(res_9cO4Qfuzy9c4z8ih7joizeqg <= HEX3Atmp_8z2i61QBqrTxJYp9bXCSF9aA)) goto LA4;
				i_QFpQyCBMTAf3RQiHRTCtRA = res_9cO4Qfuzy9c4z8ih7joizeqg;
				{
					NIM_BOOL LOC7;
					LOC7 = (NIM_BOOL)0;
					LOC7 = nsuStartsWith(environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[i_QFpQyCBMTAf3RQiHRTCtRA], temp0);
					if (!LOC7) goto LA8;
					result0 = i_QFpQyCBMTAf3RQiHRTCtRA;
					goto BeforeRet;
				}
				LA8: ;
				res_9cO4Qfuzy9c4z8ih7joizeqg += ((NI) 1);
			} LA4: ;
		}
	}
	result0 = ((NI) -1);
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_NIMCALL(NimStringDesc*, getenv_8zNgT9bxx7m9cTt2TeVdTdIw)(NimStringDesc* key0) {
	NimStringDesc* result0;
	NI i0;
{	result0 = (NimStringDesc*)0;
	i0 = findenvvar_cmJJ3H7KloA4DztTvzWyCw(key0);
	{
		NI LOC5;
		if (!(((NI) 0) <= i0)) goto LA3;
		LOC5 = (NI)0;
		LOC5 = nsuFindChar(environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[i0], 61, ((NI) 0));
		result0 = copyStr(environment_mlhK49b6YMgc9cgrcYkKq9a3g->data[i0], (NI)(LOC5 + ((NI) 1)));
		goto BeforeRet;
	}
	goto LA1;
	LA3: ;
	{
		NCSTRING env0;
		env0 = getenv(key0->data);
		{
			NIM_BOOL LOC9;
			LOC9 = (NIM_BOOL)0;
			LOC9 = HEX3DHEX3D_9ccNWqrTIE9bcAqE2Q0ro7zgos(env0, NIM_NIL);
			if (!LOC9) goto LA10;
			result0 = nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
			goto BeforeRet;
		}
		LA10: ;
		result0 = nimrtl_cstrToNimstr(env0);
	}
	LA1: ;
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetHomeDir)(void) {
	NimStringDesc* result0;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
{	result0 = (NimStringDesc*)0;
	LOC1 = (NimStringDesc*)0;
	LOC2 = (NimStringDesc*)0;
	LOC2 = getenv_8zNgT9bxx7m9cTt2TeVdTdIw(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_15));
	LOC1 = rawNewString(LOC2->Sup.len + 1);
appendString(LOC1, LOC2);
appendString(LOC1, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_16));
	result0 = LOC1;
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetConfigDir)(void) {
	NimStringDesc* result0;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
{	result0 = (NimStringDesc*)0;
	LOC1 = (NimStringDesc*)0;
	LOC2 = (NimStringDesc*)0;
	LOC2 = getenv_8zNgT9bxx7m9cTt2TeVdTdIw(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_15));
	LOC1 = rawNewString(LOC2->Sup.len + 9);
appendString(LOC1, LOC2);
appendString(LOC1, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_17));
	result0 = LOC1;
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetTempDir)(void) {
	NimStringDesc* result0;
{	result0 = (NimStringDesc*)0;
	result0 = nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_18));
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_NIMCALL(NimStringDesc*, getapplaux_Cd6LaCdd4j2y8pff6G0r9aw)(NimStringDesc* procpath0) {
	NimStringDesc* result0;
	NI len0;
	result0 = (NimStringDesc*)0;
	result0 = mnewString(((NI) 256));
	len0 = readlink(procpath0->data, result0->data, ((NI) 256));
	{
		if (!(((NI) 256) < len0)) goto LA3;
		result0 = mnewString(((NI) ((NI)(len0 + ((NI) 1)))));
		len0 = readlink(procpath0->data, result0->data, len0);
	}
	LA3: ;
	result0 = nimrtl_setLengthStr(result0, ((NI) (len0)));
	return result0;
}

N_NIMCALL(NimStringDesc*, getapplheuristic_cIsnssr9auuNc29cT9bLoxiqg)(void) {
	NimStringDesc* result0;
	result0 = (NimStringDesc*)0;
	result0 = nimrtl_copyString(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	return result0;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nosgetAppFilename)(void) {
	NimStringDesc* result0;
	result0 = (NimStringDesc*)0;
	result0 = getapplaux_Cd6LaCdd4j2y8pff6G0r9aw(((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_19));
	{
		if (!((result0 ? result0->Sup.len : 0) == ((NI) 0))) goto LA3;
		result0 = getapplheuristic_cIsnssr9auuNc29cT9bLoxiqg();
	}
	LA3: ;
	return result0;
}

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

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

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

N_LIB_EXPORT N_CDECL(void, nossleep)(NI milsecs0) {
	struct timespec a0;
	struct timespec b0;
	int LOC1;
	memset((void*)(&a0), 0, sizeof(a0));
	memset((void*)(&b0), 0, sizeof(b0));
	a0.tv_sec = (NI)(milsecs0 / ((NI) 1000));
	a0.tv_nsec = ((NI) ((NI)(((NI) ((NI)(((NI) ((NI)(milsecs0 % ((NI) 1000)))) * ((NI) 1000)))) * ((NI) 1000))));
	LOC1 = (int)0;
	LOC1 = nanosleep((&a0), (&b0));
}

N_LIB_EXPORT N_CDECL(NI64, nosgetFileSize)(NimStringDesc* file0) {
	NI64 result0;
	FILE* f0;
	result0 = (NI64)0;
	f0 = (FILE*)0;
	{
		NIM_BOOL LOC3;
		LOC3 = (NIM_BOOL)0;
		LOC3 = open_sEp0GH2306oGo9bqBpj5oTQ(&f0, file0, ((Filemode_fVUBHvW79bXUw1j55Oo9avSQ) 0), ((NI) -1));
		if (!LOC3) goto LA4;
		result0 = getfilesize_XePgC9ccBXCgb9bEHXZpnMqA(f0);
		close_BWnr8V7RERYno9bIdPmw8Hw(f0);
	}
	goto LA1;
	LA4: ;
	{
		NI32 LOC7;
		LOC7 = (NI32)0;
		LOC7 = oslasterror_pMOMIZAQaKFp1XoL58mjVg();
		raiseoserror_K9a7YBjj81Bse0N0Fg7MFIA(LOC7, ((NimStringDesc*) &T_yu6cxgKBBXbNsTkT9cyMd4g_2));
	}
	LA1: ;
	return result0;
}
NIM_EXTERNC N_NOINLINE(void, stdlib_osInit000)(void) {
nimRegisterGlobalMarker(T_yu6cxgKBBXbNsTkT9cyMd4g_6);
}

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

