// File: /workspace/github_cpp_makefile_star2_O1/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, %r15
addq $0x78, %rdi
callq 0x27130
xorb $0x1, %al
testq %r13, %r13
sete %cl
xorl %ebx, %ebx
orb %al, %cl
movl $0x0, %r12d
jne 0x4774c
movq %r13, 0x8(%rsp)
movq 0x10(%r14), %rsi
movq %r14, %rdi
callq 0x4bbd6
leaq 0x8(%r14), %rax
movq %rbx, 0x10(%r14)
movq %rax, 0x18(%r14)
movq %rax, 0x20(%r14)
movq %r14, 0x10(%rsp)
movq %rbx, 0x28(%r14)
leaq 0x38(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x47798
leaq 0x18(%rsp), %r14
cmpq $0x0, 0x40(%rsp)
sete %r12b
je 0x47739
movq %r13, %rdi
leaq 0x494c9(%rip), %rsi     # 0x90b38
callq 0x67038
testb %al, %al
je 0x47681
movl $0x1, %ebx
xorl %ebp, %ebp
jmp 0x476b7
movq %r13, %rdi
leaq 0x494cd(%rip), %rsi     # 0x90b58
callq 0x67038
testb %al, %al
je 0x4769d
xorl %ebp, %ebp
movl $0x2, %ebx
jmp 0x476b7
movq %r13, %rdi
leaq 0x494d1(%rip), %rsi     # 0x90b78
callq 0x67038
testb %al, %al
je 0x476f1
xorl %ebp, %ebp
movl $0x3, %ebx
testb %bpl, %bpl
jne 0x47739
movq %r14, %rdi
movq %r15, %rsi
callq 0x47798
movq %r13, %rdi
movq %r14, %rsi
callq 0x27350
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x476e6
callq 0x27560
testb %bpl, %bpl
je 0x47655
jmp 0x47739
cmpl $0x3, %ebx
je 0x47721
cmpl $0x2, %ebx
je 0x47709
movb $0x1, %bpl
cmpl $0x1, %ebx
je 0x4767d
jmp 0x476b7
movq %r13, %rsi
movq 0x8(%rsp), %rdx
callq 0x46e8e
movl %eax, %ebp
xorb $0x1, %bpl
jmp 0x47696
movq %r13, %rsi
movq 0x10(%rsp), %rdx
callq 0x470a8
movl %eax, %ebp
xorb $0x1, %bpl
jmp 0x476b2
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4774c
callq 0x27560
movl %r12d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x4777c
callq 0x27560
jmp 0x4777c
jmp 0x47779
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4778f
callq 0x27560
movq %rbx, %rdi
callq 0x27b20
nop