// File: /workspace/github_cpp_makefile_star2_O2/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, %r9
movq %rdx, %rdi
imulq $0x6, %rdx, %rdx
movzbl 0x4(%rsi,%rdx), %eax
movl %eax, %r10d
shrl %r10d
andl $0x7, %r10d
movl $0x4, %ecx
cmpl %r8d, %r10d
jne 0x54a5
addq %rdx, %rsi
cmpb %r9b, (%rsi)
jne 0x54a5
movl %r9d, %edx
shrl $0x8, %edx
cmpb %dl, 0x1(%rsi)
jne 0x54a5
movl %r9d, %edx
shrl $0x10, %edx
cmpb %dl, 0x2(%rsi)
jne 0x54a5
movl %r9d, %edx
shrl $0x18, %edx
cmpb %dl, 0x3(%rsi)
jne 0x54a5
andl $0x1, %eax
movq %r9, %rdx
shrq $0x20, %rdx
andl $0x1, %edx
cmpl %eax, %edx
je 0x5562
pushq %rbp
pushq %r14
pushq %rbx
leaq 0x5de4(%rip), %rax      # 0xb294
movl $0x5, %esi
cmpl %r8d, (%rax)
jne 0x555c
leaq 0x5dfb(%rip), %r10      # 0xb2c0
movq %rdi, %rax
xorl %edx, %edx
divq (%r10)
movq 0x5dac(%rip), %rax      # 0xb280
movslq %edx, %rdx
imulq $0x18, %rdx, %r10
movq (%rax,%r10), %rdx
movq 0x8(%rax,%r10), %rax
cmpq %rax, %rdx
je 0x555c
cmpq %rdi, (%rdx)
je 0x54f4
addq $0x20, %rdx
jmp 0x54e4
cmpq %rax, %rdx
je 0x555c
movq 0x8(%rdx), %rax
movq 0x10(%rdx), %rdx
movl %r9d, %edi
shrl $0x8, %edi
movl %r9d, %r10d
shrl $0x10, %r10d
movl %r9d, %r11d
shrl $0x18, %r11d
movq %r9, %rbx
shrq $0x20, %rbx
andl $0x1, %ebx
cmpq %rdx, %rax
je 0x555c
movzbl 0x4(%rax), %r14d
movl %r14d, %ebp
shrl %ebp
andl $0x7, %ebp
cmpl %r8d, %ebp
jne 0x5556
cmpb %r9b, (%rax)
jne 0x5556
cmpb %dil, 0x1(%rax)
jne 0x5556
cmpb %r10b, 0x2(%rax)
jne 0x5556
cmpb %r11b, 0x3(%rax)
jne 0x5556
andl $0x1, %r14d
cmpl %r14d, %ebx
je 0x555e
addq $0x6, %rax
jmp 0x551f
movl %esi, %ecx
popq %rbx
popq %r14
popq %rbp
movl %ecx, %eax
retq