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

#include "nimbase.h"
#include <string.h>
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Jsonparser306010 Jsonparser306010;
typedef struct Baselexer266009 Baselexer266009;
typedef struct TNimObject TNimObject;
typedef struct Streamobj144418 Streamobj144418;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct TY306060 TY306060;
typedef struct Jsonparsingerror307635 Jsonparsingerror307635;
typedef struct Valueerror3646 Valueerror3646;
typedef struct Exception Exception;
typedef struct Cell47505 Cell47505;
typedef struct Cellseq47521 Cellseq47521;
typedef struct Gcheap49818 Gcheap49818;
typedef struct Gcstack49816 Gcstack49816;
typedef struct Cellset47517 Cellset47517;
typedef struct Pagedesc47513 Pagedesc47513;
typedef struct Memregion29688 Memregion29688;
typedef struct Smallchunk29640 Smallchunk29640;
typedef struct Llchunk29682 Llchunk29682;
typedef struct Bigchunk29642 Bigchunk29642;
typedef struct Intset29614 Intset29614;
typedef struct Trunk29610 Trunk29610;
typedef struct Avlnode29686 Avlnode29686;
typedef struct Gcstat49814 Gcstat49814;
typedef struct Jsonnodeobj307633 Jsonnodeobj307633;
typedef struct TY308043 TY308043;
typedef struct TY307648 TY307648;
typedef struct TY307653 TY307653;
typedef struct Basechunk29638 Basechunk29638;
typedef struct Freecell29630 Freecell29630;
typedef N_NIMCALL_PTR(void, TY3489) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3494) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3489 marker;
TY3494 deepcopy;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  TNimObject  {
TNimType* m_type;
};
typedef NU8 TY203404[32];
struct  Baselexer266009  {
  TNimObject Sup;
NI bufpos;
NCSTRING buf;
NI buflen;
Streamobj144418* input;
NI linenumber;
NI sentinel;
NI linestart;
TY203404 refillchars;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Jsonparser306010  {
  Baselexer266009 Sup;
NimStringDesc* a;
NU8 tok;
NU8 kind;
NU8 err;
TY306060* state;
NimStringDesc* filename;
};
struct  Exception  {
  TNimObject Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
NimStringDesc* trace;
};
struct  Valueerror3646  {
  Exception Sup;
};
struct  Jsonparsingerror307635  {
  Valueerror3646 Sup;
};
typedef NimStringDesc* TY186781[4];
struct  Cell47505  {
NI refcount;
TNimType* typ;
};
struct  Cellseq47521  {
NI len;
NI cap;
Cell47505** d;
};
struct  Cellset47517  {
NI counter;
NI max;
Pagedesc47513* head;
Pagedesc47513** data;
};
typedef Smallchunk29640* TY29703[512];
typedef Trunk29610* Trunkbuckets29612[256];
struct  Intset29614  {
Trunkbuckets29612 data;
};
struct  Memregion29688  {
NI minlargeobj;
NI maxlargeobj;
TY29703 freesmallchunks;
Llchunk29682* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk29642* freechunkslist;
Intset29614 chunkstarts;
Avlnode29686* root;
Avlnode29686* deleted;
Avlnode29686* last;
Avlnode29686* freeavlnodes;
};
struct  Gcstat49814  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap49818  {
Gcstack49816* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq47521 zct;
Cellseq47521 decstack;
Cellset47517 cycleroots;
Cellseq47521 tempstack;
NI recgclock;
Memregion29688 region;
Gcstat49814 stat;
};
struct TY308043 {
NimStringDesc* Field0;
Jsonnodeobj307633* Field1;
};
struct  Jsonnodeobj307633  {
NU8 kind;
union{
struct {NimStringDesc* str;
} S1;
struct {NI64 num;
} S2;
struct {NF fnum;
} S3;
struct {NIM_BOOL bval;
} S4;
struct {TY307648* fields;
} S6;
struct {TY307653* elems;
} S7;
} kindU;
};
typedef N_NIMCALL_PTR(void, TY144419) (Streamobj144418* s);
typedef N_NIMCALL_PTR(NIM_BOOL, TY144423) (Streamobj144418* s);
typedef N_NIMCALL_PTR(void, TY144427) (Streamobj144418* s, NI pos);
typedef N_NIMCALL_PTR(NI, TY144432) (Streamobj144418* s);
typedef N_NIMCALL_PTR(NI, TY144436) (Streamobj144418* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(NI, TY144442) (Streamobj144418* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(void, TY144448) (Streamobj144418* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(void, TY144454) (Streamobj144418* s);
struct  Streamobj144418  {
  TNimObject Sup;
TY144419 closeimpl;
TY144423 atendimpl;
TY144427 setpositionimpl;
TY144432 getpositionimpl;
TY144436 readdataimpl;
TY144442 peekdataimpl;
TY144448 writedataimpl;
TY144454 flushimpl;
};
struct  Gcstack49816  {
Gcstack49816* prev;
Gcstack49816* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY29619[8];
struct  Pagedesc47513  {
Pagedesc47513* next;
NI key;
TY29619 bits;
};
struct  Basechunk29638  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk29640  {
  Basechunk29638 Sup;
Smallchunk29640* next;
Smallchunk29640* prev;
Freecell29630* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk29682  {
NI size;
NI acc;
Llchunk29682* next;
};
struct  Bigchunk29642  {
  Basechunk29638 Sup;
Bigchunk29642* next;
Bigchunk29642* prev;
NI align;
NF data;
};
struct  Trunk29610  {
Trunk29610* next;
NI key;
TY29619 bits;
};
typedef Avlnode29686* TY29693[2];
struct  Avlnode29686  {
TY29693 link;
NI key;
NI upperbound;
NI level;
};
struct  Freecell29630  {
Freecell29630* next;
NI zerofield;
};
struct TY306060 {
  TGenericSeq Sup;
  NU8 data[SEQ_DECL_SIZE];
};
struct TY307648 {
  TGenericSeq Sup;
  TY308043 data[SEQ_DECL_SIZE];
};
struct TY307653 {
  TGenericSeq Sup;
  Jsonnodeobj307633* data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, TMP3099)(void* p, NI op);
N_NIMCALL(void, open_268223)(Baselexer266009* L, Streamobj144418* input, NI buflen, TY203404 refillchars);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_84004, TNimType* mt);
N_NIMCALL(NU8, gettok_307264)(Jsonparser306010* my);
N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newlen);
N_NIMCALL(void, skip_307023)(Jsonparser306010* my);
N_NIMCALL(NI, handlecr_267601)(Baselexer266009* L, NI pos);
N_NIMCALL(NI, handlelf_267810)(Baselexer266009* L, NI pos);
N_NIMCALL(void, parsenumber_307095)(Jsonparser306010* 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_101033)(NimStringDesc* s, TY203404 chars);
N_NIMCALL(NU8, parsestring_306904)(Jsonparser306010* my);
N_NIMCALL(NI, parseescapedutf16_306871)(NCSTRING buf, NI* pos);
N_NIMCALL(NIM_BOOL, handlehexchar_306810)(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_307228)(Jsonparser306010* my);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize);
static N_INLINE(NU8, pop_307444)(TY306060** s);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
N_NIMCALL(void, next_307334)(Jsonparser306010* my);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3113)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(NimStringDesc*, errormsgexpected_306803)(Jsonparser306010* my, NimStringDesc* e);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
static N_INLINE(NI, getline_306609)(Jsonparser306010* my);
N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
static N_INLINE(NI, getcolumn_306605)(Jsonparser306010* my);
N_NIMCALL(NI, getcolnumber_268802)(Baselexer266009* L, NI pos);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell47505*, usrtocell_51440)(void* usr);
static N_INLINE(void, rtladdzct_53001)(Cell47505* c);
N_NOINLINE(void, addzct_51417)(Cellseq47521* s, Cell47505* 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, TMP5174)(void* p, NI op);
N_NIMCALL(void, TMP5175)(void* p, NI op);
N_NIMCALL(void, TMP5176)(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_308483)(TY307653* x, TY307653* y);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_308571)(TY307648* x, TY307648* y);
N_NIMCALL(void, topretty_311666)(NimStringDesc** result, Jsonnodeobj307633* node, NI indent, NIM_BOOL ml, NIM_BOOL lstarr, NI currindent);
N_NIMCALL(void, nl_311639)(NimStringDesc** s, NIM_BOOL ml);
N_NIMCALL(void, indent_311628)(NimStringDesc** s, NI i);
N_NIMCALL(NimStringDesc*, nsuRepeatChar)(NIM_CHAR c, NI count);
N_NIMCALL(NI, newindent_311633)(NI curr, NI indent, NIM_BOOL ml);
N_NIMCALL(NimStringDesc*, escapejson_311644)(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_308782)(Jsonnodeobj307633* n);
N_NIMCALL(void, tougly_311760)(NimStringDesc** result, Jsonnodeobj307633* node);
static NIM_CONST TY203404 TMP3100 = {
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];
} CNSTSEQ3103 = {{1, 1}, {((NU8) 1)}};
NIM_CONST TY306060* TMP3101 = ((TY306060*)&CNSTSEQ3103);
STRING_LITERAL(TMP3103, "", 0);
STRING_LITERAL(TMP3107, "0.", 2);
static NIM_CONST TY203404 TMP3108 = {
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(TMP3109, "\\u", 2);
STRING_LITERAL(TMP3110, "null", 4);
STRING_LITERAL(TMP3111, "true", 4);
STRING_LITERAL(TMP3112, "false", 5);
STRING_LITERAL(TMP3114, "$1($2, $3) Error: $4", 20);
STRING_LITERAL(TMP3115, " expected", 9);
STRING_LITERAL(TMP3139, "\"", 1);
STRING_LITERAL(TMP3140, "\\\"", 2);
STRING_LITERAL(TMP3141, "\\\\", 2);
TNimNode* NimDT_307633_kind[8];
STRING_LITERAL(TMP5181, "\012", 1);
STRING_LITERAL(TMP5182, "{", 1);
STRING_LITERAL(TMP5183, ", ", 2);
STRING_LITERAL(TMP5184, ": ", 2);
STRING_LITERAL(TMP5185, "}", 1);
STRING_LITERAL(TMP5186, "{}", 2);
STRING_LITERAL(TMP5187, "[", 1);
STRING_LITERAL(TMP5188, "]", 1);
STRING_LITERAL(TMP5189, "[]", 2);
STRING_LITERAL(TMP5248, ",", 1);
STRING_LITERAL(TMP5249, ":", 1);
extern TNimType NTI266009; /* BaseLexer */
TNimType NTI306010; /* JsonParser */
extern TNimType NTI138; /* string */
TNimType NTI306004; /* TokKind */
TNimType NTI306002; /* JsonEventKind */
TNimType NTI306006; /* JsonError */
TNimType NTI306008; /* ParserState */
TNimType NTI306060; /* seq[ParserState] */
extern TNimType NTI3646; /* ValueError */
TNimType NTI307635; /* JsonParsingError */
TNimType NTI307667; /* ref JsonParsingError */
extern Gcheap49818 gch_49859;
TNimType NTI307633; /* JsonNodeObj */
TNimType NTI307629; /* JsonNodeKind */
extern TNimType NTI7088; /* BiggestInt */
extern TNimType NTI124; /* float */
extern TNimType NTI130; /* bool */
TNimType NTI308043; /* tuple[key: string, val: JsonNode] */
TNimType NTI307648; /* seq[tuple[key: string, val: JsonNode]] */
TNimType NTI307653; /* seq[JsonNode] */
TNimType NTI307631; /* JsonNode */
N_NIMCALL(void, TMP3099)(void* p, NI op) {
	TY306060* a;
	NI LOC1;
	a = (TY306060*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	}
}

N_NIMCALL(void, open_306079)(Jsonparser306010* my, Streamobj144418* input, NimStringDesc* filename) {
	Baselexer266009* LOC1;
	LOC1 = 0;
	LOC1 = &my->Sup;
	open_268223(LOC1, input, ((NI) 8192), TMP3100);
	unsureAsgnRef((void**) (&(*my).filename), copyString(filename));
	genericSeqAssign((&(*my).state), TMP3101, (&NTI306060));
	(*my).kind = ((NU8) 0);
	unsureAsgnRef((void**) (&(*my).a), copyString(((NimStringDesc*) &TMP3103)));
}

N_NIMCALL(void, skip_307023)(Jsonparser306010* 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:
							{
								Baselexer266009* LOC12;
								LOC12 = 0;
								LOC12 = &my->Sup;
								pos = handlecr_267601(LOC12, pos);
								buf = (*my).Sup.buf;
								goto LA8;
							}
							break;
							case 10:
							{
								Baselexer266009* LOC14;
								LOC14 = 0;
								LOC14 = &my->Sup;
								pos = handlelf_267810(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:
							{
								Baselexer266009* LOC23;
								LOC23 = 0;
								LOC23 = &my->Sup;
								pos = handlecr_267601(LOC23, pos);
								buf = (*my).Sup.buf;
							}
							break;
							case 10:
							{
								Baselexer266009* LOC25;
								LOC25 = 0;
								LOC25 = &my->Sup;
								pos = handlelf_267810(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:
			{
				Baselexer266009* LOC35;
				LOC35 = 0;
				LOC35 = &my->Sup;
				pos = handlecr_267601(LOC35, pos);
				buf = (*my).Sup.buf;
			}
			break;
			case 10:
			{
				Baselexer266009* LOC37;
				LOC37 = 0;
				LOC37 = &my->Sup;
				pos = handlelf_267810(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_307095)(Jsonparser306010* 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*) &TMP3107));
		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_306810)(NIM_CHAR c, NI* x) {
	NIM_BOOL result;
	result = 0;
	result = NIM_TRUE;
	switch (((NU8)(c))) {
	case 48 ... 57:
	{
		(*x) = (NI)((NI)((NU64)((*x)) << (NU64)(((NI) 4))) | ((NI) ((NI)(((NI) (((NU8)(c)))) - ((NI) 48)))));
	}
	break;
	case 97 ... 102:
	{
		(*x) = (NI)((NI)((NU64)((*x)) << (NU64)(((NI) 4))) | ((NI) ((NI)(((NI) ((NI)(((NI) (((NU8)(c)))) - ((NI) 97)))) + ((NI) 10)))));
	}
	break;
	case 65 ... 70:
	{
		(*x) = (NI)((NI)((NU64)((*x)) << (NU64)(((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_306871)(NCSTRING buf, NI* pos) {
	NI result;
{	result = 0;
	result = ((NI) 0);
	{
		NI HEX5F_306886;
		NI res_306900;
		HEX5F_306886 = 0;
		res_306900 = ((NI) 0);
		{
			while (1) {
				if (!(res_306900 <= ((NI) 3))) goto LA3;
				HEX5F_306886 = res_306900;
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = handlehexchar_306810(buf[(*pos)], (&result));
					if (!LOC6) goto LA7;
					(*pos) += ((NI) 1);
				}
				goto LA4;
				LA7: ;
				{
					result = ((NI) -1);
					goto BeforeRet;
				}
				LA4: ;
				res_306900 += ((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_306904)(Jsonparser306010* 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_306871(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*) &TMP3109)))) goto LA24;
							(*my).err = ((NU8) 1);
							goto LA1;
						}
						LA24: ;
						pos += ((NI) 2);
						s = parseescapedutf16_306871(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)((NU64)((NI)(r - ((NI) 55296))) << (NU64)(((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:
			{
				Baselexer266009* LOC36;
				LOC36 = 0;
				LOC36 = &my->Sup;
				pos = handlecr_267601(LOC36, pos);
				buf = (*my).Sup.buf;
				(*my).a = addChar((*my).a, 13);
			}
			break;
			case 10:
			{
				Baselexer266009* LOC38;
				LOC38 = 0;
				LOC38 = &my->Sup;
				pos = handlelf_267810(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_307228)(Jsonparser306010* 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_307264)(Jsonparser306010* my) {
	NU8 result;
	result = 0;
	(*my).a = setLengthStr((*my).a, ((NI) 0));
	skip_307023(my);
	switch (((NU8)((*my).Sup.buf[(*my).Sup.bufpos]))) {
	case 45:
	case 46:
	case 48 ... 57:
	{
		parsenumber_307095(my);
		{
			NIM_BOOL LOC4;
			LOC4 = 0;
			LOC4 = contains_101033((*my).a, TMP3108);
			if (!LOC4) goto LA5;
			result = ((NU8) 4);
		}
		goto LA2;
		LA5: ;
		{
			result = ((NU8) 3);
		}
		LA2: ;
	}
	break;
	case 34:
	{
		result = parsestring_306904(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_307228(my);
		if (eqStrings((*my).a, ((NimStringDesc*) &TMP3110))) goto LA17;
		if (eqStrings((*my).a, ((NimStringDesc*) &TMP3111))) goto LA18;
		if (eqStrings((*my).a, ((NimStringDesc*) &TMP3112))) 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_307444)(TY306060** s) {
	NU8 result;
	NI L;
	result = 0;
	L = (NI)(((*s) ? (*s)->Sup.len : 0) - ((NI) 1));
	result = (*s)->data[L];
	(*s) = (TY306060*) setLengthSeq(&((*s))->Sup, sizeof(NU8), ((NI) (L)));
	return result;
}

N_NIMCALL(void, next_307334)(Jsonparser306010* my) {
	NU8 tk;
	NI i;
	tk = gettok_307264(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 = (TY306060*) 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 = (TY306060*) 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 = (TY306060*) 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 = (TY306060*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 6);
			++(*my).state->Sup.len;
			(*my).state = (TY306060*) 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 = (TY306060*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 6);
			++(*my).state->Sup.len;
			(*my).state = (TY306060*) 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_307444((&(*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 = (TY306060*) 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 = (TY306060*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 4);
			++(*my).state->Sup.len;
			(*my).state = (TY306060*) 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 = (TY306060*) incrSeqV2(&((*my).state)->Sup, sizeof(NU8));
			(*my).state->data[(*my).state->Sup.len] = ((NU8) 4);
			++(*my).state->Sup.len;
			(*my).state = (TY306060*) 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_307444((&(*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_307444((&(*my).state));
			next_307334(my);
		}
		break;
		case ((NU8) 11):
		{
			NU8 LOC31;
			NU8 LOC32;
			(*my).kind = ((NU8) 11);
			LOC31 = 0;
			LOC31 = pop_307444((&(*my).state));
			LOC32 = 0;
			LOC32 = pop_307444((&(*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_307444((&(*my).state));
			next_307334(my);
		}
		break;
		case ((NU8) 9):
		{
			NU8 LOC38;
			NU8 LOC39;
			(*my).kind = ((NU8) 9);
			LOC38 = 0;
			LOC38 = pop_307444((&(*my).state));
			LOC39 = 0;
			LOC39 = pop_307444((&(*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_307334(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 = (TY306060*) 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 = (TY306060*) 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, TMP3113)(void* p, NI op) {
	Jsonparsingerror307635* a;
	a = (Jsonparsingerror307635*)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_306609)(Jsonparser306010* my) {
	NI result;
	result = 0;
	result = (*my).Sup.linenumber;
	return result;
}

static N_INLINE(NI, getcolumn_306605)(Jsonparser306010* my) {
	NI result;
	result = 0;
	result = getcolnumber_268802((&(*my).Sup), (*my).Sup.bufpos);
	return result;
}

N_NIMCALL(NimStringDesc*, errormsgexpected_306803)(Jsonparser306010* my, NimStringDesc* e) {
	NimStringDesc* result;
	TY186781 LOC1;
	NI LOC2;
	NI LOC3;
	NimStringDesc* LOC4;
	result = 0;
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC1[0] = copyString((*my).filename);
	LOC2 = 0;
	LOC2 = getline_306609(my);
	LOC1[1] = nimIntToStr(LOC2);
	LOC3 = 0;
	LOC3 = getcolumn_306605(my);
	LOC1[2] = nimIntToStr(LOC3);
	LOC4 = 0;
	LOC4 = rawNewString(e->Sup.len + 9);
appendString(LOC4, e);
appendString(LOC4, ((NimStringDesc*) &TMP3115));
	LOC1[3] = LOC4;
	result = nsuFormatOpenArray(((NimStringDesc*) &TMP3114), LOC1, 4);
	return result;
}

static N_INLINE(Cell47505*, usrtocell_51440)(void* usr) {
	Cell47505* result;
	result = 0;
	result = ((Cell47505*) ((NI)((NU64)(((NI) (usr))) - (NU64)(((NI)sizeof(Cell47505))))));
	return result;
}

static N_INLINE(void, rtladdzct_53001)(Cell47505* c) {
	addzct_51417((&gch_49859.zct), c);
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		Cell47505* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_51440(src);
		(*c).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Cell47505* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_51440((*dest));
		{
			(*c).refcount -= ((NI) 8);
			if (!((NU64)((*c).refcount) < (NU64)(((NI) 8)))) goto LA11;
			rtladdzct_53001(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NOINLINE(void, raiseparseerr_307659)(Jsonparser306010* p, NimStringDesc* msg) {
	Jsonparsingerror307635* e_307666;
	e_307666 = 0;
	e_307666 = (Jsonparsingerror307635*) newObj((&NTI307667), sizeof(Jsonparsingerror307635));
	(*e_307666).Sup.Sup.Sup.m_type = (&NTI307635);
	asgnRefNoCycle((void**) (&(*e_307666).Sup.Sup.message), errormsgexpected_306803(p, msg));
	raiseException((Exception*)e_307666, "JsonParsingError");
}

N_NIMCALL(NimStringDesc*, escapejson_311644)(NimStringDesc* s) {
	NimStringDesc* result;
	result = 0;
	result = rawNewString(((NI) ((NI)((s ? s->Sup.len : 0) + (NI)((NU64)((s ? s->Sup.len : 0)) >> (NU64)(((NI) 3)))))));
	result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP3139));
	{
		NI x_311648;
		NI i_311656;
		NI result_311658;
		x_311648 = 0;
		i_311656 = ((NI) 0);
		result_311658 = 0;
		{
			while (1) {
				NI r;
				if (!(i_311656 < (s ? s->Sup.len : 0))) goto LA3;
				{
					if (!((NU64)(((NI) (((NU8)(s->data[i_311656]))))) <= (NU64)(((NI) 127)))) goto LA6;
					result_311658 = ((NI) (((NU8)(s->data[i_311656]))));
					i_311656 += ((NI) 1);
				}
				goto LA4;
				LA6: ;
				{
					if (!((NI)((NU64)(((NI) (((NU8)(s->data[i_311656]))))) >> (NU64)(((NI) 5))) == ((NI) 6))) goto LA9;
					result_311658 = (NI)((NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[i_311656])))) & ((NI) 31))))) << (NU64)(((NI) 6))) | ((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 1))])))) & ((NI) 63)))));
					i_311656 += ((NI) 2);
				}
				goto LA4;
				LA9: ;
				{
					if (!((NI)((NU64)(((NI) (((NU8)(s->data[i_311656]))))) >> (NU64)(((NI) 4))) == ((NI) 14))) goto LA12;
					result_311658 = (NI)((NI)((NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[i_311656])))) & ((NI) 15))))) << (NU64)(((NI) 12))) | (NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 1))])))) & ((NI) 63))))) << (NU64)(((NI) 6)))) | ((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 2))])))) & ((NI) 63)))));
					i_311656 += ((NI) 3);
				}
				goto LA4;
				LA12: ;
				{
					if (!((NI)((NU64)(((NI) (((NU8)(s->data[i_311656]))))) >> (NU64)(((NI) 3))) == ((NI) 30))) goto LA15;
					result_311658 = (NI)((NI)((NI)((NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[i_311656])))) & ((NI) 7))))) << (NU64)(((NI) 18))) | (NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 1))])))) & ((NI) 63))))) << (NU64)(((NI) 12)))) | (NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 2))])))) & ((NI) 63))))) << (NU64)(((NI) 6)))) | ((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 3))])))) & ((NI) 63)))));
					i_311656 += ((NI) 4);
				}
				goto LA4;
				LA15: ;
				{
					if (!((NI)((NU64)(((NI) (((NU8)(s->data[i_311656]))))) >> (NU64)(((NI) 2))) == ((NI) 62))) goto LA18;
					result_311658 = (NI)((NI)((NI)((NI)((NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[i_311656])))) & ((NI) 3))))) << (NU64)(((NI) 24))) | (NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 1))])))) & ((NI) 63))))) << (NU64)(((NI) 18)))) | (NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 2))])))) & ((NI) 63))))) << (NU64)(((NI) 12)))) | (NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 3))])))) & ((NI) 63))))) << (NU64)(((NI) 6)))) | ((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 4))])))) & ((NI) 63)))));
					i_311656 += ((NI) 5);
				}
				goto LA4;
				LA18: ;
				{
					if (!((NI)((NU64)(((NI) (((NU8)(s->data[i_311656]))))) >> (NU64)(((NI) 1))) == ((NI) 126))) goto LA21;
					result_311658 = (NI)((NI)((NI)((NI)((NI)((NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[i_311656])))) & ((NI) 1))))) << (NU64)(((NI) 30))) | (NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 1))])))) & ((NI) 63))))) << (NU64)(((NI) 24)))) | (NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 2))])))) & ((NI) 63))))) << (NU64)(((NI) 18)))) | (NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 3))])))) & ((NI) 63))))) << (NU64)(((NI) 12)))) | (NI)((NU64)(((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 4))])))) & ((NI) 63))))) << (NU64)(((NI) 6)))) | ((NI) ((NI)(((NI) (((NU8)(s->data[(NI)(i_311656 + ((NI) 5))])))) & ((NI) 63)))));
					i_311656 += ((NI) 6);
				}
				goto LA4;
				LA21: ;
				{
					result_311658 = ((NI) (((NU8)(s->data[i_311656]))));
					i_311656 += ((NI) 1);
				}
				LA4: ;
				x_311648 = result_311658;
				r = x_311648;
				{
					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*) &TMP3140));
					}
					break;
					case 92:
					{
						result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP3141));
					}
					break;
					default:
					{
						result = addChar(result, c);
					}
					break;
					}
				}
				goto LA24;
				LA28: ;
				{
					NimStringDesc* LOC34;
					result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP3109));
					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*) &TMP3139));
	return result;
}
N_NIMCALL(void, TMP5174)(void* p, NI op) {
	TY307648* a;
	NI LOC1;
	a = (TY307648*)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, TMP5175)(void* p, NI op) {
	TY307653* a;
	NI LOC1;
	a = (TY307653*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	nimGCvisit((void*)a->data[LOC1], op);
	}
}
N_NIMCALL(void, TMP5176)(void* p, NI op) {
	Jsonnodeobj307633* a;
	a = (Jsonnodeobj307633*)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) {
	Cell47505* c;
	c = usrtocell_51440(p);
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU64)((*c).refcount) < (NU64)(((NI) 8)))) goto LA3;
		rtladdzct_53001(c);
	}
	LA3: ;
}

N_NIMCALL(Jsonnodeobj307633*, HEX25_308040)(TY308043* keyvals, NI keyvalsLen0) {
	Jsonnodeobj307633* result;
	result = 0;
	result = (Jsonnodeobj307633*) newObj((&NTI307631), sizeof(Jsonnodeobj307633));
	(*result).kind = ((NU8) 5);
	if ((*result).kindU.S6.fields) nimGCunrefNoCycle((*result).kindU.S6.fields);
	(*result).kindU.S6.fields = (TY307648*) newSeqRC1((&NTI307648), ((NI) (keyvalsLen0)));
	{
		NI i_308105;
		TY308043 p_308106;
		NI i_308111;
		i_308105 = 0;
		memset((void*)(&p_308106), 0, sizeof(p_308106));
		i_308111 = ((NI) 0);
		{
			while (1) {
				NimStringDesc* LOC4;
				if (!(i_308111 < keyvalsLen0)) goto LA3;
				i_308105 = i_308111;
				p_308106.Field0 = keyvals[i_308111].Field0;
				p_308106.Field1 = keyvals[i_308111].Field1;
				LOC4 = 0;
				LOC4 = (*result).kindU.S6.fields->data[i_308105].Field0; (*result).kindU.S6.fields->data[i_308105].Field0 = copyStringRC1(p_308106.Field0);
				if (LOC4) nimGCunrefNoCycle(LOC4);
				asgnRefNoCycle((void**) (&(*result).kindU.S6.fields->data[i_308105].Field1), p_308106.Field1);
				i_308111 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}

N_NIMCALL(Jsonnodeobj307633*, HEX25_307988)(NimStringDesc* s) {
	Jsonnodeobj307633* result;
	NimStringDesc* LOC1;
	result = 0;
	result = (Jsonnodeobj307633*) newObj((&NTI307631), sizeof(Jsonnodeobj307633));
	(*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_308431)(Jsonnodeobj307633* a, Jsonnodeobj307633* 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_308483((*a).kindU.S7.elems, (*b).kindU.S7.elems);
		}
		break;
		case ((NU8) 5):
		{
			result = HEX3DHEX3D_308571((*a).kindU.S6.fields, (*b).kindU.S6.fields);
		}
		break;
		}
		goto BeforeRet;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Jsonnodeobj307633*, newjarray_307781)(void) {
	Jsonnodeobj307633* result;
	result = 0;
	result = (Jsonnodeobj307633*) newObj((&NTI307631), sizeof(Jsonnodeobj307633));
	(*result).kind = ((NU8) 6);
	if ((*result).kindU.S7.elems) nimGCunrefNoCycle((*result).kindU.S7.elems);
	(*result).kindU.S7.elems = (TY307653*) newSeqRC1((&NTI307653), 0);
	return result;
}

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

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

N_NIMCALL(void, indent_311628)(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_311633)(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_311666)(NimStringDesc** result, Jsonnodeobj307633* 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_311639(result, ml);
		}
		LA6: ;
		indent_311628(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*) &TMP5182));
			nl_311639(result, ml);
			{
				NI i_311702;
				NI HEX3Atmp_311739;
				NI res_311742;
				i_311702 = 0;
				HEX3Atmp_311739 = 0;
				HEX3Atmp_311739 = (NI)(((*node).kindU.S6.fields ? (*node).kindU.S6.fields->Sup.len : 0) - ((NI) 1));
				res_311742 = ((NI) 0);
				{
					while (1) {
						NI LOC19;
						NimStringDesc* LOC20;
						NI LOC21;
						if (!(res_311742 <= HEX3Atmp_311739)) goto LA14;
						i_311702 = res_311742;
						{
							if (!(((NI) 0) < i_311702)) goto LA17;
							(*result) = resizeString((*result), 2);
appendString((*result), ((NimStringDesc*) &TMP5183));
							nl_311639(result, ml);
						}
						LA17: ;
						LOC19 = 0;
						LOC19 = newindent_311633(currindent, indent, ml);
						indent_311628(result, LOC19);
						LOC20 = 0;
						LOC20 = escapejson_311644((*node).kindU.S6.fields->data[i_311702].Field0);
						(*result) = resizeString((*result), LOC20->Sup.len + 0);
appendString((*result), LOC20);
						(*result) = resizeString((*result), 2);
appendString((*result), ((NimStringDesc*) &TMP5184));
						LOC21 = 0;
						LOC21 = newindent_311633(currindent, indent, ml);
						topretty_311666(result, (*node).kindU.S6.fields->data[i_311702].Field1, indent, ml, NIM_FALSE, LOC21);
						res_311742 += ((NI) 1);
					} LA14: ;
				}
			}
			nl_311639(result, ml);
			indent_311628(result, currindent);
			(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5185));
		}
		goto LA8;
		LA10: ;
		{
			(*result) = resizeString((*result), 2);
appendString((*result), ((NimStringDesc*) &TMP5186));
		}
		LA8: ;
	}
	break;
	case ((NU8) 4):
	{
		NimStringDesc* LOC28;
		{
			if (!lstarr) goto LA26;
			indent_311628(result, currindent);
		}
		LA26: ;
		LOC28 = 0;
		LOC28 = escapejson_311644((*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_311628(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_311628(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_311628(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_311628(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*) &TMP5187));
			nl_311639(result, ml);
			{
				NI i_311736;
				NI HEX3Atmp_311747;
				NI res_311750;
				i_311736 = 0;
				HEX3Atmp_311747 = 0;
				HEX3Atmp_311747 = (NI)(((*node).kindU.S7.elems ? (*node).kindU.S7.elems->Sup.len : 0) - ((NI) 1));
				res_311750 = ((NI) 0);
				{
					while (1) {
						NI LOC63;
						if (!(res_311750 <= HEX3Atmp_311747)) goto LA58;
						i_311736 = res_311750;
						{
							if (!(((NI) 0) < i_311736)) goto LA61;
							(*result) = resizeString((*result), 2);
appendString((*result), ((NimStringDesc*) &TMP5183));
							nl_311639(result, ml);
						}
						LA61: ;
						LOC63 = 0;
						LOC63 = newindent_311633(currindent, indent, ml);
						topretty_311666(result, (*node).kindU.S7.elems->data[i_311736], indent, ml, NIM_TRUE, LOC63);
						res_311750 += ((NI) 1);
					} LA58: ;
				}
			}
			nl_311639(result, ml);
			indent_311628(result, currindent);
			(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5188));
		}
		goto LA52;
		LA54: ;
		{
			(*result) = resizeString((*result), 2);
appendString((*result), ((NimStringDesc*) &TMP5189));
		}
		LA52: ;
	}
	break;
	case ((NU8) 0):
	{
		{
			if (!lstarr) goto LA68;
			indent_311628(result, currindent);
		}
		LA68: ;
		(*result) = resizeString((*result), 4);
appendString((*result), ((NimStringDesc*) &TMP3110));
	}
	break;
	}
}

N_NIMCALL(NimStringDesc*, pretty_311754)(Jsonnodeobj307633* node, NI indent) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP3103));
	topretty_311666((&result), node, indent, NIM_TRUE, NIM_FALSE, ((NI) 0));
	return result;
}

N_NIMCALL(NI, len_308782)(Jsonnodeobj307633* 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_311760)(NimStringDesc** result, Jsonnodeobj307633* node) {
	NIM_BOOL comma;
	comma = NIM_FALSE;
	switch ((*node).kind) {
	case ((NU8) 6):
	{
		(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5187));
		{
			Jsonnodeobj307633* child_311775;
			TY307653* HEX3Atmp_311792;
			NI i_311795;
			NI L_311797;
			child_311775 = 0;
			HEX3Atmp_311792 = 0;
			HEX3Atmp_311792 = (*node).kindU.S7.elems;
			i_311795 = ((NI) 0);
			L_311797 = (HEX3Atmp_311792 ? HEX3Atmp_311792->Sup.len : 0);
			{
				while (1) {
					if (!(i_311795 < L_311797)) goto LA4;
					child_311775 = HEX3Atmp_311792->data[i_311795];
					{
						if (!comma) goto LA7;
						(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5248));
					}
					goto LA5;
					LA7: ;
					{
						comma = NIM_TRUE;
					}
					LA5: ;
					tougly_311760(result, child_311775);
					i_311795 += ((NI) 1);
				} LA4: ;
			}
		}
		(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5188));
	}
	break;
	case ((NU8) 5):
	{
		(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5182));
		{
			NimStringDesc* key_311785;
			Jsonnodeobj307633* value_311786;
			TY307648* HEX3Atmp_311799;
			NI i_311802;
			NI L_311804;
			key_311785 = 0;
			value_311786 = 0;
			HEX3Atmp_311799 = 0;
			HEX3Atmp_311799 = (*node).kindU.S6.fields;
			i_311802 = ((NI) 0);
			L_311804 = (HEX3Atmp_311799 ? HEX3Atmp_311799->Sup.len : 0);
			{
				while (1) {
					NimStringDesc* LOC19;
					if (!(i_311802 < L_311804)) goto LA13;
					key_311785 = HEX3Atmp_311799->data[i_311802].Field0;
					value_311786 = HEX3Atmp_311799->data[i_311802].Field1;
					{
						if (!comma) goto LA16;
						(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5248));
					}
					goto LA14;
					LA16: ;
					{
						comma = NIM_TRUE;
					}
					LA14: ;
					LOC19 = 0;
					LOC19 = escapejson_311644(key_311785);
					(*result) = resizeString((*result), LOC19->Sup.len + 0);
appendString((*result), LOC19);
					(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5249));
					tougly_311760(result, value_311786);
					i_311802 += ((NI) 1);
				} LA13: ;
			}
		}
		(*result) = resizeString((*result), 1);
appendString((*result), ((NimStringDesc*) &TMP5185));
	}
	break;
	case ((NU8) 4):
	{
		NimStringDesc* LOC21;
		LOC21 = 0;
		LOC21 = escapejson_311644((*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*) &TMP3111));
		}
		goto LA28;
		LA30: ;
		{
			LOC27 = copyString(((NimStringDesc*) &TMP3112));
		}
		LA28: ;
		(*result) = resizeString((*result), LOC27->Sup.len + 0);
appendString((*result), LOC27);
	}
	break;
	case ((NU8) 0):
	{
		(*result) = resizeString((*result), 4);
appendString((*result), ((NimStringDesc*) &TMP3110));
	}
	break;
	}
}

N_NIMCALL(NimStringDesc*, HEX24_311805)(Jsonnodeobj307633* node) {
	NimStringDesc* result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = len_308782(node);
	result = rawNewString(((NI) ((NI)((NU64)(LOC1) << (NU64)(((NI) 1))))));
	tougly_311760((&result), node);
	return result;
}
NIM_EXTERNC N_NOINLINE(void, stdlib_jsonInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, stdlib_jsonDatInit000)(void) {
static TNimNode* TMP3086[6];
static TNimNode* TMP3087[14];
NI TMP3089;
static char* NIM_CONST TMP3088[14] = {
"tkError", 
"tkEof", 
"tkString", 
"tkInt", 
"tkFloat", 
"tkTrue", 
"tkFalse", 
"tkNull", 
"tkCurlyLe", 
"tkCurlyRi", 
"tkBracketLe", 
"tkBracketRi", 
"tkColon", 
"tkComma"};
static TNimNode* TMP3090[12];
NI TMP3092;
static char* NIM_CONST TMP3091[12] = {
"jsonError", 
"jsonEof", 
"jsonString", 
"jsonInt", 
"jsonFloat", 
"jsonTrue", 
"jsonFalse", 
"jsonNull", 
"jsonObjectStart", 
"jsonObjectEnd", 
"jsonArrayStart", 
"jsonArrayEnd"};
static TNimNode* TMP3093[11];
NI TMP3095;
static char* NIM_CONST TMP3094[11] = {
"errNone", 
"errInvalidToken", 
"errStringExpected", 
"errColonExpected", 
"errCommaExpected", 
"errBracketRiExpected", 
"errCurlyRiExpected", 
"errQuoteExpected", 
"errEOC_Expected", 
"errEofExpected", 
"errExprExpected"};
static TNimNode* TMP3096[8];
NI TMP3098;
static char* NIM_CONST TMP3097[8] = {
"stateEof", 
"stateStart", 
"stateObject", 
"stateArray", 
"stateExpectArrayComma", 
"stateExpectObjectComma", 
"stateExpectColon", 
"stateExpectValue"};
static TNimNode* TMP5170[7];
NI TMP5172;
static char* NIM_CONST TMP5171[7] = {
"JNull", 
"JBool", 
"JInt", 
"JFloat", 
"JString", 
"JObject", 
"JArray"};
static TNimNode* TMP5173[2];
static TNimNode TMP969[76];
NTI306010.size = sizeof(Jsonparser306010);
NTI306010.kind = 17;
NTI306010.base = (&NTI266009);
TMP3086[0] = &TMP969[1];
TMP969[1].kind = 1;
TMP969[1].offset = offsetof(Jsonparser306010, a);
TMP969[1].typ = (&NTI138);
TMP969[1].name = "a";
TMP3086[1] = &TMP969[2];
NTI306004.size = sizeof(NU8);
NTI306004.kind = 14;
NTI306004.base = 0;
NTI306004.flags = 3;
for (TMP3089 = 0; TMP3089 < 14; TMP3089++) {
TMP969[TMP3089+3].kind = 1;
TMP969[TMP3089+3].offset = TMP3089;
TMP969[TMP3089+3].name = TMP3088[TMP3089];
TMP3087[TMP3089] = &TMP969[TMP3089+3];
}
TMP969[17].len = 14; TMP969[17].kind = 2; TMP969[17].sons = &TMP3087[0];
NTI306004.node = &TMP969[17];
TMP969[2].kind = 1;
TMP969[2].offset = offsetof(Jsonparser306010, tok);
TMP969[2].typ = (&NTI306004);
TMP969[2].name = "tok";
TMP3086[2] = &TMP969[18];
NTI306002.size = sizeof(NU8);
NTI306002.kind = 14;
NTI306002.base = 0;
NTI306002.flags = 3;
for (TMP3092 = 0; TMP3092 < 12; TMP3092++) {
TMP969[TMP3092+19].kind = 1;
TMP969[TMP3092+19].offset = TMP3092;
TMP969[TMP3092+19].name = TMP3091[TMP3092];
TMP3090[TMP3092] = &TMP969[TMP3092+19];
}
TMP969[31].len = 12; TMP969[31].kind = 2; TMP969[31].sons = &TMP3090[0];
NTI306002.node = &TMP969[31];
TMP969[18].kind = 1;
TMP969[18].offset = offsetof(Jsonparser306010, kind);
TMP969[18].typ = (&NTI306002);
TMP969[18].name = "kind";
TMP3086[3] = &TMP969[32];
NTI306006.size = sizeof(NU8);
NTI306006.kind = 14;
NTI306006.base = 0;
NTI306006.flags = 3;
for (TMP3095 = 0; TMP3095 < 11; TMP3095++) {
TMP969[TMP3095+33].kind = 1;
TMP969[TMP3095+33].offset = TMP3095;
TMP969[TMP3095+33].name = TMP3094[TMP3095];
TMP3093[TMP3095] = &TMP969[TMP3095+33];
}
TMP969[44].len = 11; TMP969[44].kind = 2; TMP969[44].sons = &TMP3093[0];
NTI306006.node = &TMP969[44];
TMP969[32].kind = 1;
TMP969[32].offset = offsetof(Jsonparser306010, err);
TMP969[32].typ = (&NTI306006);
TMP969[32].name = "err";
TMP3086[4] = &TMP969[45];
NTI306008.size = sizeof(NU8);
NTI306008.kind = 14;
NTI306008.base = 0;
NTI306008.flags = 3;
for (TMP3098 = 0; TMP3098 < 8; TMP3098++) {
TMP969[TMP3098+46].kind = 1;
TMP969[TMP3098+46].offset = TMP3098;
TMP969[TMP3098+46].name = TMP3097[TMP3098];
TMP3096[TMP3098] = &TMP969[TMP3098+46];
}
TMP969[54].len = 8; TMP969[54].kind = 2; TMP969[54].sons = &TMP3096[0];
NTI306008.node = &TMP969[54];
NTI306060.size = sizeof(TY306060*);
NTI306060.kind = 24;
NTI306060.base = (&NTI306008);
NTI306060.flags = 2;
NTI306060.marker = TMP3099;
TMP969[45].kind = 1;
TMP969[45].offset = offsetof(Jsonparser306010, state);
TMP969[45].typ = (&NTI306060);
TMP969[45].name = "state";
TMP3086[5] = &TMP969[55];
TMP969[55].kind = 1;
TMP969[55].offset = offsetof(Jsonparser306010, filename);
TMP969[55].typ = (&NTI138);
TMP969[55].name = "filename";
TMP969[0].len = 6; TMP969[0].kind = 2; TMP969[0].sons = &TMP3086[0];
NTI306010.node = &TMP969[0];
NTI307635.size = sizeof(Jsonparsingerror307635);
NTI307635.kind = 17;
NTI307635.base = (&NTI3646);
TMP969[56].len = 0; TMP969[56].kind = 2;
NTI307635.node = &TMP969[56];
NTI307667.size = sizeof(Jsonparsingerror307635*);
NTI307667.kind = 22;
NTI307667.base = (&NTI307635);
NTI307667.marker = TMP3113;
NTI307633.size = sizeof(Jsonnodeobj307633);
NTI307633.kind = 18;
NTI307633.base = 0;
NTI307633.flags = 2;
NTI307629.size = sizeof(NU8);
NTI307629.kind = 14;
NTI307629.base = 0;
NTI307629.flags = 3;
for (TMP5172 = 0; TMP5172 < 7; TMP5172++) {
TMP969[TMP5172+58].kind = 1;
TMP969[TMP5172+58].offset = TMP5172;
TMP969[TMP5172+58].name = TMP5171[TMP5172];
TMP5170[TMP5172] = &TMP969[TMP5172+58];
}
TMP969[65].len = 7; TMP969[65].kind = 2; TMP969[65].sons = &TMP5170[0];
NTI307629.node = &TMP969[65];
TMP969[57].kind = 3;
TMP969[57].offset = offsetof(Jsonnodeobj307633, kind);
TMP969[57].typ = (&NTI307629);
TMP969[57].name = "kind";
TMP969[57].sons = &NimDT_307633_kind[0];
TMP969[57].len = 7;
TMP969[66].kind = 1;
TMP969[66].offset = offsetof(Jsonnodeobj307633, kindU.S1.str);
TMP969[66].typ = (&NTI138);
TMP969[66].name = "str";
NimDT_307633_kind[4] = &TMP969[66];
TMP969[67].kind = 1;
TMP969[67].offset = offsetof(Jsonnodeobj307633, kindU.S2.num);
TMP969[67].typ = (&NTI7088);
TMP969[67].name = "num";
NimDT_307633_kind[2] = &TMP969[67];
TMP969[68].kind = 1;
TMP969[68].offset = offsetof(Jsonnodeobj307633, kindU.S3.fnum);
TMP969[68].typ = (&NTI124);
TMP969[68].name = "fnum";
NimDT_307633_kind[3] = &TMP969[68];
TMP969[69].kind = 1;
TMP969[69].offset = offsetof(Jsonnodeobj307633, kindU.S4.bval);
TMP969[69].typ = (&NTI130);
TMP969[69].name = "bval";
NimDT_307633_kind[1] = &TMP969[69];
TMP969[70].len = 0; TMP969[70].kind = 2;
NimDT_307633_kind[0] = &TMP969[70];
NTI308043.size = sizeof(TY308043);
NTI308043.kind = 18;
NTI308043.base = 0;
NTI308043.flags = 2;
TMP5173[0] = &TMP969[73];
TMP969[73].kind = 1;
TMP969[73].offset = offsetof(TY308043, Field0);
TMP969[73].typ = (&NTI138);
TMP969[73].name = "Field0";
TMP5173[1] = &TMP969[74];
TMP969[74].kind = 1;
TMP969[74].offset = offsetof(TY308043, Field1);
TMP969[74].typ = (&NTI307631);
TMP969[74].name = "Field1";
TMP969[72].len = 2; TMP969[72].kind = 2; TMP969[72].sons = &TMP5173[0];
NTI308043.node = &TMP969[72];
NTI307648.size = sizeof(TY307648*);
NTI307648.kind = 24;
NTI307648.base = (&NTI308043);
NTI307648.flags = 2;
NTI307648.marker = TMP5174;
TMP969[71].kind = 1;
TMP969[71].offset = offsetof(Jsonnodeobj307633, kindU.S6.fields);
TMP969[71].typ = (&NTI307648);
TMP969[71].name = "fields";
NimDT_307633_kind[5] = &TMP969[71];
NTI307653.size = sizeof(TY307653*);
NTI307653.kind = 24;
NTI307653.base = (&NTI307631);
NTI307653.flags = 2;
NTI307653.marker = TMP5175;
TMP969[75].kind = 1;
TMP969[75].offset = offsetof(Jsonnodeobj307633, kindU.S7.elems);
TMP969[75].typ = (&NTI307653);
TMP969[75].name = "elems";
NimDT_307633_kind[6] = &TMP969[75];
NTI307633.node = &TMP969[57];
NTI307631.size = sizeof(Jsonnodeobj307633*);
NTI307631.kind = 22;
NTI307631.base = (&NTI307633);
NTI307631.flags = 2;
NTI307631.marker = TMP5176;
}

