// File: CK7[P]abawaca/src/ScafDpData.cpp
// Function: ScafDpData::ScafDpData(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
ScafDpData::ScafDpData(string esom_names_file, string fasta_file, string info_file)
{
	FILE* fp = NULL;
	char line[8192] = {};

	if(!(fp = fopen(info_file.c_str(), "r"))) {
		throw invalid_argument(string(__FILE__) + " (" + to_string(__LINE__) + "): could not read " + info_file);
	}

	map<string, double>	scaf_name2cvg;
	while(fgets(line, 8192, fp)) {
		// gwd1_scaffold_0 556922  17.599  0.363   0
		char seq_name[512];
		double cvg, gc;
		size_t Ns, length;
		if(sscanf(line, "%s %lu %lf %lf %lu", seq_name, &length, &cvg, &gc, &Ns) != 5) {
			char s[2048];
			sprintf(s, "%s (%d): Illegal line in file %s:\n%s", __FILE__, __LINE__, info_file.c_str(), line);
			throw invalid_argument(s);
		}
		scaf_name2cvg.insert(pair<string, double>(seq_name, cvg));
	}
	fclose(fp);

	if(!(fp = fopen(esom_names_file.c_str(), "r"))) {
		char s[2048];
		sprintf(s, "%s (%d): could not read %s", __FILE__, __LINE__, esom_names_file.c_str());
		throw invalid_argument(s);
	}

	if(!fgets(line, 8192, fp)) {
		char s[2048];
		sprintf(s, "%s (%d): file %s is empty", __FILE__, __LINE__, esom_names_file.c_str());
		throw invalid_argument(s);
	}

	// % 8430
	unsigned int t1, t2;
	char	c;
	if((sscanf(line, "%c %u", &c, &t1) != 2) || (c != '%')) {
		char s[2048];
		sprintf(s, "%s (%d): unexpected line in file %s:\n%s", __FILE__, __LINE__, esom_names_file.c_str(), line);
		throw invalid_argument(s);
	}

	map<string, set<DataPoint> >	scaf2dps;
	while(fgets(line, 8192, fp)) {
		// 1    gwd1_scaffold_20283_1   gwd1_scaffold_20283:(1,2072), 1 segment(s), 2072/2072 non-N bps
		// 1	gwd1_scaffold_0_1	gwd1_scaffold_0(1, 2003), 2003/2003 non-Ns bps
		size_t 	dp=0, start=0, end=0, non_Ns=0, length=0, nsegments=0;
		char	scaf[512]{}, gene_name[512]={}, *p1, *p2, *p3, *p4, *p5;

		p1 = strchr(line, ':');
		p2 = strchr(line, '(');
		p3 = strchr(line, ')');
		p4 = strchr(line, '/');
		p5 = strchr(line, ',');
		if(!p1 || !p2 || !p3 || !p4 || !p5) {
			char s[2048];
			sprintf(s, "\n%s (%d): unexpected line in file %s:\n%s\n", __FILE__, __LINE__, esom_names_file.c_str(), line);
			throw invalid_argument(s);
		}
		*p1 = *p2 = *p3 = *p4 = *p5 = ' ';
		if((sscanf(line, "%lu %s %s %lu %lu , %lu segment(s), %lu %lu non-N bps", &dp, gene_name, scaf, &start, &end, &nsegments, &non_Ns, &length) != 8) &&
		   (sscanf(line, "%lu %s %s %lu %lu , %lu %lu non-N bps", &dp, gene_name, scaf, &start, &end, &non_Ns, &length) != 7)) {
			char s[2048];
			sprintf(s, "\n%s (%d): unexpected line in file %s:\n%sdp=%lu, gene_name=%s, scaf=%s, start=%lu, end=%lu, nsegments=%lu, non_Ns=%lu, length=%lu\nMake sure that your esom files were generated using prepare_esom_files.pl v1.05 or later\n",
				 __FILE__, __LINE__, esom_names_file.c_str(), line, dp, gene_name, scaf, start, end, nsegments, non_Ns, length);
			throw invalid_argument(s);
		}
		auto sit = scaf2dps.find(scaf);
		if(sit == scaf2dps.end()) {
			scaf2dps.insert(pair<string, set<DataPoint> >(scaf, set<DataPoint>()));
			sit = scaf2dps.find(scaf);
		}
		sit->second.insert(DataPoint(0, dp, 0, start, end, length-non_Ns));
	}
	fclose(fp);

	dps.resize(1);
	for(auto sit = scaf2dps.begin(); sit != scaf2dps.end(); sit++) {
		if(sit->second.size() == 1)
			continue;
		scaf_name2id_map.insert(pair<string, size_t>(sit->first, scaf_name2id_map.size()+1));
		for(auto dpit=sit->second.begin(); dpit != sit->second.end(); dpit++) {
			dps.push_back(DataPoint(dps.size(), dpit->get_name(), scaf_name2id_map.size(), dpit->get_start(), dpit->get_end(), dpit->get_Ns()));
			dp_name2id_map.insert(pair<size_t, size_t>(dps.back().get_name(), dps.back().get_iid()));
		}
	}

	scafs.resize(scaf_name2id_map.size()+1);
	Bio::SeqIORead_fasta<Bio::DNASequence>	reader(fasta_file);
	Bio::DNASequence* seq_obj;

	while((seq_obj = reader.next_seq()) != NULL) {
		auto it=scaf_name2id_map.find(seq_obj->display_id());
		auto mit = scaf_name2cvg.find(seq_obj->display_id());
		double cvg = (mit == scaf_name2cvg.end())? 0 : mit->second;
		if(it != scaf_name2id_map.end()) {
			scafs[it->second] = Seq(it->second, seq_obj, cvg);
		}
		else {
			delete(seq_obj);
		}
	}

	auto it=dps.begin();
	for(++it; it!=dps.end(); it++)
		scafs[it->get_scaf_id()] += *it;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x5db8, %rsp           # imm = 0x5DB8
movq %rsi, -0x5b98(%rbp)
movq %rdx, -0x5b90(%rbp)
movq %rcx, -0x5b60(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x5b70(%rbp)
movq %rdi, %rax
movq %rax, -0x5b88(%rbp)
callq 0x13dc0
movq -0x5b70(%rbp), %rdi
addq $0x30, %rdi
movq %rdi, -0x5b80(%rbp)
callq 0x9e40
movq -0x5b70(%rbp), %rdi
addq $0x60, %rdi
movq %rdi, -0x5b78(%rbp)
callq 0x13de0
movq -0x5b70(%rbp), %rdi
addq $0x78, %rdi
movq %rdi, -0x5b68(%rbp)
callq 0x13e00
movq $0x0, -0x30(%rbp)
leaq -0x2030(%rbp), %rdi
xorl %esi, %esi
movl $0x2000, %edx           # imm = 0x2000
callq 0x5210
movq -0x5b60(%rbp), %rdi
callq 0x5190
movq %rax, %rdi
leaq 0x22c8c(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x5b58(%rbp)
jmp 0x124cf
movq -0x5b58(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x12700
movb $0x1, -0x2109(%rbp)
movl $0x10, %edi
callq 0x51e0
movq %rax, -0x5ba8(%rbp)
leaq -0x20e1(%rbp), %rdi
movq %rdi, -0x5ba0(%rbp)
callq 0x5760
movq -0x5ba0(%rbp), %rdx
leaq 0x2327a(%rip), %rsi     # 0x35797
leaq -0x20e0(%rbp), %rdi
callq 0x55b0
jmp 0x1252b
leaq 0x239f3(%rip), %rdx     # 0x35f25
leaq -0x20c0(%rbp), %rdi
leaq -0x20e0(%rbp), %rsi
callq 0x13e20
jmp 0x12547
leaq -0x2108(%rbp), %rdi
movl $0x11, %esi
callq 0x13e70
jmp 0x1255a
leaq -0x20a0(%rbp), %rdi
leaq -0x20c0(%rbp), %rsi
leaq -0x2108(%rbp), %rdx
callq 0xedc0
jmp 0x12576
leaq 0x2322d(%rip), %rdx     # 0x357aa
leaq -0x2080(%rbp), %rdi
leaq -0x20a0(%rbp), %rsi
callq 0x13e20
jmp 0x12592
movq -0x5b60(%rbp), %rdx
leaq -0x2060(%rbp), %rdi
leaq -0x2080(%rbp), %rsi
callq 0xed70
jmp 0x125ae
movq -0x5ba8(%rbp), %rdi
leaq -0x2060(%rbp), %rsi
callq 0x5740
jmp 0x125c3
movq -0x5ba8(%rbp), %rdi
movb $0x0, -0x2109(%rbp)
movq 0x3a9f0(%rip), %rsi     # 0x4cfc8
movq 0x3a9d9(%rip), %rdx     # 0x4cfb8
callq 0x5700
jmp 0x13a31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x139f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x126d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x126cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x126c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x126b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x126a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x1269c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
leaq -0x2060(%rbp), %rdi
callq 0x5250
leaq -0x2080(%rbp), %rdi
callq 0x5250
leaq -0x20a0(%rbp), %rdi
callq 0x5250
leaq -0x2108(%rbp), %rdi
callq 0x5250
leaq -0x20c0(%rbp), %rdi
callq 0x5250
leaq -0x20e0(%rbp), %rdi
callq 0x5250
leaq -0x20e1(%rbp), %rdi
callq 0x5460
testb $0x1, -0x2109(%rbp)
jne 0x126ef
jmp 0x126fb
movq -0x5ba8(%rbp), %rdi
callq 0x52d0
jmp 0x139f5
leaq -0x2140(%rbp), %rdi
callq 0x13f90
movq -0x30(%rbp), %rdx
leaq -0x2030(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x5690
movq %rax, -0x5bb0(%rbp)
jmp 0x1272a
movq -0x5bb0(%rbp), %rax
cmpq $0x0, %rax
je 0x128c8
leaq -0x2030(%rbp), %rdi
leaq -0x2340(%rbp), %rdx
leaq 0x2306d(%rip), %rsi     # 0x357bd
leaq -0x2360(%rbp), %rcx
leaq -0x2348(%rbp), %r8
leaq -0x2350(%rbp), %r9
leaq -0x2358(%rbp), %rax
movq %rax, (%rsp)
movb $0x0, %al
callq 0x53e0
cmpl $0x5, %eax
je 0x1283c
movq -0x5b60(%rbp), %rdi
callq 0x5190
movq %rax, %r8
leaq 0x2303a(%rip), %rsi     # 0x357d0
leaq 0x22ffa(%rip), %rdx     # 0x35797
xorl %eax, %eax
leaq -0x2b60(%rbp), %rdi
movq %rdi, -0x5bc0(%rbp)
movl $0x1c, %ecx
leaq -0x2030(%rbp), %r9
callq 0x50b0
movl $0x10, %edi
callq 0x51e0
movq -0x5bc0(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x5bb8(%rbp)
callq 0x57f0
jmp 0x127e3
movq -0x5bb8(%rbp), %rdi
movq 0x3a7d7(%rip), %rsi     # 0x4cfc8
movq 0x3a7c0(%rip), %rdx     # 0x4cfb8
callq 0x5700
jmp 0x13a31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x139e9
movq -0x5bb8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
callq 0x52d0
jmp 0x139e9
leaq -0x2b88(%rbp), %rdi
leaq -0x2340(%rbp), %rsi
leaq -0x2348(%rbp), %rdx
callq 0x13ff0
jmp 0x12858
leaq -0x2140(%rbp), %rdi
leaq -0x2b88(%rbp), %rsi
callq 0x13fb0
movb %dl, -0x5bc9(%rbp)
movq %rax, -0x5bc8(%rbp)
jmp 0x1287a
movb -0x5bc9(%rbp), %al
movq -0x5bc8(%rbp), %rcx
movq %rcx, -0x2b98(%rbp)
movb %al, -0x2b90(%rbp)
leaq -0x2b88(%rbp), %rdi
callq 0x14080
jmp 0x1270c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
leaq -0x2b88(%rbp), %rdi
callq 0x14080
jmp 0x139e9
movq -0x30(%rbp), %rdi
callq 0x5400
jmp 0x128d3
movq -0x5b98(%rbp), %rdi
callq 0x5190
movq %rax, %rdi
leaq 0x22864(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x5bd8(%rbp)
jmp 0x128f7
movq -0x5bd8(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x129aa
movq -0x5b98(%rbp), %rdi
callq 0x5190
movq %rax, %r8
leaq 0x22ed3(%rip), %rsi     # 0x357f5
leaq 0x22e6e(%rip), %rdx     # 0x35797
xorl %eax, %eax
leaq -0x33a0(%rbp), %rdi
movq %rdi, -0x5be8(%rbp)
movl $0x25, %ecx
callq 0x50b0
movl $0x10, %edi
callq 0x51e0
movq -0x5be8(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x5be0(%rbp)
callq 0x57f0
jmp 0x12968
movq -0x5be0(%rbp), %rdi
movq 0x3a652(%rip), %rsi     # 0x4cfc8
movq 0x3a63b(%rip), %rdx     # 0x4cfb8
callq 0x5700
jmp 0x13a31
movq -0x5be0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
callq 0x52d0
jmp 0x139e9
movq -0x30(%rbp), %rdx
leaq -0x2030(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x5690
movq %rax, -0x5bf0(%rbp)
jmp 0x129c8
movq -0x5bf0(%rbp), %rax
cmpq $0x0, %rax
jne 0x12a77
movq -0x5b98(%rbp), %rdi
callq 0x5190
movq %rax, %r8
leaq 0x22e21(%rip), %rsi     # 0x35810
leaq 0x22da1(%rip), %rdx     # 0x35797
xorl %eax, %eax
leaq -0x3ba0(%rbp), %rdi
movq %rdi, -0x5c00(%rbp)
movl $0x2b, %ecx
callq 0x50b0
movl $0x10, %edi
callq 0x51e0
movq -0x5c00(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x5bf8(%rbp)
callq 0x57f0
jmp 0x12a35
movq -0x5bf8(%rbp), %rdi
movq 0x3a585(%rip), %rsi     # 0x4cfc8
movq 0x3a56e(%rip), %rdx     # 0x4cfb8
callq 0x5700
jmp 0x13a31
movq -0x5bf8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
callq 0x52d0
jmp 0x139e9
leaq -0x2030(%rbp), %rdi
leaq 0x22da5(%rip), %rsi     # 0x3582a
leaq -0x3ba9(%rbp), %rdx
leaq -0x3ba4(%rbp), %rcx
movb $0x0, %al
callq 0x53e0
cmpl $0x2, %eax
jne 0x12aaf
movsbl -0x3ba9(%rbp), %eax
cmpl $0x25, %eax
je 0x12b54
movq -0x5b98(%rbp), %rdi
callq 0x5190
movq %rax, %r8
leaq 0x22d6b(%rip), %rsi     # 0x35830
leaq 0x22ccb(%rip), %rdx     # 0x35797
xorl %eax, %eax
leaq -0x43b0(%rbp), %rdi
movq %rdi, -0x5c10(%rbp)
movl $0x34, %ecx
leaq -0x2030(%rbp), %r9
callq 0x50b0
movl $0x10, %edi
callq 0x51e0
movq -0x5c10(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x5c08(%rbp)
callq 0x57f0
jmp 0x12b12
movq -0x5c08(%rbp), %rdi
movq 0x3a4a8(%rip), %rsi     # 0x4cfc8
movq 0x3a491(%rip), %rdx     # 0x4cfb8
callq 0x5700
jmp 0x13a31
movq -0x5c08(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
callq 0x52d0
jmp 0x139e9
leaq -0x43e0(%rbp), %rdi
callq 0x140a0
movq -0x30(%rbp), %rdx
leaq -0x2030(%rbp), %rdi
movl $0x2000, %esi           # imm = 0x2000
callq 0x5690
movq %rax, -0x5c18(%rbp)
jmp 0x12b7e
movq -0x5c18(%rbp), %rax
cmpq $0x0, %rax
je 0x13280
movq $0x0, -0x43e8(%rbp)
movq $0x0, -0x43f0(%rbp)
movq $0x0, -0x43f8(%rbp)
movq $0x0, -0x4400(%rbp)
movq $0x0, -0x4408(%rbp)
movq $0x0, -0x4410(%rbp)
leaq -0x4610(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x5210
leaq -0x4810(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x5210
leaq -0x2030(%rbp), %rdi
movl $0x3a, %esi
callq 0x5170
movq %rax, -0x4818(%rbp)
leaq -0x2030(%rbp), %rdi
movl $0x28, %esi
callq 0x5170
movq %rax, -0x4820(%rbp)
leaq -0x2030(%rbp), %rdi
movl $0x29, %esi
callq 0x5170
movq %rax, -0x4828(%rbp)
leaq -0x2030(%rbp), %rdi
movl $0x2f, %esi
callq 0x5170
movq %rax, -0x4830(%rbp)
leaq -0x2030(%rbp), %rdi
movl $0x2c, %esi
callq 0x5170
movq %rax, -0x4838(%rbp)
cmpq $0x0, -0x4818(%rbp)
je 0x12ca5
cmpq $0x0, -0x4820(%rbp)
je 0x12ca5
cmpq $0x0, -0x4828(%rbp)
je 0x12ca5
cmpq $0x0, -0x4830(%rbp)
je 0x12ca5
cmpq $0x0, -0x4838(%rbp)
jne 0x12d61
movq -0x5b98(%rbp), %rdi
callq 0x5190
movq %rax, %r8
leaq 0x22b9d(%rip), %rsi     # 0x35858
leaq 0x22ad5(%rip), %rdx     # 0x35797
xorl %eax, %eax
leaq -0x5040(%rbp), %rdi
movq %rdi, -0x5c28(%rbp)
movl $0x46, %ecx
leaq -0x2030(%rbp), %r9
callq 0x50b0
movl $0x10, %edi
callq 0x51e0
movq -0x5c28(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x5c20(%rbp)
callq 0x57f0
jmp 0x12d08
movq -0x5c20(%rbp), %rdi
movq 0x3a2b2(%rip), %rsi     # 0x4cfc8
movq 0x3a29b(%rip), %rdx     # 0x4cfb8
callq 0x5700
jmp 0x13a31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x139dd
movq -0x5c20(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
callq 0x52d0
jmp 0x139dd
movq -0x4838(%rbp), %rax
movb $0x20, (%rax)
movq -0x4830(%rbp), %rax
movb $0x20, (%rax)
movq -0x4828(%rbp), %rax
movb $0x20, (%rax)
movq -0x4820(%rbp), %rax
movb $0x20, (%rax)
movq -0x4818(%rbp), %rax
movb $0x20, (%rax)
leaq -0x2030(%rbp), %rdi
leaq -0x4810(%rbp), %rcx
leaq -0x4610(%rbp), %r8
leaq 0x22ad3(%rip), %rsi     # 0x35882
leaq -0x43e8(%rbp), %rdx
leaq -0x43f0(%rbp), %r9
leaq -0x43f8(%rbp), %rbx
leaq -0x4410(%rbp), %r11
leaq -0x4400(%rbp), %r10
leaq -0x4408(%rbp), %rax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x53e0
cmpl $0x8, %eax
je 0x12f5f
leaq -0x2030(%rbp), %rdi
leaq -0x4810(%rbp), %rcx
leaq -0x4610(%rbp), %r8
leaq 0x22aa0(%rip), %rsi     # 0x358b8
leaq -0x43e8(%rbp), %rdx
leaq -0x43f0(%rbp), %r9
leaq -0x43f8(%rbp), %r11
leaq -0x4400(%rbp), %r10
leaq -0x4408(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x53e0
cmpl $0x7, %eax
je 0x12f5f
movq -0x5b98(%rbp), %rdi
callq 0x5190
movq %rax, %r8
movq -0x43e8(%rbp), %rcx
movq -0x43f0(%rbp), %rdx
movq -0x43f8(%rbp), %rsi
movq -0x4410(%rbp), %rdi
movq -0x4400(%rbp), %r9
movq -0x4408(%rbp), %r10
movq %rsp, %rax
movq %rax, -0x5c40(%rbp)
movq %r10, 0x38(%rax)
movq %r9, 0x30(%rax)
movq %rdi, 0x28(%rax)
movq %rsi, 0x20(%rax)
movq %rdx, 0x18(%rax)
leaq -0x4610(%rbp), %rdx
movq %rdx, 0x10(%rax)
leaq -0x4810(%rbp), %rdx
movq %rdx, 0x8(%rax)
movq %rcx, (%rax)
leaq 0x22a0e(%rip), %rsi     # 0x358de
leaq 0x228c0(%rip), %rdx     # 0x35797
xorl %eax, %eax
leaq -0x5840(%rbp), %rdi
movq %rdi, -0x5c38(%rbp)
movl $0x4e, %ecx
leaq -0x2030(%rbp), %r9
callq 0x50b0
movl $0x10, %edi
callq 0x51e0
movq -0x5c38(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x5c30(%rbp)
callq 0x57f0
jmp 0x12f1d
movq -0x5c30(%rbp), %rdi
movq 0x3a09d(%rip), %rsi     # 0x4cfc8
movq 0x3a086(%rip), %rdx     # 0x4cfb8
callq 0x5700
jmp 0x13a31
movq -0x5c30(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
callq 0x52d0
jmp 0x139dd
leaq -0x5869(%rbp), %rdi
movq %rdi, -0x5c48(%rbp)
callq 0x5760
movq -0x5c48(%rbp), %rdx
leaq -0x5868(%rbp), %rdi
leaq -0x4610(%rbp), %rsi
callq 0x55b0
jmp 0x12f8e
leaq -0x43e0(%rbp), %rdi
leaq -0x5868(%rbp), %rsi
callq 0x140c0
movq %rax, -0x5c50(%rbp)
jmp 0x12faa
movq -0x5c50(%rbp), %rax
movq %rax, -0x5848(%rbp)
leaq -0x5868(%rbp), %rdi
callq 0x5250
leaq -0x5869(%rbp), %rdi
callq 0x5460
leaq -0x43e0(%rbp), %rdi
callq 0x14120
movq %rax, -0x5878(%rbp)
leaq -0x5848(%rbp), %rdi
leaq -0x5878(%rbp), %rsi
callq 0x140f0
testb $0x1, %al
jne 0x12fff
jmp 0x131e7
xorps %xmm0, %xmm0
movaps %xmm0, -0x58e0(%rbp)
movaps %xmm0, -0x58f0(%rbp)
movaps %xmm0, -0x5900(%rbp)
leaq -0x5900(%rbp), %rdi
movq %rdi, -0x5c58(%rbp)
callq 0x14190
movq -0x5c58(%rbp), %rdx
leaq -0x58c8(%rbp), %rdi
leaq -0x4610(%rbp), %rsi
callq 0x141b0
jmp 0x13046
leaq -0x43e0(%rbp), %rdi
leaq -0x58c8(%rbp), %rsi
callq 0x14150
movb %dl, -0x5c61(%rbp)
movq %rax, -0x5c60(%rbp)
jmp 0x13068
movb -0x5c61(%rbp), %al
movq -0x5c60(%rbp), %rcx
movq %rcx, -0x5910(%rbp)
movb %al, -0x5908(%rbp)
leaq -0x58c8(%rbp), %rdi
callq 0x14240
leaq -0x5900(%rbp), %rdi
callq 0x14270
leaq -0x5939(%rbp), %rdi
movq %rdi, -0x5c70(%rbp)
callq 0x5760
movq -0x5c70(%rbp), %rdx
leaq -0x5938(%rbp), %rdi
leaq -0x4610(%rbp), %rsi
callq 0x55b0
jmp 0x130c9
leaq -0x43e0(%rbp), %rdi
leaq -0x5938(%rbp), %rsi
callq 0x140c0
movq %rax, -0x5c78(%rbp)
jmp 0x130e5
movq -0x5c78(%rbp), %rax
movq %rax, -0x5918(%rbp)
movq -0x5918(%rbp), %rax
movq %rax, -0x5848(%rbp)
leaq -0x5938(%rbp), %rdi
callq 0x5250
leaq -0x5939(%rbp), %rdi
callq 0x5460
jmp 0x131e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x13150
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
leaq -0x5868(%rbp), %rdi
callq 0x5250
leaq -0x5869(%rbp), %rdi
callq 0x5460
jmp 0x139dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x13193
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
leaq -0x58c8(%rbp), %rdi
callq 0x14240
leaq -0x5900(%rbp), %rdi
callq 0x14270
jmp 0x139dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x131d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
leaq -0x5938(%rbp), %rdi
callq 0x5250
leaq -0x5939(%rbp), %rdi
callq 0x5460
jmp 0x139dd
leaq -0x5848(%rbp), %rdi
callq 0x14290
addq $0x20, %rax
movq %rax, -0x5c80(%rbp)
movq -0x43e8(%rbp), %rdx
movq -0x43f0(%rbp), %r8
movq -0x43f8(%rbp), %r9
movq -0x4408(%rbp), %rcx
movq -0x4400(%rbp), %rax
subq %rax, %rcx
movq %rsp, %rax
movq %rcx, (%rax)
xorl %eax, %eax
movl %eax, %ecx
leaq -0x5970(%rbp), %rdi
movq %rcx, %rsi
callq 0x14300
jmp 0x1323f
movq -0x5c80(%rbp), %rdi
leaq -0x5970(%rbp), %rsi
callq 0x142b0
movb %dl, -0x5c89(%rbp)
movq %rax, -0x5c88(%rbp)
jmp 0x13261
movb -0x5c89(%rbp), %al
movq -0x5c88(%rbp), %rcx
movq %rcx, -0x5980(%rbp)
movb %al, -0x5978(%rbp)
jmp 0x12b60
movq -0x30(%rbp), %rdi
callq 0x5400
jmp 0x1328b
movq -0x5b88(%rbp), %rdi
addq $0x60, %rdi
movl $0x1, %esi
callq 0x14360
jmp 0x132a2
leaq -0x43e0(%rbp), %rdi
callq 0x143f0
movq %rax, -0x5988(%rbp)
leaq -0x43e0(%rbp), %rdi
callq 0x14120
movq %rax, -0x5990(%rbp)
leaq -0x5988(%rbp), %rdi
leaq -0x5990(%rbp), %rsi
callq 0x14420
testb $0x1, %al
jne 0x132e4
jmp 0x13611
leaq -0x5988(%rbp), %rdi
callq 0x14290
movq %rax, %rdi
addq $0x20, %rdi
callq 0x14450
cmpq $0x1, %rax
jne 0x13307
jmp 0x135f7
movq -0x5b88(%rbp), %rax
movq %rax, -0x5ca0(%rbp)
leaq -0x5988(%rbp), %rdi
callq 0x14290
movq -0x5b88(%rbp), %rdi
movq %rax, -0x5c98(%rbp)
callq 0x144b0
movq -0x5c98(%rbp), %rsi
incq %rax
movq %rax, -0x59c0(%rbp)
leaq -0x59b8(%rbp), %rdi
leaq -0x59c0(%rbp), %rdx
callq 0x144d0
jmp 0x1335a
movq -0x5ca0(%rbp), %rdi
leaq -0x59b8(%rbp), %rsi
callq 0x14470
movb %dl, -0x5ca9(%rbp)
movq %rax, -0x5ca8(%rbp)
jmp 0x1337c
movb -0x5ca9(%rbp), %al
movq -0x5ca8(%rbp), %rcx
movq %rcx, -0x59d0(%rbp)
movb %al, -0x59c8(%rbp)
leaq -0x59b8(%rbp), %rdi
callq 0x14510
leaq -0x5988(%rbp), %rdi
callq 0x14290
movq %rax, %rdi
addq $0x20, %rdi
callq 0x14530
movq %rax, -0x59d8(%rbp)
leaq -0x5988(%rbp), %rdi
callq 0x14290
movq %rax, %rdi
addq $0x20, %rdi
callq 0x14590
movq %rax, -0x59e0(%rbp)
leaq -0x59d8(%rbp), %rdi
leaq -0x59e0(%rbp), %rsi
callq 0x14560
testb $0x1, %al
jne 0x133fc
jmp 0x135f5
movq -0x5b88(%rbp), %rdi
addq $0x60, %rdi
movq %rdi, -0x5cc8(%rbp)
callq 0xcab0
movq %rax, -0x5cc0(%rbp)
leaq -0x59d8(%rbp), %rdi
callq 0x145f0
movq %rax, %rdi
callq 0x14610
movq %rax, -0x5cb8(%rbp)
jmp 0x13437
movq -0x5b88(%rbp), %rdi
callq 0x144b0
movq %rax, -0x5cd8(%rbp)
leaq -0x59d8(%rbp), %rdi
callq 0x145f0
movq %rax, %rdi
callq 0x14630
movq %rax, -0x5cd0(%rbp)
jmp 0x13467
leaq -0x59d8(%rbp), %rdi
callq 0x145f0
movq %rax, %rdi
callq 0x14650
movq %rax, -0x5ce0(%rbp)
jmp 0x13484
leaq -0x59d8(%rbp), %rdi
callq 0x145f0
movq %rax, %rdi
callq 0x14670
movq %rax, -0x5ce8(%rbp)
jmp 0x134a1
movq -0x5ce0(%rbp), %r9
movq -0x5cd0(%rbp), %r8
movq -0x5cd8(%rbp), %rcx
movq -0x5cb8(%rbp), %rdx
movq -0x5cc0(%rbp), %rsi
movq -0x5ce8(%rbp), %rdi
movq %rsp, %rax
movq %rdi, (%rax)
leaq -0x5a10(%rbp), %rdi
callq 0x14300
jmp 0x134df
movq -0x5cc8(%rbp), %rdi
leaq -0x5a10(%rbp), %rsi
callq 0x145c0
jmp 0x134f4
movq -0x5b88(%rbp), %rdi
movq %rdi, %rax
addq $0x30, %rax
movq %rax, -0x5cf8(%rbp)
addq $0x60, %rdi
callq 0x146d0
movq %rax, %rdi
callq 0x14610
movq %rax, -0x5cf0(%rbp)
jmp 0x13523
movq -0x5b88(%rbp), %rdi
movq -0x5cf0(%rbp), %rax
movq %rax, -0x5a28(%rbp)
addq $0x60, %rdi
callq 0x146d0
movq %rax, %rdi
callq 0x14710
movq %rax, -0x5d00(%rbp)
jmp 0x13552
movq -0x5d00(%rbp), %rax
movq %rax, -0x5a30(%rbp)
leaq -0x5a20(%rbp), %rdi
leaq -0x5a28(%rbp), %rsi
leaq -0x5a30(%rbp), %rdx
callq 0x14730
jmp 0x1357c
movq -0x5cf8(%rbp), %rdi
leaq -0x5a20(%rbp), %rsi
callq 0x14690
movb %dl, -0x5d09(%rbp)
movq %rax, -0x5d08(%rbp)
jmp 0x1359e
movb -0x5d09(%rbp), %al
movq -0x5d08(%rbp), %rcx
movq %rcx, -0x5a40(%rbp)
movb %al, -0x5a38(%rbp)
leaq -0x59d8(%rbp), %rdi
xorl %esi, %esi
callq 0x14760
movq %rax, -0x5a48(%rbp)
jmp 0x133c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
leaq -0x59b8(%rbp), %rdi
callq 0x14510
jmp 0x139dd
jmp 0x135f7
leaq -0x5988(%rbp), %rdi
xorl %esi, %esi
callq 0x147a0
movq %rax, -0x5a50(%rbp)
jmp 0x132b5
movq -0x5b88(%rbp), %rdi
movq %rdi, %rax
addq $0x78, %rax
movq %rax, -0x5d18(%rbp)
callq 0x144b0
movq -0x5d18(%rbp), %rdi
movq %rax, %rsi
incq %rsi
callq 0x147e0
jmp 0x1363f
movq -0x5b90(%rbp), %rsi
leaq -0x5ac0(%rbp), %rdi
callq 0x51a0
jmp 0x13654
leaq -0x5aa0(%rbp), %rdi
leaq -0x5ac0(%rbp), %rsi
callq 0x14870
jmp 0x13669
leaq -0x5ac0(%rbp), %rdi
callq 0x5250
leaq -0x5aa0(%rbp), %rdi
callq 0x14910
movq %rax, -0x5d20(%rbp)
jmp 0x1368a
movq -0x5d20(%rbp), %rax
movq %rax, -0x5ac8(%rbp)
cmpq $0x0, %rax
je 0x138c1
movq -0x5b88(%rbp), %rax
movq %rax, -0x5d30(%rbp)
movq -0x5ac8(%rbp), %rdi
callq 0x11ce0
movq %rax, -0x5d28(%rbp)
jmp 0x136c5
movq -0x5d28(%rbp), %rsi
movq -0x5d30(%rbp), %rdi
callq 0x150b0
movq %rax, -0x5d38(%rbp)
jmp 0x136e1
movq -0x5d38(%rbp), %rax
movq %rax, -0x5ad0(%rbp)
movq -0x5ac8(%rbp), %rdi
callq 0x11ce0
movq %rax, -0x5d40(%rbp)
jmp 0x13704
movq -0x5d40(%rbp), %rsi
leaq -0x2140(%rbp), %rdi
callq 0x150e0
movq %rax, -0x5d48(%rbp)
jmp 0x13720
movq -0x5d48(%rbp), %rax
movq %rax, -0x5ad8(%rbp)
leaq -0x2140(%rbp), %rdi
callq 0x15140
movq %rax, -0x5ae8(%rbp)
leaq -0x5ad8(%rbp), %rdi
leaq -0x5ae8(%rbp), %rsi
callq 0x15110
testb $0x1, %al
jne 0x1375a
jmp 0x13767
xorps %xmm0, %xmm0
movsd %xmm0, -0x5d50(%rbp)
jmp 0x13780
leaq -0x5ad8(%rbp), %rdi
callq 0x15170
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x5d50(%rbp)
movq -0x5b88(%rbp), %rdi
movsd -0x5d50(%rbp), %xmm0
movsd %xmm0, -0x5ae0(%rbp)
callq 0x151c0
movq %rax, -0x5af0(%rbp)
leaq -0x5ad0(%rbp), %rdi
leaq -0x5af0(%rbp), %rsi
callq 0x15190
testb $0x1, %al
jne 0x137bf
jmp 0x13899
leaq -0x5ad0(%rbp), %rdi
callq 0x151f0
movq 0x20(%rax), %rsi
movq -0x5ac8(%rbp), %rdx
movsd -0x5ae0(%rbp), %xmm0
leaq -0x5b38(%rbp), %rdi
callq 0x15210
jmp 0x137ec
movq -0x5b88(%rbp), %rax
addq $0x78, %rax
movq %rax, -0x5d58(%rbp)
leaq -0x5ad0(%rbp), %rdi
callq 0x151f0
movq -0x5d58(%rbp), %rdi
movq 0x20(%rax), %rsi
callq 0x15260
movq %rax, %rdi
leaq -0x5b38(%rbp), %rsi
callq 0x15280
jmp 0x1382b
leaq -0x5b38(%rbp), %rdi
callq 0xd390
jmp 0x138bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
leaq -0x5ac0(%rbp), %rdi
callq 0x5250
jmp 0x139dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
jmp 0x139d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2038(%rbp)
movl %eax, -0x203c(%rbp)
leaq -0x5b38(%rbp), %rdi
callq 0xd390
jmp 0x139d1
movq -0x5ac8(%rbp), %rax
movq %rax, -0x5d60(%rbp)
cmpq $0x0, %rax
je 0x138ba
movq -0x5d60(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x138bc
jmp 0x13675
movq -0x5b88(%rbp), %rdi
addq $0x60, %rdi
callq 0x15350
movq %rax, -0x5b40(%rbp)
leaq -0x5b40(%rbp), %rdi
callq 0x15380
movq -0x5b88(%rbp), %rdi
addq $0x60, %rdi
callq 0x153e0
movq %rax, -0x5b48(%rbp)
leaq -0x5b40(%rbp), %rdi
leaq -0x5b48(%rbp), %rsi
callq 0x153a0
testb $0x1, %al
jne 0x13917
jmp 0x139a3
leaq -0x5b40(%rbp), %rdi
movq %rdi, -0x5d80(%rbp)
callq 0x15410
movq -0x5d80(%rbp), %rdi
movq %rax, %rcx
movq -0x5b88(%rbp), %rax
movq %rcx, -0x5d78(%rbp)
addq $0x78, %rax
movq %rax, -0x5d70(%rbp)
callq 0x15430
movq %rax, %rdi
callq 0x15450
movq %rax, -0x5d68(%rbp)
jmp 0x13963
movq -0x5d68(%rbp), %rsi
movq -0x5d70(%rbp), %rdi
callq 0x15260
movq -0x5d78(%rbp), %rsi
movq %rax, %rdi
callq 0x15470
jmp 0x13987
jmp 0x13989
leaq -0x5b40(%rbp), %rdi
xorl %esi, %esi
callq 0x154c0
movq %rax, -0x5b50(%rbp)
jmp 0x138e4
leaq -0x5aa0(%rbp), %rdi
callq 0x15500
leaq -0x43e0(%rbp), %rdi
callq 0x15520
leaq -0x2140(%rbp), %rdi
callq 0x15540
addq $0x5db8, %rsp           # imm = 0x5DB8
popq %rbx
popq %rbp
retq
leaq -0x5aa0(%rbp), %rdi
callq 0x15500
leaq -0x43e0(%rbp), %rdi
callq 0x15520
leaq -0x2140(%rbp), %rdi
callq 0x15540
movq -0x5b68(%rbp), %rdi
callq 0xd190
movq -0x5b78(%rbp), %rdi
callq 0xd1f0
movq -0x5b80(%rbp), %rdi
callq 0xa770
movq -0x5b70(%rbp), %rdi
callq 0xd250
movq -0x2038(%rbp), %rdi
callq 0x5750
nopw %cs:(%rax,%rax)