// File: /workspace/github_cpp_makefile_star2_O3/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 $0x948, %rsp            # imm = 0x948
movq %r9, -0x228(%rbp)
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, -0x88(%rbp)
movq %rsi, -0x188(%rbp)
movq %rdi, %r15
callq 0x5060
movq %rax, -0x218(%rbp)
leaq -0x290(%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 -0x280(%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, -0x40(%rbp)
movl (%rbx), %r12d
leaq -0x258(%rbp), %rdi
movq %r15, -0x38(%rbp)
movq %r15, %rsi
callq 0x7dec
movq 0x250ca(%rip), %rdi     # 0x40fc0
leaq 0x1737e(%rip), %rsi     # 0x3327b
movl $0x8, %edx
callq 0x5420
movq -0x258(%rbp), %rsi
movq -0x250(%rbp), %rdx
movq 0x250a4(%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 -0x1b8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq %rax, -0x110(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x120(%rbp)
leaq -0x968(%rbp), %rdi
callq 0x7710
leaq -0x968(%rbp), %rsi
movl $0x1, %ebx
movq -0x38(%rbp), %rdi
movl $0x1, %edx
callq 0x8076
testl %eax, %eax
jne 0x1d29f
movq %r14, -0x48(%rbp)
movl %r12d, %eax
addl %r12d, %r12d
leal 0x1(,%rax,2), %eax
leaq -0x4b8(%rbp), %r15
movl %r12d, -0x50(%rbp)
movslq %r12d, %rcx
negq %rcx
movq %rcx, -0x60(%rbp)
movslq %eax, %r12
xorl %ebx, %ebx
leaq -0x108(%rbp), %r13
movl $0x0, -0x30(%rbp)
leaq -0x7e0(%rbp), %rdi
callq 0x5140
cmpl $-0x1, %eax
je 0x1c237
movq %r15, -0x4c8(%rbp)
movq %rbx, -0x4c0(%rbp)
movb %bl, -0x4b8(%rbp)
leaq -0x6b8(%rbp), %rax
movq %rax, -0x6c8(%rbp)
movq %rbx, -0x6c0(%rbp)
movb %bl, -0x6b8(%rbp)
leaq -0x968(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x6c8(%rbp), %rdx
leaq -0x4c8(%rbp), %rcx
callq 0x6c5b
movl $0x1, %r14d
testl %eax, %eax
jne 0x1c1e6
movq -0x4c0(%rbp), %rdx
movl %edx, -0x178(%rbp)
movq -0x118(%rbp), %rsi
cmpq -0x110(%rbp), %rsi
je 0x1c073
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x118(%rbp)
jmp 0x1c08d
leaq -0x120(%rbp), %rdi
leaq -0x178(%rbp), %rdx
callq 0xdeae
movq -0x4c0(%rbp), %rdx
movq -0x4c8(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
callq 0x5110
movl -0x178(%rbp), %eax
cmpl -0x50(%rbp), %eax
jle 0x1c0d6
movl -0x30(%rbp), %ecx
movl %ecx, -0x140(%rbp)
movq -0x40(%rbp), %rax
movl (%rax), %esi
cmpb $0x0, 0x28(%rbp)
je 0x1c0e4
leaq -0x4c8(%rbp), %rdi
callq 0x7601
testl %eax, %eax
jne 0x1c1e6
jmp 0x1c0ec
addl %eax, -0x30(%rbp)
movl $0x2, %r14d
jmp 0x1c1e6
addl %ecx, %esi
movl %esi, -0x140(%rbp)
movq -0x4c8(%rbp), %rax
movq -0x4c0(%rbp), %r15
leaq (%rax,%r15), %rcx
addq -0x60(%rbp), %rcx
cmpq %rcx, %rax
je 0x1c1a7
addq -0x60(%rbp), %r15
xorl %r14d, %r14d
movq %r13, %rdi
leaq -0x4c8(%rbp), %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x53e0
movq %r13, %rdi
callq 0x68d8
testb %al, %al
je 0x1c146
leaq -0x288(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x1d812
movq %r13, %rdi
leaq -0x29(%rbp), %rsi
callq 0x8a8b
movq %r13, %rdi
callq 0x6a7b
testl %eax, %eax
jne 0x1c1b2
movl -0x140(%rbp), %edx
leaq -0x2c0(%rbp), %rdi
movq %r13, %rsi
callq 0x1b880
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x1c195
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x53c0
incq %r14
incl -0x140(%rbp)
cmpq %r14, %r15
jne 0x1c112
xorl %r14d, %r14d
movl -0x178(%rbp), %eax
jmp 0x1c1dc
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x1c1d4
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x53c0
xorl %eax, %eax
movl $0x1, %r14d
leaq -0x4b8(%rbp), %r15
addl %eax, -0x30(%rbp)
movq -0x6c8(%rbp), %rdi
leaq -0x6b8(%rbp), %rax
cmpq %rax, %rdi
je 0x1c208
movq -0x6b8(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x4c8(%rbp), %rdi
cmpq %r15, %rdi
je 0x1c223
movq -0x4b8(%rbp), %rsi
incq %rsi
callq 0x53c0
testb $0x1, %r14b
je 0x1bfd7
movl $0x1, %ebx
jmp 0x1d29f
leaq -0x968(%rbp), %rdi
callq 0x77fa
movq -0x48(%rbp), %r14
movq -0x2a8(%rbp), %rsi
movq 0x24d6b(%rip), %rdi     # 0x40fc0
callq 0x5240
movq %rax, %rbx
leaq 0x18188(%rip), %rsi     # 0x343ec
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 -0x1e0(%rbp), %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movl $0x1, %ebx
movq -0x88(%rbp), %rdi
movl $0x1, %edx
callq 0x9851
movl -0x30(%rbp), %r13d
testl %eax, %eax
jne 0x1d293
movq -0x1d8(%rbp), %rsi
subq -0x1e0(%rbp), %rsi
sarq $0x5, %rsi
leaq -0x4c8(%rbp), %rdx
movb $0x0, (%rdx)
leaq -0x108(%rbp), %rdi
leaq -0x6c8(%rbp), %rcx
callq 0xabec
leaq -0x1e0(%rbp), %rsi
leaq -0x108(%rbp), %rdx
movq 0x20(%rbp), %rdi
callq 0x9b39
xorps %xmm0, %xmm0
movaps %xmm0, -0xc0(%rbp)
movq $0x0, -0xb0(%rbp)
cmpb $0x1, (%r14)
jne 0x1c343
leaq -0xc0(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x8528
movq -0x108(%rbp), %r14
movq -0xf8(%rbp), %rax
movl -0xf0(%rbp), %ecx
cmpq %rax, %r14
setne %dl
testl %ecx, %ecx
setne %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0x1c3d8
xorl %r15d, %r15d
leaq -0xc0(%rbp), %rbx
xorl %edx, %edx
movl %edx, %r12d
movq (%r14), %rsi
btq %rdx, %rsi
jae 0x1c3b8
movq %r14, %rax
subq -0x108(%rbp), %rax
shlq $0x8, %rax
addq -0x1e0(%rbp), %rax
movq %r12, %rsi
shlq $0x5, %rsi
addq %rax, %rsi
movq %rbx, %rdi
callq 0x8528
movq -0xf8(%rbp), %rax
movl -0xf0(%rbp), %ecx
leal 0x1(%r12), %edx
xorl %esi, %esi
cmpq $0x3f, %r12
sete %sil
leaq (%r14,%rsi,8), %r14
cmovel %r15d, %edx
cmpq %rax, %r14
jne 0x1c378
cmpl %ecx, %edx
jne 0x1c378
movq -0xb8(%rbp), %rsi
subq -0xc0(%rbp), %rsi
sarq $0x5, %rsi
movq -0x48(%rbp), %r15
movzbl (%r15), %eax
subq %rax, %rsi
movq 0x24bc4(%rip), %rdi     # 0x40fc0
callq 0x5240
movq %rax, %rbx
leaq 0x17fed(%rip), %rsi     # 0x343f8
movl $0x1c, %edx
movq %rax, %rdi
callq 0x5420
movq -0x38(%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 -0xc0(%rbp), %r14
movq -0xb8(%rbp), %rbx
movslq %r13d, %rsi
leaq -0x4c8(%rbp), %rdi
leaq -0x4b8(%rbp), %rax
movq %rax, (%rdi)
movl $0x2d, %edx
callq 0x5440
subq %r14, %rbx
sarq $0x5, %rbx
leaq -0x158(%rbp), %rdi
leaq -0x4c8(%rbp), %rdx
leaq -0x6c8(%rbp), %rcx
movq %rbx, %rsi
callq 0x1d6b0
movq -0x4c8(%rbp), %rdi
leaq -0x4b8(%rbp), %rax
cmpq %rax, %rdi
movq -0x88(%rbp), %rbx
je 0x1c4ce
movq -0x4b8(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x4c8(%rbp), %rdi
callq 0x5410
movq %rsp, -0x210(%rbp)
movq -0x40(%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, -0x238(%rbp)
leaq 0xf(%rcx), %rax
andq $-0x10, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x198(%rbp)
movq %rcx, %rsp
movl $0x0, -0x54(%rbp)
cmpb $0x1, (%r15)
jne 0x1c545
movl $0x1, -0x54(%rbp)
movq -0x158(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x51c0
xorps %xmm0, %xmm0
movaps %xmm0, -0xe0(%rbp)
movq $0x0, -0xd0(%rbp)
movq (%rbx), %rsi
cmpq %rsi, 0x8(%rbx)
je 0x1d037
xorps %xmm0, %xmm0
cvtsi2ss %r13d, %xmm0
movss %xmm0, -0x9c(%rbp)
movl %r13d, %eax
movq %rax, -0x230(%rbp)
xorl %r14d, %r14d
movq $0x0, -0x98(%rbp)
movq %r14, -0x220(%rbp)
shlq $0x5, %r14
addq %r14, %rsi
leaq -0x178(%rbp), %rdi
callq 0x7dec
addq (%rbx), %r14
movq %r14, %rdi
leaq -0x4c8(%rbp), %rsi
movl $0x1, %edx
callq 0x7f3f
movl $0x1, %r14d
testl %eax, %eax
jne 0x1cfdd
leaq -0x4c8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x9684
movl -0xa0(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x1c6f8
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
movq $0x0, -0x70(%rbp)
movl $0x0, -0x6c8(%rbp)
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rcx
cmpq %rax, %rcx
je 0x1c7db
xorl %edx, %edx
movq -0x98(%rbp), %rdi
leal (%rdx,%rdi), %esi
movslq %esi, %rsi
addl %edx, %edi
addl $0x3f, %edi
testl %esi, %esi
cmovnsl %esi, %edi
sarl $0x6, %edi
movslq %edi, %rdi
shlq $0x3, %rdi
addq -0x108(%rbp), %rdi
movabsq $-0x8000000000000000, %r10 # imm = 0x8000000000000000
leaq 0x3f(%r10), %r12
movq %rsi, %r8
andq %r12, %r8
xorl %r9d, %r9d
cmpq %r10, %r8
setbe %r9b
movq -0x8(%rdi,%r9,8), %rdi
btq %rsi, %rdi
jae 0x1c6b1
movq -0x78(%rbp), %rsi
cmpq -0x70(%rbp), %rsi
je 0x1c693
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x78(%rbp)
jmp 0x1c6b1
leaq -0x80(%rbp), %rdi
leaq -0x6c8(%rbp), %rdx
callq 0xdeae
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rcx
movslq -0x6c8(%rbp), %rdx
incq %rdx
movl %edx, -0x6c8(%rbp)
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x5, %rsi
cmpq %rdx, %rsi
ja 0x1c62c
movq -0x78(%rbp), %rax
cmpq -0x80(%rbp), %rax
je 0x1c7db
testq %rsi, %rsi
js 0x1c89f
xorps %xmm0, %xmm0
cvtsi2ss %rsi, %xmm0
jmp 0x1c8b7
movq 0x248f1(%rip), %rcx     # 0x40ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x248d3(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r14
movl $0xd, %edx
movq %rax, %rdi
leaq 0x17cd9(%rip), %rsi     # 0x34415
callq 0x5420
movq -0x178(%rbp), %rsi
movq -0x170(%rbp), %rdx
movq %r14, %rdi
callq 0x5420
movq %rax, %r14
movl $0x8, %edx
movq %rax, %rdi
leaq 0x17cba(%rip), %rsi     # 0x34423
callq 0x5420
movq -0x40(%rbp), %rax
movl (%rax), %esi
movq %r14, %rdi
callq 0x5690
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movl $0x1, %r14d
movq %rax, %rdi
callq 0x5250
jmp 0x1cfdd
leaq -0x4c8(%rbp), %rdi
callq 0x50b0
movl $0x10, %edx
movq 0x247fd(%rip), %rdi     # 0x40ff0
leaq 0x17c32(%rip), %rsi     # 0x3442c
callq 0x5420
movq 0x247ea(%rip), %rcx     # 0x40ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x247cc(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq -0xe0(%rbp), %rbx
movq -0xd8(%rbp), %r15
movq %r15, %rax
subq %rbx, %rax
shrq $0x5, %rax
movq -0x98(%rbp), %rcx
addl %eax, %ecx
movq %rcx, -0x98(%rbp)
movl $0xc, %r14d
cmpq %rbx, %r15
je 0x1cfc1
leaq 0x10(%rbx), %r12
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x1c882
movq (%r12), %rsi
incq %rsi
callq 0x53c0
leaq 0x20(%r12), %rax
addq $0x10, %r12
cmpq %r15, %r12
movq %rax, %r12
jne 0x1c86c
movq %rbx, -0xd8(%rbp)
jmp 0x1cfc1
movq %rsi, %rax
shrq %rax
andl $0x1, %esi
orq %rax, %rsi
xorps %xmm0, %xmm0
cvtsi2ss %rsi, %xmm0
addss %xmm0, %xmm0
divss 0x16dc1(%rip), %xmm0    # 0x33680
callq 0x51e0
movq %rsp, -0x208(%rbp)
cvttss2si %xmm0, %ecx
leaq 0xf(%rcx), %rax
andq $-0x10, %rax
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, %rsp
movq %rcx, -0x50(%rbp)
movq %rdx, -0x38(%rbp)
leaq (%rdx,%rcx), %rax
movq %rax, -0x60(%rbp)
movslq -0x54(%rbp), %r13
movq %r13, -0x180(%rbp)
shlq $0x5, %r13
leaq -0x4c8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x5480
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1cbe0
leaq -0x130(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0x140(%rbp), %rbx
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x85fc
xorl %eax, %eax
movq %rax, -0x6c8(%rbp)
movl %eax, -0x6c0(%rbp)
movq %rax, -0x6b8(%rbp)
movl %eax, -0x6b0(%rbp)
movq %rax, -0x6a8(%rbp)
movq %rbx, %rdi
leaq -0x6c8(%rbp), %rsi
callq 0x8993
leaq -0x4c8(%rbp), %rdi
callq 0x5140
cmpl $0xa, %eax
je 0x1cb84
leaq -0x4c8(%rbp), %rdi
leaq -0x29(%rbp), %rsi
callq 0x5500
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1cb84
leaq -0x4c8(%rbp), %rdi
movq -0x198(%rbp), %rsi
movq -0x238(%rbp), %rdx
callq 0x5480
movq -0x40(%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 -0x1f0(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x198(%rbp), %rsi
addq %rsi, %rdx
leaq -0x200(%rbp), %rbx
movq %rbx, %rdi
callq 0x85fc
leaq -0x2c0(%rbp), %rdi
movq %rbx, %rsi
callq 0x18d28
movq %rax, %r14
testq %rax, %rax
je 0x1cb59
movq 0x28(%r14), %r15
movq 0x30(%r14), %rax
movq %rax, %rcx
subq %r15, %rcx
cmpq $0x4, %rcx
jne 0x1ca4e
cmpq %rax, %r15
jne 0x1ca67
jmp 0x1cb59
cmpq %rax, %r15
je 0x1cb59
movq -0x228(%rbp), %rax
cmpb $0x0, (%rax)
je 0x1cb59
movb -0x29(%rbp), %al
movq -0x278(%rbp), %r8
testq %r8, %r8
je 0x1cac4
movl (%r15), %ecx
leaq -0x280(%rbp), %r9
movq %r9, %rdx
movq %r8, %rsi
movl 0x20(%r8), %edi
xorl %r8d, %r8d
cmpl %ecx, %edi
setl %r8b
movq %rsi, %r9
cmovlq %rdx, %r9
movq 0x10(%rsi,%r8,8), %r8
testq %r8, %r8
jne 0x1ca80
leaq -0x280(%rbp), %r8
cmpq %r8, %r9
je 0x1cac4
cmpl %ecx, %edi
cmovlq %rdx, %rsi
cmpl 0x20(%rsi), %ecx
jl 0x1cac4
leaq -0x29(%rbp), %rdi
callq 0x684c
movq -0x80(%rbp), %rcx
movq -0x78(%rbp), %rsi
cmpq %rcx, %rsi
je 0x1cb4b
movq %r13, %rdx
xorl %edi, %edi
movslq (%rcx,%rdi,4), %r8
leal 0x3f(%r8), %r9d
testq %r8, %r8
cmovnsl %r8d, %r9d
sarl $0x6, %r9d
movslq %r9d, %r9
shlq $0x3, %r9
addq -0x6c8(%rbp), %r9
movq %r8, %r10
andq %r12, %r10
xorl %r11d, %r11d
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
cmpq %rbx, %r10
setbe %r11b
movq -0x8(%r9,%r11,8), %r9
btq %r8, %r9
jae 0x1cb35
movq -0x158(%rbp), %rcx
movslq (%r15), %rsi
movq (%rcx,%rdx), %rcx
movb %al, (%rcx,%rsi)
movq -0x80(%rbp), %rcx
movq -0x78(%rbp), %rsi
incq %rdi
movq %rsi, %r8
subq %rcx, %r8
sarq $0x2, %r8
addq $0x20, %rdx
cmpq %rdi, %r8
ja 0x1cad6
addq $0x4, %r15
cmpq 0x30(%r14), %r15
jne 0x1ca67
movq -0x200(%rbp), %rdi
leaq -0x1f0(%rbp), %rax
cmpq %rax, %rdi
je 0x1c97c
movq -0x1f0(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1c97c
movl $0x100, %esi            # imm = 0x100
leaq -0x4c8(%rbp), %rdi
movl $0xa, %edx
callq 0x5220
movq -0x6c8(%rbp), %rdi
testq %rdi, %rdi
je 0x1cbb5
movq -0x6a8(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0x1c8ff
movq -0x130(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1c8ff
movq -0x78(%rbp), %rax
cmpq -0x80(%rbp), %rax
je 0x1cf37
movq $0x0, -0x90(%rbp)
movl -0x30(%rbp), %r13d
movq -0x120(%rbp), %rsi
movq -0x118(%rbp), %rax
cmpq %rax, %rsi
je 0x1cda7
movq -0x180(%rbp), %rcx
movq -0x90(%rbp), %rdx
addq %rdx, %rcx
movq %rcx, -0x60(%rbp)
movq -0x40(%rbp), %rcx
movl (%rcx), %edi
xorl %edx, %edx
movl (%rsi), %r8d
movl %r8d, %ecx
subl %edi, %ecx
cmpl %ecx, %edi
jge 0x1cd94
movq %rsi, -0x190(%rbp)
movslq %edx, %rax
movq %rax, -0x50(%rbp)
leal (%rdx,%rdi), %eax
movl %eax, -0x38(%rbp)
movslq %edi, %r15
movq %rdx, -0x1a0(%rbp)
movl %edx, %ebx
movq -0x158(%rbp), %rax
movq -0x60(%rbp), %r12
shlq $0x5, %r12
movq -0x50(%rbp), %rcx
leaq (%r15,%rcx), %r13
movq (%rax,%r12), %rax
movsbq (%rax,%r13), %r14
leaq 0x247b8(%rip), %rax     # 0x41440
cmpb $0x3, (%rax,%r14)
jg 0x1cccb
movq %r8, -0x1a8(%rbp)
movq %rdi, -0x48(%rbp)
movl %r14d, %edi
callq 0x52e0
testl %eax, %eax
je 0x1cd56
movq 0x10(%rbp), %rax
cmpb $0x0, (%rax)
movq -0x48(%rbp), %rdi
movq -0x1a8(%rbp), %r8
jne 0x1ccd2
movq -0x1c8(%rbp), %rax
cmpb (%rax,%r13), %r14b
jne 0x1ccd2
movl %ebx, %esi
jmp 0x1cd63
movl %r13d, %eax
subl %edi, %eax
movq -0x1a0(%rbp), %rdx
cmpl %edx, %eax
cmovlel %edx, %eax
cmpl %ebx, %eax
cmovlel %ebx, %eax
leal (%rdi,%r13), %esi
incl %esi
leal (%r8,%rdx), %ecx
cmpl %esi, %ecx
cmovll %ecx, %esi
cmpl %esi, %eax
jge 0x1cd63
cmpl %edx, %ebx
cmovlel %edx, %ebx
movl -0x38(%rbp), %eax
subl %edi, %eax
cmpl %eax, %ebx
cmovgl %ebx, %eax
movslq %eax, %rbx
movl %esi, -0x48(%rbp)
movslq %esi, %r13
movq -0x158(%rbp), %rax
movq (%rax,%r12), %r14
cmpb $0x2d, (%r14,%rbx)
jne 0x1cd39
movq -0x1c8(%rbp), %rax
movsbl (%rax,%rbx), %edi
callq 0x5560
movb %al, (%r14,%rbx)
incq %rbx
cmpq %r13, %rbx
jl 0x1cd13
movq -0x190(%rbp), %rax
movl (%rax), %r8d
movq -0x40(%rbp), %rax
movl (%rax), %edi
movl -0x48(%rbp), %esi
jmp 0x1cd63
movl %ebx, %esi
movq -0x48(%rbp), %rdi
movq -0x1a8(%rbp), %r8
incq %r15
movl %r8d, %eax
subl %edi, %eax
cltq
incl -0x38(%rbp)
movl %esi, %ebx
cmpq %rax, %r15
jl 0x1cc61
movq -0x118(%rbp), %rax
movl -0x30(%rbp), %r13d
movq -0x190(%rbp), %rsi
movq -0x1a0(%rbp), %rdx
addl %edx, %r8d
addq $0x4, %rsi
movl %r8d, %edx
cmpq %rax, %rsi
jne 0x1cc31
testl %r13d, %r13d
jle 0x1ce41
movq -0x90(%rbp), %rax
shlq $0x5, %rax
addq -0x158(%rbp), %rax
movq -0x180(%rbp), %rcx
shlq $0x5, %rcx
movq (%rcx,%rax), %rbx
xorl %r12d, %r12d
movq -0x1c8(%rbp), %rdx
movl $0x0, -0x38(%rbp)
movl %r13d, %r15d
movq %rdx, -0x50(%rbp)
movsbq (%rbx,%r12), %rdi
xorl %r14d, %r14d
cmpq $0x2d, %rdi
sete %r13b
leaq 0x24640(%rip), %rax     # 0x41440
cmpb $0x3, (%rax,%rdi)
jg 0x1ce2d
movsbq (%rdx,%r12), %rax
cmpb %al, %dil
je 0x1ce2d
leaq 0x24629(%rip), %rcx     # 0x41440
cmpb $0x3, (%rcx,%rax)
jg 0x1ce2d
callq 0x52e0
movq -0x50(%rbp), %rdx
cmpl $0x1, %eax
sbbl $-0x1, -0x38(%rbp)
movb %r13b, %r14b
subl %r14d, %r15d
incq %r12
cmpq %r12, -0x230(%rbp)
jne 0x1cde9
jmp 0x1ce4b
movl $0x0, -0x38(%rbp)
movl %r13d, %r15d
movq -0xc0(%rbp), %rax
movq -0x90(%rbp), %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq 0x24153(%rip), %rdi     # 0x40fc0
callq 0x5420
movl -0x38(%rbp), %ebx
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x1643c(%rip), %rsi     # 0x332c3
callq 0x5420
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
divss -0x9c(%rbp), %xmm0
mulss 0x167d8(%rip), %xmm0    # 0x3367c
cvtss2sd %xmm0, %xmm0
movq %r12, %rdi
callq 0x5610
movq %rax, %r12
movl $0x1d, %edx
movq %rax, %rdi
leaq 0x1757b(%rip), %rsi     # 0x3443d
callq 0x5420
movq %r12, %rdi
movl %ebx, %esi
callq 0x5690
movl $0x23, %edx
movq %rax, %rdi
leaq 0x1757b(%rip), %rsi     # 0x3445b
callq 0x5420
cvtsi2ss %ebx, %xmm1
movl -0xa0(%rbp), %edi
movss -0x9c(%rbp), %xmm0
callq 0x83ea
testl %eax, %eax
jne 0x1cfb0
movq -0x78(%rbp), %rbx
subq -0x80(%rbp), %rbx
movq -0x90(%rbp), %rdx
incq %rdx
movq %rbx, %rax
sarq $0x2, %rax
movq %rdx, -0x90(%rbp)
cmpq %rdx, %rax
movl -0x30(%rbp), %r13d
ja 0x1cbfd
shrq $0x2, %rbx
jmp 0x1cf3d
xorl %ebx, %ebx
movl -0x30(%rbp), %r13d
movq -0xe0(%rbp), %r15
movq -0xd8(%rbp), %r12
movq %r12, %r14
subq %r15, %r14
je 0x1cf87
leaq 0x10(%r15), %r13
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x1cf6c
movq (%r13), %rsi
incq %rsi
callq 0x53c0
leaq 0x20(%r13), %rax
addq $0x10, %r13
cmpq %r12, %r13
movq %rax, %r13
jne 0x1cf57
movq %r15, -0xd8(%rbp)
movl -0x30(%rbp), %r13d
leaq -0x4c8(%rbp), %rdi
callq 0x50b0
shrq $0x5, %r14
addl %ebx, -0x54(%rbp)
movq -0x98(%rbp), %rax
addl %r14d, %eax
movq %rax, -0x98(%rbp)
xorl %r14d, %r14d
jmp 0x1cfba
movl $0x1, %r14d
movl -0x30(%rbp), %r13d
movq -0x208(%rbp), %rsp
movq -0x88(%rbp), %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x1cfdd
movq -0x70(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0x1cfff
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x53c0
testl %r14d, %r14d
je 0x1d00a
cmpl $0xc, %r14d
jne 0x1d02d
movq -0x220(%rbp), %r14
incq %r14
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r14, %rax
ja 0x1c58f
jmp 0x1d037
cmpl $0xa, %r14d
jne 0x1d0e2
leaq -0x6c8(%rbp), %rdi
movq -0x188(%rbp), %rsi
movl $0x10, %edx
callq 0x5720
movq -0x6c8(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x6a8(%rbp,%rax)
je 0x1d0b7
movq 0x23f85(%rip), %rdi     # 0x40ff0
callq 0x5190
movq %rax, %rbx
leaq 0x163b6(%rip), %rsi     # 0x33430
movl $0x16, %edx
movq %rax, %rdi
callq 0x5420
movq -0x188(%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 0x1d20b
movq 0x18(%rbp), %rax
cmpb $0x1, (%rax)
jne 0x1d0ec
leaq -0x6c8(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
leaq -0x158(%rbp), %rcx
movl %r13d, %esi
callq 0x1b9b9
jmp 0x1d1f1
movl $0x1, %ebx
jmp 0x1d241
movq 0x23ecd(%rip), %rdi     # 0x40fc0
leaq 0x17385(%rip), %rsi     # 0x3447f
movl $0x12, %edx
callq 0x5420
movq 0x23eb5(%rip), %rdi     # 0x40fc0
callq 0x5190
movq -0xb8(%rbp), %rax
cmpq -0xc0(%rbp), %rax
je 0x1d1f1
movl $0x8, %r12d
xorl %r13d, %r13d
leaq 0x16f43(%rip), %rbx     # 0x34077
leaq -0x6c8(%rbp), %r14
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5420
movq -0xc0(%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 -0x158(%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 -0xb8(%rbp), %rax
subq -0xc0(%rbp), %rax
incq %r13
sarq $0x5, %rax
addq $0x20, %r12
cmpq %r13, %rax
ja 0x1d13b
leaq -0x6c8(%rbp), %rdi
callq 0x5530
xorl %ebx, %ebx
movq -0x218(%rbp), %rdi
callq 0x8320
movq 0x23d9e(%rip), %rax     # 0x40fb0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x6c0(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x6c8(%rbp,%rcx)
callq 0x5330
leaq -0x5d0(%rbp), %rdi
callq 0x5120
leaq -0xe0(%rbp), %rdi
callq 0xab8e
movq -0x210(%rbp), %rsp
leaq -0x4c8(%rbp), %rdi
callq 0x50d0
leaq -0x158(%rbp), %rdi
callq 0xab8e
leaq -0xc0(%rbp), %rdi
callq 0xab8e
movq -0x108(%rbp), %rdi
testq %rdi, %rdi
je 0x1d293
movq -0xe8(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
leaq -0x1e0(%rbp), %rdi
callq 0xab8e
leaq 0x23952(%rip), %rax     # 0x40bf8
leaq -0x7d0(%rbp), %r14
movq %rax, -0x10(%r14)
leaq 0x23968(%rip), %rax     # 0x40c20
movq %rax, (%r14)
movq $0x0, -0x8(%r14)
leaq 0x2386e(%rip), %rsi     # 0x40b38
leaq -0x968(%rbp), %rdi
callq 0x7922
movq %r14, %rdi
callq 0x5120
movq -0x120(%rbp), %rdi
testq %rdi, %rdi
je 0x1d2f9
movq -0x110(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x1c8(%rbp), %rdi
leaq -0x1b8(%rbp), %rax
cmpq %rax, %rdi
je 0x1d31b
movq -0x1b8(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x248(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d33a
movq -0x248(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x288(%rbp), %rdi
callq 0x1d744
leaq -0x2c0(%rbp), %rdi
callq 0x1876c
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x1d563
jmp 0x1d3cb
movq %rax, %rbx
jmp 0x1d56f
movq %rax, %rbx
movq -0x4c8(%rbp), %rdi
leaq -0x4b8(%rbp), %rax
cmpq %rax, %rdi
je 0x1d57b
movq -0x4b8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1d57b
jmp 0x1d3c1
movq %rax, %rbx
jmp 0x1d587
jmp 0x1d3af
movq %rax, %rbx
jmp 0x1d5a2
jmp 0x1d3e9
jmp 0x1d40c
jmp 0x1d3c1
jmp 0x1d426
jmp 0x1d40c
movq %rax, %rbx
jmp 0x1d57b
jmp 0x1d3fd
movq %rax, %rbx
jmp 0x1d557
movq %rax, %rbx
jmp 0x1d5ed
movq %rax, %rbx
jmp 0x1d649
jmp 0x1d40c
jmp 0x1d40c
jmp 0x1d41e
movq %rax, %rbx
leaq -0x6c8(%rbp), %rdi
callq 0x55a0
jmp 0x1d557
movq %rax, %rbx
jmp 0x1d535
jmp 0x1d426
jmp 0x1d4cb
movq %rax, %rbx
jmp 0x1d520
movq %rax, %rbx
jmp 0x1d62a
jmp 0x1d426
movq %rax, %rbx
jmp 0x1d5ae
movq %rax, %rbx
jmp 0x1d457
jmp 0x1d4cb
jmp 0x1d4a4
movq %rax, %rbx
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x1d457
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x6c8(%rbp), %rdi
leaq -0x6b8(%rbp), %rax
cmpq %rax, %rdi
je 0x1d479
movq -0x6b8(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x4c8(%rbp), %rdi
leaq -0x4b8(%rbp), %rax
cmpq %rax, %rdi
je 0x1d5ae
movq -0x4b8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1d5ae
movq %rax, %rbx
movq -0x200(%rbp), %rdi
leaq -0x1f0(%rbp), %rax
cmpq %rax, %rdi
je 0x1d4ce
movq -0x1f0(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0x1d4ce
movq %rax, %rbx
movq -0x6c8(%rbp), %rdi
testq %rdi, %rdi
je 0x1d4fe
movq -0x6a8(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq $0x0, -0x6c8(%rbp)
movl $0x0, -0x6c0(%rbp)
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0x1d520
movq -0x130(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x1d535
movq -0x70(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0x1d557
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0xe0(%rbp), %rdi
callq 0xab8e
leaq -0x4c8(%rbp), %rdi
callq 0x50d0
leaq -0x158(%rbp), %rdi
callq 0xab8e
leaq -0xc0(%rbp), %rdi
callq 0xab8e
movq -0x108(%rbp), %rdi
testq %rdi, %rdi
je 0x1d5a2
movq -0xe8(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
leaq -0x1e0(%rbp), %rdi
callq 0xab8e
leaq 0x23643(%rip), %rax     # 0x40bf8
leaq -0x7d0(%rbp), %r14
movq %rax, -0x10(%r14)
leaq 0x23659(%rip), %rax     # 0x40c20
movq %rax, (%r14)
movq $0x0, -0x8(%r14)
leaq 0x2355f(%rip), %rsi     # 0x40b38
leaq -0x968(%rbp), %rdi
callq 0x7922
movq %r14, %rdi
callq 0x5120
movq -0x120(%rbp), %rdi
testq %rdi, %rdi
je 0x1d608
movq -0x110(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x1c8(%rbp), %rdi
leaq -0x1b8(%rbp), %rax
cmpq %rax, %rdi
je 0x1d62a
movq -0x1b8(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x248(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1d649
movq -0x248(%rbp), %rsi
incq %rsi
callq 0x53c0
leaq -0x288(%rbp), %rdi
callq 0x1d744
leaq -0x2c0(%rbp), %rdi
callq 0x1876c
movq %rbx, %rdi
callq 0x56a0
nop