// File: auton1[P]viterbi/header.cpp
// Function: header::parse_header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void header::parse_header(const string &line)
{
	// #CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	(FORMAT	NA00001 NA00002 ... )
	if (has_header == true)
		LOG.warning("Multiple Header lines.");

	has_header = true;
	istringstream header(line);
	int count = 0;
	string tmp_str;
	unsigned int N_header_indv = 0;
	has_genotypes = false;
	while (!header.eof())
	{
		getline(header, tmp_str, '\t');
		switch (count)
		{
			case 0: if (tmp_str != "#CHROM") LOG.warning("First Header entry should be #CHROM: " + tmp_str); break;
			case 1: if (tmp_str != "POS") LOG.warning("Second Header entry should be POS: " + tmp_str); break;
			case 2: if (tmp_str != "ID") LOG.warning("Third Header entry should be ID: " + tmp_str); break;
			case 3: if (tmp_str != "REF") LOG.warning("Fourth Header entry should be REF: " + tmp_str); break;
			case 4: if (tmp_str != "ALT") LOG.warning("Fifth Header entry should be ALT: " + tmp_str); break;
			case 5: if (tmp_str != "QUAL") LOG.warning("Sixth Header entry should be QUAL: " + tmp_str); break;
			case 6: if (tmp_str != "FILTER") LOG.warning("Seventh Header entry should be FILTER: " + tmp_str); break;
			case 7: if (tmp_str != "INFO") LOG.warning("Eighth Header entry should be INFO: " + tmp_str); break;
			case 8:
				if (tmp_str != "FORMAT")
					LOG.warning("Ninth Header entry should be FORMAT: " + tmp_str);
				else
					has_genotypes = true;
				break;
			default:
			{
				if (count <= 8)
					LOG.error("Incorrectly formatted header.");
				indv.push_back(tmp_str);
				N_header_indv++;
			}
			break;
		}
		count++;
	}
	N_indv = N_header_indv;

	if ((has_genotypes == true ) && (N_indv == 0))
		LOG.warning("FORMAT field without genotypes?");
}

// Assembly:
subq $0x3a8, %rsp            # imm = 0x3A8
movq %rdi, 0x3a0(%rsp)
movq %rsi, 0x398(%rsp)
movq 0x3a0(%rsp), %rax
movq %rax, 0x38(%rsp)
movb 0x6(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2f27d
leaq 0x377(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x69f0
movq 0x30(%rsp), %rdx
leaq 0x4574b(%rip), %rsi     # 0x7493e
leaq 0x378(%rsp), %rdi
callq 0x67c0
jmp 0x2f202
leaq 0x643f7(%rip), %rdi     # 0x93600
leaq 0x378(%rsp), %rsi
callq 0x715a0
jmp 0x2f218
leaq 0x378(%rsp), %rdi
callq 0x6b50
leaq 0x377(%rsp), %rdi
callq 0x65f0
jmp 0x2f27d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
jmp 0x2f26b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0x378(%rsp), %rdi
callq 0x6b50
leaq 0x377(%rsp), %rdi
callq 0x65f0
jmp 0x2fa63
movq 0x38(%rsp), %rax
movb $0x1, 0x6(%rax)
movq 0x398(%rsp), %rsi
leaq 0x1e0(%rsp), %rdi
movl $0x8, %edx
callq 0x6930
movl $0x0, 0x1dc(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x67e0
movq 0x38(%rsp), %rax
movl $0x0, 0x1b4(%rsp)
movb $0x0, 0x5(%rax)
movq 0x1e0(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x1e0(%rsp,%rax), %rdi
callq 0x6a70
movb %al, 0x2f(%rsp)
jmp 0x2f2eb
movb 0x2f(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2f2fa
jmp 0x2f96a
leaq 0x1e0(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
movl $0x9, %edx
callq 0x6a80
jmp 0x2f316
movl 0x1dc(%rsp), %eax
movq %rax, 0x20(%rsp)
subq $0x8, %rax
ja 0x2f885
movq 0x20(%rsp), %rax
leaq 0x45560(%rip), %rcx     # 0x74898
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
jmp 0x2fa49
leaq 0x455f4(%rip), %rsi     # 0x74955
leaq 0x1b8(%rsp), %rdi
callq 0x30930
movb %al, 0x1f(%rsp)
jmp 0x2f374
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0x2f37e
jmp 0x2f3e7
leaq 0x455d7(%rip), %rsi     # 0x7495c
leaq 0x190(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0xe8d0
jmp 0x2f39c
leaq 0x6425d(%rip), %rdi     # 0x93600
leaq 0x190(%rsp), %rsi
callq 0x715a0
jmp 0x2f3b2
leaq 0x190(%rsp), %rdi
callq 0x6b50
jmp 0x2f3e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0x190(%rsp), %rdi
callq 0x6b50
jmp 0x2fa49
jmp 0x2f954
leaq 0x4558f(%rip), %rsi     # 0x74982
leaq 0x1b8(%rsp), %rdi
callq 0x30930
movb %al, 0x1e(%rsp)
jmp 0x2f406
movb 0x1e(%rsp), %al
testb $0x1, %al
jne 0x2f410
jmp 0x2f479
leaq 0x4556f(%rip), %rsi     # 0x74986
leaq 0x170(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0xe8d0
jmp 0x2f42e
leaq 0x641cb(%rip), %rdi     # 0x93600
leaq 0x170(%rsp), %rsi
callq 0x715a0
jmp 0x2f444
leaq 0x170(%rsp), %rdi
callq 0x6b50
jmp 0x2f479
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x6b50
jmp 0x2fa49
jmp 0x2f954
leaq 0x45525(%rip), %rsi     # 0x749aa
leaq 0x1b8(%rsp), %rdi
callq 0x30930
movb %al, 0x1d(%rsp)
jmp 0x2f498
movb 0x1d(%rsp), %al
testb $0x1, %al
jne 0x2f4a2
jmp 0x2f50b
leaq 0x45504(%rip), %rsi     # 0x749ad
leaq 0x150(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0xe8d0
jmp 0x2f4c0
leaq 0x64139(%rip), %rdi     # 0x93600
leaq 0x150(%rsp), %rsi
callq 0x715a0
jmp 0x2f4d6
leaq 0x150(%rsp), %rdi
callq 0x6b50
jmp 0x2f50b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x6b50
jmp 0x2fa49
jmp 0x2f954
leaq 0x454b8(%rip), %rsi     # 0x749cf
leaq 0x1b8(%rsp), %rdi
callq 0x30930
movb %al, 0x1c(%rsp)
jmp 0x2f52a
movb 0x1c(%rsp), %al
testb $0x1, %al
jne 0x2f534
jmp 0x2f59d
leaq 0x45498(%rip), %rsi     # 0x749d3
leaq 0x130(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0xe8d0
jmp 0x2f552
leaq 0x640a7(%rip), %rdi     # 0x93600
leaq 0x130(%rsp), %rsi
callq 0x715a0
jmp 0x2f568
leaq 0x130(%rsp), %rdi
callq 0x6b50
jmp 0x2f59d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x6b50
jmp 0x2fa49
jmp 0x2f954
leaq 0x4544e(%rip), %rsi     # 0x749f7
leaq 0x1b8(%rsp), %rdi
callq 0x30930
movb %al, 0x1b(%rsp)
jmp 0x2f5bc
movb 0x1b(%rsp), %al
testb $0x1, %al
jne 0x2f5c6
jmp 0x2f62f
leaq 0x4542e(%rip), %rsi     # 0x749fb
leaq 0x110(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0xe8d0
jmp 0x2f5e4
leaq 0x64015(%rip), %rdi     # 0x93600
leaq 0x110(%rsp), %rsi
callq 0x715a0
jmp 0x2f5fa
leaq 0x110(%rsp), %rdi
callq 0x6b50
jmp 0x2f62f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x6b50
jmp 0x2fa49
jmp 0x2f954
leaq 0x453e3(%rip), %rsi     # 0x74a1e
leaq 0x1b8(%rsp), %rdi
callq 0x30930
movb %al, 0x1a(%rsp)
jmp 0x2f64e
movb 0x1a(%rsp), %al
testb $0x1, %al
jne 0x2f658
jmp 0x2f6c1
leaq 0x453c4(%rip), %rsi     # 0x74a23
leaq 0xf0(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0xe8d0
jmp 0x2f676
leaq 0x63f83(%rip), %rdi     # 0x93600
leaq 0xf0(%rsp), %rsi
callq 0x715a0
jmp 0x2f68c
leaq 0xf0(%rsp), %rdi
callq 0x6b50
jmp 0x2f6c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x6b50
jmp 0x2fa49
jmp 0x2f954
leaq 0x4537a(%rip), %rsi     # 0x74a47
leaq 0x1b8(%rsp), %rdi
callq 0x30930
movb %al, 0x19(%rsp)
jmp 0x2f6e0
movb 0x19(%rsp), %al
testb $0x1, %al
jne 0x2f6ea
jmp 0x2f753
leaq 0x4535d(%rip), %rsi     # 0x74a4e
leaq 0xd0(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0xe8d0
jmp 0x2f708
leaq 0x63ef1(%rip), %rdi     # 0x93600
leaq 0xd0(%rsp), %rsi
callq 0x715a0
jmp 0x2f71e
leaq 0xd0(%rsp), %rdi
callq 0x6b50
jmp 0x2f753
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x6b50
jmp 0x2fa49
jmp 0x2f954
leaq 0x46ad5(%rip), %rsi     # 0x76234
leaq 0x1b8(%rsp), %rdi
callq 0x30930
movb %al, 0x18(%rsp)
jmp 0x2f772
movb 0x18(%rsp), %al
testb $0x1, %al
jne 0x2f77c
jmp 0x2f7e5
leaq 0x452f3(%rip), %rsi     # 0x74a76
leaq 0xb0(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0xe8d0
jmp 0x2f79a
leaq 0x63e5f(%rip), %rdi     # 0x93600
leaq 0xb0(%rsp), %rsi
callq 0x715a0
jmp 0x2f7b0
leaq 0xb0(%rsp), %rdi
callq 0x6b50
jmp 0x2f7e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x6b50
jmp 0x2fa49
jmp 0x2f954
leaq 0x452aa(%rip), %rsi     # 0x74a9b
leaq 0x1b8(%rsp), %rdi
callq 0x30930
movb %al, 0x17(%rsp)
jmp 0x2f804
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x2f80e
jmp 0x2f877
leaq 0x4528d(%rip), %rsi     # 0x74aa2
leaq 0x90(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0xe8d0
jmp 0x2f82c
leaq 0x63dcd(%rip), %rdi     # 0x93600
leaq 0x90(%rsp), %rsi
callq 0x715a0
jmp 0x2f842
leaq 0x90(%rsp), %rdi
callq 0x6b50
jmp 0x2f880
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x6b50
jmp 0x2fa49
movq 0x38(%rsp), %rax
movb $0x1, 0x5(%rax)
jmp 0x2f954
cmpl $0x8, 0x1dc(%rsp)
jg 0x2f92b
leaq 0x6f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x69f0
movq 0x8(%rsp), %rdx
leaq 0x4521a(%rip), %rsi     # 0x74ac8
leaq 0x70(%rsp), %rdi
callq 0x67c0
jmp 0x2f8ba
leaq 0x63d3f(%rip), %rdi     # 0x93600
leaq 0x70(%rsp), %rsi
movl $0x1, %edx
callq 0x712f0
jmp 0x2f8d2
leaq 0x70(%rsp), %rdi
callq 0x6b50
leaq 0x6f(%rsp), %rdi
callq 0x65f0
jmp 0x2f92b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
jmp 0x2f91c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x6b50
leaq 0x6f(%rsp), %rdi
callq 0x65f0
jmp 0x2fa49
movq 0x38(%rsp), %rdi
addq $0x10, %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x2a190
jmp 0x2f943
movl 0x1b4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b4(%rsp)
movl 0x1dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1dc(%rsp)
jmp 0x2f2cc
movq 0x38(%rsp), %rax
movl 0x1b4(%rsp), %ecx
movl %ecx, 0x58(%rax)
movb 0x5(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2fa27
movq 0x38(%rsp), %rax
cmpl $0x0, 0x58(%rax)
jne 0x2fa27
leaq 0x47(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x69f0
movq (%rsp), %rdx
leaq 0x45134(%rip), %rsi     # 0x74ae6
leaq 0x48(%rsp), %rdi
callq 0x67c0
jmp 0x2f9be
leaq 0x63c3b(%rip), %rdi     # 0x93600
leaq 0x48(%rsp), %rsi
callq 0x715a0
jmp 0x2f9d1
leaq 0x48(%rsp), %rdi
callq 0x6b50
leaq 0x47(%rsp), %rdi
callq 0x65f0
jmp 0x2fa27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
jmp 0x2fa1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x368(%rsp)
movl %eax, 0x364(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x6b50
leaq 0x47(%rsp), %rdi
callq 0x65f0
jmp 0x2fa49
leaq 0x1b8(%rsp), %rdi
callq 0x6b50
leaq 0x1e0(%rsp), %rdi
callq 0x6b48
addq $0x3a8, %rsp            # imm = 0x3A8
retq
leaq 0x1b8(%rsp), %rdi
callq 0x6b50
leaq 0x1e0(%rsp), %rdi
callq 0x6b48
movq 0x368(%rsp), %rdi
callq 0x69e0