// File: auton1[P]viterbi/vcf_entry.cpp
// Function: vcf_entry::parse_FORMAT()
void vcf_entry::parse_FORMAT()
{
	FORMAT_binary.resize(0);
	vector<char> tmp_vector;
	vector<string> tmp_split;
	vector< vector<string> > format_matrix(N_indv);

	unsigned int type, number, size, position=0;

	for (unsigned int ui=0; ui<N_indv; ui++)
	{
		if ( (GENOTYPE_str[ui] != "") and (GENOTYPE_str[ui] != ".") )
			header::tokenize(GENOTYPE_str[ui],':', tmp_split);
		else
			tmp_split.assign(FORMAT.size(),".");
		format_matrix[ui] = tmp_split;

		for (unsigned int uj=format_matrix[ui].size(); uj<FORMAT.size(); uj++)
			format_matrix[ui].push_back(".");
	}

	FORMAT_positions.resize(FORMAT.size()); FORMAT_types.resize(FORMAT.size()); FORMAT_skip.resize(FORMAT.size());

	for (unsigned int ui=0; ui<FORMAT.size(); ui++)
	{
		if (entry_header.FORMAT_reverse_map.find(FORMAT[ui]) == entry_header.FORMAT_reverse_map.end())
		{
			LOG.one_off_warning("FORMAT value " + FORMAT[ui] + " is not defined in the header and will not be encoded.");
			N_FORMAT_removed++;
			continue;
		}
		FORMAT_positions[ui] = position;
		make_typed_int(tmp_vector, entry_header.FORMAT_reverse_map[ FORMAT[ui] ], true );
		FORMAT_binary.insert(FORMAT_binary.end(), tmp_vector.begin(), tmp_vector.end() );

		tmp_vector.resize(0);
		tmp_split.resize(0);

		type = entry_header.FORMAT_map[ entry_header.FORMAT_reverse_map[FORMAT[ui]] ].Type;
		number = entry_header.FORMAT_map[ entry_header.FORMAT_reverse_map[FORMAT[ui]] ].N_entries;

		for (unsigned int uj=0; uj<N_indv; uj++)
			tmp_split.push_back( format_matrix[uj][ui] );

		if ((int)ui == GT_idx)
			make_typed_GT_vector(tmp_vector, tmp_split );
		else if (type == Integer)
			make_typed_int_vector(tmp_vector, tmp_split, number );
		else if (type == Float)
			make_typed_float_vector(tmp_vector, tmp_split, number );
		else if ( (type == Character) or (type == String) )
			make_typed_string_vector(tmp_vector, tmp_split, number );
		else
			LOG.error("Invalid type in FORMAT definition", 0);

		position = 0;
		get_type(&position, tmp_vector, type, size);
		FORMAT_types[ui] = type;

		if ( (type == 1) || (type == 7) )
			FORMAT_skip[ui] = size*sizeof(int8_t);
		else if (type == 2)
			FORMAT_skip[ui] = size*sizeof(int16_t);
		else if ( (type == 3) || (type == 5) )
			FORMAT_skip[ui] = size*sizeof(int32_t);

		FORMAT_binary.insert(FORMAT_binary.end(), tmp_vector.begin(), tmp_vector.end() );
		tmp_vector.resize(0);
		position = FORMAT_binary.size();
	}
	parsed_FORMAT_binary = true;
}

// Assembly:
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, 0x2b0(%rsp)
movq 0x2b0(%rsp), %rdi
movq %rdi, 0x108(%rsp)
addq $0x4b0, %rdi            # imm = 0x4B0
xorl %eax, %eax
movl %eax, %esi
callq 0x20910
leaq 0x298(%rsp), %rdi
callq 0x2a300
leaq 0x280(%rsp), %rdi
callq 0x10260
movq 0x108(%rsp), %rax
movl 0x8(%rax), %eax
movq %rax, 0x110(%rsp)
leaq 0x267(%rsp), %rdi
movq %rdi, 0x118(%rsp)
callq 0x39e80
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
leaq 0x268(%rsp), %rdi
callq 0x43340
jmp 0x3f6f0
leaq 0x267(%rsp), %rdi
callq 0x3a4d0
movl $0x0, 0x244(%rsp)
movl $0x0, 0x240(%rsp)
movq 0x108(%rsp), %rcx
movl 0x240(%rsp), %eax
cmpl 0x8(%rcx), %eax
jae 0x3fa7a
movq 0x108(%rsp), %rdi
addq $0x758, %rdi            # imm = 0x758
movl 0x240(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq %rax, %rdi
leaq 0x365d7(%rip), %rsi     # 0x75d29
callq 0x30930
movb %al, 0x107(%rsp)
jmp 0x3f760
movb 0x107(%rsp), %al
testb $0x1, %al
jne 0x3f770
jmp 0x3f82a
movq 0x108(%rsp), %rdi
addq $0x758, %rdi            # imm = 0x758
movl 0x240(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq %rax, %rdi
leaq 0x35947(%rip), %rsi     # 0x750de
callq 0x30930
movb %al, 0x106(%rsp)
jmp 0x3f7a5
movb 0x106(%rsp), %al
testb $0x1, %al
jne 0x3f7b2
jmp 0x3f82a
movq 0x108(%rsp), %rdi
addq $0x758, %rdi            # imm = 0x758
movl 0x240(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq %rax, %rdi
movl $0x3a, %esi
leaq 0x280(%rsp), %rdx
callq 0x2fa70
jmp 0x3f7e6
jmp 0x3f8fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
leaq 0x267(%rsp), %rdi
callq 0x3a4d0
jmp 0x40393
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
jmp 0x40386
movq 0x108(%rsp), %rdi
addq $0x498, %rdi            # imm = 0x498
callq 0x10270
movq %rax, 0xf0(%rsp)
leaq 0x21f(%rsp), %rdi
movq %rdi, 0xf8(%rsp)
callq 0x69f0
movq 0xf8(%rsp), %rdx
leaq 0x35874(%rip), %rsi     # 0x750de
leaq 0x220(%rsp), %rdi
callq 0x67c0
jmp 0x3f879
movq 0xf0(%rsp), %rsi
leaq 0x280(%rsp), %rdi
leaq 0x220(%rsp), %rdx
callq 0x433c0
jmp 0x3f898
leaq 0x220(%rsp), %rdi
callq 0x6b50
leaq 0x21f(%rsp), %rdi
callq 0x65f0
jmp 0x3f8fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
jmp 0x3f8eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x6b50
leaq 0x21f(%rsp), %rdi
callq 0x65f0
jmp 0x40386
movl 0x240(%rsp), %eax
movl %eax, %esi
leaq 0x268(%rsp), %rdi
callq 0x433f0
movq %rax, %rdi
leaq 0x280(%rsp), %rsi
callq 0x209d0
jmp 0x3f925
movl 0x240(%rsp), %eax
movl %eax, %esi
leaq 0x268(%rsp), %rdi
callq 0x433f0
movq %rax, %rdi
callq 0x10270
movl %eax, 0x218(%rsp)
movq 0x108(%rsp), %rdi
movl 0x218(%rsp), %eax
movq %rax, 0xe8(%rsp)
addq $0x498, %rdi            # imm = 0x498
callq 0x10270
movq %rax, %rcx
movq 0xe8(%rsp), %rax
cmpq %rcx, %rax
jae 0x3fa62
movl 0x240(%rsp), %eax
movl %eax, %esi
leaq 0x268(%rsp), %rdi
callq 0x433f0
movq %rax, 0xd8(%rsp)
leaq 0x1f7(%rsp), %rdi
movq %rdi, 0xe0(%rsp)
callq 0x69f0
movq 0xe0(%rsp), %rdx
leaq 0x3571b(%rip), %rsi     # 0x750de
leaq 0x1f8(%rsp), %rdi
callq 0x67c0
jmp 0x3f9d2
movq 0xd8(%rsp), %rdi
leaq 0x1f8(%rsp), %rsi
callq 0x2a240
jmp 0x3f9e9
leaq 0x1f8(%rsp), %rdi
callq 0x6b50
leaq 0x1f7(%rsp), %rdi
callq 0x65f0
movl 0x218(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x218(%rsp)
jmp 0x3f94a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
jmp 0x3fa50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x6b50
leaq 0x1f7(%rsp), %rdi
callq 0x65f0
jmp 0x40386
jmp 0x3fa64
movl 0x240(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x240(%rsp)
jmp 0x3f713
movq 0x108(%rsp), %rdi
movq %rdi, %rax
addq $0x640, %rax            # imm = 0x640
movq %rax, 0xd0(%rsp)
addq $0x498, %rdi            # imm = 0x498
callq 0x10270
movq 0xd0(%rsp), %rdi
movq %rax, %rsi
callq 0x393f0
jmp 0x3fab1
movq 0x108(%rsp), %rdi
movq %rdi, %rax
addq $0x658, %rax            # imm = 0x658
movq %rax, 0xc8(%rsp)
addq $0x498, %rdi            # imm = 0x498
callq 0x10270
movq 0xc8(%rsp), %rdi
movq %rax, %rsi
callq 0x393f0
jmp 0x3fae8
movq 0x108(%rsp), %rdi
movq %rdi, %rax
addq $0x688, %rax            # imm = 0x688
movq %rax, 0xc0(%rsp)
addq $0x498, %rdi            # imm = 0x498
callq 0x10270
movq 0xc0(%rsp), %rdi
movq %rax, %rsi
callq 0x393f0
jmp 0x3fb1f
movl $0x0, 0x1f0(%rsp)
movq 0x108(%rsp), %rdi
movl 0x1f0(%rsp), %eax
movq %rax, 0xb8(%rsp)
addq $0x498, %rdi            # imm = 0x498
callq 0x10270
movq %rax, %rcx
movq 0xb8(%rsp), %rax
cmpq %rcx, %rax
jae 0x40348
movq 0x108(%rsp), %rdi
movq %rdi, %rax
addq $0x1c0, %rax            # imm = 0x1C0
movq %rax, 0xa8(%rsp)
addq $0x498, %rdi            # imm = 0x498
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq 0xa8(%rsp), %rdi
movq %rax, %rsi
callq 0x310f0
movq %rax, 0xb0(%rsp)
jmp 0x3fba9
movq 0x108(%rsp), %rdi
movq 0xb0(%rsp), %rax
movq %rax, 0x1e8(%rsp)
addq $0x10, %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0x31120
movq %rax, 0x1e0(%rsp)
leaq 0x1e8(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x32ab0
testb $0x1, %al
jne 0x3fbf7
jmp 0x3fce0
movq 0x108(%rsp), %rdi
addq $0x498, %rdi            # imm = 0x498
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq %rax, %rdx
leaq 0x35457(%rip), %rsi     # 0x75075
leaq 0x1a0(%rsp), %rdi
callq 0xe8d0
jmp 0x3fc2d
leaq 0x3544f(%rip), %rdx     # 0x75083
leaq 0x1c0(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0xf4a0
jmp 0x3fc4b
leaq 0x539ae(%rip), %rdi     # 0x93600
leaq 0x1c0(%rsp), %rsi
callq 0x71610
jmp 0x3fc61
leaq 0x1c0(%rsp), %rdi
callq 0x6b50
leaq 0x1a0(%rsp), %rdi
callq 0x6b50
movq 0x108(%rsp), %rax
movl 0x4cc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4cc(%rax)
jmp 0x40332
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
jmp 0x3fcce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x6b50
leaq 0x1a0(%rsp), %rdi
callq 0x6b50
jmp 0x40386
movq 0x108(%rsp), %rdi
movl 0x244(%rsp), %eax
movl %eax, 0x94(%rsp)
addq $0x640, %rdi            # imm = 0x640
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0xe8b0
movl 0x94(%rsp), %ecx
movq 0x108(%rsp), %rdi
movl %ecx, (%rax)
movq %rdi, %rax
addq $0x1c0, %rax            # imm = 0x1C0
movq %rax, 0x98(%rsp)
addq $0x498, %rdi            # imm = 0x498
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq 0x98(%rsp), %rdi
movq %rax, %rsi
callq 0x30fe0
movq %rax, 0xa0(%rsp)
jmp 0x3fd5c
movq 0xa0(%rsp), %rdx
movq 0x108(%rsp), %rdi
leaq 0x298(%rsp), %rsi
movl $0x1, %ecx
callq 0x45d20
jmp 0x3fd80
movq 0x108(%rsp), %rdi
addq $0x4b0, %rdi            # imm = 0x4B0
movq %rdi, 0x80(%rsp)
callq 0x27020
movq %rax, 0x190(%rsp)
leaq 0x198(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x39b20
leaq 0x298(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x26ff0
movq 0x78(%rsp), %rdi
movq %rax, 0x188(%rsp)
callq 0x27020
movq 0x80(%rsp), %rdi
movq %rax, 0x180(%rsp)
movq 0x198(%rsp), %rsi
movq 0x188(%rsp), %rdx
movq 0x180(%rsp), %rcx
callq 0x39a60
movq %rax, 0x88(%rsp)
jmp 0x3fe14
movq 0x88(%rsp), %rax
movq %rax, 0x178(%rsp)
xorl %eax, %eax
movl %eax, %esi
leaq 0x298(%rsp), %rdi
callq 0x20910
jmp 0x3fe37
xorl %eax, %eax
movl %eax, %esi
leaq 0x280(%rsp), %rdi
callq 0x2a0f0
jmp 0x3fe4a
movq 0x108(%rsp), %rdi
movq %rdi, %rax
addq $0xd0, %rax
movq %rax, 0x60(%rsp)
movq %rdi, %rax
addq $0x1c0, %rax            # imm = 0x1C0
movq %rax, 0x68(%rsp)
addq $0x498, %rdi            # imm = 0x498
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x30fe0
movq %rax, 0x70(%rsp)
jmp 0x3fe97
movq 0x70(%rsp), %rsi
movq 0x60(%rsp), %rdi
callq 0x30ef0
movq %rax, 0x58(%rsp)
jmp 0x3fead
movq 0x108(%rsp), %rdi
movq 0x58(%rsp), %rax
movl 0x88(%rax), %eax
movl %eax, 0x250(%rsp)
movq %rdi, %rax
addq $0xd0, %rax
movq %rax, 0x40(%rsp)
movq %rdi, %rax
addq $0x1c0, %rax            # imm = 0x1C0
movq %rax, 0x48(%rsp)
addq $0x498, %rdi            # imm = 0x498
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x30fe0
movq %rax, 0x50(%rsp)
jmp 0x3ff0c
movq 0x50(%rsp), %rsi
movq 0x40(%rsp), %rdi
callq 0x30ef0
movq %rax, 0x38(%rsp)
jmp 0x3ff22
movq 0x38(%rsp), %rax
movl 0x44(%rax), %eax
movl %eax, 0x24c(%rsp)
movl $0x0, 0x174(%rsp)
movq 0x108(%rsp), %rcx
movl 0x174(%rsp), %eax
cmpl 0x8(%rcx), %eax
jae 0x3ff9e
movl 0x174(%rsp), %eax
movl %eax, %esi
leaq 0x268(%rsp), %rdi
callq 0x433f0
movq %rax, %rdi
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0x10290
movq %rax, %rsi
leaq 0x280(%rsp), %rdi
callq 0x2a190
jmp 0x3ff89
jmp 0x3ff8b
movl 0x174(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x174(%rsp)
jmp 0x3ff3c
movq 0x108(%rsp), %rcx
movl 0x1f0(%rsp), %eax
cmpl 0x630(%rcx), %eax
jne 0x3ffd9
movq 0x108(%rsp), %rdi
leaq 0x298(%rsp), %rsi
leaq 0x280(%rsp), %rdx
callq 0x46460
jmp 0x3ffd4
jmp 0x40132
cmpl $0x0, 0x250(%rsp)
jne 0x4000e
movq 0x108(%rsp), %rdi
movl 0x24c(%rsp), %ecx
leaq 0x298(%rsp), %rsi
leaq 0x280(%rsp), %rdx
callq 0x47050
jmp 0x40009
jmp 0x40130
cmpl $0x1, 0x250(%rsp)
jne 0x40043
movq 0x108(%rsp), %rdi
movl 0x24c(%rsp), %ecx
leaq 0x298(%rsp), %rsi
leaq 0x280(%rsp), %rdx
callq 0x47fa0
jmp 0x4003e
jmp 0x4012e
cmpl $0x2, 0x250(%rsp)
je 0x40057
cmpl $0x3, 0x250(%rsp)
jne 0x40082
movq 0x108(%rsp), %rdi
movl 0x24c(%rsp), %ecx
leaq 0x298(%rsp), %rsi
leaq 0x280(%rsp), %rdx
callq 0x46070
jmp 0x4007d
jmp 0x4012c
leaq 0x14f(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x69f0
movq 0x30(%rsp), %rdx
leaq 0x3501a(%rip), %rsi     # 0x750ba
leaq 0x150(%rsp), %rdi
callq 0x67c0
jmp 0x400af
leaq 0x5354a(%rip), %rdi     # 0x93600
leaq 0x150(%rsp), %rsi
xorl %edx, %edx
callq 0x712f0
jmp 0x400c7
leaq 0x150(%rsp), %rdi
callq 0x6b50
leaq 0x14f(%rsp), %rdi
callq 0x65f0
jmp 0x4012c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
jmp 0x4011a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x258(%rsp)
movl %eax, 0x254(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x6b50
leaq 0x14f(%rsp), %rdi
callq 0x65f0
jmp 0x40386
jmp 0x4012e
jmp 0x40130
jmp 0x40132
movq 0x108(%rsp), %rdi
movl $0x0, 0x244(%rsp)
leaq 0x244(%rsp), %rsi
leaq 0x298(%rsp), %rdx
leaq 0x250(%rsp), %rcx
leaq 0x248(%rsp), %r8
callq 0x489f0
jmp 0x4016c
movq 0x108(%rsp), %rdi
movl 0x250(%rsp), %eax
movl %eax, 0x2c(%rsp)
addq $0x658, %rdi            # imm = 0x658
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0xe8b0
movl 0x2c(%rsp), %ecx
movl %ecx, (%rax)
cmpl $0x1, 0x250(%rsp)
je 0x401ae
cmpl $0x7, 0x250(%rsp)
jne 0x401e5
movq 0x108(%rsp), %rdi
movl 0x248(%rsp), %eax
shlq $0x0, %rax
movl %eax, 0x28(%rsp)
addq $0x688, %rdi            # imm = 0x688
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0xe8b0
movl 0x28(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x4026c
cmpl $0x2, 0x250(%rsp)
jne 0x40222
movq 0x108(%rsp), %rdi
movl 0x248(%rsp), %eax
shlq %rax
movl %eax, 0x24(%rsp)
addq $0x688, %rdi            # imm = 0x688
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0xe8b0
movl 0x24(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x4026a
cmpl $0x3, 0x250(%rsp)
je 0x40236
cmpl $0x5, 0x250(%rsp)
jne 0x40268
movq 0x108(%rsp), %rdi
movl 0x248(%rsp), %eax
shlq $0x2, %rax
movl %eax, 0x20(%rsp)
addq $0x688, %rdi            # imm = 0x688
movl 0x1f0(%rsp), %eax
movl %eax, %esi
callq 0xe8b0
movl 0x20(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x4026a
jmp 0x4026c
movq 0x108(%rsp), %rdi
addq $0x4b0, %rdi            # imm = 0x4B0
movq %rdi, 0x10(%rsp)
callq 0x27020
movq %rax, 0x138(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x39b20
leaq 0x298(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x26ff0
movq 0x8(%rsp), %rdi
movq %rax, 0x130(%rsp)
callq 0x27020
movq 0x10(%rsp), %rdi
movq %rax, 0x128(%rsp)
movq 0x140(%rsp), %rsi
movq 0x130(%rsp), %rdx
movq 0x128(%rsp), %rcx
callq 0x39a60
movq %rax, 0x18(%rsp)
jmp 0x402f7
movq 0x18(%rsp), %rax
movq %rax, 0x120(%rsp)
xorl %eax, %eax
movl %eax, %esi
leaq 0x298(%rsp), %rdi
callq 0x20910
jmp 0x40317
movq 0x108(%rsp), %rdi
addq $0x4b0, %rdi            # imm = 0x4B0
callq 0x249e0
movl %eax, 0x244(%rsp)
movl 0x1f0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1f0(%rsp)
jmp 0x3fb2a
movq 0x108(%rsp), %rax
movb $0x1, 0x3de(%rax)
leaq 0x268(%rsp), %rdi
callq 0x39f50
leaq 0x280(%rsp), %rdi
callq 0x10cc0
leaq 0x298(%rsp), %rdi
callq 0x267c0
addq $0x2b8, %rsp            # imm = 0x2B8
retq
leaq 0x268(%rsp), %rdi
callq 0x39f50
leaq 0x280(%rsp), %rdi
callq 0x10cc0
leaq 0x298(%rsp), %rdi
callq 0x267c0
movq 0x258(%rsp), %rdi
callq 0x69e0
nopw (%rax,%rax)