// File: /workspace/github_cpp_makefile_star2_O2/CK7[P]abawaca/src/abawaca-build.cpp
// Function: main
int main(int argc, const char* argv[])
{
	size_t	window_size = 2000;
	size_t	max_snps = 15;

	if(argc < 5) {
		usage(argv[0]);
		return -1;
	}

	string	assembly_file;
	string	out_directory;
	string	sam_glob;
	string	this_sample_str;

	for(auto i=1; i<argc; i+=2) {
		if(!strcmp(argv[i], "-f"))
			assembly_file = argv[i+1];
		else if(!strcmp(argv[i], "-o"))
			out_directory = argv[i+1];
		else if(!strcmp(argv[i], "-s"))
			sam_glob = argv[i+1];
		else if(!strcmp(argv[i], "-c"))
			this_sample_str = argv[i+1];
		else {
			cerr << endl << "Unknown option " << argv[i] << endl << endl;
			return -1;
		}
	}

	if(assembly_file.size() == 0) {
		cerr << endl << "Error: assembly file was not specified (-f)" << endl << endl;
		return -1;
	}
	if(out_directory.size() == 0) {
		cerr << endl << "Error: output directory was not specified (-o)" << endl << endl;
		return -1;
	}
	if(sam_glob.size() == 0) {
		cerr << endl << "Error: glob path for sam files was not specified (-s)" << endl << endl;
		return -1;
	}
	if(this_sample_str.size() == 0) {
		cerr << endl << "Error: path for sam file for the assembly\'s reads was not specified (-f)" << endl << endl;
		return -1;
	}

	cerr << time_since_epoch() << "Reading assembly file (" << assembly_file << ")" << endl;
	map<string, Scaf*>			scafs;
	Bio::SeqIORead_fasta<Bio::DNASequence>  in(assembly_file);
	Bio::DNASequence*                       seq = NULL;
	size_t ndps = 0;
	while((seq = in.next_seq()) != NULL) {
		Scaf*	s = new Scaf(*seq, window_size);
 		scafs.insert(pair<string, Scaf*>(seq->display_id(), s));
		ndps += s->ndps();
	}

	char names_file[1024], lrn_file[1024], info_file[1024], links_file[1024];

	sprintf(names_file, "%s/abawaca.names", out_directory.c_str());
	sprintf(lrn_file, "%s/abawaca.lrn", out_directory.c_str());
	sprintf(info_file, "%s/abawaca.info", out_directory.c_str());
	sprintf(links_file, "%s/abawaca.links", out_directory.c_str());

	cerr << time_since_epoch() << "Creating .lrn (" << lrn_file << ") and .names (" << names_file << ") files" << endl;

	if(!directory_exists(out_directory.c_str())) {
		char	cmd[1024];
		sprintf(cmd, "mkdir %s", out_directory.c_str());
		system(cmd);
	}

	if(sam_glob.size() > 0) {
		vector<string>	sam_files = glob(sam_glob);
		for(auto vit=sam_files.begin(); vit!=sam_files.end(); vit++) {
			cerr  << time_since_epoch() << "Reading SAM file " << *vit << endl;
			dimension2index.insert(pair<string, size_t>(*vit, dimension_order.size()));
			dimension_order.push_back(*vit);

			size_t dimension = dimension2index[*vit];

			if(this_sample_str == *vit)
				this_sample = dimension;

			size_t 					insert_size = calc_insert_size(*vit);
			cerr  << time_since_epoch() << "Insert size is " << insert_size << endl;

			Bio::SAMReader  			reader(*vit);
			unordered_map<string, Bio::ReadMappingPtr>	reads;
			Links					links(insert_size, scafs);
			while(reader.good()) {
				Bio::ReadMappingPtr mapping(reader.next_mapping());
				if(mapping == NULL) {
					break;
				}

				if(dimension == this_sample) {
					string insert_name = mapping->read_name();
					size_t	p = insert_name.find_last_of('/');
					if(p != string::npos)
						insert_name.resize(p);
					auto rit = reads.find(insert_name);
					if(rit == reads.end()) {
						reads.insert(pair<string, Bio::ReadMappingPtr>(insert_name, mapping));
					}
					else {
						Bio::ReadMappingPtr mapping_other = rit->second;
						reads.erase(rit);
						links.add_pair(mapping, mapping_other);
					}
				}
				if(mapping->unmapped() || (mapping->num_snps() > max_snps) || mapping->multiple_hits()) {
					continue;
				}
				auto mit = scafs.find(mapping->ref_name());
				if(mit != scafs.end())
					mit->second->add_mapped_read(*mapping, dimension);
			}
			if(dimension == this_sample) {
				ofstream	oslinks(links_file);
				links.write_connections(oslinks);
				oslinks.close();
			}
		}
	}

	FILE* fout = fopen(names_file, "w");
	FILE* flrn = fopen(lrn_file, "w");
	FILE* finfo = fopen(info_file, "w");

	if(fout == NULL) {
		cerr << "Could not write to " << names_file << endl << endl;
		return -1;
	}
	if(flrn == NULL) {
		cerr << "Could not write to " << lrn_file << endl << endl;
		return -1;
	}
	if(finfo == NULL) {
		cerr << "Could not write to " << info_file << endl << endl;
		return -1;
	}

	fprintf(fout, "%c %lu\n", '%', ndps);
	fprintf(flrn, "%c %lu\n", '%', ndps);

	// We do not output the frequency of A/T
	fprintf(flrn, "%c %lu\n", '%', dimension_order.size());
	fprintf(flrn, "%c 9", '%');
	for(auto it=dimension_order.begin(); it!=dimension_order.end(); it++)
		if(*it != string("A"))
			fprintf(flrn, "\t1");
	fprintf(flrn, "\n");

	fprintf(flrn, "%c Key", '%');
	for(auto it=dimension_order.begin(); it!=dimension_order.end(); it++)
		if(*it != string("A"))
			fprintf(flrn, "\t%s", it->c_str());
	fprintf(flrn, "\n");

	int i=0;
	for(auto it=scafs.begin(); it!=scafs.end(); it++) {
		fprintf(finfo, "%s\t%lu\t%.3lf\t%.3lf\t%lu\n", it->second->get_display_id().c_str(), it->second->get_seq().size(), int(1000.0*it->second->cvg())/1000.0, int(1000.0*it->second->gc())/1000.0, it->second->Ns());
		for(auto sit=it->second->begin(); sit!=it->second->end(); sit++) {
			fprintf(fout, "%d\t%s\t%s\n", ++i, (*sit)->get_display_id().c_str(), (*sit)->get_desc().c_str());
			fprintf(flrn, "%d", i);
			for(auto mit=dimension_order.begin(); mit!=dimension_order.end(); mit++) {
				if(*mit != string("A"))
					fprintf(flrn, "\t%.3lf", int(1000.0*(*sit)->get_dimension(*mit))/1000.0);
			}
			fprintf(flrn, "\n");
		}
	}

	fclose(fout);
	fclose(flrn);
	fclose(finfo);

	cerr << time_since_epoch() << "Predicting genes and SCGs" << endl;
	string scg_file = prepare_scgs(assembly_file, out_directory);
	char data[2048];
	sprintf(data, "%s/data.txt", out_directory.c_str());
	FILE* fp = fopen(data, "w");

	if(fp == NULL) {
		cerr << "Could not write to " << data << endl << endl;
		return -1;
	}

	fprintf(fp, "SCG\t%s\n", scg_file.c_str());
	fprintf(fp, "Links\t%s\n", links_file);
	fprintf(fp, "Info\t%s\n", info_file);
	fprintf(fp, "Names\t%s\n", names_file);
	fprintf(fp, "Lrn\t%s\n", lrn_file);
	fprintf(fp, "Assembly\t%s\n", assembly_file.c_str());
	fclose(fp);

	cerr << time_since_epoch() << "Finished successfully" << endl;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1ae8, %rsp           # imm = 0x1AE8
movq %rsi, %rbx
cmpl $0x4, %edi
jg 0x834d
movq (%rbx), %rdi
callq 0x7ff0
pushq $-0x1
popq %rbx
jmp 0x8d24
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
leaq -0x80(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq -0x100(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq -0x188(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
movl %edi, %r15d
pushq $0x1
popq %r14
leaq -0xb0(%rbp), %r12
leaq -0x198(%rbp), %r13
cmpq %r15, %r14
jae 0x844b
movq (%rbx,%r14,8), %rax
cmpb $0x2d, (%rax)
jne 0x840f
cmpb $0x66, 0x1(%rax)
jne 0x83ca
cmpb $0x0, 0x2(%rax)
movq %r12, %rdi
je 0x83ff
cmpb $0x6f, 0x1(%rax)
jne 0x83dd
cmpb $0x0, 0x2(%rax)
leaq -0x90(%rbp), %rdi
je 0x83ff
cmpb $0x73, 0x1(%rax)
jne 0x83f0
cmpb $0x0, 0x2(%rax)
leaq -0x110(%rbp), %rdi
je 0x83ff
cmpb $0x63, 0x1(%rax)
jne 0x840f
cmpb $0x0, 0x2(%rax)
movq %r13, %rdi
jne 0x840f
movq 0x8(%rbx,%r14,8), %rsi
callq 0x4510
addq $0x2, %r14
jmp 0x83a9
movq 0xcbda(%rip), %rdi      # 0x14ff0
callq 0x4140
leaq 0x6300(%rip), %rsi      # 0xe722
movq %rax, %rdi
callq 0x4260
movq (%rbx,%r14,8), %rsi
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4140
movq %rax, %rdi
callq 0x4140
jmp 0x8cf1
cmpq $0x0, -0xa8(%rbp)
je 0x85b7
cmpq $0x0, -0x88(%rbp)
je 0x85cf
cmpq $0x0, -0x108(%rbp)
je 0x8b5e
cmpq $0x0, -0x190(%rbp)
je 0x8cc6
leaq -0xb10(%rbp), %rdi
callq 0xc98c
movq 0xcb5a(%rip), %rdi      # 0x14ff0
leaq -0xb10(%rbp), %rsi
callq 0x4220
leaq 0x6363(%rip), %rsi      # 0xe80c
movq %rax, %rdi
callq 0x4260
leaq -0xb0(%rbp), %rsi
movq %rax, %rdi
callq 0x4220
leaq 0x5e81(%rip), %rsi      # 0xe348
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4140
leaq -0xb10(%rbp), %rdi
callq 0x4130
leaq -0x170(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x240(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x43a0
leaq -0x310(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x97a2
leaq -0x240(%rbp), %rdi
callq 0x4130
movq $0x0, -0x60(%rbp)
leaq -0x310(%rbp), %rbx
leaq -0xb10(%rbp), %r14
movq %rbx, %rdi
callq 0x9810
movq %rax, %r12
testq %rax, %rax
je 0x85e7
movl $0x80, %edi
callq 0x4280
movq %rax, %r15
movl $0x7d0, %edx            # imm = 0x7D0
movq %rax, %rdi
movq %r12, %rsi
callq 0x74ce
addq $0x8, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x43a0
movq %r15, -0xaf0(%rbp)
leaq -0x178(%rbp), %rdi
movq %r14, %rsi
callq 0xbf10
movq %r14, %rdi
callq 0x4130
movq 0x68(%r15), %rax
subq 0x60(%r15), %rax
sarq $0x3, %rax
addq %rax, -0x60(%rbp)
jmp 0x8547
movq 0xca32(%rip), %rdi      # 0x14ff0
callq 0x4140
leaq 0x6168(%rip), %rsi      # 0xe732
jmp 0x8cd9
movq 0xca1a(%rip), %rdi      # 0x14ff0
callq 0x4140
leaq 0x617c(%rip), %rsi      # 0xe75e
jmp 0x8cd9
movq -0x90(%rbp), %rdx
leaq 0x622f(%rip), %rsi      # 0xe824
leaq -0x1310(%rbp), %rdi
xorl %eax, %eax
callq 0x4060
movq -0x90(%rbp), %rdx
leaq 0x6224(%rip), %rsi      # 0xe835
leaq -0xf10(%rbp), %rdi
xorl %eax, %eax
callq 0x4060
movq -0x90(%rbp), %rdx
leaq 0x6217(%rip), %rsi      # 0xe844
leaq -0x1b10(%rbp), %rdi
xorl %eax, %eax
callq 0x4060
movq -0x90(%rbp), %rdx
leaq 0x620b(%rip), %rsi      # 0xe854
leaq -0x1710(%rbp), %rdi
xorl %eax, %eax
callq 0x4060
leaq -0xb10(%rbp), %rdi
callq 0xc98c
movq 0xc986(%rip), %rdi      # 0x14ff0
leaq -0xb10(%rbp), %rsi
callq 0x4220
leaq 0x61e8(%rip), %rsi      # 0xe865
movq %rax, %rdi
callq 0x4260
leaq -0xf10(%rbp), %rsi
movq %rax, %rdi
callq 0x4260
leaq 0x61da(%rip), %rsi      # 0xe875
movq %rax, %rdi
callq 0x4260
leaq -0x1310(%rbp), %rsi
movq %rax, %rdi
callq 0x4260
leaq 0x61cb(%rip), %rsi      # 0xe884
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4140
leaq -0xb10(%rbp), %rdi
callq 0x4130
movq -0x90(%rbp), %rdi
callq 0xcd19
testl %eax, %eax
jne 0x870c
movq -0x90(%rbp), %rdx
leaq 0x6199(%rip), %rsi      # 0xe88c
leaq -0xb10(%rbp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4060
movq %rbx, %rdi
callq 0x41f0
cmpq $0x0, -0x108(%rbp)
je 0x8b82
leaq -0x128(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xcfe9
movq -0x128(%rbp), %r14
leaq -0x1d8(%rbp), %r13
leaq -0x280(%rbp), %r15
cmpq -0x120(%rbp), %r14
je 0x8b76
leaq -0xb10(%rbp), %rbx
movq %rbx, %rdi
callq 0xc98c
movq 0xc88b(%rip), %rdi      # 0x14ff0
movq %rbx, %rsi
callq 0x4220
movq %rax, %rdi
leaq 0x611e(%rip), %rsi      # 0xe895
callq 0x4260
movq %rax, %rdi
movq %r14, %rsi
callq 0x4220
movq %rax, %rdi
callq 0x4140
leaq -0xb10(%rbp), %r12
movq %r12, %rdi
callq 0x4130
movq 0xcbab(%rip), %rbx      # 0x15350
movq %r14, %rsi
movq 0xcb99(%rip), %r14      # 0x15348
movq %r12, %rdi
movq %rsi, -0x38(%rbp)
callq 0x43a0
subq %r14, %rbx
sarq $0x5, %rbx
movq %rbx, -0xaf0(%rbp)
leaq 0xcb48(%rip), %rdi      # 0x15318
movq %r12, %rsi
callq 0xa78c
movq %r12, %rdi
callq 0x4130
leaq 0xcb61(%rip), %rdi      # 0x15348
movq -0x38(%rbp), %rbx
movq %rbx, %rsi
callq 0x94cc
leaq 0xcb1e(%rip), %rdi      # 0x15318
movq %rbx, %rsi
callq 0x9bb4
movq (%rax), %r14
leaq -0x198(%rbp), %rdi
movq %rbx, %rsi
callq 0x9c1d
testb %al, %al
je 0x881f
movq %r14, 0xcb41(%rip)      # 0x15360
leaq -0x2c0(%rbp), %r12
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0x43a0
movq %r12, %rdi
callq 0x8044
movq %rax, %rbx
movq %r12, %rdi
callq 0x4130
leaq -0xb10(%rbp), %r12
movq %r12, %rdi
callq 0xc98c
movq 0xc795(%rip), %rdi      # 0x14ff0
movq %r12, %rsi
callq 0x4220
movq %rax, %rdi
leaq 0x603a(%rip), %rsi      # 0xe8a7
callq 0x4260
movq %rax, %rdi
movq %rbx, %rsi
callq 0x41b0
movq %rax, %rdi
callq 0x4140
leaq -0xb10(%rbp), %rdi
callq 0x4130
leaq -0x2a0(%rbp), %r12
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0x43a0
movq %r13, %rdi
movq %r12, %rsi
callq 0x9734
movq %r12, %rdi
callq 0x4130
leaq -0x1e0(%rbp), %rax
movq %rax, -0x210(%rbp)
movq $0x1, -0x208(%rbp)
movq %rbx, -0xf0(%rbp)
andl $0x0, -0xe0(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x20(%rax)
andq $0x0, -0xd8(%rbp)
movl $0x3f800000, -0x1f0(%rbp) # imm = 0x3F800000
movupd %xmm0, -0x8(%rax)
leaq -0xe0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq %rax, -0xc8(%rbp)
andq $0x0, -0xc0(%rbp)
leaq -0x178(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x48(%rbp), %r12
movq %r14, -0x30(%rbp)
movq %r13, %rdi
callq 0x6a2a
testb %al, %al
je 0x8af0
movq %r13, %rdi
callq 0x5ff8
movq %r12, %rdi
movq %rax, %rsi
callq 0xbb6a
movq -0x48(%rbp), %rsi
testq %rsi, %rsi
je 0x8ae7
cmpq 0xc9f8(%rip), %r14      # 0x15360
jne 0x8a82
addq $0x8, %rsi
movq %r15, %rdi
callq 0x43a0
movq %r15, %rdi
pushq $0x2f
popq %rsi
pushq $-0x1
popq %rdx
callq 0x4550
cmpq $-0x1, %rax
je 0x8999
movq %r15, %rdi
movq %rax, %rsi
callq 0x43b0
leaq -0x210(%rbp), %rdi
movq %r15, %rsi
callq 0xc38e
movq %rax, %rbx
testq %rax, %rax
je 0x8a4a
movq %r15, %r14
movq %r13, %r15
movq %rbx, %rsi
addq $0x28, %rsi
leaq -0xb10(%rbp), %r12
movq %r12, %rdi
callq 0xa1d8
leaq -0x210(%rbp), %rdi
movq %rbx, %rsi
callq 0xc7ea
leaq -0x148(%rbp), %rbx
movq %rbx, %rdi
leaq -0x48(%rbp), %rsi
callq 0xa1d8
leaq -0x138(%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0xa1d8
leaq -0xf0(%rbp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x7ad8
leaq -0x130(%rbp), %rdi
callq 0xa148
leaq -0x140(%rbp), %rdi
callq 0xa148
leaq -0xb08(%rbp), %rdi
callq 0xa148
leaq -0x48(%rbp), %r12
movq %r15, %r13
movq %r14, %r15
movq -0x30(%rbp), %r14
jmp 0x8a76
leaq -0xb10(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x9c40
leaq -0x210(%rbp), %rdi
movq %rbx, %rsi
callq 0xc48c
movq %rbx, %rdi
callq 0x9c66
movq %r15, %rdi
callq 0x4130
movq -0x48(%rbp), %rsi
movq 0x28(%rsi), %rcx
testb $0x4, %cl
jne 0x8ad9
movq 0xd8(%rsi), %rax
subq 0xd0(%rsi), %rax
cqto
pushq $0x28
popq %rdi
idivq %rdi
btl $0x8, %ecx
jb 0x8ad9
cmpq $0xf, %rax
ja 0x8ad9
addq $0x30, %rsi
leaq -0x178(%rbp), %rdi
callq 0xc900
leaq -0x170(%rbp), %rcx
cmpq %rcx, %rax
je 0x8ad9
movq 0x40(%rax), %rdi
movq -0x48(%rbp), %rsi
movq %r14, %rdx
callq 0x781a
leaq -0x40(%rbp), %rdi
callq 0xa148
jmp 0x8931
leaq -0x40(%rbp), %rdi
callq 0xa148
cmpq 0xc869(%rip), %r14      # 0x15360
movq -0x38(%rbp), %r14
jne 0x8b35
leaq -0xb10(%rbp), %rbx
movq %rbx, %rdi
leaq -0x1710(%rbp), %rsi
pushq $0x10
popq %rdx
callq 0x42d0
leaq -0xf0(%rbp), %rdi
movq %rbx, %rsi
callq 0x798c
movq %rbx, %rdi
callq 0x43c0
movq %rbx, %rdi
callq 0x43f0
leaq -0xf0(%rbp), %rdi
callq 0x78b6
leaq -0x210(%rbp), %rdi
callq 0xa216
movq %r13, %rdi
callq 0x6a8e
addq $0x20, %r14
jmp 0x8742
movq 0xc48b(%rip), %rdi      # 0x14ff0
callq 0x4140
leaq 0x5c1c(%rip), %rsi      # 0xe78d
jmp 0x8cd9
leaq -0x128(%rbp), %rdi
callq 0x5538
leaq 0x5d2e(%rip), %r12      # 0xe8b7
leaq -0x1310(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4300
movq %rax, %r13
leaq -0xf10(%rbp), %rdi
movq %r12, %rsi
callq 0x4300
movq %rax, %r14
leaq -0x1b10(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x4300
movq %rax, -0x68(%rbp)
movq %r13, -0x70(%rbp)
testq %r13, %r13
je 0x8d38
testq %r14, %r14
je 0x904d
cmpq $0x0, -0x68(%rbp)
je 0x91fb
movq %r14, %r13
leaq 0x5cdc(%rip), %r14      # 0xe8cd
pushq $0x25
popq %rbx
movq -0x70(%rbp), %rdi
movq %r14, %rsi
movl %ebx, %edx
movq -0x60(%rbp), %r15
movq %r15, %rcx
xorl %eax, %eax
callq 0x43d0
movq %r13, %rdi
movq %r14, %rsi
movl %ebx, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x43d0
movq 0xc72c(%rip), %rcx      # 0x15350
subq 0xc71d(%rip), %rcx      # 0x15348
sarq $0x5, %rcx
movq %r13, %rdi
movq %r14, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x43d0
leaq 0x5c90(%rip), %rsi      # 0xe8d5
movq %r13, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x43d0
movq 0xc6f0(%rip), %rbx      # 0x15348
leaq 0x5c7b(%rip), %r14      # 0xe8da
leaq -0xb10(%rbp), %r15
leaq -0x1d8(%rbp), %r12
movq %r13, -0x30(%rbp)
cmpq 0xc6d8(%rip), %rbx      # 0x15350
je 0x8d50
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x40f0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c86
movl %eax, %r13d
movq %r15, %rdi
callq 0x4130
testb %r13b, %r13b
movq -0x30(%rbp), %r13
je 0x8cc0
leaq 0x5c2a(%rip), %rdi      # 0xe8dc
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x4530
addq $0x20, %rbx
jmp 0x8c71
movq 0xc323(%rip), %rdi      # 0x14ff0
callq 0x4140
leaq 0x5aea(%rip), %rsi      # 0xe7c3
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4140
movq %rax, %rdi
callq 0x4140
pushq $-0x1
popq %rbx
leaq -0x198(%rbp), %rdi
callq 0x4130
leaq -0x110(%rbp), %rdi
callq 0x4130
leaq -0x90(%rbp), %rdi
callq 0x4130
leaq -0xb0(%rbp), %rdi
callq 0x4130
movl %ebx, %eax
addq $0x1ae8, %rsp           # imm = 0x1AE8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xc2b1(%rip), %rdi      # 0x14ff0
leaq 0x5b73(%rip), %rsi      # 0xe8b9
callq 0x4260
jmp 0x9211
pushq $0xa
popq %rdi
movq %r13, %rsi
callq 0x4350
leaq 0x5b7d(%rip), %rsi      # 0xe8df
pushq $0x25
popq %rdx
movq %r13, %rdi
xorl %eax, %eax
callq 0x43d0
movq 0xc5d2(%rip), %rbx      # 0x15348
leaq 0x5b5d(%rip), %r14      # 0xe8da
leaq -0xb10(%rbp), %r15
leaq -0x1d8(%rbp), %r12
cmpq 0xc5be(%rip), %rbx      # 0x15350
je 0x8ddb
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x40f0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c86
movl %eax, %r13d
movq %r15, %rdi
callq 0x4130
testb %r13b, %r13b
movq -0x30(%rbp), %r13
je 0x8dd5
movq (%rbx), %rdx
movq %r13, %rdi
leaq 0x5b18(%rip), %rsi      # 0xe8e6
xorl %eax, %eax
callq 0x43d0
addq $0x20, %rbx
jmp 0x8d8b
pushq $0xa
popq %rdi
movq %r13, %rsi
callq 0x4350
movq -0x160(%rbp), %rbx
leaq -0xb10(%rbp), %r13
movl $0x0, -0x38(%rbp)
leaq -0x170(%rbp), %rax
cmpq %rax, %rbx
je 0x906c
movq 0x40(%rbx), %rsi
addq $0x8, %rsi
movq %r13, %rdi
callq 0x43a0
movq -0xb10(%rbp), %r15
movq 0x40(%rbx), %rax
leaq 0x28(%rax), %rdi
movq 0x30(%rax), %r14
movsd 0x78(%rax), %xmm0
movapd %xmm0, -0x220(%rbp)
callq 0xd561
movapd %xmm0, -0x60(%rbp)
movq 0x40(%rbx), %rdi
addq $0x28, %rdi
callq 0xd5ec
movsd 0x5476(%rip), %xmm2     # 0xe2d0
movapd -0x220(%rbp), %xmm1
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x5473(%rip), %xmm3     # 0xe2e0
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %r14, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movsd 0x5426(%rip), %xmm2     # 0xe2c8
mulsd %xmm2, %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movapd -0x60(%rbp), %xmm1
mulsd %xmm2, %xmm1
cvttpd2dq %xmm1, %xmm1
divsd %xmm2, %xmm0
cvtdq2pd %xmm1, %xmm1
divsd %xmm2, %xmm1
movq -0x68(%rbp), %rdi
leaq 0x5a18(%rip), %rsi      # 0xe8ea
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
movb $0x2, %al
callq 0x43d0
movq %r13, %rdi
callq 0x4130
movq %rbx, -0x60(%rbp)
movq 0x40(%rbx), %rax
movq 0x60(%rax), %r12
leaq -0x1d8(%rbp), %rbx
cmpq 0x68(%rax), %r12
je 0x903c
movq (%r12), %rsi
addq $0x8, %rsi
movq %r13, %rdi
callq 0x43a0
movq -0xb10(%rbp), %r14
movq (%r12), %rsi
addq $0x58, %rsi
movq %rbx, %rdi
callq 0x43a0
movl -0x38(%rbp), %r15d
incl %r15d
movq -0x1d8(%rbp), %r8
movq -0x70(%rbp), %rdi
leaq 0x59bb(%rip), %rsi      # 0xe902
movl %r15d, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x43d0
movq %rbx, %rdi
callq 0x4130
movq %r13, %rdi
callq 0x4130
movq -0x30(%rbp), %rdi
leaq 0x599d(%rip), %rsi      # 0xe90c
movl %r15d, -0x38(%rbp)
movl %r15d, %edx
xorl %eax, %eax
callq 0x43d0
movq 0xc3c4(%rip), %r14      # 0x15348
leaq -0x260(%rbp), %r15
cmpq 0xc3be(%rip), %r14      # 0x15350
je 0x901f
movq %r13, %rdi
leaq 0x5938(%rip), %rsi      # 0xe8da
movq %rbx, %rdx
callq 0x40f0
movq %r14, %rdi
movq %r13, %rsi
callq 0x9c86
movl %eax, %ebx
movq %r13, %rdi
callq 0x4130
testb %bl, %bl
je 0x900f
movq (%r12), %rbx
movq %r15, %rdi
movq %r14, %rsi
callq 0x43a0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7494
movsd 0x52e3(%rip), %xmm1     # 0xe2c8
mulsd %xmm1, %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
divsd %xmm1, %xmm0
movq -0x30(%rbp), %rdi
leaq 0x590f(%rip), %rsi      # 0xe90f
movb $0x1, %al
callq 0x43d0
movq %r15, %rdi
callq 0x4130
addq $0x20, %r14
leaq -0x1d8(%rbp), %rbx
jmp 0x8f8b
pushq $0xa
popq %rdi
movq -0x30(%rbp), %rsi
callq 0x4350
addq $0x8, %r12
movq -0x60(%rbp), %rax
movq 0x40(%rax), %rax
jmp 0x8efd
movq -0x60(%rbp), %rdi
callq 0x41c0
movq %rax, %rbx
jmp 0x8dfb
movq 0xbf9c(%rip), %rdi      # 0x14ff0
leaq 0x585e(%rip), %rsi      # 0xe8b9
callq 0x4260
leaq -0xf10(%rbp), %rbx
jmp 0x9211
movq -0x70(%rbp), %rdi
callq 0x4270
movq -0x30(%rbp), %rdi
callq 0x4270
movq -0x68(%rbp), %rdi
callq 0x4270
leaq -0xb10(%rbp), %rdi
callq 0xc98c
movq 0xbf56(%rip), %rdi      # 0x14ff0
leaq -0xb10(%rbp), %rsi
callq 0x4220
leaq 0x5869(%rip), %rsi      # 0xe916
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4140
leaq -0xb10(%rbp), %rdi
callq 0x4130
leaq -0x1d8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x8152
movq -0x90(%rbp), %rdx
leaq 0x583f(%rip), %rsi      # 0xe930
leaq -0xb10(%rbp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4060
leaq 0x57ae(%rip), %rsi      # 0xe8b7
movq %rbx, %rdi
callq 0x4300
testq %rax, %rax
je 0x9231
movq %rax, %rbx
movq -0x1d8(%rbp), %rdx
leaq 0x5811(%rip), %rsi      # 0xe93c
movq %rax, %rdi
xorl %eax, %eax
callq 0x43d0
leaq 0x5808(%rip), %rsi      # 0xe944
leaq -0x1710(%rbp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x43d0
leaq 0x57fa(%rip), %rsi      # 0xe94e
leaq -0x1b10(%rbp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x43d0
leaq 0x57eb(%rip), %rsi      # 0xe957
leaq -0x1310(%rbp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x43d0
leaq 0x57dd(%rip), %rsi      # 0xe961
leaq -0xf10(%rbp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x43d0
movq -0xb0(%rbp), %rdx
leaq 0x57c6(%rip), %rsi      # 0xe969
movq %rbx, %rdi
xorl %eax, %eax
callq 0x43d0
movq %rbx, %rdi
callq 0x4270
leaq -0xf0(%rbp), %rdi
callq 0xc98c
movq 0xbe28(%rip), %rdi      # 0x14ff0
leaq -0xf0(%rbp), %rsi
callq 0x4220
leaq 0x579b(%rip), %rsi      # 0xe976
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4140
leaq -0xf0(%rbp), %rdi
callq 0x4130
xorl %ebx, %ebx
jmp 0x9266
movq 0xbdee(%rip), %rdi      # 0x14ff0
leaq 0x56b0(%rip), %rsi      # 0xe8b9
callq 0x4260
movq %r15, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4260
movq %rax, %rdi
callq 0x4140
movq %rax, %rdi
callq 0x4140
pushq $-0x1
popq %rbx
jmp 0x9272
movq 0xbdb8(%rip), %rdi      # 0x14ff0
leaq 0x567a(%rip), %rsi      # 0xe8b9
callq 0x4260
leaq -0xb10(%rbp), %rsi
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4140
movq %rax, %rdi
callq 0x4140
pushq $-0x1
popq %rbx
leaq -0x1d8(%rbp), %rdi
callq 0x4130
leaq -0x310(%rbp), %rdi
callq 0xa2fa
leaq -0x178(%rbp), %rdi
callq 0xa64e
jmp 0x8cf4
jmp 0x929b
jmp 0x946e
jmp 0x946e
movq %rax, %rbx
jmp 0x92b4
jmp 0x946e
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x4130
leaq -0x1d8(%rbp), %rdi
jmp 0x9467
jmp 0x946e
jmp 0x941a
jmp 0x946e
jmp 0x946e
movq %rax, %rbx
leaq -0x240(%rbp), %rdi
callq 0x4130
jmp 0x947d
movq %rax, %rbx
jmp 0x947d
jmp 0x9413
jmp 0x946e
movq %rax, %rbx
leaq -0xb10(%rbp), %rdi
callq 0x4130
jmp 0x9489
jmp 0x941a
jmp 0x946e
jmp 0x946e
jmp 0x946e
jmp 0x9426
jmp 0x941a
movq %rax, %rbx
leaq -0xb10(%rbp), %rdi
callq 0x43f0
jmp 0x9429
movq %rax, %rbx
leaq -0x2a0(%rbp), %rdi
jmp 0x93b8
jmp 0x935a
jmp 0x935a
jmp 0x93ae
jmp 0x935a
jmp 0x935a
jmp 0x935a
jmp 0x935a
movq %rax, %rbx
jmp 0x944d
movq %rax, %rbx
leaq -0x2c0(%rbp), %rdi
jmp 0x93b8
jmp 0x9413
movq %rax, %rbx
movq %r15, %rdi
callq 0x4250
jmp 0x9471
jmp 0x946e
jmp 0x941a
jmp 0x946e
jmp 0x946e
movq %rax, %rbx
leaq -0xb10(%rbp), %rdi
callq 0x9c66
jmp 0x93fc
jmp 0x93f9
jmp 0x9413
jmp 0x93ae
movq %rax, %rbx
leaq -0xb10(%rbp), %rdi
callq 0x4130
jmp 0x944d
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0xa148
leaq -0x140(%rbp), %rdi
callq 0xa148
jmp 0x93e2
movq %rax, %rbx
leaq -0xb08(%rbp), %rdi
callq 0xa148
jmp 0x93fc
jmp 0x93f9
jmp 0x93f4
movq %rax, %rbx
jmp 0x9408
movq %rax, %rbx
leaq -0x280(%rbp), %rdi
callq 0x4130
leaq -0x40(%rbp), %rdi
callq 0xa148
jmp 0x9429
movq %rax, %rbx
jmp 0x9489
jmp 0x946e
movq %rax, %rbx
leaq -0xb10(%rbp), %rdi
jmp 0x9467
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x78b6
leaq -0x210(%rbp), %rdi
callq 0xa216
leaq -0x1d8(%rbp), %rdi
callq 0x6a8e
leaq -0x128(%rbp), %rdi
callq 0x5538
jmp 0x9471
jmp 0x946e
movq %rax, %rbx
leaq -0x260(%rbp), %rdi
callq 0x4130
jmp 0x9471
movq %rax, %rbx
leaq -0x310(%rbp), %rdi
callq 0xa2fa
leaq -0x178(%rbp), %rdi
callq 0xa64e
leaq -0x198(%rbp), %rdi
callq 0x4130
leaq -0x110(%rbp), %rdi
callq 0x4130
leaq -0x90(%rbp), %rdi
callq 0x4130
leaq -0xb0(%rbp), %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x44b0
nop