// File: /workspace/github_cpp_makefile_star2_O2/simonrharris[P]SKA/src/sk_unique.cpp
// Function: uniqueKmers(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&, float const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
int uniqueKmers(const std::vector < std::string > & ingroupsamples, const std::vector < std::string > & kmerfiles, const float & minproportion, const std::string & outputfile, const bool incNs)
{

	const std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now();
	// Create the kmer map
	std::unordered_map < std::string , std::vector < bool > > kmerMap;
	int oldkmersize=0;
	int totalingroupkmers=0;

	std::vector < std::string > sampleNames;

	if (collectSampleNames(kmerfiles, sampleNames)!=0){return 1;}
	int numSamples=sampleNames.size();

	float maxmissing=(1.0-minproportion)*ingroupsamples.size();

	float minrequired=ingroupsamples.size()-maxmissing;

	std::set < std::string > ingroupSet(ingroupsamples.begin(), ingroupsamples.end());

	if (ingroupSet.size()!=ingroupsamples.size()){
		std::cout << "Warning: Duplicate samples in your ingroup sample file have been removed" << std::endl;
	}

	std::vector < int > ingroupSamplePositions;

	for (int i=0; i<sampleNames.size(); ++i){
		std::set < std::string >::iterator it = ingroupSet.find(sampleNames[i]);//check if the kmer is in the map
			if ( it != ingroupSet.end() ){//if the kmer is in the map
				ingroupSamplePositions.push_back(i);
			}
	}
	
	if (ingroupsamples.size()!=ingroupSamplePositions.size()){
		std::cout << ingroupsamples.size() << " " << ingroupSamplePositions.size() << std::endl;
		std::cout << "Error: Some of your ingroup samples are not in your input files" << std::endl << std::endl;
		return 1;
	}

	std::vector < std::string > fileSampleNames;	
	int sampleNum=0;
	int numfiles=kmerfiles.size();
	std::ifstream fileStream;
	int kmersize;
	char * kmerbuffer;


	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;
		}


		int numFileSamples=fileSampleNames.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

			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<mybits.size(); ++i){
						it->second[i+sampleNum]=mybits[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<mybits.size(); ++i){ //change the bools to true based for taxa in the file containing the kmer
						taxonBitset[i+sampleNum]=mybits[i];
					}
					kmerMap.insert(std::make_pair(kmer, taxonBitset));//add the new vector to the map
				}
	    	}
	    	fileStream.ignore(256,'\n');//skip the end ofline character
    	}
    	sampleNum+=numFileSamples; //add the number of samples in the file to the count of total samples
    	fileSampleNames.clear();
		fileStream.close();
	}

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

	int uniquecount=0;
	std::unordered_map < std::string , std::vector < bool > >::iterator it = kmerMap.begin();
	std::unordered_map < std::string , std::vector < bool > >::iterator endIter = kmerMap.end();
	std::unordered_map < std::vector < bool >,  std::vector < std::string > > revKmerMap;

	for (; it!=endIter; ){

		if (not incNs && it->first[0]=='N'){
			kmerMap.erase(it++);
			continue;
		}

		int allcount=std::count(it->second.begin(), it->second.end(), true);
		int ingroupcount=0;

		for (std::vector < int >::iterator it2=ingroupSamplePositions.begin(); it2!=ingroupSamplePositions.end(); ++it2){
			if (it->second[*it2]){
				ingroupcount++;
			}
		}
		if (ingroupcount>=minrequired && (allcount-ingroupcount)==0){
			uniquecount++;

			std::vector < bool > ingroupBitString (ingroupSamplePositions.size(), false);
			int i=0;
			for (std::vector < int >::iterator it2=ingroupSamplePositions.begin(); it2!=ingroupSamplePositions.end(); ++it2, ++i){
				ingroupBitString[i]=it->second[*it2];
			}

			std::unordered_map < std::vector < bool >,  std::vector < std::string > >::iterator it2 = revKmerMap.find(ingroupBitString);//check if the bitset is in the map
			if ( it2 != revKmerMap.end() ){//if the bitset is in the map
				it2->second.push_back(it->first); //add the kmer
			}
			else {//if the bitset isn't in the map
				//std::vector < std::string > myvector; //create a new vector of strings
				//myvector.push_back(it->first); //add the bitset to the vector
				revKmerMap.insert(std::make_pair(ingroupBitString, std::vector < std::string > {it->first})); //insert the vector into the map
			}
		}
		kmerMap.erase(it++); //remove kmer from kmerMap to save space
	}

	std::cout << uniquecount << " unique shared kmers will be written to " << outputfile << std::endl;

	std::vector < std::string > orderedingroupsamples;
	for ( std::vector < int >::iterator it=ingroupSamplePositions.begin(); it!=ingroupSamplePositions.end(); ++it){ //print each sample name to output file stream
		orderedingroupsamples.push_back(sampleNames[*it]); 
	}

	if(printMergedKmerFile(revKmerMap, outputfile, orderedingroupsamples, kmersize)){return 1;}

	printDuration(start);
	
	return 0;
	
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x478, %rsp            # imm = 0x478
movl %r8d, -0x34(%rbp)
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
callq 0x5050
movq %rax, %r12
leaq -0x218(%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 -0x130(%rbp), %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
pushq $0x1
popq %rax
movq %r13, -0xe8(%rbp)
movq %r13, %rdi
movl %eax, %r13d
movl %eax, %edx
callq 0x8436
testl %eax, %eax
jne 0x1c4bb
movq %r15, -0xe0(%rbp)
movq -0x128(%rbp), %r13
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rdx, %r15
subq %rsi, %r15
sarq $0x5, %r15
js 0x1ba8f
cvtsi2ss %r15, %xmm0
jmp 0x1baa7
movq %r15, %rax
shrq %rax
movl %r15d, %ecx
andl $0x1, %ecx
orq %rax, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
movss %xmm0, -0x38(%rbp)
cvtss2sd (%r14), %xmm0
movsd %xmm0, -0x30(%rbp)
subq -0x130(%rbp), %r13
leaq -0x298(%rbp), %rdi
callq 0x1c64a
movq %r13, -0x40(%rbp)
movq %r12, -0x1a0(%rbp)
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x5, %rax
cmpq %rax, -0x270(%rbp)
je 0x1bb03
movq 0x1a4c9(%rip), %rdi     # 0x35fb8
leaq 0xab48(%rip), %rsi      # 0x2663e
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
movq %r15, %xmm0
punpckldq 0x9890(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x9898(%rip), %xmm0     # 0x253b0
movsd 0x9748(%rip), %xmm1     # 0x25268
subsd -0x30(%rbp), %xmm1
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm0
movss -0x38(%rbp), %xmm1
subss %xmm0, %xmm1
movss %xmm1, -0x38(%rbp)
xorps %xmm0, %xmm0
leaq -0x70(%rbp), %r14
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
xorl %eax, %eax
leaq -0x290(%rbp), %r13
leaq -0x298(%rbp), %r15
leaq -0x4a0(%rbp), %r12
movl %eax, -0x4a0(%rbp)
cltq
movq -0x130(%rbp), %rsi
movq -0x128(%rbp), %rcx
subq %rsi, %rcx
sarq $0x5, %rcx
cmpq %rax, %rcx
jbe 0x1bbb9
shlq $0x5, %rax
addq %rax, %rsi
movq %r15, %rdi
callq 0x9c1c
cmpq %r13, %rax
je 0x1bbaf
movq %r14, %rdi
movq %r12, %rsi
callq 0xbe78
movl -0x4a0(%rbp), %eax
incl %eax
jmp 0x1bb6e
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x5, %rsi
movq -0x68(%rbp), %rax
subq -0x70(%rbp), %rax
sarq $0x2, %rax
cmpq %rax, %rsi
jne 0x1c030
xorps %xmm0, %xmm0
andq $0x0, -0x90(%rbp)
movaps %xmm0, -0xa0(%rbp)
movq -0xe8(%rbp), %rax
movq 0x8(%rax), %rbx
subq (%rax), %rbx
leaq -0x4a0(%rbp), %rdi
callq 0x5450
shrq $0x5, %rbx
movq %rbx, -0x198(%rbp)
movq -0x40(%rbp), %rax
shrq $0x5, %rax
cltq
movq %rax, -0x78(%rbp)
xorl %ecx, %ecx
pushq $0x1
popq %r13
leaq -0x210(%rbp), %r15
leaq -0x190(%rbp), %r12
movl $0x0, -0x44(%rbp)
movq -0xe8(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rax
subq %rdi, %rax
sarq $0x5, %rax
cmpq %rcx, %rax
jbe 0x1c093
movq %rcx, -0xf0(%rbp)
movq %rcx, %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq -0x4a0(%rbp), %rsi
movl %r13d, %edx
callq 0x73fe
testl %eax, %eax
jne 0x1c48e
leaq -0x4a0(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x832b
cmpq $0x0, -0xf0(%rbp)
sete %al
movl -0x7c(%rbp), %edx
cmpl %edx, %ebx
sete %cl
orb %al, %cl
je 0x1c43f
movq %rsp, -0x1b0(%rbp)
movq %rdx, -0x1b8(%rbp)
leal (%rdx,%rdx), %eax
cltd
pushq $0x3
popq %rcx
idivl %ecx
movl %eax, %ebx
leal 0x1(%rbx), %eax
movq %rax, -0x40(%rbp)
addq $0xf, %rax
andq $-0x10, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x30(%rbp)
movq %rcx, %rsp
movq -0x98(%rbp), %rax
subq -0xa0(%rbp), %rax
sarq $0x5, %rax
js 0x1bd01
cvtsi2ss %rax, %xmm0
jmp 0x1bd16
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
movq -0x98(%rbp), %rax
subq -0xa0(%rbp), %rax
shrq $0x5, %rax
movq %rax, -0x1a8(%rbp)
divss 0x9939(%rip), %xmm0     # 0x25670
callq 0x5220
cvttss2si %xmm0, %ecx
leaq 0xf(%rcx), %rax
andq $-0x10, %rax
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, %rsp
movq %rcx, -0x1c8(%rbp)
movq %rdx, -0xf8(%rbp)
leaq (%rdx,%rcx), %rax
movq %rax, -0x1c0(%rbp)
movslq %ebx, %rax
movq -0x30(%rbp), %rcx
addq %rcx, %rax
incq %rax
movq %rax, -0x50(%rbp)
movslq -0x44(%rbp), %r13
leaq -0x4a0(%rbp), %rdi
movq -0xf8(%rbp), %rsi
movq -0x1c8(%rbp), %rdx
callq 0x54c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1bfeb
leaq -0x108(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0x118(%rbp), %rbx
movq %rbx, %rdi
movq -0xf8(%rbp), %rsi
movq -0x1c0(%rbp), %rdx
callq 0x7828
andq $0x0, -0xd8(%rbp)
andl $0x0, -0xd0(%rbp)
andq $0x0, -0xc8(%rbp)
andl $0x0, -0xc0(%rbp)
andq $0x0, -0xb8(%rbp)
movq %rbx, %rdi
leaq -0xd8(%rbp), %rsi
callq 0x7bb6
leaq -0x4a0(%rbp), %rdi
callq 0x5140
cmpl $0xa, %eax
je 0x1bfba
leaq -0x4a0(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x54c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1bfba
leaq -0x1d8(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq -0x1e8(%rbp), %rbx
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x7828
leaq -0x248(%rbp), %rdi
movq %rbx, %rsi
callq 0x15a68
movq %rax, %rbx
testq %rax, %rax
je 0x1bef1
addq $0x28, %rbx
xorl %r14d, %r14d
movq -0xc8(%rbp), %rax
movl -0xc0(%rbp), %ecx
subq -0xd8(%rbp), %rax
leaq (%rcx,%rax,8), %rax
cmpq %r14, %rax
jbe 0x1bfa9
leaq -0xd8(%rbp), %rdi
movq %r14, %rsi
callq 0x903c
movq %rax, -0x190(%rbp)
movq %rdx, -0x188(%rbp)
leaq (%r14,%r13), %rsi
movq %rbx, %rdi
callq 0x903c
movq %rax, -0x210(%rbp)
movq %rdx, -0x208(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x9896
incq %r14
jmp 0x1be89
movb $0x0, -0x190(%rbp)
movq %r15, %rdi
movq -0x78(%rbp), %rsi
movq %r12, %rdx
leaq -0x140(%rbp), %rcx
callq 0x9140
xorl %ebx, %ebx
movq -0xc8(%rbp), %rax
movl -0xc0(%rbp), %ecx
subq -0xd8(%rbp), %rax
leaq (%rcx,%rax,8), %rax
cmpq %rbx, %rax
jbe 0x1bf78
leaq -0xd8(%rbp), %rdi
movq %rbx, %rsi
callq 0x903c
movq %rax, -0x190(%rbp)
movq %rdx, -0x188(%rbp)
leaq (%rbx,%r13), %rsi
movq %r15, %rdi
callq 0x903c
movq %rax, -0x140(%rbp)
movq %rdx, -0x138(%rbp)
leaq -0x140(%rbp), %rdi
movq %r12, %rsi
callq 0x9896
incq %rbx
jmp 0x1bf10
movq %r12, %rdi
leaq -0x1e8(%rbp), %rsi
movq %r15, %rdx
callq 0x1598e
leaq -0x248(%rbp), %rdi
movq %r12, %rsi
callq 0x15b38
movq %r12, %rdi
callq 0x15978
movq %r15, %rdi
callq 0x908a
leaq -0x1e8(%rbp), %rdi
callq 0x5778
jmp 0x1be0b
movl $0x100, %esi            # imm = 0x100
leaq -0x4a0(%rbp), %rdi
pushq $0xa
popq %rdx
callq 0x5260
leaq -0xd8(%rbp), %rdi
callq 0x908a
leaq -0x118(%rbp), %rdi
callq 0x5778
jmp 0x1bd7f
leaq -0xa0(%rbp), %rdi
callq 0xbe96
leaq -0x4a0(%rbp), %rdi
callq 0x50a0
movq -0x1a8(%rbp), %rax
addl %eax, -0x44(%rbp)
movq -0x1b0(%rbp), %rsp
movq -0xf0(%rbp), %rcx
incq %rcx
movq -0x1b8(%rbp), %rax
movl %eax, %ebx
pushq $0x1
popq %r13
jmp 0x1bc39
movq 0x19f81(%rip), %rdi     # 0x35fb8
callq 0x5280
leaq 0xa31a(%rip), %rsi      # 0x2635d
movq %rax, %rdi
callq 0x53f0
movq -0x68(%rbp), %rsi
subq -0x70(%rbp), %rsi
sarq $0x2, %rsi
movq %rax, %rdi
callq 0x5280
movq %rax, %rdi
callq 0x51c0
movq 0x19f4a(%rip), %rdi     # 0x35fb8
leaq 0xa612(%rip), %rsi      # 0x26687
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
movq %rax, %rdi
callq 0x51c0
pushq $0x1
popq %r13
jmp 0x1c4a6
movl %ebx, -0x78(%rbp)
movq -0x230(%rbp), %rsi
movq 0x19f14(%rip), %rdi     # 0x35fb8
callq 0x5280
leaq 0x96c5(%rip), %rsi      # 0x25775
movq %rax, %rdi
callq 0x53f0
movq %rax, %rdi
movl -0x44(%rbp), %esi
callq 0x56a0
leaq 0x93d6(%rip), %rsi      # 0x254a0
movq %rax, %rdi
callq 0x53f0
movq %rax, %rdi
movq -0x198(%rbp), %rsi
callq 0x56a0
leaq 0xa9dd(%rip), %rsi      # 0x26ac5
movq %rax, %rdi
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
leaq -0x248(%rbp), %r12
movq 0x10(%r12), %r13
leaq -0xa8(%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)
movq $0x0, -0x40(%rbp)
leaq -0x190(%rbp), %r8
movl -0x34(%rbp), %r14d
movq %r13, %rsi
testq %rsi, %rsi
je 0x1c389
testb %r14b, %r14b
jne 0x1c170
movq 0x8(%rsi), %rax
cmpb $0x4e, (%rax)
jne 0x1c16d
movq (%rsi), %rbx
movq %r12, %rdi
callq 0xad92
movq %rbx, %rsi
leaq -0x190(%rbp), %r8
jmp 0x1c13f
movq %rsi, %r13
movq 0x28(%r13), %rdi
movq 0x38(%r13), %rdx
movl 0x40(%r13), %ecx
movb $0x1, -0x190(%rbp)
xorl %esi, %esi
callq 0xc10d
movq %r13, %rcx
movq %rax, %r13
leaq 0x8(%rcx), %rax
movq %rax, -0x50(%rbp)
movq %rcx, -0x30(%rbp)
leaq 0x28(%rcx), %rbx
movq -0x70(%rbp), %r14
movq %r14, %r15
negq %r15
xorl %r12d, %r12d
cmpq -0x68(%rbp), %r14
je 0x1c1d3
movslq (%r14), %rsi
movq %rbx, %rdi
callq 0x903c
andq (%rax), %rdx
cmpq $0x1, %rdx
sbbl $-0x1, %r12d
addq $0x4, %r14
addq $-0x4, %r15
jmp 0x1c1ad
cmpl %r13d, %r12d
jne 0x1c2db
cvtsi2ss %r12d, %xmm0
ucomiss -0x38(%rbp), %xmm0
movq -0x30(%rbp), %r13
jb 0x1c2cb
addq -0x70(%rbp), %r15
negq %r15
sarq $0x2, %r15
movb $0x0, -0x190(%rbp)
leaq -0x210(%rbp), %rdi
movq %r15, %rsi
leaq -0x190(%rbp), %rdx
leaq -0x118(%rbp), %rcx
callq 0x9140
movq -0x40(%rbp), %rax
incl %eax
movq %rax, -0x40(%rbp)
movq -0x70(%rbp), %r13
xorl %r12d, %r12d
xorl %r14d, %r14d
leaq -0x210(%rbp), %r15
leaq (%r12,%r13), %rax
cmpq -0x68(%rbp), %rax
je 0x1c293
movslq (%r13,%r14,4), %rsi
movq %rbx, %rdi
callq 0x903c
movq %rax, -0x190(%rbp)
movq %rdx, -0x188(%rbp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x903c
movq %rax, -0x118(%rbp)
movq %rdx, -0x110(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x9896
incq %r14
addq $0x4, %r12
jmp 0x1c239
leaq -0xd8(%rbp), %rdi
movq %r15, %rsi
callq 0xa6e2
movl -0x34(%rbp), %r14d
leaq -0x248(%rbp), %r12
movq -0x30(%rbp), %r13
testq %rax, %rax
je 0x1c2ec
addq $0x30, %rax
movq %rax, %rdi
movq -0x50(%rbp), %rsi
callq 0x77fc
jmp 0x1c35f
movl -0x34(%rbp), %r14d
leaq -0x248(%rbp), %r12
jmp 0x1c36b
movl -0x34(%rbp), %r14d
leaq -0x248(%rbp), %r12
movq -0x30(%rbp), %r13
jmp 0x1c36b
leaq -0x118(%rbp), %rbx
movq %rbx, %rdi
movq -0x50(%rbp), %rsi
callq 0x5540
leaq -0x1e8(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
pushq $0x1
popq %rdx
leaq -0x140(%rbp), %rcx
callq 0x90ce
leaq -0x190(%rbp), %rbx
movq %rbx, %rdi
leaq -0x210(%rbp), %rsi
movq %r15, %rdx
callq 0x92b4
leaq -0xd8(%rbp), %rdi
movq %rbx, %rsi
callq 0xa9b8
movq %rbx, %rdi
callq 0x9108
movq %r15, %rdi
callq 0x911e
leaq -0x118(%rbp), %rdi
callq 0x5778
leaq -0x210(%rbp), %rdi
callq 0x908a
movq (%r13), %rbx
movq %r12, %rdi
movq %r13, %rsi
callq 0xad92
movq %rbx, %r13
leaq -0x190(%rbp), %r8
jmp 0x1c13c
movq 0x19c28(%rip), %rdi     # 0x35fb8
movq -0x40(%rbp), %rsi
callq 0x56a0
leaq 0xa327(%rip), %rsi      # 0x266c7
movq %rax, %rdi
callq 0x53f0
movq %rax, %rdi
movq -0xe0(%rbp), %rsi
callq 0x53a0
movq %rax, %rdi
callq 0x51c0
xorps %xmm0, %xmm0
leaq -0x190(%rbp), %rbx
movaps %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
movq -0x70(%rbp), %r14
cmpq -0x68(%rbp), %r14
je 0x1c3f7
movslq (%r14), %rsi
shlq $0x5, %rsi
addq -0x130(%rbp), %rsi
movq %rbx, %rdi
callq 0x77fc
addq $0x4, %r14
jmp 0x1c3d5
leaq -0x268(%rbp), %rdi
movq -0xe0(%rbp), %rsi
callq 0x5540
leaq -0xd8(%rbp), %rdi
leaq -0x268(%rbp), %rsi
leaq -0x190(%rbp), %rdx
movl -0x78(%rbp), %ecx
callq 0x80d4
movl %eax, %ebx
leaq -0x268(%rbp), %rdi
callq 0x5778
testl %ebx, %ebx
je 0x1c467
pushq $0x1
popq %r13
jmp 0x1c476
movq 0x19b72(%rip), %rdi     # 0x35fb8
leaq 0x902e(%rip), %rsi      # 0x2547b
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
movq %rax, %rdi
callq 0x51c0
xorl %r13d, %r13d
jmp 0x1c48e
xorl %r13d, %r13d
movq -0x1a0(%rbp), %rdi
callq 0x7657
leaq -0x190(%rbp), %rdi
callq 0x911e
leaq -0xd8(%rbp), %rdi
callq 0xbf2a
leaq -0x4a0(%rbp), %rdi
callq 0x50e0
leaq -0xa0(%rbp), %rdi
callq 0x911e
leaq -0x70(%rbp), %rdi
callq 0xc052
leaq -0x298(%rbp), %rdi
callq 0x922a
leaq -0x130(%rbp), %rdi
callq 0x911e
leaq -0x248(%rbp), %rdi
callq 0x159c4
movl %r13d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
callq 0x9108
jmp 0x1c4f9
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
callq 0x911e
jmp 0x1c50a
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x5778
jmp 0x1c560
jmp 0x1c55d
jmp 0x1c583
movq %rax, %rbx
leaq -0x268(%rbp), %rdi
callq 0x5778
jmp 0x1c573
jmp 0x1c570
jmp 0x1c55d
jmp 0x1c583
jmp 0x1c583
jmp 0x1c59b
movq %rax, %rbx
jmp 0x1c608
jmp 0x1c583
jmp 0x1c59b
movq %rax, %rbx
jmp 0x1c61d
jmp 0x1c54d
movq %rax, %rbx
jmp 0x1c629
jmp 0x1c594
jmp 0x1c59b
jmp 0x1c583
jmp 0x1c55d
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
callq 0x908a
jmp 0x1c586
jmp 0x1c59b
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
callq 0x911e
jmp 0x1c586
jmp 0x1c59b
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0xbf2a
jmp 0x1c5fc
movq %rax, %rbx
jmp 0x1c614
jmp 0x1c59b
movq %rax, %rbx
jmp 0x1c5fc
jmp 0x1c5bb
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
callq 0x15978
jmp 0x1c5c5
jmp 0x1c5c2
jmp 0x1c5d5
jmp 0x1c5d5
jmp 0x1c5bb
movq %rax, %rbx
jmp 0x1c5e4
jmp 0x1c5c2
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
callq 0x908a
jmp 0x1c5d8
jmp 0x1c5d5
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
callq 0x5778
leaq -0xd8(%rbp), %rdi
callq 0x908a
leaq -0x118(%rbp), %rdi
callq 0x5778
leaq -0x4a0(%rbp), %rdi
callq 0x50e0
leaq -0xa0(%rbp), %rdi
callq 0x911e
leaq -0x70(%rbp), %rdi
callq 0xc052
leaq -0x298(%rbp), %rdi
callq 0x922a
leaq -0x130(%rbp), %rdi
callq 0x911e
leaq -0x248(%rbp), %rdi
callq 0x159c4
movq %rbx, %rdi
callq 0x56c0
nop