/* Generated by Nim Compiler v1.6.14 */
#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__vyZqvZvf09c7OWgG4Opi2aA tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_StringTableObj__9aYeizX9bryvlooxqmPkPxqA tyObject_StringTableObj__9aYeizX9bryvlooxqmPkPxqA;
typedef struct RootObj RootObj;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg;
typedef struct tyObject_StartProcessData__NfXCqoL0sjeU9an82T8SL9cA tyObject_StartProcessData__NfXCqoL0sjeU9an82T8SL9cA;
typedef struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ tySequence__sM4lkSb7zS6F7OVMvW9cffQ;
typedef struct tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g;
typedef struct tyObject_CellSeq__nav876ELHgxScHhs30CKiA tyObject_CellSeq__nav876ELHgxScHhs30CKiA;
typedef struct tyObject_GcHeap__ZRn9bWCksoiGwT2drZZzyWQ tyObject_GcHeap__ZRn9bWCksoiGwT2drZZzyWQ;
typedef struct tyObject_GcStack__qFeGMKlnq6c9cTM2vPWycQQ tyObject_GcStack__qFeGMKlnq6c9cTM2vPWycQQ;
typedef struct tyObject_MemRegion__6QRscFDo4mEwbg9aL76vDGQ tyObject_MemRegion__6QRscFDo4mEwbg9aL76vDGQ;
typedef struct tyObject_SmallChunk__eUrTKmsk1Dqt5tm2WUT2Lw tyObject_SmallChunk__eUrTKmsk1Dqt5tm2WUT2Lw;
typedef struct tyObject_BigChunk__39bC3HTk2w4NGDjG74oNjmA tyObject_BigChunk__39bC3HTk2w4NGDjG74oNjmA;
typedef struct tyObject_LLChunk__Fjkr5Ya6Zl0UoUGxG047hA tyObject_LLChunk__Fjkr5Ya6Zl0UoUGxG047hA;
typedef struct tyObject_IntSet__WrQriiGmHk59cB1lNPtGo6A tyObject_IntSet__WrQriiGmHk59cB1lNPtGo6A;
typedef struct tyObject_Trunk__Ju1AURWHenTn3cJwAjbUhg tyObject_Trunk__Ju1AURWHenTn3cJwAjbUhg;
typedef struct tyObject_AvlNode__aGkK1t9a0WoXjpugXR6FWpw tyObject_AvlNode__aGkK1t9a0WoXjpugXR6FWpw;
typedef struct tyObject_HeapLinks__5IkCDh5QlsYpsfEMJf6zNw tyObject_HeapLinks__5IkCDh5QlsYpsfEMJf6zNw;
typedef struct tyTuple__p2vAp9cQ6YrpDq9cI3XzEDWA tyTuple__p2vAp9cQ6YrpDq9cI3XzEDWA;
typedef struct tyObject_GcStat__OG9ams3mtFJyICkjTOHbc9bg tyObject_GcStat__OG9ams3mtFJyICkjTOHbc9bg;
typedef struct tyObject_CellSet__A0mJvGLunfUxGkLUtesjdA tyObject_CellSet__A0mJvGLunfUxGkLUtesjdA;
typedef struct tyObject_PageDesc__N7tjEodqPVJaQ6oKQW8YfQ tyObject_PageDesc__N7tjEodqPVJaQ6oKQW8YfQ;
typedef struct Exception Exception;
typedef struct tySequence__QbmGqFaLnb1IWWToREeaIA tySequence__QbmGqFaLnb1IWWToREeaIA;
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__dyNB5o2GYLzoO6FJ2RhiZw tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw;
typedef struct tyObject_FileStreamObj__tYEhzw9bqtvCVwdyniGzYfA tyObject_FileStreamObj__tYEhzw9bqtvCVwdyniGzYfA;
typedef struct tyObject_ValueError__5lcTdgqMq62cNGRwBb0thA tyObject_ValueError__5lcTdgqMq62cNGRwBb0thA;
typedef struct tyObject_CatchableError__8K3kdpxrBD9aI27J0kpSCpQ tyObject_CatchableError__8K3kdpxrBD9aI27J0kpSCpQ;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
typedef struct tySequence__1KIIbxJRtGjuxcp9a9bbC09cA tySequence__1KIIbxJRtGjuxcp9a9bbC09cA;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tyObject_StackTraceEntry__3r2E7OgmrW3VdUTaooCuyA tyObject_StackTraceEntry__3r2E7OgmrW3VdUTaooCuyA;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tySet_tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw;
typedef int tyArray__SKEqGXcReU4NvbQlH779b5Q[2];
typedef NU8 tyEnum_TNimKind__pspQAsqJLrw3jEKBD9bxmyQ;
typedef NU8 tySet_tyEnum_TNimTypeFlag__Yt5hq6z2IoHhKZrzIVrc1w;
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__pspQAsqJLrw3jEKBD9bxmyQ kind;
tySet_tyEnum_TNimTypeFlag__Yt5hq6z2IoHhKZrzIVrc1w flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
struct RootObj {
TNimType* m_type;
};
struct tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA {
  RootObj Sup;
int inHandle;
int outHandle;
int errHandle;
pid_t id;
tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* inStream;
tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* outStream;
tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* errStream;
int exitStatus;
NIM_BOOL exitFlag;
tySet_tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw options;
};
typedef NU8 tyEnum_TNimNodeKind__rrp49bl1h9aEkXfXp9bNg0yZw;
struct TNimNode {
tyEnum_TNimNodeKind__rrp49bl1h9aEkXfXp9bNg0yZw kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef NU8 tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw;
struct tyObject_StartProcessData__NfXCqoL0sjeU9an82T8SL9cA {
NimStringDesc* sysCommand;
NCSTRING* sysArgs;
NCSTRING* sysEnv;
NCSTRING workingDir;
tyArray__SKEqGXcReU4NvbQlH779b5Q pStdin;
tyArray__SKEqGXcReU4NvbQlH779b5Q pStdout;
tyArray__SKEqGXcReU4NvbQlH779b5Q pStderr;
tyArray__SKEqGXcReU4NvbQlH779b5Q pErrorPipe;
tySet_tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw options;
};
struct tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__qFeGMKlnq6c9cTM2vPWycQQ {
void* bottom;
};
struct tyObject_CellSeq__nav876ELHgxScHhs30CKiA {
NI len;
NI cap;
tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g** d;
};
typedef tyObject_SmallChunk__eUrTKmsk1Dqt5tm2WUT2Lw* tyArray__1eFxjkcKGHnofywkmCV8oQ[256];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__39bC3HTk2w4NGDjG74oNjmA* tyArray__KxTmKT9a3kTkdwYfqXhEYSw[32];
typedef tyArray__KxTmKT9a3kTkdwYfqXhEYSw tyArray__ATT5LBefmjy9bg8ApRmg3rw[24];
typedef tyObject_Trunk__Ju1AURWHenTn3cJwAjbUhg* tyArray__RxhBwkGQwTHLKhoK685Xfg[256];
struct tyObject_IntSet__WrQriiGmHk59cB1lNPtGo6A {
tyArray__RxhBwkGQwTHLKhoK685Xfg data;
};
typedef tyObject_AvlNode__aGkK1t9a0WoXjpugXR6FWpw* tyArray__DrxDrI9bg9apB70ydOoNZrWw[2];
struct tyObject_AvlNode__aGkK1t9a0WoXjpugXR6FWpw {
tyArray__DrxDrI9bg9apB70ydOoNZrWw link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__p2vAp9cQ6YrpDq9cI3XzEDWA {
tyObject_BigChunk__39bC3HTk2w4NGDjG74oNjmA* Field0;
NI Field1;
};
typedef tyTuple__p2vAp9cQ6YrpDq9cI3XzEDWA tyArray__wsokuoa9bVBSU4gPLKbFaaw[30];
struct tyObject_HeapLinks__5IkCDh5QlsYpsfEMJf6zNw {
NI len;
tyArray__wsokuoa9bVBSU4gPLKbFaaw chunks;
tyObject_HeapLinks__5IkCDh5QlsYpsfEMJf6zNw* next;
};
struct tyObject_MemRegion__6QRscFDo4mEwbg9aL76vDGQ {
NI minLargeObj;
NI maxLargeObj;
tyArray__1eFxjkcKGHnofywkmCV8oQ freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__ATT5LBefmjy9bg8ApRmg3rw matrix;
tyObject_LLChunk__Fjkr5Ya6Zl0UoUGxG047hA* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__WrQriiGmHk59cB1lNPtGo6A chunkStarts;
tyObject_AvlNode__aGkK1t9a0WoXjpugXR6FWpw* root;
tyObject_AvlNode__aGkK1t9a0WoXjpugXR6FWpw* deleted;
tyObject_AvlNode__aGkK1t9a0WoXjpugXR6FWpw* last;
tyObject_AvlNode__aGkK1t9a0WoXjpugXR6FWpw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__aGkK1t9a0WoXjpugXR6FWpw bottomData;
tyObject_HeapLinks__5IkCDh5QlsYpsfEMJf6zNw heapLinks;
};
struct tyObject_GcStat__OG9ams3mtFJyICkjTOHbc9bg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__A0mJvGLunfUxGkLUtesjdA {
NI counter;
NI max;
tyObject_PageDesc__N7tjEodqPVJaQ6oKQW8YfQ* head;
tyObject_PageDesc__N7tjEodqPVJaQ6oKQW8YfQ** data;
};
struct tyObject_GcHeap__ZRn9bWCksoiGwT2drZZzyWQ {
tyObject_GcStack__qFeGMKlnq6c9cTM2vPWycQQ stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__nav876ELHgxScHhs30CKiA zct;
tyObject_CellSeq__nav876ELHgxScHhs30CKiA decStack;
tyObject_CellSeq__nav876ELHgxScHhs30CKiA tempStack;
NI recGcLock;
tyObject_MemRegion__6QRscFDo4mEwbg9aL76vDGQ region;
tyObject_GcStat__OG9ams3mtFJyICkjTOHbc9bg stat;
tyObject_CellSet__A0mJvGLunfUxGkLUtesjdA marked;
tyObject_CellSeq__nav876ELHgxScHhs30CKiA additionalRoots;
NI gcThreadId;
};
struct Exception {
  RootObj Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
tySequence__QbmGqFaLnb1IWWToREeaIA* 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__aFE1syNIcJw6kweUNHC9cQA;
struct tyObject_StringTableObj__9aYeizX9bryvlooxqmPkPxqA {
  RootObj Sup;
NI counter;
tySequence__xv3aaFd3JCw8NbmALHiezQ* data;
tyEnum_StringTableMode__aFE1syNIcJw6kweUNHC9cQA mode;
};
struct tyTuple__sPaDkVPSC0MkcoXCxPH9ccA {
NimStringDesc* Field0;
NimStringDesc* Field1;
NIM_BOOL Field2;
};
typedef NimStringDesc* tyArray__24KAM9afIUgUaqBaEBB6r9bg[3];
typedef N_NIMCALL_PTR(void, tyProc__u1QtPTYUJu1ozpzb9a8xchw) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s);
typedef N_NIMCALL_PTR(NIM_BOOL, tyProc__VytW5cBLp1DOuwAj9cjoj3Q) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s);
typedef N_NIMCALL_PTR(void, tyProc__nAUmmvz53fMDhkU9aQ4i60Q) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, NI pos);
typedef N_NIMCALL_PTR(NI, tyProc__rvgAWCz6iG9cntloh2xzZmQ) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s);
typedef N_NIMCALL_PTR(NI, tyProc__sAr4e3JGOuIBVEZ29aGGKUQ) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, NimStringDesc** buffer, tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw slice);
typedef N_NIMCALL_PTR(NIM_BOOL, tyProc__7SoiV5lfjKUldz1ENKXq1w) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, NimStringDesc** line);
typedef N_NIMCALL_PTR(NI, tyProc__mPF9ae7sAGGCOezlsIuH6Yg) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, void* buffer, NI bufLen);
typedef N_NIMCALL_PTR(void, tyProc__1nrRaSRiXjiE9bnEpZhmOsA) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, void* buffer, NI bufLen);
struct tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg {
  RootObj Sup;
tyProc__u1QtPTYUJu1ozpzb9a8xchw closeImpl;
tyProc__VytW5cBLp1DOuwAj9cjoj3Q atEndImpl;
tyProc__nAUmmvz53fMDhkU9aQ4i60Q setPositionImpl;
tyProc__rvgAWCz6iG9cntloh2xzZmQ getPositionImpl;
tyProc__sAr4e3JGOuIBVEZ29aGGKUQ readDataStrImpl;
tyProc__7SoiV5lfjKUldz1ENKXq1w readLineImpl;
tyProc__mPF9ae7sAGGCOezlsIuH6Yg readDataImpl;
tyProc__mPF9ae7sAGGCOezlsIuH6Yg peekDataImpl;
tyProc__1nrRaSRiXjiE9bnEpZhmOsA writeDataImpl;
tyProc__u1QtPTYUJu1ozpzb9a8xchw flushImpl;
};
struct tyObject_FileStreamObj__tYEhzw9bqtvCVwdyniGzYfA {
  tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg Sup;
FILE* f;
};
typedef NU8 tyEnum_FileMode__l9cwNsPPKSvz36rQZGh2S7w;
struct tyObject_CatchableError__8K3kdpxrBD9aI27J0kpSCpQ {
  Exception Sup;
};
struct tyObject_ValueError__5lcTdgqMq62cNGRwBb0thA {
  tyObject_CatchableError__8K3kdpxrBD9aI27J0kpSCpQ 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__vyZqvZvf09c7OWgG4Opi2aA* p, void* ClE_0);
void* ClE_0;
} tyProc__w6A9cCTGZLLFueLjnmit9a6w;
typedef N_CLOSURE_PTR(void, TM__HZdw8BhppcTQo8DIK46LSg_16) (NI idx);
typedef N_CLOSURE_PTR(void, TM__HZdw8BhppcTQo8DIK46LSg_18) (NI idx, tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* 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__vyZqvZvf09c7OWgG4Opi2aA* p);
struct tyObject_StackTraceEntry__3r2E7OgmrW3VdUTaooCuyA {
NCSTRING procname;
NI line;
NCSTRING filename;
};
struct tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw {
NI a;
NI b;
};
struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
struct tySequence__1KIIbxJRtGjuxcp9a9bbC09cA {
  TGenericSeq Sup;
  tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* data[SEQ_DECL_SIZE];
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
struct tySequence__QbmGqFaLnb1IWWToREeaIA {
  TGenericSeq Sup;
  tyObject_StackTraceEntry__3r2E7OgmrW3VdUTaooCuyA 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__9bnO9cCg9bOEMdQ3fiqHHHqWA)(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_5347)(tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* 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_5345)(tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__system_5296)(tyObject_CellSeq__nav876ELHgxScHhs30CKiA* s, tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* c);
static N_INLINE(tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g*, usrToCell__system_5302)(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_311)(void);
static N_INLINE(NIM_BOOL, eqeq___system_7754)(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_7774)(NimStringDesc* s, NI first, NI last);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__system_7786)(NimStringDesc* s, NI first);
N_LIB_PRIVATE N_NOCONV(void*, alloc0Impl__system_1751)(NI size);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, copyMem__system_1733)(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_1749)(NI size);
N_LIB_PRIVATE N_NIMCALL(NCSTRING*, envToCStringArray__pureZosproc_300)(tyObject_StringTableObj__9aYeizX9bryvlooxqmPkPxqA* t);
N_LIB_PRIVATE N_NIMCALL(NI, nstlen)(tyObject_StringTableObj__9aYeizX9bryvlooxqmPkPxqA* 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_339)(tyObject_StartProcessData__NfXCqoL0sjeU9an82T8SL9cA* data);
static N_INLINE(NI, nimCStrLen)(NCSTRING a);
static N_INLINE(void, setCurrentDir__pureZos_704)(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__tYEhzw9bqtvCVwdyniGzYfA*, createStream__pureZosproc_603)(int* handle, tyEnum_FileMode__l9cwNsPPKSvz36rQZGh2S7w fileMode);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, open__systemZio_422)(FILE** f, int filehandle, tyEnum_FileMode__l9cwNsPPKSvz36rQZGh2S7w mode);
N_LIB_PRIVATE N_NIMCALL(tyObject_FileStreamObj__tYEhzw9bqtvCVwdyniGzYfA*, newFileStream__pureZstreams_808)(FILE* f);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incRef__system_5340)(tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* c);
static N_INLINE(NI, pluspercent___system_696)(NI x, NI y);
N_LIB_PRIVATE N_NIMCALL(int, exitStatusLikeShell__pureZos_1071)(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__QJOHa8TkfjsZVXTbMulWFg* s);
N_LIB_PRIVATE N_NIMCALL(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA*, nospstartProcess)(NimStringDesc* command, NimStringDesc* workingDir, NimStringDesc** args, NI argsLen_0, tyObject_StringTableObj__9aYeizX9bryvlooxqmPkPxqA* env, tySet_tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw options);
N_LIB_PRIVATE N_NIMCALL(tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg*, nospoutputStream)(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* p);
N_LIB_PRIVATE N_NIMCALL(void, write__pureZstreams_177)(tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, NimStringDesc* x);
N_LIB_PRIVATE N_NIMCALL(tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg*, nospinputStream)(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* 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__QJOHa8TkfjsZVXTbMulWFg* s, NimStringDesc** line);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_LIB_PRIVATE N_NIMCALL(NI, nosppeekExitCode)(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* p);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isExitStatus__pureZosproc_297)(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__vyZqvZvf09c7OWgG4Opi2aA* p);
N_LIB_PRIVATE N_NIMCALL(NI, ncpicountProcessors)(void);
N_LIB_PRIVATE N_NIMCALL(tySequence__1KIIbxJRtGjuxcp9a9bbC09cA*, newSeq__pureZosproc_120)(NI len);
static N_NIMCALL(void, Marker_tySequence__1KIIbxJRtGjuxcp9a9bbC09cA)(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__vyZqvZvf09c7OWgG4Opi2aA* p);
N_LIB_PRIVATE N_NIMCALL(NI, nospwaitForExit)(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* p, NI timeout);
extern TNimType NTIrootobj__ytyiCJqK439aF9cIibuRVpAg_;
N_LIB_PRIVATE TNimType NTIprocessobj__vyZqvZvf09c7OWgG4Opi2aA_;
extern TNimType NTIfilehandle__2gIj3gQlK3HZJjQaYCP6ZQ_;
extern TNimType NTIpid__r9bTMVI8f19ah9b11jMgY4kPg_;
extern TNimType NTIstream__aYUZBpFIj29a9ckz9chwQ9buAQ_;
extern TNimType NTIcint__nlCscttRCss70IBTyuBqnA_;
extern TNimType NTIbool__VaVACK0bpYmqIQ0mKcHfQQ_;
N_LIB_PRIVATE TNimType NTIprocessoption__79cHN5ErNkq9cfbLi9bttt3Xw_;
N_LIB_PRIVATE TNimType NTIsetLprocessoptionT__l7E5qoK9bdJSKfSf1NDciBA_;
N_LIB_PRIVATE TNimType NTIprocess__9bnO9cCg9bOEMdQ3fiqHHHqWA_;
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__MdotPfdEWddcwl4HcVVgeQ_;
extern TNimType NTIvalueerror__5lcTdgqMq62cNGRwBb0thA_;
STRING_LITERAL(TM__HZdw8BhppcTQo8DIK46LSg_13, "System time was modified", 24);
STRING_LITERAL(TM__HZdw8BhppcTQo8DIK46LSg_14, "\012", 1);
N_LIB_PRIVATE TNimType NTIseqLprocessT__1KIIbxJRtGjuxcp9a9bbC09cA_;
static NIM_CONST tyProc__SqRJqa5aOiKB4EuKlKh9asA TM__HZdw8BhppcTQo8DIK46LSg_15 = {NIM_NIL,NIM_NIL};
static NIM_CONST tyProc__w6A9cCTGZLLFueLjnmit9a6w TM__HZdw8BhppcTQo8DIK46LSg_17 = {NIM_NIL,NIM_NIL};
extern tyObject_GcHeap__ZRn9bWCksoiGwT2drZZzyWQ gch__system_5249;
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__9bnO9cCg9bOEMdQ3fiqHHHqWA)(void* p, NI op) {
	tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* a;
	a = (tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA*)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_5345)(tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* c) {
	addZCT__system_5296((&gch__system_5249.zct), c);
}
static N_INLINE(void, decRef__system_5347)(tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* 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_5345(c);
	}
	LA4_: ;
}
static N_INLINE(tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g*, usrToCell__system_5302)(void* usr) {
	tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* result;
	NI T1_;
	result = (tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g*)0;
	T1_ = (NI)0;
	T1_ = minuspercent___system_716(((NI) (ptrdiff_t) (usr)), ((NI) 16));
	result = ((tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g*) (T1_));
	return result;
}
static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* T1_;
	T1_ = (tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g*)0;
	T1_ = usrToCell__system_5302(p);
	decRef__system_5347(T1_);
}
static N_INLINE(void, pushSafePoint)(TSafePoint* s) {
	(*s).prev = excHandler__system_2565;
	excHandler__system_2565 = s;
}
static N_INLINE(NIM_BOOL, eqeq___system_7754)(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_1733)(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_1733(((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_311)(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_7754(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_7774(kv, ((NI) 0), (NI)(p - ((NI) 1)));
					ai.Field1 = substr__system_7786(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_1751(((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_7754(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_7774(kv_2, ((NI) 0), (NI)(p_2 - ((NI) 1)));
					ai_2.Field1 = substr__system_7786(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_1749(((NI) ((NI)((x ? x->Sup.len : 0) + ((NI) 1)))));
					result[i_2] = ((NCSTRING) (T13_));
					copyMem__system_1733(((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_300)(tyObject_StringTableObj__9aYeizX9bryvlooxqmPkPxqA* t) {
	NCSTRING* result;
	NI T1_;
	void* T2_;
	NI i;
	result = (NCSTRING*)0;
	T1_ = (NI)0;
	T1_ = nstlen(t);
	T2_ = (void*)0;
	T2_ = alloc0Impl__system_1751(((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_1749(((NI) ((NI)((x ? x->Sup.len : 0) + ((NI) 1)))));
						result[i] = ((NCSTRING) (T13_));
						copyMem__system_1733(((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_704)(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_339)(tyObject_StartProcessData__NfXCqoL0sjeU9an82T8SL9cA* 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__79cHN5ErNkq9cfbLi9bttt3Xw) 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__79cHN5ErNkq9cfbLi9bttt3Xw) 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__79cHN5ErNkq9cfbLi9bttt3Xw) 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__79cHN5ErNkq9cfbLi9bttt3Xw) 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_704(T100_);
	}
	LA98_: ;
	pid = (pid_t)0;
	{
		if (!(((*data).options &((NU8)1<<((NU)(((tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw) 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__vyZqvZvf09c7OWgG4Opi2aA*, nospstartProcess)(NimStringDesc* command, NimStringDesc* workingDir, NimStringDesc** args, NI argsLen_0, tyObject_StringTableObj__9aYeizX9bryvlooxqmPkPxqA* env, tySet_tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw options) {
	tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* result;
	tyArray__SKEqGXcReU4NvbQlH779b5Q pStdin;
	tyArray__SKEqGXcReU4NvbQlH779b5Q pStdout;
	tyArray__SKEqGXcReU4NvbQlH779b5Q pStderr;
	tyObject_StartProcessData__NfXCqoL0sjeU9an82T8SL9cA 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__vyZqvZvf09c7OWgG4Opi2aA*) newObj((&NTIprocess__9bnO9cCg9bOEMdQ3fiqHHHqWA_), sizeof(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA));
	(*result).Sup.m_type = (&NTIprocessobj__vyZqvZvf09c7OWgG4Opi2aA_);
	(*result).options = options;
	(*result).exitFlag = NIM_TRUE;
	{
		if (!!(((options &((NU8)1<<((NU)(((tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw) 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__NfXCqoL0sjeU9an82T8SL9cA));
	sysArgsRaw = NIM_NIL;
	{
		NimStringDesc* T21_;
		NimStringDesc* T22_;
		NimStringDesc* T23_;
		if (!((options &((NU8)1<<((NU)(((tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw) 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__9aYeizX9bryvlooxqmPkPxqA*) NIM_NIL))) goto LA33_;
		sysEnv = envToCStringArray__pureZosproc_311();
	}
	goto LA31_;
	LA33_: ;
	{
		sysEnv = envToCStringArray__pureZosproc_300(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_339((&data));
	{
		if (!(((NI) 0) < (workingDir ? workingDir->Sup.len : 0))) goto LA38_;
		setCurrentDir__pureZos_704(currentDir);
	}
	LA38_: ;
	{
		tyArray__24KAM9afIUgUaqBaEBB6r9bg T44_;
		if (!((options &((NU8)1<<((NU)(((tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw) 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__79cHN5ErNkq9cfbLi9bttt3Xw) 4))&7U)))!=0)) goto LA47_;
		(*result).inHandle = ((int) 0);
		(*result).outHandle = ((int) 1);
		{
			if (!((options &((NU8)1<<((NU)(((tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw) 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__79cHN5ErNkq9cfbLi9bttt3Xw) 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__tYEhzw9bqtvCVwdyniGzYfA*, createStream__pureZosproc_603)(int* handle, tyEnum_FileMode__l9cwNsPPKSvz36rQZGh2S7w fileMode) {
	tyObject_FileStreamObj__tYEhzw9bqtvCVwdyniGzYfA* 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_5340)(tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* c) {
	(*c).refcount = pluspercent___system_696((*c).refcount, ((NI) 8));
}
static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* T5_;
		if (!!((src == NIM_NIL))) goto LA3_;
		T5_ = (tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g*)0;
		T5_ = usrToCell__system_5302(src);
		incRef__system_5340(T5_);
	}
	LA3_: ;
	{
		tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g* T10_;
		if (!!(((*dest) == NIM_NIL))) goto LA8_;
		T10_ = (tyObject_Cell__nhn83Yf9cX7rcmG5W9b4oa6g*)0;
		T10_ = usrToCell__system_5302((*dest));
		decRef__system_5347(T10_);
	}
	LA8_: ;
	(*dest) = src;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg*, nospinputStream)(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* p) {
	tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* result;
{	result = NIM_NIL;
	{
		tyObject_FileStreamObj__tYEhzw9bqtvCVwdyniGzYfA* T5_;
		if (!((*p).inStream == ((tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg*) NIM_NIL))) goto LA3_;
		T5_ = NIM_NIL;
		T5_ = createStream__pureZosproc_603((&(*p).inHandle), ((tyEnum_FileMode__l9cwNsPPKSvz36rQZGh2S7w) 1));
		asgnRef((void**) (&(*p).inStream), &T5_->Sup);
	}
	LA3_: ;
	result = (*p).inStream;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg*, nospoutputStream)(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* p) {
	tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* result;
{	result = NIM_NIL;
	{
		tyObject_FileStreamObj__tYEhzw9bqtvCVwdyniGzYfA* T5_;
		if (!((*p).outStream == ((tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg*) NIM_NIL))) goto LA3_;
		T5_ = NIM_NIL;
		T5_ = createStream__pureZosproc_603((&(*p).outHandle), ((tyEnum_FileMode__l9cwNsPPKSvz36rQZGh2S7w) 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__vyZqvZvf09c7OWgG4Opi2aA* p, NI timeout) {
	NI result;
	int T133_;
{	result = (NI)0;
	{
		int T5_;
		if (!(*p).exitFlag) goto LA3_;
		T5_ = (int)0;
		T5_ = exitStatusLikeShell__pureZos_1071((*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__5lcTdgqMq62cNGRwBb0thA* T71_;
								NimStringDesc* T72_;
								if (!(enspec.tv_sec == ((long) 0))) goto LA69_;
								T71_ = NIM_NIL;
								T71_ = (tyObject_ValueError__5lcTdgqMq62cNGRwBb0thA*) newObj((&NTIrefvalueerror__MdotPfdEWddcwl4HcVVgeQ_), sizeof(tyObject_ValueError__5lcTdgqMq62cNGRwBb0thA));
								(*T71_).Sup.Sup.Sup.m_type = (&NTIvalueerror__5lcTdgqMq62cNGRwBb0thA_);
								(*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__5lcTdgqMq62cNGRwBb0thA* T101_;
								NimStringDesc* T102_;
								if (!(enspec.tv_sec == ((long) 0))) goto LA99_;
								T101_ = NIM_NIL;
								T101_ = (tyObject_ValueError__5lcTdgqMq62cNGRwBb0thA*) newObj((&NTIrefvalueerror__MdotPfdEWddcwl4HcVVgeQ_), sizeof(tyObject_ValueError__5lcTdgqMq62cNGRwBb0thA));
								(*T101_).Sup.Sup.Sup.m_type = (&NTIvalueerror__5lcTdgqMq62cNGRwBb0thA_);
								(*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_1071((*p).exitStatus);
	result = ((NI) (T133_));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, nospclose)(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* p) {
	{
		if (!!((((*p).options &((NU8)1<<((NU)(((tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw) 4))&7U)))!=0))) goto LA3_;
		{
			if (!!(((*p).inStream == ((tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg*) 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__QJOHa8TkfjsZVXTbMulWFg*) 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__QJOHa8TkfjsZVXTbMulWFg*) 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_297)(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__vyZqvZvf09c7OWgG4Opi2aA* 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_1071((*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_297(status);
			if (!T12_) goto LA13_;
			(*p).exitFlag = NIM_TRUE;
			(*p).exitStatus = status;
			T15_ = (int)0;
			T15_ = exitStatusLikeShell__pureZos_1071(status);
			result = ((NI) (T15_));
		}
		LA13_: ;
	}
	LA8_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, execCmdEx__pureZosproc_1137)(NimStringDesc* command, tySet_tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw options, tyObject_StringTableObj__9aYeizX9bryvlooxqmPkPxqA* env, NimStringDesc* workingDir, NimStringDesc* input, tyTuple__XOVT24GHXwqiEj5GCsEGCA* Result) {
	tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA* p;
	tyArray__8ZvwQIddfpj2THRVPsFzIQ T1_;
	tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* outp;
	tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* 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__QJOHa8TkfjsZVXTbMulWFg* 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__1KIIbxJRtGjuxcp9a9bbC09cA)(void* p, NI op) {
	tySequence__1KIIbxJRtGjuxcp9a9bbC09cA* a;
	NI T1_;
	a = (tySequence__1KIIbxJRtGjuxcp9a9bbC09cA*)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__vyZqvZvf09c7OWgG4Opi2aA* 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_297(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__79cHN5ErNkq9cfbLi9bttt3Xw options, NI n, tyProc__SqRJqa5aOiKB4EuKlKh9asA beforeRunEvent, tyProc__w6A9cCTGZLLFueLjnmit9a6w afterRunEvent) {
	NI result;
	result = (NI)0;
	{
		NI i;
		tySequence__1KIIbxJRtGjuxcp9a9bbC09cA* 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__9aYeizX9bryvlooxqmPkPxqA*) 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__9aYeizX9bryvlooxqmPkPxqA*) NIM_NIL), (options | 4)));
							idxs->data[rexit] = i;
							i += ((NI) 1);
						}
						goto LA62_;
						LA64_: ;
						{
							asgnRef((void**) (&q->data[rexit]), ((tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA*) 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__vyZqvZvf09c7OWgG4Opi2aA* 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__9aYeizX9bryvlooxqmPkPxqA*) 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__vyZqvZvf09c7OWgG4Opi2aA_.size = sizeof(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA);
NTIprocessobj__vyZqvZvf09c7OWgG4Opi2aA_.align = NIM_ALIGNOF(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA);
NTIprocessobj__vyZqvZvf09c7OWgG4Opi2aA_.kind = 17;
NTIprocessobj__vyZqvZvf09c7OWgG4Opi2aA_.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__vyZqvZvf09c7OWgG4Opi2aA, 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__vyZqvZvf09c7OWgG4Opi2aA, 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__vyZqvZvf09c7OWgG4Opi2aA, 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__vyZqvZvf09c7OWgG4Opi2aA, 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__vyZqvZvf09c7OWgG4Opi2aA, inStream);
TM__HZdw8BhppcTQo8DIK46LSg_0[5].typ = (&NTIstream__aYUZBpFIj29a9ckz9chwQ9buAQ_);
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__vyZqvZvf09c7OWgG4Opi2aA, outStream);
TM__HZdw8BhppcTQo8DIK46LSg_0[6].typ = (&NTIstream__aYUZBpFIj29a9ckz9chwQ9buAQ_);
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__vyZqvZvf09c7OWgG4Opi2aA, errStream);
TM__HZdw8BhppcTQo8DIK46LSg_0[7].typ = (&NTIstream__aYUZBpFIj29a9ckz9chwQ9buAQ_);
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__vyZqvZvf09c7OWgG4Opi2aA, 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__vyZqvZvf09c7OWgG4Opi2aA, exitFlag);
TM__HZdw8BhppcTQo8DIK46LSg_0[9].typ = (&NTIbool__VaVACK0bpYmqIQ0mKcHfQQ_);
TM__HZdw8BhppcTQo8DIK46LSg_0[9].name = "exitFlag";
TM__HZdw8BhppcTQo8DIK46LSg_2_10[9] = &TM__HZdw8BhppcTQo8DIK46LSg_0[10];
NTIprocessoption__79cHN5ErNkq9cfbLi9bttt3Xw_.size = sizeof(tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw);
NTIprocessoption__79cHN5ErNkq9cfbLi9bttt3Xw_.align = NIM_ALIGNOF(tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw);
NTIprocessoption__79cHN5ErNkq9cfbLi9bttt3Xw_.kind = 14;
NTIprocessoption__79cHN5ErNkq9cfbLi9bttt3Xw_.base = 0;
NTIprocessoption__79cHN5ErNkq9cfbLi9bttt3Xw_.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__79cHN5ErNkq9cfbLi9bttt3Xw_.node = &TM__HZdw8BhppcTQo8DIK46LSg_0[18];
NTIsetLprocessoptionT__l7E5qoK9bdJSKfSf1NDciBA_.size = sizeof(tySet_tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw);
NTIsetLprocessoptionT__l7E5qoK9bdJSKfSf1NDciBA_.align = NIM_ALIGNOF(tySet_tyEnum_ProcessOption__79cHN5ErNkq9cfbLi9bttt3Xw);
NTIsetLprocessoptionT__l7E5qoK9bdJSKfSf1NDciBA_.kind = 19;
NTIsetLprocessoptionT__l7E5qoK9bdJSKfSf1NDciBA_.base = (&NTIprocessoption__79cHN5ErNkq9cfbLi9bttt3Xw_);
NTIsetLprocessoptionT__l7E5qoK9bdJSKfSf1NDciBA_.flags = 3;
TM__HZdw8BhppcTQo8DIK46LSg_0[19].len = 0; TM__HZdw8BhppcTQo8DIK46LSg_0[19].kind = 0;
NTIsetLprocessoptionT__l7E5qoK9bdJSKfSf1NDciBA_.node = &TM__HZdw8BhppcTQo8DIK46LSg_0[19];
TM__HZdw8BhppcTQo8DIK46LSg_0[10].kind = 1;
TM__HZdw8BhppcTQo8DIK46LSg_0[10].offset = offsetof(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA, options);
TM__HZdw8BhppcTQo8DIK46LSg_0[10].typ = (&NTIsetLprocessoptionT__l7E5qoK9bdJSKfSf1NDciBA_);
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__vyZqvZvf09c7OWgG4Opi2aA_.node = &TM__HZdw8BhppcTQo8DIK46LSg_0[0];
NTIprocess__9bnO9cCg9bOEMdQ3fiqHHHqWA_.size = sizeof(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA*);
NTIprocess__9bnO9cCg9bOEMdQ3fiqHHHqWA_.align = NIM_ALIGNOF(tyObject_ProcessObj__vyZqvZvf09c7OWgG4Opi2aA*);
NTIprocess__9bnO9cCg9bOEMdQ3fiqHHHqWA_.kind = 22;
NTIprocess__9bnO9cCg9bOEMdQ3fiqHHHqWA_.base = (&NTIprocessobj__vyZqvZvf09c7OWgG4Opi2aA_);
NTIprocess__9bnO9cCg9bOEMdQ3fiqHHHqWA_.marker = Marker_tyRef__9bnO9cCg9bOEMdQ3fiqHHHqWA;
NTIseqLprocessT__1KIIbxJRtGjuxcp9a9bbC09cA_.size = sizeof(tySequence__1KIIbxJRtGjuxcp9a9bbC09cA*);
NTIseqLprocessT__1KIIbxJRtGjuxcp9a9bbC09cA_.align = NIM_ALIGNOF(tySequence__1KIIbxJRtGjuxcp9a9bbC09cA*);
NTIseqLprocessT__1KIIbxJRtGjuxcp9a9bbC09cA_.kind = 24;
NTIseqLprocessT__1KIIbxJRtGjuxcp9a9bbC09cA_.base = (&NTIprocess__9bnO9cCg9bOEMdQ3fiqHHHqWA_);
NTIseqLprocessT__1KIIbxJRtGjuxcp9a9bbC09cA_.marker = Marker_tySequence__1KIIbxJRtGjuxcp9a9bbC09cA;
}

