// File: /workspace/github_cpp_makefile_star2_O3/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 0x1aaef
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 0xf332
movq 0x10(%rsp), %rdi
movq 0x3c0(%r14), %rsi
movl 0x6e8(%r14), %edx
callq 0x5380
testb %bpl, %bpl
je 0x1ab86
leaq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rbx
subq (%rdi), %rbx
movl 0x6f4(%r14), %esi
subl 0x6e8(%r14), %esi
addl %ebx, %esi
callq 0xf332
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 0x1adcf
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x23520
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 0x225e4
movq 0x60(%rsp), %rax
leaq 0xa0(%rsp), %rbx
movaps (%rbx), %xmm0
movq 0x10(%rbx), %rcx
movq %rcx, 0x60(%rsp)
movaps 0x50(%rsp), %xmm1
movaps %xmm0, 0x50(%rsp)
leaq 0x80(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
callq 0x1b3a8
movq %rbx, %rdi
callq 0x1b3a8
movq 0x58(%rsp), %rax
cmpq 0x50(%rsp), %rax
je 0x1adcf
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 0xf332
shlq $0x6, %rbx
movq 0x50(%rsp), %rsi
addq %rbx, %rsi
movq 0x68(%rsp), %rdi
callq 0x177e8
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movq %r14, %rdi
movq %r13, %rsi
leaq 0xc(%rsp), %rdx
movl $0x1, %ecx
callq 0x1fbd8
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x10(%rsp), %rdi
callq 0x1bd8c
movq %r13, %rdi
xorl %esi, %esi
callq 0xf332
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x17782
movl 0x88(%rax), %ebp
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x17782
movl 0x44(%rax), %ecx
cmpl $0x1, %ebp
je 0x1acd8
testl %ebp, %ebp
jne 0x1acf5
movq 0x50(%rsp), %rax
leaq (%rax,%rbx), %rdx
addq $0x20, %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x2030a
jmp 0x1ad99
movq 0x50(%rsp), %rax
leaq (%rax,%rbx), %rdx
addq $0x20, %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x20b04
jmp 0x1ad99
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x1ad1e
movq 0x50(%rsp), %rax
leaq (%rax,%rbx), %rdx
addq $0x20, %rdx
movq %r14, %rdi
movq %r13, %rsi
movl $0x1, %ecx
callq 0x1fa40
jmp 0x1ad99
cmpl $0x4, %ebp
jne 0x1ad48
movl $0x1, 0x80(%rsp)
movq %r14, %rdi
movq %r13, %rsi
leaq 0x80(%rsp), %rdx
movl $0x1, %ecx
callq 0x1fbd8
jmp 0x1ad99
leaq 0xc8(%rsp), %rbp
movq %rbp, 0xb8(%rsp)
leaq 0xb8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x1e3b0(%rip), %rsi     # 0x3911a
leaq 0x1e3c8(%rip), %rdx     # 0x39139
callq 0xc85e
leaq 0x2e72b(%rip), %rdi     # 0x494a8
movq %rbx, %rsi
xorl %edx, %edx
callq 0x36ec8
movq 0xb8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1ad99
callq 0x5410
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x10(%rsp), %rdi
callq 0x1bd8c
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
movl %r15d, %ebx
sarq $0x6, %rax
incl %r15d
cmpq %rbx, %rax
ja 0x1ac31
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 0x1af90
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 0xf332
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 0x1fbd8
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x10(%rsp), %rdi
callq 0x1bd8c
movq %rbx, %rdi
xorl %esi, %esi
callq 0xf332
movq %r14, %rdi
movq %rbx, %rsi
leaq 0xa0(%rsp), %rdx
leaq 0x80(%rsp), %rcx
callq 0x2103e
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x10(%rsp), %rdi
callq 0x1bd8c
movl 0x8(%r14), %eax
testl %eax, %eax
je 0x1af7d
xorl %r15d, %r15d
movq 0x1f0(%r14), %rdx
movl $0x1, %ebp
movl %r15d, %ecx
shlq %cl, %rbp
movl %r15d, %r12d
shrl $0x6, %r12d
movq (%rdx,%r12,8), %rcx
btq %r15, %rcx
jae 0x1af4a
movq 0x688(%r14), %rax
movl (%rax,%r13,4), %esi
movq %rbx, %rdi
callq 0xf332
movq 0x640(%r14), %rcx
movq 0x688(%r14), %rax
movl (%rax,%r13,4), %edx
movl %edx, %eax
imull %r15d, %eax
addl (%rcx,%r13,4), %eax
cmpl 0x630(%r14), %r15d
jne 0x1af1a
movq 0x218(%r14), %rcx
testq %rbp, (%rcx,%r12,8)
je 0x1af58
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 0x1bd8c
movl 0x8(%r14), %eax
incl %r15d
cmpl %eax, %r15d
jb 0x1aeb2
jmp 0x1af7d
testq %rdx, %rdx
je 0x1af2d
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 0x1af5f
jmp 0x1af2d
incq %r13
movl 0x6bc(%r14), %eax
cmpq %rax, %r13
jb 0x1adfa
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 0x37b02
leaq 0x50(%rsp), %rdi
callq 0x1b3a8
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1afd2
callq 0x5410
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1afe1
callq 0x5410
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1b02b
callq 0x5410
jmp 0x1b02b
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
jmp 0x1b028
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x1b3a8
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1b044
callq 0x5410
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1b053
callq 0x5410
movq %rbx, %rdi
callq 0x57d0
nop