/* Generated by Nim Compiler v0.16.0 */
/*   (c) 2017 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, amd64, gcc */
/* Command for C compiler:
   gcc -c  -w -O3 -fno-strict-aliasing -fPIC  -I/build/nim/src/Nim-0.16.0/lib -o lib/nimcache/stdlib_hashes.o lib/nimcache/stdlib_hashes.c */
#define NIM_INTBITS 64

#include "nimbase.h"
#undef linux
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
static N_INLINE(NI, HEX21HEX26_6dtCP6C39bxOkT4wrIPJwKghashes)(NI h0, NI val0);
static N_INLINE(NI, HEX21HEX24_zs9byUtT9cNi2e9clB27b2cUAhashes)(NI h0);
static N_INLINE(NIM_BOOL, ismagicidentseparatorrune_jEsY0iAEfTnaxdnZAwGvIwhashes)(NCSTRING cs0, NI i0);

static N_INLINE(NI, HEX21HEX26_6dtCP6C39bxOkT4wrIPJwKghashes)(NI h0, NI val0) {
	NI result0;
	result0 = (NI)0;
	result0 = (NI)((NU64)(h0) + (NU64)(val0));
	result0 = (NI)((NU64)(result0) + (NU64)((NI)((NU64)(result0) << (NU64)(((NI) 10)))));
	result0 = (NI)(result0 ^ (NI)((NU64)(result0) >> (NU64)(((NI) 6))));
	return result0;
}

static N_INLINE(NI, HEX21HEX24_zs9byUtT9cNi2e9clB27b2cUAhashes)(NI h0) {
	NI result0;
	result0 = (NI)0;
	result0 = (NI)((NU64)(h0) + (NU64)((NI)((NU64)(h0) << (NU64)(((NI) 3)))));
	result0 = (NI)(result0 ^ (NI)((NU64)(result0) >> (NU64)(((NI) 11))));
	result0 = (NI)((NU64)(result0) + (NU64)((NI)((NU64)(result0) << (NU64)(((NI) 15)))));
	return result0;
}

N_NIMCALL(NI, hash_uBstFm5SYVQeOL3j9c9bc58A)(NimStringDesc* x0) {
	NI result0;
	NI h0;
	result0 = (NI)0;
	h0 = ((NI) 0);
	{
		NI i_8yjSY27k9auQ29baB1P8NefQ;
		NI HEX3Atmp_9a6O0SjfH9acKqHTCOs2pISw;
		NI res_w69czt14PqjVC9c2DXgkaLqw;
		i_8yjSY27k9auQ29baB1P8NefQ = (NI)0;
		HEX3Atmp_9a6O0SjfH9acKqHTCOs2pISw = (NI)0;
		HEX3Atmp_9a6O0SjfH9acKqHTCOs2pISw = (NI)((x0 ? x0->Sup.len : 0) - ((NI) 1));
		res_w69czt14PqjVC9c2DXgkaLqw = ((NI) 0);
		{
			while (1) {
				if (!(res_w69czt14PqjVC9c2DXgkaLqw <= HEX3Atmp_9a6O0SjfH9acKqHTCOs2pISw)) goto LA3;
				i_8yjSY27k9auQ29baB1P8NefQ = res_w69czt14PqjVC9c2DXgkaLqw;
				h0 = HEX21HEX26_6dtCP6C39bxOkT4wrIPJwKghashes(h0, ((NI) (((NU8)(x0->data[i_8yjSY27k9auQ29baB1P8NefQ])))));
				res_w69czt14PqjVC9c2DXgkaLqw += ((NI) 1);
			} LA3: ;
		}
	}
	result0 = HEX21HEX24_zs9byUtT9cNi2e9clB27b2cUAhashes(h0);
	return result0;
}

N_NIMCALL(NI, hashignorecase_uBstFm5SYVQeOL3j9c9bc58A_2)(NimStringDesc* x0) {
	NI result0;
	NI h0;
	result0 = (NI)0;
	h0 = ((NI) 0);
	{
		NI i_geCfISAXY7wFUcQDgQbZ9cw;
		NI HEX3Atmp_9cPLbhLYuyM42xBxz2jFY8A;
		NI res_6i1CeXQb9a5YXrgtqL55qvg;
		i_geCfISAXY7wFUcQDgQbZ9cw = (NI)0;
		HEX3Atmp_9cPLbhLYuyM42xBxz2jFY8A = (NI)0;
		HEX3Atmp_9cPLbhLYuyM42xBxz2jFY8A = (NI)((x0 ? x0->Sup.len : 0) - ((NI) 1));
		res_6i1CeXQb9a5YXrgtqL55qvg = ((NI) 0);
		{
			while (1) {
				NIM_CHAR c0;
				if (!(res_6i1CeXQb9a5YXrgtqL55qvg <= HEX3Atmp_9cPLbhLYuyM42xBxz2jFY8A)) goto LA3;
				i_geCfISAXY7wFUcQDgQbZ9cw = res_6i1CeXQb9a5YXrgtqL55qvg;
				c0 = x0->data[i_geCfISAXY7wFUcQDgQbZ9cw];
				{
					if (!(((NU8)(c0)) >= ((NU8)(65)) && ((NU8)(c0)) <= ((NU8)(90)))) goto LA6;
					c0 = ((NIM_CHAR) (((NI) ((NI)(((NI) (((NU8)(c0)))) + ((NI) 32))))));
				}
				LA6: ;
				h0 = HEX21HEX26_6dtCP6C39bxOkT4wrIPJwKghashes(h0, ((NI) (((NU8)(c0)))));
				res_6i1CeXQb9a5YXrgtqL55qvg += ((NI) 1);
			} LA3: ;
		}
	}
	result0 = HEX21HEX24_zs9byUtT9cNi2e9clB27b2cUAhashes(h0);
	return result0;
}

static N_INLINE(NIM_BOOL, ismagicidentseparatorrune_jEsY0iAEfTnaxdnZAwGvIwhashes)(NCSTRING cs0, NI i0) {
	NIM_BOOL result0;
	NIM_BOOL LOC1;
	NIM_BOOL LOC2;
	result0 = (NIM_BOOL)0;
	LOC1 = (NIM_BOOL)0;
	LOC2 = (NIM_BOOL)0;
	LOC2 = ((NU8)(cs0[i0]) == (NU8)(226));
	if (!(LOC2)) goto LA3;
	LOC2 = ((NU8)(cs0[(NI)(i0 + ((NI) 1))]) == (NU8)(128));
	LA3: ;
	LOC1 = LOC2;
	if (!(LOC1)) goto LA4;
	LOC1 = ((NU8)(cs0[(NI)(i0 + ((NI) 2))]) == (NU8)(147));
	LA4: ;
	result0 = LOC1;
	return result0;
}

N_NIMCALL(NI, hashignorestyle_uBstFm5SYVQeOL3j9c9bc58A_3)(NimStringDesc* x0) {
	NI result0;
	NI h0;
	NI i0;
	NI xlen0;
	result0 = (NI)0;
	h0 = ((NI) 0);
	i0 = ((NI) 0);
	xlen0 = (x0 ? x0->Sup.len : 0);
	{
		while (1) {
			NIM_CHAR c0;
			if (!(i0 < xlen0)) goto LA2;
			c0 = x0->data[i0];
			{
				if (!((NU8)(c0) == (NU8)(95))) goto LA5;
				i0 += ((NI) 1);
			}
			goto LA3;
			LA5: ;
			{
				NIM_BOOL LOC8;
				LOC8 = (NIM_BOOL)0;
				LOC8 = ismagicidentseparatorrune_jEsY0iAEfTnaxdnZAwGvIwhashes(x0->data, i0);
				if (!LOC8) goto LA9;
				i0 += ((NI) 3);
			}
			goto LA3;
			LA9: ;
			{
				{
					if (!(((NU8)(c0)) >= ((NU8)(65)) && ((NU8)(c0)) <= ((NU8)(90)))) goto LA14;
					c0 = ((NIM_CHAR) (((NI) ((NI)(((NI) (((NU8)(c0)))) + ((NI) 32))))));
				}
				LA14: ;
				h0 = HEX21HEX26_6dtCP6C39bxOkT4wrIPJwKghashes(h0, ((NI) (((NU8)(c0)))));
				i0 += ((NI) 1);
			}
			LA3: ;
		} LA2: ;
	}
	result0 = HEX21HEX24_zs9byUtT9cNi2e9clB27b2cUAhashes(h0);
	return result0;
}
NIM_EXTERNC N_NOINLINE(void, stdlib_hashesInit000)(void) {
}

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

