// File: /workspace/github_cpp_makefile_star2_O2/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 0x31ed0
movq %rax, %r14
addq (%r15), %r12
movq %r12, %rdi
callq 0x35670
movq %rax, %r15
addq $0x10, %rbx
leaq 0x8(%rsp), %rbp
cmpq %r15, %r14
je 0x590b0
movq %rbx, %rdi
leaq 0x1fe16(%rip), %rsi     # 0x78d58
callq 0x32d80
movq %rax, %r12
leaq 0x20(%r14), %rdx
movq %rbp, %rdi
leaq 0x1fe40(%rip), %rsi     # 0x78d98
callq 0x5918e
movq %r12, %rdi
movq %rbp, %rsi
callq 0x32d80
movq %rbp, %rdi
callq 0x33a00
movq %r14, %rdi
callq 0x33b90
testb %al, %al
je 0x58fa2
leaq 0x40(%r14), %rdx
movq %rbp, %rdi
leaq 0x1fe2e(%rip), %rsi     # 0x78db8
callq 0x5918e
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x32d80
movq %rbp, %rdi
callq 0x33a00
movq %r14, %rdi
callq 0x32ba0
testb %al, %al
je 0x58fd3
movq %rbp, %rdi
leaq 0x1fdc0(%rip), %rsi     # 0x78d78
movq %r14, %rdx
callq 0x5918e
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x32d80
movq %rbp, %rdi
callq 0x33a00
movq %r14, %rdi
callq 0x341b0
testb %al, %al
je 0x59005
leaq 0x60(%r14), %rdx
movq %rbp, %rdi
leaq 0x1fdeb(%rip), %rsi     # 0x78dd8
callq 0x5918e
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x32d80
movq %rbp, %rdi
callq 0x33a00
movq %r14, %rdi
callq 0x33890
testb %al, %al
je 0x5903a
leaq 0x80(%r14), %rdx
movq %rbp, %rdi
leaq 0x1fdd6(%rip), %rsi     # 0x78df8
callq 0x5918e
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x32d80
movq %rbp, %rdi
callq 0x33a00
movq 0xa0(%r14), %rsi
movq 0xa8(%r14), %rax
cmpq %rax, %rsi
je 0x5909c
xorl %r12d, %r12d
xorl %r13d, %r13d
subq %rsi, %rax
sarq $0x6, %rax
cmpq %rax, %r13
jae 0x5909c
leaq (%rsi,%r12), %rdx
addq $0x20, %rdx
addq %r12, %rsi
movq %rbp, %rdi
callq 0x5918e
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x32d80
movq %rbp, %rdi
callq 0x33a00
incq %r13
movq 0xa0(%r14), %rsi
movq 0xa8(%r14), %rax
addq $0x40, %r12
jmp 0x59053
movq %rbx, %rdi
callq 0x31e60
addq $0xd8, %r14
jmp 0x58f2f
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x59117
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x59117
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x59117
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x59117
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x59117
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop