// File: /workspace/github_cpp_makefile_star2_O2/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 $0xb8, %rsp
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, 0x90(%rsp)
movq %rdi, %r14
cmpb $0x0, 0x3d9(%rdi)
jne 0x15bbc
movq (%r14), %rax
pushq $0x1
popq %rsi
movq %r14, %rdi
callq *0x18(%rax)
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
movl 0x6e8(%r14), %esi
callq 0xcc7c
movq 0x20(%rsp), %rdi
movq 0x3c0(%r14), %rsi
movl 0x6e8(%r14), %edx
callq 0x53b0
testb %bpl, %bpl
je 0x15e63
leaq 0x20(%rsp), %rdi
movq 0x8(%rdi), %rbx
subq (%rdi), %rbx
movl 0x6f4(%r14), %esi
subl 0x6e8(%r14), %esi
addl %ebx, %esi
callq 0xcc7c
movl %ebx, %edi
addq 0x20(%rsp), %rdi
movl 0x6e8(%r14), %esi
movl 0x6f4(%r14), %edx
subl %esi, %edx
addq 0x3c0(%r14), %rsi
callq 0x53b0
leaq 0x20(%rsp), %rax
movl 0x8(%rax), %ecx
movq (%rax), %rax
subl %eax, %ecx
movq %rcx, 0x88(%rsp)
addl $-0x8, %ecx
movl %ecx, (%rax)
leaq 0x1f0(%r14), %r12
leaq 0x218(%r14), %rax
movq %rax, 0x40(%rsp)
xorl %r13d, %r13d
movq %rsp, %rbp
movl 0x6bc(%r14), %eax
cmpq %rax, %r13
jae 0x15e06
movq 0x658(%r14), %rax
movl (%rax,%r13,4), %eax
movl %eax, 0x4c(%rsp)
movq 0x670(%r14), %rax
movl (%rax,%r13,4), %eax
movl %eax, 0x70(%rsp)
movq %rbp, %rdi
xorl %esi, %esi
callq 0xcc7c
movq 0x6a0(%r14), %rax
movl (%rax,%r13,4), %eax
movl %eax, 0x48(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
leaq 0x48(%rsp), %rdx
pushq $0x1
popq %rcx
callq 0x1a272
movq 0x28(%rsp), %rsi
movq (%rsp), %rdx
movq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %rdi
callq 0x163d4
movq %rbp, %rdi
xorl %esi, %esi
callq 0xcc7c
movq %r14, %rdi
movq %rbp, %rsi
leaq 0x4c(%rsp), %rdx
leaq 0x70(%rsp), %rcx
callq 0x1b29c
movq 0x28(%rsp), %rsi
movq (%rsp), %rdx
movq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %rdi
callq 0x163d4
xorl %ebx, %ebx
movl 0x8(%r14), %eax
cmpq %rax, %rbx
jae 0x15dfe
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9cc0
testq %rdx, (%rax)
je 0x15dd7
movq 0x688(%r14), %rax
movl (%rax,%r13,4), %esi
movq %rbp, %rdi
callq 0xcc7c
movq 0x640(%r14), %rcx
movq 0x688(%r14), %rax
movl (%rax,%r13,4), %eax
movl %ebx, %r15d
imull %eax, %r15d
addl (%rcx,%r13,4), %r15d
movl 0x630(%r14), %ecx
cmpq %rcx, %rbx
jne 0x15daa
movq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x9cc0
testq %rdx, (%rax)
je 0x15ddf
movq 0x688(%r14), %rax
movl (%rax,%r13,4), %eax
movq (%rsp), %rdi
movl %r15d, %esi
addq 0x3c0(%r14), %rsi
movl %eax, %edx
callq 0x53b0
movq 0x28(%rsp), %rsi
movq (%rsp), %rdx
movq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %rdi
callq 0x163d4
incq %rbx
jmp 0x15d30
xorl %eax, %eax
movq 0x688(%r14), %rcx
movl (%rcx,%r13,4), %ecx
cmpq %rcx, %rax
jae 0x15dbf
movq (%rsp), %rcx
movb $-0x7f, (%rcx,%rax)
incq %rax
jmp 0x15de1
incq %r13
jmp 0x15c85
movl 0x28(%rsp), %eax
movq 0x20(%rsp), %rcx
subl %ecx, %eax
subl 0x88(%rsp), %eax
movl %eax, 0x4(%rcx)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
subq %rsi, %rdx
movq 0x90(%rsp), %rdi
callq 0x2c9aa
leaq 0x50(%rsp), %rdi
callq 0x163b2
movq %rsp, %rdi
callq 0xe88a
leaq 0x20(%rsp), %rdi
callq 0xe88a
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsp, %rsi
movq %r14, %rdi
callq 0x1d484
movq 0x20(%rsp), %rax
movq (%rsp), %rcx
movb (%rcx), %cl
movb %cl, 0x18(%rax)
leaq 0x70(%rsp), %rdi
xorl %r15d, %r15d
movq %r14, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x1c5a4
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rbx
movq %rbx, %rsi
callq 0x16e68
movq %rbx, %rdi
callq 0x163b2
leaq 0x190(%r14), %rax
movq %rax, 0x40(%rsp)
leaq 0x70(%r14), %r13
leaq 0x98(%rsp), %rbx
movl %r15d, %r15d
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
sarq $0x6, %rax
cmpq %r15, %rax
jbe 0x15c52
movq %rsp, %rdi
xorl %esi, %esi
callq 0xcc7c
movq %r15, %r12
shlq $0x6, %r12
movq 0x50(%rsp), %rsi
addq %r12, %rsi
movq 0x40(%rsp), %rdi
callq 0x1316c
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movq %r14, %rdi
movq %rsp, %rsi
leaq 0x1c(%rsp), %rdx
pushq $0x1
popq %rcx
callq 0x1a272
movq 0x28(%rsp), %rsi
movq (%rsp), %rdx
movq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %rdi
callq 0x163d4
movq %rsp, %rdi
xorl %esi, %esi
callq 0xcc7c
movq %r13, %rdi
leaq 0x1c(%rsp), %rsi
callq 0x1311e
movl 0x88(%rax), %ebp
movq %r13, %rdi
leaq 0x1c(%rsp), %rsi
callq 0x1311e
movl 0x44(%rax), %ecx
cmpl $0x1, %ebp
je 0x15f84
testl %ebp, %ebp
jne 0x15f9e
movq 0x50(%rsp), %rax
leaq (%rax,%r12), %rdx
addq $0x20, %rdx
movq %r14, %rdi
movq %rsp, %rsi
callq 0x1a7e8
jmp 0x16017
movq 0x50(%rsp), %rax
leaq (%rax,%r12), %rdx
addq $0x20, %rdx
movq %r14, %rdi
movq %rsp, %rsi
callq 0x1ae62
jmp 0x16017
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x15fc5
movq 0x50(%rsp), %rax
leaq (%rax,%r12), %rdx
addq $0x20, %rdx
movq %r14, %rdi
movq %rsp, %rsi
pushq $0x1
popq %rcx
callq 0x1a12e
jmp 0x16017
cmpl $0x4, %ebp
jne 0x15fe7
movl $0x1, 0x70(%rsp)
movq %r14, %rdi
movq %rsp, %rsi
leaq 0x70(%rsp), %rdx
pushq $0x1
popq %rcx
callq 0x1a272
jmp 0x16017
movq %rbx, %r12
movq %rbx, %rdi
leaq 0x18066(%rip), %rsi     # 0x2e05a
leaq 0x70(%rsp), %rdx
callq 0x5160
leaq 0x2b4cb(%rip), %rdi     # 0x414d0
movq %r12, %rsi
xorl %edx, %edx
callq 0x2bf18
movq %r12, %rdi
callq 0x5908
movq 0x28(%rsp), %rsi
movq (%rsp), %rdx
movq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %rdi
callq 0x163d4
incl %r15d
jmp 0x15ec3
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x5908
jmp 0x1606e
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
jmp 0x1606b
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x163b2
movq %rsp, %rdi
callq 0xe88a
leaq 0x20(%rsp), %rdi
callq 0xe88a
movq %rbx, %rdi
callq 0x5800