// File: /workspace/github_cpp_makefile_star2_O1/auton1[P]viterbi/bcf_entry.cpp
// Function: bcf_entry::print_bcf(BGZF*, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<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>>>> const&, bool)
void bcf_entry::print_bcf(BGZF* out, const set<string> &INFO_to_keep, bool keep_all_INFO)
{
	if (fully_parsed == false)
		parse_full_entry(true);

	vector<char> out_vector, tmp_vector;
	vector<pair< string, string > > tmp_info;
	int index;

	out_vector.resize(INFO_pos);
	memcpy(&out_vector[0], &line[0], INFO_pos);

	if (keep_all_INFO)
	{
		unsigned int curr_size = out_vector.size();
		out_vector.resize(curr_size + (FORMAT_pos - INFO_pos) );
		memcpy(&out_vector[curr_size], &line[INFO_pos], (FORMAT_pos - INFO_pos));
	}
	else
	{
		int map_type, number;

		get_n_allele_info(tmp_vector);
		memcpy(&out_vector[6*sizeof(int32_t)], &tmp_vector[0], sizeof(char));

		tmp_info = get_INFO_vector(INFO_to_keep, keep_all_INFO);
		for(unsigned int ui=0; ui<tmp_info.size(); ui++)
		{
			tmp_vector.resize(0);
			index = entry_header.INFO_reverse_map[ tmp_info[ui].first ];
			make_typed_int(tmp_vector, index, true);
			out_vector.insert(out_vector.end(), tmp_vector.begin(), tmp_vector.end());

			tmp_vector.resize(0);
			map_type = entry_header.INFO_map[ index ].Type;
			number = entry_header.INFO_map[ index ].N_entries;

			if (map_type == Integer)
				make_typed_int_vector(tmp_vector, tmp_info[ui].second, number );
			else if (map_type == Float)
				make_typed_float_vector(tmp_vector, tmp_info[ui].second, number );
			else if ( (map_type == Character) or (map_type == String) )
				make_typed_string(tmp_vector, tmp_info[ui].second, true );
			else if (map_type == Flag)
				make_typed_int(tmp_vector, 1, true );
			else
				LOG.error("Invalid type in INFO definition", 0);

			out_vector.insert(out_vector.end(), tmp_vector.begin(), tmp_vector.end());
		}
	}

	uint32_t l_shared = (uint32_t)out_vector.size() - (uint32_t)(2*sizeof(uint32_t));
	memcpy(&out_vector[0], &l_shared, sizeof(uint32_t));

	unsigned int size, l_pos, type;
	for (unsigned int ui=0; ui<N_format; ui++)
	{
		type = FORMAT_types[ui];
		size = FORMAT_sizes[ui];

		tmp_vector.resize(0);
		make_typed_int(tmp_vector, FORMAT_keys[ui], true);
		out_vector.insert(out_vector.end(), tmp_vector.begin(), tmp_vector.end() );

		tmp_vector.resize(0);
		make_type_size(tmp_vector, type, size);
		out_vector.insert(out_vector.end(), tmp_vector.begin(), tmp_vector.end() );

		for (unsigned int uj=0; uj<N_indv; uj++)
		{
			if (include_indv[uj] == false)
				continue;

			tmp_vector.resize(FORMAT_skip[ui]);
			l_pos = FORMAT_positions[ui] + FORMAT_skip[ui]*uj;

			if ( ((int)uj == GT_idx) and (include_genotype[uj] == false) )
				for (unsigned int ploidy = 0; ploidy < FORMAT_skip[ui]; ploidy++)
					tmp_vector[ploidy] = (int8_t)0x81;
			else
				memcpy(&tmp_vector[0], &line[l_pos], FORMAT_skip[ui]);

			out_vector.insert(out_vector.end(), tmp_vector.begin(), tmp_vector.end() );
		}
	}
	uint32_t l_indv = (uint32_t)out_vector.size() - l_shared - (uint32_t)(2*sizeof(uint32_t));
	memcpy(&out_vector[sizeof(uint32_t)], &l_indv, sizeof(uint32_t));

	bgzf_write(out, &out_vector[0], out_vector.size());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, 0x78(%rsp)
movq %rdi, %r14
cmpb $0x0, 0x3d9(%rdi)
jne 0x1abdf
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *0x18(%rax)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq %rax, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movl 0x6e8(%r14), %esi
callq 0xf31a
movq 0x10(%rsp), %rdi
movq 0x3c0(%r14), %rsi
movl 0x6e8(%r14), %edx
callq 0x5380
testb %bpl, %bpl
je 0x1ac76
leaq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rbx
subq (%rdi), %rbx
movl 0x6f4(%r14), %esi
subl 0x6e8(%r14), %esi
addl %ebx, %esi
callq 0xf31a
movl %ebx, %edi
addq 0x10(%rsp), %rdi
movl 0x6e8(%r14), %esi
movl 0x6f4(%r14), %edx
subl %esi, %edx
addq 0x3c0(%r14), %rsi
callq 0x5380
jmp 0x1aec5
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x23774
movq 0x10(%rsp), %rax
movq 0x30(%rsp), %rcx
movb (%rcx), %cl
movb %cl, 0x18(%rax)
leaq 0xa0(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x227fe
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %rdi
movaps %xmm0, (%rdi)
movaps 0x50(%rsp), %xmm0
movq 0x60(%rsp), %rax
leaq 0xa0(%rsp), %rbx
movaps (%rbx), %xmm1
movaps %xmm1, 0x50(%rsp)
movq 0x10(%rbx), %rcx
movq %rcx, 0x60(%rsp)
movq %rax, 0x10(%rdi)
movaps (%rdi), %xmm1
movaps %xmm0, (%rdi)
movaps %xmm1, (%rbx)
movq $0x0, 0x10(%rbx)
callq 0x1b4a6
movq %rbx, %rdi
callq 0x1b4a6
movq 0x58(%rsp), %rax
cmpq 0x50(%rsp), %rax
je 0x1aec5
leaq 0x190(%r14), %rax
movq %rax, 0x68(%rsp)
leaq 0x70(%r14), %r12
movl $0x1, %r15d
xorl %ebx, %ebx
leaq 0x30(%rsp), %r13
movq %r13, %rdi
xorl %esi, %esi
callq 0xf31a
shlq $0x6, %rbx
movq 0x50(%rsp), %rsi
addq %rbx, %rsi
movq 0x68(%rsp), %rdi
callq 0x1785c
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movq %r14, %rdi
movq %r13, %rsi
leaq 0xc(%rsp), %rdx
movl $0x1, %ecx
callq 0x1fd74
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x10(%rsp), %rdi
callq 0x1be7e
movq %r13, %rdi
xorl %esi, %esi
callq 0xf31a
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x177f8
movl 0x88(%rax), %ebp
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x177f8
movl 0x44(%rax), %ecx
cmpl $0x1, %ebp
je 0x1adce
testl %ebp, %ebp
jne 0x1adeb
movq 0x50(%rsp), %rax
leaq (%rax,%rbx), %rdx
addq $0x20, %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x204a8
jmp 0x1ae8f
movq 0x50(%rsp), %rax
leaq (%rax,%rbx), %rdx
addq $0x20, %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x20c9a
jmp 0x1ae8f
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x1ae14
movq 0x50(%rsp), %rax
leaq (%rax,%rbx), %rdx
addq $0x20, %rdx
movq %r14, %rdi
movq %r13, %rsi
movl $0x1, %ecx
callq 0x1fbdc
jmp 0x1ae8f
cmpl $0x4, %ebp
jne 0x1ae3e
movl $0x1, 0x80(%rsp)
movq %r14, %rdi
movq %r13, %rsi
leaq 0x80(%rsp), %rdx
movl $0x1, %ecx
callq 0x1fd74
jmp 0x1ae8f
leaq 0xc8(%rsp), %rbp
movq %rbp, 0xb8(%rsp)
leaq 0xb8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x1f2da(%rip), %rsi     # 0x3a13a
leaq 0x1f2f2(%rip), %rdx     # 0x3a159
callq 0xc868
leaq 0x2f635(%rip), %rdi     # 0x4a4a8
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3721e
movq 0xb8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1ae8f
callq 0x5410
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x10(%rsp), %rdi
callq 0x1be7e
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
movl %r15d, %ebx
sarq $0x6, %rax
incl %r15d
cmpq %rbx, %rax
ja 0x1ad27
movl 0x18(%rsp), %ecx
movq 0x10(%rsp), %rax
subl %eax, %ecx
movq %rcx, 0x68(%rsp)
addl $-0x8, %ecx
movl %ecx, (%rax)
cmpl $0x0, 0x6bc(%r14)
je 0x1b091
xorl %r13d, %r13d
leaq 0x30(%rsp), %rbx
movq 0x658(%r14), %rax
movl (%rax,%r13,4), %eax
movl %eax, 0xa0(%rsp)
movq 0x670(%r14), %rax
movl (%rax,%r13,4), %eax
movl %eax, 0x80(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0xf31a
movq 0x6a0(%r14), %rax
movl (%rax,%r13,4), %eax
movl %eax, 0x74(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x74(%rsp), %rdx
movl $0x1, %ecx
callq 0x1fd74
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x10(%rsp), %rdi
callq 0x1be7e
movq %rbx, %rdi
xorl %esi, %esi
callq 0xf31a
movq %r14, %rdi
movq %rbx, %rsi
leaq 0xa0(%rsp), %rdx
leaq 0x80(%rsp), %rcx
callq 0x211e2
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x10(%rsp), %rdi
callq 0x1be7e
cmpl $0x0, 0x8(%r14)
je 0x1b07e
xorl %r15d, %r15d
movq 0x1f0(%r14), %rax
movl $0x1, %ebp
movl %r15d, %ecx
shlq %cl, %rbp
movq %r15, %r12
shrq $0x6, %r12
movq (%rax,%r12,8), %rax
btq %r15, %rax
jae 0x1b03e
movq 0x688(%r14), %rax
movl (%rax,%r13,4), %esi
movq %rbx, %rdi
callq 0xf31a
movq 0x640(%r14), %rcx
movq 0x688(%r14), %rax
movl (%rax,%r13,4), %edx
movl %r15d, %eax
imull %edx, %eax
addl (%rcx,%r13,4), %eax
movl 0x630(%r14), %ecx
cmpq %rcx, %r15
jne 0x1b012
movq 0x218(%r14), %rcx
testq %rbp, (%rcx,%r12,8)
je 0x1b050
movq 0x30(%rsp), %rdi
movl %eax, %esi
addq 0x3c0(%r14), %rsi
callq 0x5380
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x10(%rsp), %rdi
callq 0x1be7e
incq %r15
movl 0x8(%r14), %eax
cmpq %rax, %r15
jb 0x1afa7
jmp 0x1b07e
movq 0x688(%r14), %rax
cmpl $0x0, (%rax,%r13,4)
je 0x1b025
xorl %eax, %eax
movq 0x30(%rsp), %rcx
movb $-0x7f, (%rcx,%rax)
incq %rax
movq 0x688(%r14), %rcx
movl (%rcx,%r13,4), %ecx
cmpq %rcx, %rax
jb 0x1b060
jmp 0x1b025
incq %r13
movl 0x6bc(%r14), %eax
cmpq %rax, %r13
jb 0x1aef0
movl 0x18(%rsp), %eax
movq 0x10(%rsp), %rcx
subl %ecx, %eax
subl 0x68(%rsp), %eax
movl %eax, 0x4(%rcx)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
subq %rsi, %rdx
movq 0x78(%rsp), %rdi
callq 0x37eb4
leaq 0x50(%rsp), %rdi
callq 0x1b4a6
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1b0d3
callq 0x5410
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1b0e2
callq 0x5410
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1b12c
callq 0x5410
jmp 0x1b12c
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
jmp 0x1b129
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x1b4a6
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1b145
callq 0x5410
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1b154
callq 0x5410
movq %rbx, %rdi
callq 0x57d0