// File: /workspace/github_cpp_makefile_star2_O3/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, %r14
movq %rsi, %r13
movq %rdi, %r12
addq $0x78, %rdi
callq 0x27130
xorb $0x1, %al
testq %r13, %r13
sete %cl
orb %al, %cl
jne 0x4763e
movq 0x10(%r14), %rsi
movq %r14, %rdi
callq 0x4bae8
leaq 0x8(%r14), %rax
xorl %r15d, %r15d
movq %r15, 0x10(%r14)
movq %rax, 0x18(%r14)
movq %rax, 0x20(%r14)
movq %r15, 0x28(%r14)
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4768e
movb $0x1, %bpl
cmpq %r15, 0x8(%rbx)
je 0x47629
movq %r13, 0x8(%rsp)
movq %r14, 0x10(%rsp)
leaq 0x485d7(%rip), %r13     # 0x8fb30
leaq 0x38(%rsp), %rbp
leaq 0x18(%rsp), %rbx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x66a94
movl $0x1, %r14d
testb %al, %al
jne 0x475ed
movq %rbp, %rdi
leaq 0x485ce(%rip), %rsi     # 0x8fb50
callq 0x66a94
movl $0x2, %r14d
testb %al, %al
jne 0x475ed
movq %rbp, %rdi
leaq 0x485d5(%rip), %rsi     # 0x8fb70
callq 0x66a94
testb %al, %al
je 0x475ac
movl $0x3, %r14d
jmp 0x475ed
cmpl $0x1, %r15d
je 0x475ea
cmpl $0x3, %r15d
je 0x475d1
cmpl $0x2, %r15d
jne 0x47651
movq %rbp, %rsi
movq 0x8(%rsp), %rdx
callq 0x46d88
jmp 0x475e4
movq %rbp, %rsi
movq 0x10(%rsp), %rdx
callq 0x46fa2
movl $0x3, %r14d
testb %al, %al
jne 0x475ed
jmp 0x47651
movl %r15d, %r14d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4768e
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x27350
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x47617
callq 0x27560
cmpq $0x0, 0x40(%rsp)
movl %r14d, %r15d
jne 0x47563
movb $0x1, %bpl
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x47640
callq 0x27560
jmp 0x47640
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x47629
jmp 0x47670
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x47673
callq 0x27560
jmp 0x47673
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x47686
callq 0x27560
movq %rbx, %rdi
callq 0x27b10