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