/* Generated by Nim Compiler v1.6.10 */
#define NIM_INTBITS 64

#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
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ;
typedef struct tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag;
typedef struct tySequence__pNGz13plgW87QS7OArclaQ tySequence__pNGz13plgW87QS7OArclaQ;
typedef struct TGenericSeq TGenericSeq;
typedef struct NimStringDesc NimStringDesc;
typedef struct tyObject_TSym__nnJKJFyjDGi5mnv8jwfTGQ tyObject_TSym__nnJKJFyjDGi5mnv8jwfTGQ;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
struct tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ {
tySequence__pNGz13plgW87QS7OArclaQ* data;
};
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag {
NI dist;
NI depth;
NimStringDesc* msg;
tyObject_TSym__nnJKJFyjDGi5mnv8jwfTGQ* sym;
};
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;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SPr7N6UKfuF549bNPiUvSRw[256];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SPr7N6UKfuF549bNPiUvSRw freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
NI gcThreadId;
};
struct tySequence__pNGz13plgW87QS7OArclaQ {
  TGenericSeq Sup;
  tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag data[SEQ_DECL_SIZE];
};
N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_LIB_PRIVATE N_NIMCALL(TGenericSeq*, incrSeqV3)(TGenericSeq* s, TNimType* typ);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(void, decRef__system_5324)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, minuspercent___system_716)(NI x, NI y);
static N_INLINE(NIM_BOOL, ltpercent___system_1005)(NI x, NI y);
static N_INLINE(void, rtlAddZCT__system_5322)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__system_5273)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__system_5279)(void* usr);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incRef__system_5317)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, pluspercent___system_696)(NI x, NI y);
N_LIB_PRIVATE N_NIMCALL(void, siftup__lookups_1011)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ* heap, NI startpos, NI p);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
static N_INLINE(tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag*, X5BX5D___lookups_1018)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ* heap, NI i);
static N_INLINE(NIM_BOOL, heapCmp__lookups_1044)(tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* x, tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* y);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, lt___lookups_943)(tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* a, tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* b);
static N_INLINE(NI, len__lookups_1003)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ heap);
static N_INLINE(void, pop__lookups_1086)(tySequence__pNGz13plgW87QS7OArclaQ** s, tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* Result);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_LIB_PRIVATE N_NIMCALL(TGenericSeq*, setLengthSeqV2)(TGenericSeq* s, TNimType* typ, NI newLen);
N_LIB_PRIVATE N_NIMCALL(void, siftdownToBottom__lookups_1113)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ* heap, NI p);
extern TNimType NTIseqLspellcandidateT__pNGz13plgW87QS7OArclaQ_;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__system_5226;
N_LIB_PRIVATE N_NIMCALL(void, initHeapQueue__lookups_976)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ* Result) {
	unsureAsgnRef((void**)&(*Result).data, NIM_NIL);
}
static N_INLINE(NI, minuspercent___system_716)(NI x, NI y) {
	NI result;
	result = (NI)0;
	result = ((NI) ((NU)((NU64)(((NU) (x))) - (NU64)(((NU) (y))))));
	return result;
}
static N_INLINE(NIM_BOOL, ltpercent___system_1005)(NI x, NI y) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = ((NU64)(((NU) (x))) < (NU64)(((NU) (y))));
	return result;
}
static N_INLINE(void, rtlAddZCT__system_5322)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	addZCT__system_5273((&gch__system_5226.zct), c);
}
static N_INLINE(void, decRef__system_5324)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = minuspercent___system_716((*c).refcount, ((NI) 8));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = ltpercent___system_1005((*c).refcount, ((NI) 8));
		if (!T3_) goto LA4_;
		rtlAddZCT__system_5322(c);
	}
	LA4_: ;
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__system_5279)(void* usr) {
	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
	NI T1_;
	result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
	T1_ = (NI)0;
	T1_ = minuspercent___system_716(((NI) (ptrdiff_t) (usr)), ((NI) 16));
	result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) (T1_));
	return result;
}
static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T1_;
	T1_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
	T1_ = usrToCell__system_5279(p);
	decRef__system_5324(T1_);
}
static N_INLINE(NI, pluspercent___system_696)(NI x, NI y) {
	NI result;
	result = (NI)0;
	result = ((NI) ((NU)((NU64)(((NU) (x))) + (NU64)(((NU) (y))))));
	return result;
}
static N_INLINE(void, incRef__system_5317)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = pluspercent___system_696((*c).refcount, ((NI) 8));
}
static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T5_;
		if (!!((src == NIM_NIL))) goto LA3_;
		T5_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
		T5_ = usrToCell__system_5279(src);
		incRef__system_5317(T5_);
	}
	LA3_: ;
	{
		tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T10_;
		if (!!(((*dest) == NIM_NIL))) goto LA8_;
		T10_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
		T10_ = usrToCell__system_5279((*dest));
		decRef__system_5324(T10_);
	}
	LA8_: ;
	(*dest) = src;
}
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
	nimSetMem__systemZmemory_7(p, ((int) 0), size);
}
static N_INLINE(tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag*, X5BX5D___lookups_1018)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ* heap, NI i) {
	tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* result;
	result = (tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag*)0;
	result = (&(*heap).data->data[i]);
	return result;
}
static N_INLINE(NIM_BOOL, heapCmp__lookups_1044)(tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* x, tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* y) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = lt___lookups_943(x, y);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, siftup__lookups_1011)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ* heap, NI startpos, NI p) {
	NI pos;
	tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag newitem;
	tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* T1_;
	NimStringDesc* T12_;
	pos = p;
	nimZeroMem((void*)(&newitem), sizeof(tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag));
	T1_ = (tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag*)0;
	T1_ = X5BX5D___lookups_1018((&(*heap)), ((NI) (pos)));
	newitem.dist = (*T1_).dist;
	newitem.depth = (*T1_).depth;
	newitem.msg = (*T1_).msg;
	newitem.sym = (*T1_).sym;
	{
		while (1) {
			NI parentpos;
			tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag parent;
			tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* T4_;
			if (!(startpos < pos)) goto LA3;
			parentpos = (NI)((NI64)((NI)(pos - ((NI) 1))) >> (NU64)(((NI) 1)));
			nimZeroMem((void*)(&parent), sizeof(tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag));
			T4_ = (tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag*)0;
			T4_ = X5BX5D___lookups_1018((&(*heap)), ((NI) (parentpos)));
			parent.dist = (*T4_).dist;
			parent.depth = (*T4_).depth;
			parent.msg = (*T4_).msg;
			parent.sym = (*T4_).sym;
			{
				NIM_BOOL T7_;
				NimStringDesc* T10_;
				T7_ = (NIM_BOOL)0;
				T7_ = heapCmp__lookups_1044((&newitem), (&parent));
				if (!T7_) goto LA8_;
				(*heap).data->data[pos].dist = parent.dist;
				(*heap).data->data[pos].depth = parent.depth;
				T10_ = NIM_NIL;
				T10_ = (*heap).data->data[pos].msg; (*heap).data->data[pos].msg = copyStringRC1(parent.msg);
				if (T10_) nimGCunrefNoCycle(T10_);
				asgnRef((void**) (&(*heap).data->data[pos].sym), parent.sym);
				pos = parentpos;
			}
			goto LA5_;
			LA8_: ;
			{
				goto LA2;
			}
			LA5_: ;
		} LA3: ;
	} LA2: ;
	(*heap).data->data[pos].dist = newitem.dist;
	(*heap).data->data[pos].depth = newitem.depth;
	T12_ = NIM_NIL;
	T12_ = (*heap).data->data[pos].msg; (*heap).data->data[pos].msg = copyStringRC1(newitem.msg);
	if (T12_) nimGCunrefNoCycle(T12_);
	asgnRef((void**) (&(*heap).data->data[pos].sym), newitem.sym);
}
static N_INLINE(NI, len__lookups_1003)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ heap) {
	NI result;
	NI T1_;
	result = (NI)0;
	T1_ = (heap.data ? heap.data->Sup.len : 0);
	result = T1_;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, push__lookups_989)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ* heap, tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* item) {
	NI T1_;
	NimStringDesc* T2_;
	NI T3_;
	unsureAsgnRef((void**) (&(*heap).data), (tySequence__pNGz13plgW87QS7OArclaQ*) incrSeqV3((TGenericSeq*)((*heap).data), (&NTIseqLspellcandidateT__pNGz13plgW87QS7OArclaQ_)));
	T1_ = (*heap).data->Sup.len++;
	(*heap).data->data[T1_].dist = (*item).dist;
	(*heap).data->data[T1_].depth = (*item).depth;
	T2_ = NIM_NIL;
	T2_ = (*heap).data->data[T1_].msg; (*heap).data->data[T1_].msg = copyStringRC1((*item).msg);
	if (T2_) nimGCunrefNoCycle(T2_);
	asgnRef((void**) (&(*heap).data->data[T1_].sym), (*item).sym);
	T3_ = (NI)0;
	T3_ = len__lookups_1003((*heap));
	siftup__lookups_1011(heap, ((NI) 0), (NI)(T3_ - ((NI) 1)));
}
static N_INLINE(void, pop__lookups_1086)(tySequence__pNGz13plgW87QS7OArclaQ** s, tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* Result) {
	NI L;
	NI T1_;
	T1_ = ((*s) ? (*s)->Sup.len : 0);
	L = (NI)(T1_ - ((NI) 1));
	(*Result).dist = (*s)->data[L].dist;
	(*Result).depth = (*s)->data[L].depth;
	unsureAsgnRef((void**) (&(*Result).msg), copyString((*s)->data[L].msg));
	unsureAsgnRef((void**) (&(*Result).sym), (*s)->data[L].sym);
	unsureAsgnRef((void**) (&(*s)), (tySequence__pNGz13plgW87QS7OArclaQ*) setLengthSeqV2(&((*s))->Sup, (&NTIseqLspellcandidateT__pNGz13plgW87QS7OArclaQ_), ((NI) (L))));
}
N_LIB_PRIVATE N_NIMCALL(void, siftdownToBottom__lookups_1113)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ* heap, NI p) {
	NI endpos;
	NI pos;
	NI startpos;
	tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag newitem;
	tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* T1_;
	NI childpos;
	NimStringDesc* T15_;
	endpos = len__lookups_1003((*heap));
	pos = p;
	startpos = pos;
	nimZeroMem((void*)(&newitem), sizeof(tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag));
	T1_ = (tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag*)0;
	T1_ = X5BX5D___lookups_1018((&(*heap)), ((NI) (pos)));
	newitem.dist = (*T1_).dist;
	newitem.depth = (*T1_).depth;
	newitem.msg = (*T1_).msg;
	newitem.sym = (*T1_).sym;
	childpos = (NI)((NI)(((NI) 2) * pos) + ((NI) 1));
	{
		while (1) {
			NI rightpos;
			tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* T13_;
			NimStringDesc* T14_;
			if (!(childpos < endpos)) goto LA3;
			rightpos = (NI)(childpos + ((NI) 1));
			{
				NIM_BOOL T6_;
				tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* T8_;
				tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* T9_;
				NIM_BOOL T10_;
				T6_ = (NIM_BOOL)0;
				T6_ = (rightpos < endpos);
				if (!(T6_)) goto LA7_;
				T8_ = (tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag*)0;
				T8_ = X5BX5D___lookups_1018((&(*heap)), ((NI) (childpos)));
				T9_ = (tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag*)0;
				T9_ = X5BX5D___lookups_1018((&(*heap)), ((NI) (rightpos)));
				T10_ = (NIM_BOOL)0;
				T10_ = heapCmp__lookups_1044((&(*T8_)), (&(*T9_)));
				T6_ = !(T10_);
				LA7_: ;
				if (!T6_) goto LA11_;
				childpos = rightpos;
			}
			LA11_: ;
			T13_ = (tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag*)0;
			T13_ = X5BX5D___lookups_1018((&(*heap)), ((NI) (childpos)));
			(*heap).data->data[pos].dist = (*T13_).dist;
			(*heap).data->data[pos].depth = (*T13_).depth;
			T14_ = NIM_NIL;
			T14_ = (*heap).data->data[pos].msg; (*heap).data->data[pos].msg = copyStringRC1((*T13_).msg);
			if (T14_) nimGCunrefNoCycle(T14_);
			asgnRef((void**) (&(*heap).data->data[pos].sym), (*T13_).sym);
			pos = childpos;
			childpos = (NI)((NI)(((NI) 2) * pos) + ((NI) 1));
		} LA3: ;
	}
	(*heap).data->data[pos].dist = newitem.dist;
	(*heap).data->data[pos].depth = newitem.depth;
	T15_ = NIM_NIL;
	T15_ = (*heap).data->data[pos].msg; (*heap).data->data[pos].msg = copyStringRC1(newitem.msg);
	if (T15_) nimGCunrefNoCycle(T15_);
	asgnRef((void**) (&(*heap).data->data[pos].sym), newitem.sym);
	siftup__lookups_1011(heap, startpos, pos);
}
N_LIB_PRIVATE N_NIMCALL(void, pop__lookups_1082)(tyObject_HeapQueue__jrns9a9aABAIa8S75WdNI8TQ* heap, tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* Result) {
	tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag lastelt;
	nimZeroMem((void*)(&lastelt), sizeof(tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag));
	pop__lookups_1086((&(*heap).data), (&lastelt));
	{
		NI T3_;
		tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag* T6_;
		NimStringDesc* T7_;
		T3_ = (NI)0;
		T3_ = len__lookups_1003((*heap));
		if (!(((NI) 0) < T3_)) goto LA4_;
		T6_ = (tyObject_SpellCandidate__g8qH9a0Kwtue9aTwa9aUk3rag*)0;
		T6_ = X5BX5D___lookups_1018((&(*heap)), ((NI) 0));
		(*Result).dist = (*T6_).dist;
		(*Result).depth = (*T6_).depth;
		unsureAsgnRef((void**) (&(*Result).msg), copyString((*T6_).msg));
		unsureAsgnRef((void**) (&(*Result).sym), (*T6_).sym);
		(*heap).data->data[((NI) 0)].dist = lastelt.dist;
		(*heap).data->data[((NI) 0)].depth = lastelt.depth;
		T7_ = NIM_NIL;
		T7_ = (*heap).data->data[((NI) 0)].msg; (*heap).data->data[((NI) 0)].msg = copyStringRC1(lastelt.msg);
		if (T7_) nimGCunrefNoCycle(T7_);
		asgnRef((void**) (&(*heap).data->data[((NI) 0)].sym), lastelt.sym);
		siftdownToBottom__lookups_1113(heap, ((NI) 0));
	}
	goto LA1_;
	LA4_: ;
	{
		(*Result).dist = lastelt.dist;
		(*Result).depth = lastelt.depth;
		unsureAsgnRef((void**) (&(*Result).msg), copyString(lastelt.msg));
		unsureAsgnRef((void**) (&(*Result).sym), lastelt.sym);
	}
	LA1_: ;
}
