// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movb $-0x10, -0x41(%rbp)
movq -0x28(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x20(%rbp)
movq %rdx, -0x38(%rbp)
movq -0x28(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x20(%rbp)
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
imulq $0x6, -0x38(%rbp), %rcx
addq %rcx, %rax
movzbl 0x4(%rax), %eax
sarl %eax
andl $0x7, %eax
cmpl -0x2c(%rbp), %eax
jne 0xb61f
movq -0x18(%rbp), %rax
imulq $0x6, -0x38(%rbp), %rcx
addq %rcx, %rax
movzbl (%rax), %eax
movq -0x40(%rbp), %rcx
andq $0xff, %rcx
cmpq %rcx, %rax
jne 0xb61f
movq -0x18(%rbp), %rax
imulq $0x6, -0x38(%rbp), %rcx
addq %rcx, %rax
movzbl 0x1(%rax), %eax
movq -0x40(%rbp), %rcx
andq $0xff00, %rcx           # imm = 0xFF00
shrq $0x8, %rcx
cmpq %rcx, %rax
jne 0xb61f
movq -0x18(%rbp), %rax
imulq $0x6, -0x38(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2(%rax), %eax
movq -0x40(%rbp), %rcx
andq $0xff0000, %rcx         # imm = 0xFF0000
shrq $0x10, %rcx
cmpq %rcx, %rax
jne 0xb61f
movq -0x18(%rbp), %rax
imulq $0x6, -0x38(%rbp), %rcx
addq %rcx, %rax
movzbl 0x3(%rax), %eax
movabsq $0xff000000, %rcx       # imm = 0xFF000000
andq -0x40(%rbp), %rcx
shrq $0x18, %rcx
cmpq %rcx, %rax
jne 0xb61f
movq -0x18(%rbp), %rax
imulq $0x6, -0x38(%rbp), %rcx
addq %rcx, %rax
movzbl 0x4(%rax), %eax
andl $0x1, %eax
cltq
movabsq $0x100000000, %rcx      # imm = 0x100000000
andq -0x40(%rbp), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jne 0xb61f
movl $0x4, -0x4(%rbp)
jmp 0xb8b1
movl -0x2c(%rbp), %eax
leaq 0xbd2b(%rip), %rcx      # 0x17354
cmpl (%rcx), %eax
jne 0xb8a8
leaq -0x50(%rbp), %rdi
callq 0xd930
movq -0x38(%rbp), %rax
leaq 0xbd3b(%rip), %rcx      # 0x17380
xorl %edx, %edx
divq (%rcx)
movl %edx, %eax
movl %eax, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
movq 0xbce3(%rip), %rdi      # 0x17340
movslq -0x54(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0xd950
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movq 0xbcc0(%rip), %rdi      # 0x17340
movslq -0x54(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0xd9c0
movq %rax, -0x68(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xd980
testb $0x1, %al
jne 0xb6a7
jmp 0xb6d5
leaq -0x50(%rbp), %rdi
callq 0xd9f0
movq (%rax), %rax
cmpq -0x38(%rbp), %rax
jne 0xb6bb
jmp 0xb6d5
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0xda10
movq %rax, -0x70(%rbp)
jmp 0xb679
movq 0xbc64(%rip), %rdi      # 0x17340
movslq -0x54(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0xd9c0
movq %rax, -0x78(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xda50
testb $0x1, %al
jne 0xb703
jmp 0xb70f
movl $0x5, -0x4(%rbp)
jmp 0xb8b1
movb $0x0, -0x79(%rbp)
movq 0xbc26(%rip), %rdi      # 0x17340
movslq -0x54(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0x58(%rbp), %rsi
callq 0xd8c0
movq %rax, %rdi
addq $0x8, %rdi
callq 0xdb60
movq %rax, -0x88(%rbp)
movq 0xbbf8(%rip), %rdi      # 0x17340
movslq -0x54(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0x58(%rbp), %rsi
callq 0xd8c0
movq %rax, %rdi
addq $0x8, %rdi
callq 0xdbd0
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xdb90
testb $0x1, %al
jne 0xb78b
jmp 0xb889
leaq -0x88(%rbp), %rdi
callq 0xdc00
movzbl 0x4(%rax), %eax
sarl %eax
andl $0x7, %eax
cmpl -0x2c(%rbp), %eax
jne 0xb86d
leaq -0x88(%rbp), %rdi
callq 0xdc00
movzbl (%rax), %eax
movq -0x40(%rbp), %rcx
andq $0xff, %rcx
cmpq %rcx, %rax
jne 0xb86d
leaq -0x88(%rbp), %rdi
callq 0xdc00
movzbl 0x1(%rax), %eax
movq -0x40(%rbp), %rcx
andq $0xff00, %rcx           # imm = 0xFF00
shrq $0x8, %rcx
cmpq %rcx, %rax
jne 0xb86d
leaq -0x88(%rbp), %rdi
callq 0xdc00
movzbl 0x2(%rax), %eax
movq -0x40(%rbp), %rcx
andq $0xff0000, %rcx         # imm = 0xFF0000
shrq $0x10, %rcx
cmpq %rcx, %rax
jne 0xb86d
leaq -0x88(%rbp), %rdi
callq 0xdc00
movzbl 0x3(%rax), %eax
movabsq $0xff000000, %rcx       # imm = 0xFF000000
andq -0x40(%rbp), %rcx
shrq $0x18, %rcx
cmpq %rcx, %rax
jne 0xb86d
leaq -0x88(%rbp), %rdi
callq 0xdc00
movzbl 0x4(%rax), %eax
andl $0x1, %eax
cltq
movabsq $0x100000000, %rcx      # imm = 0x100000000
andq -0x40(%rbp), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jne 0xb86d
movb $0x1, -0x79(%rbp)
jmp 0xb889
jmp 0xb86f
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
callq 0xdc20
movq %rax, -0x98(%rbp)
jmp 0xb741
movb -0x79(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xb89f
movl $0x4, -0x4(%rbp)
jmp 0xb8b1
movl $0x5, -0x4(%rbp)
jmp 0xb8b1
jmp 0xb8aa
movl $0x5, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)