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

    SamProgram pg;

    // split string 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 token tag/value
        const string tokenTag = (*tokenIter).substr(0,2);
        const string tokenValue = (*tokenIter).substr(3);

        // set program record contents
        if      ( tokenTag == Constants::SAM_PG_ID_TAG              ) pg.ID = tokenValue;
        else if ( tokenTag == Constants::SAM_PG_NAME_TAG            ) pg.Name = tokenValue;
        else if ( tokenTag == Constants::SAM_PG_COMMANDLINE_TAG     ) pg.CommandLine = tokenValue;
        else if ( tokenTag == Constants::SAM_PG_PREVIOUSPROGRAM_TAG ) pg.PreviousProgramID = tokenValue;
        else if ( tokenTag == Constants::SAM_PG_VERSION_TAG         ) pg.Version = tokenValue;
        else { // custom tag
            CustomHeaderTag otherTag;
            otherTag.TagName  = tokenTag;
            otherTag.TagValue = tokenValue;
            pg.CustomTags.push_back(otherTag);
        }
    }

    // check for required tags
    if ( !pg.HasID() )
        throw BamException("SamFormatParser::ParsePGLine", "@PG line is missing ID tag");

    // store SAM program entry
    m_header.Programs.Add(pg);
}

// Assembly:
subq $0x258, %rsp            # imm = 0x258
movq %rdi, 0x250(%rsp)
movq %rsi, 0x248(%rsp)
movq 0x250(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x79210
movq 0x50(%rsp), %rsi
movq 0x248(%rsp), %rdx
leaq 0x158(%rsp), %rdi
movl $0x9, %ecx
callq 0x793a0
jmp 0xe35e2
leaq 0x158(%rsp), %rdi
callq 0x7aa40
movq %rax, 0x48(%rsp)
jmp 0xe35f6
movq 0x48(%rsp), %rax
movq %rax, 0x138(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x76ee0
jmp 0xe361a
leaq 0x158(%rsp), %rdi
callq 0x7ad60
movq %rax, 0x40(%rsp)
jmp 0xe362e
movq 0x40(%rsp), %rax
movq %rax, 0x128(%rsp)
leaq 0x130(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0x76ee0
jmp 0xe3652
jmp 0xe3654
leaq 0x140(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x750f0
movb %al, 0x3f(%rsp)
jmp 0xe366f
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0xe367c
jmp 0xe3973
leaq 0x140(%rsp), %rdi
callq 0x71410
movq %rax, 0x30(%rsp)
jmp 0xe3690
movq 0x30(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq 0x108(%rsp), %rdi
movl $0x2, %ecx
callq 0x76c50
jmp 0xe36ad
leaq 0x140(%rsp), %rdi
callq 0x71410
movq %rax, 0x28(%rsp)
jmp 0xe36c1
movq 0x28(%rsp), %rsi
leaq 0xe8(%rsp), %rdi
movl $0x3, %edx
movq $-0x1, %rcx
callq 0x76c50
jmp 0xe36e1
leaq 0x35b60(%rip), %rsi     # 0x119248
leaq 0x108(%rsp), %rdi
callq 0x74120
movb %al, 0x27(%rsp)
jmp 0xe36fb
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0xe3708
jmp 0xe3788
leaq 0x190(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x71240
jmp 0xe371f
jmp 0xe391a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0xe3b15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0xe3b04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0xe395f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0xe394e
leaq 0x35ad9(%rip), %rsi     # 0x119268
leaq 0x108(%rsp), %rdi
callq 0x74120
movb %al, 0x26(%rsp)
jmp 0xe37a2
movb 0x26(%rsp), %al
testb $0x1, %al
jne 0xe37ac
jmp 0xe37c8
leaq 0x1b0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x71240
jmp 0xe37c3
jmp 0xe3918
leaq 0x35a59(%rip), %rsi     # 0x119228
leaq 0x108(%rsp), %rdi
callq 0x74120
movb %al, 0x25(%rsp)
jmp 0xe37e2
movb 0x25(%rsp), %al
testb $0x1, %al
jne 0xe37ec
jmp 0xe3808
leaq 0x170(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x71240
jmp 0xe3803
jmp 0xe3916
leaq 0x35a79(%rip), %rsi     # 0x119288
leaq 0x108(%rsp), %rdi
callq 0x74120
movb %al, 0x24(%rsp)
jmp 0xe3822
movb 0x24(%rsp), %al
testb $0x1, %al
jne 0xe382c
jmp 0xe3848
leaq 0x1d0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x71240
jmp 0xe3843
jmp 0xe3914
leaq 0x35a59(%rip), %rsi     # 0x1192a8
leaq 0x108(%rsp), %rdi
callq 0x74120
movb %al, 0x23(%rsp)
jmp 0xe3862
movb 0x23(%rsp), %al
testb $0x1, %al
jne 0xe386c
jmp 0xe3888
leaq 0x1f0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x71240
jmp 0xe3883
jmp 0xe3912
leaq 0xa8(%rsp), %rdi
callq 0x7a640
jmp 0xe3897
leaq 0xa8(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x71240
jmp 0xe38ae
leaq 0xc8(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x71240
jmp 0xe38c5
leaq 0x210(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x743e0
jmp 0xe38dc
leaq 0xa8(%rsp), %rdi
callq 0x75d70
jmp 0xe38eb
jmp 0xe3912
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x75d70
jmp 0xe3910
jmp 0xe394e
jmp 0xe3914
jmp 0xe3916
jmp 0xe3918
jmp 0xe391a
leaq 0xe8(%rsp), %rdi
callq 0x7cce8
jmp 0xe3929
leaq 0x108(%rsp), %rdi
callq 0x7cce8
jmp 0xe3938
jmp 0xe393a
leaq 0x140(%rsp), %rdi
callq 0x75880
jmp 0xe3949
jmp 0xe3654
leaq 0xe8(%rsp), %rdi
callq 0x7cce8
jmp 0xe395d
jmp 0xe395f
leaq 0x108(%rsp), %rdi
callq 0x7cce8
jmp 0xe396e
jmp 0xe3b04
leaq 0x170(%rsp), %rdi
callq 0x714c0
movb %al, 0x22(%rsp)
jmp 0xe3986
movb 0x22(%rsp), %al
testb $0x1, %al
jne 0xe3ac2
jmp 0xe3994
movb $0x1, 0x5e(%rsp)
movl $0x28, %edi
callq 0x737c0
movq %rax, 0x10(%rsp)
leaq 0x87(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x7b5f0
movq 0x18(%rsp), %rdx
leaq 0x8d08(%rip), %rsi      # 0xec6ce
leaq 0x88(%rsp), %rdi
callq 0x78e70
jmp 0xe39d5
leaq 0x5f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7b5f0
movq 0x8(%rsp), %rdx
leaq 0x8cfb(%rip), %rsi      # 0xec6eb
leaq 0x60(%rsp), %rdi
callq 0x78e70
jmp 0xe39fc
movq 0x10(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x79cd0
jmp 0xe3a15
movq 0x10(%rsp), %rdi
movb $0x0, 0x5e(%rsp)
movq 0x2e4ea(%rip), %rsi     # 0x111f10
movq 0x2e533(%rip), %rdx     # 0x111f60
callq 0x7b010
jmp 0xe3b3b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0xe3aa0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0xe3a85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x7cce8
jmp 0xe3a83
jmp 0xe3a85
leaq 0x5f(%rsp), %rdi
callq 0x76f80
leaq 0x88(%rsp), %rdi
callq 0x7cce8
jmp 0xe3a9e
jmp 0xe3aa0
leaq 0x87(%rsp), %rdi
callq 0x76f80
testb $0x1, 0x5e(%rsp)
jne 0xe3ab6
jmp 0xe3ac0
movq 0x10(%rsp), %rdi
callq 0x74e00
jmp 0xe3b04
movq 0x50(%rsp), %rax
movq (%rax), %rdi
addq $0x108, %rdi            # imm = 0x108
leaq 0x170(%rsp), %rsi
callq 0x76700
jmp 0xe3ae0
leaq 0x158(%rsp), %rdi
callq 0x74e60
jmp 0xe3aef
leaq 0x170(%rsp), %rdi
callq 0x7a0c0
addq $0x258, %rsp            # imm = 0x258
retq
leaq 0x158(%rsp), %rdi
callq 0x74e60
jmp 0xe3b13
jmp 0xe3b15
leaq 0x170(%rsp), %rdi
callq 0x7a0c0
jmp 0xe3b24
jmp 0xe3b26
movq 0x150(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopl (%rax,%rax)