/* Generated by Nimrod Compiler v0.9.4 */
/*   (c) 2014 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, i386, gcc */
/* Command for C compiler:
   gcc -c  -w  -I/build/nimrod/src/nimrod/lib -o nimcache/stdlib_strutils.o nimcache/stdlib_strutils.c */
#define NIM_INTBITS 32
#include "nimbase.h"

#include <string.h>
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct einvalidvalue2453 einvalidvalue2453;
typedef struct esynch2429 esynch2429;
typedef struct E_Base E_Base;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tcell41290 tcell41290;
typedef struct tcellseq41306 tcellseq41306;
typedef struct tgcheap43216 tgcheap43216;
typedef struct tcellset41302 tcellset41302;
typedef struct tpagedesc41298 tpagedesc41298;
typedef struct tmemregion23610 tmemregion23610;
typedef struct tsmallchunk22838 tsmallchunk22838;
typedef struct tllchunk23604 tllchunk23604;
typedef struct tbigchunk22840 tbigchunk22840;
typedef struct tintset22815 tintset22815;
typedef struct ttrunk22811 ttrunk22811;
typedef struct tavlnode23608 tavlnode23608;
typedef struct tgcstat43214 tgcstat43214;
typedef struct tbasechunk22836 tbasechunk22836;
typedef struct tfreecell22828 tfreecell22828;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 TY89161[32];
typedef NI tskiptable89032[256];
typedef N_NIMCALL_PTR(void, TY2289) (void* p, NI op);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY2289 marker;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  E_Base  {
  TNimObject Sup;
E_Base* parent;
NCSTRING name;
NimStringDesc* message;
NimStringDesc* trace;
};
struct  esynch2429  {
  E_Base Sup;
};
struct  einvalidvalue2453  {
  esynch2429 Sup;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tcell41290  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq41306  {
NI Len;
NI Cap;
tcell41290** D;
};
struct  tcellset41302  {
NI Counter;
NI Max;
tpagedesc41298* Head;
tpagedesc41298** Data;
};
typedef tsmallchunk22838* TY23622[512];
typedef ttrunk22811* ttrunkbuckets22813[256];
struct  tintset22815  {
ttrunkbuckets22813 Data;
};
struct  tmemregion23610  {
NI Minlargeobj;
NI Maxlargeobj;
TY23622 Freesmallchunks;
tllchunk23604* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk22840* Freechunkslist;
tintset22815 Chunkstarts;
tavlnode23608* Root;
tavlnode23608* Deleted;
tavlnode23608* Last;
tavlnode23608* Freeavlnodes;
};
struct  tgcstat43214  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap43216  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq41306 Zct;
tcellseq41306 Decstack;
tcellset41302 Cycleroots;
tcellseq41306 Tempstack;
NI Recgclock;
tmemregion23610 Region;
tgcstat43214 Stat;
};
typedef NimStringDesc* TY128024[1];
typedef NI TY22818[16];
struct  tpagedesc41298  {
tpagedesc41298* Next;
NI Key;
TY22818 Bits;
};
struct  tbasechunk22836  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk22838  {
  tbasechunk22836 Sup;
tsmallchunk22838* Next;
tsmallchunk22838* Prev;
tfreecell22828* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk23604  {
NI Size;
NI Acc;
tllchunk23604* Next;
};
struct  tbigchunk22840  {
  tbasechunk22836 Sup;
tbigchunk22840* Next;
tbigchunk22840* Prev;
NI Align;
NF Data;
};
struct  ttrunk22811  {
ttrunk22811* Next;
NI Key;
TY22818 Bits;
};
typedef tavlnode23608* TY23614[2];
struct  tavlnode23608  {
TY23614 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  tfreecell22828  {
tfreecell22828* Next;
NI Zerofield;
};
N_NOINLINE(void, raiseOverflow)(void);
N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
static N_INLINE(NI, subInt)(NI a, NI b);
static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(NI, addInt)(NI a, NI b);
static N_INLINE(void, nimFrame)(TFrame* s);
static N_INLINE(void, popFrame)(void);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
N_NOINLINE(void, raiseIndexError)(void);
N_NIMCALL(NI, nsuFindCharSet)(NimStringDesc* s, TY89161 chars, NI start);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_70824, NI last);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI first, NI last);
N_NIMCALL(NIM_CHAR, nsuToLowerChar)(NIM_CHAR c);
static N_INLINE(NI, chckRange)(NI i, NI a, NI b);
N_NOINLINE(void, raiseRangeError)(NI64 val);
N_NIMCALL(void, failedassertimpl_79821)(NimStringDesc* msg);
N_NIMCALL(void, preprocesssub_89036)(NimStringDesc* sub, NI* a);
N_NIMCALL(NI, findaux_89076)(NimStringDesc* s, NimStringDesc* sub, NI start, tskiptable89032 a);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI start);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI first);
N_NIMCALL(NI, mulInt)(NI a, NI b);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(void, nsuAddf)(NimStringDesc** s, NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NOINLINE(void, invalidformatstring_90625)(void);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(tcell41290*, usrtocell_44643)(void* usr);
static N_INLINE(void, rtladdzct_46202)(tcell41290* c);
N_NOINLINE(void, addzct_44618)(tcellseq41306* s, tcell41290* c);
N_NIMCALL(void, raiseException)(E_Base* e, NCSTRING ename);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(NI, findnormalized_90598)(NimStringDesc* x, NimStringDesc** inarray, NI inarrayLen0);
N_NIMCALL(NI, nsuCmpIgnoreStyle)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newlen);
static NIM_CONST TY89161 TMP255 = {
0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
;
STRING_LITERAL(TMP331, "len(a) == L string modified while iterating over it", 51);
STRING_LITERAL(TMP334, "", 0);
STRING_LITERAL(TMP400, "invalid format string", 21);
extern TFrame* frameptr_13038;
extern TNimType NTI18001; /* ref EInvalidValue */
extern TNimType NTI2453; /* EInvalidValue */
extern tgcheap43216 gch_43244;

static N_INLINE(NI, subInt)(NI a, NI b) {
	NI result;
	result = 0;
	result = (NI)((NU32)(a) - (NU32)(b));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (0 <= (NI)(result ^ a));
		if (LOC3) goto LA4;
		LOC3 = (0 <= (NI)(result ^ (NI)((NU32) ~(b))));
		LA4: ;
		if (!LOC3) goto LA5;
		goto BeforeRet;
	}
	LA5: ;
	raiseOverflow();
	BeforeRet: ;
	return result;
}

static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c) {
	(*dest).data[((*dest).Sup.len)- 0] = c;
	(*dest).data[((NI32)((*dest).Sup.len + 1))- 0] = 0;
	(*dest).Sup.len += 1;
}

static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	memcpy(((NCSTRING) (&(*dest).data[((*dest).Sup.len)- 0])), ((NCSTRING) ((*src).data)), (NI32)((*src).Sup.len + 1));
	(*dest).Sup.len += (*src).Sup.len;
}

static N_INLINE(NI, addInt)(NI a, NI b) {
	NI result;
	result = 0;
	result = (NI)((NU32)(a) + (NU32)(b));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (0 <= (NI)(result ^ a));
		if (LOC3) goto LA4;
		LOC3 = (0 <= (NI)(result ^ b));
		LA4: ;
		if (!LOC3) goto LA5;
		goto BeforeRet;
	}
	LA5: ;
	raiseOverflow();
	BeforeRet: ;
	return result;
}

static N_INLINE(void, nimFrame)(TFrame* s) {
	(*s).prev = frameptr_13038;
	frameptr_13038 = s;
}

static N_INLINE(void, popFrame)(void) {
	frameptr_13038 = (*frameptr_13038).prev;
}

N_NIMCALL(NimStringDesc*, nsuIntToStr)(NI x, NI minchars) {
	NimStringDesc* result;
	NI i_88116;
	NI HEX3Atmp_88118;
	NI TMP162;
	NI res_88120;
	nimfr("intToStr", "strutils.nim")
	result = 0;
	nimln(371, "strutils.nim");
	nimln(371, "strutils.nim");
	nimln(371, "strutils.nim");
	if (x == (-2147483647 -1)) raiseOverflow();
	result = nimIntToStr((NI32)abs(x));
	i_88116 = 0;
	HEX3Atmp_88118 = 0;
	nimln(372, "strutils.nim");
	nimln(372, "strutils.nim");
	nimln(372, "strutils.nim");
	TMP162 = subInt(minchars, result->Sup.len);
	HEX3Atmp_88118 = (NI32)(TMP162);
	nimln(1458, "system.nim");
	res_88120 = 1;
	nimln(1459, "system.nim");
	while (1) {
		NimStringDesc* LOC2;
		nimln(1459, "system.nim");
		if (!(res_88120 <= HEX3Atmp_88118)) goto LA1;
		nimln(1458, "system.nim");
		i_88116 = res_88120;
		nimln(373, "strutils.nim");
		nimln(373, "strutils.nim");
		LOC2 = 0;
		LOC2 = rawNewString(result->Sup.len + 1);
appendChar(LOC2, 48);
appendString(LOC2, result);
		result = LOC2;
		nimln(1461, "system.nim");
		res_88120 = addInt(res_88120, 1);
	} LA1: ;
	nimln(374, "strutils.nim");
	{
		NimStringDesc* LOC7;
		nimln(374, "strutils.nim");
		if (!(x < 0)) goto LA5;
		nimln(375, "strutils.nim");
		nimln(375, "strutils.nim");
		LOC7 = 0;
		LOC7 = rawNewString(result->Sup.len + 1);
appendChar(LOC7, 45);
appendString(LOC7, result);
		result = LOC7;
	}
	LA5: ;
	popFrame();
	return result;
}

N_NIMCALL(NimStringDesc*, nsuRepeatChar)(NI count, NIM_CHAR c) {
	NimStringDesc* result;
	NI i_88463;
	NI HEX3Atmp_88464;
	NI TMP223;
	NI res_88466;
	nimfr("repeatChar", "strutils.nim")
	result = 0;
	nimln(464, "strutils.nim");
	nimln(464, "strutils.nim");
	result = mnewString(count);
	i_88463 = 0;
	HEX3Atmp_88464 = 0;
	nimln(465, "strutils.nim");
	nimln(465, "strutils.nim");
	TMP223 = subInt(count, 1);
	HEX3Atmp_88464 = (NI32)(TMP223);
	nimln(1458, "system.nim");
	res_88466 = 0;
	nimln(1459, "system.nim");
	while (1) {
		nimln(1459, "system.nim");
		if (!(res_88466 <= HEX3Atmp_88464)) goto LA1;
		nimln(1458, "system.nim");
		i_88463 = res_88466;
		nimln(465, "strutils.nim");
		if ((NU)(i_88463) > (NU)(result->Sup.len)) raiseIndexError();
		result->data[i_88463] = c;
		nimln(1461, "system.nim");
		res_88466 = addInt(res_88466, 1);
	} LA1: ;
	popFrame();
	return result;
}

N_NIMCALL(NI, nsuFindCharSet)(NimStringDesc* s, TY89161 chars, NI start) {
	NI result;
	NI i_89175;
	NI HEX3Atmp_89189;
	NI TMP254;
	NI res_89191;
	nimfr("find", "strutils.nim")
	result = 0;
	i_89175 = 0;
	HEX3Atmp_89189 = 0;
	nimln(724, "strutils.nim");
	nimln(724, "strutils.nim");
	nimln(724, "strutils.nim");
	TMP254 = subInt(s->Sup.len, 1);
	HEX3Atmp_89189 = (NI32)(TMP254);
	nimln(1458, "system.nim");
	res_89191 = start;
	nimln(1459, "system.nim");
	while (1) {
		nimln(1459, "system.nim");
		if (!(res_89191 <= HEX3Atmp_89189)) goto LA1;
		nimln(1458, "system.nim");
		i_89175 = res_89191;
		nimln(725, "strutils.nim");
		{
			nimln(725, "strutils.nim");
			if ((NU)(i_89175) > (NU)(s->Sup.len)) raiseIndexError();
			if (!((chars[((NU8)(s->data[i_89175]))/8] &(1<<(((NU8)(s->data[i_89175]))%8)))!=0)) goto LA4;
			nimln(725, "strutils.nim");
			nimln(725, "strutils.nim");
			result = i_89175;
			goto BeforeRet;
		}
		LA4: ;
		nimln(1461, "system.nim");
		res_89191 = addInt(res_89191, 1);
	} LA1: ;
	nimln(726, "strutils.nim");
	nimln(726, "strutils.nim");
	result = -1;
	goto BeforeRet;
	BeforeRet: ;
	popFrame();
	return result;
}

N_NIMCALL(NimStringDesc*, quoteifcontainswhite_89237)(NimStringDesc* s) {
	NimStringDesc* result;
	nimfr("quoteIfContainsWhite", "strutils.nim")
	result = 0;
	nimln(747, "strutils.nim");
	{
		NIM_BOOL LOC3;
		NI LOC4;
		NimStringDesc* LOC8;
		nimln(747, "strutils.nim");
		LOC3 = 0;
		nimln(747, "strutils.nim");
		nimln(747, "strutils.nim");
		LOC4 = 0;
		LOC4 = nsuFindCharSet(s, TMP255, 0);
		LOC3 = (0 <= LOC4);
		if (!(LOC3)) goto LA5;
		nimln(747, "strutils.nim");
		nimln(747, "strutils.nim");
		if ((NU)(0) > (NU)(s->Sup.len)) raiseIndexError();
		LOC3 = !(((NU8)(s->data[0]) == (NU8)(34)));
		LA5: ;
		if (!LOC3) goto LA6;
		nimln(748, "strutils.nim");
		nimln(748, "strutils.nim");
		LOC8 = 0;
		LOC8 = rawNewString(s->Sup.len + 2);
appendChar(LOC8, 34);
appendString(LOC8, s);
appendChar(LOC8, 34);
		result = LOC8;
	}
	goto LA1;
	LA6: ;
	{
		nimln(750, "strutils.nim");
		result = copyString(s);
	}
	LA1: ;
	popFrame();
	return result;
}

N_NIMCALL(NimStringDesc*, nsuStrip)(NimStringDesc* s, NIM_BOOL leading, NIM_BOOL trailing) {
	NimStringDesc* result;
	NI first;
	NI last;
	NI TMP260;
	nimfr("strip", "strutils.nim")
	result = 0;
	nimln(161, "strutils.nim");
	first = 0;
	nimln(162, "strutils.nim");
	nimln(162, "strutils.nim");
	nimln(162, "strutils.nim");
	TMP260 = subInt(s->Sup.len, 1);
	last = (NI32)(TMP260);
	nimln(163, "strutils.nim");
	{
		if (!leading) goto LA3;
		nimln(164, "strutils.nim");
		while (1) {
			nimln(164, "strutils.nim");
			if ((NU)(first) > (NU)(s->Sup.len)) raiseIndexError();
			if (!(((NU8)(s->data[first])) == ((NU8)(32)) || ((NU8)(s->data[first])) == ((NU8)(9)) || ((NU8)(s->data[first])) == ((NU8)(11)) || ((NU8)(s->data[first])) == ((NU8)(13)) || ((NU8)(s->data[first])) == ((NU8)(10)) || ((NU8)(s->data[first])) == ((NU8)(12)))) goto LA5;
			nimln(164, "strutils.nim");
			first = addInt(first, 1);
		} LA5: ;
	}
	LA3: ;
	nimln(165, "strutils.nim");
	{
		if (!trailing) goto LA8;
		nimln(166, "strutils.nim");
		while (1) {
			NIM_BOOL LOC11;
			nimln(166, "strutils.nim");
			LOC11 = 0;
			nimln(166, "strutils.nim");
			LOC11 = (0 <= last);
			if (!(LOC11)) goto LA12;
			nimln(166, "strutils.nim");
			if ((NU)(last) > (NU)(s->Sup.len)) raiseIndexError();
			LOC11 = (((NU8)(s->data[last])) == ((NU8)(32)) || ((NU8)(s->data[last])) == ((NU8)(9)) || ((NU8)(s->data[last])) == ((NU8)(11)) || ((NU8)(s->data[last])) == ((NU8)(13)) || ((NU8)(s->data[last])) == ((NU8)(10)) || ((NU8)(s->data[last])) == ((NU8)(12)));
			LA12: ;
			if (!LOC11) goto LA10;
			nimln(166, "strutils.nim");
			last = subInt(last, 1);
		} LA10: ;
	}
	LA8: ;
	nimln(167, "strutils.nim");
	nimln(167, "strutils.nim");
	result = copyStrLast(s, first, last);
	popFrame();
	return result;
}

static N_INLINE(NI, chckRange)(NI i, NI a, NI b) {
	NI result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (a <= i);
		if (!(LOC3)) goto LA4;
		LOC3 = (i <= b);
		LA4: ;
		if (!LOC3) goto LA5;
		result = i;
		goto BeforeRet;
	}
	goto LA1;
	LA5: ;
	{
		raiseRangeError(((NI64) (i)));
	}
	LA1: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_CHAR, nsuToLowerChar)(NIM_CHAR c) {
	NIM_CHAR result;
	nimfr("toLower", "strutils.nim")
	result = 0;
	nimln(62, "strutils.nim");
	{
		NI TMP273;
		nimln(62, "strutils.nim");
		if (!(((NU8)(c)) >= ((NU8)(65)) && ((NU8)(c)) <= ((NU8)(90)))) goto LA3;
		nimln(63, "strutils.nim");
		nimln(63, "strutils.nim");
		nimln(63, "strutils.nim");
		nimln(63, "strutils.nim");
		TMP273 = addInt(((NI) (((NU8)(c)))), 32);
		result = ((NIM_CHAR) (((NI)chckRange((NI32)(TMP273), 0, 255))));
	}
	goto LA1;
	LA3: ;
	{
		nimln(65, "strutils.nim");
		result = c;
	}
	LA1: ;
	popFrame();
	return result;
}

N_NIMCALL(NI, nsuCmpIgnoreCase)(NimStringDesc* a, NimStringDesc* b) {
	NI result;
	NI i;
	NI m;
	NI TMP275;
	nimfr("cmpIgnoreCase", "strutils.nim")
	result = 0;
	nimln(120, "strutils.nim");
	i = 0;
	nimln(121, "strutils.nim");
	nimln(121, "strutils.nim");
	nimln(121, "strutils.nim");
	nimln(121, "strutils.nim");
	m = ((a->Sup.len <= b->Sup.len) ? a->Sup.len : b->Sup.len);
	nimln(122, "strutils.nim");
	while (1) {
		NIM_CHAR LOC2;
		NIM_CHAR LOC3;
		NI TMP274;
		nimln(122, "strutils.nim");
		if (!(i < m)) goto LA1;
		nimln(123, "strutils.nim");
		nimln(123, "strutils.nim");
		nimln(123, "strutils.nim");
		nimln(123, "strutils.nim");
		if ((NU)(i) > (NU)(a->Sup.len)) raiseIndexError();
		LOC2 = 0;
		LOC2 = nsuToLowerChar(a->data[i]);
		nimln(123, "strutils.nim");
		nimln(123, "strutils.nim");
		if ((NU)(i) > (NU)(b->Sup.len)) raiseIndexError();
		LOC3 = 0;
		LOC3 = nsuToLowerChar(b->data[i]);
		TMP274 = subInt(((NI) (((NU8)(LOC2)))), ((NI) (((NU8)(LOC3)))));
		result = (NI32)(TMP274);
		nimln(124, "strutils.nim");
		{
			nimln(124, "strutils.nim");
			nimln(124, "strutils.nim");
			if (!!((result == 0))) goto LA6;
			nimln(124, "strutils.nim");
			goto BeforeRet;
		}
		LA6: ;
		nimln(125, "strutils.nim");
		i = addInt(i, 1);
	} LA1: ;
	nimln(126, "strutils.nim");
	nimln(126, "strutils.nim");
	nimln(126, "strutils.nim");
	nimln(126, "strutils.nim");
	TMP275 = subInt(a->Sup.len, b->Sup.len);
	result = (NI32)(TMP275);
	BeforeRet: ;
	popFrame();
	return result;
}

N_NIMCALL(NI, nsuCmpIgnoreStyle)(NimStringDesc* a, NimStringDesc* b) {
	NI result;
	NI i;
	NI j;
	nimfr("cmpIgnoreStyle", "strutils.nim")
	result = 0;
	i = 0;
	j = 0;
	while (1) {
		NIM_CHAR aa;
		NIM_CHAR bb;
		while (1) {
			if (!((NU8)(a->data[i]) == (NU8)(95))) goto LA2;
			i += 1;
		} LA2: ;
		while (1) {
			if (!((NU8)(b->data[j]) == (NU8)(95))) goto LA3;
			j += 1;
		} LA3: ;
		aa = nsuToLowerChar(a->data[i]);
		bb = nsuToLowerChar(b->data[j]);
		result = (NI32)(((NI) (((NU8)(aa)))) - ((NI) (((NU8)(bb)))));
		{
			NIM_BOOL LOC6;
			LOC6 = 0;
			LOC6 = !((result == 0));
			if (LOC6) goto LA7;
			LOC6 = ((NU8)(aa) == (NU8)(0));
			LA7: ;
			if (!LOC6) goto LA8;
			goto LA1;
		}
		LA8: ;
		i += 1;
		j += 1;
	} LA1: ;
	popFrame();
	return result;
}

N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix) {
	NIM_BOOL result;
	NI i;
	nimfr("startsWith", "strutils.nim")
	result = 0;
	nimln(588, "strutils.nim");
	i = 0;
	nimln(589, "strutils.nim");
	while (1) {
		nimln(590, "strutils.nim");
		{
			nimln(590, "strutils.nim");
			if ((NU)(i) > (NU)(prefix->Sup.len)) raiseIndexError();
			if (!((NU8)(prefix->data[i]) == (NU8)(0))) goto LA4;
			nimln(590, "strutils.nim");
			nimln(590, "strutils.nim");
			result = NIM_TRUE;
			goto BeforeRet;
		}
		LA4: ;
		nimln(591, "strutils.nim");
		{
			nimln(591, "strutils.nim");
			nimln(591, "strutils.nim");
			if ((NU)(i) > (NU)(s->Sup.len)) raiseIndexError();
			if ((NU)(i) > (NU)(prefix->Sup.len)) raiseIndexError();
			if (!!(((NU8)(s->data[i]) == (NU8)(prefix->data[i])))) goto LA8;
			nimln(591, "strutils.nim");
			nimln(591, "strutils.nim");
			result = NIM_FALSE;
			goto BeforeRet;
		}
		LA8: ;
		nimln(592, "strutils.nim");
		i = addInt(i, 1);
	}
	BeforeRet: ;
	popFrame();
	return result;
}

N_NIMCALL(NI, nsuFindChar)(NimStringDesc* s, NIM_CHAR sub, NI start) {
	NI result;
	NI i_89150;
	NI HEX3Atmp_89151;
	NI TMP289;
	NI res_89153;
	nimfr("find", "strutils.nim")
	result = 0;
	i_89150 = 0;
	HEX3Atmp_89151 = 0;
	nimln(716, "strutils.nim");
	nimln(716, "strutils.nim");
	nimln(716, "strutils.nim");
	TMP289 = subInt(s->Sup.len, 1);
	HEX3Atmp_89151 = (NI32)(TMP289);
	nimln(1458, "system.nim");
	res_89153 = start;
	nimln(1459, "system.nim");
	while (1) {
		nimln(1459, "system.nim");
		if (!(res_89153 <= HEX3Atmp_89151)) goto LA1;
		nimln(1458, "system.nim");
		i_89150 = res_89153;
		nimln(717, "strutils.nim");
		{
			nimln(717, "strutils.nim");
			if ((NU)(i_89150) > (NU)(s->Sup.len)) raiseIndexError();
			if (!((NU8)(sub) == (NU8)(s->data[i_89150]))) goto LA4;
			nimln(717, "strutils.nim");
			nimln(717, "strutils.nim");
			result = i_89150;
			goto BeforeRet;
		}
		LA4: ;
		nimln(1461, "system.nim");
		res_89153 = addInt(res_89153, 1);
	} LA1: ;
	nimln(718, "strutils.nim");
	nimln(718, "strutils.nim");
	result = -1;
	goto BeforeRet;
	BeforeRet: ;
	popFrame();
	return result;
}

N_NIMCALL(NIM_BOOL, contains_89258)(NimStringDesc* s, TY89161 chars) {
	NIM_BOOL result;
	NI LOC1;
	nimfr("contains", "strutils.nim")
	result = 0;
	nimln(762, "strutils.nim");
	nimln(762, "strutils.nim");
	nimln(762, "strutils.nim");
	nimln(762, "strutils.nim");
	LOC1 = 0;
	LOC1 = nsuFindCharSet(s, chars, 0);
	result = (0 <= LOC1);
	goto BeforeRet;
	BeforeRet: ;
	popFrame();
	return result;
}

N_NIMCALL(NIM_BOOL, allcharsinset_88836)(NimStringDesc* s, TY89161 theset) {
	NIM_BOOL result;
	NIM_CHAR c_88841;
	NI i_88856;
	NI l_88858;
	nimfr("allCharsInSet", "strutils.nim")
	result = 0;
	c_88841 = 0;
	nimln(2805, "system.nim");
	i_88856 = 0;
	nimln(2806, "system.nim");
	nimln(2806, "system.nim");
	l_88858 = s->Sup.len;
	nimln(2807, "system.nim");
	while (1) {
		nimln(2807, "system.nim");
		if (!(i_88856 < l_88858)) goto LA1;
		nimln(2808, "system.nim");
		if ((NU)(i_88856) > (NU)(s->Sup.len)) raiseIndexError();
		c_88841 = s->data[i_88856];
		nimln(638, "strutils.nim");
		{
			nimln(638, "strutils.nim");
			nimln(638, "strutils.nim");
			if (!!(((theset[((NU8)(c_88841))/8] &(1<<(((NU8)(c_88841))%8)))!=0))) goto LA4;
			nimln(638, "strutils.nim");
			nimln(638, "strutils.nim");
			result = NIM_FALSE;
			goto BeforeRet;
		}
		LA4: ;
		nimln(2809, "system.nim");
		i_88856 = addInt(i_88856, 1);
		nimln(2810, "system.nim");
		{
			nimln(2810, "system.nim");
			nimln(2810, "system.nim");
			nimln(2810, "system.nim");
			if (!!((s->Sup.len == l_88858))) goto LA8;
			nimln(2810, "system.nim");
			failedassertimpl_79821(((NimStringDesc*) &TMP331));
		}
		LA8: ;
	} LA1: ;
	nimln(639, "strutils.nim");
	nimln(639, "strutils.nim");
	result = NIM_TRUE;
	goto BeforeRet;
	BeforeRet: ;
	popFrame();
	return result;
}

N_NIMCALL(void, preprocesssub_89036)(NimStringDesc* sub, NI* a) {
	NI m;
	NI i_89053;
	NI res_89066;
	NI i_89064;
	NI HEX3Atmp_89068;
	NI TMP336;
	NI res_89070;
	nimfr("preprocessSub", "strutils.nim")
	nimln(685, "strutils.nim");
	nimln(685, "strutils.nim");
	m = sub->Sup.len;
	i_89053 = 0;
	nimln(1458, "system.nim");
	res_89066 = 0;
	nimln(1459, "system.nim");
	while (1) {
		NI TMP335;
		nimln(1459, "system.nim");
		if (!(res_89066 <= 255)) goto LA1;
		nimln(1458, "system.nim");
		i_89053 = res_89066;
		nimln(686, "strutils.nim");
		nimln(686, "strutils.nim");
		nimln(686, "strutils.nim");
		TMP335 = addInt(m, 1);
		a[(((NU8)(((NIM_CHAR) (((NI)chckRange(i_89053, 0, 255)))))))- 0] = (NI32)(TMP335);
		nimln(1461, "system.nim");
		res_89066 = addInt(res_89066, 1);
	} LA1: ;
	i_89064 = 0;
	HEX3Atmp_89068 = 0;
	nimln(687, "strutils.nim");
	nimln(687, "strutils.nim");
	TMP336 = subInt(m, 1);
	HEX3Atmp_89068 = (NI32)(TMP336);
	nimln(1458, "system.nim");
	res_89070 = 0;
	nimln(1459, "system.nim");
	while (1) {
		NI TMP337;
		nimln(1459, "system.nim");
		if (!(res_89070 <= HEX3Atmp_89068)) goto LA2;
		nimln(1458, "system.nim");
		i_89064 = res_89070;
		nimln(687, "strutils.nim");
		if ((NU)(i_89064) > (NU)(sub->Sup.len)) raiseIndexError();
		nimln(687, "strutils.nim");
		TMP337 = subInt(m, i_89064);
		a[(((NU8)(sub->data[i_89064])))- 0] = (NI32)(TMP337);
		nimln(1461, "system.nim");
		res_89070 = addInt(res_89070, 1);
	} LA2: ;
	popFrame();
}

N_NIMCALL(NI, findaux_89076)(NimStringDesc* s, NimStringDesc* sub, NI start, tskiptable89032 a) {
	NI result;
	NI m;
	NI n;
	NI j;
	nimfr("findAux", "strutils.nim")
	result = 0;
	nimln(692, "strutils.nim");
	nimln(692, "strutils.nim");
	m = sub->Sup.len;
	nimln(693, "strutils.nim");
	nimln(693, "strutils.nim");
	n = s->Sup.len;
	nimln(695, "strutils.nim");
	j = start;
	nimln(696, "strutils.nim");
	while (1) {
		NI TMP338;
		NI TMP341;
		nimln(696, "strutils.nim");
		nimln(696, "strutils.nim");
		TMP338 = subInt(n, m);
		if (!(j <= (NI32)(TMP338))) goto LA1;
		{
			NI k_89097;
			NI HEX3Atmp_89114;
			NI TMP339;
			NI res_89116;
			k_89097 = 0;
			HEX3Atmp_89114 = 0;
			nimln(698, "strutils.nim");
			nimln(698, "strutils.nim");
			TMP339 = subInt(m, 1);
			HEX3Atmp_89114 = (NI32)(TMP339);
			nimln(1458, "system.nim");
			res_89116 = 0;
			nimln(1459, "system.nim");
			while (1) {
				nimln(1459, "system.nim");
				if (!(res_89116 <= HEX3Atmp_89114)) goto LA3;
				nimln(1458, "system.nim");
				k_89097 = res_89116;
				nimln(699, "strutils.nim");
				{
					NI TMP340;
					nimln(699, "strutils.nim");
					nimln(699, "strutils.nim");
					if ((NU)(k_89097) > (NU)(sub->Sup.len)) raiseIndexError();
					nimln(699, "strutils.nim");
					TMP340 = addInt(k_89097, j);
					if ((NU)((NI32)(TMP340)) > (NU)(s->Sup.len)) raiseIndexError();
					if (!!(((NU8)(sub->data[k_89097]) == (NU8)(s->data[(NI32)(TMP340)])))) goto LA6;
					nimln(699, "strutils.nim");
					goto LA2;
				}
				LA6: ;
				nimln(1461, "system.nim");
				res_89116 = addInt(res_89116, 1);
			} LA3: ;
			nimln(700, "strutils.nim");
			nimln(700, "strutils.nim");
			result = j;
			goto BeforeRet;
		} LA2: ;
		nimln(701, "strutils.nim");
		nimln(701, "strutils.nim");
		TMP341 = addInt(j, m);
		if ((NU)((NI32)(TMP341)) > (NU)(s->Sup.len)) raiseIndexError();
		j = addInt(j, a[(((NU8)(s->data[(NI32)(TMP341)])))- 0]);
	} LA1: ;
	nimln(702, "strutils.nim");
	nimln(702, "strutils.nim");
	result = -1;
	goto BeforeRet;
	BeforeRet: ;
	popFrame();
	return result;
}

N_NIMCALL(NimStringDesc*, nsuReplaceStr)(NimStringDesc* s, NimStringDesc* sub, NimStringDesc* by) {
	NimStringDesc* result;
	tskiptable89032 a;
	NI i;
	NimStringDesc* LOC7;
	nimfr("replace", "strutils.nim")
	result = 0;
	nimln(768, "strutils.nim");
	result = copyString(((NimStringDesc*) &TMP334));
	nimln(769, "strutils.nim");
	preprocesssub_89036(sub, a);
	nimln(770, "strutils.nim");
	i = 0;
	nimln(771, "strutils.nim");
	while (1) {
		NI j;
		NI TMP342;
		NimStringDesc* LOC6;
		NI TMP343;
		nimln(772, "strutils.nim");
		j = findaux_89076(s, sub, i, a);
		nimln(773, "strutils.nim");
		{
			nimln(773, "strutils.nim");
			if (!(j < 0)) goto LA4;
			nimln(773, "strutils.nim");
			goto LA1;
		}
		LA4: ;
		nimln(774, "strutils.nim");
		nimln(774, "strutils.nim");
		nimln(774, "strutils.nim");
		TMP342 = subInt(j, 1);
		LOC6 = 0;
		LOC6 = copyStrLast(s, i, (NI32)(TMP342));
		result = resizeString(result, LOC6->Sup.len + 0);
appendString(result, LOC6);
		nimln(775, "strutils.nim");
		result = resizeString(result, by->Sup.len + 0);
appendString(result, by);
		nimln(776, "strutils.nim");
		nimln(776, "strutils.nim");
		nimln(776, "strutils.nim");
		TMP343 = addInt(j, sub->Sup.len);
		i = (NI32)(TMP343);
	} LA1: ;
	nimln(778, "strutils.nim");
	nimln(778, "strutils.nim");
	LOC7 = 0;
	LOC7 = copyStr(s, i);
	result = resizeString(result, LOC7->Sup.len + 0);
appendString(result, LOC7);
	popFrame();
	return result;
}

N_NIMCALL(NimStringDesc*, nsuJoinSep)(NimStringDesc** a, NI aLen0, NimStringDesc* sep) {
	NimStringDesc* result;
	nimfr("join", "strutils.nim")
	result = 0;
	nimln(659, "strutils.nim");
	{
		NI l;
		NI TMP381;
		NI TMP382;
		NI i_88927;
		NI HEX3Atmp_88955;
		NI res_88957;
		NI i_88954;
		NI HEX3Atmp_88959;
		NI res_88961;
		nimln(659, "strutils.nim");
		nimln(659, "strutils.nim");
		if (!(0 < aLen0)) goto LA3;
		nimln(660, "strutils.nim");
		nimln(660, "strutils.nim");
		nimln(660, "strutils.nim");
		nimln(660, "strutils.nim");
		nimln(660, "strutils.nim");
		TMP381 = subInt(aLen0, 1);
		TMP382 = mulInt(sep->Sup.len, (NI32)(TMP381));
		l = (NI32)(TMP382);
		i_88927 = 0;
		HEX3Atmp_88955 = 0;
		nimln(661, "strutils.nim");
		nimln(661, "strutils.nim");
		HEX3Atmp_88955 = (aLen0-1);
		nimln(1458, "system.nim");
		res_88957 = 0;
		nimln(1459, "system.nim");
		while (1) {
			nimln(1459, "system.nim");
			if (!(res_88957 <= HEX3Atmp_88955)) goto LA5;
			nimln(1458, "system.nim");
			i_88927 = res_88957;
			nimln(661, "strutils.nim");
			nimln(661, "strutils.nim");
			if ((NU)(i_88927) >= (NU)(aLen0)) raiseIndexError();
			l = addInt(l, a[i_88927]->Sup.len);
			nimln(1461, "system.nim");
			res_88957 = addInt(res_88957, 1);
		} LA5: ;
		nimln(662, "strutils.nim");
		nimln(662, "strutils.nim");
		result = rawNewString(l);
		nimln(663, "strutils.nim");
		if ((NU)(0) >= (NU)(aLen0)) raiseIndexError();
		result = resizeString(result, a[0]->Sup.len + 0);
appendString(result, a[0]);
		i_88954 = 0;
		HEX3Atmp_88959 = 0;
		nimln(664, "strutils.nim");
		nimln(664, "strutils.nim");
		HEX3Atmp_88959 = (aLen0-1);
		nimln(1458, "system.nim");
		res_88961 = 1;
		nimln(1459, "system.nim");
		while (1) {
			nimln(1459, "system.nim");
			if (!(res_88961 <= HEX3Atmp_88959)) goto LA6;
			nimln(1458, "system.nim");
			i_88954 = res_88961;
			nimln(665, "strutils.nim");
			result = resizeString(result, sep->Sup.len + 0);
appendString(result, sep);
			nimln(666, "strutils.nim");
			if ((NU)(i_88954) >= (NU)(aLen0)) raiseIndexError();
			result = resizeString(result, a[i_88954]->Sup.len + 0);
appendString(result, a[i_88954]);
			nimln(1461, "system.nim");
			res_88961 = addInt(res_88961, 1);
		} LA6: ;
	}
	goto LA1;
	LA3: ;
	{
		nimln(668, "strutils.nim");
		result = copyString(((NimStringDesc*) &TMP334));
	}
	LA1: ;
	popFrame();
	return result;
}

static N_INLINE(tcell41290*, usrtocell_44643)(void* usr) {
	tcell41290* result;
	nimfr("usrToCell", "gc.nim")
	result = 0;
	nimln(118, "gc.nim");
	nimln(118, "gc.nim");
	nimln(118, "gc.nim");
	result = ((tcell41290*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(tcell41290))))));
	popFrame();
	return result;
}

static N_INLINE(void, rtladdzct_46202)(tcell41290* c) {
	nimfr("rtlAddZCT", "gc.nim")
	nimln(199, "gc.nim");
	addzct_44618(&gch_43244.Zct, c);
	popFrame();
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tcell41290* c;
	nimfr("nimGCunrefNoCycle", "gc.nim")
	nimln(233, "gc.nim");
	c = usrtocell_44643(p);
	nimln(235, "gc.nim");
	{
		nimln(167, "gc.nim");
		(*c).Refcount -= 8;
		nimln(168, "gc.nim");
		if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA3;
		nimln(236, "gc.nim");
		rtladdzct_46202(c);
	}
	LA3: ;
	popFrame();
}

N_NOINLINE(void, invalidformatstring_90625)(void) {
	einvalidvalue2453* e_90629;
	NimStringDesc* LOC1;
	nimfr("invalidFormatString", "strutils.nim")
	e_90629 = 0;
	nimln(1992, "system.nim");
	e_90629 = (einvalidvalue2453*) newObj((&NTI18001), sizeof(einvalidvalue2453));
	(*e_90629).Sup.Sup.Sup.m_type = (&NTI2453);
	nimln(1993, "system.nim");
	LOC1 = 0;
	LOC1 = (*e_90629).Sup.Sup.message; (*e_90629).Sup.Sup.message = copyStringRC1(((NimStringDesc*) &TMP400));
	if (LOC1) nimGCunrefNoCycle(LOC1);
	nimln(1140, "strutils.nim");
	raiseException((E_Base*)e_90629, "EInvalidValue");
	popFrame();
}

N_NIMCALL(NI, findnormalized_90598)(NimStringDesc* x, NimStringDesc** inarray, NI inarrayLen0) {
	NI result;
	NI i;
	nimfr("findNormalized", "strutils.nim")
	result = 0;
	nimln(1132, "strutils.nim");
	i = 0;
	nimln(1133, "strutils.nim");
	while (1) {
		nimln(1133, "strutils.nim");
		nimln(1133, "strutils.nim");
		if (!(i < (inarrayLen0-1))) goto LA1;
		nimln(1134, "strutils.nim");
		{
			NI LOC4;
			nimln(1134, "strutils.nim");
			nimln(1134, "strutils.nim");
			if ((NU)(i) >= (NU)(inarrayLen0)) raiseIndexError();
			LOC4 = 0;
			LOC4 = nsuCmpIgnoreStyle(x, inarray[i]);
			if (!(LOC4 == 0)) goto LA5;
			nimln(1134, "strutils.nim");
			nimln(1134, "strutils.nim");
			result = i;
			goto BeforeRet;
		}
		LA5: ;
		nimln(1135, "strutils.nim");
		i = addInt(i, 2);
	} LA1: ;
	nimln(1137, "strutils.nim");
	nimln(1137, "strutils.nim");
	result = -1;
	goto BeforeRet;
	BeforeRet: ;
	popFrame();
	return result;
}

N_NIMCALL(void, nsuAddf)(NimStringDesc** s, NimStringDesc* formatstr, NimStringDesc** a, NI aLen0) {
	NI i;
	NI num;
	nimfr("addf", "strutils.nim")
	nimln(1146, "strutils.nim");
	i = 0;
	nimln(1147, "strutils.nim");
	num = 0;
	nimln(1148, "strutils.nim");
	while (1) {
		nimln(1148, "strutils.nim");
		nimln(1148, "strutils.nim");
		if (!(i < formatstr->Sup.len)) goto LA1;
		nimln(1149, "strutils.nim");
		{
			NI TMP399;
			nimln(1149, "strutils.nim");
			if ((NU)(i) > (NU)(formatstr->Sup.len)) raiseIndexError();
			if (!((NU8)(formatstr->data[i]) == (NU8)(36))) goto LA4;
			nimln(1150, "strutils.nim");
			nimln(1150, "strutils.nim");
			TMP399 = addInt(i, 1);
			if ((NU)((NI32)(TMP399)) > (NU)(formatstr->Sup.len)) raiseIndexError();
			switch (((NU8)(formatstr->data[(NI32)(TMP399)]))) {
			case 35:
			{
				nimln(1153, "strutils.nim");
				{
					nimln(1153, "strutils.nim");
					nimln(1153, "strutils.nim");
					if (!((NU32)((aLen0-1)) < (NU32)(num))) goto LA9;
					nimln(1153, "strutils.nim");
					invalidformatstring_90625();
				}
				LA9: ;
				nimln(1154, "strutils.nim");
				if ((NU)(num) >= (NU)(aLen0)) raiseIndexError();
				(*s) = resizeString((*s), a[num]->Sup.len + 0);
appendString((*s), a[num]);
				nimln(1155, "strutils.nim");
				i = addInt(i, 2);
				nimln(1156, "strutils.nim");
				num = addInt(num, 1);
			}
			break;
			case 36:
			{
				nimln(1158, "strutils.nim");
				(*s) = addChar((*s), 36);
				nimln(1159, "strutils.nim");
				i = addInt(i, 2);
			}
			break;
			case 49 ... 57:
			case 45:
			{
				NI j;
				NIM_BOOL negative;
				NI idx;
				nimln(1161, "strutils.nim");
				j = 0;
				nimln(1162, "strutils.nim");
				i = addInt(i, 1);
				nimln(1163, "strutils.nim");
				nimln(1163, "strutils.nim");
				if ((NU)(i) > (NU)(formatstr->Sup.len)) raiseIndexError();
				negative = ((NU8)(formatstr->data[i]) == (NU8)(45));
				nimln(1164, "strutils.nim");
				{
					if (!negative) goto LA15;
					nimln(1164, "strutils.nim");
					i = addInt(i, 1);
				}
				LA15: ;
				nimln(1165, "strutils.nim");
				while (1) {
					NI TMP401;
					NI TMP402;
					NI TMP403;
					nimln(1165, "strutils.nim");
					if ((NU)(i) > (NU)(formatstr->Sup.len)) raiseIndexError();
					if (!(((NU8)(formatstr->data[i])) >= ((NU8)(48)) && ((NU8)(formatstr->data[i])) <= ((NU8)(57)))) goto LA17;
					nimln(1166, "strutils.nim");
					nimln(1166, "strutils.nim");
					nimln(1166, "strutils.nim");
					nimln(1166, "strutils.nim");
					TMP401 = mulInt(j, 10);
					nimln(1166, "strutils.nim");
					if ((NU)(i) > (NU)(formatstr->Sup.len)) raiseIndexError();
					TMP402 = addInt((NI32)(TMP401), ((NI) (((NU8)(formatstr->data[i])))));
					TMP403 = subInt((NI32)(TMP402), 48);
					j = (NI32)(TMP403);
					nimln(1167, "strutils.nim");
					i = addInt(i, 1);
				} LA17: ;
				nimln(1168, "strutils.nim");
				nimln(1168, "strutils.nim");
				{
					NI TMP404;
					nimln(1168, "strutils.nim");
					if (!!(negative)) goto LA20;
					nimln(1168, "strutils.nim");
					TMP404 = subInt(j, 1);
					idx = (NI32)(TMP404);
				}
				goto LA18;
				LA20: ;
				{
					NI TMP405;
					nimln(1168, "strutils.nim");
					nimln(1168, "strutils.nim");
					TMP405 = subInt(aLen0, j);
					idx = (NI32)(TMP405);
				}
				LA18: ;
				nimln(1169, "strutils.nim");
				{
					nimln(1169, "strutils.nim");
					nimln(1169, "strutils.nim");
					if (!((NU32)((aLen0-1)) < (NU32)(idx))) goto LA25;
					nimln(1169, "strutils.nim");
					invalidformatstring_90625();
				}
				LA25: ;
				nimln(1170, "strutils.nim");
				if ((NU)(idx) >= (NU)(aLen0)) raiseIndexError();
				(*s) = resizeString((*s), a[idx]->Sup.len + 0);
appendString((*s), a[idx]);
			}
			break;
			case 123:
			{
				NI j;
				NI TMP406;
				NI x;
				NI TMP407;
				NI TMP408;
				NimStringDesc* LOC29;
				NI TMP410;
				nimln(1172, "strutils.nim");
				nimln(1172, "strutils.nim");
				TMP406 = addInt(i, 1);
				j = (NI32)(TMP406);
				nimln(1173, "strutils.nim");
				while (1) {
					nimln(1173, "strutils.nim");
					nimln(1173, "strutils.nim");
					if ((NU)(j) > (NU)(formatstr->Sup.len)) raiseIndexError();
					if (!!((((NU8)(formatstr->data[j])) == ((NU8)(0)) || ((NU8)(formatstr->data[j])) == ((NU8)(125))))) goto LA28;
					nimln(1173, "strutils.nim");
					j = addInt(j, 1);
				} LA28: ;
				nimln(1174, "strutils.nim");
				nimln(1174, "strutils.nim");
				nimln(1174, "strutils.nim");
				TMP407 = addInt(i, 2);
				nimln(1174, "strutils.nim");
				TMP408 = subInt(j, 1);
				LOC29 = 0;
				LOC29 = copyStrLast(formatstr, (NI32)(TMP407), (NI32)(TMP408));
				x = findnormalized_90598(LOC29, a, aLen0);
				nimln(1175, "strutils.nim");
				{
					NIM_BOOL LOC32;
					NI TMP409;
					nimln(1175, "strutils.nim");
					LOC32 = 0;
					nimln(1175, "strutils.nim");
					LOC32 = (0 <= x);
					if (!(LOC32)) goto LA33;
					nimln(1175, "strutils.nim");
					nimln(1175, "strutils.nim");
					LOC32 = (x < (aLen0-1));
					LA33: ;
					if (!LOC32) goto LA34;
					nimln(1175, "strutils.nim");
					nimln(1175, "strutils.nim");
					TMP409 = addInt(x, 1);
					if ((NU)((NI32)(TMP409)) >= (NU)(aLen0)) raiseIndexError();
					(*s) = resizeString((*s), a[(NI32)(TMP409)]->Sup.len + 0);
appendString((*s), a[(NI32)(TMP409)]);
				}
				goto LA30;
				LA34: ;
				{
					nimln(1176, "strutils.nim");
					invalidformatstring_90625();
				}
				LA30: ;
				nimln(1177, "strutils.nim");
				nimln(1177, "strutils.nim");
				TMP410 = addInt(j, 1);
				i = (NI32)(TMP410);
			}
			break;
			case 97 ... 122:
			case 65 ... 90:
			case 128 ... 255:
			case 95:
			{
				NI j;
				NI TMP411;
				NI x;
				NI TMP412;
				NI TMP413;
				NimStringDesc* LOC39;
				nimln(1179, "strutils.nim");
				nimln(1179, "strutils.nim");
				TMP411 = addInt(i, 1);
				j = (NI32)(TMP411);
				nimln(1180, "strutils.nim");
				while (1) {
					nimln(1180, "strutils.nim");
					if ((NU)(j) > (NU)(formatstr->Sup.len)) raiseIndexError();
					if (!(((NU8)(formatstr->data[j])) >= ((NU8)(97)) && ((NU8)(formatstr->data[j])) <= ((NU8)(122)) || ((NU8)(formatstr->data[j])) >= ((NU8)(65)) && ((NU8)(formatstr->data[j])) <= ((NU8)(90)) || ((NU8)(formatstr->data[j])) >= ((NU8)(48)) && ((NU8)(formatstr->data[j])) <= ((NU8)(57)) || ((NU8)(formatstr->data[j])) >= ((NU8)(128)) && ((NU8)(formatstr->data[j])) <= ((NU8)(255)) || ((NU8)(formatstr->data[j])) == ((NU8)(95)))) goto LA38;
					nimln(1180, "strutils.nim");
					j = addInt(j, 1);
				} LA38: ;
				nimln(1181, "strutils.nim");
				nimln(1181, "strutils.nim");
				nimln(1181, "strutils.nim");
				TMP412 = addInt(i, 1);
				nimln(1181, "strutils.nim");
				TMP413 = subInt(j, 1);
				LOC39 = 0;
				LOC39 = copyStrLast(formatstr, (NI32)(TMP412), (NI32)(TMP413));
				x = findnormalized_90598(LOC39, a, aLen0);
				nimln(1182, "strutils.nim");
				{
					NIM_BOOL LOC42;
					NI TMP414;
					nimln(1182, "strutils.nim");
					LOC42 = 0;
					nimln(1182, "strutils.nim");
					LOC42 = (0 <= x);
					if (!(LOC42)) goto LA43;
					nimln(1182, "strutils.nim");
					nimln(1182, "strutils.nim");
					LOC42 = (x < (aLen0-1));
					LA43: ;
					if (!LOC42) goto LA44;
					nimln(1182, "strutils.nim");
					nimln(1182, "strutils.nim");
					TMP414 = addInt(x, 1);
					if ((NU)((NI32)(TMP414)) >= (NU)(aLen0)) raiseIndexError();
					(*s) = resizeString((*s), a[(NI32)(TMP414)]->Sup.len + 0);
appendString((*s), a[(NI32)(TMP414)]);
				}
				goto LA40;
				LA44: ;
				{
					nimln(1183, "strutils.nim");
					invalidformatstring_90625();
				}
				LA40: ;
				nimln(1184, "strutils.nim");
				i = j;
			}
			break;
			default:
			{
				nimln(1186, "strutils.nim");
				invalidformatstring_90625();
			}
			break;
			}
		}
		goto LA2;
		LA4: ;
		{
			nimln(1188, "strutils.nim");
			if ((NU)(i) > (NU)(formatstr->Sup.len)) raiseIndexError();
			(*s) = addChar((*s), formatstr->data[i]);
			nimln(1189, "strutils.nim");
			i = addInt(i, 1);
		}
		LA2: ;
	} LA1: ;
	popFrame();
}

N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0) {
	NimStringDesc* result;
	NI TMP398;
	nimfr("%", "strutils.nim")
	result = 0;
	nimln(1231, "strutils.nim");
	nimln(1231, "strutils.nim");
	nimln(1231, "strutils.nim");
	nimln(1231, "strutils.nim");
	nimln(1231, "strutils.nim");
	nimln(1231, "strutils.nim");
	TMP398 = addInt(formatstr->Sup.len, (NI)((NU32)(aLen0) << (NU32)(4)));
	result = rawNewString((NI32)(TMP398));
	nimln(1232, "strutils.nim");
	nsuAddf(&result, formatstr, a, aLen0);
	popFrame();
	return result;
}

N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a) {
	NimStringDesc* result;
	NI TMP429;
	TY128024 LOC1;
	nimfr("%", "strutils.nim")
	result = 0;
	nimln(1237, "strutils.nim");
	nimln(1237, "strutils.nim");
	nimln(1237, "strutils.nim");
	nimln(1237, "strutils.nim");
	nimln(1237, "strutils.nim");
	TMP429 = addInt(formatstr->Sup.len, a->Sup.len);
	result = rawNewString((NI32)(TMP429));
	nimln(1238, "strutils.nim");
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC1[0] = copyString(a);
	nsuAddf(&result, formatstr, LOC1, 1);
	popFrame();
	return result;
}

N_NIMCALL(NimStringDesc*, nsuNormalize)(NimStringDesc* s) {
	NimStringDesc* result;
	NI j;
	NI i_86982;
	NI HEX3Atmp_87056;
	NI TMP506;
	NI res_87058;
	nimfr("normalize", "strutils.nim")
	result = 0;
	nimln(102, "strutils.nim");
	nimln(102, "strutils.nim");
	nimln(102, "strutils.nim");
	result = mnewString(s->Sup.len);
	nimln(103, "strutils.nim");
	j = 0;
	i_86982 = 0;
	HEX3Atmp_87056 = 0;
	nimln(104, "strutils.nim");
	nimln(104, "strutils.nim");
	nimln(104, "strutils.nim");
	TMP506 = subInt(s->Sup.len, 1);
	HEX3Atmp_87056 = (NI32)(TMP506);
	nimln(1458, "system.nim");
	res_87058 = 0;
	nimln(1459, "system.nim");
	while (1) {
		nimln(1459, "system.nim");
		if (!(res_87058 <= HEX3Atmp_87056)) goto LA1;
		nimln(1458, "system.nim");
		i_86982 = res_87058;
		nimln(105, "strutils.nim");
		{
			NI TMP507;
			nimln(105, "strutils.nim");
			if ((NU)(i_86982) > (NU)(s->Sup.len)) raiseIndexError();
			if (!(((NU8)(s->data[i_86982])) >= ((NU8)(65)) && ((NU8)(s->data[i_86982])) <= ((NU8)(90)))) goto LA4;
			nimln(106, "strutils.nim");
			if ((NU)(j) > (NU)(result->Sup.len)) raiseIndexError();
			nimln(106, "strutils.nim");
			nimln(106, "strutils.nim");
			nimln(106, "strutils.nim");
			if ((NU)(i_86982) > (NU)(s->Sup.len)) raiseIndexError();
			TMP507 = addInt(((NI) (((NU8)(s->data[i_86982])))), 32);
			result->data[j] = ((NIM_CHAR) (((NI)chckRange((NI32)(TMP507), 0, 255))));
			nimln(107, "strutils.nim");
			j = addInt(j, 1);
		}
		goto LA2;
		LA4: ;
		{
			nimln(108, "strutils.nim");
			nimln(108, "strutils.nim");
			if ((NU)(i_86982) > (NU)(s->Sup.len)) raiseIndexError();
			if (!!(((NU8)(s->data[i_86982]) == (NU8)(95)))) goto LA7;
			nimln(109, "strutils.nim");
			if ((NU)(j) > (NU)(result->Sup.len)) raiseIndexError();
			if ((NU)(i_86982) > (NU)(s->Sup.len)) raiseIndexError();
			result->data[j] = s->data[i_86982];
			nimln(110, "strutils.nim");
			j = addInt(j, 1);
		}
		goto LA2;
		LA7: ;
		LA2: ;
		nimln(1461, "system.nim");
		res_87058 = addInt(res_87058, 1);
	} LA1: ;
	nimln(111, "strutils.nim");
	{
		nimln(111, "strutils.nim");
		nimln(111, "strutils.nim");
		nimln(111, "strutils.nim");
		if (!!((j == s->Sup.len))) goto LA11;
		nimln(111, "strutils.nim");
		result = setLengthStr(result, j);
	}
	LA11: ;
	popFrame();
	return result;
}
N_NOINLINE(void, stdlibstrutilsInit)(void) {
	nimfr("strutils", "strutils.nim")
	popFrame();
}

N_NOINLINE(void, stdlibstrutilsDatInit)(void) {
}

