// File: /workspace/github_cpp_makefile_star2_O1/simonrharris[P]SKA/src/sk_refalign.cpp
// Function: alignKmersToReference(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, 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 const&, bool const&, bool const&, bool const&, bool 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&, bool)
int alignKmersToReference(const std::string & reference, const std::string & outputfile, const std::vector < std::string > & kmerfiles, const int & kmerlen, const bool & includeref, const bool & maprepeats, const bool & fillall, const bool & variantonly, const std::vector <std::string> & sample, const bool circularContigs)
{

	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 <int> > kmerMap;
	std::set < int > revSet;
	int substringlength=(kmerlen*2)+1;
	std::string filename=splitFileName(reference);
	std::cout << "Reading " << filename << std::endl;

	int basenum=0;
	std::string refseq;
	char base;
	std::vector < int > referenceContigLengths;
	
	igzstream gzfileStream;

	if(openGzFileStream(reference, gzfileStream)){return 1;}//open the fasta file. May be gzipped.

	while (gzfileStream.peek() != EOF){
		std::string sequence;
		std::string name;

		if(readNextFastaSequence(gzfileStream, reference, name, sequence)){return 1;}//read the next sequence from the file
		int seqlen=sequence.length();
		referenceContigLengths.push_back(seqlen);
		refseq.append(sequence);
		if (seqlen<substringlength){
			basenum+=seqlen;
			continue;
		}

		int baseposition=basenum;

		if (circularContigs){
			if(circulariseSequence(sequence, kmerlen)){return 1;}//if the contigs are circular, add an extra kmer length of sequence from the opposite end to each end
		}
		else {
			baseposition+=kmerlen;
		}
		
		int i=0;
		
		
		for (std::string::iterator iti = sequence.begin(), end = sequence.end()-(substringlength-1); iti != end; ++iti, ++i, ++baseposition){
			std::string kmer=sequence.substr(i,substringlength);
			
			if (reverseComplementIfMin(kmer)){
				revSet.insert(baseposition);
			}
			extractMiddleBase(kmer, base);
			if(ascii_codons(kmer)){return 1;}
			
			addKmerToBasePositionMap(kmerMap, kmer, baseposition);

		}
		basenum+=seqlen;
			
    }
    gzfileStream.close();


	
	std::cout << kmerMap.size() << " kmers read" << std::endl;
	
	std::vector < std::string > sampleNames;
	if (collectSampleNames(kmerfiles, sampleNames)!=0){return 1;}//get sample names from all kmerfiles

	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;

	if (includeref){
		includedSampleNames.push_back(filename);
	}

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

	std::cout << includedSampleNames.size()-int(includeref) << " samples will be aligned to " << reference << std::endl;

	std::vector < std::string > sequences(includedSampleNames.size(), std::string (basenum , '-'));//create a vector to store the new sequences;

	std::ifstream fileStream;

	char kmerbuffer[kmerlen*2/3];
	int sampleNum=0;
	int includedSampleNum=0;
	if (includeref){
		sequences[0]=refseq;
		includedSampleNum=1;
	}
	
	std::vector < std::string > names;
	
	for (int s = 0; s < kmerfiles.size(); ++s){

		std::string filename=splitFileName(kmerfiles[s]);
		if (openFileStream(kmerfiles[s], fileStream)){return 1;};

		int kmersize;
		
		readKmerHeader(fileStream, kmersize, names);//read the header from the kmer file to get the kmer size and sample names
		
		if (kmersize!=kmerlen){
			std::cerr << std::endl << "kmer size in " << filename << " is not " << kmerlen << std::endl << std::endl;
			return 1;
		}

		std::vector < int > fileInclude;

		for (int i=0; i<names.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();
			std::cerr << "Nothing to align" << std::endl;
			sampleNum+=int(names.size());
			names.clear();
			continue;
		}

		char asciibuffer[int(ceil(float(names.size())/6))];

		while (fileStream.read(asciibuffer, sizeof(asciibuffer))){
			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.get(base)){
				//base=toupper(base);
				fileStream.read(kmerbuffer, sizeof(kmerbuffer));
				std::string kmer (kmerbuffer, kmerlen*2/3);
				std::unordered_map < std::string, std::vector <int> >::iterator it = kmerMap.find(kmer);//check if the kmer is in the hash
				if ( it != kmerMap.end() ){//if the kmer is in the hash
					if (it->second.size()==1 || maprepeats){//if the match is unique or the user has chosen to map repeats
						
						for (std::vector < int >::iterator itb = it->second.begin(); itb != it->second.end(); ++itb) {//iterate each match of the kmer in the reference
							char mybase=base;
							std::set < int >::iterator itc = revSet.find(*itb);//for each match see if the kmer in the reference is on the reverse strand
							if ( itc != revSet.end() ){//if so, complement the base
								mybase=complement(base);
							}

							for (int j=0; j<fileInclude.size(); ++j){ //add the base to all samples that are true in the bitset
								if (mybits[fileInclude[j]]){
									sequences[includedSampleNum+j][*itb]=mybase;//set the base of the sequence at the site matching the reference
								}
							}
						}
					}
				}
			}
			fileStream.ignore(256,'\n');//skip the end ofline character
    	}

    	for (int i=0; i<fileInclude.size(); ++i){//print the percentage of mapped bases for each sample in a file

    		int contigStart=0;
    		int filledto=0;

    		for (std::vector <int >::iterator rclit=referenceContigLengths.begin(); rclit!=referenceContigLengths.end(); ++rclit){//Fill bases around mapped bases or SNPs
    			filledto=contigStart;
    			for (int j=kmerlen; j<(*rclit-kmerlen); ++j){
    				if ((base_score[sequences[includedSampleNum+i][contigStart+j]]<4 && std::isupper(sequences[includedSampleNum+i][contigStart+j])) && ( fillall || sequences[includedSampleNum+i][contigStart+j] != refseq[contigStart+j])){
    					int fillfrom=std::max(std::max(contigStart+j-kmerlen, contigStart), filledto);
		    			filledto=std::min(contigStart+j+kmerlen+1, contigStart+*rclit);
		    			for (int k=fillfrom; k<filledto; ++k){
		    				if (sequences[includedSampleNum+i][k]=='-'){//if the base is a gap in the sample set it to the reference base in lower case
								sequences[includedSampleNum+i][k]=std::tolower(refseq[k]);//this needs fixing when the contigs are circular to stop it running into the next contig
							}
		    			}
    				}
    			}
    			contigStart+=*rclit;
    		}

	    	int mappedbases=basenum;
	    	int mappedNs=0;
	    	int snps=0;
	    	for (int j=0; j<basenum; ++j){
	    		if (sequences[includedSampleNum+i][j]=='-'){
	    			mappedbases--;
	    		}
	    		if (base_score[sequences[includedSampleNum+i][j]]<4 && base_score[refseq[j]]<4 && sequences[includedSampleNum+i][j]!=refseq[j] && ::isupper(sequences[includedSampleNum+i][j]) ) { 
	    			snps++;
	    		}
	    	}
			std::cout << includedSampleNames[i] << ": " << float(mappedbases)/(basenum)*100 << "% of reference bases mapped. " << snps << " SNPs found vs reference sequence. ";
			if(calculateMissedSNPs(basenum, snps, kmersize)){return 1;};
    	}
    	sampleNum+=int(names.size()); //add the number of samples in the file to the count of total samples
    	includedSampleNum+=int(fileInclude.size());
    	names.clear();
		fileStream.close();
	}


	std::ofstream alignfile(outputfile);
	if (alignfile.fail()){
		std::cerr << std::endl << "Error: Failed to open " << outputfile << std::endl << std::endl;
		return 1;
	}
	
	if (variantonly){
		printVariantSites(alignfile, basenum, includedSampleNames, sequences);
	}
	else{
		std::cout << "Printing alignment" << std::endl;
		for (int i=0; i<includedSampleNames.size(); ++i){
			alignfile << ">" << includedSampleNames[i] << std::endl << sequences[i] << std::endl;
		}
	}

	alignfile.close();
	
	printDuration(start);

	return 0;
	
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x958, %rsp            # imm = 0x958
movq %r9, %r14
movq %r8, %r15
movq %rcx, %rbx
movq %rdx, -0x110(%rbp)
movq %rsi, -0x198(%rbp)
movq %rdi, %r12
callq 0x5060
movq %rax, -0x230(%rbp)
leaq -0x2a0(%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), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq %rbx, -0x48(%rbp)
movl (%rbx), %r13d
leaq -0x268(%rbp), %rdi
movq %r12, -0x40(%rbp)
movq %r12, %rsi
callq 0x7e20
movq 0x24e2a(%rip), %rdi     # 0x40fc0
leaq 0x170de(%rip), %rsi     # 0x3327b
movl $0x8, %edx
callq 0x5420
movq -0x268(%rbp), %rsi
movq -0x260(%rbp), %rdx
movq 0x24e04(%rip), %rdi     # 0x40fc0
callq 0x5420
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
movq %rax, %rdi
callq 0x5250
leaq -0x1c0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq %rax, -0x120(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x130(%rbp)
leaq -0x978(%rbp), %rdi
callq 0x7742
leaq -0x978(%rbp), %rsi
movl $0x1, %ebx
movq -0x40(%rbp), %rdi
movl $0x1, %edx
callq 0x80aa
testl %eax, %eax
jne 0x1d59d
movq %r15, -0xb0(%rbp)
movq %r14, -0x108(%rbp)
movl %r13d, %eax
addl %r13d, %r13d
leal 0x1(,%rax,2), %eax
leaq -0x6c8(%rbp), %r12
movl %r13d, -0x138(%rbp)
movslq %r13d, %r13
negq %r13
cltq
movq %rax, -0x38(%rbp)
xorl %r15d, %r15d
leaq -0x98(%rbp), %rbx
movl $0x0, -0x30(%rbp)
movq %r13, -0x118(%rbp)
leaq -0x7f0(%rbp), %rdi
callq 0x5140
cmpl $-0x1, %eax
je 0x1c511
movq %r12, -0x6d8(%rbp)
movq %r15, -0x6d0(%rbp)
movb %r15b, -0x6c8(%rbp)
leaq -0x4c0(%rbp), %rax
movq %rax, -0x4d0(%rbp)
movq %r15, -0x4c8(%rbp)
movb %r15b, -0x4c0(%rbp)
leaq -0x978(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq -0x4d0(%rbp), %rdx
leaq -0x6d8(%rbp), %rcx
callq 0x6ca1
movl $0x1, %r14d
testl %eax, %eax
jne 0x1c4c0
movl -0x6d0(%rbp), %eax
movl %eax, -0x190(%rbp)
movq -0x128(%rbp), %rsi
cmpq -0x120(%rbp), %rsi
je 0x1c328
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x128(%rbp)
jmp 0x1c33b
leaq -0x130(%rbp), %rdi
leaq -0x190(%rbp), %rdx
callq 0xe01e
movq -0x6d8(%rbp), %rsi
movq -0x6d0(%rbp), %rdx
leaq -0x1d0(%rbp), %rdi
callq 0x5110
movl -0x190(%rbp), %eax
cmpl -0x138(%rbp), %eax
jle 0x1c38e
movl -0x30(%rbp), %ecx
movl %ecx, -0x158(%rbp)
movq -0x48(%rbp), %rax
movl (%rax), %esi
cmpb $0x0, 0x28(%rbp)
je 0x1c39c
leaq -0x6d8(%rbp), %rdi
callq 0x7633
testl %eax, %eax
jne 0x1c4c0
jmp 0x1c3a4
addl %eax, -0x30(%rbp)
movl $0x2, %r14d
jmp 0x1c4c0
addl %ecx, %esi
movl %esi, -0x158(%rbp)
movq -0x6d8(%rbp), %rax
movq %r13, %rdx
movq -0x6d0(%rbp), %r13
leaq (%rax,%r13), %rcx
addq %rdx, %rcx
cmpq %rcx, %rax
sete %r12b
je 0x1c46e
addq %rdx, %r13
xorl %r14d, %r14d
movq %rbx, %rdi
leaq -0x6d8(%rbp), %rsi
movq %r14, %rdx
movq -0x38(%rbp), %rcx
callq 0x53e0
movq %rbx, %rdi
callq 0x6905
testb %al, %al
je 0x1c404
leaq -0x298(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x1db3a
movq %rbx, %rdi
leaq -0x2a(%rbp), %rsi
callq 0x8ae7
movq %rbx, %rdi
callq 0x6ab2
testl %eax, %eax
jne 0x1c476
movl -0x158(%rbp), %edx
leaq -0x2d0(%rbp), %rdi
movq %rbx, %rsi
callq 0x1bb20
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x1c453
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x53c0
incl -0x158(%rbp)
incq %r14
cmpq %r14, %r13
sete %r12b
jne 0x1c3cf
xorl %r14d, %r14d
jmp 0x1c49e
xorl %r14d, %r14d
movq %rdx, %r13
jmp 0x1c4a5
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x1c498
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x53c0
movl $0x1, %r14d
movq -0x118(%rbp), %r13
testb $0x1, %r12b
movl $0x0, %eax
je 0x1c4b6
movl -0x190(%rbp), %eax
addl %eax, -0x30(%rbp)
leaq -0x6c8(%rbp), %r12
movq -0x4d0(%rbp), %rdi
leaq -0x4c0(%rbp), %rax
cmpq %rax, %rdi
je 0x1c4e2
movq -0x4c0(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x6d8(%rbp), %rdi
cmpq %r12, %rdi
je 0x1c4fd
movq -0x6c8(%rbp), %rsi
incq %rsi
callq 0x53c0
testb $0x1, %r14b
je 0x1c28b
movl $0x1, %ebx
jmp 0x1d59d
leaq -0x978(%rbp), %rdi
callq 0x782c
movq -0xb0(%rbp), %r14
movq -0x2b8(%rbp), %rsi
movq 0x24a8e(%rip), %rdi     # 0x40fc0
callq 0x5240
movq %rax, %rbx
leaq 0x17ebb(%rip), %rsi     # 0x343fc
movl $0xb, %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
xorps %xmm0, %xmm0
leaq -0x210(%rbp), %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movl $0x1, %ebx
movq -0x110(%rbp), %rdi
movl $0x1, %edx
callq 0x98af
testl %eax, %eax
jne 0x1d591
movq -0x208(%rbp), %rsi
subq -0x210(%rbp), %rsi
sarq $0x5, %rsi
leaq -0x6d8(%rbp), %rdx
movb $0x0, (%rdx)
leaq -0x98(%rbp), %rdi
leaq -0x4d0(%rbp), %rcx
callq 0xac4a
leaq -0x210(%rbp), %rsi
leaq -0x98(%rbp), %rdx
movq 0x20(%rbp), %rdi
callq 0x9ba8
xorps %xmm0, %xmm0
movaps %xmm0, -0xe0(%rbp)
movq $0x0, -0xd0(%rbp)
cmpb $0x1, (%r14)
jne 0x1c61c
leaq -0xe0(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x855c
movq -0x98(%rbp), %r14
cmpq -0x88(%rbp), %r14
jne 0x1c632
cmpl $0x0, -0x80(%rbp)
je 0x1c695
xorl %r15d, %r15d
leaq -0xe0(%rbp), %rbx
xorl %eax, %eax
movl %eax, %r12d
movq (%r14), %rcx
btq %rax, %rcx
jae 0x1c671
movq %r14, %rax
subq -0x98(%rbp), %rax
shlq $0x8, %rax
addq -0x210(%rbp), %rax
movq %r12, %rsi
shlq $0x5, %rsi
addq %rax, %rsi
movq %rbx, %rdi
callq 0x855c
leal 0x1(%r12), %eax
xorl %ecx, %ecx
cmpq $0x3f, %r12
sete %cl
leaq (%r14,%rcx,8), %r14
cmovel %r15d, %eax
cmpq -0x88(%rbp), %r14
jne 0x1c63e
cmpl -0x80(%rbp), %eax
jne 0x1c63e
movq -0xd8(%rbp), %rsi
subq -0xe0(%rbp), %rsi
sarq $0x5, %rsi
movq -0xb0(%rbp), %rax
movzbl (%rax), %eax
subq %rax, %rsi
movq 0x24905(%rip), %rdi     # 0x40fc0
callq 0x5240
movq %rax, %rbx
leaq 0x17d3e(%rip), %rsi     # 0x34408
movl $0x1c, %edx
movq %rax, %rdi
callq 0x5420
movq -0x40(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x5420
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
movq %rax, %rdi
callq 0x5250
movq -0xe0(%rbp), %r14
movq -0xd8(%rbp), %rbx
movslq -0x30(%rbp), %rsi
leaq -0x6d8(%rbp), %rdi
leaq -0x6c8(%rbp), %r12
movq %r12, (%rdi)
movl $0x2d, %edx
callq 0x5440
movq -0x108(%rbp), %r15
subq %r14, %rbx
sarq $0x5, %rbx
leaq -0x170(%rbp), %rdi
leaq -0x6d8(%rbp), %rdx
leaq -0x4d0(%rbp), %rcx
movq %rbx, %rsi
callq 0x1d9cc
movq -0x6d8(%rbp), %rdi
cmpq %r12, %rdi
je 0x1c787
movq -0x6c8(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x6d8(%rbp), %rdi
callq 0x5410
movq %rsp, -0x218(%rbp)
movq -0x48(%rbp), %rax
movl (%rax), %eax
addl %eax, %eax
cltq
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rax
shrq $0x3f, %rax
shrq $0x20, %rcx
addl %eax, %ecx
movq %rcx, -0x248(%rbp)
leaq 0xf(%rcx), %rax
andq $-0x10, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x1a8(%rbp)
movq %rcx, %rsp
movl $0x0, -0x4c(%rbp)
movq -0xb0(%rbp), %rax
cmpb $0x1, (%rax)
jne 0x1c804
movl $0x1, -0x4c(%rbp)
movq -0x170(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x51c0
xorps %xmm0, %xmm0
movaps %xmm0, -0x100(%rbp)
movq $0x0, -0xf0(%rbp)
movq -0x110(%rbp), %rax
movq (%rax), %rsi
cmpq %rsi, 0x8(%rax)
je 0x1d325
movl -0x30(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, -0xb4(%rbp)
movl %eax, %eax
movq %rax, -0x240(%rbp)
xorl %ebx, %ebx
movq $0x0, -0xa0(%rbp)
movq %rbx, -0x238(%rbp)
shlq $0x5, %rbx
addq %rbx, %rsi
leaq -0x190(%rbp), %rdi
callq 0x7e20
movq -0x110(%rbp), %rax
addq (%rax), %rbx
movq %rbx, %rdi
leaq -0x6d8(%rbp), %rsi
movl $0x1, %edx
callq 0x7f73
movl $0x1, %r14d
testl %eax, %eax
jne 0x1d2bb
leaq -0x6d8(%rbp), %rdi
leaq -0xbc(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0x96e2
movl -0xbc(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x1c99a
movq -0xf8(%rbp), %rcx
movq -0x100(%rbp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movl $0x0, -0x4d0(%rbp)
subq %rax, %rcx
je 0x1ca77
xorl %eax, %eax
movq -0xa0(%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 0x1c96a
movq -0x68(%rbp), %rsi
cmpq -0x60(%rbp), %rsi
je 0x1c95a
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x68(%rbp)
jmp 0x1c96a
leaq -0x70(%rbp), %rdi
leaq -0x4d0(%rbp), %rdx
callq 0xe01e
movslq -0x4d0(%rbp), %rax
incq %rax
movl %eax, -0x4d0(%rbp)
movq -0xf8(%rbp), %rcx
subq -0x100(%rbp), %rcx
sarq $0x5, %rcx
cmpq %rax, %rcx
ja 0x1c8f9
jmp 0x1ca7b
movq 0x2464f(%rip), %rcx     # 0x40ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x24631(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0x17a47(%rip), %rsi     # 0x34425
callq 0x5420
movq -0x190(%rbp), %rsi
movq -0x188(%rbp), %rdx
movq %rbx, %rdi
callq 0x5420
movq %rax, %rbx
movl $0x8, %edx
movq %rax, %rdi
leaq 0x17a28(%rip), %rsi     # 0x34433
callq 0x5420
movq -0x48(%rbp), %rax
movl (%rax), %esi
movq %rbx, %rdi
callq 0x5690
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
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
movq %rax, %rdi
callq 0x5250
jmp 0x1d2bb
sarq $0x5, %rcx
movq -0x68(%rbp), %rax
cmpq -0x70(%rbp), %rax
je 0x1ca9b
testq %rcx, %rcx
js 0x1cb5f
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
jmp 0x1cb77
leaq -0x6d8(%rbp), %rdi
callq 0x50b0
movl $0x10, %edx
movq 0x2453d(%rip), %rdi     # 0x40ff0
leaq 0x17982(%rip), %rsi     # 0x3443c
callq 0x5420
movq 0x2452a(%rip), %rcx     # 0x40ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x2450c(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq -0x100(%rbp), %rbx
movq -0xf8(%rbp), %r14
movq %r14, %rax
subq %rbx, %rax
shrq $0x5, %rax
movq -0xa0(%rbp), %rcx
addl %eax, %ecx
movq %rcx, -0xa0(%rbp)
cmpq %rbx, %r14
je 0x1cb54
leaq 0x10(%rbx), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x1cb36
movq (%r15), %rsi
incq %rsi
callq 0x53c0
leaq 0x20(%r15), %rax
addq $0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0x1cb22
movq %rbx, -0xf8(%rbp)
movq -0x108(%rbp), %r15
movl $0xc, %r14d
jmp 0x1d2a6
movq %rcx, %rax
shrq %rax
andl $0x1, %ecx
orq %rax, %rcx
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
divss 0x16b01(%rip), %xmm0    # 0x33680
callq 0x51e0
movq %rsp, -0x220(%rbp)
cvttss2si %xmm0, %ecx
leaq 0xf(%rcx), %rax
andq $-0x10, %rax
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, %rsp
movq %rcx, -0x38(%rbp)
movq %rdx, %r13
leaq (%rdx,%rcx), %rax
movq %rax, -0x40(%rbp)
movslq -0x4c(%rbp), %rbx
movq %rbx, -0x1a0(%rbp)
shlq $0x5, %rbx
leaq -0x6d8(%rbp), %rdi
movq %r13, %rsi
movq -0x38(%rbp), %rdx
callq 0x5480
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1ceaa
leaq -0x148(%rbp), %rax
movq %rax, -0x158(%rbp)
leaq -0x158(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
movq -0x40(%rbp), %rdx
callq 0x862a
xorl %eax, %eax
movq %rax, -0x4d0(%rbp)
movl %eax, -0x4c8(%rbp)
movq %rax, -0x4c0(%rbp)
movl %eax, -0x4b8(%rbp)
movq %rax, -0x4b0(%rbp)
movq %r14, %rdi
leaq -0x4d0(%rbp), %rsi
callq 0x89ef
leaq -0x1f0(%rbp), %r14
leaq -0x6d8(%rbp), %rdi
callq 0x5140
cmpl $0xa, %eax
je 0x1ce2b
leaq -0x6d8(%rbp), %rdi
leaq -0x2a(%rbp), %rsi
callq 0x5500
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1ce2b
leaq -0x6d8(%rbp), %rdi
movq -0x1a8(%rbp), %rsi
movq -0x248(%rbp), %rdx
callq 0x5480
movq -0x48(%rbp), %rax
movl (%rax), %eax
addl %eax, %eax
cltq
imulq $0x55555556, %rax, %rax # imm = 0x55555556
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
addl %ecx, %eax
movslq %eax, %rdx
leaq -0x1e0(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x1a8(%rbp), %rsi
addq %rsi, %rdx
movq %r14, %rdi
callq 0x862a
leaq -0x2d0(%rbp), %rdi
movq %r14, %rsi
callq 0x18ee8
movq %rax, %r14
testq %rax, %rax
je 0x1cdfd
movq 0x28(%r14), %r12
movq 0x30(%r14), %rax
subq %r12, %rax
cmpq $0x4, %rax
je 0x1cdf3
cmpb $0x1, (%r15)
je 0x1cdf3
jmp 0x1cdfd
movq -0x288(%rbp), %rcx
leaq -0x290(%rbp), %rax
testq %rcx, %rcx
je 0x1cd3f
movl (%r12), %edx
xorl %esi, %esi
cmpl %edx, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x1cd28
leaq -0x290(%rbp), %rdx
movq %rdx, %rcx
cmpq %rdx, %rax
je 0x1cd5c
movl (%r12), %ecx
cmpl 0x20(%rax), %ecx
cmovlq %rdx, %rax
movq %rax, %rcx
cmpq %rdx, %rcx
je 0x1cd6c
leaq -0x2a(%rbp), %rdi
callq 0x686c
jmp 0x1cd6f
movb -0x2a(%rbp), %al
movq -0x70(%rbp), %rsi
cmpq %rsi, -0x68(%rbp)
je 0x1cdef
movq %rbx, %rcx
xorl %edx, %edx
movslq (%rsi,%rdx,4), %rsi
leaq 0x3f(%rsi), %rdi
testq %rsi, %rsi
cmovnsq %rsi, %rdi
sarq $0x6, %rdi
shlq $0x3, %rdi
addq -0x4d0(%rbp), %rdi
movabsq $-0x8000000000000000, %r10 # imm = 0x8000000000000000
leaq 0x3f(%r10), %r8
andq %rsi, %r8
xorl %r9d, %r9d
cmpq %r10, %r8
setbe %r9b
movq -0x8(%rdi,%r9,8), %rdi
btq %rsi, %rdi
jae 0x1cdd4
movq -0x170(%rbp), %rsi
movslq (%r12), %rdi
movq (%rsi,%rcx), %rsi
movb %al, (%rsi,%rdi)
incq %rdx
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdi
subq %rsi, %rdi
sarq $0x2, %rdi
addq $0x20, %rcx
cmpq %rdx, %rdi
ja 0x1cd7e
addq $0x4, %r12
cmpq 0x30(%r14), %r12
jne 0x1cd11
movq -0x1f0(%rbp), %rdi
leaq -0x1e0(%rbp), %rax
cmpq %rax, %rdi
je 0x1ce1f
movq -0x1e0(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x1f0(%rbp), %r14
jmp 0x1cc40
movl $0x100, %esi            # imm = 0x100
leaq -0x6d8(%rbp), %rdi
movl $0xa, %edx
callq 0x5220
movq -0x4d0(%rbp), %rdi
testq %rdi, %rdi
je 0x1ce7f
movq -0x4b0(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, -0x4d0(%rbp)
movl %eax, -0x4c8(%rbp)
movq %rax, -0x4c0(%rbp)
movl %eax, -0x4b8(%rbp)
movq %rax, -0x4b0(%rbp)
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0x1cbbe
movq -0x148(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1cbbe
movq -0x68(%rbp), %rax
movl $0x1a, %r14d
cmpq -0x70(%rbp), %rax
setne %al
je 0x1d214
movb %al, -0x29(%rbp)
movq -0x1a0(%rbp), %rax
shlq $0x5, %rax
movq %rax, -0x228(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x130(%rbp), %rdx
cmpq -0x128(%rbp), %rdx
je 0x1d07c
movq -0x1a0(%rbp), %rax
movq -0xa8(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
xorl %ecx, %ecx
movq -0x48(%rbp), %rax
movl (%rax), %r15d
movl (%rdx), %esi
movl %esi, %eax
subl %r15d, %eax
cmpl %eax, %r15d
movq %rcx, -0x1b0(%rbp)
jge 0x1d062
movslq %r15d, %r12
leal (%rcx,%r15), %eax
movl %eax, -0x40(%rbp)
movslq %ecx, %rax
movq %rax, -0x118(%rbp)
movl %ecx, %edi
movq %rdx, -0x138(%rbp)
movl %esi, -0x38(%rbp)
movq -0x170(%rbp), %rax
movq -0xb0(%rbp), %r14
shlq $0x5, %r14
movq -0x118(%rbp), %rcx
leaq (%r12,%rcx), %r13
movq (%rax,%r14), %rax
movsbq (%rax,%r13), %rbx
leaq 0x244c6(%rip), %rax     # 0x41440
cmpb $0x3, (%rax,%rbx)
jg 0x1d03c
movl %edi, -0xb8(%rbp)
movl %ebx, %edi
callq 0x52e0
testl %eax, %eax
je 0x1d032
movq 0x10(%rbp), %rax
cmpb $0x0, (%rax)
movl -0xb8(%rbp), %edi
jne 0x1cfb9
movq -0x1d0(%rbp), %rax
cmpb (%rax,%r13), %bl
je 0x1d03c
movl %r13d, %eax
subl %r15d, %eax
movq -0x1b0(%rbp), %rdx
cmpl %edx, %eax
cmovlel %edx, %eax
cmpl %edi, %eax
cmovlel %edi, %eax
leal (%r15,%r13), %ecx
incl %ecx
movl -0x38(%rbp), %esi
addl %edx, %esi
cmpl %ecx, %esi
cmovgel %ecx, %esi
cmpl %esi, %eax
jge 0x1d03a
cmpl %edx, %edi
cmovlel %edx, %edi
movl -0x40(%rbp), %eax
subl %r15d, %eax
cmpl %eax, %edi
cmovgl %edi, %eax
movslq %eax, %rbx
movl %esi, -0x38(%rbp)
movslq %esi, %r15
movq -0x170(%rbp), %rax
movq (%rax,%r14), %r13
cmpb $0x2d, (%r13,%rbx)
jne 0x1d025
movq -0x1d0(%rbp), %rax
movsbl (%rax,%rbx), %edi
callq 0x5560
movb %al, (%r13,%rbx)
incq %rbx
cmpq %r15, %rbx
jl 0x1cffd
movl -0x38(%rbp), %edi
jmp 0x1d03c
movl -0xb8(%rbp), %edi
jmp 0x1d03c
movl %esi, %edi
incq %r12
movq -0x138(%rbp), %rdx
movl (%rdx), %esi
movq -0x48(%rbp), %rax
movl (%rax), %r15d
movl %esi, %eax
subl %r15d, %eax
cltq
incl -0x40(%rbp)
cmpq %rax, %r12
jl 0x1cf4a
movq -0x1b0(%rbp), %rcx
addl %esi, %ecx
addq $0x4, %rdx
cmpq -0x128(%rbp), %rdx
jne 0x1cf0f
movl -0x30(%rbp), %r12d
testl %r12d, %r12d
jle 0x1d113
movq -0xa8(%rbp), %rax
shlq $0x5, %rax
addq -0x170(%rbp), %rax
movq -0x228(%rbp), %rcx
movq (%rcx,%rax), %rbx
xorl %r15d, %r15d
movq -0x1d0(%rbp), %rdx
movl $0x0, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movsbq (%rbx,%r15), %rdi
xorl %r14d, %r14d
cmpq $0x2d, %rdi
sete %r13b
leaq 0x2436e(%rip), %rax     # 0x41440
cmpb $0x3, (%rax,%rdi)
jg 0x1d0ff
movsbq (%rdx,%r15), %rax
cmpb %al, %dil
je 0x1d0ff
leaq 0x24357(%rip), %rcx     # 0x41440
cmpb $0x3, (%rcx,%rax)
jg 0x1d0ff
callq 0x52e0
movq -0x40(%rbp), %rdx
cmpl $0x1, %eax
sbbl $-0x1, -0x38(%rbp)
movb %r13b, %r14b
subl %r14d, %r12d
incq %r15
cmpq %r15, -0x240(%rbp)
jne 0x1d0bb
jmp 0x1d11a
movl $0x0, -0x38(%rbp)
movq -0xe0(%rbp), %rax
movq -0xa8(%rbp), %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq 0x23e84(%rip), %rdi     # 0x40fc0
callq 0x5420
movq -0x108(%rbp), %r15
movl -0x38(%rbp), %r14d
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x16165(%rip), %rsi     # 0x332c3
callq 0x5420
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
divss -0xb4(%rbp), %xmm0
mulss 0x16501(%rip), %xmm0    # 0x3367c
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x5610
movq %rax, %rbx
movl $0x1d, %edx
movq %rax, %rdi
leaq 0x172b4(%rip), %rsi     # 0x3444d
callq 0x5420
movq %rbx, %rdi
movl %r14d, %esi
callq 0x5690
movl $0x23, %edx
movq %rax, %rdi
leaq 0x172b3(%rip), %rsi     # 0x3446b
callq 0x5420
cvtsi2ss %r14d, %xmm1
movl -0xbc(%rbp), %edi
movss -0xb4(%rbp), %xmm0
callq 0x841e
testl %eax, %eax
movl $0x1a, %r14d
jne 0x1d20b
movq -0xa8(%rbp), %rdx
incq %rdx
movq -0x68(%rbp), %rax
subq -0x70(%rbp), %rax
sarq $0x2, %rax
movq %rdx, -0xa8(%rbp)
cmpq %rdx, %rax
seta -0x29(%rbp)
ja 0x1cee1
jmp 0x1d211
movl $0x1, %r14d
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x1d29f
movq -0x100(%rbp), %r15
movq -0xf8(%rbp), %r12
movq %r12, %rbx
subq %r15, %rbx
movq -0x68(%rbp), %r14
subq -0x70(%rbp), %r14
cmpq %r15, %r12
je 0x1d26d
leaq 0x10(%r15), %r13
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x1d256
movq (%r13), %rsi
incq %rsi
callq 0x53c0
leaq 0x20(%r13), %rax
addq $0x10, %r13
cmpq %r12, %r13
movq %rax, %r13
jne 0x1d241
movq %r15, -0xf8(%rbp)
leaq -0x6d8(%rbp), %rdi
callq 0x50b0
movq -0x108(%rbp), %r15
shrq $0x5, %rbx
shrq $0x2, %r14
addl %r14d, -0x4c(%rbp)
movq -0xa0(%rbp), %rax
addl %ebx, %eax
movq %rax, -0xa0(%rbp)
xorl %r14d, %r14d
movq -0x220(%rbp), %rsp
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x1d2bb
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x190(%rbp), %rdi
leaq -0x180(%rbp), %rax
cmpq %rax, %rdi
je 0x1d2dd
movq -0x180(%rbp), %rsi
incq %rsi
callq 0x53c0
cmpl $0xc, %r14d
je 0x1d2e8
testl %r14d, %r14d
jne 0x1d316
movq -0x238(%rbp), %rbx
incq %rbx
movq -0x110(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rbx, %rax
ja 0x1c855
movl $0xa, %r14d
movl $0x1, %ebx
cmpl $0xa, %r14d
jne 0x1d525
leaq -0x4d0(%rbp), %rdi
movq -0x198(%rbp), %rsi
movl $0x10, %edx
callq 0x5720
movq -0x4d0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x4b0(%rbp,%rax)
movl -0x30(%rbp), %esi
je 0x1d3a8
movq 0x23c94(%rip), %rdi     # 0x40ff0
callq 0x5190
movq %rax, %rbx
leaq 0x160c5(%rip), %rsi     # 0x33430
movl $0x16, %edx
movq %rax, %rdi
callq 0x5420
movq -0x198(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x5420
movq %rax, %rdi
callq 0x5190
movl $0x1, %ebx
movq %rax, %rdi
callq 0x5190
jmp 0x1d4ef
movq 0x18(%rbp), %rax
cmpb $0x1, (%rax)
jne 0x1d3d0
leaq -0x4d0(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
leaq -0x170(%rbp), %rcx
callq 0x1bc5d
jmp 0x1d4d5
movq 0x23be9(%rip), %rdi     # 0x40fc0
leaq 0x170b1(%rip), %rsi     # 0x3448f
movl $0x12, %edx
callq 0x5420
movq 0x23bd1(%rip), %rdi     # 0x40fc0
callq 0x5190
movq -0xd8(%rbp), %rax
cmpq -0xe0(%rbp), %rax
je 0x1d4d5
movl $0x8, %r12d
xorl %r13d, %r13d
leaq 0x16c6f(%rip), %rbx     # 0x34087
leaq -0x4d0(%rbp), %r14
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5420
movq -0xe0(%rbp), %rax
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
movq %r14, %rdi
callq 0x5420
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r15, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq -0x170(%rbp), %rcx
movq -0x8(%rcx,%r12), %rsi
movq (%rcx,%r12), %rdx
movq %rax, %rdi
callq 0x5420
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r15, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq -0xd8(%rbp), %rax
subq -0xe0(%rbp), %rax
incq %r13
sarq $0x5, %rax
addq $0x20, %r12
cmpq %r13, %rax
ja 0x1d41f
leaq -0x4d0(%rbp), %rdi
callq 0x5530
xorl %ebx, %ebx
movq -0x230(%rbp), %rdi
callq 0x8354
movq 0x23aba(%rip), %rax     # 0x40fb0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x4c8(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x4d0(%rbp,%rcx)
callq 0x5330
leaq -0x3d8(%rbp), %rdi
callq 0x5120
leaq -0x100(%rbp), %rdi
callq 0xabee
movq -0x218(%rbp), %rsp
leaq -0x6d8(%rbp), %rdi
callq 0x50d0
leaq -0x170(%rbp), %rdi
callq 0xabee
leaq -0xe0(%rbp), %rdi
callq 0xabee
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x1d591
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 -0x210(%rbp), %rdi
callq 0xabee
leaq 0x23654(%rip), %rax     # 0x40bf8
leaq -0x7e0(%rbp), %r14
movq %rax, -0x10(%r14)
leaq 0x2366a(%rip), %rax     # 0x40c20
movq %rax, (%r14)
movq $0x0, -0x8(%r14)
leaq 0x23570(%rip), %rsi     # 0x40b38
leaq -0x978(%rbp), %rdi
callq 0x7954
movq %r14, %rdi
callq 0x5120
movq -0x130(%rbp), %rdi
testq %rdi, %rdi
je 0x1d5f7
movq -0x120(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x1d0(%rbp), %rdi
leaq -0x1c0(%rbp), %rax
cmpq %rax, %rdi
je 0x1d619
movq -0x1c0(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x258(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d638
movq -0x258(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x298(%rbp), %rdi
callq 0x1da60
leaq -0x2d0(%rbp), %rdi
callq 0x1892e
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x1d865
jmp 0x1d6d2
movq %rax, %rbx
jmp 0x1d871
movq %rax, %rbx
movq -0x6d8(%rbp), %rdi
cmpq %r12, %rdi
je 0x1d87d
movq -0x6c8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1d87d
jmp 0x1d6b6
movq %rax, %rbx
jmp 0x1d889
jmp 0x1d6a6
movq %rax, %rbx
jmp 0x1d8be
jmp 0x1d6da
jmp 0x1d71a
jmp 0x1d6b6
jmp 0x1d715
movq %rax, %rbx
jmp 0x1d87d
movq %rax, %rbx
jmp 0x1d909
movq %rax, %rbx
jmp 0x1d965
jmp 0x1d71a
jmp 0x1d6f0
movq %rax, %rbx
jmp 0x1d859
movq %rax, %rbx
leaq -0x4d0(%rbp), %rdi
callq 0x55a0
jmp 0x1d859
jmp 0x1d708
movq %rax, %rbx
jmp 0x1d837
jmp 0x1d715
jmp 0x1d71a
jmp 0x1d71a
movq %rax, %rbx
jmp 0x1d946
jmp 0x1d715
movq %rax, %rbx
jmp 0x1d8ca
jmp 0x1d798
movq %rax, %rbx
jmp 0x1d747
movq %rax, %rbx
jmp 0x1d822
movq %rax, %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x1d747
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x4d0(%rbp), %rdi
leaq -0x4c0(%rbp), %rax
cmpq %rax, %rdi
je 0x1d769
movq -0x4c0(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x6d8(%rbp), %rdi
leaq -0x6c8(%rbp), %rax
cmpq %rax, %rdi
je 0x1d8ca
movq -0x6c8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1d8ca
jmp 0x1d79d
jmp 0x1d798
movq %rax, %rbx
jmp 0x1d7c2
movq %rax, %rbx
movq -0x1f0(%rbp), %rdi
leaq -0x1e0(%rbp), %rax
cmpq %rax, %rdi
je 0x1d7c2
movq -0x1e0(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x4d0(%rbp), %rdi
testq %rdi, %rdi
je 0x1d800
movq -0x4b0(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, -0x4d0(%rbp)
movl %eax, -0x4c8(%rbp)
movq %rax, -0x4c0(%rbp)
movl %eax, -0x4b8(%rbp)
movq %rax, -0x4b0(%rbp)
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0x1d822
movq -0x148(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x1d837
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x190(%rbp), %rdi
leaq -0x180(%rbp), %rax
cmpq %rax, %rdi
je 0x1d859
movq -0x180(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x100(%rbp), %rdi
callq 0xabee
leaq -0x6d8(%rbp), %rdi
callq 0x50d0
leaq -0x170(%rbp), %rdi
callq 0xabee
leaq -0xe0(%rbp), %rdi
callq 0xabee
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x1d8be
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 -0x210(%rbp), %rdi
callq 0xabee
leaq 0x23327(%rip), %rax     # 0x40bf8
leaq -0x7e0(%rbp), %r14
movq %rax, -0x10(%r14)
leaq 0x2333d(%rip), %rax     # 0x40c20
movq %rax, (%r14)
movq $0x0, -0x8(%r14)
leaq 0x23243(%rip), %rsi     # 0x40b38
leaq -0x978(%rbp), %rdi
callq 0x7954
movq %r14, %rdi
callq 0x5120
movq -0x130(%rbp), %rdi
testq %rdi, %rdi
je 0x1d924
movq -0x120(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x1d0(%rbp), %rdi
leaq -0x1c0(%rbp), %rax
cmpq %rax, %rdi
je 0x1d946
movq -0x1c0(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x258(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d965
movq -0x258(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x298(%rbp), %rdi
callq 0x1da60
leaq -0x2d0(%rbp), %rdi
callq 0x1892e
movq %rbx, %rdi
callq 0x56a0
nop