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