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

    // iterate over read group entries
    SamReadGroupConstIterator rgIter = m_header.ReadGroups.ConstBegin();
    SamReadGroupConstIterator rgEnd  = m_header.ReadGroups.ConstEnd();
    for ( ; rgIter != rgEnd; ++rgIter ) {
        const SamReadGroup& rg = (*rgIter);

        // @RG ID:<ID>
        out << Constants::SAM_RG_BEGIN_TOKEN
            << FormatTag(Constants::SAM_RG_ID_TAG, rg.ID);

        // CN:<SequencingCenter>
        if ( rg.HasSequencingCenter() )
            out << FormatTag(Constants::SAM_RG_SEQCENTER_TAG, rg.SequencingCenter);

        // DS:<Description>
        if ( rg.HasDescription() )
            out << FormatTag(Constants::SAM_RG_DESCRIPTION_TAG, rg.Description);

        // DT:<ProductionDate>
        if ( rg.HasProductionDate() )
            out << FormatTag(Constants::SAM_RG_PRODUCTIONDATE_TAG, rg.ProductionDate);

        // FO:<FlowOrder>
        if ( rg.HasFlowOrder() )
            out << FormatTag(Constants::SAM_RG_FLOWORDER_TAG, rg.FlowOrder);

        // KS:<KeySequence>
        if ( rg.HasKeySequence() )
            out << FormatTag(Constants::SAM_RG_KEYSEQUENCE_TAG, rg.KeySequence);

        // LB:<Library>
        if ( rg.HasLibrary() )
            out << FormatTag(Constants::SAM_RG_LIBRARY_TAG, rg.Library);

        // PG:<Program>
        if ( rg.HasProgram() )
            out << FormatTag(Constants::SAM_RG_PROGRAM_TAG, rg.Program);

        // PI:<PredictedInsertSize>
        if ( rg.HasPredictedInsertSize() )
            out << FormatTag(Constants::SAM_RG_PREDICTEDINSERTSIZE_TAG, rg.PredictedInsertSize);

        // PL:<SequencingTechnology>
        if ( rg.HasSequencingTechnology() )
            out << FormatTag(Constants::SAM_RG_SEQTECHNOLOGY_TAG, rg.SequencingTechnology);

        // PU:<PlatformUnit>
        if ( rg.HasPlatformUnit() )
            out << FormatTag(Constants::SAM_RG_PLATFORMUNIT_TAG, rg.PlatformUnit);

        // SM:<Sample>
        if ( rg.HasSample() )
            out << FormatTag(Constants::SAM_RG_SAMPLE_TAG, rg.Sample);

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

        // newline
        out << endl;
    }
}

// Assembly:
subq $0x2c8, %rsp            # imm = 0x2C8
movq %rdi, 0x2c0(%rsp)
movq %rsi, 0x2b8(%rsp)
movq 0x2c0(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq (%rax), %rdi
addq $0xc0, %rdi
callq 0x7ab20
movq %rax, %rcx
movq 0xd8(%rsp), %rax
movq %rcx, 0x2b0(%rsp)
movq (%rax), %rdi
addq $0xc0, %rdi
callq 0x7b990
movq %rax, 0x2a8(%rsp)
leaq 0x2b0(%rsp), %rdi
leaq 0x2a8(%rsp), %rsi
callq 0x736e0
testb $0x1, %al
jne 0xe4e7e
jmp 0xe56fd
leaq 0x2b0(%rsp), %rdi
callq 0x737d0
movq %rax, 0x2a0(%rsp)
movq 0x2b8(%rsp), %rdi
addq $0x10, %rdi
leaq 0x347aa(%rip), %rsi     # 0x119650
callq 0x75e40
movq %rax, 0xc8(%rsp)
movq 0x2a0(%rsp), %rdx
addq $0x40, %rdx
leaq 0x347ea(%rip), %rsi     # 0x1196b0
leaq 0x280(%rsp), %rdi
movq %rdi, 0xd0(%rsp)
callq 0xe5c90
movq 0xc8(%rsp), %rdi
movq 0xd0(%rsp), %rsi
callq 0x75e40
jmp 0xe4ef2
leaq 0x280(%rsp), %rdi
callq 0x7cce8
movq 0x2a0(%rsp), %rdi
callq 0x77dd0
testb $0x1, %al
jne 0xe4f15
jmp 0xe4fca
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0xb8(%rsp)
movq 0x2a0(%rsp), %rdx
addq $0x140, %rdx            # imm = 0x140
leaq 0x34871(%rip), %rsi     # 0x1197b0
leaq 0x250(%rsp), %rdi
movq %rdi, 0xc0(%rsp)
callq 0xe5c90
movq 0xb8(%rsp), %rdi
movq 0xc0(%rsp), %rsi
callq 0x75e40
jmp 0xe4f6b
leaq 0x250(%rsp), %rdi
callq 0x7cce8
jmp 0xe4fca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x280(%rsp), %rdi
callq 0x7cce8
jmp 0xe4f9d
jmp 0xe5705
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x250(%rsp), %rdi
callq 0x7cce8
jmp 0xe4fc5
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
callq 0x75ce0
testb $0x1, %al
jne 0xe4fe0
jmp 0xe5066
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0xa8(%rsp)
movq 0x2a0(%rsp), %rdx
leaq 0x3466d(%rip), %rsi     # 0x119670
leaq 0x230(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
callq 0xe5c90
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x75e40
jmp 0xe502f
leaq 0x230(%rsp), %rdi
callq 0x7cce8
jmp 0xe5066
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x230(%rsp), %rdi
callq 0x7cce8
jmp 0xe5061
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
callq 0x76ae0
testb $0x1, %al
jne 0xe507c
jmp 0xe5109
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x98(%rsp)
movq 0x2a0(%rsp), %rdx
addq $0xe0, %rdx
leaq 0x346aa(%rip), %rsi     # 0x119750
leaq 0x210(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
callq 0xe5c90
movq 0x98(%rsp), %rdi
movq 0xa0(%rsp), %rsi
callq 0x75e40
jmp 0xe50d2
leaq 0x210(%rsp), %rdi
callq 0x7cce8
jmp 0xe5109
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x210(%rsp), %rdi
callq 0x7cce8
jmp 0xe5104
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
callq 0x79e40
testb $0x1, %al
jne 0xe511f
jmp 0xe51a9
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x88(%rsp)
movq 0x2a0(%rsp), %rdx
addq $0x20, %rdx
leaq 0x3454a(%rip), %rsi     # 0x119690
leaq 0x1f0(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0xe5c90
movq 0x88(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x75e40
jmp 0xe5172
leaq 0x1f0(%rsp), %rdi
callq 0x7cce8
jmp 0xe51a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x7cce8
jmp 0xe51a4
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
callq 0x74a10
testb $0x1, %al
jne 0xe51bf
jmp 0xe5243
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x78(%rsp)
movq 0x2a0(%rsp), %rdx
addq $0x60, %rdx
leaq 0x344ed(%rip), %rsi     # 0x1196d0
leaq 0x1d0(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0xe5c90
movq 0x78(%rsp), %rdi
movq 0x80(%rsp), %rsi
callq 0x75e40
jmp 0xe520c
leaq 0x1d0(%rsp), %rdi
callq 0x7cce8
jmp 0xe5243
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x7cce8
jmp 0xe523e
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
callq 0x71460
testb $0x1, %al
jne 0xe5256
jmp 0xe52d4
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x68(%rsp)
movq 0x2a0(%rsp), %rdx
subq $-0x80, %rdx
leaq 0x34476(%rip), %rsi     # 0x1196f0
leaq 0x1b0(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0xe5c90
movq 0x68(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x75e40
jmp 0xe529d
leaq 0x1b0(%rsp), %rdi
callq 0x7cce8
jmp 0xe52d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x1b0(%rsp), %rdi
callq 0x7cce8
jmp 0xe52cf
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
callq 0x7c210
testb $0x1, %al
jne 0xe52ea
jmp 0xe536b
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x58(%rsp)
movq 0x2a0(%rsp), %rdx
addq $0x100, %rdx            # imm = 0x100
leaq 0x3445f(%rip), %rsi     # 0x119770
leaq 0x190(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0xe5c90
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x75e40
jmp 0xe5334
leaq 0x190(%rsp), %rdi
callq 0x7cce8
jmp 0xe536b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x190(%rsp), %rdi
callq 0x7cce8
jmp 0xe5366
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
callq 0x76300
testb $0x1, %al
jne 0xe5381
jmp 0xe5402
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x48(%rsp)
movq 0x2a0(%rsp), %rdx
addq $0xc0, %rdx
leaq 0x34388(%rip), %rsi     # 0x119730
leaq 0x170(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0xe5c90
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x75e40
jmp 0xe53cb
leaq 0x170(%rsp), %rdi
callq 0x7cce8
jmp 0xe5402
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x7cce8
jmp 0xe53fd
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
callq 0x74530
testb $0x1, %al
jne 0xe5418
jmp 0xe5499
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x38(%rsp)
movq 0x2a0(%rsp), %rdx
addq $0x160, %rdx            # imm = 0x160
leaq 0x34391(%rip), %rsi     # 0x1197d0
leaq 0x150(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0xe5c90
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x75e40
jmp 0xe5462
leaq 0x150(%rsp), %rdi
callq 0x7cce8
jmp 0xe5499
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x7cce8
jmp 0xe5494
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
callq 0x7ad30
testb $0x1, %al
jne 0xe54af
jmp 0xe5530
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x28(%rsp)
movq 0x2a0(%rsp), %rdx
addq $0xa0, %rdx
leaq 0x3423a(%rip), %rsi     # 0x119710
leaq 0x130(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xe5c90
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x75e40
jmp 0xe54f9
leaq 0x130(%rsp), %rdi
callq 0x7cce8
jmp 0xe5530
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x7cce8
jmp 0xe552b
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
callq 0x76da0
testb $0x1, %al
jne 0xe5546
jmp 0xe55c7
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x18(%rsp)
movq 0x2a0(%rsp), %rdx
addq $0x120, %rdx            # imm = 0x120
leaq 0x34223(%rip), %rsi     # 0x119790
leaq 0x110(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0xe5c90
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x75e40
jmp 0xe5590
leaq 0x110(%rsp), %rdi
callq 0x7cce8
jmp 0xe55c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x7cce8
jmp 0xe55c2
jmp 0xe5705
movq 0x2a0(%rsp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0x73ec0
testb $0x1, %al
jne 0xe56d3
movq $0x0, 0x108(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x2a0(%rsp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0x77e40
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0xe56d1
movq 0x2a0(%rsp), %rdi
addq $0x180, %rdi            # imm = 0x180
movq 0x108(%rsp), %rsi
callq 0x76620
movq %rax, 0x100(%rsp)
movq 0x2b8(%rsp), %rax
addq $0x10, %rax
movq %rax, (%rsp)
movq 0x100(%rsp), %rsi
movq %rsi, %rdx
addq $0x20, %rdx
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xe5c90
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x75e40
jmp 0xe5686
leaq 0xe0(%rsp), %rdi
callq 0x7cce8
movq 0x108(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x108(%rsp)
jmp 0xe55ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x278(%rsp)
movl %eax, 0x274(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x7cce8
jmp 0xe56cf
jmp 0xe5705
jmp 0xe56d3
movq 0x2b8(%rsp), %rdi
addq $0x10, %rdi
movq 0x2c832(%rip), %rsi     # 0x111f18
callq 0x76cc0
leaq 0x2b0(%rsp), %rdi
callq 0x7aa70
jmp 0xe4e60
addq $0x2c8, %rsp            # imm = 0x2C8
retq
movq 0x278(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopw (%rax,%rax)