// File: ratulSharker[P]Havec/src/vector_with_rehash_8_hash_with_N_detection_5_bytes.cpp
// Function: findGivenKhmer5Byte(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, khmerInfo5Byte*, unsigned long long, unsigned long long, unsigned int)
int findGivenKhmer5Byte(string sample,struct khmerInfo5Byte *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_5_byte>::iterator it;
			int index_v=index%num_of_vector;
			int index_vect=0;
			for(it = mapPointer5Byte[index_v].begin();it!=mapPointer5Byte[index_v].end();it++)
			{
				if(it->index_val == index)
				{
					break;
				}
				index_vect++;
			}
			if(it == mapPointer5Byte[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<khmerInfo5Byte>::iterator pi = mapPointer5Byte[index_v][index_vect].vect.begin();
						pi != mapPointer5Byte[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 $0x5, -0x38(%rbp), %rcx
addq %rcx, %rax
movzbl 0x4(%rax), %eax
sarl %eax
andl $0x7, %eax
cmpl -0x2c(%rbp), %eax
jne 0x519f
movq -0x18(%rbp), %rax
imulq $0x5, -0x38(%rbp), %rcx
addq %rcx, %rax
movzbl (%rax), %eax
movq -0x40(%rbp), %rcx
andq $0xff, %rcx
cmpq %rcx, %rax
jne 0x519f
movq -0x18(%rbp), %rax
imulq $0x5, -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 0x519f
movq -0x18(%rbp), %rax
imulq $0x5, -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 0x519f
movq -0x18(%rbp), %rax
imulq $0x5, -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 0x519f
movq -0x18(%rbp), %rax
imulq $0x5, -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 0x519f
movl $0x4, -0x4(%rbp)
jmp 0x5431
movl -0x2c(%rbp), %eax
leaq 0x121ab(%rip), %rcx     # 0x17354
cmpl (%rcx), %eax
jne 0x5428
leaq -0x50(%rbp), %rdi
callq 0x73e0
movq -0x38(%rbp), %rax
leaq 0x121bb(%rip), %rcx     # 0x17380
xorl %edx, %edx
divq (%rcx)
movl %edx, %eax
movl %eax, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
movq 0x12143(%rip), %rdi     # 0x17320
movslq -0x54(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x7400
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movq 0x12120(%rip), %rdi     # 0x17320
movslq -0x54(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x7470
movq %rax, -0x68(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x7430
testb $0x1, %al
jne 0x5227
jmp 0x5255
leaq -0x50(%rbp), %rdi
callq 0x74a0
movq (%rax), %rax
cmpq -0x38(%rbp), %rax
jne 0x523b
jmp 0x5255
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x74c0
movq %rax, -0x70(%rbp)
jmp 0x51f9
movq 0x120c4(%rip), %rdi     # 0x17320
movslq -0x54(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x7470
movq %rax, -0x78(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x7500
testb $0x1, %al
jne 0x5283
jmp 0x528f
movl $0x5, -0x4(%rbp)
jmp 0x5431
movb $0x0, -0x79(%rbp)
movq 0x12086(%rip), %rdi     # 0x17320
movslq -0x54(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0x58(%rbp), %rsi
callq 0x7390
movq %rax, %rdi
addq $0x8, %rdi
callq 0x75f0
movq %rax, -0x88(%rbp)
movq 0x12058(%rip), %rdi     # 0x17320
movslq -0x54(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0x58(%rbp), %rsi
callq 0x7390
movq %rax, %rdi
addq $0x8, %rdi
callq 0x7660
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x7620
testb $0x1, %al
jne 0x530b
jmp 0x5409
leaq -0x88(%rbp), %rdi
callq 0x7690
movzbl 0x4(%rax), %eax
sarl %eax
andl $0x7, %eax
cmpl -0x2c(%rbp), %eax
jne 0x53ed
leaq -0x88(%rbp), %rdi
callq 0x7690
movzbl (%rax), %eax
movq -0x40(%rbp), %rcx
andq $0xff, %rcx
cmpq %rcx, %rax
jne 0x53ed
leaq -0x88(%rbp), %rdi
callq 0x7690
movzbl 0x1(%rax), %eax
movq -0x40(%rbp), %rcx
andq $0xff00, %rcx           # imm = 0xFF00
shrq $0x8, %rcx
cmpq %rcx, %rax
jne 0x53ed
leaq -0x88(%rbp), %rdi
callq 0x7690
movzbl 0x2(%rax), %eax
movq -0x40(%rbp), %rcx
andq $0xff0000, %rcx         # imm = 0xFF0000
shrq $0x10, %rcx
cmpq %rcx, %rax
jne 0x53ed
leaq -0x88(%rbp), %rdi
callq 0x7690
movzbl 0x3(%rax), %eax
movabsq $0xff000000, %rcx       # imm = 0xFF000000
andq -0x40(%rbp), %rcx
shrq $0x18, %rcx
cmpq %rcx, %rax
jne 0x53ed
leaq -0x88(%rbp), %rdi
callq 0x7690
movzbl 0x4(%rax), %eax
andl $0x1, %eax
cltq
movabsq $0x100000000, %rcx      # imm = 0x100000000
andq -0x40(%rbp), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jne 0x53ed
movb $0x1, -0x79(%rbp)
jmp 0x5409
jmp 0x53ef
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
callq 0x76b0
movq %rax, -0x98(%rbp)
jmp 0x52c1
movb -0x79(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x541f
movl $0x4, -0x4(%rbp)
jmp 0x5431
movl $0x5, -0x4(%rbp)
jmp 0x5431
jmp 0x542a
movl $0x5, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)