/* Generated by Nim Compiler v0.10.2 */
/*   (c) 2014 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 64
#include "nimbase.h"

#include <string.h>
typedef struct tidtable226864 tidtable226864;
typedef struct tidpairseq226862 tidpairseq226862;
typedef struct tidpair226860 tidpair226860;
typedef struct tidobj201015 tidobj201015;
typedef struct TNimObject TNimObject;
typedef struct TGenericSeq TGenericSeq;
typedef struct ttype226852 ttype226852;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct ttypeseq226848 ttypeseq226848;
typedef struct tnode226816 tnode226816;
typedef struct tsym226846 tsym226846;
typedef struct tloc226830 tloc226830;
typedef struct trope178009 trope178009;
typedef struct tcell44933 tcell44933;
typedef struct tcellseq44949 tcellseq44949;
typedef struct tgcheap47016 tgcheap47016;
typedef struct tcellset44945 tcellset44945;
typedef struct tpagedesc44941 tpagedesc44941;
typedef struct tmemregion27210 tmemregion27210;
typedef struct tsmallchunk26440 tsmallchunk26440;
typedef struct tllchunk27204 tllchunk27204;
typedef struct tbigchunk26442 tbigchunk26442;
typedef struct tintset26417 tintset26417;
typedef struct ttrunk26413 ttrunk26413;
typedef struct tavlnode27208 tavlnode27208;
typedef struct tgcstat47014 tgcstat47014;
typedef struct NimStringDesc NimStringDesc;
typedef struct tlineinfo196539 tlineinfo196539;
typedef struct tident201021 tident201021;
typedef struct tnodeseq226810 tnodeseq226810;
typedef struct tinfocpu175463 tinfocpu175463;
typedef struct tscope226840 tscope226840;
typedef struct TY226947 TY226947;
typedef struct tinstantiation226836 tinstantiation226836;
typedef struct tstrtable226820 tstrtable226820;
typedef struct tsymseq226818 tsymseq226818;
typedef struct tlib226834 tlib226834;
typedef struct tbasechunk26438 tbasechunk26438;
typedef struct tfreecell26430 tfreecell26430;
typedef struct TY226936 TY226936;
typedef struct tlistentry127022 tlistentry127022;
struct  tidpair226860  {
tidobj201015* Key;
TNimObject* Val;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  tidtable226864  {
NI Counter;
tidpairseq226862* Data;
};
typedef tidtable226864 TY549278[62];
typedef ttype226852* TY283060[62];
typedef N_NIMCALL_PTR(void, TY3089) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3094) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3089 marker;
TY3094 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  tidobj201015  {
  TNimObject Sup;
NI Id;
};
struct  tloc226830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype226852* T;
trope178009* R;
trope178009* Heaproot;
};
struct  ttype226852  {
  tidobj201015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq226848* Sons;
tnode226816* N;
tsym226846* Owner;
tsym226846* Sym;
tsym226846* Destructor;
tsym226846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc226830 Loc;
};
struct  tcell44933  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq44949  {
NI Len;
NI Cap;
tcell44933** D;
};
struct  tcellset44945  {
NI Counter;
NI Max;
tpagedesc44941* Head;
tpagedesc44941** Data;
};
typedef tsmallchunk26440* TY27222[512];
typedef ttrunk26413* ttrunkbuckets26415[256];
struct  tintset26417  {
ttrunkbuckets26415 Data;
};
struct  tmemregion27210  {
NI Minlargeobj;
NI Maxlargeobj;
TY27222 Freesmallchunks;
tllchunk27204* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk26442* Freechunkslist;
tintset26417 Chunkstarts;
tavlnode27208* Root;
tavlnode27208* Deleted;
tavlnode27208* Last;
tavlnode27208* Freeavlnodes;
};
struct  tgcstat47014  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap47016  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq44949 Zct;
tcellseq44949 Decstack;
tcellset44945 Cycleroots;
tcellseq44949 Tempstack;
NI Recgclock;
tmemregion27210 Region;
tgcstat47014 Stat;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  tlineinfo196539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  tnode226816  {
ttype226852* Typ;
tlineinfo196539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym226846* Sym;
} S4;
struct {tident201021* Ident;
} S5;
struct {tnodeseq226810* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
struct tinfocpu175463 {
NimStringDesc* Field0;
NI Field1;
NU8 Field2;
NI Field3;
NI Field4;
};
typedef tinfocpu175463 TY175481[14];
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tstrtable226820  {
NI Counter;
tsymseq226818* Data;
};
struct  tsym226846  {
  tidobj201015 Sup;
NU8 Kind;
union {
struct {ttypeseq226848* Typeinstcache;
tscope226840* Typscope;
} S1;
struct {TY226947* Procinstcache;
tscope226840* Scope;
} S2;
struct {TY226947* Usedgenerics;
tstrtable226820 Tab;
} S3;
struct {tsym226846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype226852* Typ;
tident201021* Name;
tlineinfo196539 Info;
tsym226846* Owner;
NU32 Flags;
tnode226816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc226830 Loc;
tlib226834* Annex;
tnode226816* Constraint;
};
struct  trope178009  {
  TNimObject Sup;
trope178009* Left;
trope178009* Right;
NI Length;
NimStringDesc* Data;
};
typedef NI TY26420[8];
struct  tpagedesc44941  {
tpagedesc44941* Next;
NI Key;
TY26420 Bits;
};
struct  tbasechunk26438  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk26440  {
  tbasechunk26438 Sup;
tsmallchunk26440* Next;
tsmallchunk26440* Prev;
tfreecell26430* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk27204  {
NI Size;
NI Acc;
tllchunk27204* Next;
};
struct  tbigchunk26442  {
  tbasechunk26438 Sup;
tbigchunk26442* Next;
tbigchunk26442* Prev;
NI Align;
NF Data;
};
struct  ttrunk26413  {
ttrunk26413* Next;
NI Key;
TY26420 Bits;
};
typedef tavlnode27208* TY27214[2];
struct  tavlnode27208  {
TY27214 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  tident201021  {
  tidobj201015 Sup;
NimStringDesc* S;
tident201021* Next;
NI H;
};
struct  tscope226840  {
NI Depthlevel;
tstrtable226820 Symbols;
tnodeseq226810* Usingsyms;
tscope226840* Parent;
};
struct  tinstantiation226836  {
tsym226846* Sym;
ttypeseq226848* Concretetypes;
TY226936* Usedby;
};
struct  tlistentry127022  {
  TNimObject Sup;
tlistentry127022* Prev;
tlistentry127022* Next;
};
struct  tlib226834  {
  tlistentry127022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope178009* Name;
tnode226816* Path;
};
struct  tfreecell26430  {
tfreecell26430* Next;
NI Zerofield;
};
struct tidpairseq226862 {
  TGenericSeq Sup;
  tidpair226860 data[SEQ_DECL_SIZE];
};
struct ttypeseq226848 {
  TGenericSeq Sup;
  ttype226852* data[SEQ_DECL_SIZE];
};
struct tnodeseq226810 {
  TGenericSeq Sup;
  tnode226816* data[SEQ_DECL_SIZE];
};
struct TY226947 {
  TGenericSeq Sup;
  tinstantiation226836* data[SEQ_DECL_SIZE];
};
struct tsymseq226818 {
  TGenericSeq Sup;
  tsym226846* data[SEQ_DECL_SIZE];
};
struct TY226936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, inittypetables_549291)(void);
N_NIMCALL(void, initidtable_227167)(tidtable226864* x);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(tcell44933*, usrtocell_48646)(void* usr);
static N_INLINE(void, rtladdzct_50204)(tcell44933* c);
N_NOINLINE(void, addzct_48617)(tcellseq44949* s, tcell44933* c);
N_NIMCALL(void, internalerror_199006)(NimStringDesc* errmsg);
N_NIMCALL(ttype226852*, getuniquetype_549401)(ttype226852* key);
static N_INLINE(ttype226852*, lastson_227267)(ttype226852* n);
static N_INLINE(NI, sonslen_227255)(ttype226852* n);
N_NIMCALL(NIM_BOOL, idtablehasobjectaskey_236205)(tidtable226864 t, tidobj201015* key);
N_NIMCALL(NIM_BOOL, samebackendtype_271542)(ttype226852* x, ttype226852* y);
N_NIMCALL(void, idtableput_236196)(tidtable226864* t, tidobj201015* key, TNimObject* val);
N_NIMCALL(TNimObject*, idtableget_236182)(tidtable226864 t, tidobj201015* key);
N_NIMCALL(NIM_BOOL, sametype_269351)(ttype226852* a, ttype226852* b, NU8 flags);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(NIM_CHAR, nsuToLowerChar)(NIM_CHAR c);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_NIMCALL(NimStringDesc*, nsuToHex)(NI64 x, NI len);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(NimStringDesc*, tocchar_196649)(NIM_CHAR c);
N_NIMCALL(tnode226816*, getpragmastmt_549017)(tnode226816* n, NU8 w);
static N_INLINE(NI, len_227364)(tnode226816* n);
static N_INLINE(tnode226816*, HEX5BHEX5D_227698)(tnode226816* n, NI i);
N_NIMCALL(NU8, whichpragma_263304)(tnode226816* n);
N_NIMCALL(void, app_178052)(trope178009** a, trope178009* b);
N_NIMCALL(trope178009*, torope_178076)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newlen);
STRING_LITERAL(TMP3356, "GetUniqueType", 13);
STRING_LITERAL(TMP3363, "N", 1);
STRING_LITERAL(TMP3364, "HEX", 3);
STRING_LITERAL(TMP3455, "\"", 1);
STRING_LITERAL(TMP3966, "c\"", 2);
STRING_LITERAL(TMP3967, "\\00\"", 4);
extern NIM_CONST TY175481 cpu_175480;
TY549278 gtypetable_549281;
TY283060 gcanonicaltypes_549285;
extern tgcheap47016 gch_47044;
extern NU8 targetcpu_175587;

N_NIMCALL(void, inittypetables_549291)(void) {
	{
		NU8 i_549341;
		NU8 res_549348;
		i_549341 = 0;
		res_549348 = ((NU8) 0);
		{
			while (1) {
				if (!(res_549348 <= ((NU8) 61))) goto LA3;
				i_549341 = res_549348;
				initidtable_227167((&gtypetable_549281[(i_549341)- 0]));
				res_549348 += 1;
			} LA3: ;
		}
	}
}

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

static N_INLINE(void, rtladdzct_50204)(tcell44933* c) {
	addzct_48617((&gch_47044.Zct), c);
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		tcell44933* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_48646(src);
		(*c).Refcount += 8;
	}
	LA3: ;
	{
		tcell44933* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_48646((*dest));
		{
			(*c).Refcount -= 8;
			if (!((NU64)((*c).Refcount) < (NU64)(8))) goto LA11;
			rtladdzct_50204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

static N_INLINE(NI, sonslen_227255)(ttype226852* n) {
	NI result;
	result = 0;
	{
		if (!(*n).Sons == 0) goto LA3;
		result = 0;
	}
	goto LA1;
	LA3: ;
	{
		result = (*n).Sons->Sup.len;
	}
	LA1: ;
	return result;
}

static N_INLINE(ttype226852*, lastson_227267)(ttype226852* n) {
	ttype226852* result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = sonslen_227255(n);
	result = (*n).Sons->data[(NI64)(LOC1 - 1)];
	return result;
}

N_NIMCALL(ttype226852*, getuniquetype_549401)(ttype226852* key) {
	ttype226852* result;
	NU8 k;
	result = 0;
	{
		if (!(key == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	k = (*key).Kind;
	switch (k) {
	case ((NU8) 1):
	case ((NU8) 2):
	case ((NU8) 31) ... ((NU8) 44):
	{
		result = key;
	}
	break;
	case ((NU8) 3):
	case ((NU8) 5):
	case ((NU8) 6):
	case ((NU8) 7):
	case ((NU8) 26):
	case ((NU8) 28):
	case ((NU8) 29):
	case ((NU8) 0):
	case ((NU8) 45):
	{
		result = gcanonicaltypes_549285[(k)- 0];
		{
			if (!(result == NIM_NIL)) goto LA9;
			asgnRefNoCycle((void**) (&gcanonicaltypes_549285[(k)- 0]), key);
			result = key;
		}
		LA9: ;
	}
	break;
	case ((NU8) 8):
	case ((NU8) 51):
	case ((NU8) 12):
	case ((NU8) 60):
	case ((NU8) 61):
	case ((NU8) 54):
	case ((NU8) 52):
	case ((NU8) 53):
	case ((NU8) 55):
	case ((NU8) 56):
	case ((NU8) 57):
	case ((NU8) 58):
	{
		internalerror_199006(((NimStringDesc*) &TMP3356));
	}
	break;
	case ((NU8) 13):
	{
		{
			if (!!(((*key).Deepcopy == NIM_NIL))) goto LA15;
			result = key;
		}
		goto LA13;
		LA15: ;
		{
			ttype226852* LOC18;
			LOC18 = 0;
			LOC18 = lastson_227267(key);
			result = getuniquetype_549401(LOC18);
		}
		LA13: ;
	}
	break;
	case ((NU8) 11):
	case ((NU8) 15):
	case ((NU8) 47):
	case ((NU8) 46):
	case ((NU8) 49):
	case ((NU8) 59):
	{
		ttype226852* LOC20;
		LOC20 = 0;
		LOC20 = lastson_227267(key);
		result = getuniquetype_549401(LOC20);
	}
	break;
	case ((NU8) 4):
	case ((NU8) 9):
	case ((NU8) 10):
	case ((NU8) 27):
	case ((NU8) 16):
	case ((NU8) 19):
	case ((NU8) 20):
	case ((NU8) 18):
	case ((NU8) 21):
	case ((NU8) 22):
	case ((NU8) 24):
	case ((NU8) 30):
	case ((NU8) 48):
	case ((NU8) 50):
	case ((NU8) 23):
	{
		tidobj201015* LOC37;
		TNimObject* LOC38;
		{
			tidobj201015* LOC24;
			NIM_BOOL LOC25;
			LOC24 = 0;
			LOC24 = &key->Sup;
			LOC25 = 0;
			LOC25 = idtablehasobjectaskey_236205(gtypetable_549281[(k)- 0], LOC24);
			if (!LOC25) goto LA26;
			result = key;
			goto BeforeRet;
		}
		LA26: ;
		{
			NI h_549469;
			NI HEX3Atmp_549612;
			NI res_549615;
			h_549469 = 0;
			HEX3Atmp_549612 = 0;
			HEX3Atmp_549612 = (gtypetable_549281[(k)- 0].Data->Sup.len-1);
			res_549615 = 0;
			{
				while (1) {
					ttype226852* t;
					if (!(res_549615 <= HEX3Atmp_549612)) goto LA30;
					h_549469 = res_549615;
					t = ((ttype226852*) (gtypetable_549281[(k)- 0].Data->data[h_549469].Key));
					{
						NIM_BOOL LOC33;
						LOC33 = 0;
						LOC33 = !((t == NIM_NIL));
						if (!(LOC33)) goto LA34;
						LOC33 = samebackendtype_271542(t, key);
						LA34: ;
						if (!LOC33) goto LA35;
						result = t;
						goto BeforeRet;
					}
					LA35: ;
					res_549615 += 1;
				} LA30: ;
			}
		}
		LOC37 = 0;
		LOC37 = &key->Sup;
		LOC38 = 0;
		LOC38 = &key->Sup.Sup;
		idtableput_236196((&gtypetable_549281[(k)- 0]), LOC37, LOC38);
		result = key;
	}
	break;
	case ((NU8) 17):
	{
		{
			tidobj201015* LOC44;
			TNimObject* LOC45;
			if (!!((((*key).Flags &(1<<((((NU8) 8))&31)))!=0))) goto LA42;
			LOC44 = 0;
			LOC44 = &key->Sup;
			LOC45 = 0;
			LOC45 = idtableget_236182(gtypetable_549281[(k)- 0], LOC44);
			result = ((ttype226852*) (LOC45));
			{
				tidobj201015* LOC50;
				TNimObject* LOC51;
				if (!(result == NIM_NIL)) goto LA48;
				LOC50 = 0;
				LOC50 = &key->Sup;
				LOC51 = 0;
				LOC51 = &key->Sup.Sup;
				idtableput_236196((&gtypetable_549281[(k)- 0]), LOC50, LOC51);
				result = key;
			}
			LA48: ;
		}
		goto LA40;
		LA42: ;
		{
			tidobj201015* LOC68;
			TNimObject* LOC69;
			{
				tidobj201015* LOC55;
				NIM_BOOL LOC56;
				LOC55 = 0;
				LOC55 = &key->Sup;
				LOC56 = 0;
				LOC56 = idtablehasobjectaskey_236205(gtypetable_549281[(k)- 0], LOC55);
				if (!LOC56) goto LA57;
				result = key;
				goto BeforeRet;
			}
			LA57: ;
			{
				NI h_549532;
				NI HEX3Atmp_549618;
				NI res_549621;
				h_549532 = 0;
				HEX3Atmp_549618 = 0;
				HEX3Atmp_549618 = (gtypetable_549281[(k)- 0].Data->Sup.len-1);
				res_549621 = 0;
				{
					while (1) {
						ttype226852* t;
						if (!(res_549621 <= HEX3Atmp_549618)) goto LA61;
						h_549532 = res_549621;
						t = ((ttype226852*) (gtypetable_549281[(k)- 0].Data->data[h_549532].Key));
						{
							NIM_BOOL LOC64;
							LOC64 = 0;
							LOC64 = !((t == NIM_NIL));
							if (!(LOC64)) goto LA65;
							LOC64 = sametype_269351(t, key, 0);
							LA65: ;
							if (!LOC64) goto LA66;
							result = t;
							goto BeforeRet;
						}
						LA66: ;
						res_549621 += 1;
					} LA61: ;
				}
			}
			LOC68 = 0;
			LOC68 = &key->Sup;
			LOC69 = 0;
			LOC69 = &key->Sup.Sup;
			idtableput_236196((&gtypetable_549281[(k)- 0]), LOC68, LOC69);
			result = key;
		}
		LA40: ;
	}
	break;
	case ((NU8) 14):
	{
		tidobj201015* LOC71;
		TNimObject* LOC72;
		LOC71 = 0;
		LOC71 = &key->Sup;
		LOC72 = 0;
		LOC72 = idtableget_236182(gtypetable_549281[(k)- 0], LOC71);
		result = ((ttype226852*) (LOC72));
		{
			tidobj201015* LOC77;
			TNimObject* LOC78;
			if (!(result == NIM_NIL)) goto LA75;
			LOC77 = 0;
			LOC77 = &key->Sup;
			LOC78 = 0;
			LOC78 = &key->Sup.Sup;
			idtableput_236196((&gtypetable_549281[(k)- 0]), LOC77, LOC78);
			result = key;
		}
		LA75: ;
	}
	break;
	case ((NU8) 25):
	{
		{
			if (!!(((*key).Callconv == ((NU8) 8)))) goto LA82;
			result = key;
		}
		goto LA80;
		LA82: ;
		{
			tidobj201015* LOC100;
			TNimObject* LOC101;
			{
				tidobj201015* LOC87;
				NIM_BOOL LOC88;
				LOC87 = 0;
				LOC87 = &key->Sup;
				LOC88 = 0;
				LOC88 = idtablehasobjectaskey_236205(gtypetable_549281[(k)- 0], LOC87);
				if (!LOC88) goto LA89;
				result = key;
				goto BeforeRet;
			}
			LA89: ;
			{
				NI h_549591;
				NI HEX3Atmp_549624;
				NI res_549627;
				h_549591 = 0;
				HEX3Atmp_549624 = 0;
				HEX3Atmp_549624 = (gtypetable_549281[(k)- 0].Data->Sup.len-1);
				res_549627 = 0;
				{
					while (1) {
						ttype226852* t;
						if (!(res_549627 <= HEX3Atmp_549624)) goto LA93;
						h_549591 = res_549627;
						t = ((ttype226852*) (gtypetable_549281[(k)- 0].Data->data[h_549591].Key));
						{
							NIM_BOOL LOC96;
							LOC96 = 0;
							LOC96 = !((t == NIM_NIL));
							if (!(LOC96)) goto LA97;
							LOC96 = samebackendtype_271542(t, key);
							LA97: ;
							if (!LOC96) goto LA98;
							result = t;
							goto BeforeRet;
						}
						LA98: ;
						res_549627 += 1;
					} LA93: ;
				}
			}
			LOC100 = 0;
			LOC100 = &key->Sup;
			LOC101 = 0;
			LOC101 = &key->Sup.Sup;
			idtableput_236196((&gtypetable_549281[(k)- 0]), LOC100, LOC101);
			result = key;
		}
		LA80: ;
	}
	break;
	}
	BeforeRet: ;
	return result;
}

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

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

N_NIMCALL(NimStringDesc*, mangle_549763)(NimStringDesc* name) {
	NimStringDesc* result;
	result = 0;
	result = rawNewString(name->Sup.len);
	switch (((NU8)(name->data[0]))) {
	case 65 ... 90:
	case 97 ... 122:
	{
		NIM_CHAR LOC2;
		LOC2 = 0;
		LOC2 = nsuToLowerChar(name->data[0]);
		result = addChar(result, LOC2);
	}
	break;
	case 48 ... 57:
	{
		NimStringDesc* LOC4;
		LOC4 = 0;
		LOC4 = rawNewString(2);
appendString(LOC4, ((NimStringDesc*) &TMP3363));
appendChar(LOC4, name->data[0]);
		result = resizeString(result, LOC4->Sup.len + 0);
appendString(result, LOC4);
	}
	break;
	default:
	{
		NimStringDesc* LOC6;
		NimStringDesc* LOC7;
		LOC6 = 0;
		LOC7 = 0;
		LOC7 = nsuToHex(((NI64) (((NU8)(name->data[0])))), 2);
		LOC6 = rawNewString(LOC7->Sup.len + 3);
appendString(LOC6, ((NimStringDesc*) &TMP3364));
appendString(LOC6, LOC7);
		result = LOC6;
	}
	break;
	}
	{
		NI i_549785;
		NI HEX3Atmp_549796;
		NI res_549799;
		i_549785 = 0;
		HEX3Atmp_549796 = 0;
		HEX3Atmp_549796 = (NI64)(name->Sup.len - 1);
		res_549799 = 1;
		{
			while (1) {
				NIM_CHAR c;
				if (!(res_549799 <= HEX3Atmp_549796)) goto LA10;
				i_549785 = res_549799;
				c = name->data[i_549785];
				switch (((NU8)(c))) {
				case 65 ... 90:
				{
					NIM_CHAR LOC12;
					LOC12 = 0;
					LOC12 = nsuToLowerChar(c);
					result = addChar(result, LOC12);
				}
				break;
				case 95:
				{
				}
				break;
				case 97 ... 122:
				case 48 ... 57:
				{
					result = addChar(result, c);
				}
				break;
				default:
				{
					NimStringDesc* LOC16;
					NimStringDesc* LOC17;
					LOC16 = 0;
					LOC17 = 0;
					LOC17 = nsuToHex(((NI64) (((NU8)(c)))), 2);
					LOC16 = rawNewString(LOC17->Sup.len + 3);
appendString(LOC16, ((NimStringDesc*) &TMP3364));
appendString(LOC16, LOC17);
					result = resizeString(result, LOC16->Sup.len + 0);
appendString(result, LOC16);
				}
				break;
				}
				res_549799 += 1;
			} LA10: ;
		}
	}
	return result;
}

N_NIMCALL(NimStringDesc*, makesinglelinecstring_549737)(NimStringDesc* s) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP3455));
	{
		NIM_CHAR c_549741;
		NI i_549745;
		NI l_549747;
		c_549741 = 0;
		i_549745 = 0;
		l_549747 = s->Sup.len;
		{
			while (1) {
				NimStringDesc* LOC4;
				if (!(i_549745 < l_549747)) goto LA3;
				c_549741 = s->data[i_549745];
				LOC4 = 0;
				LOC4 = tocchar_196649(c_549741);
				result = resizeString(result, LOC4->Sup.len + 0);
appendString(result, LOC4);
				i_549745 += 1;
			} LA3: ;
		}
	}
	result = addChar(result, 34);
	return result;
}

static N_INLINE(NI, len_227364)(tnode226816* n) {
	NI result;
	result = 0;
	{
		if (!(*n).kindU.S6.Sons == 0) goto LA3;
		result = 0;
	}
	goto LA1;
	LA3: ;
	{
		result = (*n).kindU.S6.Sons->Sup.len;
	}
	LA1: ;
	return result;
}

static N_INLINE(tnode226816*, HEX5BHEX5D_227698)(tnode226816* n, NI i) {
	tnode226816* result;
	result = 0;
	result = (*n).kindU.S6.Sons->data[i];
	return result;
}

N_NIMCALL(tnode226816*, getpragmastmt_549017)(tnode226816* n, NU8 w) {
	tnode226816* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 115):
	{
		{
			NI i_549043;
			NI HEX3Atmp_549093;
			NI LOC3;
			NI res_549096;
			i_549043 = 0;
			HEX3Atmp_549093 = 0;
			LOC3 = 0;
			LOC3 = len_227364(n);
			HEX3Atmp_549093 = (LOC3 - 1);
			res_549096 = 0;
			{
				while (1) {
					tnode226816* LOC6;
					if (!(res_549096 <= HEX3Atmp_549093)) goto LA5;
					i_549043 = res_549096;
					LOC6 = 0;
					LOC6 = HEX5BHEX5D_227698(n, i_549043);
					result = getpragmastmt_549017(LOC6, w);
					{
						if (!!((result == NIM_NIL))) goto LA9;
						goto LA2;
					}
					LA9: ;
					res_549096 += 1;
				} LA5: ;
			}
		} LA2: ;
	}
	break;
	case ((NU8) 90):
	{
		{
			NI i_549082;
			NI HEX3Atmp_549099;
			NI LOC13;
			NI res_549102;
			i_549082 = 0;
			HEX3Atmp_549099 = 0;
			LOC13 = 0;
			LOC13 = len_227364(n);
			HEX3Atmp_549099 = (LOC13 - 1);
			res_549102 = 0;
			{
				while (1) {
					if (!(res_549102 <= HEX3Atmp_549099)) goto LA15;
					i_549082 = res_549102;
					{
						tnode226816* LOC18;
						NU8 LOC19;
						LOC18 = 0;
						LOC18 = HEX5BHEX5D_227698(n, i_549082);
						LOC19 = 0;
						LOC19 = whichpragma_263304(LOC18);
						if (!(LOC19 == w)) goto LA20;
						result = HEX5BHEX5D_227698(n, i_549082);
						goto BeforeRet;
					}
					LA20: ;
					res_549102 += 1;
				} LA15: ;
			}
		}
	}
	break;
	default:
	{
	}
	break;
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, stmtscontainpragma_549128)(tnode226816* n, NU8 w) {
	NIM_BOOL result;
	tnode226816* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getpragmastmt_549017(n, w);
	result = !((LOC1 == NIM_NIL));
	return result;
}

N_NIMCALL(trope178009*, makellvmstring_549816)(NimStringDesc* s) {
	trope178009* result;
	NimStringDesc* res;
	trope178009* LOC12;
	result = 0;
	result = NIM_NIL;
	res = copyString(((NimStringDesc*) &TMP3966));
	{
		NI i_549834;
		NI HEX3Atmp_549847;
		NI res_549850;
		i_549834 = 0;
		HEX3Atmp_549847 = 0;
		HEX3Atmp_549847 = (NI64)(s->Sup.len - 1);
		res_549850 = 0;
		{
			while (1) {
				if (!(res_549850 <= HEX3Atmp_549847)) goto LA3;
				i_549834 = res_549850;
				{
					trope178009* LOC8;
					if (!(((NI) ((NI64)((NI64)(i_549834 + 1) % 64))) == 0)) goto LA6;
					LOC8 = 0;
					LOC8 = torope_178076(res);
					app_178052(&result, LOC8);
					res = setLengthStr(res, 0);
				}
				LA6: ;
				switch (((NU8)(s->data[i_549834]))) {
				case 0 ... 31:
				case 128 ... 255:
				case 34:
				case 92:
				{
					NimStringDesc* LOC10;
					res = addChar(res, 92);
					LOC10 = 0;
					LOC10 = nsuToHex(((NI64) (((NU8)(s->data[i_549834])))), 2);
					res = resizeString(res, LOC10->Sup.len + 0);
appendString(res, LOC10);
				}
				break;
				default:
				{
					res = addChar(res, s->data[i_549834]);
				}
				break;
				}
				res_549850 += 1;
			} LA3: ;
		}
	}
	res = resizeString(res, 4);
appendString(res, ((NimStringDesc*) &TMP3967));
	LOC12 = 0;
	LOC12 = torope_178076(res);
	app_178052(&result, LOC12);
	return result;
}

N_NIMCALL(NI64, hashstring_549156)(NimStringDesc* s) {
	NI64 result;
	result = 0;
	{
		NI64 b;
		if (!(cpu_175480[(targetcpu_175587)- 1].Field4 == 64)) goto LA3;
		b = IL64(0);
		{
			NI i_549173;
			NI HEX3Atmp_549242;
			NI res_549245;
			i_549173 = 0;
			HEX3Atmp_549242 = 0;
			HEX3Atmp_549242 = (NI64)(s->Sup.len - 1);
			res_549245 = 0;
			{
				while (1) {
					if (!(res_549245 <= HEX3Atmp_549242)) goto LA7;
					i_549173 = res_549245;
					b = (NI64)((NU64)(b) + (NU64)(((NI64) (((NU8)(s->data[i_549173]))))));
					b = (NI64)((NU64)(b) + (NU64)((NI64)((NU64)(b) << (NU64)(IL64(10)))));
					b = (NI64)(b ^ (NI64)((NU64)(b) >> (NU64)(IL64(6))));
					res_549245 += 1;
				} LA7: ;
			}
		}
		b = (NI64)((NU64)(b) + (NU64)((NI64)((NU64)(b) << (NU64)(IL64(3)))));
		b = (NI64)(b ^ (NI64)((NU64)(b) >> (NU64)(IL64(11))));
		b = (NI64)((NU64)(b) + (NU64)((NI64)((NU64)(b) << (NU64)(IL64(15)))));
		result = b;
	}
	goto LA1;
	LA3: ;
	{
		NI32 a;
		a = ((NI32) 0);
		{
			NI i_549195;
			NI HEX3Atmp_549249;
			NI res_549252;
			i_549195 = 0;
			HEX3Atmp_549249 = 0;
			HEX3Atmp_549249 = (NI64)(s->Sup.len - 1);
			res_549252 = 0;
			{
				while (1) {
					if (!(res_549252 <= HEX3Atmp_549249)) goto LA11;
					i_549195 = res_549252;
					a = (NI32)((NU32)(a) + (NU32)(((NI32) (((NU8)(s->data[i_549195]))))));
					a = (NI32)((NU32)(a) + (NU32)((NI32)((NU32)(a) << (NU32)(((NI32) 10)))));
					a = (NI32)(a ^ (NI32)((NU32)(a) >> (NU32)(((NI32) 6))));
					res_549252 += 1;
				} LA11: ;
			}
		}
		a = (NI32)((NU32)(a) + (NU32)((NI32)((NU32)(a) << (NU32)(((NI32) 3)))));
		a = (NI32)(a ^ (NI32)((NU32)(a) >> (NU32)(((NI32) 11))));
		a = (NI32)((NU32)(a) + (NU32)((NI32)((NU32)(a) << (NU32)(((NI32) 15)))));
		result = ((NI64) (a));
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, resetcaches_549365)(void) {
	inittypetables_549291();
	{
		NU8 i_549377;
		NU8 res_549381;
		i_549377 = 0;
		res_549381 = ((NU8) 0);
		{
			while (1) {
				if (!(res_549381 <= ((NU8) 61))) goto LA3;
				i_549377 = res_549381;
				asgnRefNoCycle((void**) (&gcanonicaltypes_549285[(i_549377)- 0]), NIM_NIL);
				res_549381 += 1;
			} LA3: ;
		}
	}
}
NIM_EXTERNC N_NOINLINE(void, HEX00_ccgutilsInit)(void) {
	inittypetables_549291();
}

NIM_EXTERNC N_NOINLINE(void, HEX00_ccgutilsDatInit)(void) {
}

