/* Generated by Nim Compiler v0.10.2 */
/*   (c) 2014 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 32
#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_127025)(NI h, NI val);
static N_INLINE(NI, HEX21HEX24_127054)(NI h);
TNimType NTI127021; /* THash */

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

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

N_NIMCALL(NI, hash_127839)(NimStringDesc* x) {
	NI result;
	NI h;
	result = 0;
	h = 0;
	{
		NI i_127854;
		NI HEX3Atmp_127865;
		NI res_127868;
		i_127854 = 0;
		HEX3Atmp_127865 = 0;
		HEX3Atmp_127865 = (NI32)(x->Sup.len - 1);
		res_127868 = 0;
		{
			while (1) {
				if (!(res_127868 <= HEX3Atmp_127865)) goto LA3;
				i_127854 = res_127868;
				h = HEX21HEX26_127025(h, ((NI) (((NU8)(x->data[i_127854])))));
				res_127868 += 1;
			} LA3: ;
		}
	}
	result = HEX21HEX24_127054(h);
	return result;
}

N_NIMCALL(NI, hashignorestyle_127885)(NimStringDesc* x) {
	NI result;
	NI h;
	result = 0;
	h = 0;
	{
		NI i_127900;
		NI HEX3Atmp_127954;
		NI res_127957;
		i_127900 = 0;
		HEX3Atmp_127954 = 0;
		HEX3Atmp_127954 = (NI32)(x->Sup.len - 1);
		res_127957 = 0;
		{
			while (1) {
				if (!(res_127957 <= HEX3Atmp_127954)) goto LA3;
				i_127900 = res_127957;
				{
					NIM_CHAR c;
					c = x->data[i_127900];
					{
						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) ((NI32)(((NI) (((NU8)(c)))) + 32)))));
					}
					LA11: ;
					h = HEX21HEX26_127025(h, ((NI) (((NU8)(c)))));
				} LA4: ;
				res_127957 += 1;
			} LA3: ;
		}
	}
	result = HEX21HEX24_127054(h);
	return result;
}

N_NIMCALL(NI, hashignorecase_127977)(NimStringDesc* x) {
	NI result;
	NI h;
	result = 0;
	h = 0;
	{
		NI i_127992;
		NI HEX3Atmp_128045;
		NI res_128048;
		i_127992 = 0;
		HEX3Atmp_128045 = 0;
		HEX3Atmp_128045 = (NI32)(x->Sup.len - 1);
		res_128048 = 0;
		{
			while (1) {
				NIM_CHAR c;
				if (!(res_128048 <= HEX3Atmp_128045)) goto LA3;
				i_127992 = res_128048;
				c = x->data[i_127992];
				{
					if (!(((NU8)(c)) >= ((NU8)(65)) && ((NU8)(c)) <= ((NU8)(90)))) goto LA6;
					c = ((NIM_CHAR) (((NI) ((NI32)(((NI) (((NU8)(c)))) + 32)))));
				}
				LA6: ;
				h = HEX21HEX26_127025(h, ((NI) (((NU8)(c)))));
				res_128048 += 1;
			} LA3: ;
		}
	}
	result = HEX21HEX24_127054(h);
	return result;
}
NIM_EXTERNC N_NOINLINE(void, stdlib_hashesInit)(void) {
}

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

