/* 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/@poptions.nim.c.o /Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/.nimcache/@poptions.nim.c */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks

#include "nimbase.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 TNimTypeV2 TNimTypeV2;
typedef struct tyObject_UnpackDefect__xK9aqHM18TKDzJ53FdCNa1g tyObject_UnpackDefect__xK9aqHM18TKDzJ53FdCNa1g;
typedef struct tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA;
typedef struct tyObject_Defect__OrUtYvY9ahZHkSCkuIUgLvA tyObject_Defect__OrUtYvY9ahZHkSCkuIUgLvA;
typedef struct Exception Exception;
typedef struct RootObj RootObj;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ tySequence__3EvzHGO0xyXGnJBUggwfKQ;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content;
typedef struct tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A;
typedef struct tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw;
typedef struct tyTuple__N4J9cV4JZGem3ljqqj5rT0Q tyTuple__N4J9cV4JZGem3ljqqj5rT0Q;
typedef struct tyObject_CellSeq__dIiPa2COtDnavhK2KIqxCQ tyObject_CellSeq__dIiPa2COtDnavhK2KIqxCQ;
typedef struct tyTuple__EMes4DT7YbRCwj3TmsFXyA tyTuple__EMes4DT7YbRCwj3TmsFXyA;
typedef struct tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw;
struct TNimTypeV2 {
	void* destructor;
	NI size;
	NI16 align;
	NI16 depth;
	NU32* display;
	void* traceImpl;
	void* typeInfoV1;
	NI flags;
	void* vTable[SEQ_DECL_SIZE];
};
struct tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA {
	NI rc;
	NI rootIdx;
};
struct RootObj {
	TNimTypeV2* m_type;
};
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
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_UnpackDefect__xK9aqHM18TKDzJ53FdCNa1g {
	tyObject_Defect__OrUtYvY9ahZHkSCkuIUgLvA Sup;
};
struct tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw {
	NI len;
	NI cap;
	tyTuple__N4J9cV4JZGem3ljqqj5rT0Q* d;
};
struct tyObject_CellSeq__dIiPa2COtDnavhK2KIqxCQ {
	NI len;
	NI cap;
	tyTuple__EMes4DT7YbRCwj3TmsFXyA* d;
};
struct tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A {
	tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw traceStack;
	tyObject_CellSeq__dIiPa2COtDnavhK2KIqxCQ toFree;
	NI freed;
	NI touched;
	NI edges;
	NI rcSum;
	NIM_BOOL keepThreshold;
};
struct tyTuple__N4J9cV4JZGem3ljqqj5rT0Q {
	void** Field0;
	TNimTypeV2* Field1;
};
struct tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw {
	NCSTRING procname;
	NI line;
	NCSTRING filename;
};
struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content { NI cap; tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZoptions_u97)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZtimes_u4282)(tyObject_UnpackDefect__xK9aqHM18TKDzJ53FdCNa1g* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u813)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3555)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___system_u3757)(tySequence__3EvzHGO0xyXGnJBUggwfKQ dest_p0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZtimes_u4294)(tyObject_UnpackDefect__xK9aqHM18TKDzJ53FdCNa1g* dest_p0, void* env_p1);
static N_INLINE(void, nimTraceRefDyn)(void* q_p0, void* env_p1);
static N_INLINE(void, add__system_u3076)(tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw* s_p0, void** c_p1, TNimTypeV2* t_p2);
N_LIB_PRIVATE N_NIMCALL(void, resize__system_u3084)(tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw* s_p0);
static N_INLINE(NI, pluspercent___system_u793)(NI x_p0, NI y_p1);
N_LIB_PRIVATE TNimTypeV2 NTIv2__xK9aqHM18TKDzJ53FdCNa1g_;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4198;
static NIM_CONST NU32 TM__4DNs4bMUkswhWc4o4dM9bbg_2[4] = {3701606400, 1285336064, 3039650304, 2942966784};
N_LIB_PRIVATE TNimTypeV2 NTIv2__xK9aqHM18TKDzJ53FdCNa1g_ = {.destructor = (void*)rttiDestroy__pureZoptions_u97, .size = sizeof(tyObject_UnpackDefect__xK9aqHM18TKDzJ53FdCNa1g), .align = (NI16) NIM_ALIGNOF(tyObject_UnpackDefect__xK9aqHM18TKDzJ53FdCNa1g), .depth = 3, .display = TM__4DNs4bMUkswhWc4o4dM9bbg_2, .traceImpl = (void*)eqtrace___pureZtimes_u4294, .flags = 0};
static N_INLINE(NI, minuspercent___system_u813)(NI x_p0, NI y_p1) {
	NI result;
	result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
	return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
	NIM_BOOL result;
	result = NIM_FALSE;
	{
		tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA* cell_1;
		NI T5_;
		if (!!((p_p0 == NIM_NIL))) goto LA3_;
		T5_ = (NI)0;
		T5_ = minuspercent___system_u813(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
		cell_1 = ((tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA*) (T5_));
		{
			if (!((NI)((*cell_1).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
			result = NIM_TRUE;
		}
		goto LA6_;
LA8_: ;
		{
			(*cell_1).rc = minuspercent___system_u813((*cell_1).rc, ((NI)16));
		}
LA6_: ;
		rememberCycle__system_u3555(result, cell_1, (*((TNimTypeV2**) (p_p0))));
	}
LA3_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZtimes_u4282)(tyObject_UnpackDefect__xK9aqHM18TKDzJ53FdCNa1g* dest_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).Sup.Sup.up);
		if (!T3_) goto LA4_;
		nimDestroyAndDispose((*dest_p0).Sup.Sup.up);
	}
LA4_: ;
	eqdestroy___system_u3757((*dest_p0).Sup.Sup.trace);
	if ((*dest_p0).Sup.Sup.message.p && !((*dest_p0).Sup.Sup.message.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Sup.Sup.message.p);
}
	{
		NIM_BOOL T8_;
		T8_ = (NIM_BOOL)0;
		T8_ = nimDecRefIsLastCyclicDyn((*dest_p0).Sup.Sup.parent);
		if (!T8_) goto LA9_;
		nimDestroyAndDispose((*dest_p0).Sup.Sup.parent);
	}
LA9_: ;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4198);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZoptions_u97)(void* dest_p0) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	eqdestroy___pureZtimes_u4282(((tyObject_UnpackDefect__xK9aqHM18TKDzJ53FdCNa1g*) (dest_p0)));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
static N_INLINE(NI, pluspercent___system_u793)(NI x_p0, NI y_p1) {
	NI result;
	result = ((NI) ((NU)((NU64)(((NU) (x_p0))) + (NU64)(((NU) (y_p1))))));
	return result;
}
static N_INLINE(void, add__system_u3076)(tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw* s_p0, void** c_p1, TNimTypeV2* t_p2) {
	void** colontmp_;
	TNimTypeV2* colontmp__2;
	{
		if (!((*s_p0).cap <= (*s_p0).len)) goto LA3_;
		resize__system_u3084(s_p0);
	}
LA3_: ;
	colontmp_ = c_p1;
	colontmp__2 = t_p2;
	(*s_p0).d[(*s_p0).len].Field0 = colontmp_;
	(*s_p0).d[(*s_p0).len].Field1 = colontmp__2;
	(*s_p0).len = pluspercent___system_u793((*s_p0).len, ((NI)1));
}
static N_INLINE(void, nimTraceRefDyn)(void* q_p0, void* env_p1) {
	void** p_1;
	p_1 = ((void**) (q_p0));
	{
		tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A* j_1;
		if (!!(((*p_1) == NIM_NIL))) goto LA3_;
		j_1 = ((tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A*) (env_p1));
		add__system_u3076((&(*j_1).traceStack), p_1, (*((TNimTypeV2**) ((*p_1)))));
	}
LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZtimes_u4294)(tyObject_UnpackDefect__xK9aqHM18TKDzJ53FdCNa1g* dest_p0, void* env_p1) {
	nimTraceRefDyn(&(*dest_p0).Sup.Sup.parent, env_p1);
	nimTraceRefDyn(&(*dest_p0).Sup.Sup.up, env_p1);
}
