/* 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"
#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

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

/* section: NIM_merge_FORWARD_TYPES */
typedef struct tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct RootObj RootObj;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tySequence__WwUFq9cJ2xKRlsAWVEHyPRg tySequence__WwUFq9cJ2xKRlsAWVEHyPRg;

/* section: NIM_merge_TYPES */
typedef tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* tyArray__USLYl0Lpkimm4FABiJ3ldA[4096];
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 RootObj {
TNimType* m_type;
};
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA {
  RootObj Sup;
tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* left;
tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* right;
NI L;
NimStringDesc* data;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);

/* section: NIM_merge_SEQ_TYPES */
struct tySequence__WwUFq9cJ2xKRlsAWVEHyPRg {
  TGenericSeq Sup;
  tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* 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__4hi0XQqK9aLiPuWT9acsXm9aQ)(void* p, NI op);
static N_NIMCALL(void, TM__Vw9cfUOQOae9b9bzZBlucMZQg_3)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
N_LIB_PRIVATE N_NIMCALL(NI, len__9b0YRltzV3kNSE9aQTsG82wg)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* a);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newLen);
N_LIB_PRIVATE N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
static N_INLINE(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, pop__9c4Y4hTtvRqjj2EC8KP9aqDAsystem)(tySequence__WwUFq9cJ2xKRlsAWVEHyPRg** s);
N_LIB_PRIVATE N_NIMCALL(TGenericSeq*, setLengthSeqV2)(TGenericSeq* s, TNimType* typ, NI newLen);
N_LIB_PRIVATE N_NIMCALL(TGenericSeq*, incrSeqV3)(TGenericSeq* s, TNimType* typ);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, runtimeFormat__9bvKdnhoYI2ta9agQNm3orMA)(NimStringDesc* frmt, tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA** args, NI argsLen_0);
N_LIB_PRIVATE N_NIMCALL(void, add__yG4AKzsBRS1W4MANDlXQeg)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA** a, NimStringDesc* b);
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, amp___Z7W1o5nPSc3ExfO5f7j1Gg)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* a, NimStringDesc* b);
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, amp___ShdZ6VrAQkY0nWR9a39b9bGdQ)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* a, tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* b);
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, newRope__dBdikNFB2Y7QJ9aVJE7dGHg)(NimStringDesc* data);
N_LIB_PRIVATE N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, rope__yShmEg9cffWxI7s5XzEKBow)(NimStringDesc* s);
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, insertInCache__yShmEg9cffWxI7s5XzEKBow_2)(NimStringDesc* s);
N_LIB_PRIVATE N_NIMCALL(NI, hash__6PCYkKlCNhq9cnRLnqWKkwQ)(NimStringDesc* x);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
static N_INLINE(NIM_BOOL, equalMem__9bGgqEk7RXXl6eqM9c1HdELAsystem)(void* a, void* b, NI size);
static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size);
N_LIB_PRIVATE N_NIMCALL(void, add__IM4kcMNkkOLJtqdEqSxR8A)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA** a, tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* b);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__2yh9cer0ymNRHlOOg8P7IuA)(NimStringDesc* s, NI first, NI last);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, nimInt64ToStr)(NI64 x);

/* section: NIM_merge_DATA */
extern TNimType NTI__ytyiCJqK439aF9cIibuRVpAg_;
N_LIB_PRIVATE TNimType NTI__OFzf0kSiPTcNreUIeJgWVA_;
extern TNimType NTI__rR5Bzr1D5krxoo1NcNyeMA_;
extern TNimType NTI__77mFvmsOLKik79ci2hXkHEg_;
N_LIB_PRIVATE TNimType NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_;
N_LIB_PRIVATE TNimType NTI__USLYl0Lpkimm4FABiJ3ldA_;
extern TNimType NTI__WwUFq9cJ2xKRlsAWVEHyPRg_;
STRING_LITERAL(TM__Vw9cfUOQOae9b9bzZBlucMZQg_4, "$", 1);
STRING_LITERAL(TM__Vw9cfUOQOae9b9bzZBlucMZQg_5, "ropes.nim(237, 20) `false` invalid format string: ", 50);
STRING_LITERAL(TM__Vw9cfUOQOae9b9bzZBlucMZQg_6, "ropes.nim(249, 20) `false` invalid format string: ", 50);
STRING_LITERAL(TM__Vw9cfUOQOae9b9bzZBlucMZQg_7, "ropes.nim(252, 20) `false` invalid format string: ", 50);
STRING_LITERAL(TM__Vw9cfUOQOae9b9bzZBlucMZQg_8, "\012", 1);
STRING_LITERAL(TM__Vw9cfUOQOae9b9bzZBlucMZQg_9, "ropes.nim(262, 18) `false` invalid format string: ", 50);
STRING_LITERAL(TM__Vw9cfUOQOae9b9bzZBlucMZQg_10, "[$1, $2, $3]", 12);

/* section: NIM_merge_VARS */
N_LIB_PRIVATE tyArray__USLYl0Lpkimm4FABiJ3ldA cache__WGMp5Wo1NlgbAMOysPIfmQ;
N_LIB_PRIVATE NI gCacheTries__5GfZTThHPBfB9bjRZdFluBw = ((NI) 0);
N_LIB_PRIVATE NI gCacheMisses__fLRm9am8S0daYBVNK6JKyBg = ((NI) 0);
N_LIB_PRIVATE NI gCacheIntTries__opyfsNv023Md1P05mqsDew = ((NI) 0);
extern NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;

/* section: NIM_merge_PROCS */
static N_NIMCALL(void, Marker_tyRef__4hi0XQqK9aLiPuWT9acsXm9aQ)(void* p, NI op) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* a;
	a = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)p;
	nimGCvisit((void*)(*a).left, op);
	nimGCvisit((void*)(*a).right, op);
	nimGCvisit((void*)(*a).data, op);
}
static N_NIMCALL(void, TM__Vw9cfUOQOae9b9bzZBlucMZQg_3)(void) {
	NI T1_;
	T1_ = (NI)0;
	for (T1_ = 0; T1_ < 4096; T1_++) {
	nimGCvisit((void*)cache__WGMp5Wo1NlgbAMOysPIfmQ[T1_], 0);
	}
}
N_LIB_PRIVATE N_NIMCALL(NI, len__9b0YRltzV3kNSE9aQTsG82wg)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* a) {
	NI result;
	result = (NI)0;
	{
		if (!(a == NIM_NIL)) goto LA3_;
		result = ((NI) 0);
	}
	goto LA1_;
	LA3_: ;
	{
		result = ((*a).L > 0? ((*a).L) : -((*a).L));
	}
	LA1_: ;
	return result;
}
static N_INLINE(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, pop__9c4Y4hTtvRqjj2EC8KP9aqDAsystem)(tySequence__WwUFq9cJ2xKRlsAWVEHyPRg** s) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* result;
	NI L;
	NI T1_;
	result = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	T1_ = ((*s) ? (*s)->Sup.len : 0);
	L = (NI)(T1_ - ((NI) 1));
	result = (*s)->data[L];
	(*s) = (tySequence__WwUFq9cJ2xKRlsAWVEHyPRg*) setLengthSeqV2(&((*s))->Sup, (&NTI__WwUFq9cJ2xKRlsAWVEHyPRg_), ((NI) (L)));
	return result;
}
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size) {
	nimCopyMem(dest, source, size);
}
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	{
		void* T5_;
		void* T6_;
		if (!!((src == NIM_NIL))) goto LA3_;
		T5_ = (void*)0;
		T5_ = ((void*) ((&(*dest).data[(*dest).Sup.len])));
		T6_ = (void*)0;
		T6_ = ((void*) ((*src).data));
		copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(T5_, T6_, ((NI) ((NI)((*src).Sup.len + ((NI) 1)))));
		(*dest).Sup.len += (*src).Sup.len;
	}
	LA3_: ;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___mZ66tEveFIQokq3arf8Klw)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* r) {
	NimStringDesc* result;
	NI T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NimStringDesc*)0;
	T1_ = (NI)0;
	T1_ = len__9b0YRltzV3kNSE9aQTsG82wg(r);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	result = mnewString(((NI) (T1_)));
	result = setLengthStr(result, ((NI) 0));
	{
		NimStringDesc* s;
		s = (NimStringDesc*)0;
		{
			tySequence__WwUFq9cJ2xKRlsAWVEHyPRg* stack;
			if (!!((r == NIM_NIL))) goto LA5_;
			stack = (tySequence__WwUFq9cJ2xKRlsAWVEHyPRg*) newSeq((&NTI__WwUFq9cJ2xKRlsAWVEHyPRg_), 1);
			stack->data[0] = r;
			{
				while (1) {
					NI T9_;
					tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* it;
					T9_ = (stack ? stack->Sup.len : 0);
					if (!(((NI) 0) < T9_)) goto LA8;
					it = pop__9c4Y4hTtvRqjj2EC8KP9aqDAsystem((&stack));
					{
						while (1) {
							NI T12_;
							if (!!(((*it).left == NIM_NIL))) goto LA11;
							stack = (tySequence__WwUFq9cJ2xKRlsAWVEHyPRg*) incrSeqV3((TGenericSeq*)(stack), (&NTI__WwUFq9cJ2xKRlsAWVEHyPRg_));
							T12_ = stack->Sup.len++;
							stack->data[T12_] = (*it).right;
							it = (*it).left;
						} LA11: ;
					}
					s = (*it).data;
					result = resizeString(result, (s ? s->Sup.len : 0) + 0);
appendString(result, s);
				} LA8: ;
			}
		}
		LA5_: ;
	}
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, newRope__dBdikNFB2Y7QJ9aVJE7dGHg)(NimStringDesc* data) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* result;
	result = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	result = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*) newObj((&NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_), sizeof(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA));
	(*result).Sup.m_type = (&NTI__OFzf0kSiPTcNreUIeJgWVA_);
	(*result).L = ((NI64)-((data ? data->Sup.len : 0)));
	(*result).data = copyString(data);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, amp___ShdZ6VrAQkY0nWR9a39b9bGdQ)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* a, tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* b) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	{
		if (!(a == NIM_NIL)) goto LA3_;
		result = b;
	}
	goto LA1_;
	LA3_: ;
	{
		if (!(b == NIM_NIL)) goto LA6_;
		result = a;
	}
	goto LA1_;
	LA6_: ;
	{
		result = newRope__dBdikNFB2Y7QJ9aVJE7dGHg(((NimStringDesc*) NIM_NIL));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		(*result).L = (NI)(((*a).L > 0? ((*a).L) : -((*a).L)) + ((*b).L > 0? ((*b).L) : -((*b).L)));
		(*result).left = a;
		(*result).right = b;
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size) {
	int result;
	result = (int)0;
	result = memcmp(a, b, ((size_t) (size)));
	return result;
}
static N_INLINE(NIM_BOOL, equalMem__9bGgqEk7RXXl6eqM9c1HdELAsystem)(void* a, void* b, NI size) {
	NIM_BOOL result;
	int T1_;
	result = (NIM_BOOL)0;
	T1_ = (int)0;
	T1_ = nimCmpMem(a, b, size);
	result = (T1_ == ((NI32) 0));
	return result;
}
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b) {
	NIM_BOOL result;
	NI alen;
	NI blen;
{	result = (NIM_BOOL)0;
	alen = (a ? a->Sup.len : 0);
	blen = (b ? b->Sup.len : 0);
	{
		if (!(alen == blen)) goto LA3_;
		{
			if (!(alen == ((NI) 0))) goto LA7_;
			result = NIM_TRUE;
			goto BeforeRet_;
		}
		LA7_: ;
		result = equalMem__9bGgqEk7RXXl6eqM9c1HdELAsystem(((void*) ((&a->data[((NI) 0)]))), ((void*) ((&b->data[((NI) 0)]))), ((NI) (alen)));
		goto BeforeRet_;
	}
	LA3_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, insertInCache__yShmEg9cffWxI7s5XzEKBow_2)(NimStringDesc* s) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* result;
	NI h;
	NI T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	gCacheTries__5GfZTThHPBfB9bjRZdFluBw += ((NI) 1);
	T1_ = (NI)0;
	T1_ = hash__6PCYkKlCNhq9cnRLnqWKkwQ(s);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	h = (NI)(T1_ & ((NI) 4095));
	result = cache__WGMp5Wo1NlgbAMOysPIfmQ[(h)- 0];
	{
		NIM_BOOL T4_;
		T4_ = (NIM_BOOL)0;
		T4_ = (result == 0);
		if (T4_) goto LA5_;
		T4_ = !(eqStrings((*result).data, s));
		LA5_: ;
		if (!T4_) goto LA6_;
		gCacheMisses__fLRm9am8S0daYBVNK6JKyBg += ((NI) 1);
		result = newRope__dBdikNFB2Y7QJ9aVJE7dGHg(s);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		cache__WGMp5Wo1NlgbAMOysPIfmQ[(h)- 0] = result;
	}
	LA6_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, rope__yShmEg9cffWxI7s5XzEKBow)(NimStringDesc* s) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	{
		if (!((s ? s->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = NIM_NIL;
	}
	goto LA1_;
	LA3_: ;
	{
		result = insertInCache__yShmEg9cffWxI7s5XzEKBow_2(s);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, amp___Z7W1o5nPSc3ExfO5f7j1Gg)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* a, NimStringDesc* b) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* result;
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	T1_ = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	T1_ = rope__yShmEg9cffWxI7s5XzEKBow(b);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	result = amp___ShdZ6VrAQkY0nWR9a39b9bGdQ(a, T1_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, add__yG4AKzsBRS1W4MANDlXQeg)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA** a, NimStringDesc* b) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	T1_ = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	T1_ = amp___Z7W1o5nPSc3ExfO5f7j1Gg((*a), b);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(*a) = T1_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, add__IM4kcMNkkOLJtqdEqSxR8A)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA** a, tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* b) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	T1_ = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	T1_ = amp___ShdZ6VrAQkY0nWR9a39b9bGdQ((*a), b);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(*a) = T1_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, runtimeFormat__9bvKdnhoYI2ta9agQNm3orMA)(NimStringDesc* frmt, tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA** args, NI argsLen_0) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* result;
	NI i;
	NI num;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	i = ((NI) 0);
	result = NIM_NIL;
	num = ((NI) 0);
	{
		while (1) {
			NI start;
			if (!(i < (frmt ? frmt->Sup.len : 0))) goto LA2;
			{
				if (!((NU8)(frmt->data[i]) == (NU8)(36))) goto LA5_;
				i += ((NI) 1);
				switch (((NU8)(frmt->data[i]))) {
				case 36:
				{
					add__yG4AKzsBRS1W4MANDlXQeg(&result, ((NimStringDesc*) &TM__Vw9cfUOQOae9b9bzZBlucMZQg_4));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					i += ((NI) 1);
				}
				break;
				case 35:
				{
					i += ((NI) 1);
					add__IM4kcMNkkOLJtqdEqSxR8A(&result, args[num]);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					num += ((NI) 1);
				}
				break;
				case 48 ... 57:
				{
					NI j;
					j = ((NI) 0);
					{
						while (1) {
							j = (NI)((NI)((NI)(j * ((NI) 10)) + ((NU8)(frmt->data[i]))) - ((NI) 48));
							i += ((NI) 1);
							{
								NIM_BOOL T14_;
								T14_ = (NIM_BOOL)0;
								T14_ = ((frmt ? frmt->Sup.len : 0) <= i);
								if (T14_) goto LA15_;
								T14_ = !((((NU8)(frmt->data[i])) >= ((NU8)(48)) && ((NU8)(frmt->data[i])) <= ((NU8)(57))));
								LA15_: ;
								if (!T14_) goto LA16_;
								goto LA10;
							}
							LA16_: ;
						}
					} LA10: ;
					num = j;
					{
						if (!((NI)((argsLen_0-1) + ((NI) 1)) < j)) goto LA20_;
						{
							NimStringDesc* T26_;
							if (!NIM_TRUE) goto LA24_;
							T26_ = (NimStringDesc*)0;
							T26_ = rawNewString((frmt ? frmt->Sup.len : 0) + 50);
appendString(T26_, ((NimStringDesc*) &TM__Vw9cfUOQOae9b9bzZBlucMZQg_5));
appendString(T26_, frmt);
							failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(T26_);
							if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
						}
						LA24_: ;
					}
					goto LA18_;
					LA20_: ;
					{
						add__IM4kcMNkkOLJtqdEqSxR8A(&result, args[(NI)(j - ((NI) 1))]);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					}
					LA18_: ;
				}
				break;
				case 123:
				{
					NI j_2;
					i += ((NI) 1);
					j_2 = ((NI) 0);
					{
						while (1) {
							if (!(((NU8)(frmt->data[i])) >= ((NU8)(48)) && ((NU8)(frmt->data[i])) <= ((NU8)(57)))) goto LA30;
							j_2 = (NI)((NI)((NI)(j_2 * ((NI) 10)) + ((NU8)(frmt->data[i]))) - ((NI) 48));
							i += ((NI) 1);
						} LA30: ;
					}
					num = j_2;
					{
						if (!((NU8)(frmt->data[i]) == (NU8)(125))) goto LA33_;
						i += ((NI) 1);
					}
					goto LA31_;
					LA33_: ;
					{
						{
							NimStringDesc* T40_;
							if (!NIM_TRUE) goto LA38_;
							T40_ = (NimStringDesc*)0;
							T40_ = rawNewString((frmt ? frmt->Sup.len : 0) + 50);
appendString(T40_, ((NimStringDesc*) &TM__Vw9cfUOQOae9b9bzZBlucMZQg_6));
appendString(T40_, frmt);
							failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(T40_);
							if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
						}
						LA38_: ;
					}
					LA31_: ;
					{
						if (!((NI)((argsLen_0-1) + ((NI) 1)) < j_2)) goto LA43_;
						{
							NimStringDesc* T49_;
							if (!NIM_TRUE) goto LA47_;
							T49_ = (NimStringDesc*)0;
							T49_ = rawNewString((frmt ? frmt->Sup.len : 0) + 50);
appendString(T49_, ((NimStringDesc*) &TM__Vw9cfUOQOae9b9bzZBlucMZQg_7));
appendString(T49_, frmt);
							failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(T49_);
							if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
						}
						LA47_: ;
					}
					goto LA41_;
					LA43_: ;
					{
						add__IM4kcMNkkOLJtqdEqSxR8A(&result, args[(NI)(j_2 - ((NI) 1))]);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					}
					LA41_: ;
				}
				break;
				case 110:
				{
					add__yG4AKzsBRS1W4MANDlXQeg(&result, ((NimStringDesc*) &TM__Vw9cfUOQOae9b9bzZBlucMZQg_8));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					i += ((NI) 1);
				}
				break;
				case 78:
				{
					add__yG4AKzsBRS1W4MANDlXQeg(&result, ((NimStringDesc*) &TM__Vw9cfUOQOae9b9bzZBlucMZQg_8));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					i += ((NI) 1);
				}
				break;
				default:
				{
					{
						NimStringDesc* T58_;
						if (!NIM_TRUE) goto LA56_;
						T58_ = (NimStringDesc*)0;
						T58_ = rawNewString((frmt ? frmt->Sup.len : 0) + 50);
appendString(T58_, ((NimStringDesc*) &TM__Vw9cfUOQOae9b9bzZBlucMZQg_9));
appendString(T58_, frmt);
						failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(T58_);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					}
					LA56_: ;
				}
				break;
				}
			}
			LA5_: ;
			start = i;
			{
				while (1) {
					if (!(i < (frmt ? frmt->Sup.len : 0))) goto LA60;
					{
						if (!!(((NU8)(frmt->data[i]) == (NU8)(36)))) goto LA63_;
						i += ((NI) 1);
					}
					goto LA61_;
					LA63_: ;
					{
						goto LA59;
					}
					LA61_: ;
				} LA60: ;
			} LA59: ;
			{
				NimStringDesc* T70_;
				if (!(start <= (NI)(i - ((NI) 1)))) goto LA68_;
				T70_ = (NimStringDesc*)0;
				T70_ = substr__2yh9cer0ymNRHlOOg8P7IuA(frmt, start, (NI)(i - ((NI) 1)));
				add__yG4AKzsBRS1W4MANDlXQeg(&result, T70_);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			LA68_: ;
		} LA2: ;
	}
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, percent___UQfMnMPks8jKz20fTXQy9bQ)(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA** args, NI argsLen_0) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	result = runtimeFormat__9bvKdnhoYI2ta9agQNm3orMA(((NimStringDesc*) &TM__Vw9cfUOQOae9b9bzZBlucMZQg_10), args, argsLen_0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*, rope__KOisMGxcPhz6CcSmxgwEQQ)(NI64 i) {
	tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA* result;
	NimStringDesc* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*)0;
	gCacheIntTries__opyfsNv023Md1P05mqsDew += ((NI) 1);
	T1_ = (NimStringDesc*)0;
	T1_ = nimInt64ToStr(i);
	result = rope__yShmEg9cffWxI7s5XzEKBow(T1_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, compiler_ropesInit000)(void) {
{

	nimRegisterGlobalMarker(TM__Vw9cfUOQOae9b9bzZBlucMZQg_3);

}
}

N_LIB_PRIVATE N_NIMCALL(void, compiler_ropesDatInit000)(void) {

/* section: NIM_merge_TYPE_INIT1 */
static TNimNode* TM__Vw9cfUOQOae9b9bzZBlucMZQg_2_4[4];
static TNimNode TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[5];

/* section: NIM_merge_TYPE_INIT3 */
NTI__OFzf0kSiPTcNreUIeJgWVA_.size = sizeof(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA);
NTI__OFzf0kSiPTcNreUIeJgWVA_.align = NIM_ALIGNOF(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA);
NTI__OFzf0kSiPTcNreUIeJgWVA_.kind = 17;
NTI__OFzf0kSiPTcNreUIeJgWVA_.base = (&NTI__ytyiCJqK439aF9cIibuRVpAg_);
NTI__OFzf0kSiPTcNreUIeJgWVA_.flags = 2;
TM__Vw9cfUOQOae9b9bzZBlucMZQg_2_4[0] = &TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[1];
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[1].kind = 1;
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[1].offset = offsetof(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA, left);
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[1].typ = (&NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_);
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[1].name = "left";
TM__Vw9cfUOQOae9b9bzZBlucMZQg_2_4[1] = &TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[2];
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[2].kind = 1;
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[2].offset = offsetof(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA, right);
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[2].typ = (&NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_);
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[2].name = "right";
TM__Vw9cfUOQOae9b9bzZBlucMZQg_2_4[2] = &TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[3];
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[3].kind = 1;
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[3].offset = offsetof(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA, L);
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[3].typ = (&NTI__rR5Bzr1D5krxoo1NcNyeMA_);
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[3].name = "L";
TM__Vw9cfUOQOae9b9bzZBlucMZQg_2_4[3] = &TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[4];
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[4].kind = 1;
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[4].offset = offsetof(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA, data);
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[4].typ = (&NTI__77mFvmsOLKik79ci2hXkHEg_);
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[4].name = "data";
TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[0].len = 4; TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[0].kind = 2; TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[0].sons = &TM__Vw9cfUOQOae9b9bzZBlucMZQg_2_4[0];
NTI__OFzf0kSiPTcNreUIeJgWVA_.node = &TM__Vw9cfUOQOae9b9bzZBlucMZQg_0[0];
NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_.size = sizeof(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*);
NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_.align = NIM_ALIGNOF(tyObject_RopeObj__OFzf0kSiPTcNreUIeJgWVA*);
NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_.kind = 22;
NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_.base = (&NTI__OFzf0kSiPTcNreUIeJgWVA_);
NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_.flags = 2;
NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_.marker = Marker_tyRef__4hi0XQqK9aLiPuWT9acsXm9aQ;
NTI__USLYl0Lpkimm4FABiJ3ldA_.size = sizeof(tyArray__USLYl0Lpkimm4FABiJ3ldA);
NTI__USLYl0Lpkimm4FABiJ3ldA_.align = NIM_ALIGNOF(tyArray__USLYl0Lpkimm4FABiJ3ldA);
NTI__USLYl0Lpkimm4FABiJ3ldA_.kind = 16;
NTI__USLYl0Lpkimm4FABiJ3ldA_.base = (&NTI__4hi0XQqK9aLiPuWT9acsXm9aQ_);
NTI__USLYl0Lpkimm4FABiJ3ldA_.flags = 2;
}

