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