/* Generated by Nim Compiler v1.3.5 */
/*   (c) 2020 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 64

/* section: NIM_merge_HEADERS */

#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

/* section: NIM_merge_FRAME_DEFINES */
#define nimfr_(x, y)
#define nimln_(x, y)

/* section: NIM_merge_FORWARD_TYPES */
typedef struct tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg;
typedef struct tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw;
typedef struct tyObject_TType__v9ae2Dpu13OW2ZJ2U9bNMd9cQ tyObject_TType__v9ae2Dpu13OW2ZJ2U9bNMd9cQ;
typedef struct tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q;
typedef struct tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w;
typedef struct tyObject_TIdent__GufRQq9c0miSybX3zBD4tyA tyObject_TIdent__GufRQq9c0miSybX3zBD4tyA;
typedef struct tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ;
typedef struct tyTuple__9aIi6GdTSD27YtPkWxMqNxA tyTuple__9aIi6GdTSD27YtPkWxMqNxA;

/* section: NIM_merge_TYPES */
struct tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg {
tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* root;
NI entries;
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
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__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NimStringDesc* tyArray__9aijZrM1syqzleJpcL8bUyw[512];
typedef tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* tyArray__VznXOmL540VWlOp56dB9cqA[512];
typedef tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* tyArray__jSFVQ48g222vuMjoJArs8A[512];
struct tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g {
NI entries;
tyArray__9aijZrM1syqzleJpcL8bUyw keys;
NIM_BOOL isInternal;
union{
struct {tyArray__VznXOmL540VWlOp56dB9cqA vals;
} _isInternal_1;
struct {tyArray__jSFVQ48g222vuMjoJArs8A links;
} _isInternal_2;
};
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q {
NU16 line;
NI16 col;
NI32 fileIndex;
};
typedef NU32 tySet_tyEnum_TNodeFlag__jyh9acXHkhZANSSvPIY7ZLg;
typedef NU8 tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw;
struct tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw {
tyObject_TType__v9ae2Dpu13OW2ZJ2U9bNMd9cQ* typ;
tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q info;
tySet_tyEnum_TNodeFlag__jyh9acXHkhZANSSvPIY7ZLg flags;
tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw kind;
union{
struct {NI64 intVal;
} _kind_1;
struct {NF floatVal;
} _kind_2;
struct {NimStringDesc* strVal;
} _kind_3;
struct {tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w* sym;
} _kind_4;
struct {tyObject_TIdent__GufRQq9c0miSybX3zBD4tyA* ident;
} _kind_5;
struct {tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ* sons;
} _kind_6;
};
NimStringDesc* comment;
};
struct tyTuple__9aIi6GdTSD27YtPkWxMqNxA {
NimStringDesc* Field0;
tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* Field1;
NI Field2;
};

/* section: NIM_merge_SEQ_TYPES */
struct tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ {
  TGenericSeq Sup;
  tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* data[SEQ_DECL_SIZE];
};

/* section: NIM_merge_PROC_HEADERS */
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, Marker_tyRef__tPE9ckDbaXj82MdUy0JgA7w)(void* p, NI op);
static N_INLINE(void, unsureAsgnRef)(void** dest, void* src);
N_LIB_PRIVATE N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_LIB_PRIVATE N_NIMCALL(NI, cmp__NAicU5bAGXmkx2NJujGi7g)(NimStringDesc* x, NimStringDesc* y);
N_LIB_PRIVATE N_NIMCALL(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*, insert__J9bkvsuQNLcr7jeLPdOelGQ)(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* h, NimStringDesc* key, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* val);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_LIB_PRIVATE N_NIMCALL(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*, split__yftxuAKQL15Q5Hq7NIaang)(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* h);
N_LIB_PRIVATE N_NIMCALL(void, copyHalf__QHbavwJ9cIUJ59b9aC42MHBDg)(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* h, tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* result);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(NI, countSubTree__9bmJBiJZIhY26taaMZrwXcw)(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* it);

/* section: NIM_merge_DATA */
N_LIB_PRIVATE TNimType NTI__VZdzO0Tlflp7WMN4gS8oPg_;
N_LIB_PRIVATE TNimType NTI__dNELmBSmY7nthjhZupWO6g_;
extern TNimType NTI__rR5Bzr1D5krxoo1NcNyeMA_;
extern TNimType NTI__77mFvmsOLKik79ci2hXkHEg_;
N_LIB_PRIVATE TNimType NTI__9aijZrM1syqzleJpcL8bUyw_;
extern TNimType NTI__VaVACK0bpYmqIQ0mKcHfQQ_;
TNimNode* NimDT___dNELmBSmY7nthjhZupWO6g_isInternal[3];
extern TNimType NTI__fKfcLzXYiz5jNu3NH3Tv8Q_;
N_LIB_PRIVATE TNimType NTI__VznXOmL540VWlOp56dB9cqA_;
N_LIB_PRIVATE TNimType NTI__jSFVQ48g222vuMjoJArs8A_;
N_LIB_PRIVATE TNimType NTI__tPE9ckDbaXj82MdUy0JgA7w_;

/* section: NIM_merge_VARS */
extern NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;

/* section: NIM_merge_PROCS */
static N_NIMCALL(void, Marker_tyRef__tPE9ckDbaXj82MdUy0JgA7w)(void* p, NI op) {
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* a;
	NI T1_;
	NI T2_;
	NI T3_;
	a = (tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*)p;
	T1_ = (NI)0;
	for (T1_ = 0; T1_ < 512; T1_++) {
	nimGCvisit((void*)(*a).keys[T1_], op);
	}
	switch ((*a).isInternal) {
	case NIM_FALSE:
	T2_ = (NI)0;
	for (T2_ = 0; T2_ < 512; T2_++) {
	nimGCvisit((void*)(*a)._isInternal_1.vals[T2_], op);
	}
	break;
	case NIM_TRUE:
	T3_ = (NI)0;
	for (T3_ = 0; T3_ < 512; T3_++) {
	nimGCvisit((void*)(*a)._isInternal_2.links[T3_], op);
	}
	break;
	} 
}
static N_INLINE(void, unsureAsgnRef)(void** dest, void* src) {
	(*dest) = src;
}
N_LIB_PRIVATE N_NIMCALL(void, initBTree__k5whnwDpZp6YeM19cX9ajL9aQ)(tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg* Result) {
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* T1_;
	unsureAsgnRef((void**)&(*Result).root, NIM_NIL);
	(*Result).entries = 0;
	T1_ = (tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*)0;
	T1_ = (tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*) newObj((&NTI__tPE9ckDbaXj82MdUy0JgA7w_), sizeof(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g));
	(*T1_).entries = ((NI) 0);
	(*T1_).isInternal = NIM_FALSE;
	(*Result).root = T1_;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, contains__R2s6PEbDP9biCUJnpsKoeYw)(tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg b, NimStringDesc* key) {
	NIM_BOOL result;
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* x;
{	result = (NIM_BOOL)0;
	x = b.root;
	{
		while (1) {
			if (!(*x).isInternal) goto LA2;
			{
				NI j;
				NI i;
				j = (NI)0;
				i = ((NI) 0);
				{
					while (1) {
						if (!(i < (*x).entries)) goto LA5;
						j = i;
						{
							NIM_BOOL T8_;
							NI T10_;
							T8_ = (NIM_BOOL)0;
							T8_ = ((NI)(j + ((NI) 1)) == (*x).entries);
							if (T8_) goto LA9_;
							T10_ = (NI)0;
							T10_ = cmp__NAicU5bAGXmkx2NJujGi7g(key, (*x).keys[((NI)(j + ((NI) 1)))- 0]);
							T8_ = (T10_ < ((NI) 0));
							LA9_: ;
							if (!T8_) goto LA11_;
							x = (*x)._isInternal_2.links[(j)- 0];
							goto LA3;
						}
						LA11_: ;
						i += ((NI) 1);
					} LA5: ;
				}
			} LA3: ;
		} LA2: ;
	}
	{
		NI j_2;
		NI i_2;
		j_2 = (NI)0;
		i_2 = ((NI) 0);
		{
			while (1) {
				if (!(i_2 < (*x).entries)) goto LA15;
				j_2 = i_2;
				{
					NI T18_;
					T18_ = (NI)0;
					T18_ = cmp__NAicU5bAGXmkx2NJujGi7g(key, (*x).keys[(j_2)- 0]);
					if (!(T18_ == ((NI) 0))) goto LA19_;
					result = NIM_TRUE;
					goto BeforeRet_;
				}
				LA19_: ;
				i_2 += ((NI) 1);
			} LA15: ;
		}
	}
	result = NIM_FALSE;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, copyHalf__QHbavwJ9cIUJ59b9aC42MHBDg)(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* h, tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* result) {
	{
		NI j;
		NI i;
		j = (NI)0;
		i = ((NI) 0);
		{
			while (1) {
				if (!(i < ((NI) 256))) goto LA3;
				j = i;
				(*result).keys[(j)- 0] = copyString((*h).keys[((NI)(((NI) 256) + j))- 0]);
				i += ((NI) 1);
			} LA3: ;
		}
	}
	{
		if (!(*h).isInternal) goto LA6_;
		{
			NI j_2;
			NI i_2;
			j_2 = (NI)0;
			i_2 = ((NI) 0);
			{
				while (1) {
					if (!(i_2 < ((NI) 256))) goto LA10;
					j_2 = i_2;
					(*result)._isInternal_2.links[(j_2)- 0] = (*h)._isInternal_2.links[((NI)(((NI) 256) + j_2))- 0];
					i_2 += ((NI) 1);
				} LA10: ;
			}
		}
	}
	goto LA4_;
	LA6_: ;
	{
		{
			NI j_3;
			NI i_3;
			j_3 = (NI)0;
			i_3 = ((NI) 0);
			{
				while (1) {
					if (!(i_3 < ((NI) 256))) goto LA14;
					j_3 = i_3;
					(*result)._isInternal_1.vals[(j_3)- 0] = (*h)._isInternal_1.vals[((NI)(((NI) 256) + j_3))- 0];
					i_3 += ((NI) 1);
				} LA14: ;
			}
		}
	}
	LA4_: ;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*, split__yftxuAKQL15Q5Hq7NIaang)(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* h) {
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* result;
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*)0;
	T1_ = (tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*)0;
	T1_ = (tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*) newObj((&NTI__tPE9ckDbaXj82MdUy0JgA7w_), sizeof(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g));
	(*T1_).entries = ((NI) 256);
	(*T1_).isInternal = (*h).isInternal;
	result = T1_;
	(*h).entries = ((NI) 256);
	copyHalf__QHbavwJ9cIUJ59b9aC42MHBDg(h, result);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*, insert__J9bkvsuQNLcr7jeLPdOelGQ)(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* h, NimStringDesc* key, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* val) {
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* result;
	NimStringDesc* newKey;
	NI j;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*)0;
	newKey = copyString(key);
	j = ((NI) 0);
	{
		if (!!((*h).isInternal)) goto LA3_;
		{
			while (1) {
				if (!(j < (*h).entries)) goto LA6;
				{
					NI T9_;
					T9_ = (NI)0;
					T9_ = cmp__NAicU5bAGXmkx2NJujGi7g(key, (*h).keys[(j)- 0]);
					if (!(T9_ == ((NI) 0))) goto LA10_;
					(*h)._isInternal_1.vals[(j)- 0] = val;
					goto BeforeRet_;
				}
				LA10_: ;
				{
					NI T14_;
					T14_ = (NI)0;
					T14_ = cmp__NAicU5bAGXmkx2NJujGi7g(key, (*h).keys[(j)- 0]);
					if (!(T14_ < ((NI) 0))) goto LA15_;
					goto LA5;
				}
				LA15_: ;
				j += ((NI) 1);
			} LA6: ;
		} LA5: ;
		{
			NI i;
			NI colontmp_;
			NI res;
			i = (NI)0;
			colontmp_ = (NI)0;
			colontmp_ = (NI)(j + ((NI) 1));
			res = (*h).entries;
			{
				while (1) {
					if (!(colontmp_ <= res)) goto LA19;
					i = res;
					(*h)._isInternal_1.vals[(i)- 0] = (*h)._isInternal_1.vals[((NI)(i - ((NI) 1)))- 0];
					res -= ((NI) 1);
				} LA19: ;
			}
		}
		(*h)._isInternal_1.vals[(j)- 0] = val;
	}
	goto LA1_;
	LA3_: ;
	{
		tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* newLink;
		newLink = NIM_NIL;
		{
			while (1) {
				if (!(j < (*h).entries)) goto LA22;
				{
					NIM_BOOL T25_;
					NI T27_;
					tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* u;
					T25_ = (NIM_BOOL)0;
					T25_ = ((NI)(j + ((NI) 1)) == (*h).entries);
					if (T25_) goto LA26_;
					T27_ = (NI)0;
					T27_ = cmp__NAicU5bAGXmkx2NJujGi7g(key, (*h).keys[((NI)(j + ((NI) 1)))- 0]);
					T25_ = (T27_ < ((NI) 0));
					LA26_: ;
					if (!T25_) goto LA28_;
					u = insert__J9bkvsuQNLcr7jeLPdOelGQ((*h)._isInternal_2.links[(j)- 0], key, val);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					j += ((NI) 1);
					{
						if (!(u == NIM_NIL)) goto LA32_;
						result = NIM_NIL;
						goto BeforeRet_;
					}
					LA32_: ;
					newKey = copyString((*u).keys[(((NI) 0))- 0]);
					newLink = u;
					goto LA21;
				}
				LA28_: ;
				j += ((NI) 1);
			} LA22: ;
		} LA21: ;
		{
			NI i_2;
			NI colontmp__2;
			NI res_2;
			i_2 = (NI)0;
			colontmp__2 = (NI)0;
			colontmp__2 = (NI)(j + ((NI) 1));
			res_2 = (*h).entries;
			{
				while (1) {
					if (!(colontmp__2 <= res_2)) goto LA36;
					i_2 = res_2;
					(*h)._isInternal_2.links[(i_2)- 0] = (*h)._isInternal_2.links[((NI)(i_2 - ((NI) 1)))- 0];
					res_2 -= ((NI) 1);
				} LA36: ;
			}
		}
		(*h)._isInternal_2.links[(j)- 0] = newLink;
	}
	LA1_: ;
	{
		NI i_3;
		NI colontmp__3;
		NI res_3;
		i_3 = (NI)0;
		colontmp__3 = (NI)0;
		colontmp__3 = (NI)(j + ((NI) 1));
		res_3 = (*h).entries;
		{
			while (1) {
				if (!(colontmp__3 <= res_3)) goto LA39;
				i_3 = res_3;
				(*h).keys[(i_3)- 0] = copyString((*h).keys[((NI)(i_3 - ((NI) 1)))- 0]);
				res_3 -= ((NI) 1);
			} LA39: ;
		}
	}
	(*h).keys[(j)- 0] = copyString(newKey);
	(*h).entries += ((NI) 1);
	{
		if (!((*h).entries < ((NI) 512))) goto LA42_;
		result = NIM_NIL;
	}
	goto LA40_;
	LA42_: ;
	{
		result = split__yftxuAKQL15Q5Hq7NIaang(h);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA40_: ;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, add__oXWfa5DZ9ar9aQWG8k6z5P6Q)(tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg* b, NimStringDesc* key, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* val) {
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* u;
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* t;
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* T5_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	u = insert__J9bkvsuQNLcr7jeLPdOelGQ((*b).root, key, val);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(*b).entries += ((NI) 1);
	{
		if (!(u == NIM_NIL)) goto LA3_;
		goto BeforeRet_;
	}
	LA3_: ;
	T5_ = (tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*)0;
	T5_ = (tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*) newObj((&NTI__tPE9ckDbaXj82MdUy0JgA7w_), sizeof(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g));
	(*T5_).entries = ((NI) 2);
	(*T5_).isInternal = NIM_TRUE;
	t = T5_;
	(*t).keys[(((NI) 0))- 0] = copyString((*(*b).root).keys[(((NI) 0))- 0]);
	(*t)._isInternal_2.links[(((NI) 0))- 0] = (*b).root;
	(*t).keys[(((NI) 1))- 0] = copyString((*u).keys[(((NI) 0))- 0]);
	(*t)._isInternal_2.links[(((NI) 1))- 0] = u;
	(*b).root = t;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, getOrDefault__N7mBvvE4jWcEmzBA3UoB0A)(tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg b, NimStringDesc* key) {
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* result;
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* x;
{	result = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	x = b.root;
	{
		while (1) {
			if (!(*x).isInternal) goto LA2;
			{
				NI j;
				NI i;
				j = (NI)0;
				i = ((NI) 0);
				{
					while (1) {
						if (!(i < (*x).entries)) goto LA5;
						j = i;
						{
							NIM_BOOL T8_;
							NI T10_;
							T8_ = (NIM_BOOL)0;
							T8_ = ((NI)(j + ((NI) 1)) == (*x).entries);
							if (T8_) goto LA9_;
							T10_ = (NI)0;
							T10_ = cmp__NAicU5bAGXmkx2NJujGi7g(key, (*x).keys[((NI)(j + ((NI) 1)))- 0]);
							T8_ = (T10_ < ((NI) 0));
							LA9_: ;
							if (!T8_) goto LA11_;
							x = (*x)._isInternal_2.links[(j)- 0];
							goto LA3;
						}
						LA11_: ;
						i += ((NI) 1);
					} LA5: ;
				}
			} LA3: ;
		} LA2: ;
	}
	{
		NI j_2;
		NI i_2;
		j_2 = (NI)0;
		i_2 = ((NI) 0);
		{
			while (1) {
				if (!(i_2 < (*x).entries)) goto LA15;
				j_2 = i_2;
				{
					NI T18_;
					T18_ = (NI)0;
					T18_ = cmp__NAicU5bAGXmkx2NJujGi7g(key, (*x).keys[(j_2)- 0]);
					if (!(T18_ == ((NI) 0))) goto LA19_;
					result = (*x)._isInternal_1.vals[(j_2)- 0];
					goto BeforeRet_;
				}
				LA19_: ;
				i_2 += ((NI) 1);
			} LA15: ;
		}
	}
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasNext__4Wt9aVmAb9agcjxA5gGDTJQw)(tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg b, NI index) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = (index < b.entries);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, countSubTree__9bmJBiJZIhY26taaMZrwXcw)(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* it) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	{
		if (!(*it).isInternal) goto LA3_;
		result = ((NI) 0);
		{
			NI k;
			NI i;
			k = (NI)0;
			i = ((NI) 0);
			{
				while (1) {
					NI T8_;
					if (!(i < (*it).entries)) goto LA7;
					k = i;
					T8_ = (NI)0;
					T8_ = countSubTree__9bmJBiJZIhY26taaMZrwXcw((*it)._isInternal_2.links[(k)- 0]);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					result += T8_;
					i += ((NI) 1);
				} LA7: ;
			}
		}
	}
	goto LA1_;
	LA3_: ;
	{
		result = (*it).entries;
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, next__CqTK9bD6dhLiHbJZ5GMdxDQ)(tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg b, NI index, tyTuple__9aIi6GdTSD27YtPkWxMqNxA* Result) {
	tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g* it;
	NI i;
	NimStringDesc* colontmp_;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* colontmp__2;
	NI colontmp__3;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	it = b.root;
	i = index;
	{
		while (1) {
			NI sum;
			if (!(*it).isInternal) goto LA2;
			sum = ((NI) 0);
			{
				NI k;
				NI i_2;
				k = (NI)0;
				i_2 = ((NI) 0);
				{
					while (1) {
						NI c;
						if (!(i_2 < (*it).entries)) goto LA5;
						k = i_2;
						c = countSubTree__9bmJBiJZIhY26taaMZrwXcw((*it)._isInternal_2.links[(k)- 0]);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
						sum += c;
						{
							if (!(i < sum)) goto LA8_;
							it = (*it)._isInternal_2.links[(k)- 0];
							i -= (NI)(sum - c);
							goto LA3;
						}
						LA8_: ;
						i_2 += ((NI) 1);
					} LA5: ;
				}
			} LA3: ;
		} LA2: ;
	}
	colontmp_ = copyString((*it).keys[(i)- 0]);
	colontmp__2 = (*it)._isInternal_1.vals[(i)- 0];
	colontmp__3 = (NI)(index + ((NI) 1));
	(*Result).Field0 = copyString(colontmp_);
	(*Result).Field1 = colontmp__2;
	(*Result).Field2 = colontmp__3;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, compiler_btreesDatInit000)(void) {

/* section: NIM_merge_TYPE_INIT1 */
static TNimNode* TM__XwGTJ9cLNTC3OG1qQV0hHqQ_2_2[2];
static TNimNode* TM__XwGTJ9cLNTC3OG1qQV0hHqQ_3_3[3];
static TNimNode TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[9];

/* section: NIM_merge_TYPE_INIT3 */
NTI__VZdzO0Tlflp7WMN4gS8oPg_.size = sizeof(tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg);
NTI__VZdzO0Tlflp7WMN4gS8oPg_.align = NIM_ALIGNOF(tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg);
NTI__VZdzO0Tlflp7WMN4gS8oPg_.kind = 18;
NTI__VZdzO0Tlflp7WMN4gS8oPg_.base = 0;
NTI__VZdzO0Tlflp7WMN4gS8oPg_.flags = 2;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_2_2[0] = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[1];
NTI__dNELmBSmY7nthjhZupWO6g_.size = sizeof(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g);
NTI__dNELmBSmY7nthjhZupWO6g_.align = NIM_ALIGNOF(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g);
NTI__dNELmBSmY7nthjhZupWO6g_.kind = 18;
NTI__dNELmBSmY7nthjhZupWO6g_.base = 0;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_3_3[0] = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[3];
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[3].kind = 1;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[3].offset = offsetof(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g, entries);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[3].typ = (&NTI__rR5Bzr1D5krxoo1NcNyeMA_);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[3].name = "entries";
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_3_3[1] = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[4];
NTI__9aijZrM1syqzleJpcL8bUyw_.size = sizeof(tyArray__9aijZrM1syqzleJpcL8bUyw);
NTI__9aijZrM1syqzleJpcL8bUyw_.align = NIM_ALIGNOF(tyArray__9aijZrM1syqzleJpcL8bUyw);
NTI__9aijZrM1syqzleJpcL8bUyw_.kind = 16;
NTI__9aijZrM1syqzleJpcL8bUyw_.base = (&NTI__77mFvmsOLKik79ci2hXkHEg_);
NTI__9aijZrM1syqzleJpcL8bUyw_.flags = 2;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[4].kind = 1;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[4].offset = offsetof(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g, keys);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[4].typ = (&NTI__9aijZrM1syqzleJpcL8bUyw_);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[4].name = "keys";
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_3_3[2] = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[5];
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[5].kind = 3;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[5].offset = offsetof(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g, isInternal);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[5].typ = (&NTI__VaVACK0bpYmqIQ0mKcHfQQ_);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[5].name = "isInternal";
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[5].sons = &NimDT___dNELmBSmY7nthjhZupWO6g_isInternal[0];
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[5].len = 2;
NTI__VznXOmL540VWlOp56dB9cqA_.size = sizeof(tyArray__VznXOmL540VWlOp56dB9cqA);
NTI__VznXOmL540VWlOp56dB9cqA_.align = NIM_ALIGNOF(tyArray__VznXOmL540VWlOp56dB9cqA);
NTI__VznXOmL540VWlOp56dB9cqA_.kind = 16;
NTI__VznXOmL540VWlOp56dB9cqA_.base = (&NTI__fKfcLzXYiz5jNu3NH3Tv8Q_);
NTI__VznXOmL540VWlOp56dB9cqA_.flags = 2;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[6].kind = 1;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[6].offset = offsetof(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g, _isInternal_1.vals);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[6].typ = (&NTI__VznXOmL540VWlOp56dB9cqA_);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[6].name = "vals";
NimDT___dNELmBSmY7nthjhZupWO6g_isInternal[0] = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[6];
NTI__jSFVQ48g222vuMjoJArs8A_.size = sizeof(tyArray__jSFVQ48g222vuMjoJArs8A);
NTI__jSFVQ48g222vuMjoJArs8A_.align = NIM_ALIGNOF(tyArray__jSFVQ48g222vuMjoJArs8A);
NTI__jSFVQ48g222vuMjoJArs8A_.kind = 16;
NTI__jSFVQ48g222vuMjoJArs8A_.base = (&NTI__tPE9ckDbaXj82MdUy0JgA7w_);
NTI__jSFVQ48g222vuMjoJArs8A_.flags = 2;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[7].kind = 1;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[7].offset = offsetof(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g, _isInternal_2.links);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[7].typ = (&NTI__jSFVQ48g222vuMjoJArs8A_);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[7].name = "links";
NimDT___dNELmBSmY7nthjhZupWO6g_isInternal[1] = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[7];
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[2].len = 3; TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[2].kind = 2; TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[2].sons = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_3_3[0];
NTI__dNELmBSmY7nthjhZupWO6g_.node = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[2];
NTI__tPE9ckDbaXj82MdUy0JgA7w_.size = sizeof(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*);
NTI__tPE9ckDbaXj82MdUy0JgA7w_.align = NIM_ALIGNOF(tyObject_NodecolonObjectType___dNELmBSmY7nthjhZupWO6g*);
NTI__tPE9ckDbaXj82MdUy0JgA7w_.kind = 22;
NTI__tPE9ckDbaXj82MdUy0JgA7w_.base = (&NTI__dNELmBSmY7nthjhZupWO6g_);
NTI__tPE9ckDbaXj82MdUy0JgA7w_.marker = Marker_tyRef__tPE9ckDbaXj82MdUy0JgA7w;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[1].kind = 1;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[1].offset = offsetof(tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg, root);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[1].typ = (&NTI__tPE9ckDbaXj82MdUy0JgA7w_);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[1].name = "root";
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_2_2[1] = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[8];
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[8].kind = 1;
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[8].offset = offsetof(tyObject_BTree__VZdzO0Tlflp7WMN4gS8oPg, entries);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[8].typ = (&NTI__rR5Bzr1D5krxoo1NcNyeMA_);
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[8].name = "entries";
TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[0].len = 2; TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[0].kind = 2; TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[0].sons = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_2_2[0];
NTI__VZdzO0Tlflp7WMN4gS8oPg_.node = &TM__XwGTJ9cLNTC3OG1qQV0hHqQ_0[0];
}

