/* 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_128025)(NI h, NI val);
static N_INLINE(NI, HEX21HEX24_128054)(NI h);
TNimType NTI128021; /* THash */

static N_INLINE(NI, HEX21HEX26_128025)(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_128054)(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_128839)(NimStringDesc* x) {
	NI result;
	NI h;
	result = 0;
	h = 0;
	{
		NI i_128854;
		NI HEX3Atmp_128865;
		NI res_128868;
		i_128854 = 0;
		HEX3Atmp_128865 = 0;
		HEX3Atmp_128865 = (NI32)(x->Sup.len - 1);
		res_128868 = 0;
		{
			while (1) {
				if (!(res_128868 <= HEX3Atmp_128865)) goto LA3;
				i_128854 = res_128868;
				h = HEX21HEX26_128025(h, ((NI) (((NU8)(x->data[i_128854])))));
				res_128868 += 1;
			} LA3: ;
		}
	}
	result = HEX21HEX24_128054(h);
	return result;
}

N_NIMCALL(NI, hashignorestyle_128885)(NimStringDesc* x) {
	NI result;
	NI h;
	result = 0;
	h = 0;
	{
		NI i_128900;
		NI HEX3Atmp_128954;
		NI res_128957;
		i_128900 = 0;
		HEX3Atmp_128954 = 0;
		HEX3Atmp_128954 = (NI32)(x->Sup.len - 1);
		res_128957 = 0;
		{
			while (1) {
				if (!(res_128957 <= HEX3Atmp_128954)) goto LA3;
				i_128900 = res_128957;
				{
					NIM_CHAR c;
					c = x->data[i_128900];
					{
						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_128025(h, ((NI) (((NU8)(c)))));
				} LA4: ;
				res_128957 += 1;
			} LA3: ;
		}
	}
	result = HEX21HEX24_128054(h);
	return result;
}

N_NIMCALL(NI, hashignorecase_128977)(NimStringDesc* x) {
	NI result;
	NI h;
	result = 0;
	h = 0;
	{
		NI i_128992;
		NI HEX3Atmp_129045;
		NI res_129048;
		i_128992 = 0;
		HEX3Atmp_129045 = 0;
		HEX3Atmp_129045 = (NI32)(x->Sup.len - 1);
		res_129048 = 0;
		{
			while (1) {
				NIM_CHAR c;
				if (!(res_129048 <= HEX3Atmp_129045)) goto LA3;
				i_128992 = res_129048;
				c = x->data[i_128992];
				{
					if (!(((NU8)(c)) >= ((NU8)(65)) && ((NU8)(c)) <= ((NU8)(90)))) goto LA6;
					c = ((NIM_CHAR) (((NI) ((NI32)(((NI) (((NU8)(c)))) + 32)))));
				}
				LA6: ;
				h = HEX21HEX26_128025(h, ((NI) (((NU8)(c)))));
				res_129048 += 1;
			} LA3: ;
		}
	}
	result = HEX21HEX24_128054(h);
	return result;
}
NIM_EXTERNC N_NOINLINE(void, stdlib_hashesInit)(void) {
}

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

