// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::StatsFileReader::Read(BamTools::ResolveTool::ResolveSettings*, 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>>>&)
bool ResolveTool::StatsFileReader::Read(ResolveTool::ResolveSettings* settings,
                                        map<string, ReadGroupResolver>& readGroups)
{
    // up-front sanity checks
    if ( !m_stream.is_open() || settings == 0 )
        return false;

    // clear out read group data
    readGroups.clear();

    // initialize state
    State currentState = StatsFileReader::None;

    // read stats file
    string line = SkipCommentsAndWhitespace();
    while ( !line.empty() ) {

        bool foundError = false;

        // switch state on keyword found
        if ( Utilities::StartsWith(line, INPUT_TOKEN) )
            currentState = StatsFileReader::InInput;
        else if ( Utilities::StartsWith(line, OPTIONS_TOKEN) )
            currentState = StatsFileReader::InOptions;
        else if ( Utilities::StartsWith(line, READGROUPS_TOKEN) )
            currentState = StatsFileReader::InReadGroups;

        // otherwise parse data line, depending on state
        else {
            if ( currentState == StatsFileReader::InInput )
                foundError = !ParseInputLine(line);
            else if ( currentState == StatsFileReader::InOptions )
                foundError = !ParseOptionLine(line, settings);
            else if ( currentState == StatsFileReader::InReadGroups )
                foundError = !ParseReadGroupLine(line, readGroups);
            else
                foundError = true;
        }

        // break out if error found
        if ( foundError )
            return false;

        // get next line
        line = SkipCommentsAndWhitespace();
    }

    // if here, return success
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
addq $0x78, %rdi
callq 0x35130
xorb $0x1, %al
movq %rbx, 0x10(%rsp)
testq %rbx, %rbx
sete %cl
xorl %ebx, %ebx
orb %al, %cl
movl $0x0, %r14d
jne 0x4f346
movq %r12, 0x8(%rsp)
movq %r12, %rdi
callq 0x53e24
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x4f386
leaq 0x38(%rsp), %rbp
cmpq $0x0, 0x20(%rsp)
sete %r14b
je 0x4f33c
movq %r12, %rdi
leaq 0x468cf(%rip), %rsi     # 0x95b70
callq 0x67e92
pushq $0x1
popq %r13
testb %al, %al
jne 0x4f316
movq %r12, %rdi
leaq 0x468d8(%rip), %rsi     # 0x95b90
callq 0x67e92
pushq $0x2
popq %r13
testb %al, %al
jne 0x4f316
movq %r12, %rdi
leaq 0x468e1(%rip), %rsi     # 0x95bb0
callq 0x67e92
pushq $0x3
popq %r13
testb %al, %al
jne 0x4f316
cmpl $0x1, %ebx
je 0x4f313
cmpl $0x3, %ebx
je 0x4f2fc
cmpl $0x2, %ebx
jne 0x4f33c
movq %r12, %rsi
movq 0x10(%rsp), %rdx
callq 0x4ed88
pushq $0x2
jmp 0x4f30b
movq %r12, %rsi
movq 0x8(%rsp), %rdx
callq 0x4ef10
pushq $0x3
popq %r13
testb %al, %al
jne 0x4f316
jmp 0x4f33c
movl %ebx, %r13d
movq %rbp, %rdi
movq %r15, %rsi
callq 0x4f386
movq %r12, %rdi
movq %rbp, %rsi
callq 0x35340
movq %rbp, %rdi
callq 0x35730
movl %r13d, %ebx
jmp 0x4f287
leaq 0x18(%rsp), %rdi
callq 0x35730
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x35730
jmp 0x4f36c
jmp 0x4f369
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x35730
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198