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

#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
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct tyObject_SinglyLinkedList__lIApKraPVkRHGxPCxT2AGA tyObject_SinglyLinkedList__lIApKraPVkRHGxPCxT2AGA;
typedef struct tyTuple__msoRFpgv3EcbLwCh9arSpYw tyTuple__msoRFpgv3EcbLwCh9arSpYw;
typedef struct tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct TNimType TNimType;
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;
typedef struct TNimNode TNimNode;
typedef NU8 tyEnum_FootnoteType__ZCau9bAoJ0KvZYqUKBf6DQA;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct tyTuple__msoRFpgv3EcbLwCh9arSpYw {
tyEnum_FootnoteType__ZCau9bAoJ0KvZYqUKBf6DQA Field0;
NI Field1;
NI Field2;
NI Field3;
NimStringDesc* Field4;
};
struct tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q {
tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q* next;
tyTuple__msoRFpgv3EcbLwCh9arSpYw value;
};
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 tyObject_SinglyLinkedList__lIApKraPVkRHGxPCxT2AGA {
tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q* head;
tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q* tail;
};
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;
};
N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
static N_INLINE(void, add__packagesZdocutilsZrst_2877)(tyObject_SinglyLinkedList__lIApKraPVkRHGxPCxT2AGA* L, tyTuple__msoRFpgv3EcbLwCh9arSpYw* value);
static N_INLINE(void, add__packagesZdocutilsZrst_2966)(tyObject_SinglyLinkedList__lIApKraPVkRHGxPCxT2AGA* L, tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q* n);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incRef__system_5309)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, pluspercent___system_696)(NI x, NI y);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__system_5271)(void* usr);
static N_INLINE(NI, minuspercent___system_716)(NI x, NI y);
static N_INLINE(void, decRef__system_5316)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NIM_BOOL, ltpercent___system_1005)(NI x, NI y);
static N_INLINE(void, rtlAddZCT__system_5314)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__system_5265)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NIMCALL(tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q*, newSinglyLinkedNode__packagesZdocutilsZrst_2885)(tyTuple__msoRFpgv3EcbLwCh9arSpYw* value);
N_LIB_PRIVATE N_NOINLINE(void*, newObj)(TNimType* typ, NI size);
N_LIB_PRIVATE N_NIMCALL(void, genericAssign)(void* dest, void* src, TNimType* mt);
extern TNimType NTIsinglylinkednode__KYNyCmO27XWAAJ4AB4n9aQQ_;
extern TNimType NTIfootnotesubst__msoRFpgv3EcbLwCh9arSpYw_;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__system_5218;
N_LIB_PRIVATE N_NIMCALL(void, initSinglyLinkedList__packagesZdocutilsZrst_2775)(tyObject_SinglyLinkedList__lIApKraPVkRHGxPCxT2AGA* Result) {
	unsureAsgnRef((void**)&(*Result).head, NIM_NIL);
	unsureAsgnRef((void**)&(*Result).tail, NIM_NIL);
}
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_5309)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	(*c).refcount = pluspercent___system_696((*c).refcount, ((NI) 8));
}
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(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__system_5271)(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(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_5314)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
	addZCT__system_5265((&gch__system_5218.zct), c);
}
static N_INLINE(void, decRef__system_5316)(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_5314(c);
	}
	LA4_: ;
}
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_5271(src);
		incRef__system_5309(T5_);
	}
	LA3_: ;
	{
		tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T10_;
		if (!!(((*dest) == NIM_NIL))) goto LA8_;
		T10_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
		T10_ = usrToCell__system_5271((*dest));
		decRef__system_5316(T10_);
	}
	LA8_: ;
	(*dest) = src;
}
static N_INLINE(void, add__packagesZdocutilsZrst_2966)(tyObject_SinglyLinkedList__lIApKraPVkRHGxPCxT2AGA* L, tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q* n) {
	asgnRef((void**) (&(*n).next), ((tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q*) NIM_NIL));
	{
		if (!!(((*L).tail == ((tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q*) NIM_NIL)))) goto LA3_;
		asgnRef((void**) (&(*(*L).tail).next), n);
	}
	LA3_: ;
	unsureAsgnRef((void**) (&(*L).tail), n);
	{
		if (!((*L).head == ((tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q*) NIM_NIL))) goto LA7_;
		unsureAsgnRef((void**) (&(*L).head), n);
	}
	LA7_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q*, newSinglyLinkedNode__packagesZdocutilsZrst_2885)(tyTuple__msoRFpgv3EcbLwCh9arSpYw* value) {
	tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q* result;
	result = NIM_NIL;
	result = (tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q*) newObj((&NTIsinglylinkednode__KYNyCmO27XWAAJ4AB4n9aQQ_), sizeof(tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q));
	genericAssign((void*)(&(*result).value), (void*)value, (&NTIfootnotesubst__msoRFpgv3EcbLwCh9arSpYw_));
	return result;
}
static N_INLINE(void, add__packagesZdocutilsZrst_2877)(tyObject_SinglyLinkedList__lIApKraPVkRHGxPCxT2AGA* L, tyTuple__msoRFpgv3EcbLwCh9arSpYw* value) {
	tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q* T1_;
	T1_ = NIM_NIL;
	T1_ = newSinglyLinkedNode__packagesZdocutilsZrst_2885(value);
	add__packagesZdocutilsZrst_2966(L, T1_);
}
N_LIB_PRIVATE N_NIMCALL(void, append__packagesZdocutilsZrst_2802)(tyObject_SinglyLinkedList__lIApKraPVkRHGxPCxT2AGA* a, tyTuple__msoRFpgv3EcbLwCh9arSpYw* b) {
	add__packagesZdocutilsZrst_2877(a, b);
}
N_LIB_PRIVATE N_NIMCALL(tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q*, newSinglyLinkedNode__packagesZdocutilsZrst_3378)(tyTuple__msoRFpgv3EcbLwCh9arSpYw* value) {
	tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q* result;
	result = NIM_NIL;
	result = (tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q*) newObj((&NTIsinglylinkednode__KYNyCmO27XWAAJ4AB4n9aQQ_), sizeof(tyObject_SinglyLinkedNodeObj__HiSLnJoU2zkTTpGXzg870Q));
	genericAssign((void*)(&(*result).value), (void*)value, (&NTIfootnotesubst__msoRFpgv3EcbLwCh9arSpYw_));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, append__packagesZdocutilsZrst_3447)(tyObject_SinglyLinkedList__lIApKraPVkRHGxPCxT2AGA* a, tyTuple__msoRFpgv3EcbLwCh9arSpYw* b) {
	add__packagesZdocutilsZrst_2877(a, b);
}
