// File: /workspace/github_cpp_makefile_star2_O3/auton1[P]viterbi/variant_file.cpp
// Function: variant_file::read_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>>>>&)
void variant_file::read_file(const parameters &params, vector<vector<bool> > &haplotypes, vector<unsigned int> &positions, vector<string> &haplotype_names, vector<string> &alleles)
{
	unsigned int N_chr = 2*N_kept_individuals();
	haplotypes.resize(N_chr);

	haplotype_names.resize(0);
	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();

		alleles.push_back(e->get_REF());
		alleles.push_back(e->get_ALT());
		positions.push_back(e->get_POS());
		
		for (unsigned int ui=0; ui<tmp.size(); ui++)
			haplotypes[ui].push_back(tmp[ui]);
	}
	delete e;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %r9, 0x38(%rsp)
movq %r8, %rbx
movq %rcx, 0x68(%rsp)
movq %rdx, %r14
movq %rsi, 0x70(%rsp)
movq %rdi, %r13
callq 0x11532
addl %eax, %eax
movq %r14, 0x78(%rsp)
movq %r14, %rdi
movq %rax, 0x60(%rsp)
movq %rax, %rsi
callq 0xc1f2
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1300e
movq %r13, %rdi
callq 0x11532
testl %eax, %eax
je 0x11dc4
leaq 0x20(%rsp), %rbp
movl $0x8, %r12d
xorl %r15d, %r15d
leaq 0x10(%rsp), %r14
movq 0x430(%r13), %rax
movq %r15, %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rax
btq %r15, %rax
jae 0x11daa
movq 0x260(%r13), %rax
movq %rbp, 0x10(%rsp)
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0xc7c8
movq %r14, %rdi
leaq 0x26b2d(%rip), %rsi     # 0x3886f
callq 0x5870
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1341e
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11d61
callq 0x5410
movq 0x260(%r13), %rax
movq %rbp, 0x10(%rsp)
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0xc7c8
movq %r14, %rdi
leaq 0x26ae7(%rip), %rsi     # 0x38872
callq 0x5870
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1341e
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11daa
callq 0x5410
incq %r15
movq %r13, %rdi
callq 0x11532
movl %eax, %eax
addq $0x20, %r12
cmpq %rax, %r15
jb 0x11cfc
xorps %xmm0, %xmm0
movaps %xmm0, 0x120(%rsp)
movq $0x0, 0x130(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x28(%rax)
movq %rax, %rbx
leaq 0x168(%rsp), %r12
leaq 0x120(%rsp), %rbp
movq (%r13), %rax
movq %r13, %rdi
callq *0x18(%rax)
testb %al, %al
jne 0x122df
movq (%r13), %rax
movq %r13, %rdi
movq %rbp, %rsi
callq *0x20(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq %rbp, %rsi
callq *0x30(%rax)
movq %rbx, %rdi
movq 0x70(%rsp), %rsi
callq 0x28950
addl %eax, 0x458(%r13)
cmpb $0x0, 0xc(%rbx)
je 0x11df8
incl 0x45c(%r13)
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq *0x10(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *0x28(%rax)
movq %rbx, %rdi
callq 0x22eb0
cmpl $0x2, %eax
jne 0x120db
movq %rbx, %rdi
callq 0x21e06
testb %al, %al
je 0x1212a
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl %eax, 0x28(%rsp)
movq %rax, 0x30(%rsp)
movl 0x2a8(%r13), %esi
addl %esi, %esi
leaq 0x10(%rsp), %rdi
callq 0x130c2
movq $0x0, 0x8(%rsp)
movl 0x2a8(%r13), %eax
testl %eax, %eax
je 0x11fc6
xorl %r14d, %r14d
movq 0x1f0(%rbx), %rsi
movl $0x1, %edx
movl %r14d, %ecx
shlq %cl, %rdx
movl %r14d, %ecx
shrl $0x6, %ecx
movq (%rsi,%rcx,8), %rsi
btq %r14, %rsi
jae 0x11fba
movq 0x218(%rbx), %rax
testq %rdx, (%rax,%rcx,8)
je 0x12218
movq %rbx, %rdi
movl %r14d, %esi
leaq 0x8(%rsp), %rdx
callq 0x22b50
cmpl $0x1, 0x8(%rsp)
jg 0x11f28
cmpl $0x2, 0xc(%rsp)
jl 0x11f74
movq %r12, 0x158(%rsp)
leaq 0x158(%rsp), %r15
movq %r15, %rdi
leaq 0x26983(%rip), %rsi     # 0x388c5
leaq 0x269b0(%rip), %rdx     # 0x388f9
callq 0xc85e
leaq 0x37553(%rip), %rdi     # 0x494a8
movq %r15, %rsi
movl $0x1, %edx
callq 0x36ec8
movq 0x158(%rsp), %rdi
cmpq %r12, %rdi
je 0x11f74
callq 0x5410
movl 0x8(%rsp), %eax
cmpl $-0x1, %eax
je 0x12267
cmpl $-0x1, 0xc(%rsp)
je 0x12267
xorl %esi, %esi
testl %eax, %eax
setne %sil
leaq 0x10(%rsp), %rdi
callq 0xc22e
xorl %esi, %esi
cmpl $0x0, 0xc(%rsp)
setne %sil
leaq 0x10(%rsp), %rdi
callq 0xc22e
movl 0x2a8(%r13), %eax
incl %r14d
cmpl %eax, %r14d
jb 0x11ed3
movq 0x20(%rsp), %rax
movl 0x28(%rsp), %ecx
subq 0x10(%rsp), %rax
leaq (%rcx,%rax,8), %rax
cmpq 0x60(%rsp), %rax
movq 0x68(%rsp), %r14
je 0x12040
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x80(%rsp), %r15
movq %r15, %rdi
leaq 0x26925(%rip), %rsi     # 0x3892b
leaq 0x26948(%rip), %rdx     # 0x38955
callq 0xc85e
leaq 0x3748f(%rip), %rdi     # 0x494a8
movq %r15, %rsi
movl $0x1, %edx
callq 0x36ec8
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x12040
callq 0x5410
leaq 0x138(%rsp), %rdi
movq %rbx, %rsi
callq 0x21ac0
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21b4e
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x1341e
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x12081
callq 0x5410
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21bb2
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x1341e
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x120b2
callq 0x5410
movq %rbx, %rdi
callq 0x21afc
movl %eax, 0x40(%rsp)
movq 0x8(%r14), %rsi
cmpq 0x10(%r14), %rsi
je 0x1218a
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%r14)
jmp 0x12197
leaq 0x110(%rsp), %rax
movq %rax, 0x100(%rsp)
leaq 0x100(%rsp), %r14
movq %r14, %rdi
leaq 0x26778(%rip), %rsi     # 0x38875
leaq 0x26796(%rip), %rdx     # 0x3889a
callq 0xc85e
leaq 0x37398(%rip), %rdi     # 0x494a8
movq %r14, %rsi
callq 0x371c0
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
jmp 0x12177
leaq 0xf0(%rsp), %rax
movq %rax, 0xe0(%rsp)
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
leaq 0x2674f(%rip), %rsi     # 0x3889b
leaq 0x26771(%rip), %rdx     # 0x388c4
callq 0xc85e
leaq 0x37349(%rip), %rdi     # 0x494a8
movq %r14, %rsi
callq 0x371c0
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x11df8
callq 0x5410
jmp 0x11df8
movq %r14, %rdi
leaq 0x40(%rsp), %rdx
callq 0x136b4
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
movl 0x28(%rsp), %edx
subq %rax, %rcx
shlq $0x3, %rcx
addq %rdx, %rcx
je 0x12203
movl $0x1, %r14d
xorl %ecx, %ecx
leal -0x1(%r14), %edx
leaq (%rcx,%rcx,4), %rdi
shlq $0x3, %rdi
movq 0x78(%rsp), %rsi
addq (%rsi), %rdi
shrl $0x6, %edx
movq (%rax,%rdx,8), %rax
xorl %esi, %esi
btq %rcx, %rax
setb %sil
callq 0xc22e
movl %r14d, %ecx
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rdx
movl 0x28(%rsp), %esi
subq %rax, %rdx
leaq (%rsi,%rdx,8), %rdx
incl %r14d
cmpq %rcx, %rdx
ja 0x121b9
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
jmp 0x122b4
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
leaq 0x266c0(%rip), %rsi     # 0x388fa
leaq 0x266e9(%rip), %rdx     # 0x3892a
callq 0xc85e
leaq 0x3725b(%rip), %rdi     # 0x494a8
movq %r14, %rsi
callq 0x371c0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
jmp 0x122b4
leaq 0xd0(%rsp), %rax
movq %rax, 0xc0(%rsp)
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
leaq 0x26671(%rip), %rsi     # 0x388fa
leaq 0x2669a(%rip), %rdx     # 0x3892a
callq 0xc85e
leaq 0x3720c(%rip), %rdi     # 0x494a8
movq %r14, %rsi
callq 0x371c0
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x122be
callq 0x5410
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x11df8
callq 0x5410
movq $0x0, 0x10(%rsp)
jmp 0x11df8
testq %rbx, %rbx
je 0x122ed
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x122ff
callq 0x5410
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
jmp 0x12412
jmp 0x1241e
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
jmp 0x12412
jmp 0x1241e
jmp 0x12446
movq %rax, %rbx
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
jmp 0x12412
jmp 0x1241e
jmp 0x12374
jmp 0x123ff
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x12402
callq 0x5410
jmp 0x12402
jmp 0x123ff
jmp 0x1241e
jmp 0x123ff
jmp 0x1241e
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
jmp 0x123c8
jmp 0x12446
movq %rax, %rbx
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x12449
callq 0x5410
jmp 0x12449
jmp 0x12446
movq %rax, %rbx
movq 0x158(%rsp), %rdi
cmpq %r12, %rdi
jne 0x12417
jmp 0x12421
jmp 0x1241e
jmp 0x123f0
jmp 0x123f0
jmp 0x123f0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
jne 0x12456
jmp 0x1245b
movq %rax, %rbx
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x12421
callq 0x5410
jmp 0x12421
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x12449
callq 0x5410
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movq %rax, 0x20(%rsp)
jmp 0x12449
movq %rax, %rbx
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x1245b
callq 0x5410
movq %rbx, %rdi
callq 0x57d0
nop