1 /* Generated by Nim Compiler v1.6.2 */
2 #define NIM_INTBITS 64
3 
4 #include "nimbase.h"
5 #include <string.h>
6 #include <unistd.h>
7 #include <errno.h>
8 #include <sys/stat.h>
9 #include <sys/types.h>
10 #include <time.h>
11 #include <stdlib.h>
12 #include <sys/param.h>
13 #include <mach-o/dyld.h>
14 #include <sys/wait.h>
15 #include <dirent.h>
16 #include <setjmp.h>
17 #include <stdio.h>
18 #include <copyfile.h>
19 #undef LANGUAGE_C
20 #undef MIPSEB
21 #undef MIPSEL
22 #undef PPC
23 #undef R3000
24 #undef R4000
25 #undef i386
26 #undef linux
27 #undef mips
28 #undef near
29 #undef far
30 #undef powerpc
31 #undef unix
32 #define nimfr_(x, y)
33 #define nimln_(x, y)
34 typedef struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ tySequence__sM4lkSb7zS6F7OVMvW9cffQ;
35 typedef struct TGenericSeq TGenericSeq;
36 typedef struct NimStringDesc NimStringDesc;
37 typedef struct TNimType TNimType;
38 typedef struct TNimNode TNimNode;
39 typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
40 typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
41 typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
42 typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
43 typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
44 typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
45 typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
46 typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
47 typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
48 typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
49 typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
50 typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
51 typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
52 typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
53 typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
54 typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
55 typedef struct tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ;
56 typedef struct tyObject_Defect__LbeSGvgPzGzXnW9caIkJqMA tyObject_Defect__LbeSGvgPzGzXnW9caIkJqMA;
57 typedef struct Exception Exception;
58 typedef struct RootObj RootObj;
59 typedef struct tySequence__uB9b75OUPRENsBAu4AnoePA tySequence__uB9b75OUPRENsBAu4AnoePA;
60 typedef struct tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
61 typedef struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg tyTuple__7q7q3E6Oj24ZNVJb9aonhAg;
62 typedef struct tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw;
63 typedef struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA;
64 typedef struct tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA;
65 typedef struct tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg;
66 typedef struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ;
67 typedef struct tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw;
68 typedef struct TSafePoint TSafePoint;
69 typedef struct tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q;
70 typedef struct tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA;
71 typedef struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA;
72 struct TGenericSeq {
73 NI len;
74 NI reserved;
75 };
76 struct NimStringDesc {
77   TGenericSeq Sup;
78 NIM_CHAR data[SEQ_DECL_SIZE];
79 };
80 typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
81 typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
82 typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
83 typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
84 struct TNimType {
85 NI size;
86 NI align;
87 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
88 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
89 TNimType* base;
90 TNimNode* node;
91 void* finalizer;
92 tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
93 tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
94 };
95 typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
96 struct TNimNode {
97 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
98 NI offset;
99 TNimType* typ;
100 NCSTRING name;
101 NI len;
102 TNimNode** sons;
103 };
104 struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
105 NI refcount;
106 TNimType* typ;
107 };
108 struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
109 void* bottom;
110 };
111 struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
112 NI len;
113 NI cap;
114 tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
115 };
116 typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SPr7N6UKfuF549bNPiUvSRw[256];
117 typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
118 typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
119 typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
120 typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
121 struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
122 tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
123 };
124 typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
125 struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
126 tyArray__0aOLqZchNi8nWtMTi8ND8w link;
127 NI key;
128 NI upperBound;
129 NI level;
130 };
131 struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
132 tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
133 NI Field1;
134 };
135 typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
136 struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
137 NI len;
138 tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
139 tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
140 };
141 struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
142 NI minLargeObj;
143 NI maxLargeObj;
144 tyArray__SPr7N6UKfuF549bNPiUvSRw freeSmallChunks;
145 NU32 flBitmap;
146 tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
147 tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
148 tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
149 NI currMem;
150 NI maxMem;
151 NI freeMem;
152 NI occ;
153 NI lastSize;
154 tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
155 tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
156 tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
157 tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
158 tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
159 NIM_BOOL locked;
160 NIM_BOOL blockChunkSizeIncrease;
161 NI nextChunkSize;
162 tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
163 tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
164 };
165 struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
166 NI stackScans;
167 NI cycleCollections;
168 NI maxThreshold;
169 NI maxStackSize;
170 NI maxStackCells;
171 NI cycleTableSize;
172 NI64 maxPause;
173 };
174 struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
175 NI counter;
176 NI max;
177 tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
178 tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
179 };
180 struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
181 tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
182 NI cycleThreshold;
183 NI zctThreshold;
184 tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
185 tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
186 tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
187 NI recGcLock;
188 tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
189 tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
190 tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
191 tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
192 NI gcThreadId;
193 };
194 struct RootObj {
195 TNimType* m_type;
196 };
197 struct Exception {
198   RootObj Sup;
199 Exception* parent;
200 NCSTRING name;
201 NimStringDesc* message;
202 tySequence__uB9b75OUPRENsBAu4AnoePA* trace;
203 Exception* up;
204 };
205 struct tyObject_Defect__LbeSGvgPzGzXnW9caIkJqMA {
206   Exception Sup;
207 };
208 struct tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ {
209   tyObject_Defect__LbeSGvgPzGzXnW9caIkJqMA Sup;
210 };
211 typedef NU8 tySet_tyChar__nmiMWKVIe46vacnhAFrQvw[32];
212 struct tyTuple__UV3llMMYFckfui8YMBuUZA {
213 NimStringDesc* Field0;
214 NimStringDesc* Field1;
215 };
216 struct tyTuple__7q7q3E6Oj24ZNVJb9aonhAg {
217 NimStringDesc* Field0;
218 NimStringDesc* Field1;
219 NimStringDesc* Field2;
220 };
221 struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA {
222   Exception Sup;
223 };
224 struct tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw {
225   tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
226 };
227 struct tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA {
228   tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
229 NI32 errorCode;
230 };
231 struct tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg {
232 NI i;
233 NI prev;
234 NIM_BOOL notFirst;
235 };
236 struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ {
237 NI Field0;
238 NI Field1;
239 };
240 typedef NU8 tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg;
241 struct tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw {
242   tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
243 };
244 typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1];
245 struct TSafePoint {
246 TSafePoint* prev;
247 NI status;
248 jmp_buf context;
249 };
250 typedef NIM_CHAR tyArray__dTlC27m9c9aWd5dvuePYanug[256];
251 typedef NU8 tySet_tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA;
252 typedef NU8 tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA;
253 struct tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q {
254 NI64 seconds;
255 NI nanosecond;
256 };
257 typedef NU16 tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA;
258 typedef NU8 tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA;
259 struct tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA {
260 NimStringDesc* Field0;
261 tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA Field1;
262 };
263 struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA {
264 NCSTRING procname;
265 NI line;
266 NCSTRING filename;
267 };
268 struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ {
269   TGenericSeq Sup;
270   NimStringDesc* data[SEQ_DECL_SIZE];
271 };
272 struct tySequence__uB9b75OUPRENsBAu4AnoePA {
273   TGenericSeq Sup;
274   tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA data[SEQ_DECL_SIZE];
275 };
276 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newLen);
277 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
278 N_LIB_PRIVATE N_NIMCALL(TGenericSeq*, incrSeqV3)(TGenericSeq* s, TNimType* typ);
279 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
280 static N_INLINE(void, nimGCunrefNoCycle)(void* p);
281 static N_INLINE(void, decRef__system_5316)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
282 static N_INLINE(NI, minuspercent___system_716)(NI x, NI y);
283 static N_INLINE(NIM_BOOL, ltpercent___system_1005)(NI x, NI y);
284 static N_INLINE(void, rtlAddZCT__system_5314)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
285 N_LIB_PRIVATE N_NOINLINE(void, addZCT__system_5265)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
286 static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__system_5271)(void* usr);
287 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str);
288 N_LIB_PRIVATE N_NOINLINE(void*, newObj)(TNimType* typ, NI size);
289 static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
290 static N_INLINE(void, copyMem__system_1727)(void* dest, void* source, NI size);
291 static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
292 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___systemZdollars_3)(NI x);
293 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
294 static N_INLINE(void, asgnRef)(void** dest, void* src);
295 static N_INLINE(void, incRef__system_5309)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
296 static N_INLINE(NI, pluspercent___system_696)(NI x, NI y);
297 N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e, NCSTRING ename, NCSTRING procname, NCSTRING filename, NI line);
298 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShellPosix)(NimStringDesc* s);
299 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
300 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, allCharsInSet__pureZstrutils_1341)(NimStringDesc* s, tySet_tyChar__nmiMWKVIe46vacnhAFrQvw theSet);
301 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nsuReplaceStr)(NimStringDesc* s, NimStringDesc* sub, NimStringDesc* by);
302 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
303 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShell)(NimStringDesc* s);
304 N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
305 N_LIB_PRIVATE N_NIMCALL(void, joinPathImpl__pureZos_82)(NimStringDesc** result, NI* state, NimStringDesc* tail);
306 static N_INLINE(NIM_CHAR, X5BX5D___system_7329)(NimStringDesc* s, NI i);
307 static N_INLINE(NIM_CHAR*, X5BX5D___system_7362)(NimStringDesc** s, NI i);
308 N_LIB_PRIVATE N_NIMCALL(void, normalizePathEnd__pureZos_51)(NimStringDesc** path, NIM_BOOL trailingSep);
309 N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
310 N_LIB_PRIVATE N_NIMCALL(void, addNormalizePath__pureZpathnorm_71)(NimStringDesc* x, NimStringDesc** result, NI* state, NIM_CHAR dirSep);
311 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normalizePathEnd__pureZos_71)(NimStringDesc* path, NIM_BOOL trailingSep);
312 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosextractFilename)(NimStringDesc* path);
313 N_LIB_PRIVATE N_NIMCALL(void, nossplitPath)(NimStringDesc* path, tyTuple__UV3llMMYFckfui8YMBuUZA* Result);
314 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__system_7744)(NimStringDesc* s, NI first, NI last);
315 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__system_7756)(NimStringDesc* s, NI first);
316 static N_INLINE(void, nimZeroMem)(void* p, NI size);
317 static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
318 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normalizePath__pureZpathnorm_127)(NimStringDesc* path, NIM_CHAR dirSep);
319 N_LIB_PRIVATE N_NIMCALL(NI, cmp__system_1549)(NimStringDesc* x, NimStringDesc* y);
320 N_LIB_PRIVATE N_NIMCALL(NI, nsuCmpIgnoreCase)(NimStringDesc* a, NimStringDesc* b);
321 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosrelativePath)(NimStringDesc* path, NimStringDesc* base, NIM_CHAR sep);
322 static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
323 static N_INLINE(NIM_BOOL, equalMem__system_1735)(void* a, void* b, NI size);
324 static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size);
325 static N_INLINE(void, normalizePathAux__pureZos_31)(NimStringDesc** path);
326 N_LIB_PRIVATE N_NIMCALL(void, nosnormalizePath)(NimStringDesc** path);
327 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringDesc* path);
328 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, absolutePathInternal__pureZos_49)(NimStringDesc* path);
329 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, absolutePath__pureZos_743)(NimStringDesc* path, NimStringDesc* root);
330 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail);
331 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void);
332 N_NIMCALL(NimStringDesc*, mnewString)(NI len);
333 static N_INLINE(NIM_BOOL, eqeq___system_7724)(NCSTRING x, NCSTRING y);
334 static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s);
335 N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__pureZos_408)(void);
336 N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__systemZassertions_56)(NimStringDesc* msg);
337 N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__pureZos_405)(NI32 errorCode, NimStringDesc* additionalInfo);
338 N_LIB_PRIVATE N_NOINLINE(tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*, newOSError__pureZos_379)(NI32 errorCode, NimStringDesc* additionalInfo);
339 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, osErrorMsg__pureZos_358)(NI32 errorCode);
340 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasNext__pureZpathnorm_6)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg it, NimStringDesc* x);
341 N_LIB_PRIVATE N_NIMCALL(tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ, next__pureZpathnorm_10)(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg* it, NimStringDesc* x);
342 N_LIB_PRIVATE N_NIMCALL(NIM_CHAR, nsuToLowerAsciiChar)(NIM_CHAR c);
343 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix);
344 N_LIB_PRIVATE N_NIMCALL(NI, parentDirPos__pureZos_195)(NimStringDesc* path);
345 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getEnv__pureZos_418)(NimStringDesc* key, NimStringDesc* default_0);
346 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetHomeDir)(void);
347 static N_INLINE(NimStringDesc*, slash___pureZos_121)(NimStringDesc* head, NimStringDesc* tail);
348 N_LIB_PRIVATE N_NIMCALL(void, nossplitFile)(NimStringDesc* path, tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* Result);
349 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetAppFilename)(void);
350 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosexpandFilename)(NimStringDesc* filename);
351 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosexistsOrCreateDir)(NimStringDesc* dir);
352 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, rawCreateDir__pureZos_1435)(NimStringDesc* dir);
353 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosdirExists)(NimStringDesc* dir);
354 N_LIB_PRIVATE N_NIMCALL(NI, searchExtPos__pureZos_271)(NimStringDesc* path);
355 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normExt__pureZos_268)(NimStringDesc* ext);
356 static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c);
357 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___pureZos_429)(tyTuple__UV3llMMYFckfui8YMBuUZA x);
358 N_LIB_PRIVATE N_NIMCALL(void, addQuoted__pureZos_449)(NimStringDesc** s, NimStringDesc* x);
359 static N_INLINE(void, addEscapedChar__system_7485)(NimStringDesc** s, NIM_CHAR c);
360 static N_INLINE(NIM_BOOL, contains__pureZos_661)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item);
361 static N_INLINE(NI, find__pureZos_666)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item);
362 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext);
363 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileExists)(NimStringDesc* filename);
364 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, expandTilde__pureZos_586)(NimStringDesc* path);
365 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nossymlinkExists)(NimStringDesc* link);
366 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosparentDir)(NimStringDesc* path);
367 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nostryRemoveFile)(NimStringDesc* file);
368 static N_INLINE(void, pushSafePoint)(TSafePoint* s);
369 N_LIB_PRIVATE N_NIMCALL(tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg, getSymlinkFileKind__pureZos_1253)(NimStringDesc* path);
370 N_LIB_PRIVATE N_NIMCALL(void, nosremoveFile)(NimStringDesc* file);
371 N_LIB_PRIVATE N_NIMCALL(void, nosremoveDir)(NimStringDesc* dir, NIM_BOOL checkDir);
372 static N_INLINE(void, popSafePoint)(void);
373 N_LIB_PRIVATE N_NIMCALL(void, nimLeaveFinally)(void);
374 N_LIB_PRIVATE N_NIMCALL(void, reraiseException)(void);
375 N_LIB_PRIVATE N_NIMCALL(void, rawRemoveDir__pureZos_1428)(NimStringDesc* dir);
376 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, tryMoveFSObject__pureZos_1114)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL isDir);
377 N_LIB_PRIVATE N_NIMCALL(void, noscopyFile)(NimStringDesc* source, NimStringDesc* dest, tySet_tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA options);
378 static N_INLINE(NI, countBits32)(NU32 n);
379 static N_INLINE(NI, countSetBitsImpl__systemZcountbits95impl_26)(NU32 x);
380 N_CDECL(int, __builtin_popcount)(unsigned int x);
381 N_LIB_PRIVATE N_NIMCALL(void, createSymlink__pureZos_1022)(NimStringDesc* src, NimStringDesc* dest);
382 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, expandSymlink__pureZos_1028)(NimStringDesc* symlinkPath);
383 static N_INLINE(void, popCurrentException)(void);
384 N_LIB_PRIVATE N_NIMCALL(void, noscopyDir)(NimStringDesc* source, NimStringDesc* dest);
385 N_LIB_PRIVATE N_NIMCALL(void, noscreateDir)(NimStringDesc* dir);
386 static N_INLINE(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, toTime__pureZos_17)(struct timespec ts);
387 N_LIB_PRIVATE N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, initTime__pureZtimes_898)(NI64 unix_0, NI nanosecond);
388 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, ntLtTime)(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q a, tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q b);
389 N_LIB_PRIVATE N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, nosgetLastModificationTime)(NimStringDesc* file);
390 N_LIB_PRIVATE N_NIMCALL(void, nossetFilePermissions)(NimStringDesc* filename, tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA permissions, NIM_BOOL followSymlinks);
391 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___pureZos_881)(tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA x);
392 N_LIB_PRIVATE N_NIMCALL(void, addQuoted__pureZos_966)(NimStringDesc** s, tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA x);
393 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___pureZos_972)(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA x);
394 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, collectionToString__pureZos_976)(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA x, NimStringDesc* prefix, NimStringDesc* separator, NimStringDesc* suffix);
395 N_LIB_PRIVATE N_NIMCALL(void, addQuoted__pureZos_1008)(NimStringDesc** s, tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA x);
396 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, reprEnum)(NI e, TNimType* typ);
397 N_LIB_PRIVATE N_NIMCALL(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA, nosgetFilePermissions)(NimStringDesc* filename);
398 N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__pureZos_1127)(int status);
399 extern TNimType NTIseqLstringT__sM4lkSb7zS6F7OVMvW9cffQ_;
400 extern TNimType NTIrefindexdefect__RJnHOb9cQV3neNC9cDkRgMyw_;
401 extern TNimType NTIindexdefect__n6tGEPHKkh7E1AP9bj30WrQ_;
402 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_2, "index out of bounds, the container is empty", 43);
403 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_3, "index ", 6);
404 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_4, " not in 0 .. ", 13);
405 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_5, "\'\'", 2);
406 static NIM_CONST tySet_tyChar__nmiMWKVIe46vacnhAFrQvw TM__yu6cxgKBBXbNsTkT9cyMd4g_6 = {
407 0x00, 0x00, 0x00, 0x00, 0x20, 0xe8, 0xff, 0x27,
408 0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07,
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
411 ;
412 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_7, "\'", 1);
413 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_8, "\'\"\'\"\'", 5);
414 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_9, " ", 1);
415 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_10, "/", 1);
416 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_11, ".", 1);
417 extern TNimType NTIrefvalueerror__Ie1m0dv1ZHg72IgPRr1cDw_;
418 extern TNimType NTIvalueerror__yoNlBGx0D2tRizIdhQuENw_;
419 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_12, "The specified root is not absolute: ", 36);
420 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_13, "os.nim(1417, 21) `bufsize >= 0` ", 32);
421 extern TNimType NTIrefoserror__9clYsYwyjCqe2PFTuCI3Ubg_;
422 extern TNimType NTIoserror__BeJgrOdDsczOwEWOZbRfKA_;
423 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_14, "Additional info: ", 17);
424 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_15, "unknown OS error", 16);
425 static NIM_CONST tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ TM__yu6cxgKBBXbNsTkT9cyMd4g_16 = {((NI) 0),
426 ((NI) -1)}
427 ;
428 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_17, "..", 2);
429 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_18, "HOME", 4);
430 extern TNimType NTIrefioerror__HMIVdYjdZYWskTmTQVo5BQ_;
431 extern TNimType NTIioerror__iLZrPn9anoh9ad1MmO0RczFw_;
432 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_19, "Failed to create \'", 18);
433 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_20, "(", 1);
434 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_21, ", ", 2);
435 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_22, "\"", 1);
436 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_23, "\\a", 2);
437 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_24, "\\b", 2);
438 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_25, "\\t", 2);
439 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_26, "\\n", 2);
440 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_27, "\\v", 2);
441 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_28, "\\f", 2);
442 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_29, "\\r", 2);
443 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_30, "\\e", 2);
444 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_31, "\\\\", 2);
445 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_32, "\\\'", 2);
446 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_33, "\\\"", 2);
447 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_34, "\\x", 2);
448 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_35, "0123456789ABCDEF", 16);
449 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_36, ",", 1);
450 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_37, ")", 1);
451 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_38, "PATH", 4);
452 N_LIB_PRIVATE NIM_CONST tyArray__nHXaesL0DJZHyVS07ARPRA ExeExts__pureZos_653 = {((NimStringDesc*) NIM_NIL)}
453 ;
454 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_40, "os.nim(1851, 12) `card(copyFlagSymlink * options) == 1` There should be exactly one cfSymlink* in options", 105);
455 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_43, "XDG_CONFIG_HOME", 15);
456 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_44, ".config", 7);
457 N_LIB_PRIVATE TNimType NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_;
458 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_49, "{", 1);
459 STRING_LITERAL(TM__yu6cxgKBBXbNsTkT9cyMd4g_50, "}", 1);
460 extern int cmdCount;
461 extern NCSTRING* cmdLine;
462 extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__system_5218;
463 extern TSafePoint* excHandler__system_2565;
464 extern TSafePoint* excHandler__system_2565;
465 extern TSafePoint* excHandler__system_2565;
466 extern TSafePoint* excHandler__system_2565;
467 extern Exception* currException__system_2566;
468 extern Exception* currException__system_2566;
N_INLINE(NI,minuspercent___system_716)469 static N_INLINE(NI, minuspercent___system_716)(NI x, NI y) {
470 	NI result;
471 	result = (NI)0;
472 	result = ((NI) ((NU)((NU64)(((NU) (x))) - (NU64)(((NU) (y))))));
473 	return result;
474 }
N_INLINE(NIM_BOOL,ltpercent___system_1005)475 static N_INLINE(NIM_BOOL, ltpercent___system_1005)(NI x, NI y) {
476 	NIM_BOOL result;
477 	result = (NIM_BOOL)0;
478 	result = ((NU64)(((NU) (x))) < (NU64)(((NU) (y))));
479 	return result;
480 }
N_INLINE(void,rtlAddZCT__system_5314)481 static N_INLINE(void, rtlAddZCT__system_5314)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
482 	addZCT__system_5265((&gch__system_5218.zct), c);
483 }
N_INLINE(void,decRef__system_5316)484 static N_INLINE(void, decRef__system_5316)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
485 	(*c).refcount = minuspercent___system_716((*c).refcount, ((NI) 8));
486 	{
487 		NIM_BOOL T3_;
488 		T3_ = (NIM_BOOL)0;
489 		T3_ = ltpercent___system_1005((*c).refcount, ((NI) 8));
490 		if (!T3_) goto LA4_;
491 		rtlAddZCT__system_5314(c);
492 	}
493 	LA4_: ;
494 }
N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g *,usrToCell__system_5271)495 static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__system_5271)(void* usr) {
496 	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
497 	NI T1_;
498 	result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
499 	T1_ = (NI)0;
500 	T1_ = minuspercent___system_716(((NI) (ptrdiff_t) (usr)), ((NI) 16));
501 	result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) (T1_));
502 	return result;
503 }
N_INLINE(void,nimGCunrefNoCycle)504 static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
505 	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T1_;
506 	T1_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
507 	T1_ = usrToCell__system_5271(p);
508 	decRef__system_5316(T1_);
509 }
N_NIMCALL(tySequence__sM4lkSb7zS6F7OVMvW9cffQ *,nosparseCmdLine)510 N_LIB_PRIVATE N_NIMCALL(tySequence__sM4lkSb7zS6F7OVMvW9cffQ*, nosparseCmdLine)(NimStringDesc* c) {
511 	tySequence__sM4lkSb7zS6F7OVMvW9cffQ* result;
512 	NI i;
513 	NimStringDesc* a;
514 	result = NIM_NIL;
515 	result = NIM_NIL;
516 	i = ((NI) 0);
517 	a = ((NimStringDesc*) NIM_NIL);
518 	{
519 		while (1) {
520 			NI T25_;
521 			NimStringDesc* T26_;
522 			a = setLengthStr(a, ((NI) 0));
523 			{
524 				while (1) {
525 					NIM_BOOL T5_;
526 					T5_ = (NIM_BOOL)0;
527 					T5_ = (i < (c ? c->Sup.len : 0));
528 					if (!(T5_)) goto LA6_;
529 					T5_ = (((NU8)(c->data[i])) == ((NU8)(32)) || ((NU8)(c->data[i])) == ((NU8)(9)) || ((NU8)(c->data[i])) == ((NU8)(10)) || ((NU8)(c->data[i])) == ((NU8)(13)));
530 					LA6_: ;
531 					if (!T5_) goto LA4;
532 					i += ((NI) 1);
533 				} LA4: ;
534 			}
535 			{
536 				if (!((c ? c->Sup.len : 0) <= i)) goto LA9_;
537 				goto LA1;
538 			}
539 			LA9_: ;
540 			switch (((NU8)(c->data[i]))) {
541 			case 39:
542 			case 34:
543 			{
544 				NIM_CHAR delim;
545 				delim = c->data[i];
546 				i += ((NI) 1);
547 				{
548 					while (1) {
549 						NIM_BOOL T14_;
550 						T14_ = (NIM_BOOL)0;
551 						T14_ = (i < (c ? c->Sup.len : 0));
552 						if (!(T14_)) goto LA15_;
553 						T14_ = !(((NU8)(c->data[i]) == (NU8)(delim)));
554 						LA15_: ;
555 						if (!T14_) goto LA13;
556 						a = addChar(a, c->data[i]);
557 						i += ((NI) 1);
558 					} LA13: ;
559 				}
560 				{
561 					if (!(i < (c ? c->Sup.len : 0))) goto LA18_;
562 					i += ((NI) 1);
563 				}
564 				LA18_: ;
565 			}
566 			break;
567 			default:
568 			{
569 				{
570 					while (1) {
571 						NIM_BOOL T23_;
572 						T23_ = (NIM_BOOL)0;
573 						T23_ = (i < (c ? c->Sup.len : 0));
574 						if (!(T23_)) goto LA24_;
575 						T23_ = ((NU8)(32) < (NU8)(c->data[i]));
576 						LA24_: ;
577 						if (!T23_) goto LA22;
578 						a = addChar(a, c->data[i]);
579 						i += ((NI) 1);
580 					} LA22: ;
581 				}
582 			}
583 			break;
584 			}
585 			result = (tySequence__sM4lkSb7zS6F7OVMvW9cffQ*) incrSeqV3((TGenericSeq*)(result), (&NTIseqLstringT__sM4lkSb7zS6F7OVMvW9cffQ_));
586 			T25_ = result->Sup.len++;
587 			T26_ = NIM_NIL;
588 			T26_ = result->data[T25_]; result->data[T25_] = copyStringRC1(a);
589 			if (T26_) nimGCunrefNoCycle(T26_);
590 		}
591 	} LA1: ;
592 	return result;
593 }
N_NIMCALL(NI,paramCount__pureZos_1561)594 N_LIB_PRIVATE N_NIMCALL(NI, paramCount__pureZos_1561)(void) {
595 	NI result;
596 	result = (NI)0;
597 	result = ((NI) ((NI32)(cmdCount - ((NI32) 1))));
598 	return result;
599 }
N_INLINE(void,nimCopyMem)600 static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
601 	void* T1_;
602 	T1_ = (void*)0;
603 	T1_ = memcpy(dest, source, ((size_t) (size)));
604 }
N_INLINE(void,copyMem__system_1727)605 static N_INLINE(void, copyMem__system_1727)(void* dest, void* source, NI size) {
606 	nimCopyMem(dest, source, size);
607 }
N_INLINE(void,appendString)608 static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
609 	{
610 		if (!!((src == ((NimStringDesc*) NIM_NIL)))) goto LA3_;
611 		copyMem__system_1727(((void*) ((&(*dest).data[(*dest).Sup.len]))), ((void*) ((*src).data)), ((NI) ((NI)((*src).Sup.len + ((NI) 1)))));
612 		(*dest).Sup.len += (*src).Sup.len;
613 	}
614 	LA3_: ;
615 }
N_INLINE(NI,pluspercent___system_696)616 static N_INLINE(NI, pluspercent___system_696)(NI x, NI y) {
617 	NI result;
618 	result = (NI)0;
619 	result = ((NI) ((NU)((NU64)(((NU) (x))) + (NU64)(((NU) (y))))));
620 	return result;
621 }
N_INLINE(void,incRef__system_5309)622 static N_INLINE(void, incRef__system_5309)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
623 	(*c).refcount = pluspercent___system_696((*c).refcount, ((NI) 8));
624 }
N_INLINE(void,asgnRef)625 static N_INLINE(void, asgnRef)(void** dest, void* src) {
626 	{
627 		tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T5_;
628 		if (!!((src == NIM_NIL))) goto LA3_;
629 		T5_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
630 		T5_ = usrToCell__system_5271(src);
631 		incRef__system_5309(T5_);
632 	}
633 	LA3_: ;
634 	{
635 		tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T10_;
636 		if (!!(((*dest) == NIM_NIL))) goto LA8_;
637 		T10_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
638 		T10_ = usrToCell__system_5271((*dest));
639 		decRef__system_5316(T10_);
640 	}
641 	LA8_: ;
642 	(*dest) = src;
643 }
N_NIMCALL(NimStringDesc *,paramStr__pureZos_1555)644 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, paramStr__pureZos_1555)(NI i) {
645 	NimStringDesc* result;
646 	result = NIM_NIL;
647 	{
648 		NIM_BOOL T3_;
649 		T3_ = (NIM_BOOL)0;
650 		T3_ = (i < ((NI) (cmdCount)));
651 		if (!(T3_)) goto LA4_;
652 		T3_ = (((NI) 0) <= i);
653 		LA4_: ;
654 		if (!T3_) goto LA5_;
655 		result = cstrToNimstr(cmdLine[i]);
656 	}
657 	goto LA1_;
658 	LA5_: ;
659 	{
660 		tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ* T8_;
661 		T8_ = NIM_NIL;
662 		T8_ = (tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ*) newObj((&NTIrefindexdefect__RJnHOb9cQV3neNC9cDkRgMyw_), sizeof(tyObject_IndexDefect__n6tGEPHKkh7E1AP9bj30WrQ));
663 		(*T8_).Sup.Sup.Sup.m_type = (&NTIindexdefect__n6tGEPHKkh7E1AP9bj30WrQ_);
664 		(*T8_).Sup.Sup.name = "IndexDefect";
665 		{
666 			NimStringDesc* T13_;
667 			if (!((NI32)(cmdCount - ((NI32) 1)) < ((NI32) 0))) goto LA11_;
668 			T13_ = NIM_NIL;
669 			T13_ = (*T8_).Sup.Sup.message; (*T8_).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_2));
670 			if (T13_) nimGCunrefNoCycle(T13_);
671 		}
672 		goto LA9_;
673 		LA11_: ;
674 		{
675 			NimStringDesc* T15_;
676 			NimStringDesc* T16_;
677 			NimStringDesc* T17_;
678 			T15_ = NIM_NIL;
679 			T16_ = NIM_NIL;
680 			T16_ = dollar___systemZdollars_3(i);
681 			T17_ = NIM_NIL;
682 			T17_ = dollar___systemZdollars_3(((NI) ((NI32)(cmdCount - ((NI32) 1)))));
683 			T15_ = rawNewString((T16_ ? T16_->Sup.len : 0) + (T17_ ? T17_->Sup.len : 0) + 19);
684 appendString(T15_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_3));
685 appendString(T15_, T16_);
686 appendString(T15_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_4));
687 appendString(T15_, T17_);
688 			asgnRef((void**) (&(*T8_).Sup.Sup.message), T15_);
689 		}
690 		LA9_: ;
691 		asgnRef((void**) (&(*T8_).Sup.Sup.parent), ((Exception*) NIM_NIL));
692 		raiseExceptionEx((Exception*)T8_, "IndexDefect", "paramStr", "os.nim", 2965);
693 	}
694 	LA1_: ;
695 	return result;
696 }
N_NIMCALL(NimStringDesc *,nospquoteShellPosix)697 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShellPosix)(NimStringDesc* s) {
698 	NimStringDesc* result;
699 	result = NIM_NIL;
700 	{
701 		if (!((s ? s->Sup.len : 0) == ((NI) 0))) goto LA3_;
702 		result = copyString(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_5));
703 	}
704 	goto LA1_;
705 	LA3_: ;
706 	{
707 		NIM_BOOL T6_;
708 		T6_ = (NIM_BOOL)0;
709 		T6_ = allCharsInSet__pureZstrutils_1341(s, TM__yu6cxgKBBXbNsTkT9cyMd4g_6);
710 		if (!T6_) goto LA7_;
711 		result = copyString(s);
712 	}
713 	goto LA1_;
714 	LA7_: ;
715 	{
716 		NimStringDesc* T10_;
717 		NimStringDesc* T11_;
718 		T10_ = NIM_NIL;
719 		T11_ = NIM_NIL;
720 		T11_ = nsuReplaceStr(s, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_7), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_8));
721 		T10_ = rawNewString((T11_ ? T11_->Sup.len : 0) + 2);
722 appendString(T10_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_7));
723 appendString(T10_, T11_);
724 appendString(T10_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_7));
725 		result = T10_;
726 	}
727 	LA1_: ;
728 	return result;
729 }
N_NIMCALL(NimStringDesc *,nospquoteShell)730 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nospquoteShell)(NimStringDesc* s) {
731 	NimStringDesc* result;
732 	result = NIM_NIL;
733 	result = nospquoteShellPosix(s);
734 	return result;
735 }
N_NIMCALL(NimStringDesc *,nosunixToNativePath)736 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosunixToNativePath)(NimStringDesc* path, NimStringDesc* drive) {
737 	NimStringDesc* result;
738 	result = NIM_NIL;
739 	result = copyString(path);
740 	return result;
741 }
N_NIMCALL(NimStringDesc *,quoteShellCommand__pureZos_611)742 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, quoteShellCommand__pureZos_611)(NimStringDesc** args, NI argsLen_0) {
743 	NimStringDesc* result;
744 	result = NIM_NIL;
745 	result = ((NimStringDesc*) NIM_NIL);
746 	{
747 		NI i;
748 		NI colontmp_;
749 		NI i_2;
750 		i = (NI)0;
751 		colontmp_ = (NI)0;
752 		colontmp_ = argsLen_0;
753 		i_2 = ((NI) 0);
754 		{
755 			while (1) {
756 				NimStringDesc* T8_;
757 				if (!(i_2 < colontmp_)) goto LA3;
758 				i = i_2;
759 				{
760 					if (!(((NI) 0) < i)) goto LA6_;
761 					result = resizeString(result, 1);
762 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_9));
763 				}
764 				LA6_: ;
765 				T8_ = NIM_NIL;
766 				T8_ = nospquoteShell(args[i]);
767 				result = resizeString(result, (T8_ ? T8_->Sup.len : 0) + 0);
768 appendString(result, T8_);
769 				i_2 += ((NI) 1);
770 			} LA3: ;
771 		}
772 	}
773 	return result;
774 }
N_INLINE(NIM_CHAR,X5BX5D___system_7329)775 static N_INLINE(NIM_CHAR, X5BX5D___system_7329)(NimStringDesc* s, NI i) {
776 	NIM_CHAR result;
777 	result = (NIM_CHAR)0;
778 	result = s->data[(NI)((s ? s->Sup.len : 0) - i)];
779 	return result;
780 }
N_INLINE(NIM_CHAR *,X5BX5D___system_7362)781 static N_INLINE(NIM_CHAR*, X5BX5D___system_7362)(NimStringDesc** s, NI i) {
782 	NIM_CHAR* result;
783 	result = (NIM_CHAR*)0;
784 	result = (&(*s)->data[(NI)(((*s) ? (*s)->Sup.len : 0) - i)]);
785 	return result;
786 }
N_NIMCALL(void,normalizePathEnd__pureZos_51)787 N_LIB_PRIVATE N_NIMCALL(void, normalizePathEnd__pureZos_51)(NimStringDesc** path, NIM_BOOL trailingSep) {
788 	NI i;
789 {	{
790 		if (!(((*path) ? (*path)->Sup.len : 0) == ((NI) 0))) goto LA3_;
791 		goto BeforeRet_;
792 	}
793 	LA3_: ;
794 	i = ((*path) ? (*path)->Sup.len : 0);
795 	{
796 		while (1) {
797 			if (!(((NI) 1) <= i)) goto LA6;
798 			{
799 				if (!(((NU8)((*path)->data[(NI)(i - ((NI) 1))])) == ((NU8)(47)) || ((NU8)((*path)->data[(NI)(i - ((NI) 1))])) == ((NU8)(47)))) goto LA9_;
800 				i -= ((NI) 1);
801 			}
802 			goto LA7_;
803 			LA9_: ;
804 			{
805 				NIM_BOOL T12_;
806 				NIM_BOOL T13_;
807 				T12_ = (NIM_BOOL)0;
808 				T13_ = (NIM_BOOL)0;
809 				T13_ = ((NU8)((*path)->data[(NI)(i - ((NI) 1))]) == (NU8)(46));
810 				if (!(T13_)) goto LA14_;
811 				T13_ = (((NI) 2) <= i);
812 				LA14_: ;
813 				T12_ = T13_;
814 				if (!(T12_)) goto LA15_;
815 				T12_ = (((NU8)((*path)->data[(NI)(i - ((NI) 2))])) == ((NU8)(47)) || ((NU8)((*path)->data[(NI)(i - ((NI) 2))])) == ((NU8)(47)));
816 				LA15_: ;
817 				if (!T12_) goto LA16_;
818 				i -= ((NI) 1);
819 			}
820 			goto LA7_;
821 			LA16_: ;
822 			{
823 				goto LA5;
824 			}
825 			LA7_: ;
826 		} LA6: ;
827 	} LA5: ;
828 	{
829 		if (!trailingSep) goto LA21_;
830 		unsureAsgnRef((void**) (&(*path)), setLengthStr((*path), ((NI) (i))));
831 		unsureAsgnRef((void**) (&(*path)), addChar((*path), 47));
832 	}
833 	goto LA19_;
834 	LA21_: ;
835 	{
836 		if (!(((NI) 0) < i)) goto LA24_;
837 		unsureAsgnRef((void**) (&(*path)), setLengthStr((*path), ((NI) (i))));
838 	}
839 	goto LA19_;
840 	LA24_: ;
841 	{
842 		unsureAsgnRef((void**) (&(*path)), copyString(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_10)));
843 	}
844 	LA19_: ;
845 	}BeforeRet_: ;
846 }
N_NIMCALL(void,joinPathImpl__pureZos_82)847 N_LIB_PRIVATE N_NIMCALL(void, joinPathImpl__pureZos_82)(NimStringDesc** result, NI* state, NimStringDesc* tail) {
848 	NIM_BOOL trailingSep;
849 	NIM_BOOL T1_;
850 	NIM_BOOL T2_;
851 	NIM_CHAR T4_;
852 	NIM_BOOL T6_;
853 	NIM_BOOL T8_;
854 	NIM_CHAR* T10_;
855 	T1_ = (NIM_BOOL)0;
856 	T2_ = (NIM_BOOL)0;
857 	T2_ = (((NI) 0) < (tail ? tail->Sup.len : 0));
858 	if (!(T2_)) goto LA3_;
859 	T4_ = (NIM_CHAR)0;
860 	T4_ = X5BX5D___system_7329(tail, ((NI) 1));
861 	T2_ = (((NU8)(T4_)) == ((NU8)(47)) || ((NU8)(T4_)) == ((NU8)(47)));
862 	LA3_: ;
863 	T1_ = T2_;
864 	if (T1_) goto LA5_;
865 	T6_ = (NIM_BOOL)0;
866 	T6_ = ((tail ? tail->Sup.len : 0) == ((NI) 0));
867 	if (!(T6_)) goto LA7_;
868 	T8_ = (NIM_BOOL)0;
869 	T8_ = (((NI) 0) < ((*result) ? (*result)->Sup.len : 0));
870 	if (!(T8_)) goto LA9_;
871 	T10_ = (NIM_CHAR*)0;
872 	T10_ = X5BX5D___system_7362(result, ((NI) 1));
873 	T8_ = (((NU8)((*T10_))) == ((NU8)(47)) || ((NU8)((*T10_))) == ((NU8)(47)));
874 	LA9_: ;
875 	T6_ = T8_;
876 	LA7_: ;
877 	T1_ = T6_;
878 	LA5_: ;
879 	trailingSep = T1_;
880 	normalizePathEnd__pureZos_51(result, NIM_FALSE);
881 	addNormalizePath__pureZpathnorm_71(tail, result, state, 47);
882 	normalizePathEnd__pureZos_51(result, trailingSep);
883 }
N_NIMCALL(NimStringDesc *,nosjoinPath)884 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosjoinPath)(NimStringDesc* head, NimStringDesc* tail) {
885 	NimStringDesc* result;
886 	NI state;
887 	result = NIM_NIL;
888 	result = rawNewString(((NI) ((NI)((head ? head->Sup.len : 0) + (tail ? tail->Sup.len : 0)))));
889 	state = ((NI) 0);
890 	joinPathImpl__pureZos_82((&result), (&state), head);
891 	joinPathImpl__pureZos_82((&result), (&state), tail);
892 	return result;
893 }
N_NIMCALL(NimStringDesc *,normalizePathEnd__pureZos_71)894 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normalizePathEnd__pureZos_71)(NimStringDesc* path, NIM_BOOL trailingSep) {
895 	NimStringDesc* result;
896 	result = NIM_NIL;
897 	result = copyString(path);
898 	normalizePathEnd__pureZos_51((&result), trailingSep);
899 	return result;
900 }
N_NIMCALL(void,nossplitPath)901 N_LIB_PRIVATE N_NIMCALL(void, nossplitPath)(NimStringDesc* path, tyTuple__UV3llMMYFckfui8YMBuUZA* Result) {
902 	NI sepPos;
903 	unsureAsgnRef((void**)&(*Result).Field0, NIM_NIL);
904 	unsureAsgnRef((void**)&(*Result).Field1, NIM_NIL);
905 	sepPos = ((NI) -1);
906 	{
907 		NI i;
908 		NI colontmp_;
909 		NI res;
910 		i = (NI)0;
911 		colontmp_ = (NI)0;
912 		colontmp_ = (NI)((path ? path->Sup.len : 0) - ((NI) 1));
913 		res = colontmp_;
914 		{
915 			while (1) {
916 				if (!(((NI) 0) <= res)) goto LA3;
917 				i = res;
918 				{
919 					if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA6_;
920 					sepPos = i;
921 					goto LA1;
922 				}
923 				LA6_: ;
924 				res -= ((NI) 1);
925 			} LA3: ;
926 		}
927 	} LA1: ;
928 	{
929 		NI T12_;
930 		if (!(((NI) 0) <= sepPos)) goto LA10_;
931 		T12_ = (NI)0;
932 		{
933 			NIM_BOOL T15_;
934 			T15_ = (NIM_BOOL)0;
935 			T15_ = NIM_LIKELY((((NI) 1) <= sepPos));
936 			if (!T15_) goto LA16_;
937 			T12_ = (NI)(sepPos - ((NI) 1));
938 		}
939 		goto LA13_;
940 		LA16_: ;
941 		{
942 			T12_ = ((NI) 0);
943 		}
944 		LA13_: ;
945 		unsureAsgnRef((void**) (&(*Result).Field0), substr__system_7744(path, ((NI) 0), T12_));
946 		unsureAsgnRef((void**) (&(*Result).Field1), substr__system_7756(path, (NI)(sepPos + ((NI) 1))));
947 	}
948 	goto LA8_;
949 	LA10_: ;
950 	{
951 		unsureAsgnRef((void**) (&(*Result).Field0), ((NimStringDesc*) NIM_NIL));
952 		unsureAsgnRef((void**) (&(*Result).Field1), copyString(path));
953 	}
954 	LA8_: ;
955 }
N_INLINE(void,nimSetMem__systemZmemory_7)956 static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) {
957 	void* T1_;
958 	T1_ = (void*)0;
959 	T1_ = memset(a, v, ((size_t) (size)));
960 }
N_INLINE(void,nimZeroMem)961 static N_INLINE(void, nimZeroMem)(void* p, NI size) {
962 	nimSetMem__systemZmemory_7(p, ((int) 0), size);
963 }
N_NIMCALL(NimStringDesc *,nosextractFilename)964 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosextractFilename)(NimStringDesc* path) {
965 	NimStringDesc* result;
966 	result = NIM_NIL;
967 	{
968 		NIM_BOOL T3_;
969 		T3_ = (NIM_BOOL)0;
970 		T3_ = ((path ? path->Sup.len : 0) == ((NI) 0));
971 		if (T3_) goto LA4_;
972 		T3_ = (((NU8)(path->data[(NI)((path ? path->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path->data[(NI)((path ? path->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)));
973 		LA4_: ;
974 		if (!T3_) goto LA5_;
975 		result = ((NimStringDesc*) NIM_NIL);
976 	}
977 	goto LA1_;
978 	LA5_: ;
979 	{
980 		tyTuple__UV3llMMYFckfui8YMBuUZA T8_;
981 		nimZeroMem((void*)(&T8_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
982 		nossplitPath(path, (&T8_));
983 		result = copyString(T8_.Field1);
984 	}
985 	LA1_: ;
986 	return result;
987 }
N_NIMCALL(NimStringDesc *,noslastPathPart)988 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, noslastPathPart)(NimStringDesc* path) {
989 	NimStringDesc* result;
990 	NimStringDesc* path_2;
991 	result = NIM_NIL;
992 	path_2 = normalizePathEnd__pureZos_71(path, NIM_FALSE);
993 	result = nosextractFilename(path_2);
994 	return result;
995 }
N_NIMCALL(NI,noscmpPaths)996 N_LIB_PRIVATE N_NIMCALL(NI, noscmpPaths)(NimStringDesc* pathA, NimStringDesc* pathB) {
997 	NI result;
998 	NimStringDesc* a;
999 	NimStringDesc* b;
1000 	result = (NI)0;
1001 	a = normalizePath__pureZpathnorm_127(pathA, 47);
1002 	b = normalizePath__pureZpathnorm_127(pathB, 47);
1003 	{
1004 		if (!NIM_FALSE) goto LA3_;
1005 		result = cmp__system_1549(a, b);
1006 	}
1007 	goto LA1_;
1008 	LA3_: ;
1009 	{
1010 		result = nsuCmpIgnoreCase(a, b);
1011 	}
1012 	LA1_: ;
1013 	return result;
1014 }
N_NIMCALL(void,nossplitFile)1015 N_LIB_PRIVATE N_NIMCALL(void, nossplitFile)(NimStringDesc* path, tyTuple__7q7q3E6Oj24ZNVJb9aonhAg* Result) {
1016 	NI namePos;
1017 	NI dotPos;
1018 	unsureAsgnRef((void**)&(*Result).Field0, NIM_NIL);
1019 	unsureAsgnRef((void**)&(*Result).Field1, NIM_NIL);
1020 	unsureAsgnRef((void**)&(*Result).Field2, NIM_NIL);
1021 	namePos = ((NI) 0);
1022 	dotPos = ((NI) 0);
1023 	{
1024 		NI i;
1025 		NI colontmp_;
1026 		NI res;
1027 		i = (NI)0;
1028 		colontmp_ = (NI)0;
1029 		colontmp_ = (NI)((path ? path->Sup.len : 0) - ((NI) 1));
1030 		res = colontmp_;
1031 		{
1032 			while (1) {
1033 				if (!(((NI) 0) <= res)) goto LA3;
1034 				i = res;
1035 				{
1036 					NIM_BOOL T6_;
1037 					T6_ = (NIM_BOOL)0;
1038 					T6_ = (((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)));
1039 					if (T6_) goto LA7_;
1040 					T6_ = (i == ((NI) 0));
1041 					LA7_: ;
1042 					if (!T6_) goto LA8_;
1043 					{
1044 						NI T14_;
1045 						if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA12_;
1046 						T14_ = (NI)0;
1047 						{
1048 							NIM_BOOL T17_;
1049 							T17_ = (NIM_BOOL)0;
1050 							T17_ = NIM_LIKELY((((NI) 1) <= i));
1051 							if (!T17_) goto LA18_;
1052 							T14_ = (NI)(i - ((NI) 1));
1053 						}
1054 						goto LA15_;
1055 						LA18_: ;
1056 						{
1057 							T14_ = ((NI) 0);
1058 						}
1059 						LA15_: ;
1060 						unsureAsgnRef((void**) (&(*Result).Field0), substr__system_7744(path, ((NI) 0), T14_));
1061 						namePos = (NI)(i + ((NI) 1));
1062 					}
1063 					LA12_: ;
1064 					{
1065 						if (!(i < dotPos)) goto LA23_;
1066 						unsureAsgnRef((void**) (&(*Result).Field1), substr__system_7744(path, namePos, (NI)(dotPos - ((NI) 1))));
1067 						unsureAsgnRef((void**) (&(*Result).Field2), substr__system_7756(path, dotPos));
1068 					}
1069 					goto LA21_;
1070 					LA23_: ;
1071 					{
1072 						unsureAsgnRef((void**) (&(*Result).Field1), substr__system_7756(path, namePos));
1073 					}
1074 					LA21_: ;
1075 					goto LA1;
1076 				}
1077 				goto LA4_;
1078 				LA8_: ;
1079 				{
1080 					NIM_BOOL T27_;
1081 					NIM_BOOL T28_;
1082 					NIM_BOOL T29_;
1083 					NIM_BOOL T30_;
1084 					NIM_BOOL T31_;
1085 					T27_ = (NIM_BOOL)0;
1086 					T28_ = (NIM_BOOL)0;
1087 					T29_ = (NIM_BOOL)0;
1088 					T30_ = (NIM_BOOL)0;
1089 					T31_ = (NIM_BOOL)0;
1090 					T31_ = ((NU8)(path->data[i]) == (NU8)(46));
1091 					if (!(T31_)) goto LA32_;
1092 					T31_ = (((NI) 0) < i);
1093 					LA32_: ;
1094 					T30_ = T31_;
1095 					if (!(T30_)) goto LA33_;
1096 					T30_ = (i < (NI)((path ? path->Sup.len : 0) - ((NI) 1)));
1097 					LA33_: ;
1098 					T29_ = T30_;
1099 					if (!(T29_)) goto LA34_;
1100 					T29_ = !((((NU8)(path->data[(NI)(i - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path->data[(NI)(i - ((NI) 1))])) == ((NU8)(47))));
1101 					LA34_: ;
1102 					T28_ = T29_;
1103 					if (!(T28_)) goto LA35_;
1104 					T28_ = !(((NU8)(path->data[(NI)(i + ((NI) 1))]) == (NU8)(46)));
1105 					LA35_: ;
1106 					T27_ = T28_;
1107 					if (!(T27_)) goto LA36_;
1108 					T27_ = (dotPos == ((NI) 0));
1109 					LA36_: ;
1110 					if (!T27_) goto LA37_;
1111 					dotPos = i;
1112 				}
1113 				goto LA4_;
1114 				LA37_: ;
1115 				LA4_: ;
1116 				res -= ((NI) 1);
1117 			} LA3: ;
1118 		}
1119 	} LA1: ;
1120 }
N_INLINE(int,nimCmpMem)1121 static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size) {
1122 	int result;
1123 	result = (int)0;
1124 	result = memcmp(a, b, ((size_t) (size)));
1125 	return result;
1126 }
N_INLINE(NIM_BOOL,equalMem__system_1735)1127 static N_INLINE(NIM_BOOL, equalMem__system_1735)(void* a, void* b, NI size) {
1128 	NIM_BOOL result;
1129 	int T1_;
1130 	result = (NIM_BOOL)0;
1131 	T1_ = (int)0;
1132 	T1_ = nimCmpMem(a, b, size);
1133 	result = (T1_ == ((NI32) 0));
1134 	return result;
1135 }
N_INLINE(NIM_BOOL,eqStrings)1136 static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b) {
1137 	NIM_BOOL result;
1138 	NI alen;
1139 	NI blen;
1140 {	result = (NIM_BOOL)0;
1141 	alen = (a ? a->Sup.len : 0);
1142 	blen = (b ? b->Sup.len : 0);
1143 	{
1144 		if (!(alen == blen)) goto LA3_;
1145 		{
1146 			if (!(alen == ((NI) 0))) goto LA7_;
1147 			result = NIM_TRUE;
1148 			goto BeforeRet_;
1149 		}
1150 		LA7_: ;
1151 		result = equalMem__system_1735(((void*) ((&a->data[((NI) 0)]))), ((void*) ((&b->data[((NI) 0)]))), ((NI) (alen)));
1152 		goto BeforeRet_;
1153 	}
1154 	LA3_: ;
1155 	}BeforeRet_: ;
1156 	return result;
1157 }
N_NIMCALL(void,nosnormalizePath)1158 N_LIB_PRIVATE N_NIMCALL(void, nosnormalizePath)(NimStringDesc** path) {
1159 	unsureAsgnRef((void**) (&(*path)), normalizePath__pureZpathnorm_127((*path), 47));
1160 }
N_INLINE(void,normalizePathAux__pureZos_31)1161 static N_INLINE(void, normalizePathAux__pureZos_31)(NimStringDesc** path) {
1162 	nosnormalizePath(path);
1163 }
N_NIMCALL(NIM_BOOL,nosisAbsolute)1164 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisAbsolute)(NimStringDesc* path) {
1165 	NIM_BOOL result;
1166 {	result = (NIM_BOOL)0;
1167 	{
1168 		if (!((path ? path->Sup.len : 0) == ((NI) 0))) goto LA3_;
1169 		result = NIM_FALSE;
1170 		goto BeforeRet_;
1171 	}
1172 	LA3_: ;
1173 	result = ((NU8)(path->data[((NI) 0)]) == (NU8)(47));
1174 	}BeforeRet_: ;
1175 	return result;
1176 }
N_NIMCALL(NimStringDesc *,absolutePath__pureZos_743)1177 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, absolutePath__pureZos_743)(NimStringDesc* path, NimStringDesc* root) {
1178 	NimStringDesc* result;
1179 	result = NIM_NIL;
1180 	{
1181 		NIM_BOOL T3_;
1182 		T3_ = (NIM_BOOL)0;
1183 		T3_ = nosisAbsolute(path);
1184 		if (!T3_) goto LA4_;
1185 		result = copyString(path);
1186 	}
1187 	goto LA1_;
1188 	LA4_: ;
1189 	{
1190 		{
1191 			NIM_BOOL T9_;
1192 			tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T12_;
1193 			NimStringDesc* T13_;
1194 			T9_ = (NIM_BOOL)0;
1195 			T9_ = nosisAbsolute(root);
1196 			if (!!(T9_)) goto LA10_;
1197 			T12_ = NIM_NIL;
1198 			T12_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTIrefvalueerror__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
1199 			(*T12_).Sup.Sup.Sup.m_type = (&NTIvalueerror__yoNlBGx0D2tRizIdhQuENw_);
1200 			(*T12_).Sup.Sup.name = "ValueError";
1201 			T13_ = NIM_NIL;
1202 			T13_ = rawNewString((root ? root->Sup.len : 0) + 36);
1203 appendString(T13_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_12));
1204 appendString(T13_, root);
1205 			asgnRef((void**) (&(*T12_).Sup.Sup.message), T13_);
1206 			asgnRef((void**) (&(*T12_).Sup.Sup.parent), ((Exception*) NIM_NIL));
1207 			raiseExceptionEx((Exception*)T12_, "ValueError", "absolutePath", "os.nim", 1455);
1208 		}
1209 		LA10_: ;
1210 		result = nosjoinPath(root, path);
1211 	}
1212 	LA1_: ;
1213 	return result;
1214 }
N_INLINE(NIM_BOOL,eqeq___system_7724)1215 static N_INLINE(NIM_BOOL, eqeq___system_7724)(NCSTRING x, NCSTRING y) {
1216 	NIM_BOOL result;
1217 	result = (NIM_BOOL)0;
1218 	{
1219 		if (!(((void*) (x)) == ((void*) (y)))) goto LA3_;
1220 		result = NIM_TRUE;
1221 	}
1222 	goto LA1_;
1223 	LA3_: ;
1224 	{
1225 		NIM_BOOL T6_;
1226 		T6_ = (NIM_BOOL)0;
1227 		T6_ = (x == 0);
1228 		if (T6_) goto LA7_;
1229 		T6_ = (y == 0);
1230 		LA7_: ;
1231 		if (!T6_) goto LA8_;
1232 		result = NIM_FALSE;
1233 	}
1234 	goto LA1_;
1235 	LA8_: ;
1236 	{
1237 		int T11_;
1238 		T11_ = (int)0;
1239 		T11_ = strcmp(x, y);
1240 		result = (T11_ == ((NI32) 0));
1241 	}
1242 	LA1_: ;
1243 	return result;
1244 }
N_INLINE(NCSTRING,nimToCStringConv)1245 static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s) {
1246 	NCSTRING result;
1247 	result = (NCSTRING)0;
1248 	{
1249 		NIM_BOOL T3_;
1250 		T3_ = (NIM_BOOL)0;
1251 		T3_ = (s == ((NimStringDesc*) NIM_NIL));
1252 		if (T3_) goto LA4_;
1253 		T3_ = ((*s).Sup.len == ((NI) 0));
1254 		LA4_: ;
1255 		if (!T3_) goto LA5_;
1256 		result = "";
1257 	}
1258 	goto LA1_;
1259 	LA5_: ;
1260 	{
1261 		result = ((NCSTRING) ((*s).data));
1262 	}
1263 	LA1_: ;
1264 	return result;
1265 }
N_NIMCALL(NI32,osLastError__pureZos_408)1266 N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__pureZos_408)(void) {
1267 	NI32 result;
1268 	result = (NI32)0;
1269 	result = errno;
1270 	return result;
1271 }
N_NIMCALL(NimStringDesc *,osErrorMsg__pureZos_358)1272 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, osErrorMsg__pureZos_358)(NI32 errorCode) {
1273 	NimStringDesc* result;
1274 	result = NIM_NIL;
1275 	result = ((NimStringDesc*) NIM_NIL);
1276 	{
1277 		NCSTRING T5_;
1278 		if (!!((errorCode == ((NI32) 0)))) goto LA3_;
1279 		T5_ = (NCSTRING)0;
1280 		T5_ = strerror(errorCode);
1281 		result = cstrToNimstr(T5_);
1282 	}
1283 	LA3_: ;
1284 	return result;
1285 }
N_NOINLINE(tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA *,newOSError__pureZos_379)1286 N_LIB_PRIVATE N_NOINLINE(tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*, newOSError__pureZos_379)(NI32 errorCode, NimStringDesc* additionalInfo) {
1287 	tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA* result;
1288 	tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA* e;
1289 {	result = NIM_NIL;
1290 	e = NIM_NIL;
1291 	e = (tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA*) newObj((&NTIrefoserror__9clYsYwyjCqe2PFTuCI3Ubg_), sizeof(tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA));
1292 	(*e).Sup.Sup.Sup.m_type = (&NTIoserror__BeJgrOdDsczOwEWOZbRfKA_);
1293 	(*e).Sup.Sup.name = "OSError";
1294 	(*e).errorCode = errorCode;
1295 	asgnRef((void**) (&(*e).Sup.Sup.message), osErrorMsg__pureZos_358(errorCode));
1296 	{
1297 		if (!(((NI) 0) < (additionalInfo ? additionalInfo->Sup.len : 0))) goto LA3_;
1298 		{
1299 			NIM_BOOL T7_;
1300 			NIM_CHAR* T9_;
1301 			T7_ = (NIM_BOOL)0;
1302 			T7_ = (((NI) 0) < ((*e).Sup.Sup.message ? (*e).Sup.Sup.message->Sup.len : 0));
1303 			if (!(T7_)) goto LA8_;
1304 			T9_ = (NIM_CHAR*)0;
1305 			T9_ = X5BX5D___system_7362((&(*e).Sup.Sup.message), ((NI) 1));
1306 			T7_ = !(((NU8)((*T9_)) == (NU8)(10)));
1307 			LA8_: ;
1308 			if (!T7_) goto LA10_;
1309 			asgnRef((void**) (&(*e).Sup.Sup.message), addChar((*e).Sup.Sup.message, 10));
1310 		}
1311 		LA10_: ;
1312 		asgnRef((void**) (&(*e).Sup.Sup.message), resizeString((*e).Sup.Sup.message, 17));
1313 appendString((*e).Sup.Sup.message, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_14));
1314 		asgnRef((void**) (&(*e).Sup.Sup.message), resizeString((*e).Sup.Sup.message, (additionalInfo ? additionalInfo->Sup.len : 0) + 0));
1315 appendString((*e).Sup.Sup.message, additionalInfo);
1316 	}
1317 	LA3_: ;
1318 	{
1319 		NimStringDesc* T16_;
1320 		if (!(((*e).Sup.Sup.message ? (*e).Sup.Sup.message->Sup.len : 0) == 0)) goto LA14_;
1321 		T16_ = NIM_NIL;
1322 		T16_ = (*e).Sup.Sup.message; (*e).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_15));
1323 		if (T16_) nimGCunrefNoCycle(T16_);
1324 	}
1325 	LA14_: ;
1326 	result = e;
1327 	goto BeforeRet_;
1328 	}BeforeRet_: ;
1329 	return result;
1330 }
N_NOINLINE(void,raiseOSError__pureZos_405)1331 N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__pureZos_405)(NI32 errorCode, NimStringDesc* additionalInfo) {
1332 	tyObject_OSError__BeJgrOdDsczOwEWOZbRfKA* T1_;
1333 	T1_ = NIM_NIL;
1334 	T1_ = newOSError__pureZos_379(errorCode, additionalInfo);
1335 	raiseExceptionEx((Exception*)T1_, "OSError", "raiseOSError", "oserr.nim", 95);
1336 }
N_NIMCALL(NimStringDesc *,nosgetCurrentDir)1337 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void) {
1338 	NimStringDesc* result;
1339 	NI bufsize;
1340 	result = NIM_NIL;
1341 	bufsize = ((NI) 1024);
1342 	result = mnewString(((NI) (bufsize)));
1343 	{
1344 		while (1) {
1345 			{
1346 				NCSTRING T5_;
1347 				NIM_BOOL T6_;
1348 				int T9_;
1349 				T5_ = (NCSTRING)0;
1350 				T5_ = getcwd(nimToCStringConv(result), bufsize);
1351 				T6_ = (NIM_BOOL)0;
1352 				T6_ = eqeq___system_7724(T5_, ((NCSTRING) NIM_NIL));
1353 				if (!!(T6_)) goto LA7_;
1354 				T9_ = (int)0;
1355 				T9_ = strlen(nimToCStringConv(result));
1356 				result = setLengthStr(result, ((NI) (T9_)));
1357 				goto LA1;
1358 			}
1359 			goto LA3_;
1360 			LA7_: ;
1361 			{
1362 				NI32 err;
1363 				err = osLastError__pureZos_408();
1364 				{
1365 					if (!(err == ERANGE)) goto LA13_;
1366 					bufsize = (NI)((NU64)(bufsize) << (NU64)(((NI) 1)));
1367 					{
1368 						if (!!((((NI) 0) <= bufsize))) goto LA17_;
1369 						failedAssertImpl__systemZassertions_56(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_13));
1370 					}
1371 					LA17_: ;
1372 					result = mnewString(((NI) (bufsize)));
1373 				}
1374 				goto LA11_;
1375 				LA13_: ;
1376 				{
1377 					NI32 T20_;
1378 					T20_ = (NI32)0;
1379 					T20_ = osLastError__pureZos_408();
1380 					raiseOSError__pureZos_405(T20_, ((NimStringDesc*) NIM_NIL));
1381 				}
1382 				LA11_: ;
1383 			}
1384 			LA3_: ;
1385 		}
1386 	} LA1: ;
1387 	return result;
1388 }
N_NIMCALL(NimStringDesc *,absolutePathInternal__pureZos_49)1389 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, absolutePathInternal__pureZos_49)(NimStringDesc* path) {
1390 	NimStringDesc* result;
1391 	NimStringDesc* T1_;
1392 	result = NIM_NIL;
1393 	T1_ = NIM_NIL;
1394 	T1_ = nosgetCurrentDir();
1395 	result = absolutePath__pureZos_743(path, T1_);
1396 	return result;
1397 }
N_NIMCALL(NimStringDesc *,nosrelativePath)1398 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosrelativePath)(NimStringDesc* path, NimStringDesc* base, NIM_CHAR sep) {
1399 	NimStringDesc* result;
1400 	NimStringDesc* base_2;
1401 	NimStringDesc* path_2;
1402 	NIM_BOOL a1;
1403 	NIM_BOOL a2;
1404 	tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg f;
1405 	tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg b;
1406 	tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ ff;
1407 	tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ bb;
1408 {	result = NIM_NIL;
1409 	{
1410 		if (!((path ? path->Sup.len : 0) == ((NI) 0))) goto LA3_;
1411 		result = ((NimStringDesc*) NIM_NIL);
1412 		goto BeforeRet_;
1413 	}
1414 	LA3_: ;
1415 	{
1416 		if (!eqStrings(base, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11))) goto LA7_;
1417 		base_2 = ((NimStringDesc*) NIM_NIL);
1418 	}
1419 	goto LA5_;
1420 	LA7_: ;
1421 	{
1422 		base_2 = copyString(base);
1423 	}
1424 	LA5_: ;
1425 	path_2 = copyString(path);
1426 	normalizePathAux__pureZos_31((&path_2));
1427 	normalizePathAux__pureZos_31((&base_2));
1428 	a1 = nosisAbsolute(path_2);
1429 	a2 = nosisAbsolute(base_2);
1430 	{
1431 		NIM_BOOL T12_;
1432 		T12_ = (NIM_BOOL)0;
1433 		T12_ = a1;
1434 		if (!(T12_)) goto LA13_;
1435 		T12_ = !(a2);
1436 		LA13_: ;
1437 		if (!T12_) goto LA14_;
1438 		base_2 = absolutePathInternal__pureZos_49(base_2);
1439 	}
1440 	goto LA10_;
1441 	LA14_: ;
1442 	{
1443 		NIM_BOOL T17_;
1444 		T17_ = (NIM_BOOL)0;
1445 		T17_ = a2;
1446 		if (!(T17_)) goto LA18_;
1447 		T17_ = !(a1);
1448 		LA18_: ;
1449 		if (!T17_) goto LA19_;
1450 		path_2 = absolutePathInternal__pureZos_49(path_2);
1451 	}
1452 	goto LA10_;
1453 	LA19_: ;
1454 	LA10_: ;
1455 	nimZeroMem((void*)(&f), sizeof(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg));
1456 	nimZeroMem((void*)(&b), sizeof(tyObject_PathIter__tllF14xUpDWpqG9ci5sg9bMg));
1457 	ff = TM__yu6cxgKBBXbNsTkT9cyMd4g_16;
1458 	bb = TM__yu6cxgKBBXbNsTkT9cyMd4g_16;
1459 	result = rawNewString(((NI) ((path_2 ? path_2->Sup.len : 0))));
1460 	{
1461 		while (1) {
1462 			NIM_BOOL T23_;
1463 			NI diff;
1464 			NIM_BOOL same;
1465 			NI colontmp_;
1466 			NI colontmp__2;
1467 			NI colontmp__3;
1468 			NI colontmp__4;
1469 			T23_ = (NIM_BOOL)0;
1470 			T23_ = hasNext__pureZpathnorm_6(f, path_2);
1471 			if (!(T23_)) goto LA24_;
1472 			T23_ = hasNext__pureZpathnorm_6(b, base_2);
1473 			LA24_: ;
1474 			if (!T23_) goto LA22;
1475 			ff = next__pureZpathnorm_10((&f), path_2);
1476 			bb = next__pureZpathnorm_10((&b), base_2);
1477 			diff = (NI)(ff.Field1 - ff.Field0);
1478 			{
1479 				if (!!((diff == (NI)(bb.Field1 - bb.Field0)))) goto LA27_;
1480 				goto LA21;
1481 			}
1482 			LA27_: ;
1483 			same = NIM_TRUE;
1484 			{
1485 				NI i;
1486 				NI res;
1487 				i = (NI)0;
1488 				res = ((NI) 0);
1489 				{
1490 					while (1) {
1491 						if (!(res <= diff)) goto LA31;
1492 						i = res;
1493 						{
1494 							NIM_CHAR T34_;
1495 							NIM_CHAR T35_;
1496 							T34_ = (NIM_CHAR)0;
1497 							T34_ = nsuToLowerAsciiChar(path_2->data[(NI)(i + ff.Field0)]);
1498 							T35_ = (NIM_CHAR)0;
1499 							T35_ = nsuToLowerAsciiChar(base_2->data[(NI)(i + bb.Field0)]);
1500 							if (!!(((NU8)(T34_) == (NU8)(T35_)))) goto LA36_;
1501 							same = NIM_FALSE;
1502 							goto LA29;
1503 						}
1504 						LA36_: ;
1505 						res += ((NI) 1);
1506 					} LA31: ;
1507 				}
1508 			} LA29: ;
1509 			{
1510 				if (!!(same)) goto LA40_;
1511 				goto LA21;
1512 			}
1513 			LA40_: ;
1514 			colontmp_ = ((NI) 0);
1515 			colontmp__2 = ((NI) -1);
1516 			ff.Field0 = colontmp_;
1517 			ff.Field1 = colontmp__2;
1518 			colontmp__3 = ((NI) 0);
1519 			colontmp__4 = ((NI) -1);
1520 			bb.Field0 = colontmp__3;
1521 			bb.Field1 = colontmp__4;
1522 		} LA22: ;
1523 	} LA21: ;
1524 	{
1525 		while (1) {
1526 			{
1527 				if (!(bb.Field0 <= bb.Field1)) goto LA46_;
1528 				{
1529 					NIM_BOOL T50_;
1530 					NIM_CHAR* T52_;
1531 					T50_ = (NIM_BOOL)0;
1532 					T50_ = (((NI) 0) < (result ? result->Sup.len : 0));
1533 					if (!(T50_)) goto LA51_;
1534 					T52_ = (NIM_CHAR*)0;
1535 					T52_ = X5BX5D___system_7362((&result), ((NI) 1));
1536 					T50_ = !(((NU8)((*T52_)) == (NU8)(sep)));
1537 					LA51_: ;
1538 					if (!T50_) goto LA53_;
1539 					result = addChar(result, sep);
1540 				}
1541 				LA53_: ;
1542 				result = resizeString(result, 2);
1543 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17));
1544 			}
1545 			LA46_: ;
1546 			{
1547 				NIM_BOOL T57_;
1548 				T57_ = (NIM_BOOL)0;
1549 				T57_ = hasNext__pureZpathnorm_6(b, base_2);
1550 				if (!!(T57_)) goto LA58_;
1551 				goto LA42;
1552 			}
1553 			LA58_: ;
1554 			bb = next__pureZpathnorm_10((&b), base_2);
1555 		}
1556 	} LA42: ;
1557 	{
1558 		while (1) {
1559 			{
1560 				if (!(ff.Field0 <= ff.Field1)) goto LA64_;
1561 				{
1562 					NIM_BOOL T68_;
1563 					NIM_CHAR* T70_;
1564 					T68_ = (NIM_BOOL)0;
1565 					T68_ = (((NI) 0) < (result ? result->Sup.len : 0));
1566 					if (!(T68_)) goto LA69_;
1567 					T70_ = (NIM_CHAR*)0;
1568 					T70_ = X5BX5D___system_7362((&result), ((NI) 1));
1569 					T68_ = !(((NU8)((*T70_)) == (NU8)(sep)));
1570 					LA69_: ;
1571 					if (!T68_) goto LA71_;
1572 					result = addChar(result, sep);
1573 				}
1574 				LA71_: ;
1575 				{
1576 					NI i_2;
1577 					NI colontmp__5;
1578 					NI res_2;
1579 					i_2 = (NI)0;
1580 					colontmp__5 = (NI)0;
1581 					colontmp__5 = (NI)(ff.Field1 - ff.Field0);
1582 					res_2 = ((NI) 0);
1583 					{
1584 						while (1) {
1585 							if (!(res_2 <= colontmp__5)) goto LA75;
1586 							i_2 = res_2;
1587 							result = addChar(result, path_2->data[(NI)(i_2 + ff.Field0)]);
1588 							res_2 += ((NI) 1);
1589 						} LA75: ;
1590 					}
1591 				}
1592 			}
1593 			LA64_: ;
1594 			{
1595 				NIM_BOOL T78_;
1596 				T78_ = (NIM_BOOL)0;
1597 				T78_ = hasNext__pureZpathnorm_6(f, path_2);
1598 				if (!!(T78_)) goto LA79_;
1599 				goto LA60;
1600 			}
1601 			LA79_: ;
1602 			ff = next__pureZpathnorm_10((&f), path_2);
1603 		}
1604 	} LA60: ;
1605 	{
1606 		if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA83_;
1607 		result = resizeString(result, 1);
1608 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11));
1609 	}
1610 	LA83_: ;
1611 	}BeforeRet_: ;
1612 	return result;
1613 }
N_NIMCALL(NIM_BOOL,isRelativeTo__pureZos_188)1614 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isRelativeTo__pureZos_188)(NimStringDesc* path, NimStringDesc* base) {
1615 	NIM_BOOL result;
1616 	NimStringDesc* path_2;
1617 	NimStringDesc* base_2;
1618 	NimStringDesc* ret;
1619 	NIM_BOOL T1_;
1620 	NIM_BOOL T3_;
1621 	result = (NIM_BOOL)0;
1622 	path_2 = normalizePath__pureZpathnorm_127(path, 47);
1623 	base_2 = normalizePath__pureZpathnorm_127(base, 47);
1624 	ret = nosrelativePath(path_2, base_2, 47);
1625 	T1_ = (NIM_BOOL)0;
1626 	T1_ = (((NI) 0) < (path_2 ? path_2->Sup.len : 0));
1627 	if (!(T1_)) goto LA2_;
1628 	T3_ = (NIM_BOOL)0;
1629 	T3_ = nsuStartsWith(ret, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17));
1630 	T1_ = !(T3_);
1631 	LA2_: ;
1632 	result = T1_;
1633 	return result;
1634 }
N_NIMCALL(NI,parentDirPos__pureZos_195)1635 N_LIB_PRIVATE N_NIMCALL(NI, parentDirPos__pureZos_195)(NimStringDesc* path) {
1636 	NI result;
1637 	NI q;
1638 {	result = (NI)0;
1639 	q = ((NI) 1);
1640 	{
1641 		NIM_BOOL T3_;
1642 		T3_ = (NIM_BOOL)0;
1643 		T3_ = (((NI) 1) <= (path ? path->Sup.len : 0));
1644 		if (!(T3_)) goto LA4_;
1645 		T3_ = (((NU8)(path->data[(NI)((path ? path->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)) || ((NU8)(path->data[(NI)((path ? path->Sup.len : 0) - ((NI) 1))])) == ((NU8)(47)));
1646 		LA4_: ;
1647 		if (!T3_) goto LA5_;
1648 		q = ((NI) 2);
1649 	}
1650 	LA5_: ;
1651 	{
1652 		NI i;
1653 		NI colontmp_;
1654 		NI res;
1655 		i = (NI)0;
1656 		colontmp_ = (NI)0;
1657 		colontmp_ = (NI)((path ? path->Sup.len : 0) - q);
1658 		res = colontmp_;
1659 		{
1660 			while (1) {
1661 				if (!(((NI) 0) <= res)) goto LA9;
1662 				i = res;
1663 				{
1664 					if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA12_;
1665 					result = i;
1666 					goto BeforeRet_;
1667 				}
1668 				LA12_: ;
1669 				res -= ((NI) 1);
1670 			} LA9: ;
1671 		}
1672 	}
1673 	result = ((NI) -1);
1674 	}BeforeRet_: ;
1675 	return result;
1676 }
N_NIMCALL(NimStringDesc *,nosparentDir)1677 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosparentDir)(NimStringDesc* path) {
1678 	NimStringDesc* result;
1679 	NI sepPos;
1680 	result = NIM_NIL;
1681 	result = normalizePath__pureZpathnorm_127(path, 47);
1682 	sepPos = parentDirPos__pureZos_195(result);
1683 	{
1684 		if (!(((NI) 0) <= sepPos)) goto LA3_;
1685 		result = substr__system_7744(result, ((NI) 0), sepPos);
1686 		normalizePathEnd__pureZos_51((&result), NIM_FALSE);
1687 	}
1688 	goto LA1_;
1689 	LA3_: ;
1690 	{
1691 		NIM_BOOL T6_;
1692 		NIM_BOOL T7_;
1693 		NIM_BOOL T8_;
1694 		NIM_CHAR* T12_;
1695 		T6_ = (NIM_BOOL)0;
1696 		T7_ = (NIM_BOOL)0;
1697 		T8_ = (NIM_BOOL)0;
1698 		T8_ = eqStrings(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17));
1699 		if (T8_) goto LA9_;
1700 		T8_ = eqStrings(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11));
1701 		LA9_: ;
1702 		T7_ = T8_;
1703 		if (T7_) goto LA10_;
1704 		T7_ = ((result ? result->Sup.len : 0) == ((NI) 0));
1705 		LA10_: ;
1706 		T6_ = T7_;
1707 		if (T6_) goto LA11_;
1708 		T12_ = (NIM_CHAR*)0;
1709 		T12_ = X5BX5D___system_7362((&result), ((NI) 1));
1710 		T6_ = (((NU8)((*T12_))) == ((NU8)(47)) || ((NU8)((*T12_))) == ((NU8)(47)));
1711 		LA11_: ;
1712 		if (!T6_) goto LA13_;
1713 		result = ((NimStringDesc*) NIM_NIL);
1714 	}
1715 	goto LA1_;
1716 	LA13_: ;
1717 	{
1718 		result = copyString(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11));
1719 	}
1720 	LA1_: ;
1721 	return result;
1722 }
N_NIMCALL(NIM_BOOL,nosfileExists)1723 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileExists)(NimStringDesc* filename) {
1724 	NIM_BOOL result;
1725 	struct stat res;
1726 	NIM_BOOL T1_;
1727 	int T2_;
1728 {	result = (NIM_BOOL)0;
1729 	nimZeroMem((void*)(&res), sizeof(struct stat));
1730 	T1_ = (NIM_BOOL)0;
1731 	T2_ = (int)0;
1732 	T2_ = stat(nimToCStringConv(filename), (&res));
1733 	T1_ = (((NI32) 0) <= T2_);
1734 	if (!(T1_)) goto LA3_;
1735 	T1_ = S_ISREG(res.st_mode);
1736 	LA3_: ;
1737 	result = T1_;
1738 	goto BeforeRet_;
1739 	}BeforeRet_: ;
1740 	return result;
1741 }
N_NIMCALL(NimStringDesc *,getEnv__pureZos_418)1742 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, getEnv__pureZos_418)(NimStringDesc* key, NimStringDesc* default_0) {
1743 	NimStringDesc* result;
1744 	NCSTRING env;
1745 {	result = NIM_NIL;
1746 	env = getenv(nimToCStringConv(key));
1747 	{
1748 		NIM_BOOL T3_;
1749 		T3_ = (NIM_BOOL)0;
1750 		T3_ = eqeq___system_7724(env, ((NCSTRING) NIM_NIL));
1751 		if (!T3_) goto LA4_;
1752 		result = copyString(default_0);
1753 		goto BeforeRet_;
1754 	}
1755 	LA4_: ;
1756 	result = cstrToNimstr(env);
1757 	}BeforeRet_: ;
1758 	return result;
1759 }
N_NIMCALL(NimStringDesc *,nosgetHomeDir)1760 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetHomeDir)(void) {
1761 	NimStringDesc* result;
1762 	NimStringDesc* T1_;
1763 	NimStringDesc* T2_;
1764 {	result = NIM_NIL;
1765 	T1_ = NIM_NIL;
1766 	T2_ = NIM_NIL;
1767 	T2_ = getEnv__pureZos_418(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_18), ((NimStringDesc*) NIM_NIL));
1768 	T1_ = rawNewString((T2_ ? T2_->Sup.len : 0) + 1);
1769 appendString(T1_, T2_);
1770 appendString(T1_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_10));
1771 	result = T1_;
1772 	goto BeforeRet_;
1773 	}BeforeRet_: ;
1774 	return result;
1775 }
N_INLINE(NimStringDesc *,slash___pureZos_121)1776 static N_INLINE(NimStringDesc*, slash___pureZos_121)(NimStringDesc* head, NimStringDesc* tail) {
1777 	NimStringDesc* result;
1778 	result = NIM_NIL;
1779 	result = nosjoinPath(head, tail);
1780 	return result;
1781 }
N_NIMCALL(NimStringDesc *,expandTilde__pureZos_586)1782 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, expandTilde__pureZos_586)(NimStringDesc* path) {
1783 	NimStringDesc* result;
1784 	result = NIM_NIL;
1785 	{
1786 		NIM_BOOL T3_;
1787 		T3_ = (NIM_BOOL)0;
1788 		T3_ = ((path ? path->Sup.len : 0) == ((NI) 0));
1789 		if (T3_) goto LA4_;
1790 		T3_ = !(((NU8)(path->data[((NI) 0)]) == (NU8)(126)));
1791 		LA4_: ;
1792 		if (!T3_) goto LA5_;
1793 		result = copyString(path);
1794 	}
1795 	goto LA1_;
1796 	LA5_: ;
1797 	{
1798 		if (!((path ? path->Sup.len : 0) == ((NI) 1))) goto LA8_;
1799 		result = nosgetHomeDir();
1800 	}
1801 	goto LA1_;
1802 	LA8_: ;
1803 	{
1804 		NimStringDesc* T13_;
1805 		NimStringDesc* T14_;
1806 		if (!(((NU8)(path->data[((NI) 1)])) == ((NU8)(47)) || ((NU8)(path->data[((NI) 1)])) == ((NU8)(47)))) goto LA11_;
1807 		T13_ = NIM_NIL;
1808 		T13_ = nosgetHomeDir();
1809 		T14_ = NIM_NIL;
1810 		T14_ = substr__system_7756(path, ((NI) 2));
1811 		result = slash___pureZos_121(T13_, T14_);
1812 	}
1813 	goto LA1_;
1814 	LA11_: ;
1815 	{
1816 		result = copyString(path);
1817 	}
1818 	LA1_: ;
1819 	return result;
1820 }
N_NIMCALL(NimStringDesc *,nosexpandFilename)1821 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosexpandFilename)(NimStringDesc* filename) {
1822 	NimStringDesc* result;
1823 	NCSTRING r;
1824 	result = NIM_NIL;
1825 	r = realpath(nimToCStringConv(filename), ((NCSTRING) NIM_NIL));
1826 	{
1827 		NI32 T5_;
1828 		if (!(r == 0)) goto LA3_;
1829 		T5_ = (NI32)0;
1830 		T5_ = osLastError__pureZos_408();
1831 		raiseOSError__pureZos_405(T5_, filename);
1832 	}
1833 	goto LA1_;
1834 	LA3_: ;
1835 	{
1836 		result = cstrToNimstr(r);
1837 		free(((void*) (r)));
1838 	}
1839 	LA1_: ;
1840 	return result;
1841 }
N_NIMCALL(NimStringDesc *,nosgetAppFilename)1842 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetAppFilename)(void) {
1843 	NimStringDesc* result;
1844 	unsigned int size;
1845 	result = NIM_NIL;
1846 	size = ((NI) 0);
1847 	_NSGetExecutablePath(((NCSTRING) NIM_NIL), (&size));
1848 	result = mnewString(((NI) (size)));
1849 	{
1850 		NIM_BOOL T3_;
1851 		T3_ = (NIM_BOOL)0;
1852 		T3_ = _NSGetExecutablePath(nimToCStringConv(result), (&size));
1853 		if (!T3_) goto LA4_;
1854 		result = ((NimStringDesc*) NIM_NIL);
1855 	}
1856 	LA4_: ;
1857 	{
1858 		if (!(((NI) 0) < (result ? result->Sup.len : 0))) goto LA8_;
1859 		result = nosexpandFilename(result);
1860 	}
1861 	LA8_: ;
1862 	return result;
1863 }
N_NIMCALL(NimStringDesc *,nosgetAppDir)1864 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetAppDir)(void) {
1865 	NimStringDesc* result;
1866 	NimStringDesc* T1_;
1867 	tyTuple__7q7q3E6Oj24ZNVJb9aonhAg T2_;
1868 	result = NIM_NIL;
1869 	T1_ = NIM_NIL;
1870 	T1_ = nosgetAppFilename();
1871 	nimZeroMem((void*)(&T2_), sizeof(tyTuple__7q7q3E6Oj24ZNVJb9aonhAg));
1872 	nossplitFile(T1_, (&T2_));
1873 	result = copyString(T2_.Field0);
1874 	return result;
1875 }
N_NIMCALL(NIM_BOOL,nosdirExists)1876 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosdirExists)(NimStringDesc* dir) {
1877 	NIM_BOOL result;
1878 	struct stat res;
1879 	NIM_BOOL T1_;
1880 	int T2_;
1881 	result = (NIM_BOOL)0;
1882 	nimZeroMem((void*)(&res), sizeof(struct stat));
1883 	T1_ = (NIM_BOOL)0;
1884 	T2_ = (int)0;
1885 	T2_ = stat(nimToCStringConv(dir), (&res));
1886 	T1_ = (((NI32) 0) <= T2_);
1887 	if (!(T1_)) goto LA3_;
1888 	T1_ = S_ISDIR(res.st_mode);
1889 	LA3_: ;
1890 	result = T1_;
1891 	return result;
1892 }
N_NIMCALL(tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg,getSymlinkFileKind__pureZos_1253)1893 N_LIB_PRIVATE N_NIMCALL(tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg, getSymlinkFileKind__pureZos_1253)(NimStringDesc* path) {
1894 	tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg result;
1895 	struct stat s;
1896 	result = (tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg)0;
1897 	nimZeroMem((void*)(&s), sizeof(struct stat));
1898 	{
1899 		NIM_BOOL T3_;
1900 		int T4_;
1901 		T3_ = (NIM_BOOL)0;
1902 		T4_ = (int)0;
1903 		T4_ = stat(nimToCStringConv(path), (&s));
1904 		T3_ = (T4_ == ((NI32) 0));
1905 		if (!(T3_)) goto LA5_;
1906 		T3_ = S_ISDIR(s.st_mode);
1907 		LA5_: ;
1908 		if (!T3_) goto LA6_;
1909 		result = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3);
1910 	}
1911 	goto LA1_;
1912 	LA6_: ;
1913 	{
1914 		result = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1);
1915 	}
1916 	LA1_: ;
1917 	return result;
1918 }
N_NIMCALL(NIM_BOOL,rawCreateDir__pureZos_1435)1919 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, rawCreateDir__pureZos_1435)(NimStringDesc* dir) {
1920 	NIM_BOOL result;
1921 	int res;
1922 	result = (NIM_BOOL)0;
1923 	res = mkdir(nimToCStringConv(dir), ((mode_t) 511));
1924 	{
1925 		if (!(res == ((NI32) 0))) goto LA3_;
1926 		result = NIM_TRUE;
1927 	}
1928 	goto LA1_;
1929 	LA3_: ;
1930 	{
1931 		if (!(errno == EEXIST)) goto LA6_;
1932 		result = NIM_FALSE;
1933 	}
1934 	goto LA1_;
1935 	LA6_: ;
1936 	{
1937 		NI32 T9_;
1938 		T9_ = (NI32)0;
1939 		T9_ = osLastError__pureZos_408();
1940 		raiseOSError__pureZos_405(T9_, dir);
1941 	}
1942 	LA1_: ;
1943 	return result;
1944 }
N_NIMCALL(NIM_BOOL,nosexistsOrCreateDir)1945 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosexistsOrCreateDir)(NimStringDesc* dir) {
1946 	NIM_BOOL result;
1947 	NIM_BOOL T1_;
1948 	result = (NIM_BOOL)0;
1949 	T1_ = (NIM_BOOL)0;
1950 	T1_ = rawCreateDir__pureZos_1435(dir);
1951 	result = !(T1_);
1952 	{
1953 		if (!result) goto LA4_;
1954 		{
1955 			NIM_BOOL T8_;
1956 			tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw* T11_;
1957 			NimStringDesc* T12_;
1958 			T8_ = (NIM_BOOL)0;
1959 			T8_ = nosdirExists(dir);
1960 			if (!!(T8_)) goto LA9_;
1961 			T11_ = NIM_NIL;
1962 			T11_ = (tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw*) newObj((&NTIrefioerror__HMIVdYjdZYWskTmTQVo5BQ_), sizeof(tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw));
1963 			(*T11_).Sup.Sup.Sup.m_type = (&NTIioerror__iLZrPn9anoh9ad1MmO0RczFw_);
1964 			(*T11_).Sup.Sup.name = "IOError";
1965 			T12_ = NIM_NIL;
1966 			T12_ = rawNewString((dir ? dir->Sup.len : 0) + 19);
1967 appendString(T12_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_19));
1968 appendString(T12_, dir);
1969 appendString(T12_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_7));
1970 			asgnRef((void**) (&(*T11_).Sup.Sup.message), T12_);
1971 			asgnRef((void**) (&(*T11_).Sup.Sup.parent), ((Exception*) NIM_NIL));
1972 			raiseExceptionEx((Exception*)T11_, "IOError", "existsOrCreateDir", "os.nim", 2526);
1973 		}
1974 		LA9_: ;
1975 	}
1976 	LA4_: ;
1977 	return result;
1978 }
N_NIMCALL(void,noscreateDir)1979 N_LIB_PRIVATE N_NIMCALL(void, noscreateDir)(NimStringDesc* dir) {
1980 	NIM_BOOL omitNext;
1981 	omitNext = NIM_FALSE;
1982 	{
1983 		NI i;
1984 		NI colontmp_;
1985 		NI res;
1986 		i = (NI)0;
1987 		colontmp_ = (NI)0;
1988 		colontmp_ = (NI)((dir ? dir->Sup.len : 0) - ((NI) 1));
1989 		res = ((NI) 1);
1990 		{
1991 			while (1) {
1992 				if (!(res <= colontmp_)) goto LA3;
1993 				i = res;
1994 				{
1995 					if (!(((NU8)(dir->data[i])) == ((NU8)(47)) || ((NU8)(dir->data[i])) == ((NU8)(47)))) goto LA6_;
1996 					{
1997 						if (!omitNext) goto LA10_;
1998 						omitNext = NIM_FALSE;
1999 					}
2000 					goto LA8_;
2001 					LA10_: ;
2002 					{
2003 						NimStringDesc* T13_;
2004 						NIM_BOOL T14_;
2005 						T13_ = NIM_NIL;
2006 						T13_ = substr__system_7744(dir, ((NI) 0), (NI)(i - ((NI) 1)));
2007 						T14_ = (NIM_BOOL)0;
2008 						T14_ = nosexistsOrCreateDir(T13_);
2009 						(void)(T14_);
2010 					}
2011 					LA8_: ;
2012 				}
2013 				LA6_: ;
2014 				res += ((NI) 1);
2015 			} LA3: ;
2016 		}
2017 	}
2018 	{
2019 		NIM_BOOL T17_;
2020 		NIM_BOOL T18_;
2021 		NIM_CHAR T21_;
2022 		NIM_BOOL T24_;
2023 		T17_ = (NIM_BOOL)0;
2024 		T18_ = (NIM_BOOL)0;
2025 		T18_ = (((NI) 0) < (dir ? dir->Sup.len : 0));
2026 		if (!(T18_)) goto LA19_;
2027 		T18_ = !(omitNext);
2028 		LA19_: ;
2029 		T17_ = T18_;
2030 		if (!(T17_)) goto LA20_;
2031 		T21_ = (NIM_CHAR)0;
2032 		T21_ = X5BX5D___system_7329(dir, ((NI) 1));
2033 		T17_ = !((((NU8)(T21_)) == ((NU8)(47)) || ((NU8)(T21_)) == ((NU8)(47))));
2034 		LA20_: ;
2035 		if (!T17_) goto LA22_;
2036 		T24_ = (NIM_BOOL)0;
2037 		T24_ = nosexistsOrCreateDir(dir);
2038 		(void)(T24_);
2039 	}
2040 	LA22_: ;
2041 }
N_NIMCALL(NI,searchExtPos__pureZos_271)2042 N_LIB_PRIVATE N_NIMCALL(NI, searchExtPos__pureZos_271)(NimStringDesc* path) {
2043 	NI result;
2044 	result = (NI)0;
2045 	result = ((NI) -1);
2046 	{
2047 		NI i;
2048 		NI colontmp_;
2049 		NI res;
2050 		i = (NI)0;
2051 		colontmp_ = (NI)0;
2052 		colontmp_ = (NI)((path ? path->Sup.len : 0) - ((NI) 1));
2053 		res = colontmp_;
2054 		{
2055 			while (1) {
2056 				if (!(((NI) 1) <= res)) goto LA3;
2057 				i = res;
2058 				{
2059 					if (!((NU8)(path->data[i]) == (NU8)(46))) goto LA6_;
2060 					result = i;
2061 					goto LA1;
2062 				}
2063 				goto LA4_;
2064 				LA6_: ;
2065 				{
2066 					if (!(((NU8)(path->data[i])) == ((NU8)(47)) || ((NU8)(path->data[i])) == ((NU8)(47)))) goto LA9_;
2067 					goto LA1;
2068 				}
2069 				goto LA4_;
2070 				LA9_: ;
2071 				LA4_: ;
2072 				res -= ((NI) 1);
2073 			} LA3: ;
2074 		}
2075 	} LA1: ;
2076 	return result;
2077 }
N_INLINE(void,appendChar)2078 static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c) {
2079 	(*dest).data[(*dest).Sup.len] = c;
2080 	(*dest).data[(NI)((*dest).Sup.len + ((NI) 1))] = 0;
2081 	(*dest).Sup.len += ((NI) 1);
2082 }
N_NIMCALL(NimStringDesc *,normExt__pureZos_268)2083 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, normExt__pureZos_268)(NimStringDesc* ext) {
2084 	NimStringDesc* result;
2085 	result = NIM_NIL;
2086 	{
2087 		NIM_BOOL T3_;
2088 		T3_ = (NIM_BOOL)0;
2089 		T3_ = ((ext ? ext->Sup.len : 0) == 0);
2090 		if (T3_) goto LA4_;
2091 		T3_ = ((NU8)(ext->data[((NI) 0)]) == (NU8)(46));
2092 		LA4_: ;
2093 		if (!T3_) goto LA5_;
2094 		result = copyString(ext);
2095 	}
2096 	goto LA1_;
2097 	LA5_: ;
2098 	{
2099 		NimStringDesc* T8_;
2100 		T8_ = NIM_NIL;
2101 		T8_ = rawNewString((ext ? ext->Sup.len : 0) + 1);
2102 appendChar(T8_, 46);
2103 appendString(T8_, ext);
2104 		result = T8_;
2105 	}
2106 	LA1_: ;
2107 	return result;
2108 }
N_NIMCALL(NimStringDesc *,noschangeFileExt)2109 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, noschangeFileExt)(NimStringDesc* filename, NimStringDesc* ext) {
2110 	NimStringDesc* result;
2111 	NI extPos;
2112 	result = NIM_NIL;
2113 	extPos = searchExtPos__pureZos_271(filename);
2114 	{
2115 		NimStringDesc* T5_;
2116 		NimStringDesc* T6_;
2117 		if (!(extPos < ((NI) 0))) goto LA3_;
2118 		T5_ = NIM_NIL;
2119 		T6_ = NIM_NIL;
2120 		T6_ = normExt__pureZos_268(ext);
2121 		T5_ = rawNewString((filename ? filename->Sup.len : 0) + (T6_ ? T6_->Sup.len : 0) + 0);
2122 appendString(T5_, filename);
2123 appendString(T5_, T6_);
2124 		result = T5_;
2125 	}
2126 	goto LA1_;
2127 	LA3_: ;
2128 	{
2129 		NimStringDesc* T8_;
2130 		NimStringDesc* T9_;
2131 		NimStringDesc* T10_;
2132 		T8_ = NIM_NIL;
2133 		T9_ = NIM_NIL;
2134 		T9_ = substr__system_7744(filename, ((NI) 0), (NI)(extPos - ((NI) 1)));
2135 		T10_ = NIM_NIL;
2136 		T10_ = normExt__pureZos_268(ext);
2137 		T8_ = rawNewString((T9_ ? T9_->Sup.len : 0) + (T10_ ? T10_->Sup.len : 0) + 0);
2138 appendString(T8_, T9_);
2139 appendString(T8_, T10_);
2140 		result = T8_;
2141 	}
2142 	LA1_: ;
2143 	return result;
2144 }
N_NIMCALL(NimStringDesc *,nosaddFileExt)2145 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext) {
2146 	NimStringDesc* result;
2147 	NI extPos;
2148 	result = NIM_NIL;
2149 	extPos = searchExtPos__pureZos_271(filename);
2150 	{
2151 		NimStringDesc* T5_;
2152 		NimStringDesc* T6_;
2153 		if (!(extPos < ((NI) 0))) goto LA3_;
2154 		T5_ = NIM_NIL;
2155 		T6_ = NIM_NIL;
2156 		T6_ = normExt__pureZos_268(ext);
2157 		T5_ = rawNewString((filename ? filename->Sup.len : 0) + (T6_ ? T6_->Sup.len : 0) + 0);
2158 appendString(T5_, filename);
2159 appendString(T5_, T6_);
2160 		result = T5_;
2161 	}
2162 	goto LA1_;
2163 	LA3_: ;
2164 	{
2165 		result = copyString(filename);
2166 	}
2167 	LA1_: ;
2168 	return result;
2169 }
N_NIMCALL(NIM_BOOL,nostryRemoveFile)2170 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nostryRemoveFile)(NimStringDesc* file) {
2171 	NIM_BOOL result;
2172 	result = (NIM_BOOL)0;
2173 	result = NIM_TRUE;
2174 	{
2175 		NIM_BOOL T3_;
2176 		int T4_;
2177 		T3_ = (NIM_BOOL)0;
2178 		T4_ = (int)0;
2179 		T4_ = unlink(nimToCStringConv(file));
2180 		T3_ = !((T4_ == ((NI32) 0)));
2181 		if (!(T3_)) goto LA5_;
2182 		T3_ = !((errno == ENOENT));
2183 		LA5_: ;
2184 		if (!T3_) goto LA6_;
2185 		result = NIM_FALSE;
2186 	}
2187 	LA6_: ;
2188 	return result;
2189 }
N_INLINE(void,addEscapedChar__system_7485)2190 static N_INLINE(void, addEscapedChar__system_7485)(NimStringDesc** s, NIM_CHAR c) {
2191 	switch (((NU8)(c))) {
2192 	case 7:
2193 	{
2194 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2195 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_23));
2196 	}
2197 	break;
2198 	case 8:
2199 	{
2200 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2201 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_24));
2202 	}
2203 	break;
2204 	case 9:
2205 	{
2206 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2207 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_25));
2208 	}
2209 	break;
2210 	case 10:
2211 	{
2212 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2213 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_26));
2214 	}
2215 	break;
2216 	case 11:
2217 	{
2218 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2219 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_27));
2220 	}
2221 	break;
2222 	case 12:
2223 	{
2224 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2225 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_28));
2226 	}
2227 	break;
2228 	case 13:
2229 	{
2230 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2231 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_29));
2232 	}
2233 	break;
2234 	case 27:
2235 	{
2236 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2237 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_30));
2238 	}
2239 	break;
2240 	case 92:
2241 	{
2242 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2243 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_31));
2244 	}
2245 	break;
2246 	case 39:
2247 	{
2248 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2249 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_32));
2250 	}
2251 	break;
2252 	case 34:
2253 	{
2254 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2255 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_33));
2256 	}
2257 	break;
2258 	case 32 ... 33:
2259 	case 35 ... 38:
2260 	case 40 ... 91:
2261 	case 93 ... 126:
2262 	{
2263 		unsureAsgnRef((void**) (&(*s)), addChar((*s), c));
2264 	}
2265 	break;
2266 	default:
2267 	{
2268 		NI n;
2269 		unsureAsgnRef((void**) (&(*s)), resizeString((*s), 2));
2270 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_34));
2271 		n = ((NU8)(c));
2272 		unsureAsgnRef((void**) (&(*s)), addChar((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_35)->data[(NI)((NI64)((NI)(n & ((NI) 240))) >> (NU64)(((NI) 4)))]));
2273 		unsureAsgnRef((void**) (&(*s)), addChar((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_35)->data[(NI)(n & ((NI) 15))]));
2274 	}
2275 	break;
2276 	}
2277 }
N_NIMCALL(void,addQuoted__pureZos_449)2278 N_LIB_PRIVATE N_NIMCALL(void, addQuoted__pureZos_449)(NimStringDesc** s, NimStringDesc* x) {
2279 	unsureAsgnRef((void**) (&(*s)), resizeString((*s), 1));
2280 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_22));
2281 	{
2282 		NIM_CHAR c;
2283 		NI i;
2284 		NI L;
2285 		c = (NIM_CHAR)0;
2286 		i = ((NI) 0);
2287 		L = (x ? x->Sup.len : 0);
2288 		{
2289 			while (1) {
2290 				if (!(i < L)) goto LA3;
2291 				c = x->data[i];
2292 				{
2293 					if (!((NU8)(c) <= (NU8)(127))) goto LA6_;
2294 					addEscapedChar__system_7485(s, c);
2295 				}
2296 				goto LA4_;
2297 				LA6_: ;
2298 				{
2299 					unsureAsgnRef((void**) (&(*s)), addChar((*s), c));
2300 				}
2301 				LA4_: ;
2302 				i += ((NI) 1);
2303 			} LA3: ;
2304 		}
2305 	}
2306 	unsureAsgnRef((void**) (&(*s)), resizeString((*s), 1));
2307 appendString((*s), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_22));
2308 }
N_NIMCALL(NimStringDesc *,dollar___pureZos_429)2309 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___pureZos_429)(tyTuple__UV3llMMYFckfui8YMBuUZA x) {
2310 	NimStringDesc* result;
2311 	NI count;
2312 	result = NIM_NIL;
2313 	result = copyString(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_20));
2314 	count = ((NI) 0);
2315 	{
2316 		if (!(((NI) 0) < count)) goto LA3_;
2317 		result = resizeString(result, 2);
2318 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_21));
2319 	}
2320 	LA3_: ;
2321 	count += ((NI) 1);
2322 	addQuoted__pureZos_449((&result), x.Field0);
2323 	{
2324 		if (!(((NI) 0) < count)) goto LA7_;
2325 		result = resizeString(result, 2);
2326 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_21));
2327 	}
2328 	LA7_: ;
2329 	count += ((NI) 1);
2330 	addQuoted__pureZos_449((&result), x.Field1);
2331 	{
2332 		if (!(count == ((NI) 1))) goto LA11_;
2333 		result = resizeString(result, 1);
2334 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_36));
2335 	}
2336 	LA11_: ;
2337 	result = resizeString(result, 1);
2338 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_37));
2339 	return result;
2340 }
N_NIMCALL(void,putEnv__pureZos_426)2341 N_LIB_PRIVATE N_NIMCALL(void, putEnv__pureZos_426)(NimStringDesc* key, NimStringDesc* val) {
2342 	{
2343 		int T3_;
2344 		NI32 T6_;
2345 		tyTuple__UV3llMMYFckfui8YMBuUZA T7_;
2346 		NimStringDesc* T8_;
2347 		T3_ = (int)0;
2348 		T3_ = setenv(nimToCStringConv(key), nimToCStringConv(val), ((NI32) 1));
2349 		if (!!((T3_ == ((NI32) 0)))) goto LA4_;
2350 		T6_ = (NI32)0;
2351 		T6_ = osLastError__pureZos_408();
2352 		nimZeroMem((void*)(&T7_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
2353 		T7_.Field0 = copyString(key);
2354 		T7_.Field1 = copyString(val);
2355 		T8_ = NIM_NIL;
2356 		T8_ = dollar___pureZos_429(T7_);
2357 		raiseOSError__pureZos_405(T6_, T8_);
2358 	}
2359 	LA4_: ;
2360 }
N_INLINE(NI,find__pureZos_666)2361 static N_INLINE(NI, find__pureZos_666)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item) {
2362 	NI result;
2363 {	result = (NI)0;
2364 	result = ((NI) 0);
2365 	{
2366 		NIM_CHAR i;
2367 		NI i_2;
2368 		i = (NIM_CHAR)0;
2369 		i_2 = ((NI) 0);
2370 		{
2371 			while (1) {
2372 				if (!(i_2 < aLen_0)) goto LA3;
2373 				i = a[i_2];
2374 				{
2375 					if (!((NU8)(i) == (NU8)(item))) goto LA6_;
2376 					goto BeforeRet_;
2377 				}
2378 				LA6_: ;
2379 				result += ((NI) 1);
2380 				i_2 += ((NI) 1);
2381 			} LA3: ;
2382 		}
2383 	}
2384 	result = ((NI) -1);
2385 	}BeforeRet_: ;
2386 	return result;
2387 }
N_INLINE(NIM_BOOL,contains__pureZos_661)2388 static N_INLINE(NIM_BOOL, contains__pureZos_661)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item) {
2389 	NIM_BOOL result;
2390 	NI T1_;
2391 {	result = (NIM_BOOL)0;
2392 	T1_ = (NI)0;
2393 	T1_ = find__pureZos_666(a, aLen_0, item);
2394 	result = (((NI) 0) <= T1_);
2395 	goto BeforeRet_;
2396 	}BeforeRet_: ;
2397 	return result;
2398 }
N_NIMCALL(NIM_BOOL,nossymlinkExists)2399 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nossymlinkExists)(NimStringDesc* link) {
2400 	NIM_BOOL result;
2401 	struct stat res;
2402 	NIM_BOOL T1_;
2403 	int T2_;
2404 	result = (NIM_BOOL)0;
2405 	nimZeroMem((void*)(&res), sizeof(struct stat));
2406 	T1_ = (NIM_BOOL)0;
2407 	T2_ = (int)0;
2408 	T2_ = lstat(nimToCStringConv(link), (&res));
2409 	T1_ = (((NI32) 0) <= T2_);
2410 	if (!(T1_)) goto LA3_;
2411 	T1_ = S_ISLNK(res.st_mode);
2412 	LA3_: ;
2413 	result = T1_;
2414 	return result;
2415 }
N_NIMCALL(NimStringDesc *,findExe__pureZos_654)2416 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, findExe__pureZos_654)(NimStringDesc* exe, NIM_BOOL followSymlinks, NimStringDesc** extensions, NI extensionsLen_0) {
2417 	NimStringDesc* result;
2418 	NimStringDesc* path;
2419 {	result = NIM_NIL;
2420 	{
2421 		if (!((exe ? exe->Sup.len : 0) == ((NI) 0))) goto LA3_;
2422 		goto BeforeRet_;
2423 	}
2424 	LA3_: ;
2425 	{
2426 		NIM_BOOL T7_;
2427 		T7_ = (NIM_BOOL)0;
2428 		T7_ = contains__pureZos_661(exe->data, (exe ? exe->Sup.len : 0), 47);
2429 		if (!T7_) goto LA8_;
2430 		{
2431 			NimStringDesc** extX60gensym82_;
2432 			NI i;
2433 			extX60gensym82_ = (NimStringDesc**)0;
2434 			i = ((NI) 0);
2435 			{
2436 				while (1) {
2437 					if (!(i < extensionsLen_0)) goto LA12;
2438 					extX60gensym82_ = (&extensions[i]);
2439 					result = nosaddFileExt(exe, (*extX60gensym82_));
2440 					{
2441 						NIM_BOOL T15_;
2442 						T15_ = (NIM_BOOL)0;
2443 						T15_ = nosfileExists(result);
2444 						if (!T15_) goto LA16_;
2445 						goto BeforeRet_;
2446 					}
2447 					LA16_: ;
2448 					i += ((NI) 1);
2449 				} LA12: ;
2450 			}
2451 		}
2452 	}
2453 	LA8_: ;
2454 	path = getEnv__pureZos_418(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_38), ((NimStringDesc*) NIM_NIL));
2455 	{
2456 		NimStringDesc* candidate;
2457 		NI lastX60gensym34_;
2458 		NI splitsX60gensym34_;
2459 		candidate = NIM_NIL;
2460 		lastX60gensym34_ = ((NI) 0);
2461 		splitsX60gensym34_ = ((NI) -1);
2462 		{
2463 			while (1) {
2464 				NI firstX60gensym34_;
2465 				if (!(lastX60gensym34_ <= (path ? path->Sup.len : 0))) goto LA20;
2466 				firstX60gensym34_ = lastX60gensym34_;
2467 				{
2468 					while (1) {
2469 						NIM_BOOL T23_;
2470 						T23_ = (NIM_BOOL)0;
2471 						T23_ = (lastX60gensym34_ < (path ? path->Sup.len : 0));
2472 						if (!(T23_)) goto LA24_;
2473 						T23_ = !(((NU8)(path->data[lastX60gensym34_]) == (NU8)(58)));
2474 						LA24_: ;
2475 						if (!T23_) goto LA22;
2476 						lastX60gensym34_ += ((NI) 1);
2477 					} LA22: ;
2478 				}
2479 				{
2480 					if (!(splitsX60gensym34_ == ((NI) 0))) goto LA27_;
2481 					lastX60gensym34_ = (path ? path->Sup.len : 0);
2482 				}
2483 				LA27_: ;
2484 				candidate = substr__system_7744(path, firstX60gensym34_, (NI)(lastX60gensym34_ - ((NI) 1)));
2485 				{
2486 					NimStringDesc* x;
2487 					NimStringDesc* T34_;
2488 					{
2489 						if (!((candidate ? candidate->Sup.len : 0) == ((NI) 0))) goto LA32_;
2490 						goto LA29;
2491 					}
2492 					LA32_: ;
2493 					T34_ = NIM_NIL;
2494 					T34_ = expandTilde__pureZos_586(candidate);
2495 					x = slash___pureZos_121(T34_, exe);
2496 					{
2497 						NimStringDesc** ext;
2498 						NI i_2;
2499 						ext = (NimStringDesc**)0;
2500 						i_2 = ((NI) 0);
2501 						{
2502 							while (1) {
2503 								NimStringDesc* x_2;
2504 								if (!(i_2 < extensionsLen_0)) goto LA37;
2505 								ext = (&extensions[i_2]);
2506 								x_2 = nosaddFileExt(x, (*ext));
2507 								{
2508 									NIM_BOOL T40_;
2509 									T40_ = (NIM_BOOL)0;
2510 									T40_ = nosfileExists(x_2);
2511 									if (!T40_) goto LA41_;
2512 									{
2513 										while (1) {
2514 											if (!followSymlinks) goto LA44;
2515 											{
2516 												NIM_BOOL T47_;
2517 												NimStringDesc* r;
2518 												NI len;
2519 												T47_ = (NIM_BOOL)0;
2520 												T47_ = nossymlinkExists(x_2);
2521 												if (!T47_) goto LA48_;
2522 												r = mnewString(((NI) 1024));
2523 												len = readlink(nimToCStringConv(x_2), nimToCStringConv(r), ((NI) 1024));
2524 												{
2525 													NI32 T54_;
2526 													if (!(len < ((NI) 0))) goto LA52_;
2527 													T54_ = (NI32)0;
2528 													T54_ = osLastError__pureZos_408();
2529 													raiseOSError__pureZos_405(T54_, exe);
2530 												}
2531 												LA52_: ;
2532 												{
2533 													if (!(((NI) 1024) < len)) goto LA57_;
2534 													r = mnewString(((NI) ((NI)(len + ((NI) 1)))));
2535 													len = readlink(nimToCStringConv(x_2), nimToCStringConv(r), len);
2536 												}
2537 												LA57_: ;
2538 												r = setLengthStr(r, ((NI) (len)));
2539 												{
2540 													NIM_BOOL T61_;
2541 													T61_ = (NIM_BOOL)0;
2542 													T61_ = nosisAbsolute(r);
2543 													if (!T61_) goto LA62_;
2544 													x_2 = copyString(r);
2545 												}
2546 												goto LA59_;
2547 												LA62_: ;
2548 												{
2549 													NimStringDesc* T65_;
2550 													T65_ = NIM_NIL;
2551 													T65_ = nosparentDir(x_2);
2552 													x_2 = slash___pureZos_121(T65_, r);
2553 												}
2554 												LA59_: ;
2555 											}
2556 											goto LA45_;
2557 											LA48_: ;
2558 											{
2559 												goto LA43;
2560 											}
2561 											LA45_: ;
2562 										} LA44: ;
2563 									} LA43: ;
2564 									result = copyString(x_2);
2565 									goto BeforeRet_;
2566 								}
2567 								LA41_: ;
2568 								i_2 += ((NI) 1);
2569 							} LA37: ;
2570 						}
2571 					}
2572 				} LA29: ;
2573 				{
2574 					if (!(splitsX60gensym34_ == ((NI) 0))) goto LA69_;
2575 					goto LA19;
2576 				}
2577 				LA69_: ;
2578 				splitsX60gensym34_ -= ((NI) 1);
2579 				lastX60gensym34_ += ((NI) 1);
2580 			} LA20: ;
2581 		} LA19: ;
2582 	}
2583 	result = ((NimStringDesc*) NIM_NIL);
2584 	}BeforeRet_: ;
2585 	return result;
2586 }
N_NIMCALL(void,nosremoveFile)2587 N_LIB_PRIVATE N_NIMCALL(void, nosremoveFile)(NimStringDesc* file) {
2588 	{
2589 		NIM_BOOL T3_;
2590 		NI32 T6_;
2591 		T3_ = (NIM_BOOL)0;
2592 		T3_ = nostryRemoveFile(file);
2593 		if (!!(T3_)) goto LA4_;
2594 		T6_ = (NI32)0;
2595 		T6_ = osLastError__pureZos_408();
2596 		raiseOSError__pureZos_405(T6_, file);
2597 	}
2598 	LA4_: ;
2599 }
N_NIMCALL(NIM_BOOL,existsEnv__pureZos_423)2600 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, existsEnv__pureZos_423)(NimStringDesc* key) {
2601 	NIM_BOOL result;
2602 	NCSTRING T1_;
2603 	NIM_BOOL T2_;
2604 {	result = (NIM_BOOL)0;
2605 	T1_ = (NCSTRING)0;
2606 	T1_ = getenv(nimToCStringConv(key));
2607 	T2_ = (NIM_BOOL)0;
2608 	T2_ = eqeq___system_7724(T1_, ((NCSTRING) NIM_NIL));
2609 	result = !(T2_);
2610 	goto BeforeRet_;
2611 	}BeforeRet_: ;
2612 	return result;
2613 }
N_NIMCALL(void,delEnv__pureZos_465)2614 N_LIB_PRIVATE N_NIMCALL(void, delEnv__pureZos_465)(NimStringDesc* key) {
2615 	{
2616 		int T3_;
2617 		NI32 T6_;
2618 		T3_ = (int)0;
2619 		T3_ = unsetenv(nimToCStringConv(key));
2620 		if (!!((T3_ == ((NI32) 0)))) goto LA4_;
2621 		T6_ = (NI32)0;
2622 		T6_ = osLastError__pureZos_408();
2623 		raiseOSError__pureZos_405(T6_, key);
2624 	}
2625 	LA4_: ;
2626 }
N_NIMCALL(int,exitStatusLikeShell__pureZos_1127)2627 N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__pureZos_1127)(int status) {
2628 	int result;
2629 	result = (int)0;
2630 	{
2631 		NIM_BOOL T3_;
2632 		int T6_;
2633 		T3_ = (NIM_BOOL)0;
2634 		T3_ = WIFSIGNALED(status);
2635 		if (!T3_) goto LA4_;
2636 		T6_ = (int)0;
2637 		T6_ = WTERMSIG(status);
2638 		result = (NI32)(((NI32) 128) + T6_);
2639 	}
2640 	goto LA1_;
2641 	LA4_: ;
2642 	{
2643 		result = WEXITSTATUS(status);
2644 	}
2645 	LA1_: ;
2646 	return result;
2647 }
N_INLINE(void,pushSafePoint)2648 static N_INLINE(void, pushSafePoint)(TSafePoint* s) {
2649 	(*s).prev = excHandler__system_2565;
2650 	excHandler__system_2565 = s;
2651 }
N_INLINE(void,popSafePoint)2652 static N_INLINE(void, popSafePoint)(void) {
2653 	excHandler__system_2565 = (*excHandler__system_2565).prev;
2654 }
N_NIMCALL(void,rawRemoveDir__pureZos_1428)2655 N_LIB_PRIVATE N_NIMCALL(void, rawRemoveDir__pureZos_1428)(NimStringDesc* dir) {
2656 	{
2657 		NIM_BOOL T3_;
2658 		int T4_;
2659 		NI32 T8_;
2660 		T3_ = (NIM_BOOL)0;
2661 		T4_ = (int)0;
2662 		T4_ = rmdir(nimToCStringConv(dir));
2663 		T3_ = !((T4_ == ((NI32) 0)));
2664 		if (!(T3_)) goto LA5_;
2665 		T3_ = !((errno == ENOENT));
2666 		LA5_: ;
2667 		if (!T3_) goto LA6_;
2668 		T8_ = (NI32)0;
2669 		T8_ = osLastError__pureZos_408();
2670 		raiseOSError__pureZos_405(T8_, dir);
2671 	}
2672 	LA6_: ;
2673 }
N_NIMCALL(void,nosremoveDir)2674 N_LIB_PRIVATE N_NIMCALL(void, nosremoveDir)(NimStringDesc* dir, NIM_BOOL checkDir) {
2675 	{
2676 		tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg kind;
2677 		NimStringDesc* path;
2678 		DIR* d;
2679 		kind = (tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg)0;
2680 		path = NIM_NIL;
2681 		d = opendir(nimToCStringConv(dir));
2682 		{
2683 			if (!(d == ((DIR*) NIM_NIL))) goto LA4_;
2684 			{
2685 				NI32 T10_;
2686 				if (!checkDir) goto LA8_;
2687 				T10_ = (NI32)0;
2688 				T10_ = osLastError__pureZos_408();
2689 				raiseOSError__pureZos_405(T10_, dir);
2690 			}
2691 			LA8_: ;
2692 		}
2693 		goto LA2_;
2694 		LA4_: ;
2695 		{
2696 			TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_39;
2697 			pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_39);
2698 			TM__yu6cxgKBBXbNsTkT9cyMd4g_39.status = _setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_39.context);
2699 			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_39.status == 0) {
2700 			{
2701 				while (1) {
2702 					{
2703 						struct dirent* x;
2704 						NimStringDesc* y;
2705 						x = readdir(d);
2706 						{
2707 							if (!(x == ((struct dirent*) NIM_NIL))) goto LA17_;
2708 							goto LA12;
2709 						}
2710 						LA17_: ;
2711 						y = cstrToNimstr(((NCSTRING) ((*x).d_name)));
2712 						{
2713 							NIM_BOOL T21_;
2714 							struct stat s;
2715 							NimStringDesc* path_2;
2716 							tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg k;
2717 							T21_ = (NIM_BOOL)0;
2718 							T21_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11)));
2719 							if (!(T21_)) goto LA22_;
2720 							T21_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17)));
2721 							LA22_: ;
2722 							if (!T21_) goto LA23_;
2723 							nimZeroMem((void*)(&s), sizeof(struct stat));
2724 							path_2 = slash___pureZos_121(dir, y);
2725 							{
2726 								if (!NIM_TRUE) goto LA27_;
2727 								y = copyString(path_2);
2728 							}
2729 							LA27_: ;
2730 							k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 0);
2731 							switch ((*x).d_type) {
2732 							case ((NI) 4):
2733 							{
2734 								k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
2735 							}
2736 							break;
2737 							case ((NI) 10):
2738 							{
2739 								{
2740 									NIM_BOOL T33_;
2741 									T33_ = (NIM_BOOL)0;
2742 									T33_ = nosdirExists(path_2);
2743 									if (!T33_) goto LA34_;
2744 									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3);
2745 								}
2746 								goto LA31_;
2747 								LA34_: ;
2748 								{
2749 									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1);
2750 								}
2751 								LA31_: ;
2752 							}
2753 							break;
2754 							case ((NI) 0):
2755 							{
2756 								{
2757 									int T40_;
2758 									T40_ = (int)0;
2759 									T40_ = lstat(nimToCStringConv(path_2), (&s));
2760 									if (!(T40_ < ((NI32) 0))) goto LA41_;
2761 									goto LA14;
2762 								}
2763 								goto LA38_;
2764 								LA41_: ;
2765 								{
2766 									NIM_BOOL T44_;
2767 									T44_ = (NIM_BOOL)0;
2768 									T44_ = S_ISDIR(s.st_mode);
2769 									if (!T44_) goto LA45_;
2770 									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
2771 								}
2772 								goto LA38_;
2773 								LA45_: ;
2774 								{
2775 									NIM_BOOL T48_;
2776 									T48_ = (NIM_BOOL)0;
2777 									T48_ = S_ISLNK(s.st_mode);
2778 									if (!T48_) goto LA49_;
2779 									k = getSymlinkFileKind__pureZos_1253(path_2);
2780 								}
2781 								goto LA38_;
2782 								LA49_: ;
2783 								LA38_: ;
2784 							}
2785 							break;
2786 							default:
2787 							{
2788 							}
2789 							break;
2790 							}
2791 							kind = k;
2792 							path = y;
2793 							switch (kind) {
2794 							case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 0):
2795 							case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1):
2796 							case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3):
2797 							{
2798 								nosremoveFile(path);
2799 							}
2800 							break;
2801 							case ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2):
2802 							{
2803 								nosremoveDir(path, NIM_TRUE);
2804 							}
2805 							break;
2806 							}
2807 						}
2808 						LA23_: ;
2809 					} LA14: ;
2810 				}
2811 			} LA12: ;
2812 			popSafePoint();
2813 			}
2814 			else {
2815 				popSafePoint();
2816 			}
2817 			{
2818 				int T56_;
2819 				T56_ = (int)0;
2820 				T56_ = closedir(d);
2821 				(void)(T56_);
2822 				if (TM__yu6cxgKBBXbNsTkT9cyMd4g_39.status != 0) nimLeaveFinally();
2823 			}
2824 			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_39.status != 0) reraiseException();
2825 		}
2826 		LA2_: ;
2827 	}
2828 	rawRemoveDir__pureZos_1428(dir);
2829 }
N_NIMCALL(NIM_BOOL,tryMoveFSObject__pureZos_1114)2830 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, tryMoveFSObject__pureZos_1114)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL isDir) {
2831 	NIM_BOOL result;
2832 	int T1_;
2833 	result = (NIM_BOOL)0;
2834 	T1_ = (int)0;
2835 	T1_ = rename(nimToCStringConv(source), nimToCStringConv(dest));
2836 	result = (T1_ == ((NI32) 0));
2837 	{
2838 		NI32 err;
2839 		NIM_BOOL isAccessDeniedError;
2840 		if (!!(result)) goto LA4_;
2841 		err = osLastError__pureZos_408();
2842 		isAccessDeniedError = (err == EXDEV);
2843 		{
2844 			tyTuple__UV3llMMYFckfui8YMBuUZA T10_;
2845 			NimStringDesc* T11_;
2846 			if (!!(isAccessDeniedError)) goto LA8_;
2847 			nimZeroMem((void*)(&T10_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
2848 			T10_.Field0 = copyString(source);
2849 			T10_.Field1 = copyString(dest);
2850 			T11_ = NIM_NIL;
2851 			T11_ = dollar___pureZos_429(T10_);
2852 			raiseOSError__pureZos_405(err, T11_);
2853 		}
2854 		LA8_: ;
2855 	}
2856 	LA4_: ;
2857 	return result;
2858 }
N_INLINE(NI,countSetBitsImpl__systemZcountbits95impl_26)2859 static N_INLINE(NI, countSetBitsImpl__systemZcountbits95impl_26)(NU32 x) {
2860 	NI result;
2861 	int T1_;
2862 	result = (NI)0;
2863 	T1_ = (int)0;
2864 	T1_ = __builtin_popcount(x);
2865 	result = ((NI) (T1_));
2866 	return result;
2867 }
N_INLINE(NI,countBits32)2868 static N_INLINE(NI, countBits32)(NU32 n) {
2869 	NI result;
2870 	result = (NI)0;
2871 	result = countSetBitsImpl__systemZcountbits95impl_26(n);
2872 	return result;
2873 }
N_NIMCALL(void,createSymlink__pureZos_1022)2874 N_LIB_PRIVATE N_NIMCALL(void, createSymlink__pureZos_1022)(NimStringDesc* src, NimStringDesc* dest) {
2875 	{
2876 		int T3_;
2877 		NI32 T6_;
2878 		tyTuple__UV3llMMYFckfui8YMBuUZA T7_;
2879 		NimStringDesc* T8_;
2880 		T3_ = (int)0;
2881 		T3_ = symlink(nimToCStringConv(src), nimToCStringConv(dest));
2882 		if (!!((T3_ == ((NI32) 0)))) goto LA4_;
2883 		T6_ = (NI32)0;
2884 		T6_ = osLastError__pureZos_408();
2885 		nimZeroMem((void*)(&T7_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
2886 		T7_.Field0 = copyString(src);
2887 		T7_.Field1 = copyString(dest);
2888 		T8_ = NIM_NIL;
2889 		T8_ = dollar___pureZos_429(T7_);
2890 		raiseOSError__pureZos_405(T6_, T8_);
2891 	}
2892 	LA4_: ;
2893 }
N_NIMCALL(NimStringDesc *,expandSymlink__pureZos_1028)2894 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, expandSymlink__pureZos_1028)(NimStringDesc* symlinkPath) {
2895 	NimStringDesc* result;
2896 	NI len;
2897 	result = NIM_NIL;
2898 	result = mnewString(((NI) 1024));
2899 	len = readlink(nimToCStringConv(symlinkPath), nimToCStringConv(result), ((NI) 1024));
2900 	{
2901 		NI32 T5_;
2902 		if (!(len < ((NI) 0))) goto LA3_;
2903 		T5_ = (NI32)0;
2904 		T5_ = osLastError__pureZos_408();
2905 		raiseOSError__pureZos_405(T5_, symlinkPath);
2906 	}
2907 	LA3_: ;
2908 	{
2909 		if (!(((NI) 1024) < len)) goto LA8_;
2910 		result = mnewString(((NI) ((NI)(len + ((NI) 1)))));
2911 		len = readlink(nimToCStringConv(symlinkPath), nimToCStringConv(result), len);
2912 	}
2913 	LA8_: ;
2914 	result = setLengthStr(result, ((NI) (len)));
2915 	return result;
2916 }
N_NIMCALL(void,noscopyFile)2917 N_LIB_PRIVATE N_NIMCALL(void, noscopyFile)(NimStringDesc* source, NimStringDesc* dest, tySet_tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA options) {
2918 	NIM_BOOL isSymlink;
2919 {	{
2920 		if (!!((countBits32((7 & options)) == ((NI) 1)))) goto LA3_;
2921 		failedAssertImpl__systemZassertions_56(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_40));
2922 	}
2923 	LA3_: ;
2924 	isSymlink = nossymlinkExists(source);
2925 	{
2926 		NIM_BOOL T7_;
2927 		NIM_BOOL T9_;
2928 		T7_ = (NIM_BOOL)0;
2929 		T7_ = isSymlink;
2930 		if (!(T7_)) goto LA8_;
2931 		T9_ = (NIM_BOOL)0;
2932 		T9_ = ((options &((NU8)1<<((NU)(((tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA) 2))&7U)))!=0);
2933 		if (T9_) goto LA10_;
2934 		T9_ = NIM_FALSE;
2935 		LA10_: ;
2936 		T7_ = T9_;
2937 		LA8_: ;
2938 		if (!T7_) goto LA11_;
2939 		goto BeforeRet_;
2940 	}
2941 	LA11_: ;
2942 	{
2943 		NIM_BOOL T15_;
2944 		NimStringDesc* T19_;
2945 		T15_ = (NIM_BOOL)0;
2946 		T15_ = isSymlink;
2947 		if (!(T15_)) goto LA16_;
2948 		T15_ = ((options &((NU8)1<<((NU)(((tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA) 0))&7U)))!=0);
2949 		LA16_: ;
2950 		if (!T15_) goto LA17_;
2951 		T19_ = NIM_NIL;
2952 		T19_ = expandSymlink__pureZos_1028(source);
2953 		createSymlink__pureZos_1022(T19_, dest);
2954 	}
2955 	goto LA13_;
2956 	LA17_: ;
2957 	{
2958 		copyfile_state_t state;
2959 		int status;
2960 		int status2;
2961 		state = copyfile_state_alloc();
2962 		status = copyfile(nimToCStringConv(source), nimToCStringConv(dest), state, COPYFILE_DATA);
2963 		{
2964 			NI32 err;
2965 			int T25_;
2966 			tyTuple__UV3llMMYFckfui8YMBuUZA T26_;
2967 			NimStringDesc* T27_;
2968 			if (!!((status == ((NI32) 0)))) goto LA23_;
2969 			err = osLastError__pureZos_408();
2970 			T25_ = (int)0;
2971 			T25_ = copyfile_state_free(state);
2972 			(void)(T25_);
2973 			nimZeroMem((void*)(&T26_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
2974 			T26_.Field0 = copyString(source);
2975 			T26_.Field1 = copyString(dest);
2976 			T27_ = NIM_NIL;
2977 			T27_ = dollar___pureZos_429(T26_);
2978 			raiseOSError__pureZos_405(err, T27_);
2979 		}
2980 		LA23_: ;
2981 		status2 = copyfile_state_free(state);
2982 		{
2983 			NI32 T32_;
2984 			tyTuple__UV3llMMYFckfui8YMBuUZA T33_;
2985 			NimStringDesc* T34_;
2986 			if (!!((status2 == ((NI32) 0)))) goto LA30_;
2987 			T32_ = (NI32)0;
2988 			T32_ = osLastError__pureZos_408();
2989 			nimZeroMem((void*)(&T33_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
2990 			T33_.Field0 = copyString(source);
2991 			T33_.Field1 = copyString(dest);
2992 			T34_ = NIM_NIL;
2993 			T34_ = dollar___pureZos_429(T33_);
2994 			raiseOSError__pureZos_405(T32_, T34_);
2995 		}
2996 		LA30_: ;
2997 	}
2998 	LA13_: ;
2999 	}BeforeRet_: ;
3000 }
N_INLINE(void,popCurrentException)3001 static N_INLINE(void, popCurrentException)(void) {
3002 	asgnRef((void**) (&currException__system_2566), (*currException__system_2566).up);
3003 }
N_NIMCALL(void,nosmoveFile)3004 N_LIB_PRIVATE N_NIMCALL(void, nosmoveFile)(NimStringDesc* source, NimStringDesc* dest) {
3005 	{
3006 		NIM_BOOL T3_;
3007 		TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_41;
3008 		T3_ = (NIM_BOOL)0;
3009 		T3_ = tryMoveFSObject__pureZos_1114(source, dest, NIM_FALSE);
3010 		if (!!(T3_)) goto LA4_;
3011 		noscopyFile(source, dest, 1);
3012 		pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_41);
3013 		TM__yu6cxgKBBXbNsTkT9cyMd4g_41.status = _setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_41.context);
3014 		if (TM__yu6cxgKBBXbNsTkT9cyMd4g_41.status == 0) {
3015 		nosremoveFile(source);
3016 		popSafePoint();
3017 		}
3018 		else {
3019 			popSafePoint();
3020 			{
3021 				NIM_BOOL T8_;
3022 				TM__yu6cxgKBBXbNsTkT9cyMd4g_41.status = 0;
3023 				T8_ = (NIM_BOOL)0;
3024 				T8_ = nostryRemoveFile(dest);
3025 				(void)(T8_);
3026 				reraiseException();
3027 				popCurrentException();
3028 			}
3029 		}
3030 		if (TM__yu6cxgKBBXbNsTkT9cyMd4g_41.status != 0) reraiseException();
3031 	}
3032 	LA4_: ;
3033 }
N_NIMCALL(void,noscopyDir)3034 N_LIB_PRIVATE N_NIMCALL(void, noscopyDir)(NimStringDesc* source, NimStringDesc* dest) {
3035 	noscreateDir(dest);
3036 	{
3037 		tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg kind;
3038 		NimStringDesc* path;
3039 		DIR* d;
3040 		kind = (tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg)0;
3041 		path = NIM_NIL;
3042 		d = opendir(nimToCStringConv(source));
3043 		{
3044 			if (!(d == ((DIR*) NIM_NIL))) goto LA4_;
3045 			{
3046 				NI32 T10_;
3047 				if (!NIM_FALSE) goto LA8_;
3048 				T10_ = (NI32)0;
3049 				T10_ = osLastError__pureZos_408();
3050 				raiseOSError__pureZos_405(T10_, source);
3051 			}
3052 			LA8_: ;
3053 		}
3054 		goto LA2_;
3055 		LA4_: ;
3056 		{
3057 			TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_42;
3058 			pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_42);
3059 			TM__yu6cxgKBBXbNsTkT9cyMd4g_42.status = _setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_42.context);
3060 			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_42.status == 0) {
3061 			{
3062 				while (1) {
3063 					{
3064 						struct dirent* x;
3065 						NimStringDesc* y;
3066 						x = readdir(d);
3067 						{
3068 							if (!(x == ((struct dirent*) NIM_NIL))) goto LA17_;
3069 							goto LA12;
3070 						}
3071 						LA17_: ;
3072 						y = cstrToNimstr(((NCSTRING) ((*x).d_name)));
3073 						{
3074 							NIM_BOOL T21_;
3075 							struct stat s;
3076 							NimStringDesc* path_2;
3077 							tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg k;
3078 							NimStringDesc* noSource;
3079 							tyTuple__UV3llMMYFckfui8YMBuUZA T52_;
3080 							T21_ = (NIM_BOOL)0;
3081 							T21_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_11)));
3082 							if (!(T21_)) goto LA22_;
3083 							T21_ = !(eqStrings(y, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_17)));
3084 							LA22_: ;
3085 							if (!T21_) goto LA23_;
3086 							nimZeroMem((void*)(&s), sizeof(struct stat));
3087 							path_2 = slash___pureZos_121(source, y);
3088 							{
3089 								if (!NIM_TRUE) goto LA27_;
3090 								y = copyString(path_2);
3091 							}
3092 							LA27_: ;
3093 							k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 0);
3094 							switch ((*x).d_type) {
3095 							case ((NI) 4):
3096 							{
3097 								k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
3098 							}
3099 							break;
3100 							case ((NI) 10):
3101 							{
3102 								{
3103 									NIM_BOOL T33_;
3104 									T33_ = (NIM_BOOL)0;
3105 									T33_ = nosdirExists(path_2);
3106 									if (!T33_) goto LA34_;
3107 									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 3);
3108 								}
3109 								goto LA31_;
3110 								LA34_: ;
3111 								{
3112 									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 1);
3113 								}
3114 								LA31_: ;
3115 							}
3116 							break;
3117 							case ((NI) 0):
3118 							{
3119 								{
3120 									int T40_;
3121 									T40_ = (int)0;
3122 									T40_ = lstat(nimToCStringConv(path_2), (&s));
3123 									if (!(T40_ < ((NI32) 0))) goto LA41_;
3124 									goto LA14;
3125 								}
3126 								goto LA38_;
3127 								LA41_: ;
3128 								{
3129 									NIM_BOOL T44_;
3130 									T44_ = (NIM_BOOL)0;
3131 									T44_ = S_ISDIR(s.st_mode);
3132 									if (!T44_) goto LA45_;
3133 									k = ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2);
3134 								}
3135 								goto LA38_;
3136 								LA45_: ;
3137 								{
3138 									NIM_BOOL T48_;
3139 									T48_ = (NIM_BOOL)0;
3140 									T48_ = S_ISLNK(s.st_mode);
3141 									if (!T48_) goto LA49_;
3142 									k = getSymlinkFileKind__pureZos_1253(path_2);
3143 								}
3144 								goto LA38_;
3145 								LA49_: ;
3146 								LA38_: ;
3147 							}
3148 							break;
3149 							default:
3150 							{
3151 							}
3152 							break;
3153 							}
3154 							kind = k;
3155 							path = y;
3156 							nimZeroMem((void*)(&T52_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
3157 							nossplitPath(path, (&T52_));
3158 							noSource = copyString(T52_.Field1);
3159 							{
3160 								NimStringDesc* T57_;
3161 								if (!(kind == ((tyEnum_PathComponent__9c1SIU9cO1wHcl09b703A9cDrg) 2))) goto LA55_;
3162 								T57_ = NIM_NIL;
3163 								T57_ = slash___pureZos_121(dest, noSource);
3164 								noscopyDir(path, T57_);
3165 							}
3166 							goto LA53_;
3167 							LA55_: ;
3168 							{
3169 								NimStringDesc* T59_;
3170 								T59_ = NIM_NIL;
3171 								T59_ = slash___pureZos_121(dest, noSource);
3172 								noscopyFile(path, T59_, 1);
3173 							}
3174 							LA53_: ;
3175 						}
3176 						LA23_: ;
3177 					} LA14: ;
3178 				}
3179 			} LA12: ;
3180 			popSafePoint();
3181 			}
3182 			else {
3183 				popSafePoint();
3184 			}
3185 			{
3186 				int T62_;
3187 				T62_ = (int)0;
3188 				T62_ = closedir(d);
3189 				(void)(T62_);
3190 				if (TM__yu6cxgKBBXbNsTkT9cyMd4g_42.status != 0) nimLeaveFinally();
3191 			}
3192 			if (TM__yu6cxgKBBXbNsTkT9cyMd4g_42.status != 0) reraiseException();
3193 		}
3194 		LA2_: ;
3195 	}
3196 }
N_NIMCALL(void,moveDir__pureZos_1470)3197 N_LIB_PRIVATE N_NIMCALL(void, moveDir__pureZos_1470)(NimStringDesc* source, NimStringDesc* dest) {
3198 	{
3199 		NIM_BOOL T3_;
3200 		T3_ = (NIM_BOOL)0;
3201 		T3_ = tryMoveFSObject__pureZos_1114(source, dest, NIM_TRUE);
3202 		if (!!(T3_)) goto LA4_;
3203 		noscopyDir(source, dest);
3204 		nosremoveDir(source, NIM_FALSE);
3205 	}
3206 	LA4_: ;
3207 }
N_INLINE(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q,toTime__pureZos_17)3208 static N_INLINE(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, toTime__pureZos_17)(struct timespec ts) {
3209 	tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q result;
3210 	nimZeroMem((void*)(&result), sizeof(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q));
3211 	result = initTime__pureZtimes_898(((NI64) (ts.tv_sec)), ((NI) (ts.tv_nsec)));
3212 	return result;
3213 }
N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q,nosgetLastModificationTime)3214 N_LIB_PRIVATE N_NIMCALL(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q, nosgetLastModificationTime)(NimStringDesc* file) {
3215 	tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q result;
3216 	struct stat res;
3217 	nimZeroMem((void*)(&result), sizeof(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q));
3218 	nimZeroMem((void*)(&res), sizeof(struct stat));
3219 	{
3220 		int T3_;
3221 		NI32 T6_;
3222 		T3_ = (int)0;
3223 		T3_ = stat(nimToCStringConv(file), (&res));
3224 		if (!(T3_ < ((NI32) 0))) goto LA4_;
3225 		T6_ = (NI32)0;
3226 		T6_ = osLastError__pureZos_408();
3227 		raiseOSError__pureZos_405(T6_, file);
3228 	}
3229 	LA4_: ;
3230 	result = toTime__pureZos_17(res.st_mtimespec);
3231 	return result;
3232 }
N_NIMCALL(NimStringDesc *,nosgetConfigDir)3233 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetConfigDir)(void) {
3234 	NimStringDesc* result;
3235 	NimStringDesc* T1_;
3236 	NimStringDesc* T2_;
3237 	result = NIM_NIL;
3238 	T1_ = NIM_NIL;
3239 	T1_ = getEnv__pureZos_418(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_18), ((NimStringDesc*) NIM_NIL));
3240 	T2_ = NIM_NIL;
3241 	T2_ = slash___pureZos_121(T1_, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_44));
3242 	result = getEnv__pureZos_418(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_43), T2_);
3243 	normalizePathEnd__pureZos_51((&result), NIM_TRUE);
3244 	return result;
3245 }
N_NIMCALL(NIM_BOOL,nosisRootDir)3246 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosisRootDir)(NimStringDesc* path) {
3247 	NIM_BOOL result;
3248 	NI T1_;
3249 	result = (NIM_BOOL)0;
3250 	T1_ = (NI)0;
3251 	T1_ = parentDirPos__pureZos_195(path);
3252 	result = (T1_ < ((NI) 0));
3253 	return result;
3254 }
N_NIMCALL(NIM_BOOL,nosfileNewer)3255 N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileNewer)(NimStringDesc* a, NimStringDesc* b) {
3256 	NIM_BOOL result;
3257 	tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q T1_;
3258 	tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q T2_;
3259 	result = (NIM_BOOL)0;
3260 	T1_ = nosgetLastModificationTime(b);
3261 	T2_ = nosgetLastModificationTime(a);
3262 	result = ntLtTime(T1_, T2_);
3263 	return result;
3264 }
N_NIMCALL(void,addQuoted__pureZos_1008)3265 N_LIB_PRIVATE N_NIMCALL(void, addQuoted__pureZos_1008)(NimStringDesc** s, tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA x) {
3266 	unsureAsgnRef((void**) (&(*s)), resizeString((*s), (reprEnum((NI)x, (&NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_)) ? reprEnum((NI)x, (&NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_))->Sup.len : 0) + 0));
3267 appendString((*s), reprEnum((NI)x, (&NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_)));
3268 }
N_NIMCALL(NimStringDesc *,collectionToString__pureZos_976)3269 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, collectionToString__pureZos_976)(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA x, NimStringDesc* prefix, NimStringDesc* separator, NimStringDesc* suffix) {
3270 	NimStringDesc* result;
3271 	NIM_BOOL firstElement;
3272 	result = NIM_NIL;
3273 	result = copyString(prefix);
3274 	firstElement = NIM_TRUE;
3275 	{
3276 		tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA value;
3277 		NI i;
3278 		value = (tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA)0;
3279 		i = ((NI) 0);
3280 		{
3281 			while (1) {
3282 				if (!(i <= ((NI) 8))) goto LA3;
3283 				{
3284 					if (!((x &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) (i)))&15U)))!=0)) goto LA6_;
3285 					value = ((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) (i));
3286 					{
3287 						if (!firstElement) goto LA10_;
3288 						firstElement = NIM_FALSE;
3289 					}
3290 					goto LA8_;
3291 					LA10_: ;
3292 					{
3293 						result = resizeString(result, (separator ? separator->Sup.len : 0) + 0);
3294 appendString(result, separator);
3295 					}
3296 					LA8_: ;
3297 					addQuoted__pureZos_1008((&result), value);
3298 				}
3299 				LA6_: ;
3300 				i += ((NI) 1);
3301 			} LA3: ;
3302 		}
3303 	}
3304 	result = resizeString(result, (suffix ? suffix->Sup.len : 0) + 0);
3305 appendString(result, suffix);
3306 	return result;
3307 }
N_NIMCALL(NimStringDesc *,dollar___pureZos_972)3308 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___pureZos_972)(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA x) {
3309 	NimStringDesc* result;
3310 	result = NIM_NIL;
3311 	result = collectionToString__pureZos_976(x, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_49), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_21), ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_50));
3312 	return result;
3313 }
N_NIMCALL(void,addQuoted__pureZos_966)3314 N_LIB_PRIVATE N_NIMCALL(void, addQuoted__pureZos_966)(NimStringDesc** s, tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA x) {
3315 	NimStringDesc* T1_;
3316 	T1_ = NIM_NIL;
3317 	T1_ = dollar___pureZos_972(x);
3318 	unsureAsgnRef((void**) (&(*s)), resizeString((*s), (T1_ ? T1_->Sup.len : 0) + 0));
3319 appendString((*s), T1_);
3320 }
N_NIMCALL(NimStringDesc *,dollar___pureZos_881)3321 N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___pureZos_881)(tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA x) {
3322 	NimStringDesc* result;
3323 	NI count;
3324 	result = NIM_NIL;
3325 	result = copyString(((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_20));
3326 	count = ((NI) 0);
3327 	{
3328 		if (!(((NI) 0) < count)) goto LA3_;
3329 		result = resizeString(result, 2);
3330 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_21));
3331 	}
3332 	LA3_: ;
3333 	count += ((NI) 1);
3334 	addQuoted__pureZos_449((&result), x.Field0);
3335 	{
3336 		if (!(((NI) 0) < count)) goto LA7_;
3337 		result = resizeString(result, 2);
3338 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_21));
3339 	}
3340 	LA7_: ;
3341 	count += ((NI) 1);
3342 	addQuoted__pureZos_966((&result), x.Field1);
3343 	{
3344 		if (!(count == ((NI) 1))) goto LA11_;
3345 		result = resizeString(result, 1);
3346 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_36));
3347 	}
3348 	LA11_: ;
3349 	result = resizeString(result, 1);
3350 appendString(result, ((NimStringDesc*) &TM__yu6cxgKBBXbNsTkT9cyMd4g_37));
3351 	return result;
3352 }
N_NIMCALL(void,nossetFilePermissions)3353 N_LIB_PRIVATE N_NIMCALL(void, nossetFilePermissions)(NimStringDesc* filename, tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA permissions, NIM_BOOL followSymlinks) {
3354 	mode_t p;
3355 	p = ((mode_t) 0);
3356 	{
3357 		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 2))&15U)))!=0)) goto LA3_;
3358 		p = (NU16)(p | ((mode_t) (S_IRUSR)));
3359 	}
3360 	LA3_: ;
3361 	{
3362 		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 1))&15U)))!=0)) goto LA7_;
3363 		p = (NU16)(p | ((mode_t) (S_IWUSR)));
3364 	}
3365 	LA7_: ;
3366 	{
3367 		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 0))&15U)))!=0)) goto LA11_;
3368 		p = (NU16)(p | ((mode_t) (S_IXUSR)));
3369 	}
3370 	LA11_: ;
3371 	{
3372 		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 5))&15U)))!=0)) goto LA15_;
3373 		p = (NU16)(p | ((mode_t) (S_IRGRP)));
3374 	}
3375 	LA15_: ;
3376 	{
3377 		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 4))&15U)))!=0)) goto LA19_;
3378 		p = (NU16)(p | ((mode_t) (S_IWGRP)));
3379 	}
3380 	LA19_: ;
3381 	{
3382 		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 3))&15U)))!=0)) goto LA23_;
3383 		p = (NU16)(p | ((mode_t) (S_IXGRP)));
3384 	}
3385 	LA23_: ;
3386 	{
3387 		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 8))&15U)))!=0)) goto LA27_;
3388 		p = (NU16)(p | ((mode_t) (S_IROTH)));
3389 	}
3390 	LA27_: ;
3391 	{
3392 		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 7))&15U)))!=0)) goto LA31_;
3393 		p = (NU16)(p | ((mode_t) (S_IWOTH)));
3394 	}
3395 	LA31_: ;
3396 	{
3397 		if (!((permissions &((NU16)1<<((NU)(((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 6))&15U)))!=0)) goto LA35_;
3398 		p = (NU16)(p | ((mode_t) (S_IXOTH)));
3399 	}
3400 	LA35_: ;
3401 	{
3402 		NIM_BOOL T39_;
3403 		T39_ = (NIM_BOOL)0;
3404 		T39_ = !(followSymlinks);
3405 		if (!(T39_)) goto LA40_;
3406 		T39_ = nossymlinkExists(filename);
3407 		LA40_: ;
3408 		if (!T39_) goto LA41_;
3409 		{
3410 			int T45_;
3411 			NI32 T48_;
3412 			tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA T49_;
3413 			NimStringDesc* T50_;
3414 			T45_ = (int)0;
3415 			T45_ = lchmod(nimToCStringConv(filename), ((mode_t) (p)));
3416 			if (!!((T45_ == ((NI32) 0)))) goto LA46_;
3417 			T48_ = (NI32)0;
3418 			T48_ = osLastError__pureZos_408();
3419 			nimZeroMem((void*)(&T49_), sizeof(tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA));
3420 			T49_.Field0 = copyString(filename);
3421 			T49_.Field1 = permissions;
3422 			T50_ = NIM_NIL;
3423 			T50_ = dollar___pureZos_881(T49_);
3424 			raiseOSError__pureZos_405(T48_, T50_);
3425 		}
3426 		LA46_: ;
3427 	}
3428 	goto LA37_;
3429 	LA41_: ;
3430 	{
3431 		{
3432 			int T54_;
3433 			NI32 T57_;
3434 			tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA T58_;
3435 			NimStringDesc* T59_;
3436 			T54_ = (int)0;
3437 			T54_ = chmod(nimToCStringConv(filename), ((mode_t) (p)));
3438 			if (!!((T54_ == ((NI32) 0)))) goto LA55_;
3439 			T57_ = (NI32)0;
3440 			T57_ = osLastError__pureZos_408();
3441 			nimZeroMem((void*)(&T58_), sizeof(tyTuple__HFn8JzZZeLZ9aKrFg4S9a7HA));
3442 			T58_.Field0 = copyString(filename);
3443 			T58_.Field1 = permissions;
3444 			T59_ = NIM_NIL;
3445 			T59_ = dollar___pureZos_881(T58_);
3446 			raiseOSError__pureZos_405(T57_, T59_);
3447 		}
3448 		LA55_: ;
3449 	}
3450 	LA37_: ;
3451 }
N_NIMCALL(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA,nosgetFilePermissions)3452 N_LIB_PRIVATE N_NIMCALL(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA, nosgetFilePermissions)(NimStringDesc* filename) {
3453 	tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA result;
3454 	struct stat a;
3455 	nimZeroMem((void*)(&result), sizeof(tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA));
3456 	nimZeroMem((void*)(&a), sizeof(struct stat));
3457 	{
3458 		int T3_;
3459 		NI32 T6_;
3460 		T3_ = (int)0;
3461 		T3_ = stat(nimToCStringConv(filename), (&a));
3462 		if (!(T3_ < ((NI32) 0))) goto LA4_;
3463 		T6_ = (NI32)0;
3464 		T6_ = osLastError__pureZos_408();
3465 		raiseOSError__pureZos_405(T6_, filename);
3466 	}
3467 	LA4_: ;
3468 	result = 0;
3469 	{
3470 		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IRUSR))) == ((mode_t) 0)))) goto LA9_;
3471 		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 2)) & 15);
3472 	}
3473 	LA9_: ;
3474 	{
3475 		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IWUSR))) == ((mode_t) 0)))) goto LA13_;
3476 		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 1)) & 15);
3477 	}
3478 	LA13_: ;
3479 	{
3480 		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IXUSR))) == ((mode_t) 0)))) goto LA17_;
3481 		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 0)) & 15);
3482 	}
3483 	LA17_: ;
3484 	{
3485 		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IRGRP))) == ((mode_t) 0)))) goto LA21_;
3486 		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 5)) & 15);
3487 	}
3488 	LA21_: ;
3489 	{
3490 		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IWGRP))) == ((mode_t) 0)))) goto LA25_;
3491 		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 4)) & 15);
3492 	}
3493 	LA25_: ;
3494 	{
3495 		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IXGRP))) == ((mode_t) 0)))) goto LA29_;
3496 		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 3)) & 15);
3497 	}
3498 	LA29_: ;
3499 	{
3500 		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IROTH))) == ((mode_t) 0)))) goto LA33_;
3501 		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 8)) & 15);
3502 	}
3503 	LA33_: ;
3504 	{
3505 		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IWOTH))) == ((mode_t) 0)))) goto LA37_;
3506 		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 7)) & 15);
3507 	}
3508 	LA37_: ;
3509 	{
3510 		if (!!(((NU16)(a.st_mode & ((mode_t) (S_IXOTH))) == ((mode_t) 0)))) goto LA41_;
3511 		result |= ((NU16)1)<<((((tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA) 6)) & 15);
3512 	}
3513 	LA41_: ;
3514 	return result;
3515 }
N_NIMCALL(void,copyFileWithPermissions__pureZos_1479)3516 N_LIB_PRIVATE N_NIMCALL(void, copyFileWithPermissions__pureZos_1479)(NimStringDesc* source, NimStringDesc* dest, NIM_BOOL ignorePermissionErrors, tySet_tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA options) {
3517 	TSafePoint TM__yu6cxgKBBXbNsTkT9cyMd4g_45;
3518 	tySet_tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA T1_;
3519 	noscopyFile(source, dest, options);
3520 	pushSafePoint(&TM__yu6cxgKBBXbNsTkT9cyMd4g_45);
3521 	TM__yu6cxgKBBXbNsTkT9cyMd4g_45.status = _setjmp(TM__yu6cxgKBBXbNsTkT9cyMd4g_45.context);
3522 	if (TM__yu6cxgKBBXbNsTkT9cyMd4g_45.status == 0) {
3523 	T1_ = nosgetFilePermissions(source);
3524 	nossetFilePermissions(dest, T1_, ((options &((NU8)1<<((NU)(((tyEnum_CopyFlag__pdzel23GjJ9cPFw8c5ldeRA) 1))&7U)))!=0));
3525 	popSafePoint();
3526 	}
3527 	else {
3528 		popSafePoint();
3529 		{
3530 			TM__yu6cxgKBBXbNsTkT9cyMd4g_45.status = 0;
3531 			{
3532 				if (!!(ignorePermissionErrors)) goto LA6_;
3533 				reraiseException();
3534 			}
3535 			LA6_: ;
3536 			popCurrentException();
3537 		}
3538 	}
3539 	if (TM__yu6cxgKBBXbNsTkT9cyMd4g_45.status != 0) reraiseException();
3540 }
N_NIMCALL(NI,nosexecShellCmd)3541 N_LIB_PRIVATE N_NIMCALL(NI, nosexecShellCmd)(NimStringDesc* command) {
3542 	NI result;
3543 	int T1_;
3544 	int T2_;
3545 	result = (NI)0;
3546 	T1_ = (int)0;
3547 	T1_ = system(nimToCStringConv(command));
3548 	T2_ = (int)0;
3549 	T2_ = exitStatusLikeShell__pureZos_1127(T1_);
3550 	result = ((NI) (T2_));
3551 	return result;
3552 }
N_NIMCALL(void,stdlib_osDatInit000)3553 N_LIB_PRIVATE N_NIMCALL(void, stdlib_osDatInit000)(void) {
3554 static TNimNode* TM__yu6cxgKBBXbNsTkT9cyMd4g_46_9[9];
3555 NI TM__yu6cxgKBBXbNsTkT9cyMd4g_48;
3556 static char* NIM_CONST TM__yu6cxgKBBXbNsTkT9cyMd4g_47[9] = {
3557 "fpUserExec",
3558 "fpUserWrite",
3559 "fpUserRead",
3560 "fpGroupExec",
3561 "fpGroupWrite",
3562 "fpGroupRead",
3563 "fpOthersExec",
3564 "fpOthersWrite",
3565 "fpOthersRead"};
3566 static TNimNode TM__yu6cxgKBBXbNsTkT9cyMd4g_0[10];
3567 NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.size = sizeof(tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA);
3568 NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.align = NIM_ALIGNOF(tyEnum_FilePermission__uTVeDpjCH6aWw9c74YkAskA);
3569 NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.kind = 14;
3570 NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.base = 0;
3571 NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.flags = 3;
3572 for (TM__yu6cxgKBBXbNsTkT9cyMd4g_48 = 0; TM__yu6cxgKBBXbNsTkT9cyMd4g_48 < 9; TM__yu6cxgKBBXbNsTkT9cyMd4g_48++) {
3573 TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_48+0].kind = 1;
3574 TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_48+0].offset = TM__yu6cxgKBBXbNsTkT9cyMd4g_48;
3575 TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_48+0].name = TM__yu6cxgKBBXbNsTkT9cyMd4g_47[TM__yu6cxgKBBXbNsTkT9cyMd4g_48];
3576 TM__yu6cxgKBBXbNsTkT9cyMd4g_46_9[TM__yu6cxgKBBXbNsTkT9cyMd4g_48] = &TM__yu6cxgKBBXbNsTkT9cyMd4g_0[TM__yu6cxgKBBXbNsTkT9cyMd4g_48+0];
3577 }
3578 TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9].len = 9; TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9].kind = 2; TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9].sons = &TM__yu6cxgKBBXbNsTkT9cyMd4g_46_9[0];
3579 NTIfilepermission__uTVeDpjCH6aWw9c74YkAskA_.node = &TM__yu6cxgKBBXbNsTkT9cyMd4g_0[9];
3580 }
3581 
3582