// File: ratulSharker[P]Havec/src/vector_with_rehash_8_hash_with_N_detection_5_bytes.cpp
// Function: populateBlock5Byte(khmerInfo5Byte*, unsigned long long, char*, unsigned short)
void populateBlock5Byte(struct khmerInfo5Byte * memBlock, unsigned long long blockSize, char *fileName,unsigned short int khmerSize){

	//opening the given file
	std::ifstream inputFile;
	inputFile.open(fileName,std::fstream::in);
	std::string buf,temp="";
	bool isFirstKhmer = true;
	unsigned long long * lastFoundKHashVal;
	lastFoundKHashVal=new unsigned long long[LAST_HASH_FUNC+1];
	
	bool n_found = false;//if n found in the read, then the read processing is left inactive 
						 // till the next new read sequence is found !!!
	
	unsigned long long consumedRead = 0;
	unsigned int lastHashFuncUsed = 0;//containe the value that is last used to store last khmer
	
	//for stat purpose use only:)
	unsigned long mem_block_occupied_stat = 0,mem_block_found_stat=0;
	unsigned long list_occupied_stat = 0,list_occupied_found=0;
	
	//ofstream myfile;
	//myfile.open("firstKmers.txt");
	//error log if can't be opened
	if(inputFile.fail() == true){
		/*
		 * if fail to load the file -- return
		 */
		std::cout<<"Fail to open the "<<fileName << std::endl;
		return;
	}


	//if successfull then log it !!!
	std::cout<<"Consuming... "<<fileName<<std::endl;

	//parsing the fasta file
	while(getline(inputFile,buf)){//reading a line

			if(buf[0] == '>'){
				//its a sequence name -- omit it !!! -- before omit clear the temp
				
				n_found = false; //new sequence found so i can't tell that exactly that, this new read sequence is bad or not -- time to consume
				
				temp = ""; //cleaning the old remaining khmer
				
				isFirstKhmer = true;
				consumedRead++;
				if(consumedRead%1000000==0){
					std::cout<<consumedRead/1000000<<" million read consumed..."<<std::endl;
					currentDateTime();
					/*show_vect_status_5_byte();
						std::cout<<"stat from consume function :: "<<std::endl
							<<"khmer in memBlock :: "<<mem_block_occupied_stat<<std::endl
							<<"khmer in list :: "<<list_occupied_stat<<std::endl<<std::endl;
							cout<<"*********************************"<<endl;*/
						double vm, rss;
						process_mem_usage(vm, rss);
						cout << "Memory used (GB):  " << ((vm)/1024)/1024 <<endl;
				}
				//std::cout<<buf<<std::endl;
				continue;
			}
			else if(n_found == false){//if read sequence is not bad, consume it
									//if it is bad, then just omit consuming :) till a new read sequence found
									
				//here come the one sequnece of read
				buf = temp.append(buf);//no new read sequnence is found so the next line of read must be appended to the last
				unsigned int i;
				unsigned int bufSize = buf.size();//for optimization purpose only
				unsigned int loopTime = bufSize - khmerSize;//for optimization purpose only
				unsigned int addResult; //for optimization only

				if(isFirstKhmer == true){
					//its the first read line of the multiple read lines
					i = 1;
				}
				else{
					//its not the first line of the multiple read line
					i= 0;
				}

				//if it the first line then consume it explicitly by using fullHasher
				if(isFirstKhmer == true){
				
					if(bufSize < khmerSize){
						/*cout<<"**************************************************"<<endl;						
						cout<<"Problem detected !!!"<<endl;
						cout<<"read sequence size is less then the khmer size -- processing next read :("<<endl;
						cout<<"seq :: "<<buf<<endl;
						cout<<"**************************************************"<<endl;
						*/
						continue;						
					}
					//start of a new read detected
					temp = buf.substr(0,khmerSize); //here temp denote the string khmer
					
					//std::cout<<"khmer's in the read (first):: "<<temp<<std::endl;
					
					if(bufSize > khmerSize){
						//khmer has a neighbour :) -- so put the khmer in the blockArray
						
						//saving the first khmer
						//myfile<<temp<<endl;//_revhash(lastFoundKHashVal,khmerSize)<<endl; //saving the first khmer -- revhash isn't working right now
						
						// hash function trying formation 0th->1th->2th->3th
						bool stored = false;
						for(int ii=0;ii<=LAST_HASH_FUNC;ii++){
						
							//for the first khmer all the 
							//saving signature that which hash function is being used for the first khmer
							lastFoundKHashVal[ii] = fullHasher(temp,ii); //saving the hash
							
							if(buf.length() > khmerSize ){//checking that next khmer is not invalid
								switch(toupper(buf[khmerSize])){
									case 'A':
									case 'T':
									case 'G':
									case 'C':
									break;
									
									default:
									neucleotide_status = N_FOUND_IN_NEUCLEOTIDE;
									break;
								}
							}
							
							if(neucleotide_status == N_FOUND_IN_NEUCLEOTIDE){
								n_found = true;
								break;
							}
							
							//std::cout<<"store try ("<<ii<<")"<<endl;
							
							//cout<<"trying to store-"<<temp<<" hashfunc-"<<ii<<" hashed value-"<<lastFoundKHashVal[ii]<<" neighbour "<<buf[khmerSize]<<endl;
							switch(storeKhmerInMemBlock5Byte(temp,memBlock,blockSize,lastFoundKHashVal[ii],buf[khmerSize],ii)){
							
							case MEM_BLOCK:
								mem_block_occupied_stat++;
								lastHashFuncUsed = ii;
								stored = true;
								break;
							case MEM_BLOCK_FOUND:
								//cout<<"mem_block_found :: "<<temp<<endl;
								mem_block_found_stat++;
								lastHashFuncUsed = ii;
								stored=true;
								break;
							case LIST:
								list_occupied_stat++; //this will happen only for the las time (hash Func 3)
								lastHashFuncUsed = ii;
								stored = true;
								break;
							case LIST_FOUND:
								//cout<<"list_found :: "<<temp<<endl;
								list_occupied_found++;
								lastHashFuncUsed = ii;
								stored=true;
								break;
							case ERROR:
								//std::cout<<"ERROR OCCURED"<<std::endl;
								//return;
								break;
							}
							if(stored){
								break; //break out from the for loop
							}
						}
						//for debug purpose
						//std::cout<<"inside firstkhmer "<<std::endl;
						//std::cout<<temp<<std::endl;
					}

					isFirstKhmer = false;
				}
				
				if(n_found == true){ //in the first khmer N found so abort consuming using continue statement
					continue;
				}
				
				
				
				for( ; i <= loopTime && n_found == false; i++){
					temp = buf.substr(i,khmerSize);

					//std::cout<<"khmer's in the read (intermediate) :: "<<temp<<std::endl;

					addResult = i + khmerSize;

					if(bufSize > addResult){
						
						bool stored = false;
						for(int ii=0;ii<=LAST_HASH_FUNC;ii++){
							
							if(ii<=lastHashFuncUsed){
								//last used hash func & current hashfunc is same -- so partial hasher would do the job
								
								//neighbour left so put it into the memBlock
								//cout<<"using partial hash func with last hash func value "<<lastFoundKHashVal[ii]<<" and next neighbour "<<temp[khmerSize - 1]<<endl;
								lastFoundKHashVal[ii] = partialHasher(lastFoundKHashVal[ii],temp[khmerSize - 1],khmerSize,ii);
								//lastFoundKHashVal = fullHasher(temp,ii); //saving the hash
							}  
							else{
								lastFoundKHashVal[ii] = fullHasher(temp,ii); //saving the hash
							}
							
							if(buf.length() >= addResult + 1){//checking that next khmer is not invalid
								switch(toupper(buf[addResult])){
									case 'A':
									case 'T':
									case 'G':
									case 'C':
									break;
									
									default:
									neucleotide_status = N_FOUND_IN_NEUCLEOTIDE;
									break;
								}
							}
							
							if(neucleotide_status == N_FOUND_IN_NEUCLEOTIDE){//N found in the middle of consuming
								n_found = true;
								break;
							}
							
							//std::cout<<"store try ("<<ii<<")"<<endl;
							
							//cout<<"trying to store-"<<temp<<" neighbour "<<buf[addResult]<<" hashfunc-"<<ii<<" last found hashed value "<<lastFoundKHashVal[ii]<<endl;
							//cout<<"Hash "<<temp<<" "<<buf[addResult]<<endl;
							
							switch(storeKhmerInMemBlock5Byte(temp,memBlock, blockSize, lastFoundKHashVal[ii], buf[addResult],ii)){

								case MEM_BLOCK:
									mem_block_occupied_stat++;
									lastHashFuncUsed = ii;
									stored = true;
									break;
								case MEM_BLOCK_FOUND:
									//cout<<"mem_block_found:: "<<temp<<endl;
									mem_block_found_stat++;
									lastHashFuncUsed = ii;
									stored=true;
									break;
								case LIST:
									list_occupied_stat++;
									lastHashFuncUsed = ii;
									stored = true;
									break;
								case LIST_FOUND:
									//cout<<"list_found:: "<<temp<<endl;
									list_occupied_found++;
									lastHashFuncUsed = ii;
									stored=true;
									break;
								case ERROR:
									//std::cout<<"ERROR OCCURED"<<std::endl;
									break;
								
							}

							if(stored == true){
								//if stored then just end the loop
								break;
							}
							
							//for debug purpose
							//std::cout<<"\tinside loop "<<std::endl;
							//std::cout<<"\t\t"<<temp<<std::endl;
						}
					}

				}

				//temp = temp.substr(1,khmerSize-1);//advance to next khmer one time of ahead
			}
		}

	//myfile.close();

	//spit out the stats
	std::cout<<"stat from consume function :: "<<std::endl
			<<"khmer in memBlock (distinct):: "<<mem_block_occupied_stat<<std::endl
			<<"khmer in list (distinct):: "<<list_occupied_stat<<std::endl<<std::endl;
			/*<<"khmer in memBlock (found):: "<<mem_block_found_stat<<std::endl
			<<"khmer in list (found):: "<<list_occupied_found<<std::endl<<std::endl;*/
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x530, %rsp            # imm = 0x530
movw %cx, %ax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movw %ax, -0x1a(%rbp)
leaq -0x228(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x33b0
movq -0x3c0(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x8, %edx
callq 0x31c0
jmp 0x4308
leaq -0x258(%rbp), %rdi
callq 0x3460
leaq -0x279(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x3550
movq -0x3c8(%rbp), %rdx
leaq 0xd3f9(%rip), %rsi      # 0x1172e
leaq -0x278(%rbp), %rdi
callq 0x7760
jmp 0x4343
leaq -0x279(%rbp), %rdi
callq 0x3380
movb $0x1, -0x27a(%rbp)
leaq 0x12ff7(%rip), %rax     # 0x17354
movl (%rax), %eax
incl %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x3040
movq %rax, -0x3d0(%rbp)
jmp 0x4375
movq -0x3d0(%rbp), %rax
movq %rax, -0x288(%rbp)
movb $0x0, -0x289(%rbp)
movq $0x0, -0x298(%rbp)
movl $0x0, -0x29c(%rbp)
movq $0x0, -0x2a8(%rbp)
movq $0x0, -0x2b0(%rbp)
movq $0x0, -0x2b8(%rbp)
movq $0x0, -0x2c0(%rbp)
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x228(%rbp,%rax), %rdi
callq 0x3030
movb %al, -0x3d1(%rbp)
jmp 0x43eb
movb -0x3d1(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x44a9
movq 0x12bca(%rip), %rdi     # 0x16fd0
leaq 0xcdcc(%rip), %rsi      # 0x111d9
callq 0x32f0
movq %rax, -0x3e0(%rbp)
jmp 0x441b
movq -0x3e0(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32f0
movq %rax, -0x3e8(%rbp)
jmp 0x4434
movq -0x3e8(%rbp), %rdi
movq 0x12b7e(%rip), %rsi     # 0x16fc0
callq 0x3340
jmp 0x4449
movl $0x1, -0x2c4(%rbp)
jmp 0x500b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x5050
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x279(%rbp), %rdi
callq 0x3380
jmp 0x5044
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x5038
movq 0x12b20(%rip), %rdi     # 0x16fd0
leaq 0xcd34(%rip), %rsi      # 0x111eb
callq 0x32f0
movq %rax, -0x3f0(%rbp)
jmp 0x44c5
movq -0x3f0(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32f0
movq %rax, -0x3f8(%rbp)
jmp 0x44de
movq -0x3f8(%rbp), %rdi
movq 0x12ad4(%rip), %rsi     # 0x16fc0
callq 0x3340
jmp 0x44f3
jmp 0x44f5
leaq -0x228(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x3090
movq %rax, -0x400(%rbp)
jmp 0x4511
movq -0x400(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3410
movb %al, -0x401(%rbp)
jmp 0x452f
movb -0x401(%rbp), %al
testb $0x1, %al
jne 0x453e
jmp 0x4f0c
xorl %eax, %eax
movl %eax, %esi
leaq -0x258(%rbp), %rdi
callq 0x35e0
movq %rax, -0x410(%rbp)
jmp 0x4557
movq -0x410(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
jne 0x469c
movb $0x0, -0x289(%rbp)
leaq 0xd1b6(%rip), %rsi      # 0x1172e
leaq -0x278(%rbp), %rdi
callq 0x3450
jmp 0x4586
movb $0x1, -0x27a(%rbp)
movq -0x298(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x298(%rbp)
movq -0x298(%rbp), %rax
movl $0xf4240, %ecx          # imm = 0xF4240
xorl %edx, %edx
divq %rcx
cmpq $0x0, %rdx
jne 0x4697
movq -0x298(%rbp), %rax
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
mulq %rcx
movq %rdx, %rsi
shrq $0x12, %rsi
movq 0x129f4(%rip), %rdi     # 0x16fd0
callq 0x32d0
movq %rax, -0x418(%rbp)
jmp 0x45ea
movq -0x418(%rbp), %rdi
leaq 0xcc01(%rip), %rsi      # 0x111f9
callq 0x32f0
movq %rax, -0x420(%rbp)
jmp 0x4606
movq -0x420(%rbp), %rdi
movq 0x129ac(%rip), %rsi     # 0x16fc0
callq 0x3340
jmp 0x461b
callq 0x10000
jmp 0x4622
leaq -0x2d0(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0xf7b0
jmp 0x4637
movq 0x12992(%rip), %rdi     # 0x16fd0
leaq 0xcbce(%rip), %rsi      # 0x11213
callq 0x32f0
movq %rax, -0x428(%rbp)
jmp 0x4653
movq -0x428(%rbp), %rdi
movsd -0x2d0(%rbp), %xmm0
movsd 0xcace(%rip), %xmm1     # 0x11138
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
callq 0x35a0
movq %rax, -0x430(%rbp)
jmp 0x4680
movq -0x430(%rbp), %rdi
movq 0x12932(%rip), %rsi     # 0x16fc0
callq 0x3340
jmp 0x4695
jmp 0x4697
jmp 0x44f5
movb -0x289(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x4f05
leaq -0x278(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x35c0
movq %rax, -0x438(%rbp)
jmp 0x46cc
movq -0x438(%rbp), %rsi
leaq -0x258(%rbp), %rdi
callq 0x3050
jmp 0x46e1
leaq -0x258(%rbp), %rdi
callq 0x31f0
movl %eax, -0x2e0(%rbp)
movl -0x2e0(%rbp), %eax
movzwl -0x1a(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x2e4(%rbp)
movb -0x27a(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x4721
movl $0x1, -0x2dc(%rbp)
jmp 0x472b
movl $0x0, -0x2dc(%rbp)
movb -0x27a(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x4aa2
movl -0x2e0(%rbp), %eax
movzwl -0x1a(%rbp), %ecx
cmpl %ecx, %eax
jae 0x4752
jmp 0x44f5
movzwl -0x1a(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
movl %eax, %edx
leaq -0x308(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x3330
jmp 0x4771
leaq -0x278(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x33e0
leaq -0x308(%rbp), %rdi
callq 0x31b0
movl -0x2e0(%rbp), %eax
movzwl -0x1a(%rbp), %ecx
cmpl %ecx, %eax
jbe 0x4a9b
movb $0x0, -0x309(%rbp)
movl $0x0, -0x310(%rbp)
movl -0x310(%rbp), %eax
leaq 0x12b94(%rip), %rcx     # 0x17354
cmpl (%rcx), %eax
ja 0x4a99
leaq -0x330(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x3120
jmp 0x47dd
movl -0x310(%rbp), %esi
leaq -0x330(%rbp), %rdi
callq 0x100e0
movq %rax, -0x440(%rbp)
jmp 0x47f8
movq -0x440(%rbp), %rdx
movq -0x288(%rbp), %rax
movslq -0x310(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq -0x330(%rbp), %rdi
callq 0x31b0
leaq -0x258(%rbp), %rdi
callq 0x34c0
movzwl -0x1a(%rbp), %ecx
cmpq %rcx, %rax
jbe 0x48ca
movzwl -0x1a(%rbp), %eax
movl %eax, %esi
leaq -0x258(%rbp), %rdi
callq 0x35e0
movq %rax, -0x448(%rbp)
jmp 0x4851
movq -0x448(%rbp), %rax
movsbl (%rax), %edi
callq 0x3590
movl %eax, %ecx
movl %ecx, -0x44c(%rbp)
subl $0x41, %eax
je 0x48b9
jmp 0x486f
movl -0x44c(%rbp), %eax
subl $0x43, %eax
je 0x48b9
jmp 0x487c
movl -0x44c(%rbp), %eax
subl $0x47, %eax
je 0x48b9
jmp 0x4889
movl -0x44c(%rbp), %eax
subl $0x54, %eax
je 0x48b9
jmp 0x48bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x31b0
jmp 0x5038
jmp 0x48c8
leaq 0x12ab6(%rip), %rax     # 0x17378
movl $0x7, (%rax)
jmp 0x48ca
leaq 0x12aa7(%rip), %rax     # 0x17378
cmpl $0x7, (%rax)
jne 0x48e2
movb $0x1, -0x289(%rbp)
jmp 0x4a99
leaq -0x350(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x3120
jmp 0x48f7
movq -0x8(%rbp), %rax
movq %rax, -0x470(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x468(%rbp)
movq -0x288(%rbp), %rax
movslq -0x310(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x460(%rbp)
movzwl -0x1a(%rbp), %eax
movl %eax, %esi
leaq -0x258(%rbp), %rdi
callq 0x35e0
movq %rax, -0x458(%rbp)
jmp 0x4941
movq -0x460(%rbp), %rcx
movq -0x468(%rbp), %rdx
movq -0x470(%rbp), %rsi
movq -0x458(%rbp), %rax
movsbl (%rax), %r8d
movl -0x310(%rbp), %r9d
leaq -0x350(%rbp), %rdi
callq 0x3a40
movl %eax, -0x474(%rbp)
jmp 0x497c
leaq -0x350(%rbp), %rdi
callq 0x31b0
movl -0x474(%rbp), %eax
movl %eax, %ecx
movq %rcx, -0x480(%rbp)
subl $0x6, %eax
ja 0x4a78
movq -0x480(%rbp), %rax
leaq 0xc752(%rip), %rcx      # 0x11100
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x350(%rbp), %rdi
callq 0x31b0
jmp 0x5038
movq -0x2a8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2a8(%rbp)
movl -0x310(%rbp), %eax
movl %eax, -0x29c(%rbp)
movb $0x1, -0x309(%rbp)
jmp 0x4a78
movq -0x2b0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2b0(%rbp)
movl -0x310(%rbp), %eax
movl %eax, -0x29c(%rbp)
movb $0x1, -0x309(%rbp)
jmp 0x4a78
movq -0x2b8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2b8(%rbp)
movl -0x310(%rbp), %eax
movl %eax, -0x29c(%rbp)
movb $0x1, -0x309(%rbp)
jmp 0x4a78
movq -0x2c0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2c0(%rbp)
movl -0x310(%rbp), %eax
movl %eax, -0x29c(%rbp)
movb $0x1, -0x309(%rbp)
jmp 0x4a78
jmp 0x4a78
testb $0x1, -0x309(%rbp)
je 0x4a83
jmp 0x4a99
jmp 0x4a85
movl -0x310(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x310(%rbp)
jmp 0x47b3
jmp 0x4a9b
movb $0x0, -0x27a(%rbp)
movb -0x289(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x4ab7
jmp 0x44f5
jmp 0x4ab9
movl -0x2dc(%rbp), %ecx
xorl %eax, %eax
cmpl -0x2e4(%rbp), %ecx
movb %al, -0x481(%rbp)
ja 0x4ae6
movb -0x289(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
sete %al
movb %al, -0x481(%rbp)
movb -0x481(%rbp), %al
testb $0x1, %al
jne 0x4af5
jmp 0x4f03
movl -0x2dc(%rbp), %eax
movl %eax, %edx
movzwl -0x1a(%rbp), %eax
movl %eax, %ecx
leaq -0x370(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x3330
jmp 0x4b18
leaq -0x278(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x33e0
leaq -0x370(%rbp), %rdi
callq 0x31b0
movl -0x2dc(%rbp), %eax
movzwl -0x1a(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x2e8(%rbp)
movl -0x2e0(%rbp), %eax
cmpl -0x2e8(%rbp), %eax
jbe 0x4eed
movb $0x0, -0x371(%rbp)
movl $0x0, -0x378(%rbp)
movl -0x378(%rbp), %eax
leaq 0x127db(%rip), %rcx     # 0x17354
cmpl (%rcx), %eax
ja 0x4eeb
movl -0x378(%rbp), %eax
cmpl -0x29c(%rbp), %eax
ja 0x4c0a
movq -0x288(%rbp), %rax
movslq -0x378(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x498(%rbp)
movzwl -0x1a(%rbp), %eax
movl %eax, %esi
decq %rsi
leaq -0x278(%rbp), %rdi
callq 0x35e0
movq %rax, -0x490(%rbp)
jmp 0x4bc6
movq -0x498(%rbp), %rdi
movq -0x490(%rbp), %rax
movsbl (%rax), %esi
movzwl -0x1a(%rbp), %edx
movl -0x378(%rbp), %ecx
callq 0x10250
movq %rax, -0x4a0(%rbp)
jmp 0x4bef
movq -0x4a0(%rbp), %rdx
movq -0x288(%rbp), %rax
movslq -0x378(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x4c84
leaq -0x398(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x3120
jmp 0x4c1f
movl -0x378(%rbp), %esi
leaq -0x398(%rbp), %rdi
callq 0x100e0
movq %rax, -0x4a8(%rbp)
jmp 0x4c3a
movq -0x4a8(%rbp), %rdx
movq -0x288(%rbp), %rax
movslq -0x378(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq -0x398(%rbp), %rdi
callq 0x31b0
jmp 0x4c84
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x398(%rbp), %rdi
callq 0x31b0
jmp 0x5038
leaq -0x258(%rbp), %rdi
callq 0x34c0
movl -0x2e8(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jb 0x4d13
movl -0x2e8(%rbp), %eax
movl %eax, %esi
leaq -0x258(%rbp), %rdi
callq 0x35e0
movq %rax, -0x4b0(%rbp)
jmp 0x4cbd
movq -0x4b0(%rbp), %rax
movsbl (%rax), %edi
callq 0x3590
movl %eax, %ecx
movl %ecx, -0x4b4(%rbp)
subl $0x41, %eax
je 0x4d02
jmp 0x4cdb
movl -0x4b4(%rbp), %eax
subl $0x43, %eax
je 0x4d02
jmp 0x4ce8
movl -0x4b4(%rbp), %eax
subl $0x47, %eax
je 0x4d02
jmp 0x4cf5
movl -0x4b4(%rbp), %eax
subl $0x54, %eax
jne 0x4d04
jmp 0x4d02
jmp 0x4d11
leaq 0x1266d(%rip), %rax     # 0x17378
movl $0x7, (%rax)
jmp 0x4d13
leaq 0x1265e(%rip), %rax     # 0x17378
cmpl $0x7, (%rax)
jne 0x4d2b
movb $0x1, -0x289(%rbp)
jmp 0x4eeb
leaq -0x3b8(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x3120
jmp 0x4d40
movq -0x8(%rbp), %rax
movq %rax, -0x4d8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x4d0(%rbp)
movq -0x288(%rbp), %rax
movslq -0x378(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x4c8(%rbp)
movl -0x2e8(%rbp), %eax
movl %eax, %esi
leaq -0x258(%rbp), %rdi
callq 0x35e0
movq %rax, -0x4c0(%rbp)
jmp 0x4d8c
movq -0x4c8(%rbp), %rcx
movq -0x4d0(%rbp), %rdx
movq -0x4d8(%rbp), %rsi
movq -0x4c0(%rbp), %rax
movsbl (%rax), %r8d
movl -0x378(%rbp), %r9d
leaq -0x3b8(%rbp), %rdi
callq 0x3a40
movl %eax, -0x4dc(%rbp)
jmp 0x4dc7
leaq -0x3b8(%rbp), %rdi
callq 0x31b0
movl -0x4dc(%rbp), %eax
movl %eax, %ecx
movq %rcx, -0x4e8(%rbp)
subl $0x6, %eax
ja 0x4ec3
movq -0x4e8(%rbp), %rax
leaq 0xc323(%rip), %rcx      # 0x1111c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x3b8(%rbp), %rdi
callq 0x31b0
jmp 0x5038
movq -0x2a8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2a8(%rbp)
movl -0x378(%rbp), %eax
movl %eax, -0x29c(%rbp)
movb $0x1, -0x371(%rbp)
jmp 0x4ec3
movq -0x2b0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2b0(%rbp)
movl -0x378(%rbp), %eax
movl %eax, -0x29c(%rbp)
movb $0x1, -0x371(%rbp)
jmp 0x4ec3
movq -0x2b8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2b8(%rbp)
movl -0x378(%rbp), %eax
movl %eax, -0x29c(%rbp)
movb $0x1, -0x371(%rbp)
jmp 0x4ec3
movq -0x2c0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2c0(%rbp)
movl -0x378(%rbp), %eax
movl %eax, -0x29c(%rbp)
movb $0x1, -0x371(%rbp)
jmp 0x4ec3
jmp 0x4ec3
movb -0x371(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x4ed5
jmp 0x4eeb
jmp 0x4ed7
movl -0x378(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x378(%rbp)
jmp 0x4b6c
jmp 0x4eed
jmp 0x4eef
movl -0x2dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2dc(%rbp)
jmp 0x4ab9
jmp 0x4f05
jmp 0x4f07
jmp 0x44f5
movq 0x120bd(%rip), %rdi     # 0x16fd0
leaq 0xc30d(%rip), %rsi      # 0x11227
callq 0x32f0
movq %rax, -0x4f0(%rbp)
jmp 0x4f28
movq -0x4f0(%rbp), %rdi
movq 0x1208a(%rip), %rsi     # 0x16fc0
callq 0x3340
movq %rax, -0x4f8(%rbp)
jmp 0x4f44
movq -0x4f8(%rbp), %rdi
leaq 0xc2f4(%rip), %rsi      # 0x11246
callq 0x32f0
movq %rax, -0x500(%rbp)
jmp 0x4f60
movq -0x500(%rbp), %rdi
movq -0x2a8(%rbp), %rsi
callq 0x30b0
movq %rax, -0x508(%rbp)
jmp 0x4f7c
movq -0x508(%rbp), %rdi
movq 0x12036(%rip), %rsi     # 0x16fc0
callq 0x3340
movq %rax, -0x510(%rbp)
jmp 0x4f98
movq -0x510(%rbp), %rdi
leaq 0xc2c0(%rip), %rsi      # 0x11266
callq 0x32f0
movq %rax, -0x518(%rbp)
jmp 0x4fb4
movq -0x518(%rbp), %rdi
movq -0x2b8(%rbp), %rsi
callq 0x30b0
movq %rax, -0x520(%rbp)
jmp 0x4fd0
movq -0x520(%rbp), %rdi
movq 0x11fe2(%rip), %rsi     # 0x16fc0
callq 0x3340
movq %rax, -0x528(%rbp)
jmp 0x4fec
movq -0x528(%rbp), %rdi
movq 0x11fc6(%rip), %rsi     # 0x16fc0
callq 0x3340
jmp 0x5001
movl $0x0, -0x2c4(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x31b0
leaq -0x258(%rbp), %rdi
callq 0x31b0
leaq -0x228(%rbp), %rdi
callq 0x30c0
addq $0x530, %rsp            # imm = 0x530
popq %rbp
retq
leaq -0x278(%rbp), %rdi
callq 0x31b0
leaq -0x258(%rbp), %rdi
callq 0x31b0
leaq -0x228(%rbp), %rdi
callq 0x30c0
movq -0x230(%rbp), %rdi
callq 0x3540
nopl (%rax,%rax)