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

#include "nimbase.h"
#include <string.h>
#include <math.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 tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tySequence__xv3aaFd3JCw8NbmALHiezQ tySequence__xv3aaFd3JCw8NbmALHiezQ;
typedef struct tySequence__xv3aaFd3JCw8NbmALHiezQ_Content tySequence__xv3aaFd3JCw8NbmALHiezQ_Content;
typedef struct tyTuple__sPaDkVPSC0MkcoXCxPH9ccA tyTuple__sPaDkVPSC0MkcoXCxPH9ccA;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_KeyError__qzHBUoNbmltDnZWA4mt9c9bw tyObject_KeyError__qzHBUoNbmltDnZWA4mt9c9bw;
typedef struct tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw;
typedef struct tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug;
typedef struct Exception Exception;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ tySequence__3EvzHGO0xyXGnJBUggwfKQ;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content;
typedef struct tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw;
typedef NU8 tyEnum_StringTableMode__6ub39bO039a0E9aDYDUuazVSw;
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__xv3aaFd3JCw8NbmALHiezQ {
  NI len; tySequence__xv3aaFd3JCw8NbmALHiezQ_Content* p;
};
struct tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg {
	RootObj Sup;
	NI counter;
	tySequence__xv3aaFd3JCw8NbmALHiezQ data;
	tyEnum_StringTableMode__6ub39bO039a0E9aDYDUuazVSw mode;
};
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
struct tyTuple__sPaDkVPSC0MkcoXCxPH9ccA {
	NimStringV2 Field0;
	NimStringV2 Field1;
	NIM_BOOL Field2;
};
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_CatchableError__liO6E8JNJNTVmf9cnXKZiug {
	Exception Sup;
};
struct tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw {
	tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug Sup;
};
struct tyObject_KeyError__qzHBUoNbmltDnZWA4mt9c9bw {
	tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw Sup;
};
struct tySequence__xv3aaFd3JCw8NbmALHiezQ_Content { NI cap; tyTuple__sPaDkVPSC0MkcoXCxPH9ccA data[SEQ_DECL_SIZE]; };
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*, nimNewObjUninit)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZstrtabs_u689)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZstrtabs_u498)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZstrtabs_u97)(tySequence__xv3aaFd3JCw8NbmALHiezQ dest_p0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p_p0, NI align_p1);
N_LIB_PRIVATE N_NIMCALL(tySequence__xv3aaFd3JCw8NbmALHiezQ, newSeq__pureZstrtabs_u486)(NI len_p0);
N_LIB_PRIVATE N_NIMCALL(NI, rawGet__pureZstrtabs_u286)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, NimStringV2 key_p1);
N_LIB_PRIVATE N_NIMCALL(NI, myhash__pureZstrtabs_u264)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, NimStringV2 key_p1);
N_LIB_PRIVATE N_NIMCALL(NI, hash__pureZhashes_u586)(NimStringV2 x_p0);
N_LIB_PRIVATE N_NIMCALL(NI, hashIgnoreCase__pureZhashes_u664)(NimStringV2 x_p0);
N_LIB_PRIVATE N_NIMCALL(NI, hashIgnoreStyle__pureZhashes_u597)(NimStringV2 x_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, myCmp__pureZstrtabs_u268)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, NimStringV2 a_p1, NimStringV2 b_p2);
N_LIB_PRIVATE N_NIMCALL(NI, cmp__system_u1571)(NimStringV2 x_p0, NimStringV2 y_p1);
N_LIB_PRIVATE N_NIMCALL(NI, nsuCmpIgnoreCase)(NimStringV2 a_p0, NimStringV2 b_p1);
N_LIB_PRIVATE N_NIMCALL(NI, nsuCmpIgnoreStyle)(NimStringV2 a_p0, NimStringV2 b_p1);
static N_INLINE(NI, nextTry__pureZstrtabs_u282)(NI h_p0, NI maxHash_p1);
static N_INLINE(NIM_BOOL, nimAddInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
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, rawNewString)(NI space_p0);
N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e_p0, NCSTRING ename_p1, NCSTRING procname_p2, NCSTRING filename_p3, NI line_p4);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___system_u2754)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, mustRehash__pureZstrtabs_u273)(NI length_p0, NI counter_p1);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u95)(NimStringV2 msg_p0);
static N_INLINE(NIM_BOOL, nimMulInt)(NI a_p0, NI b_p1, NI* res_p2);
static N_INLINE(NF, toFloat__system_u1705)(NI i_p0);
static N_INLINE(NF, abs__system_u5188)(NF x_p0);
static N_INLINE(NIM_BOOL, nimSubInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NIMCALL(void, enlarge__pureZstrtabs_u417)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0);
N_LIB_PRIVATE N_NIMCALL(void, newSeq__pureZstrtabs_u423)(tySequence__xv3aaFd3JCw8NbmALHiezQ* s_p0, NI len_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i_p0, NI64 a_p1, NI64 b_p2);
N_LIB_PRIVATE N_NIMCALL(void, rawInsert__pureZstrtabs_u405)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, tySequence__xv3aaFd3JCw8NbmALHiezQ* data_p1, NimStringV2 key_p2, NimStringV2 val_p3);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___system_u2751)(NimStringV2* dest_p0);
N_LIB_PRIVATE TNimTypeV2 NTIv2__aB8otkyeeuZW5rawDMqajg_;
extern TNimTypeV2 NTIv2__qzHBUoNbmltDnZWA4mt9c9bw_;
static const struct {
  NI cap; NIM_CHAR data[15+1];
} TM__ZT9crccxweoChVXn9cHcxIXQ_4 = { 15 | NIM_STRLIT_FLAG, "key not found: " };
static const NimStringV2 TM__ZT9crccxweoChVXn9cHcxIXQ_5 = {15, (NimStrPayload*)&TM__ZT9crccxweoChVXn9cHcxIXQ_4};
static const struct {
  NI cap; NIM_CHAR data[39+1];
} TM__ZT9crccxweoChVXn9cHcxIXQ_6 = { 39 | NIM_STRLIT_FLAG, "strtabs.nim(130, 9) `length > counter` " };
static const NimStringV2 TM__ZT9crccxweoChVXn9cHcxIXQ_7 = {39, (NimStrPayload*)&TM__ZT9crccxweoChVXn9cHcxIXQ_6};
static NIM_CONST NU32 TM__ZT9crccxweoChVXn9cHcxIXQ_2[2] = {3701606400, 522761728};
N_LIB_PRIVATE TNimTypeV2 NTIv2__aB8otkyeeuZW5rawDMqajg_ = {.destructor = (void*)rttiDestroy__pureZstrtabs_u689, .size = sizeof(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg), .align = (NI16) NIM_ALIGNOF(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg), .depth = 1, .display = TM__ZT9crccxweoChVXn9cHcxIXQ_2, .traceImpl = (void*)NIM_NIL, .flags = 0};
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4198;
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZstrtabs_u97)(tySequence__xv3aaFd3JCw8NbmALHiezQ 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__sPaDkVPSC0MkcoXCxPH9ccA));
}
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZstrtabs_u498)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* dest_p0) {
	eqdestroy___pureZstrtabs_u97((*dest_p0).data);
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZstrtabs_u689)(void* dest_p0) {
	eqdestroy___pureZstrtabs_u498(((tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg*) (dest_p0)));
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZstrtabs_u163)(tyTuple__sPaDkVPSC0MkcoXCxPH9ccA* dest_p0) {
	if ((*dest_p0).Field0.p && !((*dest_p0).Field0.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Field0.p);
}
	if ((*dest_p0).Field1.p && !((*dest_p0).Field1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Field1.p);
}
}
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___pureZstrtabs_u160)(tyTuple__sPaDkVPSC0MkcoXCxPH9ccA* dest_p0) {
	(*dest_p0).Field0.len = 0; (*dest_p0).Field0.p = NIM_NIL;
	(*dest_p0).Field1.len = 0; (*dest_p0).Field1.p = NIM_NIL;
	(*dest_p0).Field2 = 0;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg*, nstnewStringTable)(tyEnum_StringTableMode__6ub39bO039a0E9aDYDUuazVSw mode_p0) {
	tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* result;
	tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* T1_;
	T1_ = NIM_NIL;
	T1_ = (tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg*) nimNewObjUninit(sizeof(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg), NIM_ALIGNOF(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg));
	(*T1_).Sup.m_type = (&NTIv2__aB8otkyeeuZW5rawDMqajg_);
	(*T1_).mode = mode_p0;
	(*T1_).counter = ((NI)0);
	(*T1_).data = newSeq__pureZstrtabs_u486(((NI)64));
	result = T1_;
	return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4198);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, myhash__pureZstrtabs_u264)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, NimStringV2 key_p1) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	switch ((*t_p0).mode) {
	case ((tyEnum_StringTableMode__6ub39bO039a0E9aDYDUuazVSw)0):
	{
		result = hash__pureZhashes_u586(key_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	case ((tyEnum_StringTableMode__6ub39bO039a0E9aDYDUuazVSw)1):
	{
		result = hashIgnoreCase__pureZhashes_u664(key_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	case ((tyEnum_StringTableMode__6ub39bO039a0E9aDYDUuazVSw)2):
	{
		result = hashIgnoreStyle__pureZhashes_u597(key_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	default: __builtin_unreachable();
	}
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, myCmp__pureZstrtabs_u268)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, NimStringV2 a_p1, NimStringV2 b_p2) {
	NIM_BOOL result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	switch ((*t_p0).mode) {
	case ((tyEnum_StringTableMode__6ub39bO039a0E9aDYDUuazVSw)0):
	{
		NI T2_;
		T2_ = (NI)0;
		T2_ = cmp__system_u1571(a_p1, b_p2);
		result = (T2_ == ((NI)0));
	}
	break;
	case ((tyEnum_StringTableMode__6ub39bO039a0E9aDYDUuazVSw)1):
	{
		NI T4_;
		T4_ = (NI)0;
		T4_ = nsuCmpIgnoreCase(a_p1, b_p2);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		result = (T4_ == ((NI)0));
	}
	break;
	case ((tyEnum_StringTableMode__6ub39bO039a0E9aDYDUuazVSw)2):
	{
		NI T6_;
		T6_ = (NI)0;
		T6_ = nsuCmpIgnoreStyle(a_p1, b_p2);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		result = (T6_ == ((NI)0));
	}
	break;
	default: __builtin_unreachable();
	}
	}BeforeRet_: ;
	return result;
}
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;
}
static N_INLINE(NI, nextTry__pureZstrtabs_u282)(NI h_p0, NI maxHash_p1) {
	NI result;
	NI TM__ZT9crccxweoChVXn9cHcxIXQ_3;
{	result = (NI)0;
	if (nimAddInt(h_p0, ((NI)1), &TM__ZT9crccxweoChVXn9cHcxIXQ_3)) { raiseOverflow(); goto BeforeRet_;
	};
	result = (NI)((NI)(TM__ZT9crccxweoChVXn9cHcxIXQ_3) & maxHash_p1);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, rawGet__pureZstrtabs_u286)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, NimStringV2 key_p1) {
	NI result;
	NI h_1;
	NI T1_;
	NI T2_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	T1_ = (NI)0;
	T1_ = myhash__pureZstrtabs_u264(t_p0, key_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T2_ = ((*t_p0).data.len-1);
	h_1 = (NI)(T1_ & T2_);
	{
		while (1) {
			NI T10_;
			if (h_1 < 0 || h_1 >= (*t_p0).data.len){ raiseIndexError2(h_1,(*t_p0).data.len-1); goto BeforeRet_;
			}
			if (!(*t_p0).data.p->data[h_1].Field2) goto LA4;
			{
				NIM_BOOL T7_;
				if (h_1 < 0 || h_1 >= (*t_p0).data.len){ raiseIndexError2(h_1,(*t_p0).data.len-1); goto BeforeRet_;
				}
				T7_ = (NIM_BOOL)0;
				T7_ = myCmp__pureZstrtabs_u268(t_p0, (*t_p0).data.p->data[h_1].Field0, key_p1);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				if (!T7_) goto LA8_;
				result = h_1;
				goto BeforeRet_;
			}
LA8_: ;
			T10_ = ((*t_p0).data.len-1);
			h_1 = nextTry__pureZstrtabs_u282(h_1, T10_);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		} LA4: ;
	}
	result = ((NI)-1);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nsthasKey)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, NimStringV2 key_p1) {
	NIM_BOOL result;
	NI T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	T1_ = (NI)0;
	T1_ = rawGet__pureZstrtabs_u286(t_p0, key_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	result = (((NI)0) <= T1_);
	}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_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2*, nstTake)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, NimStringV2 key_p1) {
	NimStringV2* result;
	NI indexX60gensym3__1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NimStringV2*)0;
	indexX60gensym3__1 = rawGet__pureZstrtabs_u286(t_p0, key_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!(((NI)0) <= indexX60gensym3__1)) goto LA3_;
		if (indexX60gensym3__1 < 0 || indexX60gensym3__1 >= (*t_p0).data.len){ raiseIndexError2(indexX60gensym3__1,(*t_p0).data.len-1); goto BeforeRet_;
		}
		result = (&(*t_p0).data.p->data[indexX60gensym3__1].Field1);
	}
	goto LA1_;
LA3_: ;
	{
		tyObject_KeyError__qzHBUoNbmltDnZWA4mt9c9bw* T6_;
		NimStringV2 T7_;
		T6_ = NIM_NIL;
		T6_ = (tyObject_KeyError__qzHBUoNbmltDnZWA4mt9c9bw*) nimNewObj(sizeof(tyObject_KeyError__qzHBUoNbmltDnZWA4mt9c9bw), NIM_ALIGNOF(tyObject_KeyError__qzHBUoNbmltDnZWA4mt9c9bw));
		(*T6_).Sup.Sup.Sup.Sup.m_type = (&NTIv2__qzHBUoNbmltDnZWA4mt9c9bw_);
		(*T6_).Sup.Sup.Sup.name = "KeyError";
		T7_.len = 0; T7_.p = NIM_NIL;
		T7_ = rawNewString(key_p1.len + 15);
appendString((&T7_), TM__ZT9crccxweoChVXn9cHcxIXQ_5);
appendString((&T7_), key_p1);
		(*T6_).Sup.Sup.Sup.message = T7_;
		(*T6_).Sup.Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T6_, "KeyError", "[]", "strtabs.nim", 148);
goto BeforeRet_;
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NF, toFloat__system_u1705)(NI i_p0) {
	NF result;
	result = ((NF) (i_p0));
	return result;
}
static N_INLINE(NF, abs__system_u5188)(NF x_p0) {
	NF result;
	result = (NF)0;
	result = fabs(x_p0);
	return result;
}
static N_INLINE(NIM_BOOL, nimMulInt)(NI a_p0, NI b_p1, NI* res_p2) {
	NIM_BOOL result;
	NI r_1;
	NF floatProd_1;
	NF T1_;
	NF T2_;
	NF resAsFloat_1;
	result = (NIM_BOOL)0;
	r_1 = ((NI) ((NU)((NU64)(((NU) (a_p0))) * (NU64)(((NU) (b_p1))))));
	T1_ = (NF)0;
	T1_ = toFloat__system_u1705(a_p0);
	T2_ = (NF)0;
	T2_ = toFloat__system_u1705(b_p1);
	floatProd_1 = ((NF)(T1_) * (NF)(T2_));
	resAsFloat_1 = toFloat__system_u1705(r_1);
	{
		if (!(resAsFloat_1 == floatProd_1)) goto LA5_;
		(*res_p2) = r_1;
	}
	goto LA3_;
LA5_: ;
	{
		{
			NF T10_;
			NF T11_;
			T10_ = (NF)0;
			T10_ = abs__system_u5188(((NF)(resAsFloat_1) - (NF)(floatProd_1)));
			T11_ = (NF)0;
			T11_ = abs__system_u5188(floatProd_1);
			if (!(((NF)(32.0) * (NF)(T10_)) <= T11_)) goto LA12_;
			(*res_p2) = r_1;
		}
		goto LA8_;
LA12_: ;
		{
			result = NIM_TRUE;
		}
LA8_: ;
	}
LA3_: ;
	return result;
}
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(NIM_BOOL, mustRehash__pureZstrtabs_u273)(NI length_p0, NI counter_p1) {
	NIM_BOOL result;
	NIM_BOOL T5_;
	NI TM__ZT9crccxweoChVXn9cHcxIXQ_8;
	NI TM__ZT9crccxweoChVXn9cHcxIXQ_9;
	NI TM__ZT9crccxweoChVXn9cHcxIXQ_10;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	{
		if (!!((counter_p1 < length_p0))) goto LA3_;
		failedAssertImpl__stdZassertions_u95(TM__ZT9crccxweoChVXn9cHcxIXQ_7);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	T5_ = (NIM_BOOL)0;
	if (nimMulInt(length_p0, ((NI)2), &TM__ZT9crccxweoChVXn9cHcxIXQ_8)) { raiseOverflow(); goto BeforeRet_;
	};
	if (nimMulInt(counter_p1, ((NI)3), &TM__ZT9crccxweoChVXn9cHcxIXQ_9)) { raiseOverflow(); goto BeforeRet_;
	};
	T5_ = ((NI)(TM__ZT9crccxweoChVXn9cHcxIXQ_8) < (NI)(TM__ZT9crccxweoChVXn9cHcxIXQ_9));
	if (T5_) goto LA6_;
	if (nimSubInt(length_p0, counter_p1, &TM__ZT9crccxweoChVXn9cHcxIXQ_10)) { raiseOverflow(); goto BeforeRet_;
	};
	T5_ = ((NI)(TM__ZT9crccxweoChVXn9cHcxIXQ_10) < ((NI)4));
LA6_: ;
	result = T5_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, rawInsert__pureZstrtabs_u405)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, tySequence__xv3aaFd3JCw8NbmALHiezQ* data_p1, NimStringV2 key_p2, NimStringV2 val_p3) {
	NI h_1;
	NI T1_;
	NI T2_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	T1_ = (NI)0;
	T1_ = myhash__pureZstrtabs_u264(t_p0, key_p2);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T2_ = ((*data_p1).len-1);
	h_1 = (NI)(T1_ & T2_);
	{
		while (1) {
			NI T5_;
			if (h_1 < 0 || h_1 >= (*data_p1).len){ raiseIndexError2(h_1,(*data_p1).len-1); goto BeforeRet_;
			}
			if (!(*data_p1).p->data[h_1].Field2) goto LA4;
			T5_ = ((*data_p1).len-1);
			h_1 = nextTry__pureZstrtabs_u282(h_1, T5_);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		} LA4: ;
	}
	if (h_1 < 0 || h_1 >= (*data_p1).len){ raiseIndexError2(h_1,(*data_p1).len-1); goto BeforeRet_;
	}
	eqcopy___system_u2754((&(*data_p1).p->data[h_1].Field0), key_p2);
	if (h_1 < 0 || h_1 >= (*data_p1).len){ raiseIndexError2(h_1,(*data_p1).len-1); goto BeforeRet_;
	}
	eqcopy___system_u2754((&(*data_p1).p->data[h_1].Field1), val_p3);
	if (h_1 < 0 || h_1 >= (*data_p1).len){ raiseIndexError2(h_1,(*data_p1).len-1); goto BeforeRet_;
	}
	(*data_p1).p->data[h_1].Field2 = NIM_TRUE;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, enlarge__pureZstrtabs_u417)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0) {
	tySequence__xv3aaFd3JCw8NbmALHiezQ n_1;
	NI T1_;
	NI TM__ZT9crccxweoChVXn9cHcxIXQ_11;
	tySequence__xv3aaFd3JCw8NbmALHiezQ T10_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	n_1.len = 0; n_1.p = NIM_NIL;
	T1_ = (*t_p0).data.len;
	if (nimMulInt(T1_, ((NI)2), &TM__ZT9crccxweoChVXn9cHcxIXQ_11)) { raiseOverflow(); goto BeforeRet_;
	};
	if (((NI)(TM__ZT9crccxweoChVXn9cHcxIXQ_11)) < ((NI)0) || ((NI)(TM__ZT9crccxweoChVXn9cHcxIXQ_11)) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__ZT9crccxweoChVXn9cHcxIXQ_11), ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
	}
	newSeq__pureZstrtabs_u423((&n_1), ((NI)(TM__ZT9crccxweoChVXn9cHcxIXQ_11)));
	{
		NI i_1;
		NI colontmp_;
		NI T3_;
		NI res_1;
		i_1 = (NI)0;
		colontmp_ = (NI)0;
		T3_ = ((*t_p0).data.len-1);
		colontmp_ = T3_;
		res_1 = ((NI)0);
		{
			while (1) {
				NI TM__ZT9crccxweoChVXn9cHcxIXQ_12;
				if (!(res_1 <= colontmp_)) goto LA5;
				i_1 = ((NI) (res_1));
				{
					NimStringV2 colontmpD_;
					NimStringV2 colontmpD__2;
					if (i_1 < 0 || i_1 >= (*t_p0).data.len){ raiseIndexError2(i_1,(*t_p0).data.len-1); goto BeforeRet_;
					}
					if (!(*t_p0).data.p->data[i_1].Field2) goto LA8_;
					colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
					colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
					if (i_1 < 0 || i_1 >= (*t_p0).data.len){ raiseIndexError2(i_1,(*t_p0).data.len-1); goto BeforeRet_;
					}
					colontmpD_ = (*t_p0).data.p->data[i_1].Field0;
					eqwasMoved___system_u2751((&(*t_p0).data.p->data[i_1].Field0));
					if (i_1 < 0 || i_1 >= (*t_p0).data.len){ raiseIndexError2(i_1,(*t_p0).data.len-1); goto BeforeRet_;
					}
					colontmpD__2 = (*t_p0).data.p->data[i_1].Field1;
					eqwasMoved___system_u2751((&(*t_p0).data.p->data[i_1].Field1));
					rawInsert__pureZstrtabs_u405(t_p0, (&n_1), colontmpD_, colontmpD__2);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					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);
}
				}
LA8_: ;
				if (nimAddInt(res_1, ((NI)1), &TM__ZT9crccxweoChVXn9cHcxIXQ_12)) { raiseOverflow(); goto BeforeRet_;
				};
				res_1 = (NI)(TM__ZT9crccxweoChVXn9cHcxIXQ_12);
			} LA5: ;
		}
	}
	T10_.len = 0; T10_.p = NIM_NIL;
	T10_ = (*t_p0).data;
	(*t_p0).data = n_1;
	n_1 = T10_;
	eqdestroy___pureZstrtabs_u97(n_1);
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, nstPut)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0, NimStringV2 key_p1, NimStringV2 val_p2) {
	NI index_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	index_1 = rawGet__pureZstrtabs_u286(t_p0, key_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!(((NI)0) <= index_1)) goto LA3_;
		if (index_1 < 0 || index_1 >= (*t_p0).data.len){ raiseIndexError2(index_1,(*t_p0).data.len-1); goto BeforeRet_;
		}
		eqcopy___system_u2754((&(*t_p0).data.p->data[index_1].Field1), val_p2);
	}
	goto LA1_;
LA3_: ;
	{
		tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* T12_;
		NI TM__ZT9crccxweoChVXn9cHcxIXQ_13;
		{
			NI T8_;
			NIM_BOOL T9_;
			T8_ = (*t_p0).data.len;
			T9_ = (NIM_BOOL)0;
			T9_ = mustRehash__pureZstrtabs_u273(T8_, (*t_p0).counter);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (!T9_) goto LA10_;
			enlarge__pureZstrtabs_u417(t_p0);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
LA10_: ;
		T12_ = NIM_NIL;
		T12_ = t_p0;
		rawInsert__pureZstrtabs_u405(T12_, (&(*t_p0).data), key_p1, val_p2);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (nimAddInt((*t_p0).counter, ((NI)1), &TM__ZT9crccxweoChVXn9cHcxIXQ_13)) { raiseOverflow(); goto BeforeRet_;
		};
		(*t_p0).counter = (NI)(TM__ZT9crccxweoChVXn9cHcxIXQ_13);
	}
LA1_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NI, nstlen)(tyObject_StringTableObj__aB8otkyeeuZW5rawDMqajg* t_p0) {
	NI result;
	result = (*t_p0).counter;
	return result;
}
