// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movl $0x108, %r12d           # imm = 0x108
movq (%rdi), %rdi
addq %r12, %rdi
callq 0x26a10
movq %rax, %r14
addq (%r15), %r12
movq %r12, %rdi
callq 0x291a0
movq %rax, 0x20(%rsp)
cmpq %rax, %r14
je 0x53199
addq $0x10, %rbx
leaq 0x10(%rsp), %r12
movq %rsp, %r13
movq 0x1b2f6(%rip), %rsi     # 0x6e2b0
movq 0x1b2f7(%rip), %rdx     # 0x6e2b8
movq %rbx, %rdi
callq 0x27a70
movq %rax, %rbp
leaq 0x20(%r14), %rdx
movq %r13, %rdi
leaq 0x1b316(%rip), %rsi     # 0x6e2f0
callq 0x53278
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0x27a70
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x52ffe
callq 0x27560
movq %r14, %rdi
callq 0x27dc0
testb %al, %al
je 0x5303c
leaq 0x40(%r14), %rdx
movq %r13, %rdi
leaq 0x1b2f8(%rip), %rsi     # 0x6e310
callq 0x53278
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x27a70
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x5303c
callq 0x27560
movq %r14, %rdi
callq 0x27290
testb %al, %al
je 0x53079
movq %r13, %rdi
leaq 0x1b27e(%rip), %rsi     # 0x6e2d0
movq %r14, %rdx
callq 0x53278
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x27a70
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x53079
callq 0x27560
movq %r14, %rdi
callq 0x281f0
testb %al, %al
je 0x530b7
leaq 0x60(%r14), %rdx
movq %r13, %rdi
leaq 0x1b29d(%rip), %rsi     # 0x6e330
callq 0x53278
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x27a70
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x530b7
callq 0x27560
movq %r14, %rdi
callq 0x27b90
testb %al, %al
je 0x530f8
leaq 0x80(%r14), %rdx
movq %r13, %rdi
leaq 0x1b27c(%rip), %rsi     # 0x6e350
callq 0x53278
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x27a70
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x530f8
callq 0x27560
movq 0xa0(%r14), %rsi
cmpq 0xa8(%r14), %rsi
je 0x53160
xorl %ebp, %ebp
xorl %r15d, %r15d
leaq (%rsi,%rbp), %rdx
addq $0x20, %rdx
addq %rbp, %rsi
movq %r13, %rdi
callq 0x53278
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x27a70
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x5313f
callq 0x27560
incq %r15
movq 0xa0(%r14), %rsi
movq 0xa8(%r14), %rax
subq %rsi, %rax
sarq $0x6, %rax
addq $0x40, %rbp
cmpq %rax, %r15
jb 0x5310d
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x275a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x260a0
movq %rax, %rdi
callq 0x26fc0
addq $0xd8, %r14
cmpq 0x20(%rsp), %r14
jne 0x52fb3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x531b2
jmp 0x531b2
jmp 0x531b2
jmp 0x531b2
jmp 0x531b2
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x531c3
callq 0x27560
movq %rbx, %rdi
callq 0x28c10
nop