/* Generated by Nim Compiler v0.16.0 */
/*   (c) 2017 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, arm, gcc */
/* Command for C compiler:
   gcc -c  -w -O3 -fno-strict-aliasing -fPIC  -I/build/nim/src/Nim-0.16.0/lib -o lib/nimcache/stdlib_ropes.o lib/nimcache/stdlib_ropes.c */
#define NIM_INTBITS 32

#include "nimbase.h"
#include <string.h>
#include <stdio.h>
#undef linux
typedef struct Ropeobj_pk4sC5H3E9ceov4bEasyPVw Ropeobj_pk4sC5H3E9ceov4bEasyPVw;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Cell_1zcF9cV8XIAtbN8h5HRUB8g Cell_1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct TY_xyYfiXqv9bXR7uHakYC9cy3A TY_xyYfiXqv9bXR7uHakYC9cy3A;
typedef struct Valueerror_Gi06FkNeykJn7mrqRZYrkA Valueerror_Gi06FkNeykJn7mrqRZYrkA;
typedef struct Exception Exception;
typedef struct TNimObject TNimObject;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Ropeobj_pk4sC5H3E9ceov4bEasyPVw  {
Ropeobj_pk4sC5H3E9ceov4bEasyPVw* left;
Ropeobj_pk4sC5H3E9ceov4bEasyPVw* right;
NI length;
NimStringDesc* data;
};
typedef NU8 Tnimkind_jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 Tnimtypeflag_v8QUszD1sWlSIWZz7mC4bQ_Set;
typedef N_NIMCALL_PTR(void, TY_ojoeKfW4VYIm36I9cpDTQIg) (void* p0, NI op0);
typedef N_NIMCALL_PTR(void*, TY_WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p0);
struct  TNimType  {
NI size;
Tnimkind_jIBKr1ejBgsfM33Kxw4j7A kind;
Tnimtypeflag_v8QUszD1sWlSIWZz7mC4bQ_Set flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY_ojoeKfW4VYIm36I9cpDTQIg marker;
TY_WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 Tnimnodekind_unfNsxrcATrufDZmpBq4HQ;
struct  TNimNode  {
Tnimnodekind_unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(void, TY_T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct  Cell_1zcF9cV8XIAtbN8h5HRUB8g  {
NI refcount;
TNimType* typ;
};
typedef Ropeobj_pk4sC5H3E9ceov4bEasyPVw* TY_ezQ7zQIr6HCZDV3txRgZxQ[1];
struct  TNimObject  {
TNimType* m_type;
};
struct  Exception  {
  TNimObject Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
NimStringDesc* trace;
};
struct  Valueerror_Gi06FkNeykJn7mrqRZYrkA  {
  Exception Sup;
};
typedef NIM_CHAR TY_9bKy7UA2LOi2vzOViufaW1Q[1024];
typedef NU8 Filemode_fVUBHvW79bXUw1j55Oo9avSQ;
struct TY_xyYfiXqv9bXR7uHakYC9cy3A {
  TGenericSeq Sup;
  Ropeobj_pk4sC5H3E9ceov4bEasyPVw* data[SEQ_DECL_SIZE];
};
N_LIB_EXPORT N_CDECL(NI, nrolen)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* a0);
N_LIB_EXPORT N_CDECL(void, nimrtl_nimGCvisit)(void* d0, NI op0);
static N_NIMCALL(void, Marker_TY_VYsfqmmqchsY5XzU9aJJBBA)(void* p, NI op);
static N_NIMCALL(void, T_7lAtbav61D2a8Y3CNxNADw_3)(void);
N_NIMCALL(void, nimRegisterGlobalMarker)(TY_T4eqaYlFJYZUv9aG9b1TV0bQ markerproc0);
static N_NIMCALL(void, T_7lAtbav61D2a8Y3CNxNADw_4)(void);
N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroropeStr)(NimStringDesc* s0);
N_NIMCALL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, insertincache_zyNKR9bGqWnYs3KqoSwEkmw)(NimStringDesc* s0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* tree0);
N_NIMCALL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, newrope_ZCIC6k9cUm3AxZaNUwQjbQA)(NimStringDesc* data0);
N_LIB_EXPORT N_CDECL(void*, nimrtl_newObj)(TNimType* typ0, NI size0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_copyStringRC1)(NimStringDesc* src0);
static N_INLINE(void, nimGCunrefNoCycle)(void* p0);
static N_INLINE(Cell_1zcF9cV8XIAtbN8h5HRUB8g*, usrtocell_yB9aH5WIlwd0xkYrcdPeXrQsystem)(void* usr0);
N_LIB_EXPORT N_CDECL(void, nimrtl_rtlAddZCT)(Cell_1zcF9cV8XIAtbN8h5HRUB8g* c0);
N_NIMCALL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, splay_7mVUhfvaqnODOd3UFhWBOw)(NimStringDesc* s0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* tree0, NI* cmpres0);
static N_INLINE(void, asgnRefNoCycle)(void** dest0, void* src0);
N_NIMCALL(NI, cmp_xEnKsp9cfvO7Do9cTYXo8eJw)(NimStringDesc* x0, NimStringDesc* y0);
static N_INLINE(NI, cmpStrings)(NimStringDesc* a0, NimStringDesc* b0);
N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroropeBiggestInt)(NI64 i0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_nimInt64ToStr)(NI64 x0);
N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroropeBiggestFloat)(NF f0);
N_NIMCALL(NimStringDesc*, nimFloatToStr)(NF f0);
N_LIB_EXPORT N_CDECL(void, nroenableCache)(void);
N_LIB_EXPORT N_CDECL(void, nrodisableCache)(void);
N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroConcRopeRope)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* a0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* b0);
N_NIMCALL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, newrope_WJVf4Z1xJABh8ibr4mr22w)(void);
N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroConcRopeStr)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* a0, NimStringDesc* b0);
N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroConcStrRope)(NimStringDesc* a0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* b0);
N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroConcOpenArray)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw** a0, NI a0Len0);
N_LIB_EXPORT N_CDECL(void, nroaddRope)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw** a0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* b0);
N_NIMCALL(void, unsureAsgnRef)(void** dest0, void* src0);
N_LIB_EXPORT N_CDECL(void, nroaddStr)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw** a0, NimStringDesc* b0);
N_LIB_EXPORT N_CDECL(NIM_CHAR, nroCharAt)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0, NI i0);
static N_INLINE(NIM_BOOL, isconc_XZ8qsVA5ELaAT0pRYWW5Ywropes)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0);
N_LIB_EXPORT N_CDECL(void, nrowrite)(FILE* f0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0);
N_LIB_EXPORT N_CDECL(void*, nimrtl_newSeq)(TNimType* typ0, NI len0);
static N_INLINE(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, pop_ty7pjOMAEzlk2hF5VjHEsAropes)(TY_xyYfiXqv9bXR7uHakYC9cy3A** s0);
N_LIB_EXPORT N_CDECL(TGenericSeq*, nimrtl_setLengthSeq)(TGenericSeq* seq0, NI elemsize0, NI newlen0);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq0, NI elemsize0);
N_NIMCALL(void, write_c4mGyJBvK73pdM22jiweKQ)(FILE* f0, NimStringDesc* s0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nroToString)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0);
N_NIMCALL(NimStringDesc*, mnewString)(NI len0);
N_NIMCALL(NimStringDesc*, mnewString)(NI len0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_setLengthStr)(NimStringDesc* s0, NI newlen0);
static N_INLINE(void, appendString)(NimStringDesc* dest0, NimStringDesc* src0);
static N_INLINE(void, copymem_fPlwH3r9agN9aEHB6yCPMh0wsystem)(void* dest0, void* source0, NI size0);
N_LIB_EXPORT N_CDECL(NimStringDesc*, nimrtl_resizeString)(NimStringDesc* dest0, NI addlen0);
N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroFormat)(NimStringDesc* frmt0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw** args0, NI args0Len0);
N_LIB_EXPORT N_CDECL(void, nimrtl_raiseException)(Exception* e0, NCSTRING ename0);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s0, NI start_WPWyPKk58Cr5a6XFFviMjg, NI last0);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s0, NI first0, NI last0);
N_LIB_EXPORT N_CDECL(void, nroaddf)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw** c0, NimStringDesc* frmt0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw** args0, NI args0Len0);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nroequalsFileFile)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0, FILE* f0);
N_NIMCALL(NI, readbuffer_nZ0pNe9cd9cXtoayexCiaDtA)(FILE* f0, void* buffer0, NI len0);
static N_INLINE(NIM_BOOL, equalmem_DCrUjdaMvFDHaR1hs7sQGwstrutils)(void* a0, void* b0, NI size0);
N_LIB_EXPORT N_CDECL(NIM_BOOL, nroequalsFileStr)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0, NimStringDesc* filename0);
N_NIMCALL(NIM_BOOL, open_sEp0GH2306oGo9bqBpj5oTQ)(FILE** f0, NimStringDesc* filename0, Filemode_fVUBHvW79bXUw1j55Oo9avSQ mode0, NI bufsize0);
N_NIMCALL(void, close_BWnr8V7RERYno9bIdPmw8Hw)(FILE* f0);
N_LIB_EXPORT N_CDECL(void*, nimrtl_newObjRC1)(TNimType* typ0, NI size0);
NIM_BOOL cacheenabled_Tx9b9cwni2VzCnsN5eGrePhg;
Ropeobj_pk4sC5H3E9ceov4bEasyPVw* cache_lDP9b48rBnemgIUaWT45Xng;
TNimType NTI_pk4sC5H3E9ceov4bEasyPVw;
extern TNimType NTI_rR5Bzr1D5krxoo1NcNyeMA;
extern TNimType NTI_77mFvmsOLKik79ci2hXkHEg;
TNimType NTI_VYsfqmmqchsY5XzU9aJJBBA;
Ropeobj_pk4sC5H3E9ceov4bEasyPVw* N_Exgp9asfFKZJfhz9bzz9bL89cg;
extern TNimType NTI_xyYfiXqv9bXR7uHakYC9cy3A;
extern TNimType NTI_yCEN9anxCD6mzBxGjuaRBdg;
extern TNimType NTI_Gi06FkNeykJn7mrqRZYrkA;
STRING_LITERAL(T_7lAtbav61D2a8Y3CNxNADw_5, "$", 1);
STRING_LITERAL(T_7lAtbav61D2a8Y3CNxNADw_6, "invalid format string", 21);

N_LIB_EXPORT N_CDECL(NI, nrolen)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* a0) {
	NI result0;
	result0 = (NI)0;
	{
		if (!(a0 == NIM_NIL)) goto LA3;
		result0 = ((NI) 0);
	}
	goto LA1;
	LA3: ;
	{
		result0 = (*a0).length;
	}
	LA1: ;
	return result0;
}
static N_NIMCALL(void, Marker_TY_VYsfqmmqchsY5XzU9aJJBBA)(void* p, NI op) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* a;
	a = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)p;
	nimrtl_nimGCvisit((void*)(*a).left, op);
	nimrtl_nimGCvisit((void*)(*a).right, op);
	nimrtl_nimGCvisit((void*)(*a).data, op);
}
static N_NIMCALL(void, T_7lAtbav61D2a8Y3CNxNADw_3)(void) {
	nimrtl_nimGCvisit((void*)cache_lDP9b48rBnemgIUaWT45Xng, 0);
}
static N_NIMCALL(void, T_7lAtbav61D2a8Y3CNxNADw_4)(void) {
	nimrtl_nimGCvisit((void*)N_Exgp9asfFKZJfhz9bzz9bL89cg, 0);
}

static N_INLINE(Cell_1zcF9cV8XIAtbN8h5HRUB8g*, usrtocell_yB9aH5WIlwd0xkYrcdPeXrQsystem)(void* usr0) {
	Cell_1zcF9cV8XIAtbN8h5HRUB8g* result0;
	result0 = (Cell_1zcF9cV8XIAtbN8h5HRUB8g*)0;
	result0 = ((Cell_1zcF9cV8XIAtbN8h5HRUB8g*) ((NI)((NU32)(((NI) (usr0))) - (NU32)(((NI)sizeof(Cell_1zcF9cV8XIAtbN8h5HRUB8g))))));
	return result0;
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p0) {
	Cell_1zcF9cV8XIAtbN8h5HRUB8g* c0;
	c0 = usrtocell_yB9aH5WIlwd0xkYrcdPeXrQsystem(p0);
	{
		(*c0).refcount -= ((NI) 8);
		if (!((NU32)((*c0).refcount) < (NU32)(((NI) 8)))) goto LA3;
		nimrtl_rtlAddZCT(c0);
	}
	LA3: ;
}

N_NIMCALL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, newrope_ZCIC6k9cUm3AxZaNUwQjbQA)(NimStringDesc* data0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	NimStringDesc* LOC1;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*) nimrtl_newObj((&NTI_VYsfqmmqchsY5XzU9aJJBBA), sizeof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw));
	(*result0).length = (data0 ? data0->Sup.len : 0);
	LOC1 = (NimStringDesc*)0;
	LOC1 = (*result0).data; (*result0).data = nimrtl_copyStringRC1(data0);
	if (LOC1) nimGCunrefNoCycle(LOC1);
	return result0;
}

static N_INLINE(void, asgnRefNoCycle)(void** dest0, void* src0) {
	{
		Cell_1zcF9cV8XIAtbN8h5HRUB8g* c0;
		if (!!((src0 == NIM_NIL))) goto LA3;
		c0 = usrtocell_yB9aH5WIlwd0xkYrcdPeXrQsystem(src0);
		(*c0).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Cell_1zcF9cV8XIAtbN8h5HRUB8g* c0;
		if (!!(((*dest0) == NIM_NIL))) goto LA7;
		c0 = usrtocell_yB9aH5WIlwd0xkYrcdPeXrQsystem((*dest0));
		{
			(*c0).refcount -= ((NI) 8);
			if (!((NU32)((*c0).refcount) < (NU32)(((NI) 8)))) goto LA11;
			nimrtl_rtlAddZCT(c0);
		}
		LA11: ;
	}
	LA7: ;
	(*dest0) = src0;
}

static N_INLINE(NI, cmpStrings)(NimStringDesc* a0, NimStringDesc* b0) {
	NI result0;
	int LOC13;
{	result0 = (NI)0;
	{
		if (!(a0 == b0)) goto LA3;
		result0 = ((NI) 0);
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!(a0 == NIM_NIL)) goto LA7;
		result0 = ((NI) -1);
		goto BeforeRet;
	}
	LA7: ;
	{
		if (!(b0 == NIM_NIL)) goto LA11;
		result0 = ((NI) 1);
		goto BeforeRet;
	}
	LA11: ;
	LOC13 = (int)0;
	LOC13 = strcmp(((NCSTRING) ((*a0).data)), ((NCSTRING) ((*b0).data)));
	result0 = ((NI) (LOC13));
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_NIMCALL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, splay_7mVUhfvaqnODOd3UFhWBOw)(NimStringDesc* s0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* tree0, NI* cmpres0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	NI c0;
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* t0;
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* le0;
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	c0 = (NI)0;
	t0 = tree0;
	asgnRefNoCycle((void**) (&(*N_Exgp9asfFKZJfhz9bzz9bL89cg).left), NIM_NIL);
	asgnRefNoCycle((void**) (&(*N_Exgp9asfFKZJfhz9bzz9bL89cg).right), NIM_NIL);
	le0 = N_Exgp9asfFKZJfhz9bzz9bL89cg;
	r0 = N_Exgp9asfFKZJfhz9bzz9bL89cg;
	{
		while (1) {
			c0 = cmp_xEnKsp9cfvO7Do9cTYXo8eJw(s0, (*t0).data);
			{
				if (!(c0 < ((NI) 0))) goto LA5;
				{
					NIM_BOOL LOC9;
					Ropeobj_pk4sC5H3E9ceov4bEasyPVw* y0;
					LOC9 = (NIM_BOOL)0;
					LOC9 = !(((*t0).left == NIM_NIL));
					if (!(LOC9)) goto LA10;
					LOC9 = (cmpStrings(s0, (*(*t0).left).data) < 0);
					LA10: ;
					if (!LOC9) goto LA11;
					y0 = (*t0).left;
					asgnRefNoCycle((void**) (&(*t0).left), (*y0).right);
					asgnRefNoCycle((void**) (&(*y0).right), t0);
					t0 = y0;
				}
				LA11: ;
				{
					if (!((*t0).left == NIM_NIL)) goto LA15;
					goto LA1;
				}
				LA15: ;
				asgnRefNoCycle((void**) (&(*r0).left), t0);
				r0 = t0;
				t0 = (*t0).left;
			}
			goto LA3;
			LA5: ;
			{
				if (!(((NI) 0) < c0)) goto LA18;
				{
					NIM_BOOL LOC22;
					Ropeobj_pk4sC5H3E9ceov4bEasyPVw* y0;
					LOC22 = (NIM_BOOL)0;
					LOC22 = !(((*t0).right == NIM_NIL));
					if (!(LOC22)) goto LA23;
					LOC22 = (cmpStrings((*(*t0).right).data, s0) < 0);
					LA23: ;
					if (!LOC22) goto LA24;
					y0 = (*t0).right;
					asgnRefNoCycle((void**) (&(*t0).right), (*y0).left);
					asgnRefNoCycle((void**) (&(*y0).left), t0);
					t0 = y0;
				}
				LA24: ;
				{
					if (!((*t0).right == NIM_NIL)) goto LA28;
					goto LA1;
				}
				LA28: ;
				asgnRefNoCycle((void**) (&(*le0).right), t0);
				le0 = t0;
				t0 = (*t0).right;
			}
			goto LA3;
			LA18: ;
			{
				goto LA1;
			}
			LA3: ;
		}
	} LA1: ;
	(*cmpres0) = c0;
	asgnRefNoCycle((void**) (&(*le0).right), (*t0).left);
	asgnRefNoCycle((void**) (&(*r0).left), (*t0).right);
	asgnRefNoCycle((void**) (&(*t0).left), (*N_Exgp9asfFKZJfhz9bzz9bL89cg).right);
	asgnRefNoCycle((void**) (&(*t0).right), (*N_Exgp9asfFKZJfhz9bzz9bL89cg).left);
	result0 = t0;
	return result0;
}

N_NIMCALL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, insertincache_zyNKR9bGqWnYs3KqoSwEkmw)(NimStringDesc* s0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* tree0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* t0;
	NI cmp0;
{	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	t0 = tree0;
	{
		if (!(t0 == NIM_NIL)) goto LA3;
		result0 = newrope_ZCIC6k9cUm3AxZaNUwQjbQA(s0);
		goto BeforeRet;
	}
	LA3: ;
	cmp0 = (NI)0;
	t0 = splay_7mVUhfvaqnODOd3UFhWBOw(s0, t0, (&cmp0));
	{
		if (!(cmp0 == ((NI) 0))) goto LA7;
		result0 = t0;
	}
	goto LA5;
	LA7: ;
	{
		result0 = newrope_ZCIC6k9cUm3AxZaNUwQjbQA(s0);
		{
			if (!(cmp0 < ((NI) 0))) goto LA12;
			asgnRefNoCycle((void**) (&(*result0).left), (*t0).left);
			asgnRefNoCycle((void**) (&(*result0).right), t0);
			asgnRefNoCycle((void**) (&(*t0).left), NIM_NIL);
		}
		goto LA10;
		LA12: ;
		{
			asgnRefNoCycle((void**) (&(*result0).right), (*t0).right);
			asgnRefNoCycle((void**) (&(*result0).left), t0);
			asgnRefNoCycle((void**) (&(*t0).right), NIM_NIL);
		}
		LA10: ;
	}
	LA5: ;
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroropeStr)(NimStringDesc* s0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	{
		if (!((s0 ? s0->Sup.len : 0) == ((NI) 0))) goto LA3;
		result0 = NIM_NIL;
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!cacheenabled_Tx9b9cwni2VzCnsN5eGrePhg) goto LA8;
			result0 = insertincache_zyNKR9bGqWnYs3KqoSwEkmw(s0, cache_lDP9b48rBnemgIUaWT45Xng);
			asgnRefNoCycle((void**) (&cache_lDP9b48rBnemgIUaWT45Xng), result0);
		}
		goto LA6;
		LA8: ;
		{
			result0 = newrope_ZCIC6k9cUm3AxZaNUwQjbQA(s0);
		}
		LA6: ;
	}
	LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroropeBiggestInt)(NI64 i0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	NimStringDesc* LOC1;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	LOC1 = (NimStringDesc*)0;
	LOC1 = nimrtl_nimInt64ToStr(i0);
	result0 = nroropeStr(LOC1);
	return result0;
}

N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroropeBiggestFloat)(NF f0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	NimStringDesc* LOC1;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	LOC1 = (NimStringDesc*)0;
	LOC1 = nimFloatToStr(f0);
	result0 = nroropeStr(LOC1);
	return result0;
}

N_LIB_EXPORT N_CDECL(void, nroenableCache)(void) {
	cacheenabled_Tx9b9cwni2VzCnsN5eGrePhg = NIM_TRUE;
}

N_LIB_EXPORT N_CDECL(void, nrodisableCache)(void) {
	asgnRefNoCycle((void**) (&cache_lDP9b48rBnemgIUaWT45Xng), NIM_NIL);
	cacheenabled_Tx9b9cwni2VzCnsN5eGrePhg = NIM_FALSE;
}

N_NIMCALL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, newrope_WJVf4Z1xJABh8ibr4mr22w)(void) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*) nimrtl_newObj((&NTI_VYsfqmmqchsY5XzU9aJJBBA), sizeof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw));
	return result0;
}

N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroConcRopeRope)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* a0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* b0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	{
		if (!(a0 == NIM_NIL)) goto LA3;
		result0 = b0;
	}
	goto LA1;
	LA3: ;
	{
		if (!(b0 == NIM_NIL)) goto LA6;
		result0 = a0;
	}
	goto LA1;
	LA6: ;
	{
		result0 = newrope_WJVf4Z1xJABh8ibr4mr22w();
		(*result0).length = (NI)((*a0).length + (*b0).length);
		asgnRefNoCycle((void**) (&(*result0).left), a0);
		asgnRefNoCycle((void**) (&(*result0).right), b0);
	}
	LA1: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroConcRopeStr)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* a0, NimStringDesc* b0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* LOC1;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	LOC1 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	LOC1 = nroropeStr(b0);
	result0 = nroConcRopeRope(a0, LOC1);
	return result0;
}

N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroConcStrRope)(NimStringDesc* a0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* b0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* LOC1;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	LOC1 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	LOC1 = nroropeStr(a0);
	result0 = nroConcRopeRope(LOC1, b0);
	return result0;
}

N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroConcOpenArray)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw** a0, NI a0Len0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	{
		NI i_Oa0pigMKuTuG2KdWdBy6vQ;
		NI HEX3Atmp_3s0VL7vJ8v2FHBUYfz4Mzg;
		NI res_W5HLAlk5Nri9aMw4RwhsrDQ;
		i_Oa0pigMKuTuG2KdWdBy6vQ = (NI)0;
		HEX3Atmp_3s0VL7vJ8v2FHBUYfz4Mzg = (NI)0;
		HEX3Atmp_3s0VL7vJ8v2FHBUYfz4Mzg = (a0Len0-1);
		res_W5HLAlk5Nri9aMw4RwhsrDQ = ((NI) 0);
		{
			while (1) {
				if (!(res_W5HLAlk5Nri9aMw4RwhsrDQ <= HEX3Atmp_3s0VL7vJ8v2FHBUYfz4Mzg)) goto LA3;
				i_Oa0pigMKuTuG2KdWdBy6vQ = res_W5HLAlk5Nri9aMw4RwhsrDQ;
				result0 = nroConcRopeRope(result0, a0[i_Oa0pigMKuTuG2KdWdBy6vQ]);
				res_W5HLAlk5Nri9aMw4RwhsrDQ += ((NI) 1);
			} LA3: ;
		}
	}
	return result0;
}

N_LIB_EXPORT N_CDECL(void, nroaddRope)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw** a0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* b0) {
	unsureAsgnRef((void**) (&(*a0)), nroConcRopeRope((*a0), b0));
}

N_LIB_EXPORT N_CDECL(void, nroaddStr)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw** a0, NimStringDesc* b0) {
	unsureAsgnRef((void**) (&(*a0)), nroConcRopeStr((*a0), b0));
}

static N_INLINE(NIM_BOOL, isconc_XZ8qsVA5ELaAT0pRYWW5Ywropes)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0) {
	NIM_BOOL result0;
{	result0 = (NIM_BOOL)0;
	result0 = ((*r0).data == 0);
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NIM_CHAR, nroCharAt)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0, NI i0) {
	NIM_CHAR result0;
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* x0;
	NI j0;
{	result0 = (NIM_CHAR)0;
	x0 = r0;
	j0 = i0;
	{
		if (!(x0 == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		while (1) {
			{
				NIM_BOOL LOC9;
				LOC9 = (NIM_BOOL)0;
				LOC9 = isconc_XZ8qsVA5ELaAT0pRYWW5Ywropes(x0);
				if (!!(LOC9)) goto LA10;
				{
					if (!((NU32)(((*x0).data ? (*x0).data->Sup.len : 0)) < (NU32)(j0))) goto LA14;
					result0 = (*x0).data->data[j0];
					goto BeforeRet;
				}
				LA14: ;
				result0 = 0;
				goto BeforeRet;
			}
			goto LA7;
			LA10: ;
			{
				{
					NI LOC19;
					LOC19 = (NI)0;
					LOC19 = nrolen((*x0).left);
					if (!((NU32)(j0) < (NU32)(LOC19))) goto LA20;
					x0 = (*x0).left;
				}
				goto LA17;
				LA20: ;
				{
					NI LOC23;
					x0 = (*x0).right;
					LOC23 = (NI)0;
					LOC23 = nrolen(x0);
					j0 -= LOC23;
				}
				LA17: ;
			}
			LA7: ;
		}
	}
	}BeforeRet: ;
	return result0;
}

static N_INLINE(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, pop_ty7pjOMAEzlk2hF5VjHEsAropes)(TY_xyYfiXqv9bXR7uHakYC9cy3A** s0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	NI L0;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	L0 = (NI)(((*s0) ? (*s0)->Sup.len : 0) - ((NI) 1));
	result0 = (*s0)->data[L0];
	(*s0) = (TY_xyYfiXqv9bXR7uHakYC9cy3A*) nimrtl_setLengthSeq(&((*s0))->Sup, sizeof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*), ((NI) (L0)));
	return result0;
}

N_LIB_EXPORT N_CDECL(void, nrowrite)(FILE* f0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0) {
	{
		NimStringDesc* s_vj6t8ITzi9bEZGjQId9agbJg;
		s_vj6t8ITzi9bEZGjQId9agbJg = (NimStringDesc*)0;
		{
			TY_xyYfiXqv9bXR7uHakYC9cy3A* stack_t9a1XhaQB9cBUhDCqRP70o5A;
			TY_ezQ7zQIr6HCZDV3txRgZxQ LOC6;
			if (!!((r0 == NIM_NIL))) goto LA4;
			stack_t9a1XhaQB9cBUhDCqRP70o5A = (TY_xyYfiXqv9bXR7uHakYC9cy3A*) nimrtl_newSeq((&NTI_xyYfiXqv9bXR7uHakYC9cy3A), 1);
			memset((void*)LOC6, 0, sizeof(LOC6));
			LOC6[0] = r0;
			asgnRefNoCycle((void**) (&stack_t9a1XhaQB9cBUhDCqRP70o5A->data[0]), LOC6[0]);
			{
				while (1) {
					Ropeobj_pk4sC5H3E9ceov4bEasyPVw* it_yvoX9cP719aWqxcj09bHsL9a9cg;
					if (!(((NI) 0) < (stack_t9a1XhaQB9cBUhDCqRP70o5A ? stack_t9a1XhaQB9cBUhDCqRP70o5A->Sup.len : 0))) goto LA8;
					it_yvoX9cP719aWqxcj09bHsL9a9cg = pop_ty7pjOMAEzlk2hF5VjHEsAropes((&stack_t9a1XhaQB9cBUhDCqRP70o5A));
					{
						while (1) {
							NIM_BOOL LOC11;
							LOC11 = (NIM_BOOL)0;
							LOC11 = isconc_XZ8qsVA5ELaAT0pRYWW5Ywropes(it_yvoX9cP719aWqxcj09bHsL9a9cg);
							if (!LOC11) goto LA10;
							stack_t9a1XhaQB9cBUhDCqRP70o5A = (TY_xyYfiXqv9bXR7uHakYC9cy3A*) incrSeqV2(&(stack_t9a1XhaQB9cBUhDCqRP70o5A)->Sup, sizeof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*));
							asgnRefNoCycle((void**) (&stack_t9a1XhaQB9cBUhDCqRP70o5A->data[stack_t9a1XhaQB9cBUhDCqRP70o5A->Sup.len]), (*it_yvoX9cP719aWqxcj09bHsL9a9cg).right);
							++stack_t9a1XhaQB9cBUhDCqRP70o5A->Sup.len;
							it_yvoX9cP719aWqxcj09bHsL9a9cg = (*it_yvoX9cP719aWqxcj09bHsL9a9cg).left;
						} LA10: ;
					}
					s_vj6t8ITzi9bEZGjQId9agbJg = (*it_yvoX9cP719aWqxcj09bHsL9a9cg).data;
					write_c4mGyJBvK73pdM22jiweKQ(f0, s_vj6t8ITzi9bEZGjQId9agbJg);
				} LA8: ;
			}
		}
		LA4: ;
	}
}

static N_INLINE(void, copymem_fPlwH3r9agN9aEHB6yCPMh0wsystem)(void* dest0, void* source0, NI size0) {
	void* LOC1;
	LOC1 = (void*)0;
	LOC1 = memcpy(dest0, source0, ((size_t) (size0)));
}

static N_INLINE(void, appendString)(NimStringDesc* dest0, NimStringDesc* src0) {
	copymem_fPlwH3r9agN9aEHB6yCPMh0wsystem(((void*) ((&(*dest0).data[((*dest0).Sup.len)- 0]))), ((void*) ((*src0).data)), ((NI) ((NI)((*src0).Sup.len + ((NI) 1)))));
	(*dest0).Sup.len += (*src0).Sup.len;
}

N_LIB_EXPORT N_CDECL(NimStringDesc*, nroToString)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0) {
	NimStringDesc* result0;
	NI LOC1;
	result0 = (NimStringDesc*)0;
	LOC1 = (NI)0;
	LOC1 = nrolen(r0);
	result0 = mnewString(((NI) (LOC1)));
	result0 = nimrtl_setLengthStr(result0, ((NI) 0));
	{
		NimStringDesc* s_joFpP5SJhNLSTlfzzSTZJA;
		s_joFpP5SJhNLSTlfzzSTZJA = (NimStringDesc*)0;
		{
			TY_xyYfiXqv9bXR7uHakYC9cy3A* stack_69bzWaF0rUfEp8DtYi8nufw;
			TY_ezQ7zQIr6HCZDV3txRgZxQ LOC7;
			if (!!((r0 == NIM_NIL))) goto LA5;
			stack_69bzWaF0rUfEp8DtYi8nufw = (TY_xyYfiXqv9bXR7uHakYC9cy3A*) nimrtl_newSeq((&NTI_xyYfiXqv9bXR7uHakYC9cy3A), 1);
			memset((void*)LOC7, 0, sizeof(LOC7));
			LOC7[0] = r0;
			asgnRefNoCycle((void**) (&stack_69bzWaF0rUfEp8DtYi8nufw->data[0]), LOC7[0]);
			{
				while (1) {
					Ropeobj_pk4sC5H3E9ceov4bEasyPVw* it_4YVfxWWv8ZNQ7BkbAtZTxg;
					if (!(((NI) 0) < (stack_69bzWaF0rUfEp8DtYi8nufw ? stack_69bzWaF0rUfEp8DtYi8nufw->Sup.len : 0))) goto LA9;
					it_4YVfxWWv8ZNQ7BkbAtZTxg = pop_ty7pjOMAEzlk2hF5VjHEsAropes((&stack_69bzWaF0rUfEp8DtYi8nufw));
					{
						while (1) {
							NIM_BOOL LOC12;
							LOC12 = (NIM_BOOL)0;
							LOC12 = isconc_XZ8qsVA5ELaAT0pRYWW5Ywropes(it_4YVfxWWv8ZNQ7BkbAtZTxg);
							if (!LOC12) goto LA11;
							stack_69bzWaF0rUfEp8DtYi8nufw = (TY_xyYfiXqv9bXR7uHakYC9cy3A*) incrSeqV2(&(stack_69bzWaF0rUfEp8DtYi8nufw)->Sup, sizeof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*));
							asgnRefNoCycle((void**) (&stack_69bzWaF0rUfEp8DtYi8nufw->data[stack_69bzWaF0rUfEp8DtYi8nufw->Sup.len]), (*it_4YVfxWWv8ZNQ7BkbAtZTxg).right);
							++stack_69bzWaF0rUfEp8DtYi8nufw->Sup.len;
							it_4YVfxWWv8ZNQ7BkbAtZTxg = (*it_4YVfxWWv8ZNQ7BkbAtZTxg).left;
						} LA11: ;
					}
					s_joFpP5SJhNLSTlfzzSTZJA = (*it_4YVfxWWv8ZNQ7BkbAtZTxg).data;
					result0 = nimrtl_resizeString(result0, s_joFpP5SJhNLSTlfzzSTZJA->Sup.len + 0);
appendString(result0, s_joFpP5SJhNLSTlfzzSTZJA);
				} LA9: ;
			}
		}
		LA5: ;
	}
	return result0;
}

N_LIB_EXPORT N_CDECL(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*, nroFormat)(NimStringDesc* frmt0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw** args0, NI args0Len0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* result0;
	NI i0;
	NI length0;
	NI num0;
	result0 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	i0 = ((NI) 0);
	length0 = (frmt0 ? frmt0->Sup.len : 0);
	result0 = NIM_NIL;
	num0 = ((NI) 0);
	{
		while (1) {
			NI start0;
			if (!(i0 < length0)) goto LA2;
			{
				if (!((NU8)(frmt0->data[i0]) == (NU8)(36))) goto LA5;
				i0 += ((NI) 1);
				switch (((NU8)(frmt0->data[i0]))) {
				case 36:
				{
					nroaddStr(&result0, ((NimStringDesc*) &T_7lAtbav61D2a8Y3CNxNADw_5));
					i0 += ((NI) 1);
				}
				break;
				case 35:
				{
					i0 += ((NI) 1);
					nroaddRope(&result0, args0[num0]);
					num0 += ((NI) 1);
				}
				break;
				case 48 ... 57:
				{
					NI j0;
					j0 = ((NI) 0);
					{
						while (1) {
							j0 = (NI)((NI)((NI)(j0 * ((NI) 10)) + ((NI) (((NU8)(frmt0->data[i0]))))) - ((NI) 48));
							i0 += ((NI) 1);
							{
								if (!!((((NU8)(frmt0->data[i0])) >= ((NU8)(48)) && ((NU8)(frmt0->data[i0])) <= ((NU8)(57))))) goto LA14;
								goto LA10;
							}
							LA14: ;
						}
					} LA10: ;
					nroaddRope(&result0, args0[(NI)(j0 - ((NI) 1))]);
				}
				break;
				case 123:
				{
					NI j0;
					i0 += ((NI) 1);
					j0 = ((NI) 0);
					{
						while (1) {
							if (!(((NU8)(frmt0->data[i0])) >= ((NU8)(48)) && ((NU8)(frmt0->data[i0])) <= ((NU8)(57)))) goto LA18;
							j0 = (NI)((NI)((NI)(j0 * ((NI) 10)) + ((NI) (((NU8)(frmt0->data[i0]))))) - ((NI) 48));
							i0 += ((NI) 1);
						} LA18: ;
					}
					{
						if (!((NU8)(frmt0->data[i0]) == (NU8)(125))) goto LA21;
						i0 += ((NI) 1);
					}
					goto LA19;
					LA21: ;
					{
						Valueerror_Gi06FkNeykJn7mrqRZYrkA* e_hkSGTDR06p6gStNEmOpvMA;
						NimStringDesc* LOC24;
						e_hkSGTDR06p6gStNEmOpvMA = (Valueerror_Gi06FkNeykJn7mrqRZYrkA*)0;
						e_hkSGTDR06p6gStNEmOpvMA = (Valueerror_Gi06FkNeykJn7mrqRZYrkA*) nimrtl_newObj((&NTI_yCEN9anxCD6mzBxGjuaRBdg), sizeof(Valueerror_Gi06FkNeykJn7mrqRZYrkA));
						(*e_hkSGTDR06p6gStNEmOpvMA).Sup.Sup.m_type = (&NTI_Gi06FkNeykJn7mrqRZYrkA);
						LOC24 = (NimStringDesc*)0;
						LOC24 = (*e_hkSGTDR06p6gStNEmOpvMA).Sup.message; (*e_hkSGTDR06p6gStNEmOpvMA).Sup.message = nimrtl_copyStringRC1(((NimStringDesc*) &T_7lAtbav61D2a8Y3CNxNADw_6));
						if (LOC24) nimGCunrefNoCycle(LOC24);
						nimrtl_raiseException((Exception*)e_hkSGTDR06p6gStNEmOpvMA, "ValueError");
					}
					LA19: ;
					nroaddRope(&result0, args0[(NI)(j0 - ((NI) 1))]);
				}
				break;
				default:
				{
					Valueerror_Gi06FkNeykJn7mrqRZYrkA* e_hkSGTDR06p6gStNEmOpvMA_2;
					NimStringDesc* LOC26;
					e_hkSGTDR06p6gStNEmOpvMA_2 = (Valueerror_Gi06FkNeykJn7mrqRZYrkA*)0;
					e_hkSGTDR06p6gStNEmOpvMA_2 = (Valueerror_Gi06FkNeykJn7mrqRZYrkA*) nimrtl_newObj((&NTI_yCEN9anxCD6mzBxGjuaRBdg), sizeof(Valueerror_Gi06FkNeykJn7mrqRZYrkA));
					(*e_hkSGTDR06p6gStNEmOpvMA_2).Sup.Sup.m_type = (&NTI_Gi06FkNeykJn7mrqRZYrkA);
					LOC26 = (NimStringDesc*)0;
					LOC26 = (*e_hkSGTDR06p6gStNEmOpvMA_2).Sup.message; (*e_hkSGTDR06p6gStNEmOpvMA_2).Sup.message = nimrtl_copyStringRC1(((NimStringDesc*) &T_7lAtbav61D2a8Y3CNxNADw_6));
					if (LOC26) nimGCunrefNoCycle(LOC26);
					nimrtl_raiseException((Exception*)e_hkSGTDR06p6gStNEmOpvMA_2, "ValueError");
				}
				break;
				}
			}
			LA5: ;
			start0 = i0;
			{
				while (1) {
					if (!(i0 < length0)) goto LA28;
					{
						if (!!(((NU8)(frmt0->data[i0]) == (NU8)(36)))) goto LA31;
						i0 += ((NI) 1);
					}
					goto LA29;
					LA31: ;
					{
						goto LA27;
					}
					LA29: ;
				} LA28: ;
			} LA27: ;
			{
				NimStringDesc* LOC38;
				if (!(start0 <= (NI)(i0 - ((NI) 1)))) goto LA36;
				LOC38 = (NimStringDesc*)0;
				LOC38 = copyStrLast(frmt0, start0, (NI)(i0 - ((NI) 1)));
				nroaddStr(&result0, LOC38);
			}
			LA36: ;
		} LA2: ;
	}
	return result0;
}

N_LIB_EXPORT N_CDECL(void, nroaddf)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw** c0, NimStringDesc* frmt0, Ropeobj_pk4sC5H3E9ceov4bEasyPVw** args0, NI args0Len0) {
	Ropeobj_pk4sC5H3E9ceov4bEasyPVw* LOC1;
	LOC1 = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*)0;
	LOC1 = nroFormat(frmt0, args0, args0Len0);
	nroaddRope(c0, LOC1);
}

static N_INLINE(NIM_BOOL, equalmem_DCrUjdaMvFDHaR1hs7sQGwstrutils)(void* a0, void* b0, NI size0) {
	NIM_BOOL result0;
	int LOC1;
	result0 = (NIM_BOOL)0;
	LOC1 = (int)0;
	LOC1 = memcmp(a0, b0, ((size_t) (size0)));
	result0 = (LOC1 == ((NI32) 0));
	return result0;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nroequalsFileFile)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0, FILE* f0) {
	NIM_BOOL result0;
	TY_9bKy7UA2LOi2vzOViufaW1Q buf0;
	NI bpos0;
	NI blen0;
	NI LOC27;
{	result0 = (NIM_BOOL)0;
	memset((void*)buf0, 0, sizeof(buf0));
	bpos0 = ((NI) 1024);
	blen0 = ((NI) 1024);
	{
		NimStringDesc* s_o0ny1wkBAJgA9b2hW9bffYoQ;
		s_o0ny1wkBAJgA9b2hW9bffYoQ = (NimStringDesc*)0;
		{
			TY_xyYfiXqv9bXR7uHakYC9cy3A* stack_sXhGwkA0tbYr4saNMM5G2g;
			TY_ezQ7zQIr6HCZDV3txRgZxQ LOC6;
			if (!!((r0 == NIM_NIL))) goto LA4;
			stack_sXhGwkA0tbYr4saNMM5G2g = (TY_xyYfiXqv9bXR7uHakYC9cy3A*) nimrtl_newSeq((&NTI_xyYfiXqv9bXR7uHakYC9cy3A), 1);
			memset((void*)LOC6, 0, sizeof(LOC6));
			LOC6[0] = r0;
			asgnRefNoCycle((void**) (&stack_sXhGwkA0tbYr4saNMM5G2g->data[0]), LOC6[0]);
			{
				while (1) {
					Ropeobj_pk4sC5H3E9ceov4bEasyPVw* it_ZvcZVO6jvE5Ap8WCwfb4qA;
					NI spos0;
					NI slen0;
					if (!(((NI) 0) < (stack_sXhGwkA0tbYr4saNMM5G2g ? stack_sXhGwkA0tbYr4saNMM5G2g->Sup.len : 0))) goto LA8;
					it_ZvcZVO6jvE5Ap8WCwfb4qA = pop_ty7pjOMAEzlk2hF5VjHEsAropes((&stack_sXhGwkA0tbYr4saNMM5G2g));
					{
						while (1) {
							NIM_BOOL LOC11;
							LOC11 = (NIM_BOOL)0;
							LOC11 = isconc_XZ8qsVA5ELaAT0pRYWW5Ywropes(it_ZvcZVO6jvE5Ap8WCwfb4qA);
							if (!LOC11) goto LA10;
							stack_sXhGwkA0tbYr4saNMM5G2g = (TY_xyYfiXqv9bXR7uHakYC9cy3A*) incrSeqV2(&(stack_sXhGwkA0tbYr4saNMM5G2g)->Sup, sizeof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*));
							asgnRefNoCycle((void**) (&stack_sXhGwkA0tbYr4saNMM5G2g->data[stack_sXhGwkA0tbYr4saNMM5G2g->Sup.len]), (*it_ZvcZVO6jvE5Ap8WCwfb4qA).right);
							++stack_sXhGwkA0tbYr4saNMM5G2g->Sup.len;
							it_ZvcZVO6jvE5Ap8WCwfb4qA = (*it_ZvcZVO6jvE5Ap8WCwfb4qA).left;
						} LA10: ;
					}
					s_o0ny1wkBAJgA9b2hW9bffYoQ = (*it_ZvcZVO6jvE5Ap8WCwfb4qA).data;
					spos0 = ((NI) 0);
					slen0 = (s_o0ny1wkBAJgA9b2hW9bffYoQ ? s_o0ny1wkBAJgA9b2hW9bffYoQ->Sup.len : 0);
					{
						while (1) {
							NI n0;
							if (!(spos0 < slen0)) goto LA13;
							{
								if (!(bpos0 == blen0)) goto LA16;
								bpos0 = ((NI) 0);
								blen0 = readbuffer_nZ0pNe9cd9cXtoayexCiaDtA(f0, ((void*) ((&buf0[(((NI) 0))- 0]))), ((NI) 1024));
								{
									if (!(blen0 == ((NI) 0))) goto LA20;
									result0 = NIM_FALSE;
									goto BeforeRet;
								}
								LA20: ;
							}
							LA16: ;
							n0 = (((NI)(blen0 - bpos0) <= (NI)(slen0 - spos0)) ? (NI)(blen0 - bpos0) : (NI)(slen0 - spos0));
							{
								NIM_BOOL LOC24;
								LOC24 = (NIM_BOOL)0;
								LOC24 = equalmem_DCrUjdaMvFDHaR1hs7sQGwstrutils(((void*) ((&buf0[(bpos0)- 0]))), ((void*) ((NI)(((NI) (s_o0ny1wkBAJgA9b2hW9bffYoQ->data)) + spos0))), ((NI) (n0)));
								if (!!(LOC24)) goto LA25;
								result0 = NIM_FALSE;
								goto BeforeRet;
							}
							LA25: ;
							spos0 += n0;
							bpos0 += n0;
						} LA13: ;
					}
				} LA8: ;
			}
		}
		LA4: ;
	}
	LOC27 = (NI)0;
	LOC27 = readbuffer_nZ0pNe9cd9cXtoayexCiaDtA(f0, ((void*) ((&buf0[(((NI) 0))- 0]))), ((NI) 1));
	result0 = (LOC27 == ((NI) 0));
	}BeforeRet: ;
	return result0;
}

N_LIB_EXPORT N_CDECL(NIM_BOOL, nroequalsFileStr)(Ropeobj_pk4sC5H3E9ceov4bEasyPVw* r0, NimStringDesc* filename0) {
	NIM_BOOL result0;
	FILE* f0;
	result0 = (NIM_BOOL)0;
	f0 = (FILE*)0;
	result0 = open_sEp0GH2306oGo9bqBpj5oTQ(&f0, filename0, ((Filemode_fVUBHvW79bXUw1j55Oo9avSQ) 0), ((NI) -1));
	{
		if (!result0) goto LA3;
		result0 = nroequalsFileFile(r0, f0);
		close_BWnr8V7RERYno9bIdPmw8Hw(f0);
	}
	LA3: ;
	return result0;
}
NIM_EXTERNC N_NOINLINE(void, stdlib_ropesInit000)(void) {
nimRegisterGlobalMarker(T_7lAtbav61D2a8Y3CNxNADw_3);
nimRegisterGlobalMarker(T_7lAtbav61D2a8Y3CNxNADw_4);
	cacheenabled_Tx9b9cwni2VzCnsN5eGrePhg = NIM_FALSE;
	if (N_Exgp9asfFKZJfhz9bzz9bL89cg) nimGCunrefNoCycle(N_Exgp9asfFKZJfhz9bzz9bL89cg);
	N_Exgp9asfFKZJfhz9bzz9bL89cg = (Ropeobj_pk4sC5H3E9ceov4bEasyPVw*) nimrtl_newObjRC1((&NTI_VYsfqmmqchsY5XzU9aJJBBA), sizeof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw));
}

NIM_EXTERNC N_NOINLINE(void, stdlib_ropesDatInit000)(void) {
static TNimNode* T_7lAtbav61D2a8Y3CNxNADw_2[4];
static TNimNode T_7lAtbav61D2a8Y3CNxNADw_0[5];
NTI_pk4sC5H3E9ceov4bEasyPVw.size = sizeof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw);
NTI_pk4sC5H3E9ceov4bEasyPVw.kind = 18;
NTI_pk4sC5H3E9ceov4bEasyPVw.base = 0;
NTI_pk4sC5H3E9ceov4bEasyPVw.flags = 2;
T_7lAtbav61D2a8Y3CNxNADw_2[0] = &T_7lAtbav61D2a8Y3CNxNADw_0[1];
T_7lAtbav61D2a8Y3CNxNADw_0[1].kind = 1;
T_7lAtbav61D2a8Y3CNxNADw_0[1].offset = offsetof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw, left);
T_7lAtbav61D2a8Y3CNxNADw_0[1].typ = (&NTI_VYsfqmmqchsY5XzU9aJJBBA);
T_7lAtbav61D2a8Y3CNxNADw_0[1].name = "left";
T_7lAtbav61D2a8Y3CNxNADw_2[1] = &T_7lAtbav61D2a8Y3CNxNADw_0[2];
T_7lAtbav61D2a8Y3CNxNADw_0[2].kind = 1;
T_7lAtbav61D2a8Y3CNxNADw_0[2].offset = offsetof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw, right);
T_7lAtbav61D2a8Y3CNxNADw_0[2].typ = (&NTI_VYsfqmmqchsY5XzU9aJJBBA);
T_7lAtbav61D2a8Y3CNxNADw_0[2].name = "right";
T_7lAtbav61D2a8Y3CNxNADw_2[2] = &T_7lAtbav61D2a8Y3CNxNADw_0[3];
T_7lAtbav61D2a8Y3CNxNADw_0[3].kind = 1;
T_7lAtbav61D2a8Y3CNxNADw_0[3].offset = offsetof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw, length);
T_7lAtbav61D2a8Y3CNxNADw_0[3].typ = (&NTI_rR5Bzr1D5krxoo1NcNyeMA);
T_7lAtbav61D2a8Y3CNxNADw_0[3].name = "length";
T_7lAtbav61D2a8Y3CNxNADw_2[3] = &T_7lAtbav61D2a8Y3CNxNADw_0[4];
T_7lAtbav61D2a8Y3CNxNADw_0[4].kind = 1;
T_7lAtbav61D2a8Y3CNxNADw_0[4].offset = offsetof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw, data);
T_7lAtbav61D2a8Y3CNxNADw_0[4].typ = (&NTI_77mFvmsOLKik79ci2hXkHEg);
T_7lAtbav61D2a8Y3CNxNADw_0[4].name = "data";
T_7lAtbav61D2a8Y3CNxNADw_0[0].len = 4; T_7lAtbav61D2a8Y3CNxNADw_0[0].kind = 2; T_7lAtbav61D2a8Y3CNxNADw_0[0].sons = &T_7lAtbav61D2a8Y3CNxNADw_2[0];
NTI_pk4sC5H3E9ceov4bEasyPVw.node = &T_7lAtbav61D2a8Y3CNxNADw_0[0];
NTI_VYsfqmmqchsY5XzU9aJJBBA.size = sizeof(Ropeobj_pk4sC5H3E9ceov4bEasyPVw*);
NTI_VYsfqmmqchsY5XzU9aJJBBA.kind = 22;
NTI_VYsfqmmqchsY5XzU9aJJBBA.base = (&NTI_pk4sC5H3E9ceov4bEasyPVw);
NTI_VYsfqmmqchsY5XzU9aJJBBA.flags = 2;
NTI_VYsfqmmqchsY5XzU9aJJBBA.marker = Marker_TY_VYsfqmmqchsY5XzU9aJJBBA;
}

