/* Generated by Nim Compiler v0.12.0 */
/*   (c) 2015 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 32

#include "nimbase.h"
#include <string.h>
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Jsonparser323013 Jsonparser323013;
typedef struct Baselexer281024 Baselexer281024;
typedef struct TNimObject TNimObject;
typedef struct Streamobj149427 Streamobj149427;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct TY323063 TY323063;
typedef struct Jsonparsingerror324756 Jsonparsingerror324756;
typedef struct Valueerror4049 Valueerror4049;
typedef struct Exception Exception;
typedef struct Cell48947 Cell48947;
typedef struct Cellseq48963 Cellseq48963;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48959 Cellset48959;
typedef struct Pagedesc48955 Pagedesc48955;
typedef struct Memregion30890 Memregion30890;
typedef struct Smallchunk30842 Smallchunk30842;
typedef struct Llchunk30884 Llchunk30884;
typedef struct Bigchunk30844 Bigchunk30844;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30888 Avlnode30888;
typedef struct Gcstat51014 Gcstat51014;
typedef struct Jsonnodeobj324754 Jsonnodeobj324754;
typedef struct TY325284 TY325284;
typedef struct TY324769 TY324769;
typedef struct TY324774 TY324774;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef N_NIMCALL_PTR(void, TY3889) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3894) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3889 marker;
TY3894 deepcopy;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  TNimObject  {
TNimType* m_type;
};
typedef NU8 TY212407[32];
struct  Baselexer281024  {
  TNimObject Sup;
NI bufpos;
NCSTRING buf;
NI buflen;
Streamobj149427* input;
NI linenumber;
NI sentinel;
NI linestart;
TY212407 refillchars;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Jsonparser323013  {
  Baselexer281024 Sup;
NimStringDesc* a;
NU8 tok;
NU8 kind;
NU8 err;
TY323063* state;
NimStringDesc* filename;
};
struct  Exception  {
  TNimObject Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
NimStringDesc* trace;
};
struct  Valueerror4049  {
  Exception Sup;
};
struct  Jsonparsingerror324756  {
  Valueerror4049 Sup;
};
typedef NimStringDesc* TY193829[4];
struct  Cell48947  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48963  {
NI len;
NI cap;
Cell48947** d;
};
struct  Cellset48959  {
NI counter;
NI max;
Pagedesc48955* head;
Pagedesc48955** data;
};
typedef Smallchunk30842* TY30905[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30890  {
NI minlargeobj;
NI maxlargeobj;
TY30905 freesmallchunks;
Llchunk30884* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30844* freechunkslist;
Intset30817 chunkstarts;
Avlnode30888* root;
Avlnode30888* deleted;
Avlnode30888* last;
Avlnode30888* freeavlnodes;
};
struct  Gcstat51014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap51018  {
Gcstack51016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq48963 zct;
Cellseq48963 decstack;
Cellset48959 cycleroots;
Cellseq48963 tempstack;
NI recgclock;
Memregion30890 region;
Gcstat51014 stat;
};
struct TY325284 {
NimStringDesc* Field0;
Jsonnodeobj324754* Field1;
};
struct  Jsonnodeobj324754  {
NU8 kind;
union{
struct {NimStringDesc* str;
} S1;
struct {NI64 num;
} S2;
struct {NF fnum;
} S3;
struct {NIM_BOOL bval;
} S4;
struct {TY324769* fields;
} S6;
struct {TY324774* elems;
} S7;
} kindU;
};
typedef N_NIMCALL_PTR(void, TY149428) (Streamobj149427* s);
typedef N_NIMCALL_PTR(NIM_BOOL, TY149432) (Streamobj149427* s);
typedef N_NIMCALL_PTR(void, TY149436) (Streamobj149427* s, NI pos);
typedef N_NIMCALL_PTR(NI, TY149441) (Streamobj149427* s);
typedef N_NIMCALL_PTR(NI, TY149445) (Streamobj149427* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(NI, TY149451) (Streamobj149427* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(void, TY149457) (Streamobj149427* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(void, TY149463) (Streamobj149427* s);
struct  Streamobj149427  {
  TNimObject Sup;
TY149428 closeimpl;
TY149432 atendimpl;
TY149436 setpositionimpl;
TY149441 getpositionimpl;
TY149445 readdataimpl;
TY149451 peekdataimpl;
TY149457 writedataimpl;
TY149463 flushimpl;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30821[16];
struct  Pagedesc48955  {
Pagedesc48955* next;
NI key;
TY30821 bits;
};
struct  Basechunk30840  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30842  {
  Basechunk30840 Sup;
Smallchunk30842* next;
Smallchunk30842* prev;
Freecell30832* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30884  {
NI size;
NI acc;
Llchunk30884* next;
};
struct  Bigchunk30844  {
  Basechunk30840 Sup;
Bigchunk30844* next;
Bigchunk30844* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30821 bits;
};
typedef Avlnode30888* TY30895[2];
struct  Avlnode30888  {
TY30895 link;
NI key;
NI upperbound;
NI level;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct TY323063 {
  TGenericSeq Sup;
  NU8 data[SEQ_DECL_SIZE];
};
struct TY324769 {
  TGenericSeq Sup;
  TY325284 data[SEQ_DECL_SIZE];
};
struct TY324774 {
  TGenericSeq Sup;
  Jsonnodeobj324754* data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, TMP3057)(void* p, NI op);
N_NIMCALL(void, open_282635)(Baselexer281024* L, Streamobj149427* input, NI buflen, TY212407 refillchars);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_85804, TNimType* mt);
N_NIMCALL(NU8, gettok_324370)(Jsonparser323013* my);
N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newlen);
N_NIMCALL(void, skip_324069)(Jsonparser323013* my);
N_NIMCALL(NI, handlecr_282007)(Baselexer281024* L, NI pos);
N_NIMCALL(NI, handlelf_282216)(Baselexer281024* L, NI pos);
N_NIMCALL(void, parsenumber_324165)(Jsonparser323013* my);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_NIMCALL(NIM_BOOL, contains_103975)(NimStringDesc* s, TY212407 chars);
N_NIMCALL(NU8, parsestring_323938)(Jsonparser323013* my);
N_NIMCALL(NI, parseescapedutf16_323889)(NCSTRING buf, NI* pos);
N_NIMCALL(NIM_BOOL, handlehexchar_323822)(NIM_CHAR c, NI* x);
static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(NimStringDesc*, nuctoUTF8)(NI c);
N_NIMCALL(void, parsename_324322)(Jsonparser323013* my);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize);
static N_INLINE(NU8, pop_324556)(TY323063** s);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, next_324446)(Jsonparser323013* my);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3071)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(NimStringDesc*, errormsgexpected_323809)(Jsonparser323013* my, NimStringDesc* e);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
static N_INLINE(NI, getline_323627)(Jsonparser323013* my);
N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
static N_INLINE(NI, getcolumn_323617)(Jsonparser323013* my);
N_NIMCALL(NI, getcolnumber_283008)(Baselexer281024* L, NI pos);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell48947*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48947* c);
N_NOINLINE(void, addzct_52617)(Cellseq48963* s, Cell48947* c);
N_NIMCALL(void, raiseException)(Exception* e, NCSTRING ename);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(NimStringDesc*, nsuToHex)(NI64 x, NI len);
N_NIMCALL(void, TMP5155)(void* p, NI op);
N_NIMCALL(void, TMP5156)(void* p, NI op);
N_NIMCALL(void, TMP5157)(void* p, NI op);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len);
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_325713)(TY324774* x, TY324774* y);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_325817)(TY324769* x, TY324769* y);
N_NIMCALL(void, topretty_328932)(NimStringDesc** result, Jsonnodeobj324754* node, NI indent, NIM_BOOL ml, NIM_BOOL lstarr, NI currindent);
N_NIMCALL(void, nl_328884)(NimStringDesc** s, NIM_BOOL ml);
N_NIMCALL(void, indent_328861)(NimStringDesc** s, NI i);
N_NIMCALL(NimStringDesc*, nsuRepeatChar)(NIM_CHAR c, NI count);
N_NIMCALL(NI, newindent_328872)(NI curr, NI indent, NIM_BOOL ml);
N_NIMCALL(NimStringDesc*, escapejson_328895)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, nimInt64ToStr)(NI64 x);
N_NIMCALL(NimStringDesc*, nimFloatToStr)(NF f);
N_NIMCALL(NimStringDesc*, nimBoolToStr)(NIM_BOOL x);
N_NIMCALL(NI, len_326106)(Jsonnodeobj324754* n);
N_NIMCALL(void, tougly_329058)(NimStringDesc** result, Jsonnodeobj324754* node);
static NIM_CONST TY212407 TMP3058 = {
0x00, 0x24, 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, 0x00, 0x00, 0x00}
;
NIM_CONST struct {
  TGenericSeq Sup;
  NU8 data[1];
} CNSTSEQ3061 = {{1, 1}, {((NU8) 1)}};
NIM_CONST TY323063* TMP3059 = ((TY323063*)&CNSTSEQ3061);
STRING_LITERAL(TMP3061, "", 0);
STRING_LITERAL(TMP3065, "0.", 2);
static NIM_CONST TY212407 TMP3066 = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
;
STRING_LITERAL(TMP3067, "\\u", 2);
STRING_LITERAL(TMP3068, "null", 4);
STRING_LITERAL(TMP3069, "true", 4);
STRING_LITERAL(TMP3070, "false", 5);
STRING_LITERAL(TMP3072, "$1($2, $3) Error: $4", 20);
STRING_LITERAL(TMP3073, " expected", 9);
STRING_LITERAL(TMP3100, "\"", 1);
STRING_LITERAL(TMP3101, "\\\"", 2);
STRING_LITERAL(TMP3102, "\\\\", 2);
TNimNode* NimDT_324754_kind[8];
STRING_LITERAL(TMP5162, "\012", 1);
STRING_LITERAL(TMP5163, "{", 1);
STRING_LITERAL(TMP5164, ", ", 2);
STRING_LITERAL(TMP5165, ": ", 2);
STRING_LITERAL(TMP5166, "}", 1);
STRING_LITERAL(TMP5167, "{}", 2);
STRING_LITERAL(TMP5168, "[", 1);
STRING_LITERAL(TMP5169, "]", 1);
STRING_LITERAL(TMP5170, "[]", 2);
STRING_LITERAL(TMP5229, ",", 1);
STRING_LITERAL(TMP5230, ":", 1);
extern TNimType NTI281024; /* BaseLexer */
TNimType NTI323013; /* JsonParser */
extern TNimType NTI149; /* string */
TNimType NTI323007; /* TokKind */
TNimType NTI323005; /* JsonEventKind */
TNimType NTI323009; /* JsonError */
TNimType NTI323011; /* ParserState */
TNimType NTI323063; /* seq[ParserState] */
extern TNimType NTI4049; /* ValueError */
TNimType NTI324756; /* JsonParsingError */
TNimType NTI324794; /* ref JsonParsingError */
extern Gcheap51018 gch_51059;
TNimType NTI324754; /* JsonNodeObj */
TNimType NTI324750; /* JsonNodeKind */
extern TNimType NTI8112; /* BiggestInt */
extern TNimType NTI128; /* float */
extern TNimType NTI138; /* bool */
TNimType NTI325284; /* tuple[key: string, val: JsonNode] */
TNimType NTI324769; /* seq[tuple[key: string, val: JsonNode]] */
TNimType NTI324774; /* seq[JsonNode] */
TNimType NTI324752; /* JsonNode */
N_NIMCALL(void, TMP3057)(void* p, NI op) {
	TY323063* a;
	NI LOC1;
	a = (TY323063*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	}
}

N_NIMCALL(void, open_323091)(Jsonparser323013* my, Streamobj149427* input, NimStringDesc* filename) {
	Baselexer281024* LOC1;
	LOC1 = 0;
	LOC1 = &my->Sup;
	open_282635(LOC1, input, ((NI) 8192), TMP3058);
	unsureAsgnRef((void**) (&(*my).filename), copyString(filename));
	genericSeqAssign((&(*my).state), TMP3059, (&NTI323063));
	(*my).kind = ((NU8) 0);
	unsureAsgnRef((void**) (&(*my).a), copyString(((NimStringDesc*) &TMP3061)));
}

N_NIMCALL(void, skip_324069)(Jsonparser323013* my) {
	NI pos;
	NCSTRING buf;
	pos = (*my).Sup.bufpos;
	buf = (*my).Sup.buf;
	{
		while (1) {
			switch (((NU8)(buf[pos]))) {
			case 47:
			{
				{
					if (!((NU8)(buf[(NI)(pos + ((NI) 1))]) == (NU8)(47))) goto LA6;
					pos += ((NI) 2);
					{
						while (1) {
							switch (((NU8)(buf[pos]))) {
							case 0:
							{
								goto LA8;
							}
							break;
							case 13:
							{
								Baselexer281024* LOC12;
								LOC12 = 0;
								LOC12 = &my->Sup;
								pos = handlecr_282007(LOC12, pos);
								buf = (*my).Sup.buf;
								goto LA8;
							}
							break;
							case 10:
							{
								Baselexer281024* LOC14;
								LOC14 = 0;
								LOC14 = &my->Sup;
								pos = handlelf_282216(LOC14, pos);
								buf = (*my).Sup.buf;
								goto LA8;
							}
							break;
							default:
							{
								pos += ((NI) 1);
							}
							break;
							}
						}
					} LA8: ;
				}
				goto LA4;
				LA6: ;
				{
					if (!((NU8)(buf[(NI)(pos + ((NI) 1))]) == (NU8)(42))) goto LA17;
					pos += ((NI) 2);
					{
						while (1) {
							switch (((NU8)(buf[pos]))) {
							case 0:
							{
								(*my).err = ((NU8) 8);
								goto LA19;
							}
							break;
							case 13:
							{
								Baselexer281024* LOC23;
								LOC23 = 0;
								LOC23 = &my->Sup;
								pos = handlecr_282007(LOC23, pos);
								buf = (*my).Sup.buf;
							}
							break;
							case 10:
							{
								Baselexer281024* LOC25;
								LOC25 = 0;
								LOC25 = &my->Sup;
								pos = handlelf_282216(LOC25, pos);
								buf = (*my).Sup.buf;
							}
							break;
							case 42:
							{
								pos += ((NI) 1);
								{
									if (!((NU8)(buf[pos]) == (NU8)(47))) goto LA29;
									pos += ((NI) 1);
									goto LA19;
								}
								LA29: ;
							}
							break;
							default:
							{
								pos += ((NI) 1);
							}
							break;
							}
						}
					} LA19: ;
				}
				goto LA4;
				LA17: ;
				{
					goto LA1;
				}
				LA4: ;
			}
			break;
			case 32:
			case 9:
			{
				pos += ((NI) 1);
			}
			break;
			case 13:
			{
				Baselexer281024* LOC35;
				LOC35 = 0;
				LOC35 = &my->Sup;
				pos = handlecr_282007(LOC35, pos);
				buf = (*my).Sup.buf;
			}
			break;
			case 10:
			{
				Baselexer281024* LOC37;
				LOC37 = 0;
				LOC37 = &my->Sup;
				pos = handlelf_282216(LOC37, pos);
				buf = (*my).Sup.buf;
			}
			break;
			default:
			{
				goto LA1;
			}
			break;
			}
		}
	} LA1: ;
	(*my).Sup.bufpos = pos;
}

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

N_NIMCALL(void, parsenumber_324165)(Jsonparser323013* my) {
	NI pos;
	NCSTRING buf;
	pos = (*my).Sup.bufpos;
	buf = (*my).Sup.buf;
	{
		if (!((NU8)(buf[pos]) == (NU8)(45))) goto LA3;
		(*my).a = addChar((*my).a, 45);
		pos += ((NI) 1);
	}
	LA3: ;
	{
		if (!((NU8)(buf[pos]) == (NU8)(46))) goto LA7;
		(*my).a = resizeString((*my).a, 2);
appendString((*my).a, ((NimStringDesc*) &TMP3065));
		pos += ((NI) 1);
	}
	goto LA5;
	LA7: ;
	{
		{
			while (1) {
				if (!(((NU8)(buf[pos])) >= ((NU8)(48)) && ((NU8)(buf[pos])) <= ((NU8)(57)))) goto LA11;
				(*my).a = addChar((*my).a, buf[pos]);
				pos += ((NI) 1);
			} LA11: ;
		}
		{
			if (!((NU8)(buf[pos]) == (NU8)(46))) goto LA14;
			(*my).a = addChar((*my).a, 46);
			pos += ((NI) 1);
		}
		LA14: ;
	}
	LA5: ;
	{
		while (1) {
			if (!(((NU8)(buf[pos])) >= ((NU8)(48)) && ((NU8)(buf[pos])) <= ((NU8)(57)))) goto LA17;
			(*my).a = addChar((*my).a, buf[pos]);
			pos += ((NI) 1);
		} LA17: ;
	}
	{
		if (!(((NU8)(buf[pos])) == ((NU8)(69)) || ((NU8)(buf[pos])) == ((NU8)(101)))) goto LA20;
		(*my).a = addChar((*my).a, buf[pos]);
		pos += ((NI) 1);
		{
			if (!(((NU8)(buf[pos])) == ((NU8)(43)) || ((NU8)(buf[pos])) == ((NU8)(45)))) goto LA24;
			(*my).a = addChar((*my).a, buf[pos]);
			pos += ((NI) 1);
		}
		LA24: ;
		{
			while (1) {
				if (!(((NU8)(buf[pos])) >= ((NU8)(48)) && ((NU8)(buf[pos])) <= ((NU8)(57)))) goto LA27;
				(*my).a = addChar((*my).a, buf[pos]);
				pos += ((NI) 1);
			} LA27: ;
		}
	}
	LA20: ;
	(*my).Sup.bufpos = pos;
}

N_NIMCALL(NIM_BOOL, handlehexchar_323822)(NIM_CHAR c, NI* x) {
	NIM_BOOL result;
	result = 0;
	result = NIM_TRUE;
	switch (((NU8)(c))) {
	case 48 ... 57:
	{
		(*x) = (NI)((NI)((NU32)((*x)) << (NU32)(((NI) 4))) | ((NI) ((NI)(((NI) (((NU8)(c)))) - ((NI) 48)))));
	}
	break;
	case 97 ... 102:
	{
		(*x) = (NI)((NI)((NU32)((*x)) << (NU32)(((NI) 4))) | ((NI) ((NI)(((NI) ((NI)(((NI) (((NU8)(c)))) - ((NI) 97)))) + ((NI) 10)))));
	}
	break;
	case 65 ... 70:
	{
		(*x) = (NI)((NI)((NU32)((*x)) << (NU32)(((NI) 4))) | ((NI) ((NI)(((NI) ((NI)(((NI) (((NU8)(c)))) - ((NI) 65)))) + ((NI) 10)))));
	}
	break;
	default:
	{
		result = NIM_FALSE;
	}
	break;
	}
	return result;
}

N_NIMCALL(NI, parseescapedutf16_323889)(NCSTRING buf, NI* pos) {
	NI result;
{	result = 0;
	result = ((NI) 0);
	{
		NI HEX5F_323905;
		NI res_323919;
		HEX5F_323905 = 0;
		res_323919 = ((NI) 0);
		{
			while (1) {
				if (!(res_323919 <= ((NI) 3))) goto LA3;
				HEX5F_323905 = res_323919;
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = handlehexchar_323822(buf[(*pos)], (&result));
					if (!LOC6) goto LA7;
					(*pos) += ((NI) 1);
				}
				goto LA4;
				LA7: ;
				{
					result = ((NI) -1);
					goto BeforeRet;
				}
				LA4: ;
				res_323919 += ((NI) 1);
			} LA3: ;
		}
	}
	}BeforeRet: ;
	return result;
}

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

static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b) {
	NIM_BOOL result;
	NIM_BOOL LOC11;
	int LOC13;
{	result = 0;
	{
		if (!(a == b)) goto LA3;
		result = NIM_TRUE;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = (a == NIM_NIL);
		if (LOC7) goto LA8;
		LOC7 = (b == NIM_NIL);
		LA8: ;
		if (!LOC7) goto LA9;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA9: ;
	LOC11 = 0;
	LOC11 = ((*a).Sup.len == (*b).Sup.len);
	if (!(LOC11)) goto LA12;
	LOC13 = 0;
	LOC13 = memcmp(((NCSTRING) ((*a).data)), ((NCSTRING) ((*b).data)), (*a).Sup.len);
	LOC11 = (LOC13 == ((NI32) 0));
	LA12: ;
	result = LOC11;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NU8, parsestring_323938)(Jsonparser323013* my) {
	NU8 result;
	NI pos;
	NCSTRING buf;
	result = 0;
	result = ((NU8) 2);
	pos = (NI)((*my).Sup.bufpos + ((NI) 1));
	buf = (*my).Sup.buf;
	{
		while (1) {
			switch (((NU8)(buf[pos]))) {
			case 0:
			{
				(*my).err = ((NU8) 7);
				result = ((NU8) 0);
				goto LA1;
			}
			break;
			case 34:
			{
				pos += ((NI) 1);
				goto LA1;
			}
			break;
			case 92:
			{
				switch (((NU8)(buf[(NI)(pos + ((NI) 1))]))) {
				case 92:
				case 34:
				case 39:
				case 47:
				{
					(*my).a = addChar((*my).a, buf[(NI)(pos + ((NI) 1))]);
					pos += ((NI) 2);
				}
				break;
				case 98:
				{
					(*my).a = addChar((*my).a, 8);
					pos += ((NI) 2);
				}
				break;
				case 102:
				{
					(*my).a = addChar((*my).a, 12);
					pos += ((NI) 2);
				}
				break;
				case 110:
				{
					(*my).a = addChar((*my).a, 10);
					pos += ((NI) 2);
				}
				break;
				case 114:
				{
					(*my).a = addChar((*my).a, 13);
					pos += ((NI) 2);
				}
				break;
				case 116:
				{
					(*my).a = addChar((*my).a, 9);
					pos += ((NI) 2);
				}
				break;
				case 117:
				{
					NI r;
					NimStringDesc* LOC33;
					pos += ((NI) 2);
					r = parseescapedutf16_323889(buf, (&pos));
					{
						if (!(r < ((NI) 0))) goto LA15;
						(*my).err = ((NU8) 1);
						goto LA1;
					}
					LA15: ;
					{
						NI s;
						if (!((NI)(r & ((NI) 64512)) == ((NI) 55296))) goto LA19;
						{
							NimStringDesc* LOC23;
							LOC23 = 0;
							LOC23 = rawNewString(2);
appendChar(LOC23, buf[pos]);
appendChar(LOC23, buf[(NI)(pos + ((NI) 1))]);
							if (!!(eqStrings(LOC23, ((NimStringDesc*) &TMP3067)))) goto LA24;
							(*my).err = ((NU8) 1);
							goto LA1;
						}
						LA24: ;
						pos += ((NI) 2);
						s = parseescapedutf16_323889(buf, (&pos));
						{
							NIM_BOOL LOC28;
							LOC28 = 0;
							LOC28 = ((NI)(s & ((NI) 64512)) == ((NI) 56320));
							if (!(LOC28)) goto LA29;
							LOC28 = (((NI) 0) < s);
							LA29: ;
							if (!LOC28) goto LA30;
							r = (NI)(((NI) 65536) + (NI)((NI)((NU32)((NI)(r - ((NI) 55296))) << (NU32)(((NI) 10))) | (NI)(s - ((NI) 56320))));
						}
						goto LA26;
						LA30: ;
						{
							(*my).err = ((NU8) 1);
							goto LA1;
						}
						LA26: ;
					}
					LA19: ;
					LOC33 = 0;
					LOC33 = nuctoUTF8(r);
					(*my).a = resizeString((*my).a, LOC33->Sup.len + 0);
appendString((*my).a, LOC33);
				}
				break;
				default:
				{
					(*my).a = addChar((*my).a, buf[pos]);
					pos += ((NI) 1);
				}
				break;
				}
			}
			break;
			case 13:
			{
				Baselexer281024* LOC36;
				LOC36 = 0;
				LOC36 = &my->Sup;
				pos = handlecr_282007(LOC36, pos);
				buf = (*my).Sup.buf;
				(*my).a = addChar((*my).a, 13);
			}
			break;
			case 10:
			{
				Baselexer281024* LOC38;
				LOC38 = 0;
				LOC38 = &my->Sup;
				pos = handlelf_282216(LOC38, pos);
				buf = (*my).Sup.buf;
				(*my).a = addChar((*my).a, 10);
			}
			break;
			default:
			{
				(*my).a = addChar((*my).a, buf[pos]);
				pos += ((NI) 1);
			}
			break;
			}
		}
	} LA1: ;
	(*my).Sup.bufpos = pos;
	return result;
}

N_NIMCALL(void, parsename_324322)(Jsonparser323013* my) {
	NI pos;
	NCSTRING buf;
	pos = (*my).Sup.bufpos;
	buf = (*my).Sup.buf;
	{
		if (!(((NU8)(buf[pos])) >= ((NU8)(97)) && ((NU8)(buf[pos])) <= ((NU8)(122)) || ((NU8)(buf[pos])) >= ((NU8)(65)) && ((NU8)(buf[pos])) <= ((NU8)(90)) || ((NU8)(buf[pos])) == ((NU8)(95)))) goto LA3;
		{
			while (1) {
				if (!(((NU8)(buf[pos])) >= ((NU8)(97)) && ((NU8)(buf[pos])) <= ((NU8)(122)) || ((NU8)(buf[pos])) >= ((NU8)(65)) && ((NU8)(buf[pos])) <= ((NU8)(90)) || ((NU8)(buf[pos])) >= ((NU8)(48)) && ((NU8)(buf[pos])) <= ((NU8)(57)) || ((NU8)(buf[pos])) == ((NU8)(95)))) goto LA6;
				(*my).a = addChar((*my).a, buf[pos]);
				pos += ((NI) 1);
			} LA6: ;
		}
	}
	LA3: ;
	(*my).Sup.bufpos = pos;
}

N_NIMCALL(NU8, gettok_324370)(Jsonparser323013* my) {
	NU8 result;
	result = 0;
	(*my).a = setLengthStr((*my).a, ((NI) 0));
	skip_324069(my);
	switch (((NU8)((*my).Sup.buf[(*my).Sup.bufpos]))) {
	case 45:
	case 46:
	case 48 ... 57:
	{
		parsenumber_324165(my);
		{
			NIM_BOOL LOC4;
			LOC4 = 0;
			LOC4 = contains_103975((*my).a, TMP3066);
			if (!LOC4) goto LA5;
			result = ((NU8) 4);
		}
		goto LA2;
		LA5: ;
		{
			result = ((NU8) 3);
		}
		LA2: ;
	}
	break;
	case 34:
	{
		result = parsestring_323938(my);
	}
	break;
	case 91:
	{
		(*my).Sup.bufpos += ((NI) 1);
		result = ((NU8) 10);
	}
	break;
	case 123:
	{
		(*my).Sup.bufpos += ((NI) 1);
		result = ((NU8) 8);
	}
	break;
	case 93:
	{
		(*my).Sup.bufpos += ((NI) 1);
		result = ((NU8) 11);
	}
	break;
	case 125:
	{
		(*my).Sup.bufpos += ((NI) 1);
		result = ((NU8) 9);
	}
	break;
	case 44:
	{
		(*my).Sup.bufpos += ((NI) 1);
		result = ((NU8) 13);
	}
	break;
	case 58:
	{
		(*my).Sup.bufpos += ((NI) 1);
		result = ((NU8) 12);
	}
	break;
	case 0:
	{
		result = ((NU8) 1);
	}
	break;
	case 97 ... 122:
	case 65 ... 90:
	case 95:
	{
		parsename_324322(my);
		if (eqStrings((*my).a, ((NimStringDesc*) &TMP3068))) goto LA17;
		if (eqStrings((*my).a, ((NimStringDesc*) &TMP3069))) goto LA18;
		if (eqStrings((*my).a, ((NimStringDesc*) &TMP3070))) goto LA19;
		goto LA20;
		LA17: ;
		{
			result = ((NU8) 7);
		}
		goto LA21;
		LA18: ;
		{
			result = ((NU8) 5);
		}
		goto LA21;
		LA19: ;
		{
			result = ((NU8) 6);
		}
		goto LA21;
		LA20: ;
		{
			result = ((NU8) 0);
		}
		LA21: ;
	}
	break;
	default:
	{
		(*my).Sup.bufpos += ((NI) 1);
		result = ((NU8) 0);
	}
	break;
	}
	(*my).tok = result;
	return result;
}

static N_INLINE(NU8, pop_324556)(TY323063** s) {
	NU8 result;
	NI L;
	result = 0;
	L = (NI)(((*s) ? (*s)->Sup.len : 0) - ((NI) 1));
	result = (*s)->data[L];
	(*s) = (TY323063*) setLengthSeq(&((*s))->Sup, sizeof(NU8), ((NI) (L)));
	return result;
}

N_NIMCALL(void, next_324446)(Jsonparser323013* my) {
	NU8 tk;
	NI i;
	tk = gettok_324370(my);
	i = (NI)(((*my).state ? (*my).state->Sup.len : 0) - ((NI) 1));
	switch ((*my).state->data[i]) {
	case ((NU8) 0):
	{
		{
			if (!(tk == ((NU8) 1))) goto LA4;
			(*my).kind = ((NU8) 1);
		}
		goto LA2;
		LA4: ;
		{
			(*my).kind = ((NU8) 0);
			(*my).err = ((NU8) 9);
		}
		LA2: ;
	}
	break;
	case ((NU8) 1):
	{
		switch (tk) {
		case ((NU8) 2):
		case ((NU8) 3):
		case ((NU8) 4):
		case ((NU8) 5):
		case ((NU8) 6):
		case ((NU8) 7):
		{
			(*my).state->data[i] = ((NU8) 0);
			(*my).kind = ((NU8) (tk));
		}
		break;
		case ((NU8) 10):
		{
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 3);
			++(*my).state->Sup.len;
			(*my).kind = ((NU8) 10);
		}
		break;
		case ((NU8) 8):
		{
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 2);
			++(*my).state->Sup.len;
			(*my).kind = ((NU8) 8);
		}
		break;
		case ((NU8) 1):
		{
			(*my).kind = ((NU8) 1);
		}
		break;
		default:
		{
			(*my).kind = ((NU8) 0);
			(*my).err = ((NU8) 9);
		}
		break;
		}
	}
	break;
	case ((NU8) 2):
	{
		switch (tk) {
		case ((NU8) 2):
		case ((NU8) 3):
		case ((NU8) 4):
		case ((NU8) 5):
		case ((NU8) 6):
		case ((NU8) 7):
		{
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 6);
			++(*my).state->Sup.len;
			(*my).kind = ((NU8) (tk));
		}
		break;
		case ((NU8) 10):
		{
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 6);
			++(*my).state->Sup.len;
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 3);
			++(*my).state->Sup.len;
			(*my).kind = ((NU8) 10);
		}
		break;
		case ((NU8) 8):
		{
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 6);
			++(*my).state->Sup.len;
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 2);
			++(*my).state->Sup.len;
			(*my).kind = ((NU8) 8);
		}
		break;
		case ((NU8) 9):
		{
			NU8 LOC18;
			(*my).kind = ((NU8) 9);
			LOC18 = 0;
			LOC18 = pop_324556((&(*my).state));
		}
		break;
		default:
		{
			(*my).kind = ((NU8) 0);
			(*my).err = ((NU8) 6);
		}
		break;
		}
	}
	break;
	case ((NU8) 3):
	{
		switch (tk) {
		case ((NU8) 2):
		case ((NU8) 3):
		case ((NU8) 4):
		case ((NU8) 5):
		case ((NU8) 6):
		case ((NU8) 7):
		{
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 4);
			++(*my).state->Sup.len;
			(*my).kind = ((NU8) (tk));
		}
		break;
		case ((NU8) 10):
		{
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 4);
			++(*my).state->Sup.len;
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 3);
			++(*my).state->Sup.len;
			(*my).kind = ((NU8) 10);
		}
		break;
		case ((NU8) 8):
		{
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 4);
			++(*my).state->Sup.len;
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 2);
			++(*my).state->Sup.len;
			(*my).kind = ((NU8) 8);
		}
		break;
		case ((NU8) 11):
		{
			NU8 LOC25;
			(*my).kind = ((NU8) 11);
			LOC25 = 0;
			LOC25 = pop_324556((&(*my).state));
		}
		break;
		default:
		{
			(*my).kind = ((NU8) 0);
			(*my).err = ((NU8) 5);
		}
		break;
		}
	}
	break;
	case ((NU8) 4):
	{
		switch (tk) {
		case ((NU8) 13):
		{
			NU8 LOC29;
			LOC29 = 0;
			LOC29 = pop_324556((&(*my).state));
			next_324446(my);
		}
		break;
		case ((NU8) 11):
		{
			NU8 LOC31;
			NU8 LOC32;
			(*my).kind = ((NU8) 11);
			LOC31 = 0;
			LOC31 = pop_324556((&(*my).state));
			LOC32 = 0;
			LOC32 = pop_324556((&(*my).state));
		}
		break;
		default:
		{
			(*my).kind = ((NU8) 0);
			(*my).err = ((NU8) 5);
		}
		break;
		}
	}
	break;
	case ((NU8) 5):
	{
		switch (tk) {
		case ((NU8) 13):
		{
			NU8 LOC36;
			LOC36 = 0;
			LOC36 = pop_324556((&(*my).state));
			next_324446(my);
		}
		break;
		case ((NU8) 9):
		{
			NU8 LOC38;
			NU8 LOC39;
			(*my).kind = ((NU8) 9);
			LOC38 = 0;
			LOC38 = pop_324556((&(*my).state));
			LOC39 = 0;
			LOC39 = pop_324556((&(*my).state));
		}
		break;
		default:
		{
			(*my).kind = ((NU8) 0);
			(*my).err = ((NU8) 6);
		}
		break;
		}
	}
	break;
	case ((NU8) 6):
	{
		switch (tk) {
		case ((NU8) 12):
		{
			(*my).state->data[i] = ((NU8) 7);
			next_324446(my);
		}
		break;
		default:
		{
			(*my).kind = ((NU8) 0);
			(*my).err = ((NU8) 3);
		}
		break;
		}
	}
	break;
	case ((NU8) 7):
	{
		switch (tk) {
		case ((NU8) 2):
		case ((NU8) 3):
		case ((NU8) 4):
		case ((NU8) 5):
		case ((NU8) 6):
		case ((NU8) 7):
		{
			(*my).state->data[i] = ((NU8) 5);
			(*my).kind = ((NU8) (tk));
		}
		break;
		case ((NU8) 10):
		{
			(*my).state->data[i] = ((NU8) 5);
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 3);
			++(*my).state->Sup.len;
			(*my).kind = ((NU8) 10);
		}
		break;
		case ((NU8) 8):
		{
			(*my).state->data[i] = ((NU8) 5);
			(*my).state = (TY323063*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 2);
			++(*my).state->Sup.len;
			(*my).kind = ((NU8) 8);
		}
		break;
		default:
		{
			(*my).kind = ((NU8) 0);
			(*my).err = ((NU8) 10);
		}
		break;
		}
	}
	break;
	}
}
N_NIMCALL(void, TMP3071)(void* p, NI op) {
	Jsonparsingerror324756* a;
	a = (Jsonparsingerror324756*)p;
	nimGCvisit((void*)(*a).Sup.Sup.parent, op);
	nimGCvisit((void*)(*a).Sup.Sup.message, op);
	nimGCvisit((void*)(*a).Sup.Sup.trace, op);
}

static N_INLINE(NI, getline_323627)(Jsonparser323013* my) {
	NI result;
	result = 0;
	result = (*my).Sup.linenumber;
	return result;
}

static N_INLINE(NI, getcolumn_323617)(Jsonparser323013* my) {
	NI result;
	result = 0;
	result = getcolnumber_283008((&(*my).Sup), (*my).Sup.bufpos);
	return result;
}

N_NIMCALL(NimStringDesc*, errormsgexpected_323809)(Jsonparser323013* my, NimStringDesc* e) {
	NimStringDesc* result;
	TY193829 LOC1;
	NI LOC2;
	NI LOC3;
	NimStringDesc* LOC4;
	result = 0;
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC1[0] = copyString((*my).filename);
	LOC2 = 0;
	LOC2 = getline_323627(my);
	LOC1[1] = nimIntToStr(LOC2);
	LOC3 = 0;
	LOC3 = getcolumn_323617(my);
	LOC1[2] = nimIntToStr(LOC3);
	LOC4 = 0;
	LOC4 = rawNewString(e->Sup.len + 9);
appendString(LOC4, e);
appendString(LOC4, ((NimStringDesc*) &TMP3073));
	LOC1[3] = LOC4;
	result = nsuFormatOpenArray(((NimStringDesc*) &TMP3072), LOC1, 4);
	return result;
}

static N_INLINE(Cell48947*, usrtocell_52646)(void* usr) {
	Cell48947* result;
	result = 0;
	result = ((Cell48947*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(Cell48947))))));
	return result;
}

static N_INLINE(void, rtladdzct_54204)(Cell48947* c) {
	addzct_52617((&gch_51059.zct), c);
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		Cell48947* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_52646(src);
		(*c).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Cell48947* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_52646((*dest));
		{
			(*c).refcount -= ((NI) 8);
			if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA11;
			rtladdzct_54204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NOINLINE(void, raiseparseerr_324786)(Jsonparser323013* p, NimStringDesc* msg) {
	Jsonparsingerror324756* e_324793;
	e_324793 = 0;
	e_324793 = (Jsonparsingerror324756*) newObj((&NTI324794), sizeof(Jsonparsingerror324756));
	(*e_324793).Sup.Sup.Sup.m_type = (&NTI324756);
	asgnRefNoCycle((void**) (&(*e_324793).Sup.Sup.message), errormsgexpected_323809(p, msg));
	raiseException((Exception*)e_324793, "JsonParsingError");
}

N_NIMCALL(NimStringDesc*, escapejson_328895)(NimStringDesc* s) {
	NimStringDesc* result;
	result = 0;
	result = rawNewString(((NI) ((NI)((s ? s->Sup.len : 0) + (NI)((NU32)((s ? s->Sup.len : 0)) >> (NU32)(((NI) 3)))))));
	result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP3100));
	{
		NI x_328899;
		NI i_328907;
		NI result_328909;
		x_328899 = 0;
		i_328907 = ((NI) 0);
		result_328909 = 0;
		{
			while (1) {
				NI r;
				if (!(i_328907 < (s ? s->Sup.len : 0))) goto LA3;
				{
					if (!((NU32)(((NI) (((NU8)(s->data[i_328907]))))) <= (NU32)(((NI) 127)))) goto LA6;
					result_328909 = ((NI) (((NU8)(s->data[i_328907]))));
					i_328907 += ((NI) 1);
				}
				goto LA4;
				LA6: ;
				{
					if (!((NI)((NU32)(((NI) (((NU8)(s->data[i_328907]))))) >> (NU32)(((NI) 5))) == ((NI) 6))) goto LA9;
					result_328909 = (NI)((NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[i_328907])))) & ((NI) 31))))) << (NU32)(((NI) 6))) | ((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 1))])))) & ((NI) 63)))));
					i_328907 += ((NI) 2);
				}
				goto LA4;
				LA9: ;
				{
					if (!((NI)((NU32)(((NI) (((NU8)(s->data[i_328907]))))) >> (NU32)(((NI) 4))) == ((NI) 14))) goto LA12;
					result_328909 = (NI)((NI)((NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[i_328907])))) & ((NI) 15))))) << (NU32)(((NI) 12))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 1))])))) & ((NI) 63))))) << (NU32)(((NI) 6)))) | ((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 2))])))) & ((NI) 63)))));
					i_328907 += ((NI) 3);
				}
				goto LA4;
				LA12: ;
				{
					if (!((NI)((NU32)(((NI) (((NU8)(s->data[i_328907]))))) >> (NU32)(((NI) 3))) == ((NI) 30))) goto LA15;
					result_328909 = (NI)((NI)((NI)((NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[i_328907])))) & ((NI) 7))))) << (NU32)(((NI) 18))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 1))])))) & ((NI) 63))))) << (NU32)(((NI) 12)))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 2))])))) & ((NI) 63))))) << (NU32)(((NI) 6)))) | ((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 3))])))) & ((NI) 63)))));
					i_328907 += ((NI) 4);
				}
				goto LA4;
				LA15: ;
				{
					if (!((NI)((NU32)(((NI) (((NU8)(s->data[i_328907]))))) >> (NU32)(((NI) 2))) == ((NI) 62))) goto LA18;
					result_328909 = (NI)((NI)((NI)((NI)((NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[i_328907])))) & ((NI) 3))))) << (NU32)(((NI) 24))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 1))])))) & ((NI) 63))))) << (NU32)(((NI) 18)))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 2))])))) & ((NI) 63))))) << (NU32)(((NI) 12)))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 3))])))) & ((NI) 63))))) << (NU32)(((NI) 6)))) | ((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 4))])))) & ((NI) 63)))));
					i_328907 += ((NI) 5);
				}
				goto LA4;
				LA18: ;
				{
					if (!((NI)((NU32)(((NI) (((NU8)(s->data[i_328907]))))) >> (NU32)(((NI) 1))) == ((NI) 126))) goto LA21;
					result_328909 = (NI)((NI)((NI)((NI)((NI)((NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[i_328907])))) & ((NI) 1))))) << (NU32)(((NI) 30))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 1))])))) & ((NI) 63))))) << (NU32)(((NI) 24)))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 2))])))) & ((NI) 63))))) << (NU32)(((NI) 18)))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 3))])))) & ((NI) 63))))) << (NU32)(((NI) 12)))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 4))])))) & ((NI) 63))))) << (NU32)(((NI) 6)))) | ((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_328907 + ((NI) 5))])))) & ((NI) 63)))));
					i_328907 += ((NI) 6);
				}
				goto LA4;
				LA21: ;
				{
					result_328909 = ((NI) (((NU8)(s->data[i_328907]))));
					i_328907 += ((NI) 1);
				}
				LA4: ;
				x_328899 = result_328909;
				r = x_328899;
				{
					NIM_BOOL LOC26;
					NIM_CHAR c;
					LOC26 = 0;
					LOC26 = (((NI) 32) <= r);
					if (!(LOC26)) goto LA27;
					LOC26 = (r <= ((NI) 127));
					LA27: ;
					if (!LOC26) goto LA28;
					c = ((NIM_CHAR) (((NI) (r))));
					switch (((NU8)(c))) {
					case 34:
					{
						result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP3101));
					}
					break;
					case 92:
					{
						result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP3102));
					}
					break;
					default:
					{
						result = addChar(result, c);
					}
					break;
					}
				}
				goto LA24;
				LA28: ;
				{
					NimStringDesc* LOC34;
					result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP3067));
					LOC34 = 0;
					LOC34 = nsuToHex(((NI64) (r)), ((NI) 4));
					result = resizeString(result, LOC34->Sup.len + 0);
appendString(result, LOC34);
				}
				LA24: ;
			} LA3: ;
		}
	}
	result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP3100));
	return result;
}
N_NIMCALL(void, TMP5155)(void* p, NI op) {
	TY324769* a;
	NI LOC1;
	a = (TY324769*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	nimGCvisit((void*)a->data[LOC1].Field0, op);
	nimGCvisit((void*)a->data[LOC1].Field1, op);
	}
}
N_NIMCALL(void, TMP5156)(void* p, NI op) {
	TY324774* a;
	NI LOC1;
	a = (TY324774*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	nimGCvisit((void*)a->data[LOC1], op);
	}
}
N_NIMCALL(void, TMP5157)(void* p, NI op) {
	Jsonnodeobj324754* a;
	a = (Jsonnodeobj324754*)p;
	switch ((*a).kind) {
	case ((NU8) 4):
	nimGCvisit((void*)(*a).kindU.S1.str, op);
	break;
	case ((NU8) 2):
	break;
	case ((NU8) 3):
	break;
	case ((NU8) 1):
	break;
	case ((NU8) 0):
	break;
	case ((NU8) 5):
	nimGCvisit((void*)(*a).kindU.S6.fields, op);
	break;
	case ((NU8) 6):
	nimGCvisit((void*)(*a).kindU.S7.elems, op);
	break;
	} 
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	Cell48947* c;
	c = usrtocell_52646(p);
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3;
		rtladdzct_54204(c);
	}
	LA3: ;
}

N_NIMCALL(Jsonnodeobj324754*, HEX25_325281)(TY325284* keyvals, NI keyvalsLen0) {
	Jsonnodeobj324754* result;
	result = 0;
	result = (Jsonnodeobj324754*) newObj((&NTI324752), sizeof(Jsonnodeobj324754));
	(*result).kind = ((NU8) 5);
	if ((*result).kindU.S6.fields) nimGCunrefNoCycle((*result).kindU.S6.fields);
	(*result).kindU.S6.fields = (TY324769*) newSeqRC1((&NTI324769), ((NI) (keyvalsLen0)));
	{
		NI i_325356;
		TY325284 p_325357;
		NI i_325362;
		i_325356 = 0;
		memset((void*)(&p_325357), 0, sizeof(p_325357));
		i_325362 = ((NI) 0);
		{
			while (1) {
				NimStringDesc* LOC4;
				if (!(i_325362 < keyvalsLen0)) goto LA3;
				i_325356 = i_325362;
				p_325357.Field0 = keyvals[i_325362].Field0;
				p_325357.Field1 = keyvals[i_325362].Field1;
				LOC4 = 0;
				LOC4 = (*result).kindU.S6.fields->data[i_325356].Field0; (*result).kindU.S6.fields->data[i_325356].Field0 = copyStringRC1(p_325357.Field0);
				if (LOC4) nimGCunrefNoCycle(LOC4);
				asgnRefNoCycle((void**) (&(*result).kindU.S6.fields->data[i_325356].Field1), p_325357.Field1);
				i_325362 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}

N_NIMCALL(Jsonnodeobj324754*, HEX25_325205)(NimStringDesc* s) {
	Jsonnodeobj324754* result;
	NimStringDesc* LOC1;
	result = 0;
	result = (Jsonnodeobj324754*) newObj((&NTI324752), sizeof(Jsonnodeobj324754));
	(*result).kind = ((NU8) 4);
	LOC1 = 0;
	LOC1 = (*result).kindU.S1.str; (*result).kindU.S1.str = copyStringRC1(s);
	if (LOC1) nimGCunrefNoCycle(LOC1);
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_325661)(Jsonnodeobj324754* a, Jsonnodeobj324754* b) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!a == 0) goto LA3;
		{
			if (!b == 0) goto LA7;
			result = NIM_TRUE;
			goto BeforeRet;
		}
		LA7: ;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC10;
		LOC10 = 0;
		LOC10 = b == 0;
		if (LOC10) goto LA11;
		LOC10 = !(((*a).kind == (*b).kind));
		LA11: ;
		if (!LOC10) goto LA12;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	goto LA1;
	LA12: ;
	{
		switch ((*a).kind) {
		case ((NU8) 4):
		{
			result = eqStrings((*a).kindU.S1.str, (*b).kindU.S1.str);
		}
		break;
		case ((NU8) 2):
		{
			result = ((*a).kindU.S2.num == (*b).kindU.S2.num);
		}
		break;
		case ((NU8) 3):
		{
			result = ((*a).kindU.S3.fnum == (*b).kindU.S3.fnum);
		}
		break;
		case ((NU8) 1):
		{
			result = ((*a).kindU.S4.bval == (*b).kindU.S4.bval);
		}
		break;
		case ((NU8) 0):
		{
			result = NIM_TRUE;
		}
		break;
		case ((NU8) 6):
		{
			result = HEX3DHEX3D_325713((*a).kindU.S7.elems, (*b).kindU.S7.elems);
		}
		break;
		case ((NU8) 5):
		{
			result = HEX3DHEX3D_325817((*a).kindU.S6.fields, (*b).kindU.S6.fields);
		}
		break;
		}
		goto BeforeRet;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Jsonnodeobj324754*, newjarray_324956)(void) {
	Jsonnodeobj324754* result;
	result = 0;
	result = (Jsonnodeobj324754*) newObj((&NTI324752), sizeof(Jsonnodeobj324754));
	(*result).kind = ((NU8) 6);
	if ((*result).kindU.S7.elems) nimGCunrefNoCycle((*result).kindU.S7.elems);
	(*result).kindU.S7.elems = (TY324774*) newSeqRC1((&NTI324774), 0);
	return result;
}

N_NIMCALL(void, add_327247)(Jsonnodeobj324754* father, Jsonnodeobj324754* child) {
	(*father).kindU.S7.elems = (TY324774*) incrSeqV2(&((*father).kindU.S7.elems)->Sup, sizeof(Jsonnodeobj324754*));
	asgnRefNoCycle((void**) (&(*father).kindU.S7.elems->data[(*father).kindU.S7.elems->Sup.len]), child);
	++(*father).kindU.S7.elems->Sup.len;
}

N_NIMCALL(void, nl_328884)(NimStringDesc** s, NIM_BOOL ml) {
	{
		if (!ml) goto LA3;
		(*s) = resizeString((*s), 1);
appendString((*s), ((NimStringDesc*) &TMP5162));
	}
	LA3: ;
}

N_NIMCALL(void, indent_328861)(NimStringDesc** s, NI i) {
	NimStringDesc* LOC1;
	LOC1 = 0;
	LOC1 = nsuRepeatChar(32, ((NI) (i)));
	(*s) = resizeString((*s), LOC1->Sup.len + 0);
appendString((*s), LOC1);
}

N_NIMCALL(NI, newindent_328872)(NI curr, NI indent, NIM_BOOL ml) {
	NI result;
{	result = 0;
	{
		if (!ml) goto LA3;
		result = (NI)(curr + indent);
		goto BeforeRet;
	}
	goto LA1;
	LA3: ;
	{
		result = indent;
		goto BeforeRet;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, topretty_328932)(NimStringDesc** result, Jsonnodeobj324754* node, NI indent, NIM_BOOL ml, NIM_BOOL lstarr, NI currindent) {
	switch ((*node).kind) {
	case ((NU8) 5):
	{
		{
			NIM_BOOL LOC4;
			LOC4 = 0;
			LOC4 = !((currindent == ((NI) 0)));
			if (!(LOC4)) goto LA5;
			LOC4 = !(lstarr);
			LA5: ;
			if (!LOC4) goto LA6;
			nl_328884(result, ml);
		}
		LA6: ;
		indent_328861(result, currindent);
		{
			if (!(((NI) 0) < ((*node).kindU.S6.fields ? (*node).kindU.S6.fields->Sup.len : 0))) goto LA10;
			(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5163));
			nl_328884(result, ml);
			{
				NI i_328969;
				NI HEX3Atmp_329007;
				NI res_329010;
				i_328969 = 0;
				HEX3Atmp_329007 = 0;
				HEX3Atmp_329007 = (NI)(((*node).kindU.S6.fields ? (*node).kindU.S6.fields->Sup.len : 0) - ((NI) 1));
				res_329010 = ((NI) 0);
				{
					while (1) {
						NI LOC19;
						NimStringDesc* LOC20;
						NI LOC21;
						if (!(res_329010 <= HEX3Atmp_329007)) goto LA14;
						i_328969 = res_329010;
						{
							if (!(((NI) 0) < i_328969)) goto LA17;
							(*result) = resizeString((*result), 2);
appendString((*result), ((NimStringDesc*) &TMP5164));
							nl_328884(result, ml);
						}
						LA17: ;
						LOC19 = 0;
						LOC19 = newindent_328872(currindent, indent, ml);
						indent_328861(result, LOC19);
						LOC20 = 0;
						LOC20 = escapejson_328895((*node).kindU.S6.fields->data[i_328969].Field0);
						(*result) = resizeString((*result), LOC20->Sup.len + 0);
appendString((*result), LOC20);
						(*result) = resizeString((*result), 2);
appendString((*result), ((NimStringDesc*) &TMP5165));
						LOC21 = 0;
						LOC21 = newindent_328872(currindent, indent, ml);
						topretty_328932(result, (*node).kindU.S6.fields->data[i_328969].Field1, indent, ml, NIM_FALSE, LOC21);
						res_329010 += ((NI) 1);
					} LA14: ;
				}
			}
			nl_328884(result, ml);
			indent_328861(result, currindent);
			(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5166));
		}
		goto LA8;
		LA10: ;
		{
			(*result) = resizeString((*result), 2);
appendString((*result), ((NimStringDesc*) &TMP5167));
		}
		LA8: ;
	}
	break;
	case ((NU8) 4):
	{
		NimStringDesc* LOC28;
		{
			if (!lstarr) goto LA26;
			indent_328861(result, currindent);
		}
		LA26: ;
		LOC28 = 0;
		LOC28 = escapejson_328895((*node).kindU.S1.str);
		(*result) = resizeString((*result), LOC28->Sup.len + 0);
appendString((*result), LOC28);
	}
	break;
	case ((NU8) 2):
	{
		NimStringDesc* LOC34;
		{
			if (!lstarr) goto LA32;
			indent_328861(result, currindent);
		}
		LA32: ;
		LOC34 = 0;
		LOC34 = nimInt64ToStr((*node).kindU.S2.num);
		(*result) = resizeString((*result), LOC34->Sup.len + 0);
appendString((*result), LOC34);
	}
	break;
	case ((NU8) 3):
	{
		NimStringDesc* LOC40;
		{
			if (!lstarr) goto LA38;
			indent_328861(result, currindent);
		}
		LA38: ;
		LOC40 = 0;
		LOC40 = nimFloatToStr((*node).kindU.S3.fnum);
		(*result) = resizeString((*result), LOC40->Sup.len + 0);
appendString((*result), LOC40);
	}
	break;
	case ((NU8) 1):
	{
		NimStringDesc* LOC46;
		{
			if (!lstarr) goto LA44;
			indent_328861(result, currindent);
		}
		LA44: ;
		LOC46 = 0;
		LOC46 = nimBoolToStr((*node).kindU.S4.bval);
		(*result) = resizeString((*result), LOC46->Sup.len + 0);
appendString((*result), LOC46);
	}
	break;
	case ((NU8) 6):
	{
		{
			if (!lstarr) goto LA50;
			indent_328861(result, currindent);
		}
		LA50: ;
		{
			if (!!((((*node).kindU.S7.elems ? (*node).kindU.S7.elems->Sup.len : 0) == ((NI) 0)))) goto LA54;
			(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5168));
			nl_328884(result, ml);
			{
				NI i_329004;
				NI HEX3Atmp_329015;
				NI res_329018;
				i_329004 = 0;
				HEX3Atmp_329015 = 0;
				HEX3Atmp_329015 = (NI)(((*node).kindU.S7.elems ? (*node).kindU.S7.elems->Sup.len : 0) - ((NI) 1));
				res_329018 = ((NI) 0);
				{
					while (1) {
						NI LOC63;
						if (!(res_329018 <= HEX3Atmp_329015)) goto LA58;
						i_329004 = res_329018;
						{
							if (!(((NI) 0) < i_329004)) goto LA61;
							(*result) = resizeString((*result), 2);
appendString((*result), ((NimStringDesc*) &TMP5164));
							nl_328884(result, ml);
						}
						LA61: ;
						LOC63 = 0;
						LOC63 = newindent_328872(currindent, indent, ml);
						topretty_328932(result, (*node).kindU.S7.elems->data[i_329004], indent, ml, NIM_TRUE, LOC63);
						res_329018 += ((NI) 1);
					} LA58: ;
				}
			}
			nl_328884(result, ml);
			indent_328861(result, currindent);
			(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5169));
		}
		goto LA52;
		LA54: ;
		{
			(*result) = resizeString((*result), 2);
appendString((*result), ((NimStringDesc*) &TMP5170));
		}
		LA52: ;
	}
	break;
	case ((NU8) 0):
	{
		{
			if (!lstarr) goto LA68;
			indent_328861(result, currindent);
		}
		LA68: ;
		(*result) = resizeString((*result), 4);
appendString((*result), ((NimStringDesc*) &TMP3068));
	}
	break;
	}
}

N_NIMCALL(NimStringDesc*, pretty_329046)(Jsonnodeobj324754* node, NI indent) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP3061));
	topretty_328932((&result), node, indent, NIM_TRUE, NIM_FALSE, ((NI) 0));
	return result;
}

N_NIMCALL(NI, len_326106)(Jsonnodeobj324754* n) {
	NI result;
	result = 0;
	switch ((*n).kind) {
	case ((NU8) 6):
	{
		result = ((*n).kindU.S7.elems ? (*n).kindU.S7.elems->Sup.len : 0);
	}
	break;
	case ((NU8) 5):
	{
		result = ((*n).kindU.S6.fields ? (*n).kindU.S6.fields->Sup.len : 0);
	}
	break;
	default:
	{
	}
	break;
	}
	return result;
}

N_NIMCALL(void, tougly_329058)(NimStringDesc** result, Jsonnodeobj324754* node) {
	NIM_BOOL comma;
	comma = NIM_FALSE;
	switch ((*node).kind) {
	case ((NU8) 6):
	{
		(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5168));
		{
			Jsonnodeobj324754* child_329074;
			TY324774* HEX3Atmp_329092;
			NI i_329095;
			NI L_329097;
			child_329074 = 0;
			HEX3Atmp_329092 = 0;
			HEX3Atmp_329092 = (*node).kindU.S7.elems;
			i_329095 = ((NI) 0);
			L_329097 = (HEX3Atmp_329092 ? HEX3Atmp_329092->Sup.len : 0);
			{
				while (1) {
					if (!(i_329095 < L_329097)) goto LA4;
					child_329074 = HEX3Atmp_329092->data[i_329095];
					{
						if (!comma) goto LA7;
						(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5229));
					}
					goto LA5;
					LA7: ;
					{
						comma = NIM_TRUE;
					}
					LA5: ;
					tougly_329058(result, child_329074);
					i_329095 += ((NI) 1);
				} LA4: ;
			}
		}
		(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5169));
	}
	break;
	case ((NU8) 5):
	{
		(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5163));
		{
			NimStringDesc* key_329085;
			Jsonnodeobj324754* value_329086;
			TY324769* HEX3Atmp_329099;
			NI i_329102;
			NI L_329104;
			key_329085 = 0;
			value_329086 = 0;
			HEX3Atmp_329099 = 0;
			HEX3Atmp_329099 = (*node).kindU.S6.fields;
			i_329102 = ((NI) 0);
			L_329104 = (HEX3Atmp_329099 ? HEX3Atmp_329099->Sup.len : 0);
			{
				while (1) {
					NimStringDesc* LOC19;
					if (!(i_329102 < L_329104)) goto LA13;
					key_329085 = HEX3Atmp_329099->data[i_329102].Field0;
					value_329086 = HEX3Atmp_329099->data[i_329102].Field1;
					{
						if (!comma) goto LA16;
						(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5229));
					}
					goto LA14;
					LA16: ;
					{
						comma = NIM_TRUE;
					}
					LA14: ;
					LOC19 = 0;
					LOC19 = escapejson_328895(key_329085);
					(*result) = resizeString((*result), LOC19->Sup.len + 0);
appendString((*result), LOC19);
					(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5230));
					tougly_329058(result, value_329086);
					i_329102 += ((NI) 1);
				} LA13: ;
			}
		}
		(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5166));
	}
	break;
	case ((NU8) 4):
	{
		NimStringDesc* LOC21;
		LOC21 = 0;
		LOC21 = escapejson_328895((*node).kindU.S1.str);
		(*result) = resizeString((*result), LOC21->Sup.len + 0);
appendString((*result), LOC21);
	}
	break;
	case ((NU8) 2):
	{
		NimStringDesc* LOC23;
		LOC23 = 0;
		LOC23 = nimInt64ToStr((*node).kindU.S2.num);
		(*result) = resizeString((*result), LOC23->Sup.len + 0);
appendString((*result), LOC23);
	}
	break;
	case ((NU8) 3):
	{
		NimStringDesc* LOC25;
		LOC25 = 0;
		LOC25 = nimFloatToStr((*node).kindU.S3.fnum);
		(*result) = resizeString((*result), LOC25->Sup.len + 0);
appendString((*result), LOC25);
	}
	break;
	case ((NU8) 1):
	{
		NimStringDesc* LOC27;
		LOC27 = 0;
		{
			if (!(*node).kindU.S4.bval) goto LA30;
			LOC27 = copyString(((NimStringDesc*) &TMP3069));
		}
		goto LA28;
		LA30: ;
		{
			LOC27 = copyString(((NimStringDesc*) &TMP3070));
		}
		LA28: ;
		(*result) = resizeString((*result), LOC27->Sup.len + 0);
appendString((*result), LOC27);
	}
	break;
	case ((NU8) 0):
	{
		(*result) = resizeString((*result), 4);
appendString((*result), ((NimStringDesc*) &TMP3068));
	}
	break;
	}
}

N_NIMCALL(NimStringDesc*, HEX24_329129)(Jsonnodeobj324754* node) {
	NimStringDesc* result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = len_326106(node);
	result = rawNewString(((NI) ((NI)((NU32)(LOC1) << (NU32)(((NI) 1))))));
	tougly_329058((&result), node);
	return result;
}
NIM_EXTERNC N_NOINLINE(void, stdlib_jsonInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, stdlib_jsonDatInit000)(void) {
static TNimNode* TMP3044[6];
static TNimNode* TMP3045[14];
NI TMP3047;
static char* NIM_CONST TMP3046[14] = {
"tkError", 
"tkEof", 
"tkString", 
"tkInt", 
"tkFloat", 
"tkTrue", 
"tkFalse", 
"tkNull", 
"tkCurlyLe", 
"tkCurlyRi", 
"tkBracketLe", 
"tkBracketRi", 
"tkColon", 
"tkComma"};
static TNimNode* TMP3048[12];
NI TMP3050;
static char* NIM_CONST TMP3049[12] = {
"jsonError", 
"jsonEof", 
"jsonString", 
"jsonInt", 
"jsonFloat", 
"jsonTrue", 
"jsonFalse", 
"jsonNull", 
"jsonObjectStart", 
"jsonObjectEnd", 
"jsonArrayStart", 
"jsonArrayEnd"};
static TNimNode* TMP3051[11];
NI TMP3053;
static char* NIM_CONST TMP3052[11] = {
"errNone", 
"errInvalidToken", 
"errStringExpected", 
"errColonExpected", 
"errCommaExpected", 
"errBracketRiExpected", 
"errCurlyRiExpected", 
"errQuoteExpected", 
"errEOC_Expected", 
"errEofExpected", 
"errExprExpected"};
static TNimNode* TMP3054[8];
NI TMP3056;
static char* NIM_CONST TMP3055[8] = {
"stateEof", 
"stateStart", 
"stateObject", 
"stateArray", 
"stateExpectArrayComma", 
"stateExpectObjectComma", 
"stateExpectColon", 
"stateExpectValue"};
static TNimNode* TMP5151[7];
NI TMP5153;
static char* NIM_CONST TMP5152[7] = {
"JNull", 
"JBool", 
"JInt", 
"JFloat", 
"JString", 
"JObject", 
"JArray"};
static TNimNode* TMP5154[2];
static TNimNode TMP963[76];
NTI323013.size = sizeof(Jsonparser323013);
NTI323013.kind = 17;
NTI323013.base = (&NTI281024);
TMP3044[0] = &TMP963[1];
TMP963[1].kind = 1;
TMP963[1].offset = offsetof(Jsonparser323013, a);
TMP963[1].typ = (&NTI149);
TMP963[1].name = "a";
TMP3044[1] = &TMP963[2];
NTI323007.size = sizeof(NU8);
NTI323007.kind = 14;
NTI323007.base = 0;
NTI323007.flags = 3;
for (TMP3047 = 0; TMP3047 < 14; TMP3047++) {
TMP963[TMP3047+3].kind = 1;
TMP963[TMP3047+3].offset = TMP3047;
TMP963[TMP3047+3].name = TMP3046[TMP3047];
TMP3045[TMP3047] = &TMP963[TMP3047+3];
}
TMP963[17].len = 14; TMP963[17].kind = 2; TMP963[17].sons = &TMP3045[0];
NTI323007.node = &TMP963[17];
TMP963[2].kind = 1;
TMP963[2].offset = offsetof(Jsonparser323013, tok);
TMP963[2].typ = (&NTI323007);
TMP963[2].name = "tok";
TMP3044[2] = &TMP963[18];
NTI323005.size = sizeof(NU8);
NTI323005.kind = 14;
NTI323005.base = 0;
NTI323005.flags = 3;
for (TMP3050 = 0; TMP3050 < 12; TMP3050++) {
TMP963[TMP3050+19].kind = 1;
TMP963[TMP3050+19].offset = TMP3050;
TMP963[TMP3050+19].name = TMP3049[TMP3050];
TMP3048[TMP3050] = &TMP963[TMP3050+19];
}
TMP963[31].len = 12; TMP963[31].kind = 2; TMP963[31].sons = &TMP3048[0];
NTI323005.node = &TMP963[31];
TMP963[18].kind = 1;
TMP963[18].offset = offsetof(Jsonparser323013, kind);
TMP963[18].typ = (&NTI323005);
TMP963[18].name = "kind";
TMP3044[3] = &TMP963[32];
NTI323009.size = sizeof(NU8);
NTI323009.kind = 14;
NTI323009.base = 0;
NTI323009.flags = 3;
for (TMP3053 = 0; TMP3053 < 11; TMP3053++) {
TMP963[TMP3053+33].kind = 1;
TMP963[TMP3053+33].offset = TMP3053;
TMP963[TMP3053+33].name = TMP3052[TMP3053];
TMP3051[TMP3053] = &TMP963[TMP3053+33];
}
TMP963[44].len = 11; TMP963[44].kind = 2; TMP963[44].sons = &TMP3051[0];
NTI323009.node = &TMP963[44];
TMP963[32].kind = 1;
TMP963[32].offset = offsetof(Jsonparser323013, err);
TMP963[32].typ = (&NTI323009);
TMP963[32].name = "err";
TMP3044[4] = &TMP963[45];
NTI323011.size = sizeof(NU8);
NTI323011.kind = 14;
NTI323011.base = 0;
NTI323011.flags = 3;
for (TMP3056 = 0; TMP3056 < 8; TMP3056++) {
TMP963[TMP3056+46].kind = 1;
TMP963[TMP3056+46].offset = TMP3056;
TMP963[TMP3056+46].name = TMP3055[TMP3056];
TMP3054[TMP3056] = &TMP963[TMP3056+46];
}
TMP963[54].len = 8; TMP963[54].kind = 2; TMP963[54].sons = &TMP3054[0];
NTI323011.node = &TMP963[54];
NTI323063.size = sizeof(TY323063*);
NTI323063.kind = 24;
NTI323063.base = (&NTI323011);
NTI323063.flags = 2;
NTI323063.marker = TMP3057;
TMP963[45].kind = 1;
TMP963[45].offset = offsetof(Jsonparser323013, state);
TMP963[45].typ = (&NTI323063);
TMP963[45].name = "state";
TMP3044[5] = &TMP963[55];
TMP963[55].kind = 1;
TMP963[55].offset = offsetof(Jsonparser323013, filename);
TMP963[55].typ = (&NTI149);
TMP963[55].name = "filename";
TMP963[0].len = 6; TMP963[0].kind = 2; TMP963[0].sons = &TMP3044[0];
NTI323013.node = &TMP963[0];
NTI324756.size = sizeof(Jsonparsingerror324756);
NTI324756.kind = 17;
NTI324756.base = (&NTI4049);
TMP963[56].len = 0; TMP963[56].kind = 2;
NTI324756.node = &TMP963[56];
NTI324794.size = sizeof(Jsonparsingerror324756*);
NTI324794.kind = 22;
NTI324794.base = (&NTI324756);
NTI324794.marker = TMP3071;
NTI324754.size = sizeof(Jsonnodeobj324754);
NTI324754.kind = 18;
NTI324754.base = 0;
NTI324754.flags = 2;
NTI324750.size = sizeof(NU8);
NTI324750.kind = 14;
NTI324750.base = 0;
NTI324750.flags = 3;
for (TMP5153 = 0; TMP5153 < 7; TMP5153++) {
TMP963[TMP5153+58].kind = 1;
TMP963[TMP5153+58].offset = TMP5153;
TMP963[TMP5153+58].name = TMP5152[TMP5153];
TMP5151[TMP5153] = &TMP963[TMP5153+58];
}
TMP963[65].len = 7; TMP963[65].kind = 2; TMP963[65].sons = &TMP5151[0];
NTI324750.node = &TMP963[65];
TMP963[57].kind = 3;
TMP963[57].offset = offsetof(Jsonnodeobj324754, kind);
TMP963[57].typ = (&NTI324750);
TMP963[57].name = "kind";
TMP963[57].sons = &NimDT_324754_kind[0];
TMP963[57].len = 7;
TMP963[66].kind = 1;
TMP963[66].offset = offsetof(Jsonnodeobj324754, kindU.S1.str);
TMP963[66].typ = (&NTI149);
TMP963[66].name = "str";
NimDT_324754_kind[4] = &TMP963[66];
TMP963[67].kind = 1;
TMP963[67].offset = offsetof(Jsonnodeobj324754, kindU.S2.num);
TMP963[67].typ = (&NTI8112);
TMP963[67].name = "num";
NimDT_324754_kind[2] = &TMP963[67];
TMP963[68].kind = 1;
TMP963[68].offset = offsetof(Jsonnodeobj324754, kindU.S3.fnum);
TMP963[68].typ = (&NTI128);
TMP963[68].name = "fnum";
NimDT_324754_kind[3] = &TMP963[68];
TMP963[69].kind = 1;
TMP963[69].offset = offsetof(Jsonnodeobj324754, kindU.S4.bval);
TMP963[69].typ = (&NTI138);
TMP963[69].name = "bval";
NimDT_324754_kind[1] = &TMP963[69];
TMP963[70].len = 0; TMP963[70].kind = 2;
NimDT_324754_kind[0] = &TMP963[70];
NTI325284.size = sizeof(TY325284);
NTI325284.kind = 18;
NTI325284.base = 0;
NTI325284.flags = 2;
TMP5154[0] = &TMP963[73];
TMP963[73].kind = 1;
TMP963[73].offset = offsetof(TY325284, Field0);
TMP963[73].typ = (&NTI149);
TMP963[73].name = "Field0";
TMP5154[1] = &TMP963[74];
TMP963[74].kind = 1;
TMP963[74].offset = offsetof(TY325284, Field1);
TMP963[74].typ = (&NTI324752);
TMP963[74].name = "Field1";
TMP963[72].len = 2; TMP963[72].kind = 2; TMP963[72].sons = &TMP5154[0];
NTI325284.node = &TMP963[72];
NTI324769.size = sizeof(TY324769*);
NTI324769.kind = 24;
NTI324769.base = (&NTI325284);
NTI324769.flags = 2;
NTI324769.marker = TMP5155;
TMP963[71].kind = 1;
TMP963[71].offset = offsetof(Jsonnodeobj324754, kindU.S6.fields);
TMP963[71].typ = (&NTI324769);
TMP963[71].name = "fields";
NimDT_324754_kind[5] = &TMP963[71];
NTI324774.size = sizeof(TY324774*);
NTI324774.kind = 24;
NTI324774.base = (&NTI324752);
NTI324774.flags = 2;
NTI324774.marker = TMP5156;
TMP963[75].kind = 1;
TMP963[75].offset = offsetof(Jsonnodeobj324754, kindU.S7.elems);
TMP963[75].typ = (&NTI324774);
TMP963[75].name = "elems";
NimDT_324754_kind[6] = &TMP963[75];
NTI324754.node = &TMP963[57];
NTI324752.size = sizeof(Jsonnodeobj324754*);
NTI324752.kind = 22;
NTI324752.base = (&NTI324754);
NTI324752.flags = 2;
NTI324752.marker = TMP5157;
}

