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

    // iterate over sequence entries
    SamSequenceConstIterator seqIter = m_header.Sequences.ConstBegin();
    SamSequenceConstIterator seqEnd  = m_header.Sequences.ConstEnd();
    for ( ; seqIter != seqEnd; ++seqIter ) {
        const SamSequence& seq = (*seqIter);

        // @SQ SN:<Name> LN:<Length>
        out << Constants::SAM_SQ_BEGIN_TOKEN
            << FormatTag(Constants::SAM_SQ_NAME_TAG, seq.Name)
            << FormatTag(Constants::SAM_SQ_LENGTH_TAG, seq.Length);

        // AS:<AssemblyID>
        if ( seq.HasAssemblyID() )
            out << FormatTag(Constants::SAM_SQ_ASSEMBLYID_TAG, seq.AssemblyID);

        // M5:<Checksum>
        if ( seq.HasChecksum() )
            out << FormatTag(Constants::SAM_SQ_CHECKSUM_TAG, seq.Checksum);

        // SP:<Species>
        if ( seq.HasSpecies() )
            out << FormatTag(Constants::SAM_SQ_SPECIES_TAG, seq.Species);

        // UR:<URI>
        if ( seq.HasURI() )
            out << FormatTag(Constants::SAM_SQ_URI_TAG, seq.URI);

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

        // newline
        out << endl;
    }
}

// Assembly:
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, 0x1a0(%rsp)
movq %rsi, 0x198(%rsp)
movq 0x1a0(%rsp), %rax
movq %rax, 0x78(%rsp)
movq (%rax), %rdi
addq $0x78, %rdi
callq 0x79d20
movq %rax, %rcx
movq 0x78(%rsp), %rax
movq %rcx, 0x190(%rsp)
movq (%rax), %rdi
addq $0x78, %rdi
callq 0x7bfb0
movq %rax, 0x188(%rsp)
leaq 0x190(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x75e90
testb $0x1, %al
jne 0xe4952
jmp 0xe4de1
leaq 0x190(%rsp), %rdi
callq 0x767c0
movq %rax, 0x180(%rsp)
movq 0x198(%rsp), %rdi
addq $0x10, %rdi
leaq 0x34bf6(%rip), %rsi     # 0x119570
callq 0x75e40
movq %rax, 0x60(%rsp)
movq 0x180(%rsp), %rdx
addq $0x60, %rdx
leaq 0x34c59(%rip), %rsi     # 0x1195f0
leaq 0x160(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0xe5c90
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x75e40
movq %rax, 0x70(%rsp)
jmp 0xe49bf
movq 0x180(%rsp), %rdx
addq $0x40, %rdx
leaq 0x34bfe(%rip), %rsi     # 0x1195d0
leaq 0x130(%rsp), %rdi
callq 0xe5c90
jmp 0xe49e1
movq 0x70(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x75e40
jmp 0xe49f5
leaq 0x130(%rsp), %rdi
callq 0x7cce8
jmp 0xe4a04
leaq 0x160(%rsp), %rdi
callq 0x7cce8
movq 0x180(%rsp), %rdi
callq 0x77990
testb $0x1, %al
jne 0xe4a27
jmp 0xe4af0
movq 0x198(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x50(%rsp)
movq 0x180(%rsp), %rdx
leaq 0x34b49(%rip), %rsi     # 0x119590
leaq 0x110(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0xe5c90
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x75e40
jmp 0xe4a6a
leaq 0x110(%rsp), %rdi
callq 0x7cce8
jmp 0xe4af0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
jmp 0xe4ab4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x7cce8
jmp 0xe4ab2
jmp 0xe4ab4
leaq 0x160(%rsp), %rdi
callq 0x7cce8
jmp 0xe4ac3
jmp 0xe4de9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x7cce8
jmp 0xe4aeb
jmp 0xe4de9
movq 0x180(%rsp), %rdi
callq 0x74340
testb $0x1, %al
jne 0xe4b03
jmp 0xe4b81
movq 0x198(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x40(%rsp)
movq 0x180(%rsp), %rdx
addq $0x20, %rdx
leaq 0x34a89(%rip), %rsi     # 0x1195b0
leaq 0xf0(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0xe5c90
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x75e40
jmp 0xe4b4a
leaq 0xf0(%rsp), %rdi
callq 0x7cce8
jmp 0xe4b81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x7cce8
jmp 0xe4b7c
jmp 0xe4de9
movq 0x180(%rsp), %rdi
callq 0x78240
testb $0x1, %al
jne 0xe4b94
jmp 0xe4c12
movq 0x198(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x30(%rsp)
movq 0x180(%rsp), %rdx
subq $-0x80, %rdx
leaq 0x34a58(%rip), %rsi     # 0x119610
leaq 0xd0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0xe5c90
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x75e40
jmp 0xe4bdb
leaq 0xd0(%rsp), %rdi
callq 0x7cce8
jmp 0xe4c12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x7cce8
jmp 0xe4c0d
jmp 0xe4de9
movq 0x180(%rsp), %rdi
callq 0x7c3b0
testb $0x1, %al
jne 0xe4c28
jmp 0xe4ca9
movq 0x198(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x20(%rsp)
movq 0x180(%rsp), %rdx
addq $0xa0, %rdx
leaq 0x349e1(%rip), %rsi     # 0x119630
leaq 0xb0(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xe5c90
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x75e40
jmp 0xe4c72
leaq 0xb0(%rsp), %rdi
callq 0x7cce8
jmp 0xe4ca9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x7cce8
jmp 0xe4ca4
jmp 0xe4de9
movq 0x180(%rsp), %rdi
addq $0xc0, %rdi
callq 0x73ec0
testb $0x1, %al
jne 0xe4db7
movq $0x0, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x180(%rsp), %rdi
addq $0xc0, %rdi
callq 0x77e40
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0xe4db5
movq 0x180(%rsp), %rdi
addq $0xc0, %rdi
movq 0xa8(%rsp), %rsi
callq 0x76620
movq %rax, 0xa0(%rsp)
movq 0x198(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x8(%rsp)
movq 0xa0(%rsp), %rsi
movq %rsi, %rdx
addq $0x20, %rdx
leaq 0x80(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0xe5c90
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x75e40
jmp 0xe4d6a
leaq 0x80(%rsp), %rdi
callq 0x7cce8
movq 0xa8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa8(%rsp)
jmp 0xe4cd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x7cce8
jmp 0xe4db3
jmp 0xe4de9
jmp 0xe4db7
movq 0x198(%rsp), %rdi
addq $0x10, %rdi
movq 0x2d14e(%rip), %rsi     # 0x111f18
callq 0x76cc0
leaq 0x190(%rsp), %rdi
callq 0x76200
jmp 0xe4934
addq $0x1a8, %rsp            # imm = 0x1A8
retq
movq 0x158(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nop