// File: auton1[P]viterbi/variant_file.cpp
// Function: variant_file::add_file(parameters const&, std::vector<std::vector<bool, std::allocator<bool>>, std::allocator<std::vector<bool, std::allocator<bool>>>>&, std::vector<unsigned int, std::allocator<unsigned int>>&, 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>>>>&, 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>>>>&)
int variant_file::add_file(const parameters &params, vector<vector<bool> > &haplotypes, vector<unsigned int> &positions, vector<string> &haplotype_names, vector<string> &alleles)
{
	int passed_sites = 0;
	unsigned int N_chr = 2*N_kept_individuals();
	vector<vector<bool> > new_haplotypes;
	vector<unsigned int> new_positions;
	vector<string> new_alleles;
	
	new_haplotypes.resize(N_chr);
	
	for (unsigned int ui=0; ui<N_kept_individuals(); ui++)
	{
		if (include_indv[ui] == false)
			continue;
		haplotype_names.push_back(meta_data.indv[ui] + "_1");
		haplotype_names.push_back(meta_data.indv[ui] + "_2");
	}

	vector<char> variant_line;
	entry *e = get_entry_object();
	unsigned int N_alleles;

	while(!eof())
	{
		get_entry(variant_line);
		e->reset(variant_line);
		N_entries += e->apply_filters(params);

		if(!e->passed_filters)
			continue;
		N_kept_entries++;
		e->parse_basic_entry(true);

		e->parse_genotype_entries(true);
		N_alleles = e->get_N_alleles();

		if (N_alleles != 2)
		{
			LOG.one_off_warning("\tWarning: Only using biallelic sites.");
			continue;
		}
		if (e->is_diploid() == false)
		{
			LOG.one_off_warning("\tWarning: Only using fully diploid sites.");
			continue;
		}

		vector<bool> tmp;
		tmp.reserve(meta_data.N_indv*2);
		int allele_count = 0;

		pair<int, int> geno;
		bool skip = false;
		for (unsigned int ui=0; ui<meta_data.N_indv; ui++)
		{
			if (e->include_indv[ui] == false)
				continue;

			if (e->include_genotype[ui] == true)
			{
				e->get_indv_GENOTYPE_ids(ui, geno);
				if ((geno.first > 1) || (geno.second > 1))
					LOG.error("Only supporting biallelics... something bad happened", 1);
				if ((geno.first != -1) && (geno.second != -1))
				{
					tmp.push_back((bool)geno.first);
					tmp.push_back((bool)geno.second);
					allele_count += geno.first;
					allele_count += geno.second;
				}
				else
				{
					skip = true;
					LOG.one_off_warning("\tWarning: Only using sites without missing data.");
					break;
				}
			}
			else
			{
				skip = true;
				LOG.one_off_warning("\tWarning: Only using sites without missing data.");
				break;
			}
		}

		if (skip == true)
			continue;

		if (N_chr != tmp.size())
			LOG.error("Something unexpected happened.... oh dear.");

		string chr = e->get_CHROM();
		passed_sites++;

		new_alleles.push_back(e->get_REF());
		new_alleles.push_back(e->get_ALT());
		new_positions.push_back(e->get_POS());

		for (unsigned int ui=0; ui<tmp.size(); ui++)
			new_haplotypes[ui].push_back(tmp[ui]);
		
	}
	vector<vector<bool> > merged_haplotypes;
	vector<unsigned int> merged_positions;
	vector<string> merged_alleles;
	
	merged_haplotypes.resize(haplotypes.size()+new_haplotypes.size());
	for (unsigned int ui=0; ui<positions.size(); ui++)
	{
		int idx = find(new_positions.begin(), new_positions.end(), positions[ui]) - new_positions.begin();

		if (idx >= 0 && idx < new_positions.size())
		{
			if (alleles[2*ui] == new_alleles[2*idx] && alleles[2*ui+1] == new_alleles[2*idx+1])
			{
				merged_positions.push_back(positions[ui]);
				for (unsigned int uj=0; uj<haplotypes.size(); uj++)
					merged_haplotypes[uj].push_back(haplotypes[uj][ui]);

				for (unsigned int uj=0; uj<new_haplotypes.size(); uj++)
					merged_haplotypes[haplotypes.size()+uj].push_back(new_haplotypes[uj][idx]);
			}
		}
	}
	haplotypes = merged_haplotypes;
	positions = merged_positions;
	
	delete e;
	return passed_sites;
}

// Assembly:
subq $0x4e8, %rsp            # imm = 0x4E8
movq %rdi, 0x4e0(%rsp)
movq %rsi, 0x4d8(%rsp)
movq %rdx, 0x4d0(%rsp)
movq %rcx, 0x4c8(%rsp)
movq %r8, 0x4c0(%rsp)
movq %r9, 0x4b8(%rsp)
movq 0x4e0(%rsp), %rdi
movq %rdi, 0x168(%rsp)
movl $0x0, 0x4b4(%rsp)
callq 0x27690
addl %eax, %eax
movl %eax, 0x4b0(%rsp)
leaq 0x498(%rsp), %rdi
movq %rdi, 0x170(%rsp)
callq 0x10240
leaq 0x480(%rsp), %rdi
callq 0x10250
leaq 0x468(%rsp), %rdi
callq 0x10260
movq 0x170(%rsp), %rdi
movl 0x4b0(%rsp), %eax
movl %eax, %esi
callq 0x10340
jmp 0x28e77
movl $0x0, 0x458(%rsp)
movq 0x168(%rsp), %rdi
movl 0x458(%rsp), %eax
movl %eax, 0x160(%rsp)
callq 0x27690
movl %eax, 0x164(%rsp)
jmp 0x28ea6
movl 0x160(%rsp), %eax
movl 0x164(%rsp), %ecx
cmpl %ecx, %eax
jae 0x29076
movq 0x168(%rsp), %rdi
addq $0x430, %rdi            # imm = 0x430
movl 0x458(%rsp), %eax
movl %eax, %esi
callq 0x102b0
movq %rdx, 0x150(%rsp)
movq %rax, 0x158(%rsp)
jmp 0x28eeb
movq 0x150(%rsp), %rax
movq 0x158(%rsp), %rcx
movq %rcx, 0x448(%rsp)
movq %rax, 0x450(%rsp)
leaq 0x448(%rsp), %rdi
callq 0x10310
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x28f40
jmp 0x29014
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
jmp 0x2a081
movq 0x168(%rsp), %rdi
movq 0x4c0(%rsp), %rax
movq %rax, 0x148(%rsp)
addq $0x260, %rdi            # imm = 0x260
movl 0x458(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq %rax, %rsi
leaq 0x4b828(%rip), %rdx     # 0x7479f
leaq 0x428(%rsp), %rdi
callq 0x2a270
jmp 0x28f86
movq 0x148(%rsp), %rdi
leaq 0x428(%rsp), %rsi
callq 0x2a240
jmp 0x28f9d
leaq 0x428(%rsp), %rdi
callq 0x6b50
movq 0x168(%rsp), %rdi
movq 0x4c0(%rsp), %rax
movq %rax, 0x140(%rsp)
addq $0x260, %rdi            # imm = 0x260
movl 0x458(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq %rax, %rsi
leaq 0x4b7c1(%rip), %rdx     # 0x747a2
leaq 0x408(%rsp), %rdi
callq 0x2a270
jmp 0x28ff0
movq 0x140(%rsp), %rdi
leaq 0x408(%rsp), %rsi
callq 0x2a240
jmp 0x29007
leaq 0x408(%rsp), %rdi
callq 0x6b50
movl 0x458(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x458(%rsp)
jmp 0x28e82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x428(%rsp), %rdi
callq 0x6b50
jmp 0x2a081
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x408(%rsp), %rdi
callq 0x6b50
jmp 0x2a081
leaq 0x3f0(%rsp), %rdi
callq 0x2a300
movq 0x168(%rsp), %rdi
movq (%rdi), %rax
movq 0x28(%rax), %rax
callq *%rax
movq %rax, 0x138(%rsp)
jmp 0x2909e
movq 0x138(%rsp), %rax
movq %rax, 0x3e8(%rsp)
movq 0x168(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movb %al, 0x137(%rsp)
jmp 0x290c8
movb 0x137(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x290da
jmp 0x29b55
movq 0x168(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
leaq 0x3f0(%rsp), %rsi
callq *%rax
jmp 0x290f5
movq 0x3e8(%rsp), %rdi
movq (%rdi), %rax
movq 0x30(%rax), %rax
leaq 0x3f0(%rsp), %rsi
callq *%rax
jmp 0x29110
movq 0x3e8(%rsp), %rdi
movq 0x4d8(%rsp), %rsi
callq 0x59590
movl %eax, 0x130(%rsp)
jmp 0x2912e
movq 0x168(%rsp), %rax
movl 0x130(%rsp), %ecx
addl 0x458(%rax), %ecx
movl %ecx, 0x458(%rax)
movq 0x3e8(%rsp), %rax
testb $0x1, 0xc(%rax)
jne 0x29175
jmp 0x290ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
jmp 0x2a074
movq 0x168(%rsp), %rax
movl 0x45c(%rax), %ecx
incl %ecx
movl %ecx, 0x45c(%rax)
movq 0x3e8(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
movl $0x1, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
jmp 0x291a7
movq 0x3e8(%rsp), %rdi
movq (%rdi), %rax
movq 0x28(%rax), %rax
movl $0x1, %esi
xorl %r8d, %r8d
movl %r8d, %edx
movl %r8d, %ecx
callq *%rax
jmp 0x291c8
movq 0x3e8(%rsp), %rdi
callq 0x4c290
movl %eax, 0x12c(%rsp)
jmp 0x291de
movl 0x12c(%rsp), %eax
movl %eax, 0x3e4(%rsp)
cmpl $0x2, 0x3e4(%rsp)
je 0x292ab
leaq 0x3bf(%rsp), %rdi
movq %rdi, 0x120(%rsp)
callq 0x69f0
movq 0x120(%rsp), %rdx
leaq 0x4b587(%rip), %rsi     # 0x747a5
leaq 0x3c0(%rsp), %rdi
callq 0x67c0
jmp 0x2922d
leaq 0x6a3cc(%rip), %rdi     # 0x93600
leaq 0x3c0(%rsp), %rsi
callq 0x71610
jmp 0x29243
leaq 0x3c0(%rsp), %rdi
callq 0x6b50
leaq 0x3bf(%rsp), %rdi
callq 0x65f0
jmp 0x290ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
jmp 0x29299
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x3c0(%rsp), %rdi
callq 0x6b50
leaq 0x3bf(%rsp), %rdi
callq 0x65f0
jmp 0x2a074
movq 0x3e8(%rsp), %rdi
callq 0x4a820
movb %al, 0x11f(%rsp)
jmp 0x292c1
movb 0x11f(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x29387
leaq 0x397(%rsp), %rdi
movq %rdi, 0x110(%rsp)
callq 0x69f0
movq 0x110(%rsp), %rdx
leaq 0x4b4d1(%rip), %rsi     # 0x747cb
leaq 0x398(%rsp), %rdi
callq 0x67c0
jmp 0x29309
leaq 0x6a2f0(%rip), %rdi     # 0x93600
leaq 0x398(%rsp), %rsi
callq 0x71610
jmp 0x2931f
leaq 0x398(%rsp), %rdi
callq 0x6b50
leaq 0x397(%rsp), %rdi
callq 0x65f0
jmp 0x290ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
jmp 0x29375
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x398(%rsp), %rdi
callq 0x6b50
leaq 0x397(%rsp), %rdi
callq 0x65f0
jmp 0x2a074
leaq 0x368(%rsp), %rdi
movq %rdi, 0x108(%rsp)
callq 0x1b250
movq 0x168(%rsp), %rax
movq 0x108(%rsp), %rdi
movl 0x2a8(%rax), %eax
addl %eax, %eax
movl %eax, %esi
callq 0x2a310
jmp 0x293bd
movl $0x0, 0x364(%rsp)
leaq 0x35c(%rsp), %rdi
callq 0x2a380
jmp 0x293d7
movb $0x0, 0x35b(%rsp)
movl $0x0, 0x354(%rsp)
movq 0x168(%rsp), %rcx
movl 0x354(%rsp), %eax
cmpl 0x2a8(%rcx), %eax
jae 0x297e7
movq 0x3e8(%rsp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
movl 0x354(%rsp), %eax
movl %eax, %esi
callq 0x102b0
movq %rdx, 0xf8(%rsp)
movq %rax, 0x100(%rsp)
jmp 0x29434
movq 0xf8(%rsp), %rax
movq 0x100(%rsp), %rcx
movq %rcx, 0x340(%rsp)
movq %rax, 0x348(%rsp)
leaq 0x340(%rsp), %rdi
callq 0x10310
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x29489
jmp 0x297d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
jmp 0x29b43
movq 0x3e8(%rsp), %rdi
addq $0x218, %rdi            # imm = 0x218
movl 0x354(%rsp), %eax
movl %eax, %esi
callq 0x102b0
movq %rdx, 0xe8(%rsp)
movq %rax, 0xf0(%rsp)
jmp 0x294b8
movq 0xe8(%rsp), %rax
movq 0xf0(%rsp), %rcx
movq %rcx, 0x330(%rsp)
movq %rax, 0x338(%rsp)
leaq 0x330(%rsp), %rdi
callq 0x10310
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x29719
movq 0x3e8(%rsp), %rdi
movl 0x354(%rsp), %esi
leaq 0x35c(%rsp), %rdx
callq 0x4bd10
jmp 0x29511
cmpl $0x1, 0x35c(%rsp)
jg 0x29529
cmpl $0x1, 0x360(%rsp)
jle 0x295dc
leaq 0x30f(%rsp), %rdi
movq %rdi, 0xe0(%rsp)
callq 0x69f0
movq 0xe0(%rsp), %rdx
leaq 0x4b2a8(%rip), %rsi     # 0x747f5
leaq 0x310(%rsp), %rdi
callq 0x67c0
jmp 0x2955c
leaq 0x6a09d(%rip), %rdi     # 0x93600
leaq 0x310(%rsp), %rsi
movl $0x1, %edx
callq 0x712f0
jmp 0x29577
leaq 0x310(%rsp), %rdi
callq 0x6b50
leaq 0x30f(%rsp), %rdi
callq 0x65f0
jmp 0x295dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
jmp 0x295ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x310(%rsp), %rdi
callq 0x6b50
leaq 0x30f(%rsp), %rdi
callq 0x65f0
jmp 0x29b43
cmpl $-0x1, 0x35c(%rsp)
je 0x2965b
cmpl $-0x1, 0x360(%rsp)
je 0x2965b
movl 0x35c(%rsp), %eax
testl %eax, %eax
setne %al
movzbl %al, %esi
leaq 0x368(%rsp), %rdi
callq 0x10470
jmp 0x2960e
movl 0x360(%rsp), %eax
testl %eax, %eax
setne %al
movzbl %al, %esi
leaq 0x368(%rsp), %rdi
callq 0x10470
jmp 0x2962c
movl 0x35c(%rsp), %eax
addl 0x364(%rsp), %eax
movl %eax, 0x364(%rsp)
movl 0x360(%rsp), %eax
addl 0x364(%rsp), %eax
movl %eax, 0x364(%rsp)
jmp 0x29714
movb $0x1, 0x35b(%rsp)
leaq 0x2e7(%rsp), %rdi
movq %rdi, 0xd8(%rsp)
callq 0x69f0
movq 0xd8(%rsp), %rdx
leaq 0x4b1a3(%rip), %rsi     # 0x7482a
leaq 0x2e8(%rsp), %rdi
callq 0x67c0
jmp 0x29696
leaq 0x69f63(%rip), %rdi     # 0x93600
leaq 0x2e8(%rsp), %rsi
callq 0x71610
jmp 0x296ac
leaq 0x2e8(%rsp), %rdi
callq 0x6b50
leaq 0x2e7(%rsp), %rdi
callq 0x65f0
jmp 0x297e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
jmp 0x29702
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x2e8(%rsp), %rdi
callq 0x6b50
leaq 0x2e7(%rsp), %rdi
callq 0x65f0
jmp 0x29b43
jmp 0x297cf
movb $0x1, 0x35b(%rsp)
leaq 0x2bf(%rsp), %rdi
movq %rdi, 0xd0(%rsp)
callq 0x69f0
movq 0xd0(%rsp), %rdx
leaq 0x4b0e5(%rip), %rsi     # 0x7482a
leaq 0x2c0(%rsp), %rdi
callq 0x67c0
jmp 0x29754
leaq 0x69ea5(%rip), %rdi     # 0x93600
leaq 0x2c0(%rsp), %rsi
callq 0x71610
jmp 0x2976a
leaq 0x2c0(%rsp), %rdi
callq 0x6b50
leaq 0x2bf(%rsp), %rdi
callq 0x65f0
jmp 0x297e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
jmp 0x297bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x2c0(%rsp), %rdi
callq 0x6b50
leaq 0x2bf(%rsp), %rdi
callq 0x65f0
jmp 0x29b43
jmp 0x297d1
movl 0x354(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x354(%rsp)
jmp 0x293ea
movb 0x35b(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x29808
movl $0x5, 0x2b8(%rsp)
jmp 0x29b12
movl 0x4b0(%rsp), %eax
movq %rax, 0xc8(%rsp)
leaq 0x368(%rsp), %rdi
callq 0xf1d0
movq %rax, %rcx
movq 0xc8(%rsp), %rax
cmpq %rcx, %rax
je 0x298eb
leaq 0x297(%rsp), %rdi
movq %rdi, 0xc0(%rsp)
callq 0x69f0
movq 0xc0(%rsp), %rdx
leaq 0x4afff(%rip), %rsi     # 0x7485b
leaq 0x298(%rsp), %rdi
callq 0x67c0
jmp 0x2986b
leaq 0x69d8e(%rip), %rdi     # 0x93600
leaq 0x298(%rsp), %rsi
movl $0x1, %edx
callq 0x712f0
jmp 0x29886
leaq 0x298(%rsp), %rdi
callq 0x6b50
leaq 0x297(%rsp), %rdi
callq 0x65f0
jmp 0x298eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
jmp 0x298d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x298(%rsp), %rdi
callq 0x6b50
leaq 0x297(%rsp), %rdi
callq 0x65f0
jmp 0x29b43
movq 0x3e8(%rsp), %rsi
leaq 0x270(%rsp), %rdi
callq 0x4a260
jmp 0x29902
movl 0x4b4(%rsp), %eax
incl %eax
movl %eax, 0x4b4(%rsp)
movq 0x3e8(%rsp), %rsi
leaq 0x250(%rsp), %rdi
callq 0x4a390
jmp 0x29929
leaq 0x468(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x2a240
jmp 0x29940
leaq 0x250(%rsp), %rdi
callq 0x6b50
movq 0x3e8(%rsp), %rsi
leaq 0x230(%rsp), %rdi
callq 0x4a450
jmp 0x29964
leaq 0x468(%rsp), %rdi
leaq 0x230(%rsp), %rsi
callq 0x2a240
jmp 0x2997b
leaq 0x230(%rsp), %rdi
callq 0x6b50
movq 0x3e8(%rsp), %rdi
callq 0x4a2c0
movl %eax, 0xbc(%rsp)
jmp 0x2999e
movl 0xbc(%rsp), %eax
movl %eax, 0x22c(%rsp)
leaq 0x480(%rsp), %rdi
leaq 0x22c(%rsp), %rsi
callq 0x2a3a0
jmp 0x299c3
movl $0x0, 0x228(%rsp)
movl 0x228(%rsp), %eax
movq %rax, 0xb0(%rsp)
leaq 0x368(%rsp), %rdi
callq 0xf1d0
movq %rax, %rcx
movq 0xb0(%rsp), %rax
cmpq %rcx, %rax
jae 0x29afa
movl 0x228(%rsp), %eax
movl %eax, %esi
leaq 0x498(%rsp), %rdi
callq 0x103e0
movq %rax, 0x98(%rsp)
movl 0x228(%rsp), %eax
movl %eax, %esi
leaq 0x368(%rsp), %rdi
callq 0x102b0
movq %rdx, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
jmp 0x29a44
movq 0xa0(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq %rcx, 0x218(%rsp)
movq %rax, 0x220(%rsp)
leaq 0x218(%rsp), %rdi
callq 0x10310
movq 0x98(%rsp), %rdi
movzbl %al, %esi
callq 0x10470
jmp 0x29a83
jmp 0x29a85
movl 0x228(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x228(%rsp)
jmp 0x299ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
jmp 0x29b36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x250(%rsp), %rdi
callq 0x6b50
jmp 0x29b36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x230(%rsp), %rdi
callq 0x6b50
jmp 0x29b36
leaq 0x270(%rsp), %rdi
callq 0x6b50
movl $0x0, 0x2b8(%rsp)
leaq 0x368(%rsp), %rdi
callq 0x11300
movl 0x2b8(%rsp), %eax
testl %eax, %eax
je 0x29b31
jmp 0x29b2c
jmp 0x290ae
jmp 0x290ae
leaq 0x270(%rsp), %rdi
callq 0x6b50
leaq 0x368(%rsp), %rdi
callq 0x11300
jmp 0x2a074
leaq 0x200(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x10240
leaq 0x1e8(%rsp), %rdi
callq 0x10250
leaq 0x1d0(%rsp), %rdi
callq 0x10260
movq 0x4d0(%rsp), %rdi
callq 0xf1b0
movq %rax, 0x88(%rsp)
leaq 0x498(%rsp), %rdi
callq 0xf1b0
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdi
addq %rax, %rsi
callq 0x10340
jmp 0x29bc0
movl $0x0, 0x1cc(%rsp)
movl 0x1cc(%rsp), %eax
movq %rax, 0x80(%rsp)
movq 0x4c8(%rsp), %rdi
callq 0xe850
movq %rax, %rcx
movq 0x80(%rsp), %rax
cmpq %rcx, %rax
jae 0x29fab
leaq 0x480(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x1b9c0
movq 0x70(%rsp), %rdi
movq %rax, 0x1b8(%rsp)
callq 0x1b840
movq %rax, 0x1b0(%rsp)
movq 0x4c8(%rsp), %rdi
movl 0x1cc(%rsp), %eax
movl %eax, %esi
callq 0xe8b0
movq %rax, %rdx
movq 0x1b8(%rsp), %rdi
movq 0x1b0(%rsp), %rsi
callq 0x2a3d0
movq %rax, 0x78(%rsp)
jmp 0x29c5c
movq 0x78(%rsp), %rax
movq %rax, 0x1c0(%rsp)
leaq 0x480(%rsp), %rdi
callq 0x1b9c0
movq %rax, 0x1a8(%rsp)
leaq 0x1c0(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x1b980
movl %eax, 0x1c8(%rsp)
cmpl $0x0, 0x1c8(%rsp)
jl 0x29f93
movslq 0x1c8(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x480(%rsp), %rdi
callq 0xe850
movq %rax, %rcx
movq 0x68(%rsp), %rax
cmpq %rcx, %rax
jae 0x29f93
movq 0x4b8(%rsp), %rdi
movl 0x1cc(%rsp), %eax
shll %eax
movl %eax, %eax
movl %eax, %esi
callq 0x10290
movq %rax, 0x60(%rsp)
movl 0x1c8(%rsp), %eax
shll %eax
movslq %eax, %rsi
leaq 0x468(%rsp), %rdi
callq 0x10290
movq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x2a430
testb $0x1, %al
jne 0x29d21
jmp 0x29f91
movq 0x4b8(%rsp), %rdi
movl 0x1cc(%rsp), %eax
shll %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x10290
movq %rax, 0x58(%rsp)
movl 0x1c8(%rsp), %eax
shll %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x468(%rsp), %rdi
callq 0x10290
movq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0x2a430
testb $0x1, %al
jne 0x29d75
jmp 0x29f91
movq 0x4c8(%rsp), %rdi
movl 0x1cc(%rsp), %eax
movl %eax, %esi
callq 0xe8b0
movq %rax, %rsi
leaq 0x1e8(%rsp), %rdi
callq 0x10400
jmp 0x29d9d
movl $0x0, 0x1a4(%rsp)
movl 0x1a4(%rsp), %eax
movq %rax, 0x50(%rsp)
movq 0x4d0(%rsp), %rdi
callq 0xf1b0
movq %rax, %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
jae 0x29eae
movl 0x1a4(%rsp), %eax
movl %eax, %esi
leaq 0x200(%rsp), %rdi
callq 0x103e0
movq %rax, 0x38(%rsp)
movq 0x4d0(%rsp), %rdi
movl 0x1a4(%rsp), %eax
movl %eax, %esi
callq 0x103e0
movq %rax, %rdi
movl 0x1cc(%rsp), %eax
movl %eax, %esi
callq 0x102b0
movq %rdx, 0x40(%rsp)
movq %rax, 0x48(%rsp)
jmp 0x29e20
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
movq %rcx, 0x190(%rsp)
movq %rax, 0x198(%rsp)
leaq 0x190(%rsp), %rdi
callq 0x10310
movq 0x38(%rsp), %rdi
movzbl %al, %esi
callq 0x10470
jmp 0x29e56
jmp 0x29e58
movl 0x1a4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a4(%rsp)
jmp 0x29da8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x460(%rsp)
movl %eax, 0x45c(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x10cc0
leaq 0x1e8(%rsp), %rdi
callq 0x10c00
leaq 0x200(%rsp), %rdi
callq 0x10c60
jmp 0x2a074
movl $0x0, 0x18c(%rsp)
movl 0x18c(%rsp), %eax
movq %rax, 0x30(%rsp)
leaq 0x498(%rsp), %rdi
callq 0xf1b0
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
jae 0x29f8f
movq 0x4d0(%rsp), %rdi
callq 0xf1b0
movq %rax, %rsi
movl 0x18c(%rsp), %eax
addq %rax, %rsi
leaq 0x200(%rsp), %rdi
callq 0x103e0
movq %rax, 0x18(%rsp)
movl 0x18c(%rsp), %eax
movl %eax, %esi
leaq 0x498(%rsp), %rdi
callq 0x103e0
movq %rax, %rdi
movslq 0x1c8(%rsp), %rsi
callq 0x102b0
movq %rdx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
jmp 0x29f41
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rcx, 0x178(%rsp)
movq %rax, 0x180(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x10310
movq 0x18(%rsp), %rdi
movzbl %al, %esi
callq 0x10470
jmp 0x29f77
jmp 0x29f79
movl 0x18c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18c(%rsp)
jmp 0x29eb9
jmp 0x29f91
jmp 0x29f93
jmp 0x29f95
movl 0x1cc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1cc(%rsp)
jmp 0x29bcb
movq 0x4d0(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0x10810
jmp 0x29fc2
movq 0x4c8(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0x10550
jmp 0x29fd9
movq 0x3e8(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x29ff7
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movl 0x4b4(%rsp), %eax
movl %eax, 0xc(%rsp)
movl $0x1, 0x2b8(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x10cc0
leaq 0x1e8(%rsp), %rdi
callq 0x10c00
leaq 0x200(%rsp), %rdi
callq 0x10c60
leaq 0x3f0(%rsp), %rdi
callq 0x267c0
leaq 0x468(%rsp), %rdi
callq 0x10cc0
leaq 0x480(%rsp), %rdi
callq 0x10c00
leaq 0x498(%rsp), %rdi
callq 0x10c60
movl 0xc(%rsp), %eax
addq $0x4e8, %rsp            # imm = 0x4E8
retq
leaq 0x3f0(%rsp), %rdi
callq 0x267c0
leaq 0x468(%rsp), %rdi
callq 0x10cc0
leaq 0x480(%rsp), %rdi
callq 0x10c00
leaq 0x498(%rsp), %rdi
callq 0x10c60
movq 0x460(%rsp), %rdi
callq 0x69e0
nopw %cs:(%rax,%rax)
nop