/* Generated by Nim Compiler v2.2.10 */
/* Compiled for: MacOSX, arm64, clang */
/* Command for C compiler:
   clang -c  -w -ferror-limit=3 -fno-strict-aliasing -pthread -isysroot /Applications/Xcode_16.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -target arm64-apple-darwin24.2.0 -O3   -I/Users/runner/work/nightlies/nightlies/nim-2.2.10/lib -I/Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/src -o /Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/.nimcache/@pstd@scmdline.nim.c.o /Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/.nimcache/@pstd@scmdline.nim.c */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks

#include "nimbase.h"
#include <string.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
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_IndexDefect__Eq8hLo1nOVNgU1kcCW9bQTQ tyObject_IndexDefect__Eq8hLo1nOVNgU1kcCW9bQTQ;
typedef struct tyObject_Defect__OrUtYvY9ahZHkSCkuIUgLvA tyObject_Defect__OrUtYvY9ahZHkSCkuIUgLvA;
typedef struct Exception Exception;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ tySequence__3EvzHGO0xyXGnJBUggwfKQ;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content;
typedef struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ tySequence__sM4lkSb7zS6F7OVMvW9cffQ;
typedef struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ_Content tySequence__sM4lkSb7zS6F7OVMvW9cffQ_Content;
typedef struct tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw;
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
struct TNimTypeV2 {
	void* destructor;
	NI size;
	NI16 align;
	NI16 depth;
	NU32* display;
	void* traceImpl;
	void* typeInfoV1;
	NI flags;
	void* vTable[SEQ_DECL_SIZE];
};
struct RootObj {
	TNimTypeV2* m_type;
};
struct tySequence__3EvzHGO0xyXGnJBUggwfKQ {
  NI len; tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content* p;
};
struct Exception {
	RootObj Sup;
	Exception* parent;
	NCSTRING name;
	NimStringV2 message;
	tySequence__3EvzHGO0xyXGnJBUggwfKQ trace;
	Exception* up;
};
struct tyObject_Defect__OrUtYvY9ahZHkSCkuIUgLvA {
	Exception Sup;
};
struct tyObject_IndexDefect__Eq8hLo1nOVNgU1kcCW9bQTQ {
	tyObject_Defect__OrUtYvY9ahZHkSCkuIUgLvA Sup;
};
struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ {
  NI len; tySequence__sM4lkSb7zS6F7OVMvW9cffQ_Content* p;
};
struct tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw {
	NCSTRING procname;
	NI line;
	NCSTRING filename;
};
struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content { NI cap; tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw data[SEQ_DECL_SIZE]; };
struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ_Content { NI cap; NimStringV2 data[SEQ_DECL_SIZE]; };
static N_INLINE(NIM_BOOL, nimSubInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, cstrToNimstr)(NCSTRING str_p0);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___system_u2751)(NimStringV2* dest_p0);
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1);
static N_INLINE(void, copyMem__system_u1755)(void* dest_p0, void* source_p1, NI size_p2);
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u14)(NI xX60gensym0__p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u29)(NI32 xX60gensym3__p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, rawNewString)(NI space_p0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e_p0, NCSTRING ename_p1, NCSTRING procname_p2, NCSTRING filename_p3, NI line_p4);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void*, newSeqPayload)(NI cap_p0, NI elemSize_p1, NI elemAlign_p2);
N_LIB_PRIVATE N_NIMCALL(NI, paramCount__stdZcmdline_u61)(void);
N_LIB_PRIVATE N_NIMCALL(void, add__stdZenumutils_u70)(tySequence__sM4lkSb7zS6F7OVMvW9cffQ* x_p0, NimStringV2 y_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, paramStr__stdZcmdline_u55)(NI i_p0);
static N_INLINE(void, eqdestroy___system_u281)(NimStringV2 x_p0);
static N_INLINE(NIM_BOOL, nimAddInt)(NI a_p0, NI b_p1, NI* res_p2);
extern TNimTypeV2 NTIv2__Eq8hLo1nOVNgU1kcCW9bQTQ_;
static const struct {
  NI cap; NIM_CHAR data[43+1];
} TM__MZPGKsURfItHSi3RvnOT8Q_4 = { 43 | NIM_STRLIT_FLAG, "index out of bounds, the container is empty" };
static const NimStringV2 TM__MZPGKsURfItHSi3RvnOT8Q_5 = {43, (NimStrPayload*)&TM__MZPGKsURfItHSi3RvnOT8Q_4};
static const struct {
  NI cap; NIM_CHAR data[6+1];
} TM__MZPGKsURfItHSi3RvnOT8Q_6 = { 6 | NIM_STRLIT_FLAG, "index " };
static const NimStringV2 TM__MZPGKsURfItHSi3RvnOT8Q_7 = {6, (NimStrPayload*)&TM__MZPGKsURfItHSi3RvnOT8Q_6};
static const struct {
  NI cap; NIM_CHAR data[13+1];
} TM__MZPGKsURfItHSi3RvnOT8Q_8 = { 13 | NIM_STRLIT_FLAG, " not in 0 .. " };
static const NimStringV2 TM__MZPGKsURfItHSi3RvnOT8Q_9 = {13, (NimStrPayload*)&TM__MZPGKsURfItHSi3RvnOT8Q_8};
extern int cmdCount;
extern NCSTRING* cmdLine;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4198;
static N_INLINE(NIM_BOOL, nimSubInt)(NI a_p0, NI b_p1, NI* res_p2) {
	NIM_BOOL result;
	NI r_1;
	result = (NIM_BOOL)0;
	r_1 = ((NI) ((NU)((NU64)(((NU) (a_p0))) - (NU64)(((NU) (b_p1))))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI)0) <= (NI)(r_1 ^ a_p0));
		if (T3_) goto LA4_;
		T3_ = (((NI)0) <= (NI)(r_1 ^ (NI)((NU64) ~(b_p1))));
LA4_: ;
		if (!T3_) goto LA5_;
		(*res_p2) = r_1;
	}
	goto LA1_;
LA5_: ;
	{
		result = NIM_TRUE;
	}
LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, paramCount__stdZcmdline_u61)(void) {
	NI result;
	NI TM__MZPGKsURfItHSi3RvnOT8Q_2;
{	result = (NI)0;
	if (nimSubInt(cmdCount, ((NI32)1), &TM__MZPGKsURfItHSi3RvnOT8Q_2)) { raiseOverflow(); goto BeforeRet_;
	};
	if (TM__MZPGKsURfItHSi3RvnOT8Q_2 < (-2147483647 -1) || TM__MZPGKsURfItHSi3RvnOT8Q_2 > 2147483647){ raiseOverflow(); goto BeforeRet_;
	}
	result = ((NI) ((NI32)(TM__MZPGKsURfItHSi3RvnOT8Q_2)));
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest_p0, source_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, copyMem__system_u1755)(void* dest_p0, void* source_p1, NI size_p2) {
	nimCopyMem(dest_p0, source_p1, size_p2);
}
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1) {
	{
		if (!(((NI)0) < src_p1.len)) goto LA3_;
		copyMem__system_u1755(((void*) ((&(*(*dest_p0).p).data[(*dest_p0).len]))), ((void*) ((&(*src_p1.p).data[((NI)0)]))), (src_p1.len));
		(*dest_p0).len += src_p1.len;
		(*(*dest_p0).p).data[(*dest_p0).len] = 0;
	}
LA3_: ;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4198);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, paramStr__stdZcmdline_u55)(NI i_p0) {
	NimStringV2 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (i_p0 < ((NI) (cmdCount)));
		if (!(T3_)) goto LA4_;
		T3_ = (((NI)0) <= i_p0);
LA4_: ;
		if (!T3_) goto LA5_;
		result = cstrToNimstr(cmdLine[i_p0]);
	}
	goto LA1_;
LA5_: ;
	{
		NimStringV2 colontmpD_;
		NimStringV2 colontmpD__2;
		tyObject_IndexDefect__Eq8hLo1nOVNgU1kcCW9bQTQ* T9_;
		colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
		colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
		T9_ = NIM_NIL;
		T9_ = (tyObject_IndexDefect__Eq8hLo1nOVNgU1kcCW9bQTQ*) nimNewObj(sizeof(tyObject_IndexDefect__Eq8hLo1nOVNgU1kcCW9bQTQ), NIM_ALIGNOF(tyObject_IndexDefect__Eq8hLo1nOVNgU1kcCW9bQTQ));
		(*T9_).Sup.Sup.Sup.m_type = (&NTIv2__Eq8hLo1nOVNgU1kcCW9bQTQ_);
		(*T9_).Sup.Sup.name = "IndexDefect";
		{
			NI TM__MZPGKsURfItHSi3RvnOT8Q_3;
			NimStringV2 blitTmp_1;
			if (nimSubInt(cmdCount, ((NI32)1), &TM__MZPGKsURfItHSi3RvnOT8Q_3)) { raiseOverflow(); goto LA8_;
			};
			if (TM__MZPGKsURfItHSi3RvnOT8Q_3 < (-2147483647 -1) || TM__MZPGKsURfItHSi3RvnOT8Q_3 > 2147483647){ raiseOverflow(); goto LA8_;
			}
			if (!((NI32)(TM__MZPGKsURfItHSi3RvnOT8Q_3) < ((NI32)0))) goto LA12_;
			colontmpD_ = TM__MZPGKsURfItHSi3RvnOT8Q_5;
			blitTmp_1 = colontmpD_;
			eqwasMoved___system_u2751((&colontmpD_));
			(*T9_).Sup.Sup.message = blitTmp_1;
		}
		goto LA10_;
LA12_: ;
		{
			NimStringV2 colontmpD__3;
			NimStringV2 colontmpD__4;
			NimStringV2 T15_;
			NI TM__MZPGKsURfItHSi3RvnOT8Q_10;
			NimStringV2 blitTmp_2;
			colontmpD__3.len = 0; colontmpD__3.p = NIM_NIL;
			colontmpD__4.len = 0; colontmpD__4.p = NIM_NIL;
			T15_.len = 0; T15_.p = NIM_NIL;
			colontmpD__3 = dollar___systemZdollars_u14(i_p0);
			if (NIM_UNLIKELY(*nimErr_)) goto LA8_;
			if (nimSubInt(cmdCount, ((NI32)1), &TM__MZPGKsURfItHSi3RvnOT8Q_10)) { raiseOverflow(); goto LA8_;
			};
			if (TM__MZPGKsURfItHSi3RvnOT8Q_10 < (-2147483647 -1) || TM__MZPGKsURfItHSi3RvnOT8Q_10 > 2147483647){ raiseOverflow(); goto LA8_;
			}
			colontmpD__4 = dollar___systemZdollars_u29((NI32)(TM__MZPGKsURfItHSi3RvnOT8Q_10));
			if (NIM_UNLIKELY(*nimErr_)) goto LA8_;
			T15_ = rawNewString(colontmpD__3.len + colontmpD__4.len + 19);
appendString((&T15_), TM__MZPGKsURfItHSi3RvnOT8Q_7);
appendString((&T15_), colontmpD__3);
appendString((&T15_), TM__MZPGKsURfItHSi3RvnOT8Q_9);
appendString((&T15_), colontmpD__4);
			colontmpD__2 = T15_;
			if (colontmpD__4.p && !(colontmpD__4.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__4.p);
}
			if (colontmpD__3.p && !(colontmpD__3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__3.p);
}
			blitTmp_2 = colontmpD__2;
			eqwasMoved___system_u2751((&colontmpD__2));
			(*T9_).Sup.Sup.message = blitTmp_2;
		}
LA10_: ;
		(*T9_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T9_, "IndexDefect", "paramStr", "cmdline.nim", 272);
goto LA8_;
		{
			LA8_:;
		}
		{
			if (colontmpD__2.p && !(colontmpD__2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__2.p);
}
			if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
		}
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, eqdestroy___system_u281)(NimStringV2 x_p0) {
}
static N_INLINE(NIM_BOOL, nimAddInt)(NI a_p0, NI b_p1, NI* res_p2) {
	NIM_BOOL result;
	NI r_1;
	result = (NIM_BOOL)0;
	r_1 = ((NI) ((NU)((NU64)(((NU) (a_p0))) + (NU64)(((NU) (b_p1))))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI)0) <= (NI)(r_1 ^ a_p0));
		if (T3_) goto LA4_;
		T3_ = (((NI)0) <= (NI)(r_1 ^ b_p1));
LA4_: ;
		if (!T3_) goto LA5_;
		(*res_p2) = r_1;
	}
	goto LA1_;
LA5_: ;
	{
		result = NIM_TRUE;
	}
LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tySequence__sM4lkSb7zS6F7OVMvW9cffQ, commandLineParams__stdZcmdline_u63)(void) {
	tySequence__sM4lkSb7zS6F7OVMvW9cffQ result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = (tySequence__sM4lkSb7zS6F7OVMvW9cffQ_Content*) newSeqPayload(0, sizeof(NimStringV2), NIM_ALIGNOF(NimStringV2));
	{
		NI i_1;
		NI colontmp_;
		NI res_1;
		i_1 = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = paramCount__stdZcmdline_u61();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		res_1 = ((NI)1);
		{
			while (1) {
				NimStringV2 T4_;
				NI TM__MZPGKsURfItHSi3RvnOT8Q_11;
				if (!(res_1 <= colontmp_)) goto LA3;
				i_1 = ((NI) (res_1));
				T4_.len = 0; T4_.p = NIM_NIL;
				T4_ = paramStr__stdZcmdline_u55(i_1);
				if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T4_); goto BeforeRet_;}
				add__stdZenumutils_u70((&result), T4_);
				if (nimAddInt(res_1, ((NI)1), &TM__MZPGKsURfItHSi3RvnOT8Q_11)) { raiseOverflow(); goto BeforeRet_;
				};
				res_1 = (NI)(TM__MZPGKsURfItHSi3RvnOT8Q_11);
			} LA3: ;
		}
	}
	}BeforeRet_: ;
	return result;
}
