/* Generated by Nim Compiler v1.6.10 */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks

#include "nimbase.h"
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <setjmp.h>
#include <spawn.h>
#include <signal.h>
#include <sys/wait.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg;
typedef struct RootObj RootObj;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ;
typedef struct tyObject_StartProcessData__xgRnKnLIYRtnOkshMKhc9cA tyObject_StartProcessData__xgRnKnLIYRtnOkshMKhc9cA;
typedef struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ tySequence__sM4lkSb7zS6F7OVMvW9cffQ;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
typedef struct Exception Exception;
typedef struct tySequence__uB9b75OUPRENsBAu4AnoePA tySequence__uB9b75OUPRENsBAu4AnoePA;
typedef struct TSafePoint TSafePoint;
typedef struct tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
typedef struct tySequence__xv3aaFd3JCw8NbmALHiezQ tySequence__xv3aaFd3JCw8NbmALHiezQ;
typedef struct tyTuple__sPaDkVPSC0MkcoXCxPH9ccA tyTuple__sPaDkVPSC0MkcoXCxPH9ccA;
typedef struct tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA;
typedef struct tyObject_FileStreamObj__9bEVSsOIpkY9cf5lCtaS39bPQ tyObject_FileStreamObj__9bEVSsOIpkY9cf5lCtaS39bPQ;
typedef struct tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw;
typedef struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
typedef struct tySequence__PrBYolTs4TOSgE8v5oqDUQ tySequence__PrBYolTs4TOSgE8v5oqDUQ;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA;
typedef int tyArray__SKEqGXcReU4NvbQlH779b5Q[2];
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
struct RootObj {
TNimType* m_type;
};
struct tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg {
  RootObj Sup;
int inHandle;
int outHandle;
int errHandle;
pid_t id;
tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* inStream;
tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* outStream;
tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* errStream;
int exitStatus;
NIM_BOOL exitFlag;
tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA options;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef NU8 tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA;
struct tyObject_StartProcessData__xgRnKnLIYRtnOkshMKhc9cA {
NimStringDesc* sysCommand;
NCSTRING* sysArgs;
NCSTRING* sysEnv;
NCSTRING workingDir;
tyArray__SKEqGXcReU4NvbQlH779b5Q pStdin;
tyArray__SKEqGXcReU4NvbQlH779b5Q pStdout;
tyArray__SKEqGXcReU4NvbQlH779b5Q pStderr;
tyArray__SKEqGXcReU4NvbQlH779b5Q pErrorPipe;
tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA options;
};
struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SPr7N6UKfuF549bNPiUvSRw[256];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SPr7N6UKfuF549bNPiUvSRw freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
NI gcThreadId;
};
struct Exception {
  RootObj Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
tySequence__uB9b75OUPRENsBAu4AnoePA* trace;
Exception* up;
};
struct TSafePoint {
TSafePoint* prev;
NI status;
jmp_buf context;
};
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
typedef NCSTRING tyUncheckedArray__nvS6J9clHMUMHfoZd8Ad2zg[1];
typedef NU8 tyEnum_StringTableMode__G9c4wVDFIzf0xHmQvxso9a9cQ;
struct tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg {
  RootObj Sup;
NI counter;
tySequence__xv3aaFd3JCw8NbmALHiezQ* data;
tyEnum_StringTableMode__G9c4wVDFIzf0xHmQvxso9a9cQ mode;
};
struct tyTuple__sPaDkVPSC0MkcoXCxPH9ccA {
NimStringDesc* Field0;
NimStringDesc* Field1;
NIM_BOOL Field2;
};
typedef NimStringDesc* tyArray__24KAM9afIUgUaqBaEBB6r9bg[3];
typedef N_NIMCALL_PTR(void, tyProc__JQrsH08b4uPTH9cyFPlVOZg) (tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s);
typedef N_NIMCALL_PTR(NIM_BOOL, tyProc__9bmhFrLahRsL2hltfRDVtlQ) (tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s);
typedef N_NIMCALL_PTR(void, tyProc__3svSoGIUJIsHkaBL7q4DAQ) (tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s, NI pos);
typedef N_NIMCALL_PTR(NI, tyProc__xflqkf2D1uVClg70czEDHA) (tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s);
typedef N_NIMCALL_PTR(NI, tyProc__c9c0f59ak4YGQ6neEym8LPKw) (tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s, NimStringDesc** buffer, tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA slice);
typedef N_NIMCALL_PTR(NIM_BOOL, tyProc__7jFfqMk9ajToCz6Hv9atCA4A) (tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s, NimStringDesc** line);
typedef N_NIMCALL_PTR(NI, tyProc__2VVzVL9bOnKhj1eZKkf9cEuA) (tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s, void* buffer, NI bufLen);
typedef N_NIMCALL_PTR(void, tyProc__ki6p1QyfOkJLQJ9aw5NI0AQ) (tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s, void* buffer, NI bufLen);
struct tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ {
  RootObj Sup;
tyProc__JQrsH08b4uPTH9cyFPlVOZg closeImpl;
tyProc__9bmhFrLahRsL2hltfRDVtlQ atEndImpl;
tyProc__3svSoGIUJIsHkaBL7q4DAQ setPositionImpl;
tyProc__xflqkf2D1uVClg70czEDHA getPositionImpl;
tyProc__c9c0f59ak4YGQ6neEym8LPKw readDataStrImpl;
tyProc__7jFfqMk9ajToCz6Hv9atCA4A readLineImpl;
tyProc__2VVzVL9bOnKhj1eZKkf9cEuA readDataImpl;
tyProc__2VVzVL9bOnKhj1eZKkf9cEuA peekDataImpl;
tyProc__ki6p1QyfOkJLQJ9aw5NI0AQ writeDataImpl;
tyProc__JQrsH08b4uPTH9cyFPlVOZg flushImpl;
};
struct tyObject_FileStreamObj__9bEVSsOIpkY9cf5lCtaS39bPQ {
  tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ Sup;
FILE* f;
};
typedef NU8 tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg;
struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA {
  Exception Sup;
};
struct tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw {
  tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
};
typedef NimStringDesc* tyArray__8ZvwQIddfpj2THRVPsFzIQ[1];
struct tyTuple__XOVT24GHXwqiEj5GCsEGCA {
NimStringDesc* Field0;
NI Field1;
};
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (NI idx, void* ClE_0);
void* ClE_0;
} tyProc__SqRJqa5aOiKB4EuKlKh9asA;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (NI idx, tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p, void* ClE_0);
void* ClE_0;
} tyProc__oudJckli4GdxAXLVzBBlAw;
typedef N_CLOSURE_PTR(void, TM__HZdw8BhppcTQo8DIK46LSg_16) (NI idx);
typedef N_CLOSURE_PTR(void, TM__HZdw8BhppcTQo8DIK46LSg_18) (NI idx, tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p);
typedef N_CLOSURE_PTR(void, TM__HZdw8BhppcTQo8DIK46LSg_19) (NI idx);
typedef N_CLOSURE_PTR(void, TM__HZdw8BhppcTQo8DIK46LSg_20) (NI idx);
typedef N_CLOSURE_PTR(void, TM__HZdw8BhppcTQo8DIK46LSg_21) (NI idx, tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p);
struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA {
NCSTRING procname;
NI line;
NCSTRING filename;
};
struct tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA {
NI a;
NI b;
};
struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
struct tySequence__PrBYolTs4TOSgE8v5oqDUQ {
  TGenericSeq Sup;
  tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* data[SEQ_DECL_SIZE];
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
struct tySequence__uB9b75OUPRENsBAu4AnoePA {
  TGenericSeq Sup;
  tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA data[SEQ_DECL_SIZE];
};
struct tySequence__xv3aaFd3JCw8NbmALHiezQ {
  TGenericSeq Sup;
  tyTuple__sPaDkVPSC0MkcoXCxPH9ccA data[SEQ_DECL_SIZE];
};
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, Marker_tyRef__lw7iqc9cC7bi1oOZOAlJkJA)(void* p, NI op);
N_LIB_PRIVATE N_NOINLINE(void*, newObj)(TNimType* typ, NI size);
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__pureZos_387)(NI32 errorCode, NimStringDesc* additionalInfo);
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__pureZos_390)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_LIB_PRIVATE N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(void, decRef__system_5345)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, minuspercent___system_716)(NI x, NI y);
static N_INLINE(NIM_BOOL, ltpercent___system_1005)(NI x, NI y);
static N_INLINE(void, rtlAddZCT__system_5343)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__system_5294)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__system_5300)(void* usr);
N_LIB_PRIVATE N_NIMCALL(TGenericSeq*, incrSeqV3)(TGenericSeq* s, TNimType* typ);
N_LIB_PRIVATE N_NIMCALL(NCSTRING*, allocCStringArray__system_2469)(NimStringDesc** a, NI aLen_0);
static N_INLINE(void, pushSafePoint)(TSafePoint* s);
N_LIB_PRIVATE N_NIMCALL(NCSTRING*, envToCStringArray__pureZosproc_320)(void);
static N_INLINE(NIM_BOOL, eqeq___system_7753)(NCSTRING x, NCSTRING y);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str);
N_LIB_PRIVATE N_NIMCALL(NI, nsuFindChar)(NimStringDesc* s, NIM_CHAR sub, NI start, NI last);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__system_7773)(NimStringDesc* s, NI first, NI last);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__system_7785)(NimStringDesc* s, NI first);
N_LIB_PRIVATE N_NOCONV(void*, alloc0Impl__system_1745)(NI size);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, copyMem__system_1727)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_LIB_PRIVATE N_NOCONV(void*, allocImpl__system_1743)(NI size);
N_LIB_PRIVATE N_NIMCALL(NCSTRING*, envToCStringArray__pureZosproc_309)(tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg* t);
N_LIB_PRIVATE N_NIMCALL(NI, nstlen)(tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg* t);
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void);
N_LIB_PRIVATE N_NIMCALL(pid_t, startProcessAuxSpawn__pureZosproc_348)(tyObject_StartProcessData__xgRnKnLIYRtnOkshMKhc9cA* data);
static N_INLINE(NI, nimCStrLen)(NCSTRING a);
static N_INLINE(void, setCurrentDir__pureZos_713)(NimStringDesc* newDir);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nsuJoinSep)(NimStringDesc** a, NI aLen_0, NimStringDesc* sep);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0);
static N_INLINE(void, popSafePoint)(void);
N_LIB_PRIVATE N_NIMCALL(void, deallocCStringArray__system_2503)(NCSTRING* a);
N_LIB_PRIVATE N_NIMCALL(void, nimLeaveFinally)(void);
N_LIB_PRIVATE N_NIMCALL(void, reraiseException)(void);
N_LIB_PRIVATE N_NIMCALL(tyObject_FileStreamObj__9bEVSsOIpkY9cf5lCtaS39bPQ*, createStream__pureZosproc_612)(int* handle, tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg fileMode);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, open__systemZio_422)(FILE** f, int filehandle, tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg mode);
N_LIB_PRIVATE N_NIMCALL(tyObject_FileStreamObj__9bEVSsOIpkY9cf5lCtaS39bPQ*, newFileStream__pureZstreams_808)(FILE* f);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incRef__system_5338)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, pluspercent___system_696)(NI x, NI y);
N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__pureZos_1080)(int status);
static N_INLINE(NI, percentpercent___system_776)(NI x, NI y);
N_LIB_PRIVATE N_NIMCALL(pid_t, si_pid__posixZposix_219)(siginfo_t info);
N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e, NCSTRING ename, NCSTRING procname, NCSTRING filename, NI line);
N_LIB_PRIVATE N_NIMCALL(void, close__pureZstreams_57)(tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s);
N_LIB_PRIVATE N_NIMCALL(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg*, nospstartProcess)(NimStringDesc* command, NimStringDesc* workingDir, NimStringDesc** args, NI argsLen_0, tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg* env, tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA options);
N_LIB_PRIVATE N_NIMCALL(tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ*, nospoutputStream)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p);
N_LIB_PRIVATE N_NIMCALL(void, write__pureZstreams_177)(tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s, NimStringDesc* x);
N_LIB_PRIVATE N_NIMCALL(tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ*, nospinputStream)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p);
N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, readLine__pureZstreams_524)(tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* s, NimStringDesc** line);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_LIB_PRIVATE N_NIMCALL(NI, nosppeekExitCode)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isExitStatus__pureZosproc_306)(int status);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, WIFEXITED__posixZposix_875)(int s);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, WIFSIGNALED__posixZposix_884)(int s);
N_LIB_PRIVATE N_NIMCALL(void, nospclose)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p);
N_LIB_PRIVATE N_NIMCALL(NI, ncpicountProcessors)(void);
N_LIB_PRIVATE N_NIMCALL(tySequence__PrBYolTs4TOSgE8v5oqDUQ*, newSeq__pureZosproc_120)(NI len);
static N_NIMCALL(void, Marker_tySequence__PrBYolTs4TOSgE8v5oqDUQ)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(tySequence__qwqHTkRvwhrRyENtudHQ7g*, newSeq__pureZosproc_151)(NI len);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosprunning)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p);
N_LIB_PRIVATE N_NIMCALL(NI, nospwaitForExit)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p, NI timeout);
extern TNimType NTIrootobj__ytyiCJqK439aF9cIibuRVpAg_;
N_LIB_PRIVATE TNimType NTIprocessobj__2rGNQnv9bU4hanI2g3svReg_;
extern TNimType NTIfilehandle__2gIj3gQlK3HZJjQaYCP6ZQ_;
extern TNimType NTIpid__r9bTMVI8f19ah9b11jMgY4kPg_;
extern TNimType NTIstream__1G0jiQbe7KwD5ADza5AZaw_;
extern TNimType NTIcint__nlCscttRCss70IBTyuBqnA_;
extern TNimType NTIbool__VaVACK0bpYmqIQ0mKcHfQQ_;
N_LIB_PRIVATE TNimType NTIprocessoption__bnU6W8LhTMnT4JaSWtGlSA_;
N_LIB_PRIVATE TNimType NTIsetLprocessoptionT__HlmBYNr2gdAZMXOsuiSZ0A_;
N_LIB_PRIVATE TNimType NTIprocess__lw7iqc9cC7bi1oOZOAlJkJA_;
STRING_LITERAL(TM__HZdw8BhppcTQo8DIK46LSg_6, "/bin/sh", 7);
extern TNimType NTIseqLstringT__sM4lkSb7zS6F7OVMvW9cffQ_;
STRING_LITERAL(TM__HZdw8BhppcTQo8DIK46LSg_7, "-c", 2);
STRING_LITERAL(TM__HZdw8BhppcTQo8DIK46LSg_9, "=", 1);
STRING_LITERAL(TM__HZdw8BhppcTQo8DIK46LSg_11, " ", 1);
extern TNimType NTIrefvalueerror__Ie1m0dv1ZHg72IgPRr1cDw_;
extern TNimType NTIvalueerror__yoNlBGx0D2tRizIdhQuENw_;
STRING_LITERAL(TM__HZdw8BhppcTQo8DIK46LSg_13, "System time was modified", 24);
STRING_LITERAL(TM__HZdw8BhppcTQo8DIK46LSg_14, "\012", 1);
N_LIB_PRIVATE TNimType NTIseqLprocessT__PrBYolTs4TOSgE8v5oqDUQ_;
static NIM_CONST tyProc__SqRJqa5aOiKB4EuKlKh9asA TM__HZdw8BhppcTQo8DIK46LSg_15 = {NIM_NIL,NIM_NIL};
static NIM_CONST tyProc__oudJckli4GdxAXLVzBBlAw TM__HZdw8BhppcTQo8DIK46LSg_17 = {NIM_NIL,NIM_NIL};
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__system_5247;
extern TSafePoint* excHandler__system_2565;
extern TSafePoint* excHandler__system_2565;
extern NCSTRING* environ;
extern TSafePoint* excHandler__system_2565;
extern TSafePoint* excHandler__system_2565;
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
	nimSetMem__systemZmemory_7(p, ((int) 0), size);
}
static N_NIMCALL(void, Marker_tyRef__lw7iqc9cC7bi1oOZOAlJkJA)(void* p, NI op) {
	tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* a;
	a = (tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg*)p;
	nimGCvisit((void*)(*a).inStream, op);
	nimGCvisit((void*)(*a).outStream, op);
	nimGCvisit((void*)(*a).errStream, op);
}
static N_INLINE(NI, minuspercent___system_716)(NI x, NI y) {
	NI result;
	result = (NI)0;
	result = ((NI) ((NU)((NU64)(((NU) (x))) - (NU64)(((NU) (y))))));
	return result;
}
static N_INLINE(NIM_BOOL, ltpercent___system_1005)(NI x, NI y) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = ((NU64)(((NU) (x))) < (NU64)(((NU) (y))));
	return result;
}
static N_INLINE(void, rtlAddZCT__system_5343)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	addZCT__system_5294((&gch__system_5247.zct), c);
}
static N_INLINE(void, decRef__system_5345)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = minuspercent___system_716((*c).refcount, ((NI) 8));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = ltpercent___system_1005((*c).refcount, ((NI) 8));
		if (!T3_) goto LA4_;
		rtlAddZCT__system_5343(c);
	}
	LA4_: ;
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__system_5300)(void* usr) {
	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
	NI T1_;
	result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
	T1_ = (NI)0;
	T1_ = minuspercent___system_716(((NI) (ptrdiff_t) (usr)), ((NI) 16));
	result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) (T1_));
	return result;
}
static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T1_;
	T1_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
	T1_ = usrToCell__system_5300(p);
	decRef__system_5345(T1_);
}
static N_INLINE(void, pushSafePoint)(TSafePoint* s) {
	(*s).prev = excHandler__system_2565;
	excHandler__system_2565 = s;
}
static N_INLINE(NIM_BOOL, eqeq___system_7753)(NCSTRING x, NCSTRING y) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	{
		if (!(((void*) (x)) == ((void*) (y)))) goto LA3_;
		result = NIM_TRUE;
	}
	goto LA1_;
	LA3_: ;
	{
		NIM_BOOL T6_;
		T6_ = (NIM_BOOL)0;
		T6_ = (x == 0);
		if (T6_) goto LA7_;
		T6_ = (y == 0);
		LA7_: ;
		if (!T6_) goto LA8_;
		result = NIM_FALSE;
	}
	goto LA1_;
	LA8_: ;
	{
		int T11_;
		T11_ = (int)0;
		T11_ = strcmp(x, y);
		result = (T11_ == ((NI32) 0));
	}
	LA1_: ;
	return result;
}
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}
static N_INLINE(void, copyMem__system_1727)(void* dest, void* source, NI size) {
	nimCopyMem(dest, source, size);
}
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	{
		if (!!((src == ((NimStringDesc*) NIM_NIL)))) goto LA3_;
		copyMem__system_1727(((void*) ((&(*dest).data[(*dest).Sup.len]))), ((void*) ((*src).data)), ((NI) ((NI)((*src).Sup.len + ((NI) 1)))));
		(*dest).Sup.len += (*src).Sup.len;
	}
	LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(NCSTRING*, envToCStringArray__pureZosproc_320)(void) {
	NCSTRING* result;
	NI counter;
	void* T6_;
	NI i_2;
	result = (NCSTRING*)0;
	counter = ((NI) 0);
	{
		NimStringDesc* key;
		NimStringDesc* val;
		key = NIM_NIL;
		val = NIM_NIL;
		{
			tyTuple__UV3llMMYFckfui8YMBuUZA ai;
			NI i;
			nimZeroMem((void*)(&ai), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
			i = ((NI) 0);
			{
				while (1) {
					NIM_BOOL T5_;
					NimStringDesc* kv;
					NI p;
					tyTuple__UV3llMMYFckfui8YMBuUZA colontmp_;
					T5_ = (NIM_BOOL)0;
					T5_ = eqeq___system_7753(environ[i], ((NCSTRING) NIM_NIL));
					if (!!(T5_)) goto LA4;
					kv = cstrToNimstr(environ[i]);
					i += ((NI) 1);
					p = nsuFindChar(kv, 61, ((NI) 0), ((NI) 0));
					ai.Field0 = substr__system_7773(kv, ((NI) 0), (NI)(p - ((NI) 1)));
					ai.Field1 = substr__system_7785(kv, (NI)(p + ((NI) 1)));
					nimZeroMem((void*)(&colontmp_), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
					colontmp_.Field0 = copyString(ai.Field0);
					colontmp_.Field1 = copyString(ai.Field1);
					key = colontmp_.Field0;
					val = colontmp_.Field1;
					counter += ((NI) 1);
				} LA4: ;
			}
		}
	}
	T6_ = (void*)0;
	T6_ = alloc0Impl__system_1745(((NI) ((NI)((NI)(counter + ((NI) 1)) * ((NI) 8)))));
	result = ((NCSTRING*) (T6_));
	i_2 = ((NI) 0);
	{
		NimStringDesc* key_2;
		NimStringDesc* val_2;
		key_2 = NIM_NIL;
		val_2 = NIM_NIL;
		{
			tyTuple__UV3llMMYFckfui8YMBuUZA ai_2;
			NI i_3;
			nimZeroMem((void*)(&ai_2), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
			i_3 = ((NI) 0);
			{
				while (1) {
					NIM_BOOL T11_;
					NimStringDesc* kv_2;
					NI p_2;
					tyTuple__UV3llMMYFckfui8YMBuUZA colontmp__2;
					NimStringDesc* x;
					NimStringDesc* T12_;
					void* T13_;
					T11_ = (NIM_BOOL)0;
					T11_ = eqeq___system_7753(environ[i_3], ((NCSTRING) NIM_NIL));
					if (!!(T11_)) goto LA10;
					kv_2 = cstrToNimstr(environ[i_3]);
					i_3 += ((NI) 1);
					p_2 = nsuFindChar(kv_2, 61, ((NI) 0), ((NI) 0));
					ai_2.Field0 = substr__system_7773(kv_2, ((NI) 0), (NI)(p_2 - ((NI) 1)));
					ai_2.Field1 = substr__system_7785(kv_2, (NI)(p_2 + ((NI) 1)));
					nimZeroMem((void*)(&colontmp__2), sizeof(tyTuple__UV3llMMYFckfui8YMBuUZA));
					colontmp__2.Field0 = copyString(ai_2.Field0);
					colontmp__2.Field1 = copyString(ai_2.Field1);
					key_2 = colontmp__2.Field0;
					val_2 = colontmp__2.Field1;
					T12_ = NIM_NIL;
					T12_ = rawNewString((key_2 ? key_2->Sup.len : 0) + (val_2 ? val_2->Sup.len : 0) + 1);
appendString(T12_, key_2);
appendString(T12_, ((NimStringDesc*) &TM__HZdw8BhppcTQo8DIK46LSg_9));
appendString(T12_, val_2);
					x = T12_;
					T13_ = (void*)0;
					T13_ = allocImpl__system_1743(((NI) ((NI)((x ? x->Sup.len : 0) + ((NI) 1)))));
					result[i_2] = ((NCSTRING) (T13_));
					copyMem__system_1727(((void*) (result[i_2])), ((void*) ((&x->data[((NI) 0)]))), ((NI) ((NI)((x ? x->Sup.len : 0) + ((NI) 1)))));
					i_2 += ((NI) 1);
				} LA10: ;
			}
		}
	}
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NCSTRING*, envToCStringArray__pureZosproc_309)(tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg* t) {
	NCSTRING* result;
	NI T1_;
	void* T2_;
	NI i;
	result = (NCSTRING*)0;
	T1_ = (NI)0;
	T1_ = nstlen(t);
	T2_ = (void*)0;
	T2_ = alloc0Impl__system_1745(((NI) ((NI)((NI)(T1_ + ((NI) 1)) * ((NI) 8)))));
	result = ((NCSTRING*) (T2_));
	i = ((NI) 0);
	{
		NimStringDesc* key;
		NimStringDesc* val;
		key = NIM_NIL;
		val = NIM_NIL;
		{
			NI h;
			NI colontmp_;
			NI T5_;
			NI res;
			h = (NI)0;
			colontmp_ = (NI)0;
			T5_ = (((*t).data ? (*t).data->Sup.len : 0)-1);
			colontmp_ = T5_;
			res = ((NI) 0);
			{
				while (1) {
					if (!(res <= colontmp_)) goto LA7;
					h = res;
					{
						NimStringDesc* x;
						NimStringDesc* T12_;
						void* T13_;
						if (!(*t).data->data[h].Field2) goto LA10_;
						key = (*t).data->data[h].Field0;
						val = (*t).data->data[h].Field1;
						T12_ = NIM_NIL;
						T12_ = rawNewString((key ? key->Sup.len : 0) + (val ? val->Sup.len : 0) + 1);
appendString(T12_, key);
appendString(T12_, ((NimStringDesc*) &TM__HZdw8BhppcTQo8DIK46LSg_9));
appendString(T12_, val);
						x = T12_;
						T13_ = (void*)0;
						T13_ = allocImpl__system_1743(((NI) ((NI)((x ? x->Sup.len : 0) + ((NI) 1)))));
						result[i] = ((NCSTRING) (T13_));
						copyMem__system_1727(((void*) (result[i])), ((void*) ((&x->data[((NI) 0)]))), ((NI) ((NI)((x ? x->Sup.len : 0) + ((NI) 1)))));
						i += ((NI) 1);
					}
					LA10_: ;
					res += ((NI) 1);
				} LA7: ;
			}
		}
	}
	return result;
}
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s) {
	NCSTRING result;
	result = (NCSTRING)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (s == ((NimStringDesc*) NIM_NIL));
		if (T3_) goto LA4_;
		T3_ = ((*s).Sup.len == ((NI) 0));
		LA4_: ;
		if (!T3_) goto LA5_;
		result = "";
	}
	goto LA1_;
	LA5_: ;
	{
		result = ((NCSTRING) ((*s).data));
	}
	LA1_: ;
	return result;
}
static N_INLINE(NI, nimCStrLen)(NCSTRING a) {
	NI result;
	size_t T1_;
	result = (NI)0;
	T1_ = (size_t)0;
	T1_ = strlen(a);
	result = ((NI) (T1_));
	return result;
}
static N_INLINE(void, setCurrentDir__pureZos_713)(NimStringDesc* newDir) {
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = chdir(nimToCStringConv(newDir));
		if (!!((T3_ == ((NI32) 0)))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__pureZos_390();
		raiseOSError__pureZos_387(T6_, newDir);
	}
	LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(pid_t, startProcessAuxSpawn__pureZosproc_348)(tyObject_StartProcessData__xgRnKnLIYRtnOkshMKhc9cA* data) {
	pid_t result;
	posix_spawnattr_t attr;
	posix_spawn_file_actions_t fops;
	sigset_t mask;
	NI32 flags;
	int res;
	pid_t pid;
	int T106_;
	int T107_;
{	result = (pid_t)0;
	nimZeroMem((void*)(&attr), sizeof(posix_spawnattr_t));
	nimZeroMem((void*)(&fops), sizeof(posix_spawn_file_actions_t));
	{
		int T3_;
		NI32 T6_;
		T3_ = (int)0;
		T3_ = posix_spawn_file_actions_init((&fops));
		if (!!((T3_ == ((NI32) 0)))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__pureZos_390();
		raiseOSError__pureZos_387(T6_, ((NimStringDesc*) NIM_NIL));
	}
	LA4_: ;
	{
		int T9_;
		NI32 T12_;
		T9_ = (int)0;
		T9_ = posix_spawnattr_init((&attr));
		if (!!((T9_ == ((NI32) 0)))) goto LA10_;
		T12_ = (NI32)0;
		T12_ = osLastError__pureZos_390();
		raiseOSError__pureZos_387(T12_, ((NimStringDesc*) NIM_NIL));
	}
	LA10_: ;
	mask = (sigset_t)0;
	{
		int T15_;
		NI32 T18_;
		T15_ = (int)0;
		T15_ = sigemptyset((&mask));
		if (!!((T15_ == ((NI32) 0)))) goto LA16_;
		T18_ = (NI32)0;
		T18_ = osLastError__pureZos_390();
		raiseOSError__pureZos_387(T18_, ((NimStringDesc*) NIM_NIL));
	}
	LA16_: ;
	{
		int T21_;
		NI32 T24_;
		T21_ = (int)0;
		T21_ = posix_spawnattr_setsigmask((&attr), (&mask));
		if (!!((T21_ == ((NI32) 0)))) goto LA22_;
		T24_ = (NI32)0;
		T24_ = osLastError__pureZos_390();
		raiseOSError__pureZos_387(T24_, ((NimStringDesc*) NIM_NIL));
	}
	LA22_: ;
	{
		if (!(((*data).options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 6))&7U)))!=0)) goto LA27_;
		{
			int T31_;
			NI32 T34_;
			T31_ = (int)0;
			T31_ = posix_spawnattr_setpgroup((&attr), ((NI32) 0));
			if (!!((T31_ == ((NI32) 0)))) goto LA32_;
			T34_ = (NI32)0;
			T34_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T34_, ((NimStringDesc*) NIM_NIL));
		}
		LA32_: ;
	}
	LA27_: ;
	flags = ((NI32) 96);
	{
		if (!(((*data).options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 6))&7U)))!=0)) goto LA37_;
		flags = (NI32)(flags | ((int) 2));
	}
	LA37_: ;
	{
		int T41_;
		NI32 T44_;
		T41_ = (int)0;
		T41_ = posix_spawnattr_setflags((&attr), flags);
		if (!!((T41_ == ((NI32) 0)))) goto LA42_;
		T44_ = (NI32)0;
		T44_ = osLastError__pureZos_390();
		raiseOSError__pureZos_387(T44_, ((NimStringDesc*) NIM_NIL));
	}
	LA42_: ;
	{
		if (!!((((*data).options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 4))&7U)))!=0))) goto LA47_;
		{
			int T51_;
			NI32 T54_;
			T51_ = (int)0;
			T51_ = posix_spawn_file_actions_addclose((&fops), (*data).pStdin[(((NI) 1))- 0]);
			if (!!((T51_ == ((NI32) 0)))) goto LA52_;
			T54_ = (NI32)0;
			T54_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T54_, ((NimStringDesc*) NIM_NIL));
		}
		LA52_: ;
		{
			int T57_;
			NI32 T60_;
			T57_ = (int)0;
			T57_ = posix_spawn_file_actions_adddup2((&fops), (*data).pStdin[(((NI) 0))- 0], ((int) 0));
			if (!!((T57_ == ((NI32) 0)))) goto LA58_;
			T60_ = (NI32)0;
			T60_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T60_, ((NimStringDesc*) NIM_NIL));
		}
		LA58_: ;
		{
			int T63_;
			NI32 T66_;
			T63_ = (int)0;
			T63_ = posix_spawn_file_actions_addclose((&fops), (*data).pStdout[(((NI) 0))- 0]);
			if (!!((T63_ == ((NI32) 0)))) goto LA64_;
			T66_ = (NI32)0;
			T66_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T66_, ((NimStringDesc*) NIM_NIL));
		}
		LA64_: ;
		{
			int T69_;
			NI32 T72_;
			T69_ = (int)0;
			T69_ = posix_spawn_file_actions_adddup2((&fops), (*data).pStdout[(((NI) 1))- 0], ((int) 1));
			if (!!((T69_ == ((NI32) 0)))) goto LA70_;
			T72_ = (NI32)0;
			T72_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T72_, ((NimStringDesc*) NIM_NIL));
		}
		LA70_: ;
		{
			int T75_;
			NI32 T78_;
			T75_ = (int)0;
			T75_ = posix_spawn_file_actions_addclose((&fops), (*data).pStderr[(((NI) 0))- 0]);
			if (!!((T75_ == ((NI32) 0)))) goto LA76_;
			T78_ = (NI32)0;
			T78_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T78_, ((NimStringDesc*) NIM_NIL));
		}
		LA76_: ;
		{
			if (!(((*data).options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 3))&7U)))!=0)) goto LA81_;
			{
				int T85_;
				NI32 T88_;
				T85_ = (int)0;
				T85_ = posix_spawn_file_actions_adddup2((&fops), (*data).pStdout[(((NI) 1))- 0], ((int) 2));
				if (!!((T85_ == ((NI32) 0)))) goto LA86_;
				T88_ = (NI32)0;
				T88_ = osLastError__pureZos_390();
				raiseOSError__pureZos_387(T88_, ((NimStringDesc*) NIM_NIL));
			}
			LA86_: ;
		}
		goto LA79_;
		LA81_: ;
		{
			{
				int T92_;
				NI32 T95_;
				T92_ = (int)0;
				T92_ = posix_spawn_file_actions_adddup2((&fops), (*data).pStderr[(((NI) 1))- 0], ((int) 2));
				if (!!((T92_ == ((NI32) 0)))) goto LA93_;
				T95_ = (NI32)0;
				T95_ = osLastError__pureZos_390();
				raiseOSError__pureZos_387(T95_, ((NimStringDesc*) NIM_NIL));
			}
			LA93_: ;
		}
		LA79_: ;
	}
	LA47_: ;
	res = (int)0;
	{
		NimStringDesc* T100_;
		if (!(((NI) 0) < ((*data).workingDir ? nimCStrLen((*data).workingDir) : 0))) goto LA98_;
		T100_ = NIM_NIL;
		T100_ = cstrToNimstr((*data).workingDir);
		setCurrentDir__pureZos_713(T100_);
	}
	LA98_: ;
	pid = (pid_t)0;
	{
		if (!(((*data).options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 1))&7U)))!=0)) goto LA103_;
		res = posix_spawnp((&pid), nimToCStringConv((*data).sysCommand), (&fops), (&attr), (*data).sysArgs, (*data).sysEnv);
	}
	goto LA101_;
	LA103_: ;
	{
		res = posix_spawn((&pid), nimToCStringConv((*data).sysCommand), (&fops), (&attr), (*data).sysArgs, (*data).sysEnv);
	}
	LA101_: ;
	T106_ = (int)0;
	T106_ = posix_spawn_file_actions_destroy((&fops));
	(void)(T106_);
	T107_ = (int)0;
	T107_ = posix_spawnattr_destroy((&attr));
	(void)(T107_);
	{
		if (!!((res == ((NI32) 0)))) goto LA110_;
		raiseOSError__pureZos_387(res, (*data).sysCommand);
	}
	LA110_: ;
	result = pid;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, popSafePoint)(void) {
	excHandler__system_2565 = (*excHandler__system_2565).prev;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg*, nospstartProcess)(NimStringDesc* command, NimStringDesc* workingDir, NimStringDesc** args, NI argsLen_0, tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg* env, tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA options) {
	tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* result;
	tyArray__SKEqGXcReU4NvbQlH779b5Q pStdin;
	tyArray__SKEqGXcReU4NvbQlH779b5Q pStdout;
	tyArray__SKEqGXcReU4NvbQlH779b5Q pStderr;
	tyObject_StartProcessData__xgRnKnLIYRtnOkshMKhc9cA data;
	tySequence__sM4lkSb7zS6F7OVMvW9cffQ* sysArgsRaw;
	pid_t pid;
	NCSTRING* sysArgs;
	TSafePoint TM__HZdw8BhppcTQo8DIK46LSg_8;
	NCSTRING* sysEnv;
	TSafePoint TM__HZdw8BhppcTQo8DIK46LSg_10;
	NimStringDesc* currentDir;
	result = NIM_NIL;
	nimZeroMem((void*)pStdin, sizeof(tyArray__SKEqGXcReU4NvbQlH779b5Q));
	nimZeroMem((void*)pStdout, sizeof(tyArray__SKEqGXcReU4NvbQlH779b5Q));
	nimZeroMem((void*)pStderr, sizeof(tyArray__SKEqGXcReU4NvbQlH779b5Q));
	result = (tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg*) newObj((&NTIprocess__lw7iqc9cC7bi1oOZOAlJkJA_), sizeof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg));
	(*result).Sup.m_type = (&NTIprocessobj__2rGNQnv9bU4hanI2g3svReg_);
	(*result).options = options;
	(*result).exitFlag = NIM_TRUE;
	{
		if (!!(((options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 4))&7U)))!=0))) goto LA3_;
		{
			NIM_BOOL T7_;
			NIM_BOOL T8_;
			int T9_;
			int T11_;
			int T13_;
			NI32 T16_;
			T7_ = (NIM_BOOL)0;
			T8_ = (NIM_BOOL)0;
			T9_ = (int)0;
			T9_ = pipe(pStdin);
			T8_ = !((T9_ == ((NI32) 0)));
			if (T8_) goto LA10_;
			T11_ = (int)0;
			T11_ = pipe(pStdout);
			T8_ = !((T11_ == ((NI32) 0)));
			LA10_: ;
			T7_ = T8_;
			if (T7_) goto LA12_;
			T13_ = (int)0;
			T13_ = pipe(pStderr);
			T7_ = !((T13_ == ((NI32) 0)));
			LA12_: ;
			if (!T7_) goto LA14_;
			T16_ = (NI32)0;
			T16_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T16_, ((NimStringDesc*) NIM_NIL));
		}
		LA14_: ;
	}
	LA3_: ;
	nimZeroMem((void*)(&data), sizeof(tyObject_StartProcessData__xgRnKnLIYRtnOkshMKhc9cA));
	sysArgsRaw = NIM_NIL;
	{
		NimStringDesc* T21_;
		NimStringDesc* T22_;
		NimStringDesc* T23_;
		if (!((options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 2))&7U)))!=0)) goto LA19_;
		data.sysCommand = copyString(((NimStringDesc*) &TM__HZdw8BhppcTQo8DIK46LSg_6));
		sysArgsRaw = (tySequence__sM4lkSb7zS6F7OVMvW9cffQ*) newSeq((&NTIseqLstringT__sM4lkSb7zS6F7OVMvW9cffQ_), 3);
		T21_ = NIM_NIL;
		T21_ = sysArgsRaw->data[0]; sysArgsRaw->data[0] = copyStringRC1(((NimStringDesc*) &TM__HZdw8BhppcTQo8DIK46LSg_6));
		if (T21_) nimGCunrefNoCycle(T21_);
		T22_ = NIM_NIL;
		T22_ = sysArgsRaw->data[1]; sysArgsRaw->data[1] = copyStringRC1(((NimStringDesc*) &TM__HZdw8BhppcTQo8DIK46LSg_7));
		if (T22_) nimGCunrefNoCycle(T22_);
		T23_ = NIM_NIL;
		T23_ = sysArgsRaw->data[2]; sysArgsRaw->data[2] = copyStringRC1(command);
		if (T23_) nimGCunrefNoCycle(T23_);
	}
	goto LA17_;
	LA19_: ;
	{
		NimStringDesc* T25_;
		data.sysCommand = copyString(command);
		sysArgsRaw = (tySequence__sM4lkSb7zS6F7OVMvW9cffQ*) newSeq((&NTIseqLstringT__sM4lkSb7zS6F7OVMvW9cffQ_), 1);
		T25_ = NIM_NIL;
		T25_ = sysArgsRaw->data[0]; sysArgsRaw->data[0] = copyStringRC1(command);
		if (T25_) nimGCunrefNoCycle(T25_);
		{
			NimStringDesc** arg;
			NI i;
			arg = (NimStringDesc**)0;
			i = ((NI) 0);
			{
				while (1) {
					NI T29_;
					NimStringDesc* T30_;
					if (!(i < argsLen_0)) goto LA28;
					arg = (&args[i]);
					sysArgsRaw = (tySequence__sM4lkSb7zS6F7OVMvW9cffQ*) incrSeqV3((TGenericSeq*)(sysArgsRaw), (&NTIseqLstringT__sM4lkSb7zS6F7OVMvW9cffQ_));
					T29_ = sysArgsRaw->Sup.len++;
					T30_ = NIM_NIL;
					T30_ = sysArgsRaw->data[T29_]; sysArgsRaw->data[T29_] = copyStringRC1((*arg));
					if (T30_) nimGCunrefNoCycle(T30_);
					i += ((NI) 1);
				} LA28: ;
			}
		}
	}
	LA17_: ;
	pid = (pid_t)0;
	sysArgs = allocCStringArray__system_2469((sysArgsRaw) ? (sysArgsRaw->data) : NIM_NIL, (sysArgsRaw ? sysArgsRaw->Sup.len : 0));
	pushSafePoint(&TM__HZdw8BhppcTQo8DIK46LSg_8);
	TM__HZdw8BhppcTQo8DIK46LSg_8.status = setjmp(TM__HZdw8BhppcTQo8DIK46LSg_8.context);
	if (TM__HZdw8BhppcTQo8DIK46LSg_8.status == 0) {
	{
		if (!(env == ((tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg*) NIM_NIL))) goto LA33_;
		sysEnv = envToCStringArray__pureZosproc_320();
	}
	goto LA31_;
	LA33_: ;
	{
		sysEnv = envToCStringArray__pureZosproc_309(env);
	}
	LA31_: ;
	pushSafePoint(&TM__HZdw8BhppcTQo8DIK46LSg_10);
	TM__HZdw8BhppcTQo8DIK46LSg_10.status = setjmp(TM__HZdw8BhppcTQo8DIK46LSg_10.context);
	if (TM__HZdw8BhppcTQo8DIK46LSg_10.status == 0) {
	data.sysArgs = sysArgs;
	data.sysEnv = sysEnv;
	nimCopyMem((void*)data.pStdin, (NIM_CONST void*)pStdin, sizeof(tyArray__SKEqGXcReU4NvbQlH779b5Q));
	nimCopyMem((void*)data.pStdout, (NIM_CONST void*)pStdout, sizeof(tyArray__SKEqGXcReU4NvbQlH779b5Q));
	nimCopyMem((void*)data.pStderr, (NIM_CONST void*)pStderr, sizeof(tyArray__SKEqGXcReU4NvbQlH779b5Q));
	data.workingDir = nimToCStringConv(workingDir);
	data.options = options;
	currentDir = nosgetCurrentDir();
	pid = startProcessAuxSpawn__pureZosproc_348((&data));
	{
		if (!(((NI) 0) < (workingDir ? workingDir->Sup.len : 0))) goto LA38_;
		setCurrentDir__pureZos_713(currentDir);
	}
	LA38_: ;
	{
		tyArray__24KAM9afIUgUaqBaEBB6r9bg T44_;
		if (!((options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 0))&7U)))!=0)) goto LA42_;
		nimZeroMem((void*)T44_, sizeof(tyArray__24KAM9afIUgUaqBaEBB6r9bg));
		T44_[0] = copyString(command);
		T44_[1] = copyString(((NimStringDesc*) &TM__HZdw8BhppcTQo8DIK46LSg_11));
		T44_[2] = nsuJoinSep(args, argsLen_0, ((NimStringDesc*) &TM__HZdw8BhppcTQo8DIK46LSg_11));
		echoBinSafe(T44_, 3);
	}
	LA42_: ;
	(*result).id = pid;
	(*result).exitFlag = NIM_FALSE;
	{
		if (!((options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 4))&7U)))!=0)) goto LA47_;
		(*result).inHandle = ((int) 0);
		(*result).outHandle = ((int) 1);
		{
			if (!((options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 3))&7U)))!=0)) goto LA51_;
			(*result).errHandle = (*result).outHandle;
		}
		goto LA49_;
		LA51_: ;
		{
			(*result).errHandle = ((int) 2);
		}
		LA49_: ;
	}
	goto LA45_;
	LA47_: ;
	{
		int T61_;
		int T62_;
		int T63_;
		(*result).inHandle = pStdin[(((NI) 1))- 0];
		(*result).outHandle = pStdout[(((NI) 0))- 0];
		{
			int T59_;
			if (!((options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 3))&7U)))!=0)) goto LA57_;
			(*result).errHandle = (*result).outHandle;
			T59_ = (int)0;
			T59_ = close(pStderr[(((NI) 0))- 0]);
			(void)(T59_);
		}
		goto LA55_;
		LA57_: ;
		{
			(*result).errHandle = pStderr[(((NI) 0))- 0];
		}
		LA55_: ;
		T61_ = (int)0;
		T61_ = close(pStderr[(((NI) 1))- 0]);
		(void)(T61_);
		T62_ = (int)0;
		T62_ = close(pStdin[(((NI) 0))- 0]);
		(void)(T62_);
		T63_ = (int)0;
		T63_ = close(pStdout[(((NI) 1))- 0]);
		(void)(T63_);
	}
	LA45_: ;
	popSafePoint();
	}
	else {
		popSafePoint();
	}
	{
		deallocCStringArray__system_2503(sysEnv);
		if (TM__HZdw8BhppcTQo8DIK46LSg_10.status != 0) nimLeaveFinally();
	}
	if (TM__HZdw8BhppcTQo8DIK46LSg_10.status != 0) reraiseException();
	popSafePoint();
	}
	else {
		popSafePoint();
	}
	{
		deallocCStringArray__system_2503(sysArgs);
		if (TM__HZdw8BhppcTQo8DIK46LSg_8.status != 0) nimLeaveFinally();
	}
	if (TM__HZdw8BhppcTQo8DIK46LSg_8.status != 0) reraiseException();
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_FileStreamObj__9bEVSsOIpkY9cf5lCtaS39bPQ*, createStream__pureZosproc_612)(int* handle, tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg fileMode) {
	tyObject_FileStreamObj__9bEVSsOIpkY9cf5lCtaS39bPQ* result;
	FILE* f;
{	result = NIM_NIL;
	f = (FILE*)0;
	{
		NIM_BOOL T3_;
		NI32 T6_;
		T3_ = (NIM_BOOL)0;
		T3_ = open__systemZio_422(&f, (*handle), fileMode);
		if (!!(T3_)) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__pureZos_390();
		raiseOSError__pureZos_387(T6_, ((NimStringDesc*) NIM_NIL));
	}
	LA4_: ;
	result = newFileStream__pureZstreams_808(f);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NI, pluspercent___system_696)(NI x, NI y) {
	NI result;
	result = (NI)0;
	result = ((NI) ((NU)((NU64)(((NU) (x))) + (NU64)(((NU) (y))))));
	return result;
}
static N_INLINE(void, incRef__system_5338)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = pluspercent___system_696((*c).refcount, ((NI) 8));
}
static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T5_;
		if (!!((src == NIM_NIL))) goto LA3_;
		T5_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
		T5_ = usrToCell__system_5300(src);
		incRef__system_5338(T5_);
	}
	LA3_: ;
	{
		tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T10_;
		if (!!(((*dest) == NIM_NIL))) goto LA8_;
		T10_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
		T10_ = usrToCell__system_5300((*dest));
		decRef__system_5345(T10_);
	}
	LA8_: ;
	(*dest) = src;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ*, nospinputStream)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p) {
	tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* result;
{	result = NIM_NIL;
	{
		tyObject_FileStreamObj__9bEVSsOIpkY9cf5lCtaS39bPQ* T5_;
		if (!((*p).inStream == ((tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ*) NIM_NIL))) goto LA3_;
		T5_ = NIM_NIL;
		T5_ = createStream__pureZosproc_612((&(*p).inHandle), ((tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg) 1));
		asgnRef((void**) (&(*p).inStream), &T5_->Sup);
	}
	LA3_: ;
	result = (*p).inStream;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ*, nospoutputStream)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p) {
	tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* result;
{	result = NIM_NIL;
	{
		tyObject_FileStreamObj__9bEVSsOIpkY9cf5lCtaS39bPQ* T5_;
		if (!((*p).outStream == ((tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ*) NIM_NIL))) goto LA3_;
		T5_ = NIM_NIL;
		T5_ = createStream__pureZosproc_612((&(*p).outHandle), ((tyEnum_FileMode__ZJfK20XeZ9bv2j1pZjw9aswg) 0));
		asgnRef((void**) (&(*p).outStream), &T5_->Sup);
	}
	LA3_: ;
	result = (*p).outStream;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NI, percentpercent___system_776)(NI x, NI y) {
	NI result;
	result = (NI)0;
	result = ((NI) ((NU)((NU64)(((NU) (x))) % (NU64)(((NU) (y))))));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, nospwaitForExit)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p, NI timeout) {
	NI result;
	int T133_;
{	result = (NI)0;
	{
		int T5_;
		if (!(*p).exitFlag) goto LA3_;
		T5_ = (int)0;
		T5_ = exitStatusLikeShell__pureZos_1080((*p).exitStatus);
		result = ((NI) (T5_));
		goto BeforeRet_;
	}
	LA3_: ;
	{
		int status;
		if (!(timeout == ((NI) -1))) goto LA8_;
		status = ((int) 1);
		{
			pid_t T12_;
			NI32 T15_;
			T12_ = (pid_t)0;
			T12_ = waitpid((*p).id, (&status), ((int) 0));
			if (!(T12_ < ((NI32) 0))) goto LA13_;
			T15_ = (NI32)0;
			T15_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T15_, ((NimStringDesc*) NIM_NIL));
		}
		LA13_: ;
		(*p).exitFlag = NIM_TRUE;
		(*p).exitStatus = status;
	}
	goto LA6_;
	LA8_: ;
	{
		sigset_t nmask;
		sigset_t omask;
		siginfo_t sinfo;
		struct timespec stspec;
		struct timespec enspec;
		struct timespec tmspec;
		int T17_;
		int T18_;
		int T19_;
		TSafePoint TM__HZdw8BhppcTQo8DIK46LSg_12;
		nmask = (sigset_t)0;
		omask = (sigset_t)0;
		nimZeroMem((void*)(&sinfo), sizeof(siginfo_t));
		nimZeroMem((void*)(&stspec), sizeof(struct timespec));
		nimZeroMem((void*)(&enspec), sizeof(struct timespec));
		nimZeroMem((void*)(&tmspec), sizeof(struct timespec));
		T17_ = (int)0;
		T17_ = sigemptyset((&nmask));
		(void)(T17_);
		T18_ = (int)0;
		T18_ = sigemptyset((&omask));
		(void)(T18_);
		T19_ = (int)0;
		T19_ = sigaddset((&nmask), ((int) 20));
		(void)(T19_);
		{
			int T22_;
			NI32 T25_;
			T22_ = (int)0;
			T22_ = sigprocmask(((int) 1), (&nmask), (&omask));
			if (!(T22_ == ((NI32) -1))) goto LA23_;
			T25_ = (NI32)0;
			T25_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T25_, ((NimStringDesc*) NIM_NIL));
		}
		LA23_: ;
		{
			NI T30_;
			if (!(((NI) 1000) <= timeout)) goto LA28_;
			tmspec.tv_sec = (NI)(timeout / ((NI) 1000));
			T30_ = (NI)0;
			T30_ = percentpercent___system_776(timeout, ((NI) 1000));
			tmspec.tv_nsec = (NI)(T30_ * ((NI) 1000000));
		}
		goto LA26_;
		LA28_: ;
		{
			tmspec.tv_sec = ((long) 0);
			tmspec.tv_nsec = (NI)(timeout * ((NI) 1000000));
		}
		LA26_: ;
		pushSafePoint(&TM__HZdw8BhppcTQo8DIK46LSg_12);
		TM__HZdw8BhppcTQo8DIK46LSg_12.status = setjmp(TM__HZdw8BhppcTQo8DIK46LSg_12.context);
		if (TM__HZdw8BhppcTQo8DIK46LSg_12.status == 0) {
		{
			int T34_;
			NI32 T37_;
			T34_ = (int)0;
			T34_ = clock_gettime(((int) 1), (&stspec));
			if (!(T34_ == ((NI32) -1))) goto LA35_;
			T37_ = (NI32)0;
			T37_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T37_, ((NimStringDesc*) NIM_NIL));
		}
		LA35_: ;
		{
			while (1) {
				int res;
				res = sigtimedwait((&nmask), (&sinfo), (&tmspec));
				{
					if (!(res == ((int) 20))) goto LA42_;
					{
						pid_t T46_;
						int status_2;
						T46_ = (pid_t)0;
						T46_ = si_pid__posixZposix_219(sinfo);
						if (!(T46_ == (*p).id)) goto LA47_;
						status_2 = ((int) 1);
						{
							pid_t T51_;
							NI32 T54_;
							T51_ = (pid_t)0;
							T51_ = waitpid((*p).id, (&status_2), ((int) 0));
							if (!(T51_ < ((NI32) 0))) goto LA52_;
							T54_ = (NI32)0;
							T54_ = osLastError__pureZos_390();
							raiseOSError__pureZos_387(T54_, ((NimStringDesc*) NIM_NIL));
						}
						LA52_: ;
						(*p).exitFlag = NIM_TRUE;
						(*p).exitStatus = status_2;
						goto LA38;
					}
					goto LA44_;
					LA47_: ;
					{
						NI volatile diffX60gensym83_;
						struct timespec bX60gensym83_;
						{
							int T58_;
							NI32 T61_;
							T58_ = (int)0;
							T58_ = clock_gettime(((int) 1), (&enspec));
							if (!(T58_ == ((NI32) -1))) goto LA59_;
							T61_ = (NI32)0;
							T61_ = osLastError__pureZos_390();
							raiseOSError__pureZos_387(T61_, ((NimStringDesc*) NIM_NIL));
						}
						LA59_: ;
						diffX60gensym83_ = (NI)0;
						nimZeroMem((void*)(&bX60gensym83_), sizeof(struct timespec));
						bX60gensym83_.tv_sec = enspec.tv_sec;
						bX60gensym83_.tv_nsec = enspec.tv_nsec;
						enspec.tv_sec = (long)(enspec.tv_sec - stspec.tv_sec);
						{
							if (!(stspec.tv_nsec <= enspec.tv_nsec)) goto LA64_;
							enspec.tv_nsec -= stspec.tv_nsec;
						}
						goto LA62_;
						LA64_: ;
						{
							{
								tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T71_;
								NimStringDesc* T72_;
								if (!(enspec.tv_sec == ((long) 0))) goto LA69_;
								T71_ = NIM_NIL;
								T71_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTIrefvalueerror__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
								(*T71_).Sup.Sup.Sup.m_type = (&NTIvalueerror__yoNlBGx0D2tRizIdhQuENw_);
								(*T71_).Sup.Sup.name = "ValueError";
								T72_ = NIM_NIL;
								T72_ = (*T71_).Sup.Sup.message; (*T71_).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TM__HZdw8BhppcTQo8DIK46LSg_13));
								if (T72_) nimGCunrefNoCycle(T72_);
								asgnRef((void**) (&(*T71_).Sup.Sup.parent), ((Exception*) NIM_NIL));
								raiseExceptionEx((Exception*)T71_, "ValueError", "waitForExit", "osproc.nim", 1378);
							}
							goto LA67_;
							LA69_: ;
							{
								diffX60gensym83_ = (NI)(stspec.tv_nsec - enspec.tv_nsec);
								enspec.tv_nsec = (NI)(((NI) 1000000000) - diffX60gensym83_);
							}
							LA67_: ;
						}
						LA62_: ;
						tmspec.tv_sec = (long)(tmspec.tv_sec - enspec.tv_sec);
						{
							if (!(enspec.tv_nsec <= tmspec.tv_nsec)) goto LA76_;
							tmspec.tv_nsec -= enspec.tv_nsec;
						}
						goto LA74_;
						LA76_: ;
						{
							tmspec.tv_sec = (long)(tmspec.tv_sec - ((long) 1));
							diffX60gensym83_ = (NI)(enspec.tv_nsec - tmspec.tv_nsec);
							tmspec.tv_nsec = (NI)(((NI) 1000000000) - diffX60gensym83_);
						}
						LA74_: ;
						stspec.tv_sec = bX60gensym83_.tv_sec;
						stspec.tv_nsec = bX60gensym83_.tv_nsec;
					}
					LA44_: ;
				}
				goto LA40_;
				LA42_: ;
				{
					NI32 err;
					if (!(res < ((NI32) 0))) goto LA80_;
					err = osLastError__pureZos_390();
					{
						NI volatile diffX60gensym87_;
						struct timespec bX60gensym87_;
						if (!(err == ((int) 4))) goto LA84_;
						{
							int T88_;
							NI32 T91_;
							T88_ = (int)0;
							T88_ = clock_gettime(((int) 1), (&enspec));
							if (!(T88_ == ((NI32) -1))) goto LA89_;
							T91_ = (NI32)0;
							T91_ = osLastError__pureZos_390();
							raiseOSError__pureZos_387(T91_, ((NimStringDesc*) NIM_NIL));
						}
						LA89_: ;
						diffX60gensym87_ = (NI)0;
						nimZeroMem((void*)(&bX60gensym87_), sizeof(struct timespec));
						bX60gensym87_.tv_sec = enspec.tv_sec;
						bX60gensym87_.tv_nsec = enspec.tv_nsec;
						enspec.tv_sec = (long)(enspec.tv_sec - stspec.tv_sec);
						{
							if (!(stspec.tv_nsec <= enspec.tv_nsec)) goto LA94_;
							enspec.tv_nsec -= stspec.tv_nsec;
						}
						goto LA92_;
						LA94_: ;
						{
							{
								tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T101_;
								NimStringDesc* T102_;
								if (!(enspec.tv_sec == ((long) 0))) goto LA99_;
								T101_ = NIM_NIL;
								T101_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTIrefvalueerror__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
								(*T101_).Sup.Sup.Sup.m_type = (&NTIvalueerror__yoNlBGx0D2tRizIdhQuENw_);
								(*T101_).Sup.Sup.name = "ValueError";
								T102_ = NIM_NIL;
								T102_ = (*T101_).Sup.Sup.message; (*T101_).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TM__HZdw8BhppcTQo8DIK46LSg_13));
								if (T102_) nimGCunrefNoCycle(T102_);
								asgnRef((void**) (&(*T101_).Sup.Sup.parent), ((Exception*) NIM_NIL));
								raiseExceptionEx((Exception*)T101_, "ValueError", "waitForExit", "osproc.nim", 1378);
							}
							goto LA97_;
							LA99_: ;
							{
								diffX60gensym87_ = (NI)(stspec.tv_nsec - enspec.tv_nsec);
								enspec.tv_nsec = (NI)(((NI) 1000000000) - diffX60gensym87_);
							}
							LA97_: ;
						}
						LA92_: ;
						tmspec.tv_sec = (long)(tmspec.tv_sec - enspec.tv_sec);
						{
							if (!(enspec.tv_nsec <= tmspec.tv_nsec)) goto LA106_;
							tmspec.tv_nsec -= enspec.tv_nsec;
						}
						goto LA104_;
						LA106_: ;
						{
							tmspec.tv_sec = (long)(tmspec.tv_sec - ((long) 1));
							diffX60gensym87_ = (NI)(enspec.tv_nsec - tmspec.tv_nsec);
							tmspec.tv_nsec = (NI)(((NI) 1000000000) - diffX60gensym87_);
						}
						LA104_: ;
						stspec.tv_sec = bX60gensym87_.tv_sec;
						stspec.tv_nsec = bX60gensym87_.tv_nsec;
					}
					goto LA82_;
					LA84_: ;
					{
						int status_3;
						if (!(err == ((int) 11))) goto LA110_;
						{
							int T114_;
							NI32 T117_;
							T114_ = (int)0;
							T114_ = kill((*p).id, ((int) 9));
							if (!(T114_ == ((NI32) -1))) goto LA115_;
							T117_ = (NI32)0;
							T117_ = osLastError__pureZos_390();
							raiseOSError__pureZos_387(T117_, ((NimStringDesc*) NIM_NIL));
						}
						LA115_: ;
						status_3 = ((int) 1);
						{
							pid_t T120_;
							NI32 T123_;
							T120_ = (pid_t)0;
							T120_ = waitpid((*p).id, (&status_3), ((int) 0));
							if (!(T120_ < ((NI32) 0))) goto LA121_;
							T123_ = (NI32)0;
							T123_ = osLastError__pureZos_390();
							raiseOSError__pureZos_387(T123_, ((NimStringDesc*) NIM_NIL));
						}
						LA121_: ;
						(*p).exitFlag = NIM_TRUE;
						(*p).exitStatus = status_3;
						goto LA38;
					}
					goto LA82_;
					LA110_: ;
					{
						raiseOSError__pureZos_387(err, ((NimStringDesc*) NIM_NIL));
					}
					LA82_: ;
				}
				goto LA40_;
				LA80_: ;
				LA40_: ;
			}
		} LA38: ;
		popSafePoint();
		}
		else {
			popSafePoint();
		}
		{
			{
				int T129_;
				NI32 T132_;
				T129_ = (int)0;
				T129_ = sigprocmask(((int) 2), (&nmask), (&omask));
				if (!(T129_ == ((NI32) -1))) goto LA130_;
				T132_ = (NI32)0;
				T132_ = osLastError__pureZos_390();
				raiseOSError__pureZos_387(T132_, ((NimStringDesc*) NIM_NIL));
			}
			LA130_: ;
			if (TM__HZdw8BhppcTQo8DIK46LSg_12.status != 0) nimLeaveFinally();
		}
		if (TM__HZdw8BhppcTQo8DIK46LSg_12.status != 0) reraiseException();
	}
	LA6_: ;
	T133_ = (int)0;
	T133_ = exitStatusLikeShell__pureZos_1080((*p).exitStatus);
	result = ((NI) (T133_));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nospclose)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p) {
	{
		if (!!((((*p).options &((NU8)1<<((NU)(((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) 4))&7U)))!=0))) goto LA3_;
		{
			if (!!(((*p).inStream == ((tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ*) NIM_NIL)))) goto LA7_;
			close__pureZstreams_57((*p).inStream);
		}
		goto LA5_;
		LA7_: ;
		{
			int T10_;
			T10_ = (int)0;
			T10_ = close((*p).inHandle);
			(void)(T10_);
		}
		LA5_: ;
		{
			if (!!(((*p).outStream == ((tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ*) NIM_NIL)))) goto LA13_;
			close__pureZstreams_57((*p).outStream);
		}
		goto LA11_;
		LA13_: ;
		{
			int T16_;
			T16_ = (int)0;
			T16_ = close((*p).outHandle);
			(void)(T16_);
		}
		LA11_: ;
		{
			if (!!(((*p).errStream == ((tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ*) NIM_NIL)))) goto LA19_;
			close__pureZstreams_57((*p).errStream);
		}
		goto LA17_;
		LA19_: ;
		{
			int T22_;
			T22_ = (int)0;
			T22_ = close((*p).errHandle);
			(void)(T22_);
		}
		LA17_: ;
	}
	LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isExitStatus__pureZosproc_306)(int status) {
	NIM_BOOL result;
	NIM_BOOL T1_;
	result = (NIM_BOOL)0;
	T1_ = (NIM_BOOL)0;
	T1_ = WIFEXITED__posixZposix_875(status);
	if (T1_) goto LA2_;
	T1_ = WIFSIGNALED__posixZposix_884(status);
	LA2_: ;
	result = T1_;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, nosppeekExitCode)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p) {
	NI result;
	int status;
	pid_t ret;
{	result = (NI)0;
	status = ((int) 0);
	result = ((NI) -1);
	{
		int T5_;
		if (!(*p).exitFlag) goto LA3_;
		T5_ = (int)0;
		T5_ = exitStatusLikeShell__pureZos_1080((*p).exitStatus);
		result = ((NI) (T5_));
		goto BeforeRet_;
	}
	LA3_: ;
	ret = waitpid((*p).id, (&status), ((int) 1));
	{
		if (!(((NI32) 0) < ret)) goto LA8_;
		{
			NIM_BOOL T12_;
			int T15_;
			T12_ = (NIM_BOOL)0;
			T12_ = isExitStatus__pureZosproc_306(status);
			if (!T12_) goto LA13_;
			(*p).exitFlag = NIM_TRUE;
			(*p).exitStatus = status;
			T15_ = (int)0;
			T15_ = exitStatusLikeShell__pureZos_1080(status);
			result = ((NI) (T15_));
		}
		LA13_: ;
	}
	LA8_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, execCmdEx__pureZosproc_1146)(NimStringDesc* command, tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA options, tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg* env, NimStringDesc* workingDir, NimStringDesc* input, tyTuple__XOVT24GHXwqiEj5GCsEGCA* Result) {
	tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p;
	tyArray__8ZvwQIddfpj2THRVPsFzIQ T1_;
	tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* outp;
	tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* T7_;
	NimStringDesc* colontmp_;
	NI colontmp__2;
	NimStringDesc* line;
	nimZeroMem((void*)T1_, sizeof(tyArray__8ZvwQIddfpj2THRVPsFzIQ));
	p = nospstartProcess(command, workingDir, T1_, 0, env, (options | 4));
	outp = nospoutputStream(p);
	{
		tyObject_StreamObj__THYguAi9bSgidczZ3ywEIMQ* T6_;
		if (!(((NI) 0) < (input ? input->Sup.len : 0))) goto LA4_;
		T6_ = NIM_NIL;
		T6_ = nospinputStream(p);
		write__pureZstreams_177(T6_, input);
	}
	LA4_: ;
	T7_ = NIM_NIL;
	T7_ = nospinputStream(p);
	close__pureZstreams_57(T7_);
	colontmp_ = ((NimStringDesc*) NIM_NIL);
	colontmp__2 = ((NI) -1);
	unsureAsgnRef((void**) (&(*Result).Field0), copyString(colontmp_));
	(*Result).Field1 = colontmp__2;
	line = rawNewString(((NI) 120));
	{
		while (1) {
			{
				NIM_BOOL T12_;
				T12_ = (NIM_BOOL)0;
				T12_ = readLine__pureZstreams_524(outp, (&line));
				if (!T12_) goto LA13_;
				unsureAsgnRef((void**) (&(*Result).Field0), resizeString((*Result).Field0, (line ? line->Sup.len : 0) + 0));
appendString((*Result).Field0, line);
				unsureAsgnRef((void**) (&(*Result).Field0), resizeString((*Result).Field0, 1));
appendString((*Result).Field0, ((NimStringDesc*) &TM__HZdw8BhppcTQo8DIK46LSg_14));
			}
			goto LA10_;
			LA13_: ;
			{
				(*Result).Field1 = nosppeekExitCode(p);
				{
					if (!!(((*Result).Field1 == ((NI) -1)))) goto LA18_;
					goto LA8;
				}
				LA18_: ;
			}
			LA10_: ;
		}
	} LA8: ;
	nospclose(p);
}
N_LIB_PRIVATE N_NIMCALL(NI, nospexecCmd)(NimStringDesc* command) {
	NI result;
	int T1_;
	result = (NI)0;
	T1_ = (int)0;
	T1_ = system(nimToCStringConv(command));
	result = ((NI) (T1_));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, nospcountProcessors)(void) {
	NI result;
	result = (NI)0;
	result = ncpicountProcessors();
	return result;
}
static N_NIMCALL(void, Marker_tySequence__PrBYolTs4TOSgE8v5oqDUQ)(void* p, NI op) {
	tySequence__PrBYolTs4TOSgE8v5oqDUQ* a;
	NI T1_;
	a = (tySequence__PrBYolTs4TOSgE8v5oqDUQ*)p;
	T1_ = (NI)0;
	for (T1_ = 0; T1_ < (a ? a->Sup.len : 0); T1_++) {
	nimGCvisit((void*)a->data[T1_], op);
	}
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosprunning)(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p) {
	NIM_BOOL result;
{	result = (NIM_BOOL)0;
	{
		if (!(*p).exitFlag) goto LA3_;
		result = NIM_FALSE;
		goto BeforeRet_;
	}
	goto LA1_;
	LA3_: ;
	{
		int status;
		pid_t ret;
		status = ((int) 1);
		ret = waitpid((*p).id, (&status), ((int) 1));
		{
			if (!(((NI) (ret)) == ((NI) ((*p).id)))) goto LA8_;
			{
				NIM_BOOL T12_;
				T12_ = (NIM_BOOL)0;
				T12_ = isExitStatus__pureZosproc_306(status);
				if (!T12_) goto LA13_;
				(*p).exitFlag = NIM_TRUE;
				(*p).exitStatus = status;
				result = NIM_FALSE;
				goto BeforeRet_;
			}
			goto LA10_;
			LA13_: ;
			{
				result = NIM_TRUE;
				goto BeforeRet_;
			}
			LA10_: ;
		}
		goto LA6_;
		LA8_: ;
		{
			if (!(ret == ((NI32) 0))) goto LA17_;
			result = NIM_TRUE;
			goto BeforeRet_;
		}
		goto LA6_;
		LA17_: ;
		{
			NI32 T20_;
			T20_ = (NI32)0;
			T20_ = osLastError__pureZos_390();
			raiseOSError__pureZos_387(T20_, ((NimStringDesc*) NIM_NIL));
		}
		LA6_: ;
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, nospexecProcesses)(NimStringDesc** cmds, NI cmdsLen_0, tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA options, NI n, tyProc__SqRJqa5aOiKB4EuKlKh9asA beforeRunEvent, tyProc__oudJckli4GdxAXLVzBBlAw afterRunEvent) {
	NI result;
	result = (NI)0;
	{
		NI i;
		tySequence__PrBYolTs4TOSgE8v5oqDUQ* q;
		tySequence__qwqHTkRvwhrRyENtudHQ7g* idxs;
		NI m;
		NI ecount;
		if (!(((NI) 1) < n)) goto LA3_;
		i = ((NI) 0);
		q = newSeq__pureZosproc_120(((NI) (n)));
		idxs = newSeq__pureZosproc_151(((NI) (n)));
		m = ((n <= cmdsLen_0) ? n : cmdsLen_0);
		{
			while (1) {
				tyArray__8ZvwQIddfpj2THRVPsFzIQ T11_;
				if (!(i < m)) goto LA6;
				{
					if (!!((beforeRunEvent.ClP_0 == TM__HZdw8BhppcTQo8DIK46LSg_15.ClP_0 && beforeRunEvent.ClE_0 == TM__HZdw8BhppcTQo8DIK46LSg_15.ClE_0))) goto LA9_;
					beforeRunEvent.ClE_0? beforeRunEvent.ClP_0(i, beforeRunEvent.ClE_0):((TM__HZdw8BhppcTQo8DIK46LSg_16)(beforeRunEvent.ClP_0))(i);
				}
				LA9_: ;
				nimZeroMem((void*)T11_, sizeof(tyArray__8ZvwQIddfpj2THRVPsFzIQ));
				asgnRef((void**) (&q->data[i]), nospstartProcess(cmds[i], ((NimStringDesc*) NIM_NIL), T11_, 0, ((tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg*) NIM_NIL), (options | 4)));
				idxs->data[i] = i;
				i += ((NI) 1);
			} LA6: ;
		}
		ecount = cmdsLen_0;
		{
			while (1) {
				if (!(((NI) 0) < ecount)) goto LA13;
				{
					NI rexit;
					int status;
					pid_t res;
					rexit = ((NI) -1);
					status = ((int) 1);
					res = waitpid(((pid_t) -1), (&status), ((int) 0));
					{
						if (!(((NI32) 0) < res)) goto LA17_;
						{
							NI r;
							NI colontmp_;
							NI res_2;
							r = (NI)0;
							colontmp_ = (NI)0;
							colontmp_ = (NI)(m - ((NI) 1));
							res_2 = ((NI) 0);
							{
								while (1) {
									if (!(res_2 <= colontmp_)) goto LA21;
									r = res_2;
									{
										NIM_BOOL T24_;
										T24_ = (NIM_BOOL)0;
										T24_ = !((q->data[r] == 0));
										if (!(T24_)) goto LA25_;
										T24_ = ((*q->data[r]).id == res);
										LA25_: ;
										if (!T24_) goto LA26_;
										{
											NIM_BOOL T30_;
											T30_ = (NIM_BOOL)0;
											T30_ = WIFEXITED__posixZposix_875(status);
											if (T30_) goto LA31_;
											T30_ = WIFSIGNALED__posixZposix_884(status);
											LA31_: ;
											if (!T30_) goto LA32_;
											(*q->data[r]).exitFlag = NIM_TRUE;
											(*q->data[r]).exitStatus = status;
											rexit = r;
											goto LA19;
										}
										LA32_: ;
									}
									LA26_: ;
									res_2 += ((NI) 1);
								} LA21: ;
							}
						} LA19: ;
					}
					goto LA15_;
					LA17_: ;
					{
						NI32 err;
						err = osLastError__pureZos_390();
						{
							if (!(err == ((NI32) 10))) goto LA37_;
							{
								NI r_2;
								NI colontmp__2;
								NI res_3;
								r_2 = (NI)0;
								colontmp__2 = (NI)0;
								colontmp__2 = (NI)(m - ((NI) 1));
								res_3 = ((NI) 0);
								{
									while (1) {
										if (!(res_3 <= colontmp__2)) goto LA41;
										r_2 = res_3;
										{
											NIM_BOOL T44_;
											NIM_BOOL T46_;
											T44_ = (NIM_BOOL)0;
											T44_ = !((q->data[r_2] == 0));
											if (!(T44_)) goto LA45_;
											T46_ = (NIM_BOOL)0;
											T46_ = nosprunning(q->data[r_2]);
											T44_ = !(T46_);
											LA45_: ;
											if (!T44_) goto LA47_;
											(*q->data[r_2]).exitFlag = NIM_TRUE;
											(*q->data[r_2]).exitStatus = status;
											rexit = r_2;
											goto LA39;
										}
										LA47_: ;
										res_3 += ((NI) 1);
									} LA41: ;
								}
							} LA39: ;
						}
						goto LA35_;
						LA37_: ;
						{
							if (!(err == ((NI32) 4))) goto LA50_;
							goto LA14;
						}
						goto LA35_;
						LA50_: ;
						{
							raiseOSError__pureZos_387(err, ((NimStringDesc*) NIM_NIL));
						}
						LA35_: ;
					}
					LA15_: ;
					{
						NI T57_;
						if (!(((NI) 0) <= rexit)) goto LA55_;
						T57_ = (NI)0;
						T57_ = nosppeekExitCode(q->data[rexit]);
						result = ((result >= (T57_ > 0? (T57_) : -(T57_))) ? result : (T57_ > 0? (T57_) : -(T57_)));
						{
							if (!!((afterRunEvent.ClP_0 == TM__HZdw8BhppcTQo8DIK46LSg_17.ClP_0 && afterRunEvent.ClE_0 == TM__HZdw8BhppcTQo8DIK46LSg_17.ClE_0))) goto LA60_;
							afterRunEvent.ClE_0? afterRunEvent.ClP_0(idxs->data[rexit], q->data[rexit], afterRunEvent.ClE_0):((TM__HZdw8BhppcTQo8DIK46LSg_18)(afterRunEvent.ClP_0))(idxs->data[rexit], q->data[rexit]);
						}
						LA60_: ;
						nospclose(q->data[rexit]);
						{
							tyArray__8ZvwQIddfpj2THRVPsFzIQ T70_;
							if (!(i < cmdsLen_0)) goto LA64_;
							{
								if (!!((beforeRunEvent.ClP_0 == TM__HZdw8BhppcTQo8DIK46LSg_15.ClP_0 && beforeRunEvent.ClE_0 == TM__HZdw8BhppcTQo8DIK46LSg_15.ClE_0))) goto LA68_;
								beforeRunEvent.ClE_0? beforeRunEvent.ClP_0(i, beforeRunEvent.ClE_0):((TM__HZdw8BhppcTQo8DIK46LSg_19)(beforeRunEvent.ClP_0))(i);
							}
							LA68_: ;
							nimZeroMem((void*)T70_, sizeof(tyArray__8ZvwQIddfpj2THRVPsFzIQ));
							asgnRef((void**) (&q->data[rexit]), nospstartProcess(cmds[i], ((NimStringDesc*) NIM_NIL), T70_, 0, ((tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg*) NIM_NIL), (options | 4)));
							idxs->data[rexit] = i;
							i += ((NI) 1);
						}
						goto LA62_;
						LA64_: ;
						{
							asgnRef((void**) (&q->data[rexit]), ((tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg*) NIM_NIL));
						}
						LA62_: ;
						ecount -= ((NI) 1);
					}
					LA55_: ;
				} LA14: ;
			} LA13: ;
		}
	}
	goto LA1_;
	LA3_: ;
	{
		{
			NI i_2;
			NI colontmp__3;
			NI res_4;
			i_2 = (NI)0;
			colontmp__3 = (NI)0;
			colontmp__3 = (cmdsLen_0-1);
			res_4 = ((NI) 0);
			{
				while (1) {
					tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg* p;
					tyArray__8ZvwQIddfpj2THRVPsFzIQ T80_;
					NI T81_;
					if (!(res_4 <= colontmp__3)) goto LA75;
					i_2 = res_4;
					{
						if (!!((beforeRunEvent.ClP_0 == TM__HZdw8BhppcTQo8DIK46LSg_15.ClP_0 && beforeRunEvent.ClE_0 == TM__HZdw8BhppcTQo8DIK46LSg_15.ClE_0))) goto LA78_;
						beforeRunEvent.ClE_0? beforeRunEvent.ClP_0(i_2, beforeRunEvent.ClE_0):((TM__HZdw8BhppcTQo8DIK46LSg_20)(beforeRunEvent.ClP_0))(i_2);
					}
					LA78_: ;
					nimZeroMem((void*)T80_, sizeof(tyArray__8ZvwQIddfpj2THRVPsFzIQ));
					p = nospstartProcess(cmds[i_2], ((NimStringDesc*) NIM_NIL), T80_, 0, ((tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg*) NIM_NIL), (options | 4));
					T81_ = (NI)0;
					T81_ = nospwaitForExit(p, ((NI) -1));
					result = (((T81_ > 0? (T81_) : -(T81_)) >= result) ? (T81_ > 0? (T81_) : -(T81_)) : result);
					{
						if (!!((afterRunEvent.ClP_0 == TM__HZdw8BhppcTQo8DIK46LSg_17.ClP_0 && afterRunEvent.ClE_0 == TM__HZdw8BhppcTQo8DIK46LSg_17.ClE_0))) goto LA84_;
						afterRunEvent.ClE_0? afterRunEvent.ClP_0(i_2, p, afterRunEvent.ClE_0):((TM__HZdw8BhppcTQo8DIK46LSg_21)(afterRunEvent.ClP_0))(i_2, p);
					}
					LA84_: ;
					nospclose(p);
					res_4 += ((NI) 1);
				} LA75: ;
			}
		}
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatslibatspureatsosprocdotnim_DatInit000)(void) {
static TNimNode* TM__HZdw8BhppcTQo8DIK46LSg_2_10[10];
static TNimNode* TM__HZdw8BhppcTQo8DIK46LSg_3_7[7];
NI TM__HZdw8BhppcTQo8DIK46LSg_5;
static char* NIM_CONST TM__HZdw8BhppcTQo8DIK46LSg_4[7] = {
"poEchoCmd", 
"poUsePath", 
"poEvalCommand", 
"poStdErrToStdOut", 
"poParentStreams", 
"poInteractive", 
"poDaemon"};
static TNimNode TM__HZdw8BhppcTQo8DIK46LSg_0[20];
NTIprocessobj__2rGNQnv9bU4hanI2g3svReg_.size = sizeof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg);
NTIprocessobj__2rGNQnv9bU4hanI2g3svReg_.align = NIM_ALIGNOF(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg);
NTIprocessobj__2rGNQnv9bU4hanI2g3svReg_.kind = 17;
NTIprocessobj__2rGNQnv9bU4hanI2g3svReg_.base = (&NTIrootobj__ytyiCJqK439aF9cIibuRVpAg_);
TM__HZdw8BhppcTQo8DIK46LSg_2_10[0] = &TM__HZdw8BhppcTQo8DIK46LSg_0[1];
TM__HZdw8BhppcTQo8DIK46LSg_0[1].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[1].offset = offsetof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg, inHandle);
TM__HZdw8BhppcTQo8DIK46LSg_0[1].typ = (&NTIfilehandle__2gIj3gQlK3HZJjQaYCP6ZQ_);
TM__HZdw8BhppcTQo8DIK46LSg_0[1].name = "inHandle";
TM__HZdw8BhppcTQo8DIK46LSg_2_10[1] = &TM__HZdw8BhppcTQo8DIK46LSg_0[2];
TM__HZdw8BhppcTQo8DIK46LSg_0[2].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[2].offset = offsetof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg, outHandle);
TM__HZdw8BhppcTQo8DIK46LSg_0[2].typ = (&NTIfilehandle__2gIj3gQlK3HZJjQaYCP6ZQ_);
TM__HZdw8BhppcTQo8DIK46LSg_0[2].name = "outHandle";
TM__HZdw8BhppcTQo8DIK46LSg_2_10[2] = &TM__HZdw8BhppcTQo8DIK46LSg_0[3];
TM__HZdw8BhppcTQo8DIK46LSg_0[3].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[3].offset = offsetof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg, errHandle);
TM__HZdw8BhppcTQo8DIK46LSg_0[3].typ = (&NTIfilehandle__2gIj3gQlK3HZJjQaYCP6ZQ_);
TM__HZdw8BhppcTQo8DIK46LSg_0[3].name = "errHandle";
TM__HZdw8BhppcTQo8DIK46LSg_2_10[3] = &TM__HZdw8BhppcTQo8DIK46LSg_0[4];
TM__HZdw8BhppcTQo8DIK46LSg_0[4].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[4].offset = offsetof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg, id);
TM__HZdw8BhppcTQo8DIK46LSg_0[4].typ = (&NTIpid__r9bTMVI8f19ah9b11jMgY4kPg_);
TM__HZdw8BhppcTQo8DIK46LSg_0[4].name = "id";
TM__HZdw8BhppcTQo8DIK46LSg_2_10[4] = &TM__HZdw8BhppcTQo8DIK46LSg_0[5];
TM__HZdw8BhppcTQo8DIK46LSg_0[5].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[5].offset = offsetof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg, inStream);
TM__HZdw8BhppcTQo8DIK46LSg_0[5].typ = (&NTIstream__1G0jiQbe7KwD5ADza5AZaw_);
TM__HZdw8BhppcTQo8DIK46LSg_0[5].name = "inStream";
TM__HZdw8BhppcTQo8DIK46LSg_2_10[5] = &TM__HZdw8BhppcTQo8DIK46LSg_0[6];
TM__HZdw8BhppcTQo8DIK46LSg_0[6].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[6].offset = offsetof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg, outStream);
TM__HZdw8BhppcTQo8DIK46LSg_0[6].typ = (&NTIstream__1G0jiQbe7KwD5ADza5AZaw_);
TM__HZdw8BhppcTQo8DIK46LSg_0[6].name = "outStream";
TM__HZdw8BhppcTQo8DIK46LSg_2_10[6] = &TM__HZdw8BhppcTQo8DIK46LSg_0[7];
TM__HZdw8BhppcTQo8DIK46LSg_0[7].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[7].offset = offsetof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg, errStream);
TM__HZdw8BhppcTQo8DIK46LSg_0[7].typ = (&NTIstream__1G0jiQbe7KwD5ADza5AZaw_);
TM__HZdw8BhppcTQo8DIK46LSg_0[7].name = "errStream";
TM__HZdw8BhppcTQo8DIK46LSg_2_10[7] = &TM__HZdw8BhppcTQo8DIK46LSg_0[8];
TM__HZdw8BhppcTQo8DIK46LSg_0[8].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[8].offset = offsetof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg, exitStatus);
TM__HZdw8BhppcTQo8DIK46LSg_0[8].typ = (&NTIcint__nlCscttRCss70IBTyuBqnA_);
TM__HZdw8BhppcTQo8DIK46LSg_0[8].name = "exitStatus";
TM__HZdw8BhppcTQo8DIK46LSg_2_10[8] = &TM__HZdw8BhppcTQo8DIK46LSg_0[9];
TM__HZdw8BhppcTQo8DIK46LSg_0[9].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[9].offset = offsetof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg, exitFlag);
TM__HZdw8BhppcTQo8DIK46LSg_0[9].typ = (&NTIbool__VaVACK0bpYmqIQ0mKcHfQQ_);
TM__HZdw8BhppcTQo8DIK46LSg_0[9].name = "exitFlag";
TM__HZdw8BhppcTQo8DIK46LSg_2_10[9] = &TM__HZdw8BhppcTQo8DIK46LSg_0[10];
NTIprocessoption__bnU6W8LhTMnT4JaSWtGlSA_.size = sizeof(tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA);
NTIprocessoption__bnU6W8LhTMnT4JaSWtGlSA_.align = NIM_ALIGNOF(tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA);
NTIprocessoption__bnU6W8LhTMnT4JaSWtGlSA_.kind = 14;
NTIprocessoption__bnU6W8LhTMnT4JaSWtGlSA_.base = 0;
NTIprocessoption__bnU6W8LhTMnT4JaSWtGlSA_.flags = 3;
for (TM__HZdw8BhppcTQo8DIK46LSg_5 = 0; TM__HZdw8BhppcTQo8DIK46LSg_5 < 7; TM__HZdw8BhppcTQo8DIK46LSg_5++) {
TM__HZdw8BhppcTQo8DIK46LSg_0[TM__HZdw8BhppcTQo8DIK46LSg_5+11].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[TM__HZdw8BhppcTQo8DIK46LSg_5+11].offset = TM__HZdw8BhppcTQo8DIK46LSg_5;
TM__HZdw8BhppcTQo8DIK46LSg_0[TM__HZdw8BhppcTQo8DIK46LSg_5+11].name = TM__HZdw8BhppcTQo8DIK46LSg_4[TM__HZdw8BhppcTQo8DIK46LSg_5];
TM__HZdw8BhppcTQo8DIK46LSg_3_7[TM__HZdw8BhppcTQo8DIK46LSg_5] = &TM__HZdw8BhppcTQo8DIK46LSg_0[TM__HZdw8BhppcTQo8DIK46LSg_5+11];
}
TM__HZdw8BhppcTQo8DIK46LSg_0[18].len = 7; TM__HZdw8BhppcTQo8DIK46LSg_0[18].kind = 2; TM__HZdw8BhppcTQo8DIK46LSg_0[18].sons = &TM__HZdw8BhppcTQo8DIK46LSg_3_7[0];
NTIprocessoption__bnU6W8LhTMnT4JaSWtGlSA_.node = &TM__HZdw8BhppcTQo8DIK46LSg_0[18];
NTIsetLprocessoptionT__HlmBYNr2gdAZMXOsuiSZ0A_.size = sizeof(tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA);
NTIsetLprocessoptionT__HlmBYNr2gdAZMXOsuiSZ0A_.align = NIM_ALIGNOF(tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA);
NTIsetLprocessoptionT__HlmBYNr2gdAZMXOsuiSZ0A_.kind = 19;
NTIsetLprocessoptionT__HlmBYNr2gdAZMXOsuiSZ0A_.base = (&NTIprocessoption__bnU6W8LhTMnT4JaSWtGlSA_);
NTIsetLprocessoptionT__HlmBYNr2gdAZMXOsuiSZ0A_.flags = 3;
TM__HZdw8BhppcTQo8DIK46LSg_0[19].len = 0; TM__HZdw8BhppcTQo8DIK46LSg_0[19].kind = 0;
NTIsetLprocessoptionT__HlmBYNr2gdAZMXOsuiSZ0A_.node = &TM__HZdw8BhppcTQo8DIK46LSg_0[19];
TM__HZdw8BhppcTQo8DIK46LSg_0[10].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[10].offset = offsetof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg, options);
TM__HZdw8BhppcTQo8DIK46LSg_0[10].typ = (&NTIsetLprocessoptionT__HlmBYNr2gdAZMXOsuiSZ0A_);
TM__HZdw8BhppcTQo8DIK46LSg_0[10].name = "options";
TM__HZdw8BhppcTQo8DIK46LSg_0[0].len = 10; TM__HZdw8BhppcTQo8DIK46LSg_0[0].kind = 2; TM__HZdw8BhppcTQo8DIK46LSg_0[0].sons = &TM__HZdw8BhppcTQo8DIK46LSg_2_10[0];
NTIprocessobj__2rGNQnv9bU4hanI2g3svReg_.node = &TM__HZdw8BhppcTQo8DIK46LSg_0[0];
NTIprocess__lw7iqc9cC7bi1oOZOAlJkJA_.size = sizeof(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg*);
NTIprocess__lw7iqc9cC7bi1oOZOAlJkJA_.align = NIM_ALIGNOF(tyObject_ProcessObj__2rGNQnv9bU4hanI2g3svReg*);
NTIprocess__lw7iqc9cC7bi1oOZOAlJkJA_.kind = 22;
NTIprocess__lw7iqc9cC7bi1oOZOAlJkJA_.base = (&NTIprocessobj__2rGNQnv9bU4hanI2g3svReg_);
NTIprocess__lw7iqc9cC7bi1oOZOAlJkJA_.marker = Marker_tyRef__lw7iqc9cC7bi1oOZOAlJkJA;
NTIseqLprocessT__PrBYolTs4TOSgE8v5oqDUQ_.size = sizeof(tySequence__PrBYolTs4TOSgE8v5oqDUQ*);
NTIseqLprocessT__PrBYolTs4TOSgE8v5oqDUQ_.align = NIM_ALIGNOF(tySequence__PrBYolTs4TOSgE8v5oqDUQ*);
NTIseqLprocessT__PrBYolTs4TOSgE8v5oqDUQ_.kind = 24;
NTIseqLprocessT__PrBYolTs4TOSgE8v5oqDUQ_.base = (&NTIprocess__lw7iqc9cC7bi1oOZOAlJkJA_);
NTIseqLprocessT__PrBYolTs4TOSgE8v5oqDUQ_.marker = Marker_tySequence__PrBYolTs4TOSgE8v5oqDUQ;
}

