// File: /workspace/github_cpp_makefile_star2_O3/ratulSharker[P]Havec/src/vector_with_rehash_8_hash_with_N_detection_6_bytes.cpp
// Function: findGivenKhmer6Byte(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, khmerInfo6Byte*, unsigned long long, unsigned long long, unsigned int)
int findGivenKhmer6Byte(string sample,struct khmerInfo6Byte *memBlock,unsigned long long blockSize, unsigned long long khmer_h,unsigned int whichHashFunc){
		unsigned long long index;
		unsigned long long qutioned; //this value must be under 12bit
		char neighbour_musk = 0xF0;
		
		//cout<<sample << " whichhash::"<<whichHashFunc;
		
		//unsigned char upperQution,lowerQution;//this shit must be unsigned

		//find the index value in the memBlock
		index = khmer_h % blockSize;
		qutioned = khmer_h / blockSize;//this value must be under 12bit
		
		//cout<<"rechecking blcoksize "<<blockSize<<" index "<<index<<" khmer_h "<<khmer_h<<endl;

		/*lowerQution = (qutioned & 0xFF);
		upperQution = ((qutioned & 0x0F00) >> 8);
		*/

		//check that index in the memBlock
		//1.neighbour table
		//2.qutioned table
		if(((memBlock[index].data[4] >> 1) & 0x07) == whichHashFunc && //hash value matched
			(memBlock[index].data[0] == (qutioned & 0xFF)) &&
			(memBlock[index].data[1] == (qutioned & 0xFF00)>>8) &&
			(memBlock[index].data[2] == (qutioned & 0xFF0000)>>16) &&
			(memBlock[index].data[3] == (qutioned & 0xFF000000)>>24) &&
			((memBlock[index].data[4] & 0x01) == ((qutioned & 0x0100000000) >> 32))){

			return FOUND;
		}
		else if(whichHashFunc == LAST_HASH_FUNC){
			//cout<<"asche 01 for "<<sample<<endl;//delete this
			vector<struct vector_trial_6_byte>::iterator it;
			int index_v=index%num_of_vector;
			int index_vect=0;
			for(it = mapPointer6Byte[index_v].begin();it!=mapPointer6Byte[index_v].end();it++)
			{
				if(it->index_val == index)
				{
					break;
				}
				index_vect++;
			}
			if(it == mapPointer6Byte[index_v].end())
			{
				//cout<<"asche 02 for "<<sample<<" searching in "<<index_v<<" for memblock index "<<index<<" hash func no "<<whichHashFunc<<endl;//delete this
				return NOT_FOUND;
			}
			else
			{	//its actuallty found
				//cout<<"asche 03 for "<<sample<<endl;//delete this
				bool isFound = false;
				for(std::vector<khmerInfo6Byte>::iterator pi = mapPointer6Byte[index_v][index_vect].vect.begin();
						pi != mapPointer6Byte[index_v][index_vect].vect.end() ; pi++)
				{
					if(
						((pi->data[4] >> 1) & 0x07) == whichHashFunc && //hash value matched
						(pi->data[0] == (qutioned & 0xFF)) &&
						(pi->data[1] == (qutioned & 0xFF00)>>8) &&
						(pi->data[2] == (qutioned & 0xFF0000)>>16) &&
						(pi->data[3] == (qutioned & 0xFF000000)>>24) &&
						((pi->data[4] & 0x01) == ((qutioned & 0x0100000000) >> 32))){
					//(pi->data[0] == (qutioned & 0xFF)) && ((pi->data[1] & 0x0F) == ((qutioned & 0x0F00) >> 8))){
						//cout<<"asche 04 for "<<sample<<endl;//delete this
						isFound = true;
						break;
					}
				}
				if(isFound==true)
					return FOUND;
				else
					return NOT_FOUND;
			}
				
		}
	return NOT_FOUND;
}

// Assembly:
movq %rcx, %rax
movq %rdx, %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq %rdx, %rdi
leaq (%rdx,%rdx,2), %rdx
movzbl 0x4(%rsi,%rdx,2), %eax
movl %eax, %r9d
shrl %r9d
andl $0x7, %r9d
cmpl %r8d, %r9d
jne 0x755c
leaq (%rsi,%rdx,2), %rdx
cmpb %cl, (%rdx)
jne 0x755c
movl %ecx, %esi
shrl $0x8, %esi
cmpb %sil, 0x1(%rdx)
jne 0x755c
movl %ecx, %esi
shrl $0x10, %esi
cmpb %sil, 0x2(%rdx)
jne 0x755c
movl %ecx, %esi
shrl $0x18, %esi
cmpb %sil, 0x3(%rdx)
jne 0x755c
andl $0x1, %eax
movq %rcx, %rdx
shrq $0x20, %rdx
andl $0x1, %edx
movl $0x4, %esi
cmpl %eax, %edx
je 0x762d
pushq %rbp
pushq %rbx
leaq 0x6d4f(%rip), %rax      # 0xe2b4
movl $0x5, %esi
cmpl %r8d, (%rax)
jne 0x762b
leaq 0x6d66(%rip), %r10      # 0xe2e0
xorl %r9d, %r9d
movq %rdi, %rax
xorl %edx, %edx
divq (%r10)
movq 0x6d14(%rip), %rax      # 0xe2a0
movslq %edx, %rdx
leaq (%rdx,%rdx,2), %r10
movq (%rax,%r10,8), %rdx
movq 0x8(%rax,%r10,8), %rax
movq %rdx, %r10
cmpq %rax, %rdx
je 0x75be
movq %rdx, %r10
cmpq %rdi, (%r10)
je 0x75bb
incl %r9d
addq $0x20, %r10
cmpq %rax, %r10
jne 0x75a7
movq %rax, %r10
movl %r9d, %r9d
cmpq %rax, %r10
je 0x762b
shlq $0x5, %r9
movq 0x8(%rdx,%r9), %rax
movq 0x10(%rdx,%r9), %rdx
cmpq %rdx, %rax
je 0x762b
movl %ecx, %edi
shrl $0x8, %edi
movl %ecx, %r9d
shrl $0x10, %r9d
movl %ecx, %r10d
shrl $0x18, %r10d
movq %rcx, %r11
shrq $0x20, %r11
andl $0x1, %r11d
movzbl 0x4(%rax), %ebx
movl %ebx, %ebp
shrl %ebp
andl $0x7, %ebp
cmpl %r8d, %ebp
jne 0x7622
cmpb %cl, (%rax)
jne 0x7622
cmpb %dil, 0x1(%rax)
jne 0x7622
cmpb %r9b, 0x2(%rax)
jne 0x7622
cmpb %r10b, 0x3(%rax)
jne 0x7622
andl $0x1, %ebx
cmpl %ebx, %r11d
je 0x7630
addq $0x6, %rax
cmpq %rdx, %rax
jne 0x75f4
popq %rbx
popq %rbp
movl %esi, %eax
retq
movl $0x4, %esi
jmp 0x762b