// File: /workspace/github_cpp_makefile_star2_O1/simonrharris[P]SKA/src/sk_merge.cpp
// Function: mergeKmerFiles(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
int mergeKmerFiles(const std::string & outfile, const std::vector < std::string > & kmerfiles, const std::vector < std::string > & sample)
{

	const std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();//start the clock

	int numfiles=kmerfiles.size();
	
	// Create the kmer map
	std::unordered_map < std::string, std::vector < bool > > kmerMap;
	
	std::vector< int > kmerCounts;
	int kmersize=0;
	std::vector < std::string > sampleNames;

	if (collectSampleNames(kmerfiles, sampleNames)!=0){return 1;}

	std::vector < bool > include (sampleNames.size());
	getSubsample(sample, sampleNames, include);//get a vector of bools representing which samples to include based on a provided sample file. This also removed duplicate samples in the input files

	std::vector < std::string > includedSampleNames;
	for (std::vector < bool >::iterator it=include.begin(); it!=include.end(); ++it){//make a vector of all included sample names to help printing output files later
		if (*it){
			includedSampleNames.push_back(sampleNames[distance(include.begin(), it)]);
		}
	}

	//int numSamples=sampleNames.size();
	int numSamples = std::count(include.begin(), include.end(), true);

	std::vector < std::string > fileSampleNames;

	int sampleNum=0;
	int includedSampleNum=0;
	std::ifstream fileStream;

	for (int s = 0; s < kmerfiles.size(); ++s){

		if (openFileStream(kmerfiles[s], fileStream)){return 1;};

		int newkmersize;
		
		readKmerHeader(fileStream, newkmersize, fileSampleNames);
		
		if (s==0){
			kmersize=newkmersize;
		}

		if (newkmersize!=kmersize){
			std::cout << "kmer files have different kmer sizes" << std::endl << std::endl;
			return 0;
		}

		std::vector < int > fileInclude;

		for (int i=0; i<fileSampleNames.size(); ++i){ //put the index of all sample names that are to be included into a vector
			if (include[sampleNum+i]){
				fileInclude.push_back(i);
			}
		}
		if (fileInclude.size()==0){ // if no sample names in the file are going to be included then don't read the file
			fileStream.close();
			sampleNum+=int(fileSampleNames.size());
			fileSampleNames.clear();
			continue;
		}

		//int numFileSamples=fileSampleNames.size();
		int numFileSamples = fileInclude.size();

		char basebuffer[1];
		char kmerbuffer[(kmersize*2/3)+1];
		char asciibuffer[int(std::ceil(float(fileSampleNames.size())/6))];

		while (fileStream.read(asciibuffer, sizeof(asciibuffer))){//read the ascii representation of the taxa
			std::string asciibits (asciibuffer, sizeof(asciibuffer));
			std::vector < bool > mybits;
			vectorbool_from_ascii(asciibits, mybits);//read the ascii representation of the taxa to a vector of bools

			int mybitcount=0;
			for (int i=0; i< fileInclude.size(); ++i){
				if (mybits[fileInclude[i]]){
					mybitcount++;
				}
			}

			if (mybitcount==0){
				std::string line;
				std::getline(fileStream, line);
				continue;
			}

			while (fileStream.peek()!='\n' && fileStream.read(kmerbuffer, sizeof(kmerbuffer))){
				std::string kmer (kmerbuffer, (kmersize*2/3)+1);
				
				std::unordered_map < std::string, std::vector < bool > >::iterator it = kmerMap.find(kmer);//check if the kmer is in the map
				if ( it != kmerMap.end() ){//if the kmer is in the map
					for (int i=0; i<fileInclude.size(); ++i){
						it->second[i+includedSampleNum]=mybits[fileInclude[i]];
					}
				}
				else {//if the kmer is not in the hash
					std::vector < bool > taxonBitset(numSamples, false);//create a new vector of bools for all samples
					for (int i=0; i<fileInclude.size(); ++i){ //change the bools to true based for taxa in the file containing the kmer
						taxonBitset[i+includedSampleNum]=mybits[fileInclude[i]];
					}
					kmerMap.insert(std::make_pair(kmer, taxonBitset));//add the new vector to the map
				}
	    	}
	    	fileStream.ignore(256,'\n');//skip the end of line character
    	}
    	sampleNum+=numFileSamples; //add the number of samples in the file to the count of total samples
    	includedSampleNum+=fileInclude.size();
    	fileSampleNames.clear();
		fileStream.close();
	}

	std::cout << kmerMap.size() << " kmers identified from " << includedSampleNum << " samples in " << numfiles << " files" << std::endl;
	
	std::cout << "Merging..." << std::endl;

	std::unordered_map < std::vector < bool >,  std::vector < std::string > > revKmerMap;

	reverseVectorBoolKmerMap(kmerMap, revKmerMap);//reverse the map so that we have a new map of kmers for each combination of samples

	std::cout << revKmerMap.size() << " unique taxon combinations in map" << std::endl;
	
	if(printMergedKmerFile(revKmerMap, outfile, includedSampleNames, kmersize)){return 1;}
	
	printDuration(start);//stop the clock
	
	return 0;
		
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x478, %rsp            # imm = 0x478
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, -0x200(%rbp)
callq 0x5060
movq %rax, -0x1f8(%rbp)
movq 0x8(%r15), %rax
subq (%r15), %rax
movq %rax, -0x208(%rbp)
leaq -0x260(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq -0x1d0(%rbp), %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movl $0x1, %ebx
movq %r15, -0x158(%rbp)
movq %r15, %rdi
movl $0x1, %edx
callq 0x98af
testl %eax, %eax
jne 0x1b389
movq -0x1c8(%rbp), %rsi
subq -0x1d0(%rbp), %rsi
sarq $0x5, %rsi
leaq -0x498(%rbp), %rdx
movb $0x0, (%rdx)
leaq -0x98(%rbp), %rdi
leaq -0x118(%rbp), %rcx
callq 0xac4a
leaq -0x1d0(%rbp), %rsi
leaq -0x98(%rbp), %rdx
movq %r14, %rdi
callq 0x9ba8
xorps %xmm0, %xmm0
movaps %xmm0, -0x1f0(%rbp)
movq $0x0, -0x1e0(%rbp)
movq -0x98(%rbp), %r14
movq -0x88(%rbp), %rax
movl -0x80(%rbp), %ecx
cmpq %rax, %r14
setne %dl
testl %ecx, %ecx
setne %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0x1a794
xorl %r15d, %r15d
leaq -0x1f0(%rbp), %rbx
xorl %edx, %edx
movl %edx, %r12d
movq (%r14), %rax
btq %rdx, %rax
jae 0x1a762
movq %r14, %rax
subq -0x98(%rbp), %rax
shlq $0x8, %rax
addq -0x1d0(%rbp), %rax
movq %r12, %rsi
shlq $0x5, %rsi
addq %rax, %rsi
movq %rbx, %rdi
callq 0x855c
leal 0x1(%r12), %edx
xorl %eax, %eax
cmpq $0x3f, %r12
sete %al
cmovel %r15d, %edx
leaq (%r14,%rax,8), %r14
movq -0x88(%rbp), %rax
movl -0x80(%rbp), %ecx
cmpq %rax, %r14
setne %sil
cmpl %ecx, %edx
setne %dil
orb %sil, %dil
jne 0x1a72f
movq -0x98(%rbp), %rdx
cmpq %rax, %rdx
setne %sil
testl %ecx, %ecx
setne %dil
orb %sil, %dil
xorl %ebx, %ebx
cmpb $0x1, %dil
jne 0x1a7eb
xorl %esi, %esi
xorl %edi, %edi
movq (%rdx), %r8
btq %rdi, %r8
adcq $0x0, %rsi
xorl %r8d, %r8d
cmpl $0x3f, %edi
leal 0x1(%rdi), %edi
sete %r8b
leaq (%rdx,%r8,8), %rdx
cmovel %ebx, %edi
cmpq %rax, %rdx
setne %r8b
cmpl %ecx, %edi
setne %r9b
orb %r8b, %r9b
jne 0x1a7b7
movslq %esi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
leaq -0x498(%rbp), %r13
movq %r13, %rdi
callq 0x5410
movq -0x158(%rbp), %rcx
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
setne %r14b
je 0x1b117
movq %rbx, -0x228(%rbp)
leaq -0x180(%rbp), %r12
xorl %edi, %edi
movq $0x0, -0x58(%rbp)
movq $0x0, -0xc8(%rbp)
movl $0x0, -0x30(%rbp)
movq %rdi, -0x160(%rbp)
shlq $0x5, %rdi
addq %rax, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x7f73
testl %eax, %eax
jne 0x1b12a
movb %r14b, -0x29(%rbp)
movq %r13, %rdi
leaq -0x11c(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x96e2
cmpq $0x0, -0x160(%rbp)
movl -0x11c(%rbp), %eax
movq -0x58(%rbp), %rdx
cmovel %eax, %edx
movq %rdx, -0x58(%rbp)
cmpl %edx, %eax
jne 0x1a9da
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x0, -0x118(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x70(%rbp), %rax
je 0x1a965
xorl %eax, %eax
movq -0xc8(%rbp), %rcx
addl %eax, %ecx
movslq %ecx, %rcx
leaq 0x3f(%rcx), %rdx
testq %rcx, %rcx
cmovnsq %rcx, %rdx
sarq $0x6, %rdx
shlq $0x3, %rdx
addq -0x98(%rbp), %rdx
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
leaq 0x3f(%r8), %rsi
andq %rcx, %rsi
xorl %edi, %edi
cmpq %r8, %rsi
setbe %dil
movq -0x8(%rdx,%rdi,8), %rdx
btq %rcx, %rdx
jae 0x1a940
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x1a930
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x1a940
leaq -0x50(%rbp), %rdi
leaq -0x118(%rbp), %rdx
callq 0xe01e
movslq -0x118(%rbp), %rax
incq %rax
movl %eax, -0x118(%rbp)
movq -0x68(%rbp), %rcx
subq -0x70(%rbp), %rcx
sarq $0x5, %rcx
cmpq %rax, %rcx
ja 0x1a8cf
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rax
subq %rax, %rsi
je 0x1aa59
movq %rsp, -0x210(%rbp)
movq -0x58(%rbp), %rax
addl %eax, %eax
cltq
imulq $0x55555556, %rax, %rbx # imm = 0x55555556
movq %rbx, %rax
shrq $0x3f, %rax
shrq $0x20, %rbx
leal (%rbx,%rax), %ecx
incl %ecx
movq %rcx, -0x238(%rbp)
addq $0xf, %rcx
andq $-0x10, %rcx
movq %rsp, %rdx
subq %rcx, %rdx
movq %rdx, -0xd0(%rbp)
movq %rdx, %rsp
movq -0x68(%rbp), %rcx
subq -0x70(%rbp), %rcx
sarq $0x5, %rcx
js 0x1aac2
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
jmp 0x1aada
movl $0x24, %edx
movq 0x265da(%rip), %rdi     # 0x40fc0
leaq 0x18a9e(%rip), %rsi     # 0x3348b
callq 0x5420
movq 0x265c7(%rip), %rcx     # 0x40fc0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x265a9(%rip), %rdi     # 0x40fc0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movl $0x1, %r14d
movq %rax, %rdi
callq 0x5250
jmp 0x1b0dc
movq %r13, %rdi
callq 0x50b0
movq -0x70(%rbp), %rbx
movq -0x68(%rbp), %r15
movq %r15, %rax
subq %rbx, %rax
sarq $0x5, %rax
movq %rax, -0x150(%rbp)
movl $0x7, %r14d
cmpq %rbx, %r15
je 0x1b0b3
leaq 0x10(%rbx), %r13
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x1aaa2
movq (%r13), %rsi
incq %rsi
callq 0x53c0
leaq 0x20(%r13), %rax
addq $0x10, %r13
cmpq %r15, %r13
movq %rax, %r13
jne 0x1aa8d
movq %rbx, -0x68(%rbp)
leaq -0x498(%rbp), %r13
jmp 0x1b0b3
movq %rcx, %rdx
shrq %rdx
andl $0x1, %ecx
orq %rdx, %rcx
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
sarq $0x2, %rsi
movq %rsi, -0x150(%rbp)
addl %eax, %ebx
divss 0x18b91(%rip), %xmm0    # 0x33680
callq 0x51e0
cvttss2si %xmm0, %ecx
leaq 0xf(%rcx), %rax
andq $-0x10, %rax
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, %rsp
movq %rcx, -0x220(%rbp)
movq %rdx, -0x168(%rbp)
leaq (%rdx,%rcx), %rax
movq %rax, -0x218(%rbp)
movslq %ebx, %rax
movq -0xd0(%rbp), %rcx
leaq 0x1(%rax,%rcx), %rax
movq %rax, -0x230(%rbp)
movslq -0x30(%rbp), %rax
movq %rax, -0x170(%rbp)
leaq -0x1b0(%rbp), %rbx
movq %r13, %rdi
movq -0x168(%rbp), %rsi
movq -0x220(%rbp), %rdx
callq 0x5480
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1b051
leaq -0x1a0(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq %rbx, %rdi
movq -0x168(%rbp), %rsi
movq -0x218(%rbp), %rdx
callq 0x862a
xorl %eax, %eax
movq %rax, -0xc0(%rbp)
movl %eax, -0xb8(%rbp)
movq %rax, -0xb0(%rbp)
movl %eax, -0xa8(%rbp)
movq %rax, -0xa0(%rbp)
movq %rbx, %rdi
leaq -0xc0(%rbp), %rsi
callq 0x89ef
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rax, %rcx
je 0x1af68
sarq $0x2, %rcx
movq -0xc0(%rbp), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %esi, %esi
xorl %edi, %edi
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
movslq (%rax,%rsi,4), %r8
leaq 0x3f(%r8), %r9
testq %r8, %r8
cmovnsq %r8, %r9
sarq $0x6, %r9
leaq (%rdx,%r9,8), %r9
leaq 0x3f(%r14), %r15
movq %r8, %r10
andq %r15, %r10
xorl %r11d, %r11d
cmpq %r14, %r10
setbe %r11b
movq -0x8(%r9,%r11,8), %r9
btq %r8, %r9
adcl $0x0, %edi
incq %rsi
cmpq %rsi, %rcx
jne 0x1abfa
testl %edi, %edi
je 0x1af68
movq %r13, %rdi
callq 0x5140
cmpl $0xa, %eax
je 0x1afd6
movq %r13, %rdi
movq -0xd0(%rbp), %rsi
movq -0x238(%rbp), %rdx
callq 0x5480
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1afd6
movq %r12, -0x190(%rbp)
leaq -0x190(%rbp), %rbx
movq %rbx, %rdi
movq -0xd0(%rbp), %rsi
movq -0x230(%rbp), %rdx
callq 0x862a
leaq -0x290(%rbp), %rdi
movq %rbx, %rsi
callq 0x1b6e4
testq %rax, %rax
je 0x1ad7e
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rsi
subq %rdx, %rsi
je 0x1af33
sarq $0x2, %rsi
movq -0xc0(%rbp), %rdi
movq 0x28(%rax), %rax
cmpq $0x1, %rsi
adcq $0x0, %rsi
xorl %r8d, %r8d
movslq (%rdx,%r8,4), %r9
leaq 0x3f(%r9), %rcx
testq %r9, %r9
cmovnsq %r9, %rcx
sarq $0x6, %rcx
leaq (%rdi,%rcx,8), %r10
movq %r9, %rcx
andq %r15, %rcx
xorl %r14d, %r14d
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
cmpq %rbx, %rcx
setbe %r14b
movq -0x170(%rbp), %r11
movq %r11, %rcx
addq %r8, %rcx
leaq 0x3f(%r11,%r8), %r13
cmovnsq %rcx, %r13
sarq $0x6, %r13
movq %rcx, %r11
andq %r15, %r11
xorl %r12d, %r12d
cmpq %rbx, %r11
setbe %r12b
movl $0x1, %r11d
shlq %cl, %r11
movq -0x8(%r10,%r14,8), %rcx
btq %r9, %rcx
leaq (%rax,%r13,8), %rcx
leaq -0x8(,%r12,8), %r9
jae 0x1ad62
orq (%rcx,%r9), %r11
jmp 0x1ad69
notq %r11
andq (%rcx,%r9), %r11
movq %r11, (%rcx,%r9)
incq %r8
cmpq %r8, %rsi
jne 0x1ace1
jmp 0x1af33
movb $0x0, -0x118(%rbp)
leaq -0x148(%rbp), %rdi
movq -0x228(%rbp), %rsi
leaq -0x118(%rbp), %rdx
leaq -0x31(%rbp), %rcx
callq 0xac4a
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rdx
subq %rax, %rdx
je 0x1ae69
sarq $0x2, %rdx
movq -0xc0(%rbp), %rsi
movq -0x148(%rbp), %rdi
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %r8d, %r8d
movslq (%rax,%r8,4), %r9
leaq 0x3f(%r9), %rcx
testq %r9, %r9
cmovnsq %r9, %rcx
sarq $0x6, %rcx
leaq (%rsi,%rcx,8), %r10
movq %r9, %rcx
andq %r15, %rcx
xorl %r14d, %r14d
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
cmpq %rbx, %rcx
setbe %r14b
movq -0x170(%rbp), %r11
movq %r11, %rcx
addq %r8, %rcx
leaq 0x3f(%r11,%r8), %r12
cmovnsq %rcx, %r12
sarq $0x6, %r12
movq %rcx, %r11
andq %r15, %r11
xorl %r13d, %r13d
cmpq %rbx, %r11
setbe %r13b
movl $0x1, %r11d
shlq %cl, %r11
movq -0x8(%r10,%r14,8), %rcx
btq %r9, %rcx
leaq (%rdi,%r12,8), %rcx
leaq -0x8(,%r13,8), %r9
jae 0x1ae52
orq (%rcx,%r9), %r11
jmp 0x1ae59
notq %r11
andq (%rcx,%r9), %r11
movq %r11, (%rcx,%r9)
incq %r8
cmpq %r8, %rdx
jne 0x1add1
leaq -0x118(%rbp), %rbx
movq %rbx, %rdi
leaq -0x190(%rbp), %rsi
leaq -0x148(%rbp), %rdx
callq 0x1b5f2
leaq -0x290(%rbp), %rdi
movq %rbx, %rsi
callq 0x1b7e0
movq -0xf8(%rbp), %rdi
testq %rdi, %rdi
je 0x1aed3
movq -0xd8(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, -0xf8(%rbp)
movl %eax, -0xf0(%rbp)
movq %rax, -0xe8(%rbp)
movl %eax, -0xe0(%rbp)
movq %rax, -0xd8(%rbp)
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x1aef5
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x148(%rbp), %rdi
testq %rdi, %rdi
je 0x1af33
movq -0x128(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, -0x148(%rbp)
movl %eax, -0x140(%rbp)
movq %rax, -0x138(%rbp)
movl %eax, -0x130(%rbp)
movq %rax, -0x128(%rbp)
movq -0x190(%rbp), %rdi
leaq -0x180(%rbp), %r12
cmpq %r12, %rdi
je 0x1af55
movq -0x180(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x498(%rbp), %r13
leaq -0x1b0(%rbp), %rbx
jmp 0x1ac41
leaq -0x108(%rbp), %rax
movq %rax, -0x118(%rbp)
movq $0x0, -0x110(%rbp)
movb $0x0, -0x108(%rbp)
movq -0x498(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %edx
movq %r13, %rdi
leaq -0x118(%rbp), %rsi
callq 0x56c0
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x1afe8
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1afe8
movl $0x100, %esi            # imm = 0x100
movq %r13, %rdi
movl $0xa, %edx
callq 0x5220
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0x1b026
movq -0xa0(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, -0xc0(%rbp)
movl %eax, -0xb8(%rbp)
movq %rax, -0xb0(%rbp)
movl %eax, -0xa8(%rbp)
movq %rax, -0xa0(%rbp)
movq -0x1b0(%rbp), %rdi
leaq -0x1a0(%rbp), %rax
cmpq %rax, %rdi
je 0x1ab4a
movq -0x1a0(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1ab4a
movq -0x48(%rbp), %rbx
subq -0x50(%rbp), %rbx
movq -0x70(%rbp), %r14
movq -0x68(%rbp), %r15
cmpq %r14, %r15
je 0x1b09a
leaq 0x10(%r14), %r13
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x1b07f
movq (%r13), %rsi
incq %rsi
callq 0x53c0
leaq 0x20(%r13), %rax
addq $0x10, %r13
cmpq %r15, %r13
movq %rax, %r13
jne 0x1b06a
movq %r14, -0x68(%rbp)
leaq -0x498(%rbp), %r13
movq %r13, %rdi
callq 0x50b0
shrq $0x2, %rbx
addl %ebx, -0x30(%rbp)
movq -0x210(%rbp), %rsp
xorl %r14d, %r14d
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x1b0c8
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0xc8(%rbp), %rax
addl -0x150(%rbp), %eax
movq %rax, -0xc8(%rbp)
xorl %ebx, %ebx
cmpl $0x7, %r14d
je 0x1b0e9
testl %r14d, %r14d
jne 0x1b131
movq -0x160(%rbp), %rdi
incq %rdi
movq -0x158(%rbp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rdi, %rcx
seta %r14b
ja 0x1a84b
jmp 0x1b135
movl $0x0, -0x30(%rbp)
movq $0x0, -0x58(%rbp)
xorl %ebx, %ebx
jmp 0x1b135
movl $0x1, %ebx
jmp 0x1b135
movb -0x29(%rbp), %r14b
testb $0x1, %r14b
jne 0x1b333
movq -0x278(%rbp), %rsi
movq 0x25e73(%rip), %rdi     # 0x40fc0
callq 0x5240
movq %rax, %rbx
leaq 0x1860d(%rip), %rsi     # 0x33769
movl $0x17, %edx
movq %rax, %rdi
callq 0x5420
movq %rbx, %rdi
movl -0x30(%rbp), %esi
callq 0x5690
movq %rax, %rbx
leaq 0x18332(%rip), %rsi     # 0x334b0
movl $0xc, %edx
movq %rax, %rdi
callq 0x5420
movq -0x208(%rbp), %rsi
shrq $0x5, %rsi
movq %rbx, %rdi
callq 0x5690
movq %rax, %rbx
leaq 0x19959(%rip), %rsi     # 0x34b01
movl $0x6, %edx
movq %rax, %rdi
callq 0x5420
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq 0x25ddd(%rip), %rbx     # 0x40fc0
leaq 0x191de(%rip), %rsi     # 0x343c8
movl $0xa, %edx
movq %rbx, %rdi
callq 0x5420
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x25dab(%rip), %rdi     # 0x40fc0
callq 0x5030
movq %rax, %rdi
callq 0x5250
leaq -0xe8(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq -0x290(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0xa600
movq -0x100(%rbp), %rsi
movq 0x25d58(%rip), %rdi     # 0x40fc0
callq 0x5240
movq %rax, %rbx
leaq 0x1852c(%rip), %rsi     # 0x337a3
movl $0x21, %edx
movq %rax, %rdi
callq 0x5420
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
leaq -0x248(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x200(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x258(%rbp), %rdi
callq 0x859a
leaq -0x118(%rbp), %rdi
leaq -0x258(%rbp), %rsi
leaq -0x1f0(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0x92ac
movl %eax, %r14d
movq -0x258(%rbp), %rdi
cmpq %r15, %rdi
je 0x1b30f
movq -0x248(%rbp), %rsi
incq %rsi
callq 0x53c0
movl $0x1, %ebx
testl %r14d, %r14d
jne 0x1b327
xorl %ebx, %ebx
movq -0x1f8(%rbp), %rdi
callq 0x8354
leaq -0x118(%rbp), %rdi
callq 0xdec6
leaq -0x498(%rbp), %rdi
callq 0x50d0
leaq -0x70(%rbp), %rdi
callq 0xabee
leaq -0x1f0(%rbp), %rdi
callq 0xabee
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x1b389
movq -0x78(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, -0x98(%rbp)
movl %eax, -0x90(%rbp)
movq %rax, -0x88(%rbp)
movl %eax, -0x80(%rbp)
movq %rax, -0x78(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0xabee
leaq -0x290(%rbp), %rdi
callq 0x1b646
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x258(%rbp), %rdi
cmpq %r15, %rdi
je 0x1b3f3
movq -0x248(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1b3f3
movq %rax, %rbx
jmp 0x1b557
movq %rax, %rbx
jmp 0x1b56c
jmp 0x1b3e8
jmp 0x1b426
jmp 0x1b426
movq %rax, %rbx
jmp 0x1b5a1
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0xdec6
jmp 0x1b54b
jmp 0x1b417
jmp 0x1b417
movq %rax, %rbx
jmp 0x1b560
jmp 0x1b426
jmp 0x1b4d3
movq %rax, %rbx
jmp 0x1b54b
jmp 0x1b4d3
jmp 0x1b426
movq %rax, %rbx
jmp 0x1b536
movq %rax, %rbx
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x1b4d6
movq -0x108(%rbp), %rsi
jmp 0x1b4c7
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x1b5c2
jmp 0x1b465
movq %rax, %rbx
movq -0x148(%rbp), %rdi
testq %rdi, %rdi
je 0x1b4a8
movq -0x128(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, -0x148(%rbp)
movl %eax, -0x140(%rbp)
movq %rax, -0x138(%rbp)
movl %eax, -0x130(%rbp)
movq %rax, -0x128(%rbp)
jmp 0x1b4a8
movq %rax, %rbx
leaq -0x180(%rbp), %r12
jmp 0x1b4b4
movq %rax, %rbx
movq -0x190(%rbp), %rdi
cmpq %r12, %rdi
je 0x1b4d6
movq -0x180(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1b4d6
jmp 0x1b4d3
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0x1b514
movq -0xa0(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, -0xc0(%rbp)
movl %eax, -0xb8(%rbp)
movq %rax, -0xb0(%rbp)
movl %eax, -0xa8(%rbp)
movq %rax, -0xa0(%rbp)
movq -0x1b0(%rbp), %rdi
leaq -0x1a0(%rbp), %rax
cmpq %rax, %rdi
je 0x1b536
movq -0x1a0(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x1b54b
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
leaq -0x498(%rbp), %rdi
callq 0x50d0
leaq -0x70(%rbp), %rdi
callq 0xabee
leaq -0x1f0(%rbp), %rdi
callq 0xabee
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x1b5a1
movq -0x78(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, -0x98(%rbp)
movl %eax, -0x90(%rbp)
movq %rax, -0x88(%rbp)
movl %eax, -0x80(%rbp)
movq %rax, -0x78(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0xabee
leaq -0x290(%rbp), %rdi
callq 0x1b646
movq %rbx, %rdi
callq 0x56a0
nop