// File: /workspace/github_cpp_makefile_star2_O3/ratulSharker[P]Havec/src/vector_with_rehash_8_hash_with_N_detection_5_bytes.cpp
// Function: main5Byte(int, char**)
void main5Byte(int argc, char** argv) {

	//freopen("results.txt","w",stdout);
	unsigned long long size;
	int kSize;
	std::string::size_type sz = 0;
	char * filename=new char[200];
	num_of_vector = get_a_prime_above_x(500000);
	
	if(argc < 7){
		std::cout<<"sufficient number of argument is not passed"<<std::endl<<" 'fileName' 'khmersize' 'howManyHash' 'cut-off or no cut-off' 'print or not print' 'hashSize' 'multiplying factor' "<<std::endl;
		return ;
	}


	/*std::string::size_type sz = 0;
	std::cout<<"Give input file name :: "<<std::endl;
	std::cin>>filename;*/

	//fetching the args
	strcpy(filename,argv[1]);
	kSize = atoi(argv[2]);
	LAST_HASH_FUNC = atoi(argv[3])-1;//0 indexing hash value 
	
	//size =  std::stoull(argv[3],&sz,10);
	
	size = 0;
	if(argc == 7){ //size provided as the last argument -- so process it //newly changed
		size =  std::stoull(argv[6],&sz,10);//newly changed
	}
	else if(argc == 8)//newly changed
	{
		/*
		* here we parse the multiplying by factor --- which is not optional anymore
 		*/
		size =  std::stoull(argv[6],&sz,10) * atof(argv[7]);//newly changed
	}

/* unblock this area -- you must should (blocked this code section due to low memory space)
 * warning 
 * warning
 * WARNING --- unblock this code of section before releasing
 */
 /*
	if(size < (pow(2,2 * kSize - 33)+ 536870912)){
		size = pow(2,2 * kSize - 33)+ 536870912;
	}
*/


// for output to the file

	string fileName = "5_";
	fileName.append(argv[1]);

	fileName.append("_k_");
	fileName.append(argv[2]);
	fileName.append("_h_");
	fileName.append(argv[3]);

	if(argc >= 6)
	{
		fileName.append("_s_");
		fileName.append(argv[6]);

		if(argc >= 7)
		{
			fileName.append("_mf_");
			fileName.append(argv[7]);
		}
	}
	//cant contain the dot, thats why replacing it with the 
	// - char
	replace(fileName.begin(), fileName.end(), '.', '-');
	replace(fileName.begin(), fileName.end(), '/', '~');

	string outputDir = OUTPUT_DIRECTORY_NAME;
	fileName = outputDir.append(fileName);
	fileName.append(".txt");
	
	freopen(fileName.c_str(),"w",stdout);

	
	currentDateTime();
	
	/*std::cout<<"Give Kmer Size :: "<<std::endl;
	std::cin>>kSize;
	std::cout<<"Minimum space you want to give to hash's :: "<<std::endl;
	std::cin>>size;*/
	//initial memory arrangement
	size=get_a_prime_above_x(size);
	cout<<"Hash size is "<<size<<endl;

	std::cout<<"filename::"<<filename<<" ksize::"<<kSize<<" Size::"<<size<<std::endl;

	populateTwoBitReprHashMap();//populating map
	struct khmerInfo5Byte *blockArray = new struct khmerInfo5Byte[size];
	mapPointer5Byte=new vector<struct vector_trial_5_byte>[num_of_vector];
	
	//cleaning the array
	memset( blockArray, 0, sizeof(struct khmerInfo5Byte) * size);

	//cout<<"After memory allocation"<<endl;
	currentDateTime();

	populateBlock5Byte(blockArray, size , filename , kSize);

	show_vect_status_5_byte();
	
	currentDateTime();
	
	//rechecking ...
	//reCheckTheKhmerExistence5Byte(blockArray,size,argv[1],kSize);
	currentDateTime();
	
	double vm, rss;
	process_mem_usage(vm, rss);
	cout<<"HashTable memory allocation (GB):: "<<((double)size * 5.0 )/(1024.0 * 1024.0 * 1024.0)<<endl;
	cout<<"Vector memory allocation    (GB):: "<<(((vm)/1024.0)/1024.0) - (((double)size * 5 )/(1024.0 * 1024.0 * 1024.0)) <<endl;
	cout << "Total memory used (GB):  " << ((vm)/1024.0)/1024.0 <<endl;	
	
	/*//newly changed
	* before deleting the block array check for the print state
	*/
	if(strcmp("p",argv[5]) == 0 ||  strcmp("P",argv[5]) == 0 ) //newly changed
	{
		//time to print the whole block array
		//printWholeBlockArrayAndVectorStructure(blockArray, true, size, kSize, NULL, NULL);
		print5ByteHashTableAndVectorStructure(blockArray , size, kSize,mapPointer5Byte);
	}
	
	delete [] blockArray;
	
	fclose(stdout);
	return ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r14
movl %edi, %ebp
movl $0xc8, %edi
callq 0x3030
movq %rax, %r13
movl $0x7a120, %edi          # imm = 0x7A120
callq 0xa117
leaq 0x8cf0(%rip), %rcx      # 0xe2e0
movq %rax, (%rcx)
cmpl $0x6, %ebp
jg 0x568d
movq 0x89d5(%rip), %rbx      # 0xdfd8
leaq 0x5c42(%rip), %rsi      # 0xb24c
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x32c0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq %rax, %rbx
leaq 0x5c30(%rip), %rsi      # 0xb278
movl $0x73, %edx
movq %rax, %rdi
callq 0x32c0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3180
movq 0x8(%r14), %rsi
movq %r13, %rdi
callq 0x3210
movq 0x10(%r14), %rdi
callq 0x33c0
movl %eax, 0x2c(%rsp)
movq 0x18(%r14), %rdi
callq 0x33c0
decl %eax
leaq 0x8bfc(%rip), %rcx      # 0xe2b4
movl %eax, (%rcx)
cmpl $0x8, %ebp
je 0x5733
cmpl $0x7, %ebp
jne 0x5792
movq %r13, %rbp
movq 0x30(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x5e52
movq 0x8(%rsp), %rbx
callq 0x3050
movq %rax, %r13
movl (%rax), %eax
movl %eax, 0x30(%rsp)
movl $0x0, (%r13)
leaq 0x50(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x3340
cmpq %rbx, (%r15)
je 0x5d7c
movq %rax, %r12
movl (%r13), %eax
testl %eax, %eax
je 0x579a
cmpl $0x22, %eax
jne 0x57a2
leaq 0x5c5e(%rip), %rdi      # 0xb38c
callq 0x3370
movq 0x30(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x5e52
movq 0x8(%rsp), %rbx
callq 0x3050
movq %rax, %r12
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x50(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x3340
cmpq %rbx, (%r15)
je 0x5d88
movl (%r12), %ecx
testl %ecx, %ecx
je 0x57c2
cmpl $0x22, %ecx
jne 0x57c6
leaq 0x5bff(%rip), %rdi      # 0xb38c
callq 0x3370
xorl %r12d, %r12d
jmp 0x5836
movl 0x30(%rsp), %eax
movl %eax, (%r13)
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x57bd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbp, %r13
jmp 0x5836
movl %ebp, (%r12)
movq %rax, %xmm0
punpckldq 0x589d(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x58a5(%rip), %xmm0     # 0xb080
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x30(%rsp)
movq 0x38(%r14), %rdi
callq 0x3300
mulsd 0x30(%rsp), %xmm0
cvttsd2si %xmm0, %r12
movq %r12, %rax
sarq $0x3f, %rax
subsd 0x5808(%rip), %xmm0     # 0xb018
cvttsd2si %xmm0, %rbx
andq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5833
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
orq %rbx, %r12
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x5aa6(%rip), %rsi      # 0xb2ec
leaq 0x5aa1(%rip), %rdx      # 0xb2ee
leaq 0x8(%rsp), %rdi
callq 0x6334
movq 0x8(%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x3490
leaq 0x5a83(%rip), %rsi      # 0xb2ef
leaq 0x8(%rsp), %rdi
callq 0x3490
movq 0x10(%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x3490
leaq 0x5a68(%rip), %rsi      # 0xb2f3
leaq 0x8(%rsp), %rdi
callq 0x3490
movq 0x18(%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x3490
leaq 0x5a4d(%rip), %rsi      # 0xb2f7
leaq 0x8(%rsp), %rdi
callq 0x3490
movq 0x30(%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x3490
leaq 0x5a32(%rip), %rsi      # 0xb2fb
leaq 0x8(%rsp), %rdi
callq 0x3490
movq 0x38(%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x3490
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x5927
movq 0x8(%rsp), %rcx
xorl %edx, %edx
cmpb $0x2e, (%rcx,%rdx)
jne 0x58fc
movb $0x2d, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x58f2
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x5927
movq 0x8(%rsp), %rcx
xorl %edx, %edx
cmpb $0x2f, (%rcx,%rdx)
jne 0x591f
movb $0x7e, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5915
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x56cd(%rip), %rsi      # 0xb004
leaq 0x56cd(%rip), %rdx      # 0xb00b
leaq 0x50(%rsp), %rdi
callq 0x6334
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x50(%rsp), %rdi
callq 0x3090
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x3100
leaq 0x58b5(%rip), %rsi      # 0xb225
leaq 0x8(%rsp), %rdi
callq 0x3490
movq 0x8(%rsp), %rdi
movq 0x863a(%rip), %rax      # 0xdfc0
movq (%rax), %rdx
leaq 0x58b6(%rip), %rsi      # 0xb246
callq 0x3290
callq 0xa158
movq %r12, %rdi
callq 0xa117
movq %rax, %r15
movq 0x862c(%rip), %rdi      # 0xdfd8
leaq 0x594d(%rip), %rsi      # 0xb300
movl $0xd, %edx
callq 0x32c0
movq 0x8614(%rip), %rdi      # 0xdfd8
movq %r15, %rsi
callq 0x3160
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0x85db(%rip), %rdi      # 0xdfd8
leaq 0x590a(%rip), %rsi      # 0xb30e
movl $0xa, %edx
callq 0x32c0
movq %r13, %rdi
callq 0x30c0
movq 0x85bb(%rip), %rdi      # 0xdfd8
movq %r13, %rsi
movq %rax, %rdx
callq 0x32c0
movq 0x85a9(%rip), %rdi      # 0xdfd8
leaq 0x58e3(%rip), %rsi      # 0xb319
movl $0x8, %edx
callq 0x32c0
movq 0x8591(%rip), %rdi      # 0xdfd8
movl 0x2c(%rsp), %esi
callq 0x3420
movq %rax, %rbx
leaq 0x58c8(%rip), %rsi      # 0xb322
movl $0x7, %edx
movq %rax, %rdi
callq 0x32c0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3160
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
callq 0xa23f
movl $0x5, %ecx
movq %r15, %r12
movq %r15, %rax
mulq %rcx
movq %rax, %rbp
movq $-0x1, %r15
movq %rax, %rdi
cmovoq %r15, %rdi
callq 0x3030
movq %rax, 0x30(%rsp)
leaq 0x880f(%rip), %rax      # 0xe2e0
movq (%rax), %rbx
movl $0x18, %ecx
movq %rbx, %rax
mulq %rcx
seto %cl
addq $0x8, %rax
cmovbq %r15, %rax
testb %cl, %cl
cmoveq %rax, %r15
movq %r15, %rdi
callq 0x3030
movq %rax, %r15
movq %rbx, (%rax)
addq $0x8, %r15
testq %rbx, %rbx
je 0x5b3a
leaq (%rbx,%rbx,2), %rax
leaq -0x18(,%rax,8), %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
shrq $0x4, %rdx
leaq (%rdx,%rdx,2), %rax
leaq 0x18(,%rax,8), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x3120
movq %r15, 0x873f(%rip)      # 0xe280
movq 0x30(%rsp), %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x3120
callq 0xa158
movzwl 0x2c(%rsp), %ecx
movq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3b6e
callq 0x36fc
callq 0xa158
callq 0xa158
leaq 0x48(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x9698
movq 0x8446(%rip), %rdi      # 0xdfd8
leaq 0x5791(%rip), %rsi      # 0xb32a
movl $0x23, %edx
callq 0x32c0
movq %r12, %xmm1
punpckldq 0x54c0(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x54c8(%rip), %xmm1     # 0xb080
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x5454(%rip), %xmm0     # 0xb020
mulsd 0x5454(%rip), %xmm0     # 0xb028
movq 0x83fd(%rip), %rdi      # 0xdfd8
movapd %xmm0, 0x70(%rsp)
callq 0x33e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0x83c1(%rip), %rdi      # 0xdfd8
leaq 0x5730(%rip), %rsi      # 0xb34e
movl $0x23, %edx
callq 0x32c0
movsd 0x53e0(%rip), %xmm1     # 0xb010
movsd 0x48(%rsp), %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
subsd 0x70(%rsp), %xmm0
movq 0x838d(%rip), %rdi      # 0xdfd8
callq 0x33e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0x8357(%rip), %rdi      # 0xdfd8
leaq 0x56ea(%rip), %rsi      # 0xb372
movl $0x19, %edx
callq 0x32c0
movsd 0x48(%rsp), %xmm0
movsd 0x5370(%rip), %xmm1     # 0xb010
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movq 0x8329(%rip), %rdi      # 0xdfd8
callq 0x33e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0x28(%r14), %rcx
movzbl (%rcx), %eax
cmpl $0x70, %eax
jne 0x5cf2
cmpb $0x0, 0x1(%rcx)
jne 0x5d19
jmp 0x5d01
subl $0x50, %eax
jne 0x5cfb
movzbl 0x1(%rcx), %eax
negl %eax
testl %eax, %eax
jne 0x5d19
movq 0x8578(%rip), %rcx      # 0xe280
movq 0x30(%rsp), %rdi
movq %r12, %rsi
movl 0x2c(%rsp), %edx
callq 0x51c7
movq 0x30(%rsp), %rdi
callq 0x3330
movq 0x8296(%rip), %rax      # 0xdfc0
movq (%rax), %rdi
callq 0x3240
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x5d4e
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5d6a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5609(%rip), %rdi      # 0xb38c
callq 0x3130
leaq 0x55fd(%rip), %rdi      # 0xb38c
callq 0x3130
jmp 0x5dc7
jmp 0x5dc7
movq %rax, %rbx
cmpl $0x0, (%r12)
jne 0x5dba
movl %ebp, (%r12)
jmp 0x5dba
movq %rax, %rbx
cmpl $0x0, (%r13)
jne 0x5dba
movl 0x30(%rsp), %eax
movl %eax, (%r13)
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x5dfe
jmp 0x5dce
movq %rax, %rbx
jmp 0x5e10
jmp 0x5dd5
movq %rax, %rbx
jmp 0x5df4
jmp 0x5dd5
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x5df4
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5e10
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x3430