// File: zeeev[P]DASVC/bamtools/src/api/internal/sam/SamFormatPrinter_p.cpp
// Function: BamTools::Internal::SamFormatPrinter::PrintPG(std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char>>&) const
void SamFormatPrinter::PrintPG(std::stringstream& out) const {

    // iterate over program record entries
    SamProgramConstIterator pgIter = m_header.Programs.ConstBegin();
    SamProgramConstIterator pgEnd  = m_header.Programs.ConstEnd();
    for ( ; pgIter != pgEnd; ++pgIter ) {
        const SamProgram& pg = (*pgIter);

        // @PG ID:<ID>
        out << Constants::SAM_PG_BEGIN_TOKEN
            << FormatTag(Constants::SAM_PG_ID_TAG, pg.ID);

        // PN:<Name>
        if ( pg.HasName() )
            out << FormatTag(Constants::SAM_PG_NAME_TAG, pg.Name);

        // CL:<CommandLine>
        if ( pg.HasCommandLine() )
            out << FormatTag(Constants::SAM_PG_COMMANDLINE_TAG, pg.CommandLine);

        // PP:<PreviousProgramID>
        if ( pg.HasPreviousProgramID() )
            out << FormatTag(Constants::SAM_PG_PREVIOUSPROGRAM_TAG, pg.PreviousProgramID);

        // VN:<Version>
        if ( pg.HasVersion() )
            out << FormatTag(Constants::SAM_PG_VERSION_TAG, pg.Version);

        // custom tags
        if ( !pg.CustomTags.empty() ) {
            for (size_t i = 0; i < pg.CustomTags.size(); ++i) {
                const CustomHeaderTag& customTag = pg.CustomTags[i];
                out << FormatTag(customTag.TagName, customTag.TagValue);
            }
        }

        // newline
        out << endl;
    }
}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, 0x170(%rsp)
movq %rsi, 0x168(%rsp)
movq 0x170(%rsp), %rax
movq %rax, 0x68(%rsp)
movq (%rax), %rdi
addq $0x108, %rdi            # imm = 0x108
callq 0x738b0
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x160(%rsp)
movq (%rax), %rdi
addq $0x108, %rdi            # imm = 0x108
callq 0x7c8a0
movq %rax, 0x158(%rsp)
leaq 0x160(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x71760
testb $0x1, %al
jne 0xe5798
jmp 0xe5ba5
leaq 0x160(%rsp), %rdi
callq 0x7b140
movq %rax, 0x150(%rsp)
movq 0x168(%rsp), %rdi
addq $0x10, %rdi
leaq 0x34030(%rip), %rsi     # 0x1197f0
callq 0x75e40
movq %rax, 0x58(%rsp)
movq 0x150(%rsp), %rdx
addq $0x20, %rdx
leaq 0x34053(%rip), %rsi     # 0x119830
leaq 0x130(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0xe5c90
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x75e40
jmp 0xe5800
leaq 0x130(%rsp), %rdi
callq 0x7cce8
movq 0x150(%rsp), %rdi
callq 0x78410
testb $0x1, %al
jne 0xe5823
jmp 0xe58c9
movq 0x168(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x48(%rsp)
movq 0x150(%rsp), %rdx
addq $0x40, %rdx
leaq 0x34009(%rip), %rsi     # 0x119850
leaq 0x100(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0xe5c90
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x75e40
jmp 0xe586a
leaq 0x100(%rsp), %rdi
callq 0x7cce8
jmp 0xe58c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x7cce8
jmp 0xe589c
jmp 0xe5bad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x7cce8
jmp 0xe58c4
jmp 0xe5bad
movq 0x150(%rsp), %rdi
callq 0x75890
testb $0x1, %al
jne 0xe58dc
jmp 0xe5956
movq 0x168(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x38(%rsp)
movq 0x150(%rsp), %rdx
leaq 0x33f14(%rip), %rsi     # 0x119810
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0xe5c90
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x75e40
jmp 0xe591f
leaq 0xe0(%rsp), %rdi
callq 0x7cce8
jmp 0xe5956
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x7cce8
jmp 0xe5951
jmp 0xe5bad
movq 0x150(%rsp), %rdi
callq 0x794e0
testb $0x1, %al
jne 0xe5969
jmp 0xe59e7
movq 0x168(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x28(%rsp)
movq 0x150(%rsp), %rdx
addq $0x60, %rdx
leaq 0x33ee3(%rip), %rsi     # 0x119870
leaq 0xc0(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xe5c90
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x75e40
jmp 0xe59b0
leaq 0xc0(%rsp), %rdi
callq 0x7cce8
jmp 0xe59e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x7cce8
jmp 0xe59e2
jmp 0xe5bad
movq 0x150(%rsp), %rdi
callq 0x77bc0
testb $0x1, %al
jne 0xe59fa
jmp 0xe5a78
movq 0x168(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x18(%rsp)
movq 0x150(%rsp), %rdx
subq $-0x80, %rdx
leaq 0x33e72(%rip), %rsi     # 0x119890
leaq 0xa0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0xe5c90
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x75e40
jmp 0xe5a41
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xe5a78
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xe5a73
jmp 0xe5bad
movq 0x150(%rsp), %rdi
addq $0xa0, %rdi
callq 0x73ec0
testb $0x1, %al
jne 0xe5b7b
movq $0x0, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x150(%rsp), %rdi
addq $0xa0, %rdi
callq 0x77e40
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0xe5b79
movq 0x150(%rsp), %rdi
addq $0xa0, %rdi
movq 0x98(%rsp), %rsi
callq 0x76620
movq %rax, 0x90(%rsp)
movq 0x168(%rsp), %rax
addq $0x10, %rax
movq %rax, (%rsp)
movq 0x90(%rsp), %rsi
movq %rsi, %rdx
addq $0x20, %rdx
leaq 0x70(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xe5c90
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x75e40
jmp 0xe5b34
leaq 0x70(%rsp), %rdi
callq 0x7cce8
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x98(%rsp)
jmp 0xe5aa0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x7cce8
jmp 0xe5b77
jmp 0xe5bad
jmp 0xe5b7b
movq 0x168(%rsp), %rdi
addq $0x10, %rdi
movq 0x2c38a(%rip), %rsi     # 0x111f18
callq 0x76cc0
leaq 0x160(%rsp), %rdi
callq 0x78180
jmp 0xe577a
addq $0x178, %rsp            # imm = 0x178
retq
movq 0x128(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopw %cs:(%rax,%rax)