// File: /workspace/github_cpp_makefile_star2_O2/auton1[P]viterbi/bcf_entry.cpp
// Function: bcf_entry::read_indv_generic_entry(unsigned int, int const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
void bcf_entry::read_indv_generic_entry(unsigned int indv, const int &idx, string &out)
{
	if (fully_parsed == false)
		parse_full_entry(true);

	if (parsed_FORMAT == false)
		set_FORMAT();

	if(idx == GT_idx)
		parse_genotype_entry(indv, true);

	out = ".";
	ostringstream outstream;
	outstream.str("");

	string tmpstr;
	unsigned int l_pos, type, size;
	bool miss, format_miss;

	l_pos = FORMAT_positions[idx] + FORMAT_skip[idx]*indv;
	type = FORMAT_types[idx];
	size = FORMAT_sizes[idx];

	format_miss = true;
	if(type == 1)
	{
		int8_t tmp;
		if (idx == GT_idx)
		{
			pair<int, int> genotype;
			char phase;

			get_indv_GENOTYPE_ids(indv, genotype);
			phase = get_indv_PHASE(indv);
			if ((genotype.first == -2) && (genotype.second == -2))
				outstream << ".";
			else if ((genotype.first == -1) && (genotype.second == -2))
				outstream << ".";
			else if ((genotype.first > -1) && (genotype.second == -2))
				outstream << header::int2str(genotype.first);
			else if ((genotype.first > -1) && (genotype.second > -1))
				outstream << header::int2str(genotype.first) << phase << header::int2str(genotype.second);
			else
				outstream << header::int2str(genotype.first) << phase << header::int2str(genotype.second);

			tmpstr = outstream.str();
			out = tmpstr;
		}
		else
		{
			format_miss = true;
			for (unsigned int uj=0; uj<size; uj++)
			{
				if (check_end(l_pos, type, line))
					break;

				miss = check_missing(l_pos, type, line);
				if (uj != 0)
					outstream << ",";

				if (miss)
					outstream << ".";
				else
				{
					tmp = *reinterpret_cast<const int8_t*>(&line[l_pos]);
					outstream << int(tmp);
				}
				l_pos += sizeof(int8_t);
				format_miss = format_miss && miss;
			}

			tmpstr = outstream.str();
			if ( (tmpstr.length() > 0) and !format_miss)
				out = tmpstr;
		}
	}
	else if (type == 2)
	{
		int16_t tmp;
		format_miss = true;

		for (unsigned int uj=0; uj<size; uj++)
		{
			if (check_end(l_pos, type, line))
				break;

			miss = check_missing(l_pos, type, line);
			if (uj != 0)
				outstream << ",";

			if (miss)
				outstream << ".";
			else
			{
				tmp = *reinterpret_cast<const int16_t*>(&line[l_pos]);
				outstream << int(tmp);
			}
			l_pos += sizeof(int16_t);
			format_miss = format_miss && miss;
		}

		tmpstr = outstream.str();
		if ( (tmpstr.length() > 0) and !format_miss )
			out = tmpstr;
	}
	else if (type == 3)
	{
		int32_t tmp;
		format_miss = true;

		for (unsigned int uj=0; uj<size; uj++)
		{
			if (check_end(l_pos, type, line))
				break;

			miss = check_missing(l_pos, type, line);
			if (uj != 0)
				outstream << ",";

			if (miss)
				outstream << ".";
			else
			{
				tmp = *reinterpret_cast<const int32_t*>(&line[l_pos]);
				outstream << int(tmp);
			}
			l_pos += sizeof(int32_t);
			format_miss = format_miss && miss;
		}

		tmpstr = outstream.str();
		if ( (tmpstr.length() > 0) and !format_miss )
			out = tmpstr;
	}
	else if (type == 5)
	{
		float tmp;
		format_miss = true;

		for (unsigned int uj=0; uj<size; uj++)
		{
			if (check_end(l_pos, type, line))
				break;

			miss = check_missing(l_pos, type, line);
			if (uj != 0)
				outstream << ",";

			if (miss)
				outstream << ".";
			else
			{
				tmp = *reinterpret_cast<const float*>(&line[l_pos]);
				outstream << float(tmp);
			}
			l_pos += sizeof(float);
			format_miss = format_miss && miss;
		}

		tmpstr = outstream.str();
		if ( (tmpstr.length() > 0) and !format_miss )
			out = tmpstr;
	}
	else if (type == 7)
	{
		stringstream str_stream;
		string tmp_string;
		char tmp = '.';

		for (unsigned int uj=0; uj<size; uj++)
		{
			tmp = *reinterpret_cast<const char*>(&line[l_pos]);
			l_pos += sizeof(char);
			str_stream << tmp;
		}
		tmp_string = str_stream.str();
		tmp_string.erase( remove( tmp_string.begin(), tmp_string.end(), ' ' ), tmp_string.end() );

		if (tmp_string != "")
			out = tmp;
		else
			out = ".";
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x378, %rsp            # imm = 0x378
movq %rcx, 0x10(%rsp)
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
cmpb $0x0, 0x3d9(%rdi)
jne 0x14d77
movq (%r15), %rax
pushq $0x1
popq %rsi
movq %r15, %rdi
callq *0x18(%rax)
cmpb $0x0, 0x3dd(%r15)
jne 0x14d89
movq %r15, %rdi
callq 0x20588
movl (%rbx), %eax
cmpl 0x630(%r15), %eax
jne 0x14daa
movq (%r15), %rax
pushq $0x1
popq %rdx
movq %r15, %rdi
movl %ebp, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq *0x20(%rax)
leaq 0x1937c(%rip), %rsi     # 0x2e12d
movq 0x10(%rsp), %rdi
callq 0x58b0
leaq 0x200(%rsp), %rdi
callq 0x5610
leaq 0x1a068(%rip), %rsi     # 0x2ee37
leaq 0x78(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x5160
leaq 0x208(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x5690
leaq 0x78(%rsp), %rdi
callq 0x5908
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movslq (%rbx), %rax
movq 0x658(%r15), %rcx
movl (%rcx,%rax,4), %ecx
decl %ecx
cmpl $0x6, %ecx
ja 0x154b9
movq 0x688(%r15), %rdx
movl (%rdx,%rax,4), %r12d
imull %ebp, %r12d
movq 0x640(%r15), %rdx
addl (%rdx,%rax,4), %r12d
movq 0x670(%r15), %rdx
movl (%rdx,%rax,4), %ebx
leaq 0x19106(%rip), %rdx     # 0x2df54
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl 0x630(%r15), %eax
jne 0x15268
leaq 0x58(%rsp), %rdx
andq $0x0, (%rdx)
movq %r15, %rdi
movl %ebp, %esi
callq 0x1cb02
movq %r15, %rdi
movl %ebp, %esi
callq 0x1cb56
movl %eax, %ebx
movl 0x58(%rsp), %esi
movl 0x5c(%rsp), %eax
cmpl $-0x2, %eax
sete %cl
cmpl $-0x2, %esi
setae %dl
testb %cl, %dl
je 0x15397
leaq 0x19287(%rip), %rsi     # 0x2e12d
leaq 0x200(%rsp), %rdi
callq 0x5480
jmp 0x1547d
leaq 0x3c0(%r15), %r13
xorl %ebp, %ebp
movb $0x1, 0x8(%rsp)
cmpl %ebp, %ebx
je 0x15163
movq %r15, %rdi
movl %r12d, %esi
pushq $0x3
popq %rdx
movq %r13, %rcx
callq 0x1b898
testb %al, %al
jne 0x15163
movq %r15, %rdi
movl %r12d, %esi
pushq $0x3
popq %rdx
movq %r13, %rcx
callq 0x1b818
movl %eax, %r14d
testl %ebp, %ebp
je 0x14f13
leaq 0x200(%rsp), %rdi
leaq 0x18cbe(%rip), %rsi     # 0x2dbcc
callq 0x5480
testb %r14b, %r14b
je 0x14f2e
leaq 0x200(%rsp), %rdi
leaq 0x19206(%rip), %rsi     # 0x2e12d
callq 0x5480
jmp 0x14f45
movl %r12d, %eax
movq (%r13), %rcx
movl (%rcx,%rax), %esi
leaq 0x200(%rsp), %rdi
callq 0x57e0
addl $0x4, %r12d
andb %r14b, 0x8(%rsp)
incl %ebp
jmp 0x14ec6
leaq 0x3c0(%r15), %r13
movb $0x1, 0x8(%rsp)
xorl %ebp, %ebp
cmpl %ebp, %ebx
je 0x151ba
movq %r15, %rdi
movl %r12d, %esi
pushq $0x2
popq %rdx
movq %r13, %rcx
callq 0x1b898
testb %al, %al
jne 0x151ba
movq %r15, %rdi
movl %r12d, %esi
pushq $0x2
popq %rdx
movq %r13, %rcx
callq 0x1b818
movl %eax, %r14d
testl %ebp, %ebp
je 0x14fb0
leaq 0x200(%rsp), %rdi
leaq 0x18c21(%rip), %rsi     # 0x2dbcc
callq 0x5480
testb %r14b, %r14b
je 0x14fcb
leaq 0x200(%rsp), %rdi
leaq 0x19169(%rip), %rsi     # 0x2e12d
callq 0x5480
jmp 0x14fe3
movl %r12d, %eax
movq (%r13), %rcx
movswl (%rcx,%rax), %esi
leaq 0x200(%rsp), %rdi
callq 0x57e0
addl $0x2, %r12d
andb %r14b, 0x8(%rsp)
incl %ebp
jmp 0x14f63
leaq 0x3c0(%r15), %r13
xorl %ebp, %ebp
movb $0x1, 0x8(%rsp)
cmpl %ebp, %ebx
je 0x15211
movq %r15, %rdi
movl %r12d, %esi
pushq $0x5
popq %rdx
movq %r13, %rcx
callq 0x1b898
testb %al, %al
jne 0x15211
movq %r15, %rdi
movl %r12d, %esi
pushq $0x5
popq %rdx
movq %r13, %rcx
callq 0x1b818
movl %eax, %r14d
testl %ebp, %ebp
je 0x1504e
leaq 0x200(%rsp), %rdi
leaq 0x18b83(%rip), %rsi     # 0x2dbcc
callq 0x5480
testb %r14b, %r14b
je 0x15069
leaq 0x200(%rsp), %rdi
leaq 0x190cb(%rip), %rsi     # 0x2e12d
callq 0x5480
jmp 0x15082
movl %r12d, %eax
movq (%r13), %rcx
movss (%rcx,%rax), %xmm0
leaq 0x200(%rsp), %rdi
callq 0x5350
addl $0x4, %r12d
andb %r14b, 0x8(%rsp)
incl %ebp
jmp 0x15001
leaq 0x78(%rsp), %rdi
callq 0x5300
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movb $0x2e, %bpl
leaq 0x88(%rsp), %r14
subl $0x1, %ebx
jb 0x150dc
movl %r12d, %eax
movq 0x3c0(%r15), %rcx
movb (%rcx,%rax), %bpl
movsbl %bpl, %esi
movq %r14, %rdi
callq 0x5530
incl %r12d
jmp 0x150b8
leaq 0x90(%rsp), %rsi
leaq 0x58(%rsp), %rdi
callq 0x56f0
leaq 0x18(%rsp), %rbx
leaq 0x58(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5580
movq %r14, %rdi
callq 0x5908
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
addq %rdi, %rsi
movb $0x20, (%r14)
leaq 0x58(%rsp), %rdx
callq 0x16da0
leaq 0x18(%rsp), %rdi
movq (%rdi), %rdx
addq 0x8(%rdi), %rdx
movq %rax, %rsi
callq 0x50b0
leaq 0x19cf9(%rip), %rsi     # 0x2ee37
leaq 0x18(%rsp), %rdi
callq 0x12f17
testb %al, %al
je 0x15316
movsbl %bpl, %esi
movq 0x10(%rsp), %rdi
callq 0x5760
jmp 0x15327
leaq 0x78(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x56f0
leaq 0x38(%rsp), %rbx
leaq 0x78(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5580
movq %r14, %rdi
callq 0x5908
cmpq $0x0, 0x8(%rbx)
sete %al
orb 0x8(%rsp), %al
testb $0x1, %al
jne 0x154b9
leaq 0x38(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x5210
jmp 0x154b9
leaq 0x78(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x56f0
leaq 0x38(%rsp), %rbx
leaq 0x78(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5580
movq %r14, %rdi
callq 0x5908
cmpq $0x0, 0x8(%rbx)
sete %al
orb 0x8(%rsp), %al
testb $0x1, %al
jne 0x154b9
leaq 0x38(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x5210
jmp 0x154b9
leaq 0x78(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x56f0
leaq 0x38(%rsp), %rbx
leaq 0x78(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5580
movq %r14, %rdi
callq 0x5908
cmpq $0x0, 0x8(%rbx)
sete %al
orb 0x8(%rsp), %al
testb $0x1, %al
jne 0x154b9
leaq 0x38(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x5210
jmp 0x154b9
leaq 0x3c0(%r15), %rax
movq %rax, 0x8(%rsp)
movb $0x1, 0x7(%rsp)
xorl %r13d, %r13d
cmpl %r13d, %ebx
je 0x15340
leal (%r12,%r13), %r14d
movq %r15, %rdi
movl %r14d, %esi
pushq $0x1
popq %rdx
movq 0x8(%rsp), %rcx
callq 0x1b898
testb %al, %al
jne 0x15340
movq %r15, %rdi
movl %r14d, %esi
pushq $0x1
popq %rdx
movq 0x8(%rsp), %rcx
callq 0x1b818
movl %eax, %ebp
testl %r13d, %r13d
je 0x152d2
leaq 0x200(%rsp), %rdi
leaq 0x188ff(%rip), %rsi     # 0x2dbcc
callq 0x5480
testb %bpl, %bpl
je 0x152ed
leaq 0x200(%rsp), %rdi
leaq 0x18e47(%rip), %rsi     # 0x2e12d
callq 0x5480
jmp 0x15309
movl %r14d, %eax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movsbl (%rcx,%rax), %esi
leaq 0x200(%rsp), %rdi
callq 0x57e0
andb %bpl, 0x7(%rsp)
incl %r13d
jmp 0x1527c
leaq 0x18e10(%rip), %rsi     # 0x2e12d
movq 0x10(%rsp), %rdi
callq 0x58b0
leaq 0x18(%rsp), %rdi
callq 0x5908
leaq 0x78(%rsp), %rdi
callq 0x5360
jmp 0x154b9
leaq 0x78(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x56f0
leaq 0x38(%rsp), %rbx
leaq 0x78(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5580
movq %r14, %rdi
callq 0x5908
cmpq $0x0, 0x8(%rbx)
sete %al
orb 0x7(%rsp), %al
testb $0x1, %al
jne 0x154b9
leaq 0x38(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x5210
jmp 0x154b9
cmpl $-0x2, %eax
sete %cl
testl %esi, %esi
setns %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x153cd
leaq 0x78(%rsp), %rdi
pushq $-0x1
popq %rdx
callq 0x12c9c
leaq 0x200(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x5400
jmp 0x15473
orl %esi, %eax
js 0x1541e
leaq 0x78(%rsp), %rdi
pushq $-0x1
popq %rdx
callq 0x12c9c
leaq 0x200(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x5400
movsbl %bl, %esi
movq %rax, %rdi
callq 0x5530
movq %rax, %rbx
movl 0x5c(%rsp), %esi
leaq 0x18(%rsp), %rdi
pushq $-0x1
popq %rdx
callq 0x12c9c
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5400
jmp 0x15469
leaq 0x78(%rsp), %rdi
pushq $-0x1
popq %rdx
callq 0x12c9c
leaq 0x200(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x5400
movsbl %bl, %esi
movq %rax, %rdi
callq 0x5530
movq %rax, %rbx
movl 0x5c(%rsp), %esi
leaq 0x18(%rsp), %rdi
pushq $-0x1
popq %rdx
callq 0x12c9c
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x5400
leaq 0x18(%rsp), %rdi
callq 0x5908
leaq 0x78(%rsp), %rdi
callq 0x5908
leaq 0x78(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x56f0
leaq 0x38(%rsp), %rbx
leaq 0x78(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5580
movq %r14, %rdi
callq 0x5908
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x5210
leaq 0x38(%rsp), %rdi
callq 0x5908
leaq 0x200(%rsp), %rdi
callq 0x58f0
addq $0x378, %rsp            # imm = 0x378
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x154e4
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x5908
jmp 0x15502
jmp 0x154ff
jmp 0x154ff
jmp 0x1555c
jmp 0x1555c
jmp 0x154ff
jmp 0x154ff
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x5908
jmp 0x1555f
jmp 0x1555c
jmp 0x1555c
jmp 0x1555c
jmp 0x1555c
jmp 0x1555c
jmp 0x1555c
jmp 0x1555c
jmp 0x1555c
jmp 0x1555c
jmp 0x1555c
jmp 0x1553f
jmp 0x1553f
jmp 0x1553f
jmp 0x1555c
jmp 0x1555c
jmp 0x1553f
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
jmp 0x15564
movq %rax, %rbx
jmp 0x15569
jmp 0x1555c
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x5908
leaq 0x78(%rsp), %rdi
callq 0x5360
jmp 0x1555f
jmp 0x1555c
jmp 0x1555c
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x5908
leaq 0x200(%rsp), %rdi
callq 0x58f0
movq %rbx, %rdi
callq 0x5800