// File: /workspace/github_cpp_makefile_star2_O3/simonrharris[P]SKA/src/sk_compare.cpp
// Function: compareKmerFiles(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 compareKmerFiles(const std::string & queryfile, const std::vector < std::string > & subjectfiles)
{

	// Create the kmer map
	std::unordered_map < std::string, char > kmerMap;

	//std::vector < std::string > sampleNames;
	//if (collectSampleNames(subjectfiles, sampleNames, false)!=0){return 1;}
	//int numSamples=sampleNames.size();
	//std::string emptySequence (numSamples , '-');
	

	int querykmersize;
	std::vector < std::string > querySampleNames;

	std::ifstream fileStream;

	if (openFileStream(queryfile, fileStream, false)){return 1;};		
		
	readKmerHeader(fileStream, querykmersize, querySampleNames);

	char base;
	char kmerbuffer[querykmersize*2/3];
	char asciibuffer[int(ceil(float(querySampleNames.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 verctor of bools
		while (fileStream.peek()!='\n' && fileStream.get(base)){
			fileStream.read(kmerbuffer, sizeof(kmerbuffer));
			std::string kmer (kmerbuffer, querykmersize*2/3);
			
			std::unordered_map < std::string, char >::iterator it = kmerMap.find(kmer);//check if the kmer is in the hash
			if ( it != kmerMap.end() ){//if the kmer is in the hash
				it->second='N';
			}
			else {
				kmerMap.insert(std::make_pair(kmer, base));
			}
		}
		fileStream.ignore(256,'\n');//skip the end ofline character
	}
	querySampleNames.clear();
	fileStream.close();

	std::cout << "Subject\tKmers unique to Query\tKmers unique to Subject\tMatches\t% kmers in Query matching\t% kmers in Subject matching\tSNPs\t%ID of matching kmers\t%ID of Query kmers\t%ID of Subject kmers\tNs in Query\tNs in Subject\tNs in both" << std::endl;
	
	for (int s = 0; s < subjectfiles.size(); ++s){
		fileStream.open(subjectfiles[s], std::ios::in);
		if (fileStream.fail()) {
			std::cerr << "Failed to open " << subjectfiles[s] << std::endl << std::endl;
			return 1;
		}
		int subjectkmersize;
		std::vector < std::string > subjectSampleNames;
		
		try {
				int returnval = readKmerHeader(fileStream, subjectkmersize, subjectSampleNames);
			}
			catch (int e){
				std::cerr << "An exception occurred when reading file " << subjectfiles[s] << ". Please check the format. Exception Nr. " << e << std::endl;
				return 1;
			}
		if (subjectkmersize!=querykmersize){
			std::cout << subjectfiles[s] << " has different kmer size to query" << std::endl;
			return 1;
		}

		
		std::vector < int > kmerjustinsubject (subjectSampleNames.size(), 0);
		std::vector < int > snps (subjectSampleNames.size(), 0);
		std::vector < int > ninsubject (subjectSampleNames.size(), 0);
		std::vector < int > ninquery (subjectSampleNames.size(), 0);
		std::vector < int > ninboth (subjectSampleNames.size(), 0);
		std::vector < int > matches (subjectSampleNames.size(), 0);

		char base;
		char kmerbuffer[querykmersize*2/3];
		char asciibuffer[int(ceil(float(subjectSampleNames.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 verctor of bools

			int nb=0;
			int nq=0;
			int ns=0;
			int m=0;
			int sn=0;
			int js=0;

			while (fileStream.peek()!='\n' && fileStream.get(base)){
				base=toupper(base);
				fileStream.read(kmerbuffer, sizeof(kmerbuffer));
				std::string kmer (kmerbuffer, querykmersize*2/3);

				std::unordered_map < std::string, char >::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=='N' && base=='N'){
						nb++;
					}
					else if (it->second=='N'){
						nq++;
					}
					else if (base=='N'){
						ns++;
					}
					else if (it->second==base){
						m++;
					}
					else {
						sn++;
					}
				}
				else {
					js++;
				}
	    	}
	    	for (int i=0; i<subjectSampleNames.size(); ++i){ //add the base to all samples that are true in the bitset
				if (mybits[i]){
					ninboth[i]+=nb;
					ninquery[i]+=nq;
					ninsubject[i]+=ns;
					matches[i]+=m;
					snps[i]+=sn;
					kmerjustinsubject[i]+=js;
				}
			}
	    	fileStream.ignore(256,'\n');//skip the end ofline character
	    }
		fileStream.close();
		
		for (int i=0; i<subjectSampleNames.size(); ++i){

			int kmerjustinquery=kmerMap.size()-(matches[i]+snps[i]+ninquery[i]+ninboth[i]+ninsubject[i]);
			float percentmatchquery=float(matches[i]+snps[i]+ninquery[i]+ninboth[i])/(kmerjustinquery+matches[i]+snps[i]+ninquery[i]+ninboth[i])*100;
			float percentmatchsubject=float(matches[i]+snps[i]+ninsubject[i]+ninboth[i])/(kmerjustinsubject[i]+matches[i]+snps[i]+ninsubject[i]+ninboth[i])*100;
			float percentidofmatches=float(matches[i])/(matches[i]+snps[i])*100;
			float percentidofquery=(percentidofmatches*percentmatchquery)/100;
			float percentidofsubject=(percentidofmatches*percentmatchsubject)/100;
			
			std::cout << subjectSampleNames[i] << "\t" << kmerjustinquery << "\t" << kmerjustinsubject[i] << "\t" << (matches[i]+snps[i]+ninquery[i]+ninboth[i]+ninsubject[i]) << "\t" << percentmatchquery << "\t" << percentmatchsubject << "\t" << snps[i] << "\t" << percentidofmatches << "\t" << percentidofquery << "\t" << percentidofsubject << "\t" << ninquery[i] << "\t" << ninsubject[i] << "\t" << ninboth[i] << std::endl;

		}
	}
	return 0;
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movq %rsi, -0x80(%rbp)
movq %rdi, %rbx
leaq -0x1d8(%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)
movaps %xmm0, -0x120(%rbp)
movq $0x0, -0x110(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x5410
leaq -0x410(%rbp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x7f3f
movl $0x1, %ebx
testl %eax, %eax
jne 0xfbee
leaq -0x410(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0x9684
movq %rsp, -0x1b8(%rbp)
movl -0x3c(%rbp), %eax
addl %eax, %eax
cltq
imulq $0x55555556, %rax, %rbx # imm = 0x55555556
movq %rbx, %rax
shrq $0x3f, %rax
shrq $0x20, %rbx
addl %eax, %ebx
leaq 0xf(%rbx), %rax
andq $-0x10, %rax
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
movq -0x118(%rbp), %rax
subq -0x120(%rbp), %rax
sarq $0x5, %rax
js 0xeef8
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0xef10
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0x24768(%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, -0x78(%rbp)
movq %rdx, -0x48(%rbp)
leaq (%rdx,%rcx), %rax
movq %rax, -0x50(%rbp)
leaq -0x98(%rbp), %r12
leaq -0x410(%rbp), %r13
leaq -0xc8(%rbp), %r15
movq %r14, -0x38(%rbp)
movq %r13, %rdi
movq -0x48(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0x5480
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xf10e
leaq -0xd8(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0xe8(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x85fc
movq %r13, %rdi
callq 0x5140
cmpl $0xa, %eax
je 0xf0d1
movq %r13, %rdi
leaq -0x2a(%rbp), %rsi
callq 0x5500
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xf0d1
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5480
movl -0x3c(%rbp), %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 -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
addq %r14, %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x85fc
leaq -0x208(%rbp), %rdi
movq %r15, %rsi
callq 0x100f6
testq %rax, %rax
je 0xf030
movb $0x4e, 0x28(%rax)
jmp 0xf0a6
movq %r13, %r14
movq %r15, %r13
movq %rbx, %r15
movq %r12, %rbx
movq %r12, -0xa8(%rbp)
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %r12
movq %r12, %rdi
callq 0x8566
movb -0x2a(%rbp), %al
movb %al, -0x88(%rbp)
leaq -0x208(%rbp), %rdi
movq %r12, %rsi
callq 0x101f2
movq -0xa8(%rbp), %rdi
movq %rbx, %r12
cmpq %rbx, %rdi
je 0xf099
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x53c0
movq %r15, %rbx
movq %r13, %r15
movq %r14, %r13
movq -0x38(%rbp), %r14
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0xef9f
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0xef9f
movl $0x100, %esi            # imm = 0x100
movq %r13, %rdi
movl $0xa, %edx
callq 0x5220
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0xef5b
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0xef5b
movq -0x120(%rbp), %rbx
movq -0x118(%rbp), %r14
cmpq %rbx, %r14
je 0xf150
leaq 0x10(%rbx), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0xf139
movq (%r15), %rsi
incq %rsi
callq 0x53c0
leaq 0x20(%r15), %rax
addq $0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0xf125
movq %rbx, -0x118(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x50b0
movq 0x31e5d(%rip), %rbx     # 0x40fc0
leaq 0x246a6(%rip), %rsi     # 0x33810
movl $0xdb, %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 0x31e2b(%rip), %rdi     # 0x40fc0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq -0x80(%rbp), %rax
movq (%rax), %rsi
cmpq %rsi, 0x8(%rax)
je 0xfae9
leaq -0x410(%rbp), %rbx
leaq -0x70(%rbp), %r15
leaq -0xa8(%rbp), %r12
xorl %r13d, %r13d
movq %r13, %r14
shlq $0x5, %r14
addq %r14, %rsi
movq %rbx, %rdi
movl $0x8, %edx
callq 0x5350
movq -0x410(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x3f0(%rbp,%rax)
jne 0xfaf0
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movq %rbx, %rdi
leaq -0xfc(%rbp), %rsi
movq %r15, %rdx
callq 0x9684
movl -0xfc(%rbp), %eax
cmpl -0x3c(%rbp), %eax
leaq -0xe8(%rbp), %r15
jne 0xfb7f
movq -0x68(%rbp), %rsi
subq -0x70(%rbp), %rsi
sarq $0x5, %rsi
movl $0x0, -0xa8(%rbp)
leaq -0x1b0(%rbp), %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0xfedc
movq -0x68(%rbp), %rsi
subq -0x70(%rbp), %rsi
sarq $0x5, %rsi
movl $0x0, -0xa8(%rbp)
leaq -0x180(%rbp), %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0xfedc
movq -0x68(%rbp), %rsi
subq -0x70(%rbp), %rsi
sarq $0x5, %rsi
movl $0x0, -0xa8(%rbp)
leaq -0x168(%rbp), %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0xfedc
movq -0x68(%rbp), %rsi
subq -0x70(%rbp), %rsi
sarq $0x5, %rsi
movl $0x0, -0xa8(%rbp)
leaq -0x150(%rbp), %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0xfedc
movq -0x68(%rbp), %rsi
subq -0x70(%rbp), %rsi
sarq $0x5, %rsi
movl $0x0, -0xa8(%rbp)
leaq -0x138(%rbp), %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0xfedc
movq %r13, -0x1c8(%rbp)
movq -0x68(%rbp), %rsi
subq -0x70(%rbp), %rsi
sarq $0x5, %rsi
movl $0x0, -0xa8(%rbp)
leaq -0x198(%rbp), %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0xfedc
movq %rsp, -0x1c0(%rbp)
movl -0x3c(%rbp), %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, -0x48(%rbp)
leaq 0xf(%rcx), %rax
andq $-0x10, %rax
movq %rsp, %r13
subq %rax, %r13
movq %r13, %rsp
movq -0x68(%rbp), %rax
subq -0x70(%rbp), %rax
sarq $0x5, %rax
js 0xf372
cvtsi2ss %rax, %xmm0
jmp 0xf387
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
divss 0x242f1(%rip), %xmm0    # 0x33680
callq 0x51e0
cvttss2si %xmm0, %ecx
leaq 0xf(%rcx), %rax
andq $-0x10, %rax
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
movq %rcx, -0xf8(%rbp)
leaq (%r14,%rcx), %rax
movq %rax, -0xf0(%rbp)
movq %r14, -0x1d0(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
movq -0xf8(%rbp), %rdx
callq 0x5480
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xf661
leaq -0xd8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq %r15, %rdi
movq %r14, %rsi
movq -0xf0(%rbp), %rdx
callq 0x85fc
xorl %eax, %eax
movq %rax, -0xa8(%rbp)
movl %eax, -0xa0(%rbp)
movq %rax, -0x98(%rbp)
movl %eax, -0x90(%rbp)
movq %rax, -0x88(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x8993
movl $0x0, -0x38(%rbp)
movl $0x0, -0x78(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x0, -0x30(%rbp)
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x5140
cmpl $0xa, %eax
je 0xf55f
movq %rbx, %rdi
leaq -0x29(%rbp), %rsi
callq 0x5500
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xf55f
movsbl -0x29(%rbp), %edi
callq 0x56d0
movb %al, -0x29(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
movq -0x48(%rbp), %rdx
callq 0x5480
movl -0x3c(%rbp), %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 -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
addq %r13, %rdx
leaq -0xc8(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x85fc
leaq -0x208(%rbp), %rdi
movq %r12, %rsi
callq 0x100f6
testq %rax, %rax
je 0xf510
movb 0x28(%rax), %al
movl %eax, %edx
xorb $0x4e, %dl
movb -0x29(%rbp), %cl
movl %ecx, %esi
xorb $0x4e, %sil
orb %dl, %sil
jne 0xf515
incl %r15d
jmp 0xf534
incl %r14d
jmp 0xf534
cmpb $0x4e, %al
jne 0xf51e
incl -0x38(%rbp)
jmp 0xf534
cmpb $0x4e, %cl
jne 0xf528
incl -0x78(%rbp)
jmp 0xf534
cmpb %cl, %al
jne 0xf531
incl -0x50(%rbp)
jmp 0xf534
incl -0x30(%rbp)
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0xf456
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0xf456
movq -0x68(%rbp), %rax
subq -0x70(%rbp), %rax
je 0xf5ed
sarq $0x5, %rax
movq -0xa8(%rbp), %rcx
movq -0x138(%rbp), %rdx
movq -0x150(%rbp), %rsi
movq -0x168(%rbp), %rdi
movq -0x198(%rbp), %r8
movq -0x180(%rbp), %r9
movq -0x1b0(%rbp), %r10
cmpq $0x1, %rax
adcq $0x0, %rax
xorl %ebx, %ebx
movl %ebx, %r11d
shrl $0x6, %r11d
movq (%rcx,%r11,8), %r11
btq %rbx, %r11
jae 0xf5e5
addl %r15d, (%rdx,%rbx,4)
movl -0x38(%rbp), %r11d
addl %r11d, (%rsi,%rbx,4)
movl -0x78(%rbp), %r11d
addl %r11d, (%rdi,%rbx,4)
movl -0x50(%rbp), %r11d
addl %r11d, (%r8,%rbx,4)
movl -0x30(%rbp), %r11d
addl %r11d, (%r9,%rbx,4)
addl %r14d, (%r10,%rbx,4)
incq %rbx
cmpq %rbx, %rax
jne 0xf5ac
movl $0x100, %esi            # imm = 0x100
leaq -0x410(%rbp), %rbx
movq %rbx, %rdi
movl $0xa, %edx
callq 0x5220
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
leaq -0xa8(%rbp), %r12
leaq -0xe8(%rbp), %r15
movq -0x1d0(%rbp), %r14
je 0xf636
movq -0x88(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0xf3c2
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0xf3c2
movq %rbx, %rdi
callq 0x50b0
movq -0x70(%rbp), %rax
cmpq %rax, -0x68(%rbp)
je 0xfa01
xorl %edx, %edx
movq $0x0, -0x78(%rbp)
movl -0x1f0(%rbp), %r15d
movq -0x198(%rbp), %rcx
movl (%rcx,%rdx), %esi
movq -0x180(%rbp), %rcx
movl (%rcx,%rdx), %edi
movl %esi, -0xf0(%rbp)
addl %esi, %edi
movq -0x150(%rbp), %rcx
movl (%rcx,%rdx), %r14d
movq -0x138(%rbp), %rcx
movl (%rcx,%rdx), %ecx
movq %rdi, -0x48(%rbp)
movq %rcx, -0x50(%rbp)
leal (%rcx,%rdi), %r12d
movq -0x168(%rbp), %rcx
movl (%rcx,%rdx), %ebx
leal (%r12,%rbx), %esi
movq -0x1b0(%rbp), %rcx
movl (%rcx,%rdx), %ecx
movl %esi, -0x30(%rbp)
addl %esi, %ecx
movl %ecx, -0xf8(%rbp)
movq (%rax,%rdx,8), %rsi
movq %rdx, -0x38(%rbp)
movq 0x8(%rax,%rdx,8), %rdx
movq 0x318c4(%rip), %rdi     # 0x40fc0
callq 0x5420
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x24b8e(%rip), %rsi     # 0x342a1
callq 0x5420
addl %r14d, %r12d
addl %r12d, %ebx
subl %ebx, %r15d
movq %r13, %rdi
movl %r15d, %esi
callq 0x5690
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x24b63(%rip), %rsi     # 0x342a1
callq 0x5420
movq -0x1b0(%rbp), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx), %esi
movq %r13, %rdi
callq 0x5690
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x24b36(%rip), %rsi     # 0x342a1
callq 0x5420
movq -0x198(%rbp), %rax
movq -0x180(%rbp), %rcx
movq -0x38(%rbp), %rdx
movl (%rcx,%rdx), %esi
addl (%rax,%rdx), %esi
movq -0x150(%rbp), %rax
addl (%rax,%rdx), %esi
movq -0x138(%rbp), %rax
addl (%rax,%rdx), %esi
movq -0x168(%rbp), %rax
addl (%rax,%rdx), %esi
movq %r13, %rdi
callq 0x5690
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x24ae1(%rip), %rsi     # 0x342a1
callq 0x5420
cvtsi2ss %r12d, %xmm1
addl -0x50(%rbp), %r14d
addl -0x48(%rbp), %r14d
addl %r15d, %r14d
cvtsi2ss %r14d, %xmm0
divss %xmm0, %xmm1
mulss 0x23e96(%rip), %xmm1    # 0x3367c
movss %xmm1, -0x50(%rbp)
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movq %r13, %rdi
callq 0x5610
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x24a95(%rip), %rsi     # 0x342a1
callq 0x5420
xorps %xmm1, %xmm1
cvtsi2ssl -0x30(%rbp), %xmm1
xorps %xmm0, %xmm0
cvtsi2ssl -0xf8(%rbp), %xmm0
divss %xmm0, %xmm1
mulss 0x23e4c(%rip), %xmm1    # 0x3367c
movss %xmm1, -0x30(%rbp)
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movq %r15, %rdi
callq 0x5610
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x24a4b(%rip), %rsi     # 0x342a1
callq 0x5420
movq -0x180(%rbp), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx), %esi
movq %r15, %rdi
callq 0x5690
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x24a1e(%rip), %rsi     # 0x342a1
callq 0x5420
xorps %xmm1, %xmm1
cvtsi2ssl -0xf0(%rbp), %xmm1
xorps %xmm0, %xmm0
cvtsi2ssl -0x48(%rbp), %xmm0
divss %xmm0, %xmm1
mulss 0x23dd5(%rip), %xmm1    # 0x3367c
movss %xmm1, -0x48(%rbp)
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movq %r15, %rdi
callq 0x5610
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x249d4(%rip), %rsi     # 0x342a1
callq 0x5420
movss -0x50(%rbp), %xmm0
mulss -0x48(%rbp), %xmm0
divss 0x23d98(%rip), %xmm0    # 0x3367c
cvtss2sd %xmm0, %xmm0
movq %r15, %rdi
callq 0x5610
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2499f(%rip), %rsi     # 0x342a1
callq 0x5420
movss -0x48(%rbp), %xmm0
mulss -0x30(%rbp), %xmm0
divss 0x23d63(%rip), %xmm0    # 0x3367c
cvtss2sd %xmm0, %xmm0
movq %r15, %rdi
callq 0x5610
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2496a(%rip), %rsi     # 0x342a1
callq 0x5420
movq -0x150(%rbp), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx), %esi
movq %r15, %rdi
callq 0x5690
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2493d(%rip), %rsi     # 0x342a1
callq 0x5420
movq -0x168(%rbp), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx), %esi
movq %r15, %rdi
callq 0x5690
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x24910(%rip), %rsi     # 0x342a1
callq 0x5420
movq -0x138(%rbp), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx), %esi
movq %r15, %rdi
callq 0x5690
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 -0x78(%rbp), %rdi
incq %rdi
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
movq -0x38(%rbp), %rdx
addq $0x4, %rdx
movq %rdi, -0x78(%rbp)
cmpq %rdi, %rcx
ja 0xf681
movq -0x1c0(%rbp), %rsp
movq -0x198(%rbp), %rdi
testq %rdi, %rdi
je 0xfa23
movq -0x188(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
leaq -0x70(%rbp), %r15
movq -0x1c8(%rbp), %r13
je 0xfa49
movq -0x128(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x150(%rbp), %rdi
testq %rdi, %rdi
leaq -0xa8(%rbp), %r12
je 0xfa6b
movq -0x140(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x168(%rbp), %rdi
testq %rdi, %rdi
leaq -0x410(%rbp), %rbx
je 0xfa8d
movq -0x158(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x180(%rbp), %rdi
testq %rdi, %rdi
je 0xfaa8
movq -0x170(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x1b0(%rbp), %rdi
testq %rdi, %rdi
je 0xfac3
movq -0x1a0(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq %r15, %rdi
callq 0xab8e
incq %r13
movq -0x80(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r13, %rax
ja 0xf1c8
xorl %ebx, %ebx
jmp 0xfbe7
movq 0x314f9(%rip), %rdi     # 0x40ff0
leaq 0x23939(%rip), %rsi     # 0x33437
movl $0xf, %edx
callq 0x5420
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r14), %rsi
movq 0x8(%rax,%r14), %rdx
movq 0x314d1(%rip), %rdi     # 0x40ff0
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 %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, %ebx
movq %rax, %rdi
callq 0x5250
jmp 0xfbe7
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r14), %rsi
movq 0x8(%rax,%r14), %rdx
movq 0x3142a(%rip), %rdi     # 0x40fc0
callq 0x5420
movq %rax, %rbx
leaq 0x23d9a(%rip), %rsi     # 0x3393f
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 -0x70(%rbp), %rdi
callq 0xab8e
movl $0x1, %ebx
movq -0x1b8(%rbp), %rsp
leaq -0x410(%rbp), %rdi
callq 0x50d0
leaq -0x120(%rbp), %rdi
callq 0xab8e
leaq -0x208(%rbp), %rdi
callq 0x10058
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xfc59
jmp 0xfd01
movq %rax, %r15
jmp 0xfebb
jmp 0xfd01
jmp 0xfd01
jmp 0xfdbf
movq %rax, %r15
jmp 0xfe1f
movq %rax, %r15
jmp 0xfe70
movq %rax, %r15
jmp 0xfe55
movq %rax, %r15
jmp 0xfea6
movq %rax, %r15
jmp 0xfe3a
movq %rax, %r15
jmp 0xfe8b
movq %rax, %r15
cmpl $0x1, %edx
jne 0xfea6
movq %r15, %rdi
callq 0x5160
movl (%rax), %ebx
movq 0x31362(%rip), %rdi     # 0x40ff0
leaq 0x23c57(%rip), %rsi     # 0x338ec
movl $0x28, %edx
callq 0x5420
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r14), %rsi
movq 0x8(%rax,%r14), %rdx
movq 0x3133a(%rip), %rdi     # 0x40ff0
callq 0x5420
movq %rax, %r14
leaq 0x23c50(%rip), %rsi     # 0x33915
movl $0x29, %edx
movq %rax, %rdi
callq 0x5420
movq %r14, %rdi
movl %ebx, %esi
callq 0x5690
movq %rax, %rdi
callq 0x5190
callq 0x5630
jmp 0xfbd9
movq %rax, %r15
callq 0x5630
jmp 0xfea6
jmp 0xfd01
jmp 0xfd68
jmp 0xfd01
movq %rax, %r15
jmp 0xfeaf
movq %rax, %r15
movq -0xa8(%rbp), %rdi
cmpq %rbx, %rdi
je 0xfd42
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0xfd42
jmp 0xfd3f
jmp 0xfdc4
jmp 0xfdbf
jmp 0xfdc4
jmp 0xfdbf
movq %rax, %r15
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0xfd6b
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0xfd6b
jmp 0xfd68
movq %rax, %r15
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0xfeaf
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0xfeaf
jmp 0xfdc4
movq %rax, %r15
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0xfdc7
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x53c0
jmp 0xfdc7
movq %rax, %r15
jmp 0xfe04
movq %rax, %r15
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0xfde2
movq -0x88(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0xfe04
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x53c0
movq -0x198(%rbp), %rdi
testq %rdi, %rdi
je 0xfe1f
movq -0x188(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
je 0xfe3a
movq -0x128(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x150(%rbp), %rdi
testq %rdi, %rdi
je 0xfe55
movq -0x140(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x168(%rbp), %rdi
testq %rdi, %rdi
je 0xfe70
movq -0x158(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x180(%rbp), %rdi
testq %rdi, %rdi
je 0xfe8b
movq -0x170(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq -0x1b0(%rbp), %rdi
testq %rdi, %rdi
je 0xfea6
movq -0x1a0(%rbp), %rsi
subq %rdi, %rsi
callq 0x53c0
leaq -0x70(%rbp), %rdi
callq 0xab8e
leaq -0x410(%rbp), %rdi
callq 0x50d0
leaq -0x120(%rbp), %rdi
callq 0xab8e
leaq -0x208(%rbp), %rdi
callq 0x10058
movq %r15, %rdi
callq 0x56a0
nop