// File: 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
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x28(%rbp)
movl $0xc8, %edi
callq 0x3040
movq %rax, -0x30(%rbp)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0xff70
movq %rax, %rcx
leaq 0x10a34(%rip), %rax     # 0x17380
movq %rcx, (%rax)
cmpl $0x7, -0x4(%rbp)
jge 0x699a
movq 0x10674(%rip), %rdi     # 0x16fd0
leaq 0xaa38(%rip), %rsi      # 0x1139b
callq 0x32f0
movq %rax, %rdi
movq 0x1064e(%rip), %rsi     # 0x16fc0
callq 0x3340
movq %rax, %rdi
leaq 0xaa46(%rip), %rsi      # 0x113c7
callq 0x32f0
movq %rax, %rdi
movq 0x10630(%rip), %rsi     # 0x16fc0
callq 0x3340
jmp 0x734f
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x32e0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x34e0
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x34e0
movl %eax, %ecx
subl $0x1, %ecx
leaq 0x10980(%rip), %rax     # 0x17354
movl %ecx, (%rax)
movq $0x0, -0x18(%rbp)
cmpl $0x7, -0x4(%rbp)
jne 0x6a8e
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x138(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x3550
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x7760
jmp 0x6a20
leaq -0x50(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movl $0xa, %edx
callq 0x78b0
movq %rax, -0x140(%rbp)
jmp 0x6a3b
movq -0x140(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x31b0
leaq -0x51(%rbp), %rdi
callq 0x3380
jmp 0x6bc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x6a80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x31b0
leaq -0x51(%rbp), %rdi
callq 0x3380
jmp 0x7358
cmpl $0x8, -0x4(%rbp)
jne 0x6bc1
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x150(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x3550
movq -0x150(%rbp), %rsi
movq -0x148(%rbp), %rdx
leaq -0x88(%rbp), %rdi
callq 0x7760
jmp 0x6ad6
leaq -0x88(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movl $0xa, %edx
callq 0x78b0
movq %rax, -0x158(%rbp)
jmp 0x6af4
movq -0x158(%rbp), %rax
movq %rax, %xmm0
movaps 0xa659(%rip), %xmm1     # 0x11160
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xa65d(%rip), %xmm1     # 0x11170
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x160(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x3400
movaps %xmm0, %xmm1
movsd -0x160(%rbp), %xmm0
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0xa5e3(%rip), %xmm1     # 0x11140
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x18(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x31b0
leaq -0x89(%rbp), %rdi
callq 0x3380
jmp 0x6bc1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x6bb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x31b0
leaq -0x89(%rbp), %rdi
callq 0x3380
jmp 0x7358
jmp 0x6bc3
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x3550
movq -0x168(%rbp), %rdx
leaq 0xa857(%rip), %rsi      # 0x1143b
leaq -0xb0(%rbp), %rdi
callq 0x7760
jmp 0x6bf2
leaq -0xb1(%rbp), %rdi
callq 0x3380
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x35b0
jmp 0x6c14
leaq 0xa823(%rip), %rsi      # 0x1143e
leaq -0xb0(%rbp), %rdi
callq 0x35b0
jmp 0x6c29
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x35b0
jmp 0x6c3f
leaq 0xa7fc(%rip), %rsi      # 0x11442
leaq -0xb0(%rbp), %rdi
callq 0x35b0
jmp 0x6c54
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x35b0
jmp 0x6c6a
cmpl $0x6, -0x4(%rbp)
jl 0x6d02
leaq 0xa7cb(%rip), %rsi      # 0x11446
leaq -0xb0(%rbp), %rdi
callq 0x35b0
jmp 0x6c89
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x35b0
jmp 0x6c9f
cmpl $0x7, -0x4(%rbp)
jl 0x6d00
leaq 0xa79e(%rip), %rsi      # 0x1144a
leaq -0xb0(%rbp), %rdi
callq 0x35b0
jmp 0x6cba
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x35b0
jmp 0x6cd0
jmp 0x6d00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xb1(%rbp), %rdi
callq 0x3380
jmp 0x7358
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x7341
jmp 0x6d02
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x3280
movq -0x170(%rbp), %rdi
movq %rax, -0xc0(%rbp)
callq 0x3180
movq %rax, -0xc8(%rbp)
movb $0x2e, -0xc9(%rbp)
movb $0x2d, -0xca(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
leaq -0xc9(%rbp), %rdx
leaq -0xca(%rbp), %rcx
callq 0x78f0
jmp 0x6d60
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x3280
movq -0x178(%rbp), %rdi
movq %rax, -0xd8(%rbp)
callq 0x3180
movq %rax, -0xe0(%rbp)
movb $0x2f, -0xe1(%rbp)
movb $0x7e, -0xe2(%rbp)
movq -0xd8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
leaq -0xe1(%rbp), %rdx
leaq -0xe2(%rbp), %rcx
callq 0x78f0
jmp 0x6dbe
leaq -0x109(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x3550
movq -0x180(%rbp), %rdx
leaq 0xa227(%rip), %rsi      # 0x11006
leaq -0x108(%rbp), %rdi
callq 0x7760
jmp 0x6ded
leaq -0x109(%rbp), %rdi
callq 0x3380
leaq -0x108(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x35c0
movq %rax, -0x188(%rbp)
jmp 0x6e15
movq -0x188(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x3050
jmp 0x6e2a
leaq 0xa512(%rip), %rsi      # 0x11343
leaq -0xb0(%rbp), %rdi
callq 0x35b0
jmp 0x6e3f
leaq -0xb0(%rbp), %rdi
callq 0x3110
movq %rax, %rdi
movq 0x1015b(%rip), %rax     # 0x16fb0
movq (%rax), %rdx
leaq 0xa505(%rip), %rsi      # 0x11364
callq 0x3360
jmp 0x6e66
callq 0x10000
jmp 0x6e6d
movq -0x18(%rbp), %rdi
callq 0xff70
movq %rax, -0x190(%rbp)
jmp 0x6e7f
movq -0x190(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x1013f(%rip), %rdi     # 0x16fd0
leaq 0xa5b7(%rip), %rsi      # 0x1144f
callq 0x32f0
movq %rax, -0x198(%rbp)
jmp 0x6ea6
movq -0x198(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32d0
movq %rax, -0x1a0(%rbp)
jmp 0x6ebf
movq -0x1a0(%rbp), %rdi
movq 0x100f3(%rip), %rsi     # 0x16fc0
callq 0x3340
jmp 0x6ed4
movq 0x100f5(%rip), %rdi     # 0x16fd0
leaq 0xa57b(%rip), %rsi      # 0x1145d
callq 0x32f0
movq %rax, -0x1a8(%rbp)
jmp 0x6ef0
movq -0x1a8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x32f0
movq %rax, -0x1b0(%rbp)
jmp 0x6f09
movq -0x1b0(%rbp), %rdi
leaq 0xa551(%rip), %rsi      # 0x11468
callq 0x32f0
movq %rax, -0x1b8(%rbp)
jmp 0x6f25
movq -0x1b8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x3530
movq %rax, -0x1c0(%rbp)
jmp 0x6f3d
movq -0x1c0(%rbp), %rdi
leaq 0xa526(%rip), %rsi      # 0x11471
callq 0x32f0
movq %rax, -0x1c8(%rbp)
jmp 0x6f59
movq -0x1c8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32d0
movq %rax, -0x1d0(%rbp)
jmp 0x6f72
movq -0x1d0(%rbp), %rdi
movq 0x10040(%rip), %rsi     # 0x16fc0
callq 0x3340
jmp 0x6f87
callq 0x100a0
jmp 0x6f8e
movq -0x18(%rbp), %rax
movl $0x5, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x3040
movq %rax, -0x1d8(%rbp)
jmp 0x6fb6
movq -0x1d8(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq 0x103b5(%rip), %rax     # 0x17380
movq (%rax), %rax
movq %rax, -0x1e8(%rbp)
movl $0x18, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
movq $-0x1, %rax
cmovbq %rax, %rdi
testb %cl, %cl
cmovneq %rax, %rdi
callq 0x3040
movq %rax, -0x1e0(%rbp)
jmp 0x7006
movq -0x1e8(%rbp), %rax
movq -0x1e0(%rbp), %rcx
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, -0x1f0(%rbp)
cmpq $0x0, %rax
je 0x707f
movq -0x1f0(%rbp), %rax
movq -0x1e8(%rbp), %rcx
imulq $0x18, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x200(%rbp)
movq %rax, -0x1f8(%rbp)
movq -0x1f8(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x7960
movq -0x208(%rbp), %rax
movq -0x200(%rbp), %rcx
addq $0x18, %rax
cmpq %rcx, %rax
movq %rax, -0x1f8(%rbp)
jne 0x704e
movq -0x1f0(%rbp), %rax
movq %rax, 0x10293(%rip)     # 0x17320
movq -0x118(%rbp), %rdi
movq -0x18(%rbp), %rax
leaq (%rax,%rax,4), %rdx
xorl %esi, %esi
callq 0x3160
callq 0x10000
jmp 0x70aa
movq -0x118(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
movzwl -0x1c(%rbp), %ecx
callq 0x42c0
jmp 0x70c4
callq 0x3880
jmp 0x70cb
callq 0x10000
jmp 0x70d2
callq 0x10000
jmp 0x70d9
leaq -0x120(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0xf7b0
jmp 0x70ee
movq 0xfedb(%rip), %rdi      # 0x16fd0
leaq 0xa37d(%rip), %rsi      # 0x11479
callq 0x32f0
movq %rax, -0x210(%rbp)
jmp 0x710a
movq -0x210(%rbp), %rdi
movaps 0xa048(%rip), %xmm1     # 0x11160
movq -0x18(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xa047(%rip), %xmm1     # 0x11170
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0xa008(%rip), %xmm1     # 0x11148
mulsd %xmm1, %xmm0
movsd 0xa004(%rip), %xmm1     # 0x11150
mulsd %xmm1, %xmm0
callq 0x35a0
movq %rax, -0x218(%rbp)
jmp 0x715e
movq -0x218(%rbp), %rdi
movq 0xfe54(%rip), %rsi      # 0x16fc0
callq 0x3340
jmp 0x7173
movq 0xfe56(%rip), %rdi      # 0x16fd0
leaq 0xa31c(%rip), %rsi      # 0x1149d
callq 0x32f0
movq %rax, -0x220(%rbp)
jmp 0x718f
movq -0x220(%rbp), %rdi
movsd -0x120(%rbp), %xmm0
movsd 0x9f92(%rip), %xmm1     # 0x11138
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movaps 0x9fab(%rip), %xmm2     # 0x11160
movq -0x18(%rbp), %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x9faa(%rip), %xmm2     # 0x11170
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
movsd 0x9f7b(%rip), %xmm2     # 0x11158
mulsd %xmm2, %xmm1
movsd 0x9f67(%rip), %xmm2     # 0x11150
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
callq 0x35a0
movq %rax, -0x228(%rbp)
jmp 0x71ff
movq -0x228(%rbp), %rdi
movq 0xfdb3(%rip), %rsi      # 0x16fc0
callq 0x3340
jmp 0x7214
movq 0xfdb5(%rip), %rdi      # 0x16fd0
leaq 0xa29f(%rip), %rsi      # 0x114c1
callq 0x32f0
movq %rax, -0x230(%rbp)
jmp 0x7230
movq -0x230(%rbp), %rdi
movsd -0x120(%rbp), %xmm0
movsd 0x9ef1(%rip), %xmm1     # 0x11138
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
callq 0x35a0
movq %rax, -0x238(%rbp)
jmp 0x725d
movq -0x238(%rbp), %rdi
movq 0xfd55(%rip), %rsi      # 0x16fc0
callq 0x3340
jmp 0x7272
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
leaq 0xa25a(%rip), %rdi      # 0x114db
callq 0x3470
cmpl $0x0, %eax
je 0x72a4
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
leaq 0xa243(%rip), %rdi      # 0x114dd
callq 0x3470
cmpl $0x0, %eax
jne 0x72f6
movq -0x118(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq 0x10067(%rip), %rcx     # 0x17320
callq 0x6080
jmp 0x72c0
jmp 0x72f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x109(%rbp), %rdi
callq 0x3380
jmp 0x7341
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x31b0
jmp 0x7341
movq -0x118(%rbp), %rax
movq %rax, -0x240(%rbp)
cmpq $0x0, %rax
je 0x7316
movq -0x240(%rbp), %rdi
callq 0x3430
movq 0xfc93(%rip), %rax      # 0x16fb0
movq (%rax), %rdi
callq 0x3300
jmp 0x7327
leaq -0x108(%rbp), %rdi
callq 0x31b0
leaq -0xb0(%rbp), %rdi
callq 0x31b0
jmp 0x734f
leaq -0xb0(%rbp), %rdi
callq 0x31b0
jmp 0x7358
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x3540
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)