// File: zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::StatsFileWriter::WriteReadGroups(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, ReadGroupResolver, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, ReadGroupResolver>>> const&)
void ResolveTool::StatsFileWriter::WriteReadGroups(const map<string, ReadGroupResolver>& readGroups) {

    // [ReadGroups]
    // #<name> <medianFL> <minFL> <maxFL> <topModelID> <nextTopModelID> <isAmbiguous?>
    m_stream << READGROUPS_TOKEN << endl
             << RG_FIELD_DESCRIPTION << endl;

    // iterate over read groups
    map<string, ReadGroupResolver>::const_iterator rgIter = readGroups.begin();
    map<string, ReadGroupResolver>::const_iterator rgEnd  = readGroups.end();
    for ( ; rgIter != rgEnd; ++rgIter ) {
        const string& name = (*rgIter).first;
        const ReadGroupResolver& resolver = (*rgIter).second;

        // skip if read group has no data
        if ( !resolver.HasData )
            continue;

        // write read group data
        m_stream << name << TAB_CHAR
                 << resolver.MedianFragmentLength << TAB_CHAR
                 << resolver.MinFragmentLength << TAB_CHAR
                 << resolver.MaxFragmentLength << TAB_CHAR
                 << resolver.TopModelId << TAB_CHAR
                 << resolver.NextTopModelId << TAB_CHAR
                 << boolalpha << resolver.IsAmbiguous
                 << endl;
    }

    // extra newline at end
    m_stream << endl;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, (%rsp)
leaq 0x9c222(%rip), %rsi     # 0x165d00
callq 0x86640
movq %rax, %rdi
movq 0x9b483(%rip), %rsi     # 0x164f70
callq 0x86770
movq %rax, %rdi
leaq 0x9c2a4(%rip), %rsi     # 0x165da0
callq 0x86640
movq %rax, %rdi
movq 0x9b465(%rip), %rsi     # 0x164f70
callq 0x86770
movq 0x28(%rsp), %rdi
callq 0xcfbf0
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
callq 0xcfc20
movq %rax, 0x18(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xcfc50
testb $0x1, %al
jne 0xc9b46
jmp 0xc9c67
leaq 0x20(%rsp), %rdi
callq 0xcfc70
movq %rax, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
callq 0xcfc70
addq $0x20, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
testb $0x1, 0x11(%rax)
jne 0xc9b78
jmp 0xc9c58
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x86640
movq %rax, %rdi
movl $0x9, %esi
callq 0x86890
movq %rax, %rdi
movq 0x8(%rsp), %rax
movl 0x4(%rax), %esi
callq 0x86d40
movq %rax, %rdi
movl $0x9, %esi
callq 0x86890
movq %rax, %rdi
movq 0x8(%rsp), %rax
movl (%rax), %esi
callq 0x86d40
movq %rax, %rdi
movl $0x9, %esi
callq 0x86890
movq %rax, %rdi
movq 0x8(%rsp), %rax
movl 0x8(%rax), %esi
callq 0x86d40
movq %rax, %rdi
movl $0x9, %esi
callq 0x86890
movq %rax, %rdi
movq 0x8(%rsp), %rax
movzwl 0xc(%rax), %esi
callq 0x86cb0
movq %rax, %rdi
movl $0x9, %esi
callq 0x86890
movq %rax, %rdi
movq 0x8(%rsp), %rax
movzwl 0xe(%rax), %esi
callq 0x86cb0
movq %rax, %rdi
movl $0x9, %esi
callq 0x86890
movq %rax, %rdi
leaq -0x2068f(%rip), %rsi    # 0xa95a0
callq 0x86290
movq %rax, %rdi
movq 0x8(%rsp), %rax
movb 0x10(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x86dc0
movq %rax, %rdi
movq 0x9b31d(%rip), %rsi     # 0x164f70
callq 0x86770
leaq 0x20(%rsp), %rdi
callq 0xcfc90
jmp 0xc9b2e
movq (%rsp), %rdi
movq 0x9b2fe(%rip), %rsi     # 0x164f70
callq 0x86770
addq $0x38, %rsp
retq
nopl (%rax)