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

#include "nimbase.h"
#include <string.h>
#include <stdlib.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 tySequence__4eQHGndY6XBYpFOH09apV8Q tySequence__4eQHGndY6XBYpFOH09apV8Q;
typedef struct tySequence__4eQHGndY6XBYpFOH09apV8Q_Content tySequence__4eQHGndY6XBYpFOH09apV8Q_Content;
typedef struct tyObject_NimRawSeq__8ODFhI7GYUKt9cpVXMRXb9bQ tyObject_NimRawSeq__8ODFhI7GYUKt9cpVXMRXb9bQ;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
struct tySequence__4eQHGndY6XBYpFOH09apV8Q {
  NI len; tySequence__4eQHGndY6XBYpFOH09apV8Q_Content* p;
};
struct tyObject_NimRawSeq__8ODFhI7GYUKt9cpVXMRXb9bQ {
	NI len;
	void* p;
};
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
	NimStringV2 Field0;
	NimStringV2 Field1;
};
struct tySequence__4eQHGndY6XBYpFOH09apV8Q_Content { NI cap; tyTuple__UV3llMMYFckfui8YMBuUZA data[SEQ_DECL_SIZE]; };
static N_INLINE(NIM_BOOL, sameSeqPayload)(void* x_p0, void* y_p1);
N_LIB_PRIVATE N_NIMCALL(void, setLen__stdZenvvars_u124)(tySequence__4eQHGndY6XBYpFOH09apV8Q* s_p0, NI newlen_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___system_u2754)(NimStringV2* dest_p0, NimStringV2 src_p1);
static N_INLINE(NIM_BOOL, eqeq___system_u9048)(NCSTRING x_p0, NCSTRING y_p1);
N_LIB_PRIVATE N_NIMCALL(NCSTRING, getEnvImpl__stdZenvvars_u12)(NCSTRING env_p0);
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, cstrToNimstr)(NCSTRING str_p0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p_p0, NI align_p1);
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4198;
static N_INLINE(NIM_BOOL, sameSeqPayload)(void* x_p0, void* y_p1) {
	NIM_BOOL result;
	result = ((*((tyObject_NimRawSeq__8ODFhI7GYUKt9cpVXMRXb9bQ*) (x_p0))).p == (*((tyObject_NimRawSeq__8ODFhI7GYUKt9cpVXMRXb9bQ*) (y_p1))).p);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___stdZenvvars_u106)(tySequence__4eQHGndY6XBYpFOH09apV8Q* dest_p0, tySequence__4eQHGndY6XBYpFOH09apV8Q src_p1) {
	NI T6_;
	NI colontmp_;
{	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = sameSeqPayload(dest_p0, (&src_p1));
		if (!T3_) goto LA4_;
		goto BeforeRet_;
	}
LA4_: ;
	T6_ = src_p1.len;
	setLen__stdZenvvars_u124((&(*dest_p0)), T6_);
	colontmp_ = ((NI)0);
	{
		while (1) {
			NI T9_;
			T9_ = (*dest_p0).len;
			if (!(colontmp_ < T9_)) goto LA8;
			eqcopy___system_u2754((&(*dest_p0).p->data[colontmp_].Field0), src_p1.p->data[colontmp_].Field0);
			eqcopy___system_u2754((&(*dest_p0).p->data[colontmp_].Field1), src_p1.p->data[colontmp_].Field1);
			colontmp_ += ((NI)1);
		} LA8: ;
	}
	}BeforeRet_: ;
}
static N_INLINE(NIM_BOOL, eqeq___system_u9048)(NCSTRING x_p0, NCSTRING y_p1) {
	NIM_BOOL result;
	{
		if (!(((void*) (x_p0)) == ((void*) (y_p1)))) goto LA3_;
		result = NIM_TRUE;
	}
	goto LA1_;
LA3_: ;
	{
		NIM_BOOL T6_;
		T6_ = (NIM_BOOL)0;
		T6_ = (((void*) (x_p0)) == NIM_NIL);
		if (T6_) goto LA7_;
		T6_ = (((void*) (y_p1)) == NIM_NIL);
LA7_: ;
		if (!T6_) goto LA8_;
		result = NIM_FALSE;
	}
	goto LA1_;
LA8_: ;
	{
		int T11_;
		T11_ = (int)0;
		T11_ = strcmp(x_p0, y_p1);
		result = (T11_ == ((NI32)0));
	}
LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NCSTRING, getEnvImpl__stdZenvvars_u12)(NCSTRING env_p0) {
	NCSTRING result;
	result = getenv(env_p0);
	return result;
}
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s_p0) {
	NCSTRING result;
	{
		if (!(s_p0.len == ((NI)0))) goto LA3_;
		result = "";
	}
	goto LA1_;
LA3_: ;
	{
		result = ((NCSTRING) ((*s_p0.p).data));
	}
LA1_: ;
	return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4198);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, existsEnv__stdZenvvars_u20)(NimStringV2 key_p0) {
	NIM_BOOL result;
	NCSTRING T1_;
	NIM_BOOL T2_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	T1_ = (NCSTRING)0;
	T1_ = getEnvImpl__stdZenvvars_u12(nimToCStringConv(key_p0));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T2_ = (NIM_BOOL)0;
	T2_ = eqeq___system_u9048(T1_, ((NCSTRING) NIM_NIL));
	result = !(T2_);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, getEnv__stdZenvvars_u15)(NimStringV2 key_p0, NimStringV2 default_p1) {
	NimStringV2 result;
	NCSTRING env_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	env_1 = getEnvImpl__stdZenvvars_u12(nimToCStringConv(key_p0));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = eqeq___system_u9048(env_1, ((NCSTRING) NIM_NIL));
		if (!T3_) goto LA4_;
		eqcopy___system_u2754((&result), default_p1);
	}
	goto LA1_;
LA4_: ;
	{
		result = cstrToNimstr(env_1);
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZenvvars_u103)(tySequence__4eQHGndY6XBYpFOH09apV8Q dest_p0) {
	NI colontmp_;
	colontmp_ = ((NI)0);
	{
		while (1) {
			NI T3_;
			T3_ = dest_p0.len;
			if (!(colontmp_ < T3_)) goto LA2;
			if (dest_p0.p->data[colontmp_].Field0.p && !(dest_p0.p->data[colontmp_].Field0.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(dest_p0.p->data[colontmp_].Field0.p);
}
			if (dest_p0.p->data[colontmp_].Field1.p && !(dest_p0.p->data[colontmp_].Field1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(dest_p0.p->data[colontmp_].Field1.p);
}
			colontmp_ += ((NI)1);
		} LA2: ;
	}
	if (dest_p0.p && !(dest_p0.p->cap & NIM_STRLIT_FLAG)) {
 alignedDealloc(dest_p0.p, NIM_ALIGNOF(tyTuple__UV3llMMYFckfui8YMBuUZA));
}
}
