/* 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"
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
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  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
static N_INLINE(NI, HEX21HEX26_130025)(NI h, NI val);
static N_INLINE(NI, HEX21HEX24_130054)(NI h);
TNimType NTI130021; /* THash */

static N_INLINE(NI, HEX21HEX26_130025)(NI h, NI val) {
	NI result;
	result = 0;
	result = (NI)((NU64)(h) + (NU64)(val));
	result = (NI)((NU64)(result) + (NU64)((NI)((NU64)(result) << (NU64)(10))));
	result = (NI)(result ^ (NI)((NU64)(result) >> (NU64)(6)));
	return result;
}

static N_INLINE(NI, HEX21HEX24_130054)(NI h) {
	NI result;
	result = 0;
	result = (NI)((NU64)(h) + (NU64)((NI)((NU64)(h) << (NU64)(3))));
	result = (NI)(result ^ (NI)((NU64)(result) >> (NU64)(11)));
	result = (NI)((NU64)(result) + (NU64)((NI)((NU64)(result) << (NU64)(15))));
	return result;
}

N_NIMCALL(NI, hash_130839)(NimStringDesc* x) {
	NI result;
	NI h;
	result = 0;
	h = 0;
	{
		NI i_130854;
		NI HEX3Atmp_130865;
		NI res_130868;
		i_130854 = 0;
		HEX3Atmp_130865 = 0;
		HEX3Atmp_130865 = (NI64)(x->Sup.len - 1);
		res_130868 = 0;
		{
			while (1) {
				if (!(res_130868 <= HEX3Atmp_130865)) goto LA3;
				i_130854 = res_130868;
				h = HEX21HEX26_130025(h, ((NI) (((NU8)(x->data[i_130854])))));
				res_130868 += 1;
			} LA3: ;
		}
	}
	result = HEX21HEX24_130054(h);
	return result;
}

N_NIMCALL(NI, hashignorestyle_130885)(NimStringDesc* x) {
	NI result;
	NI h;
	result = 0;
	h = 0;
	{
		NI i_130900;
		NI HEX3Atmp_130954;
		NI res_130957;
		i_130900 = 0;
		HEX3Atmp_130954 = 0;
		HEX3Atmp_130954 = (NI64)(x->Sup.len - 1);
		res_130957 = 0;
		{
			while (1) {
				if (!(res_130957 <= HEX3Atmp_130954)) goto LA3;
				i_130900 = res_130957;
				{
					NIM_CHAR c;
					c = x->data[i_130900];
					{
						if (!((NU8)(c) == (NU8)(95))) goto LA7;
						goto LA4;
					}
					LA7: ;
					{
						if (!(((NU8)(c)) >= ((NU8)(65)) && ((NU8)(c)) <= ((NU8)(90)))) goto LA11;
						c = ((NIM_CHAR) (((NI) ((NI64)(((NI) (((NU8)(c)))) + 32)))));
					}
					LA11: ;
					h = HEX21HEX26_130025(h, ((NI) (((NU8)(c)))));
				} LA4: ;
				res_130957 += 1;
			} LA3: ;
		}
	}
	result = HEX21HEX24_130054(h);
	return result;
}

N_NIMCALL(NI, hashignorecase_130977)(NimStringDesc* x) {
	NI result;
	NI h;
	result = 0;
	h = 0;
	{
		NI i_130992;
		NI HEX3Atmp_131045;
		NI res_131048;
		i_130992 = 0;
		HEX3Atmp_131045 = 0;
		HEX3Atmp_131045 = (NI64)(x->Sup.len - 1);
		res_131048 = 0;
		{
			while (1) {
				NIM_CHAR c;
				if (!(res_131048 <= HEX3Atmp_131045)) goto LA3;
				i_130992 = res_131048;
				c = x->data[i_130992];
				{
					if (!(((NU8)(c)) >= ((NU8)(65)) && ((NU8)(c)) <= ((NU8)(90)))) goto LA6;
					c = ((NIM_CHAR) (((NI) ((NI64)(((NI) (((NU8)(c)))) + 32)))));
				}
				LA6: ;
				h = HEX21HEX26_130025(h, ((NI) (((NU8)(c)))));
				res_131048 += 1;
			} LA3: ;
		}
	}
	result = HEX21HEX24_130054(h);
	return result;
}
NIM_EXTERNC N_NOINLINE(void, stdlib_hashesInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, stdlib_hashesDatInit)(void) {
NTI130021.size = sizeof(NI);
NTI130021.kind = 31;
NTI130021.base = 0;
NTI130021.flags = 3;
}

