// File: zeeev[P]DASVC/bamtools/src/api/internal/sam/SamFormatParser_p.cpp
// Function: BamTools::Internal::SamFormatParser::ParseHDLine(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void SamFormatParser::ParseHDLine(const string& line) {

    // split HD lines into tokens
    vector<string> tokens = Split(line, Constants::SAM_TAB);

    // iterate over tokens
    vector<string>::const_iterator tokenIter = tokens.begin();
    vector<string>::const_iterator tokenEnd  = tokens.end();
    for ( ; tokenIter != tokenEnd; ++tokenIter ) {

        // get tag/value
        const string tokenTag = (*tokenIter).substr(0,2);
        const string tokenValue = (*tokenIter).substr(3);

        // set header contents
        if      ( tokenTag == Constants::SAM_HD_VERSION_TAG    ) m_header.Version    = tokenValue;
        else if ( tokenTag == Constants::SAM_HD_SORTORDER_TAG  ) m_header.SortOrder  = tokenValue;
        else if ( tokenTag == Constants::SAM_HD_GROUPORDER_TAG ) m_header.GroupOrder = tokenValue;
        else { // custom tag
            CustomHeaderTag otherTag;
            otherTag.TagName  = tokenTag;
            otherTag.TagValue = tokenValue;
            m_header.CustomTags.push_back(otherTag);
        }
    }

    // check for required tags
    if ( !m_header.HasVersion() )
        throw BamException("SamFormatParser::ParseHDLine", "@HD line is missing VN tag");
}

// Assembly:
subq $0x188, %rsp            # imm = 0x188
movq %rdi, 0x180(%rsp)
movq %rsi, 0x178(%rsp)
movq 0x180(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq 0x178(%rsp), %rdx
leaq 0x160(%rsp), %rdi
movq %rdi, 0x50(%rsp)
movl $0x9, %ecx
callq 0x793a0
movq 0x50(%rsp), %rdi
callq 0x7aa40
movq %rax, 0x58(%rsp)
jmp 0xe2234
movq 0x58(%rsp), %rax
movq %rax, 0x150(%rsp)
leaq 0x158(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x76ee0
jmp 0xe2258
leaq 0x160(%rsp), %rdi
callq 0x7ad60
movq %rax, 0x40(%rsp)
jmp 0xe226c
movq 0x40(%rsp), %rax
movq %rax, 0x130(%rsp)
leaq 0x138(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x76ee0
jmp 0xe2290
jmp 0xe2292
leaq 0x158(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x750f0
movb %al, 0x3f(%rsp)
jmp 0xe22ad
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0xe22ba
jmp 0xe251d
leaq 0x158(%rsp), %rdi
callq 0x71410
movq %rax, 0x30(%rsp)
jmp 0xe22ce
movq 0x30(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq 0x110(%rsp), %rdi
movl $0x2, %ecx
callq 0x76c50
jmp 0xe22eb
leaq 0x158(%rsp), %rdi
callq 0x71410
movq %rax, 0x28(%rsp)
jmp 0xe22ff
movq 0x28(%rsp), %rsi
leaq 0xf0(%rsp), %rdi
movl $0x3, %edx
movq $-0x1, %rcx
callq 0x76c50
jmp 0xe231f
leaq 0x36c02(%rip), %rsi     # 0x118f28
leaq 0x110(%rsp), %rdi
callq 0x74120
movb %al, 0x27(%rsp)
jmp 0xe2339
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0xe2343
jmp 0xe23aa
movq 0x48(%rsp), %rax
movq (%rax), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x71240
jmp 0xe235a
jmp 0xe24c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
jmp 0xe2681
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
jmp 0xe2509
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
jmp 0xe24f8
leaq 0x36b97(%rip), %rsi     # 0x118f48
leaq 0x110(%rsp), %rdi
callq 0x74120
movb %al, 0x26(%rsp)
jmp 0xe23c4
movb 0x26(%rsp), %al
testb $0x1, %al
jne 0xe23ce
jmp 0xe23ee
movq 0x48(%rsp), %rax
movq (%rax), %rdi
addq $0x20, %rdi
leaq 0xf0(%rsp), %rsi
callq 0x71240
jmp 0xe23e9
jmp 0xe24c2
leaq 0x36b73(%rip), %rsi     # 0x118f68
leaq 0x110(%rsp), %rdi
callq 0x74120
movb %al, 0x25(%rsp)
jmp 0xe2408
movb 0x25(%rsp), %al
testb $0x1, %al
jne 0xe2412
jmp 0xe2432
movq 0x48(%rsp), %rax
movq (%rax), %rdi
addq $0x40, %rdi
leaq 0xf0(%rsp), %rsi
callq 0x71240
jmp 0xe242d
jmp 0xe24c0
leaq 0xb0(%rsp), %rdi
callq 0x7a640
jmp 0xe2441
leaq 0xb0(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x71240
jmp 0xe2458
leaq 0xd0(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x71240
jmp 0xe246f
movq 0x48(%rsp), %rax
movq (%rax), %rdi
addq $0x60, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x743e0
jmp 0xe248a
leaq 0xb0(%rsp), %rdi
callq 0x75d70
jmp 0xe2499
jmp 0xe24c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x75d70
jmp 0xe24be
jmp 0xe24f8
jmp 0xe24c2
jmp 0xe24c4
leaq 0xf0(%rsp), %rdi
callq 0x7cce8
jmp 0xe24d3
leaq 0x110(%rsp), %rdi
callq 0x7cce8
jmp 0xe24e2
jmp 0xe24e4
leaq 0x158(%rsp), %rdi
callq 0x75880
jmp 0xe24f3
jmp 0xe2292
leaq 0xf0(%rsp), %rdi
callq 0x7cce8
jmp 0xe2507
jmp 0xe2509
leaq 0x110(%rsp), %rdi
callq 0x7cce8
jmp 0xe2518
jmp 0xe2681
movq 0x48(%rsp), %rax
movq (%rax), %rdi
callq 0x780e0
movb %al, 0x24(%rsp)
jmp 0xe2530
movb 0x24(%rsp), %al
testb $0x1, %al
jne 0xe266c
jmp 0xe253e
movb $0x1, 0x66(%rsp)
movl $0x28, %edi
callq 0x737c0
movq %rax, 0x10(%rsp)
leaq 0x8f(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x7b5f0
movq 0x18(%rsp), %rdx
leaq 0xa09b(%rip), %rsi      # 0xec60b
leaq 0x90(%rsp), %rdi
callq 0x78e70
jmp 0xe257f
leaq 0x67(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7b5f0
movq 0x8(%rsp), %rdx
leaq 0xa08e(%rip), %rsi      # 0xec628
leaq 0x68(%rsp), %rdi
callq 0x78e70
jmp 0xe25a6
movq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x79cd0
jmp 0xe25bf
movq 0x10(%rsp), %rdi
movb $0x0, 0x66(%rsp)
movq 0x2f940(%rip), %rsi     # 0x111f10
movq 0x2f989(%rip), %rdx     # 0x111f60
callq 0x7b010
jmp 0xe26a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
jmp 0xe264a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
jmp 0xe262f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x7cce8
jmp 0xe262d
jmp 0xe262f
leaq 0x67(%rsp), %rdi
callq 0x76f80
leaq 0x90(%rsp), %rdi
callq 0x7cce8
jmp 0xe2648
jmp 0xe264a
leaq 0x8f(%rsp), %rdi
callq 0x76f80
testb $0x1, 0x66(%rsp)
jne 0xe2660
jmp 0xe266a
movq 0x10(%rsp), %rdi
callq 0x74e00
jmp 0xe2681
leaq 0x160(%rsp), %rdi
callq 0x74e60
addq $0x188, %rsp            # imm = 0x188
retq
leaq 0x160(%rsp), %rdi
callq 0x74e60
jmp 0xe2690
jmp 0xe2692
movq 0x148(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopw (%rax,%rax)