// File: /workspace/github_cpp_makefile_star2_O1/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 0x114e6
addl %eax, %eax
movq %r14, 0x78(%rsp)
movq %r14, %rdi
movq %rax, 0x60(%rsp)
movq %rax, %rsi
callq 0xc232
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1300a
movq %r13, %rdi
callq 0x114e6
testl %eax, %eax
je 0x11d7e
leaq 0x18(%rsp), %rbp
movl $0x8, %r12d
xorl %r15d, %r15d
leaq 0x8(%rsp), %r14
movq 0x430(%r13), %rax
movq %r15, %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rax
btq %r15, %rax
jae 0x11d64
movq 0x260(%r13), %rax
movq %rbp, 0x8(%rsp)
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0xc7d8
movq %r14, %rdi
leaq 0x27b73(%rip), %rsi     # 0x3986f
callq 0x5870
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13458
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11d1b
callq 0x5410
movq 0x260(%r13), %rax
movq %rbp, 0x8(%rsp)
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0xc7d8
movq %r14, %rdi
leaq 0x27b2d(%rip), %rsi     # 0x39872
callq 0x5870
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13458
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11d64
callq 0x5410
incq %r15
movq %r13, %rdi
callq 0x114e6
movl %eax, %eax
addq $0x20, %r12
cmpq %rax, %r15
jb 0x11cb6
xorps %xmm0, %xmm0
movaps %xmm0, 0x140(%rsp)
movq $0x0, 0x150(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x28(%rax)
movq %rax, %rbx
leaq 0x140(%rsp), %rbp
xorl %r12d, %r12d
movq (%r13), %rax
movq %r13, %rdi
callq *0x18(%rax)
testb %al, %al
jne 0x122b4
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 0x28b6c
addl %eax, 0x458(%r13)
cmpb $0x0, 0xc(%rbx)
je 0x11dad
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 0x230f4
cmpl $0x2, %eax
jne 0x120a0
movq %rbx, %rdi
callq 0x22004
testb %al, %al
je 0x120ef
movq %r12, 0x8(%rsp)
movl %r12d, 0x10(%rsp)
movq %r12, 0x18(%rsp)
movl %r12d, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movl 0x2a8(%r13), %esi
addl %esi, %esi
leaq 0x8(%rsp), %rdi
callq 0x130be
movq $0x0, 0x30(%rsp)
cmpl $0x0, 0x2a8(%r13)
je 0x11f8b
xorl %r14d, %r14d
movq 0x1f0(%rbx), %rdx
movl $0x1, %eax
movl %r14d, %ecx
shlq %cl, %rax
movq %r14, %rcx
shrq $0x6, %rcx
movq (%rdx,%rcx,8), %rdx
btq %r14, %rdx
jae 0x11f78
movq 0x218(%rbx), %rdx
testq %rax, (%rdx,%rcx,8)
je 0x121dd
movq %rbx, %rdi
movl %r14d, %esi
leaq 0x30(%rsp), %rdx
callq 0x22d94
cmpl $0x1, 0x30(%rsp)
jg 0x11edd
cmpl $0x2, 0x34(%rsp)
jl 0x11f39
leaq 0xf0(%rsp), %rax
movq %rax, 0xe0(%rsp)
leaq 0xe0(%rsp), %r15
movq %r15, %rdi
leaq 0x279c6(%rip), %rsi     # 0x398c5
leaq 0x279f3(%rip), %rdx     # 0x398f9
callq 0xc868
leaq 0x38596(%rip), %rdi     # 0x4a4a8
movq %r15, %rsi
movl $0x1, %edx
callq 0x3721e
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x11f39
callq 0x5410
movl 0x30(%rsp), %eax
cmpl $-0x1, %eax
je 0x1222c
cmpl $-0x1, 0x34(%rsp)
je 0x1222c
xorl %esi, %esi
testl %eax, %eax
setne %sil
leaq 0x8(%rsp), %rdi
callq 0xc26e
xorl %esi, %esi
cmpl $0x0, 0x34(%rsp)
setne %sil
leaq 0x8(%rsp), %rdi
callq 0xc26e
incq %r14
movl 0x2a8(%r13), %eax
cmpq %rax, %r14
jb 0x11e87
movq 0x18(%rsp), %rax
movl 0x20(%rsp), %ecx
subq 0x8(%rsp), %rax
leaq (%rcx,%rax,8), %rax
cmpq 0x60(%rsp), %rax
movq 0x68(%rsp), %r14
je 0x12005
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x80(%rsp), %r15
movq %r15, %rdi
leaq 0x27960(%rip), %rsi     # 0x3992b
leaq 0x27983(%rip), %rdx     # 0x39955
callq 0xc868
leaq 0x384ca(%rip), %rdi     # 0x4a4a8
movq %r15, %rsi
movl $0x1, %edx
callq 0x3721e
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x12005
callq 0x5410
leaq 0x158(%rsp), %rdi
movq %rbx, %rsi
callq 0x21cbc
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21d4a
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x13458
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x12046
callq 0x5410
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21dae
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x13458
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x12077
callq 0x5410
movq %rbx, %rdi
callq 0x21cf8
movl %eax, 0x40(%rsp)
movq 0x8(%r14), %rsi
cmpq 0x10(%r14), %rsi
je 0x1214f
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%r14)
jmp 0x1215c
leaq 0x130(%rsp), %rax
movq %rax, 0x120(%rsp)
leaq 0x120(%rsp), %r14
movq %r14, %rdi
leaq 0x277b3(%rip), %rsi     # 0x39875
leaq 0x277d1(%rip), %rdx     # 0x3989a
callq 0xc868
leaq 0x383d3(%rip), %rdi     # 0x4a4a8
movq %r14, %rsi
callq 0x37516
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
jmp 0x1213c
leaq 0x110(%rsp), %rax
movq %rax, 0x100(%rsp)
leaq 0x100(%rsp), %r14
movq %r14, %rdi
leaq 0x2778a(%rip), %rsi     # 0x3989b
leaq 0x277ac(%rip), %rdx     # 0x398c4
callq 0xc868
leaq 0x38384(%rip), %rdi     # 0x4a4a8
movq %r14, %rsi
callq 0x37516
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x11dad
callq 0x5410
jmp 0x11dad
movq %r14, %rdi
leaq 0x40(%rsp), %rdx
callq 0x136ee
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rcx
movl 0x20(%rsp), %edx
subq %rax, %rcx
shlq $0x3, %rcx
addq %rdx, %rcx
je 0x121c8
movl $0x1, %r14d
xorl %ecx, %ecx
leaq (%rcx,%rcx,4), %rdi
shlq $0x3, %rdi
movq 0x78(%rsp), %rdx
addq (%rdx), %rdi
movq %rcx, %rdx
shrq $0x6, %rdx
movq (%rax,%rdx,8), %rax
xorl %esi, %esi
btq %rcx, %rax
setb %sil
callq 0xc26e
movl %r14d, %ecx
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rdx
movl 0x20(%rsp), %esi
subq %rax, %rdx
leaq (%rsi,%rdx,8), %rdx
incl %r14d
cmpq %rcx, %rdx
ja 0x1217e
movq 0x158(%rsp), %rdi
leaq 0x168(%rsp), %rax
jmp 0x12279
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
leaq 0x276fb(%rip), %rsi     # 0x398fa
leaq 0x27724(%rip), %rdx     # 0x3992a
callq 0xc868
leaq 0x38296(%rip), %rdi     # 0x4a4a8
movq %r14, %rsi
callq 0x37516
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
jmp 0x12279
leaq 0xd0(%rsp), %rax
movq %rax, 0xc0(%rsp)
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
leaq 0x276ac(%rip), %rsi     # 0x398fa
leaq 0x276d5(%rip), %rdx     # 0x3992a
callq 0xc868
leaq 0x38247(%rip), %rdi     # 0x4a4a8
movq %r14, %rsi
callq 0x37516
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x12283
callq 0x5410
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x11dad
callq 0x5410
movq %r12, 0x8(%rsp)
movl %r12d, 0x10(%rsp)
movq %r12, 0x18(%rsp)
movl %r12d, 0x20(%rsp)
movq %r12, 0x28(%rsp)
jmp 0x11dad
testq %rbx, %rbx
je 0x122c2
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x122d4
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 0x123f2
jmp 0x123fe
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
jmp 0x123f2
jmp 0x123fe
jmp 0x1242b
movq %rax, %rbx
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
jmp 0x123f2
jmp 0x123fe
jmp 0x12349
jmp 0x123df
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x123e2
callq 0x5410
jmp 0x123e2
jmp 0x123df
jmp 0x123fe
jmp 0x123df
jmp 0x123fe
movq %rax, %rbx
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
jmp 0x123a1
jmp 0x1242b
movq %rax, %rbx
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x1242e
callq 0x5410
jmp 0x1242e
jmp 0x1242b
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
jmp 0x123f2
jmp 0x123fe
jmp 0x123d0
jmp 0x123d0
jmp 0x123d0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
jne 0x1243b
jmp 0x12440
movq %rax, %rbx
movq 0x158(%rsp), %rdi
leaq 0x168(%rsp), %rax
cmpq %rax, %rdi
je 0x12401
callq 0x5410
jmp 0x12401
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1242e
callq 0x5410
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movq %rax, 0x28(%rsp)
jmp 0x1242e
movq %rax, %rbx
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x12440
callq 0x5410
movq %rbx, %rdi
callq 0x57d0