// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/HttpHeader_p.cpp
// Function: BamTools::Internal::HttpResponseHeader::ParseLine(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
bool HttpResponseHeader::ParseLine(const string& line, int lineNumber) {

    // if not 'status line', just let base class
    if ( lineNumber != 0 )
        return HttpHeader::ParseLine(line, lineNumber);

    // fail if empty line
    if ( line.empty() )
        return false;

    // walk through status line, storing positions
    //    HTTP/1.1 200 OK
    //    ^       ^^  ^^

    const size_t foundVersion = line.find_first_not_of(Constants::SPACE_CHAR); // skip any leading whitespace
    if ( foundVersion == string::npos ) return false;
    const size_t foundFirstSpace = line.find(Constants::SPACE_CHAR, foundVersion+1);
    if ( foundFirstSpace == string::npos ) return false;
    const size_t foundStatusCode = line.find_first_not_of(Constants::SPACE_CHAR, foundFirstSpace+1);
    if ( foundStatusCode == string::npos ) return false;
    const size_t foundSecondSpace = line.find(Constants::SPACE_CHAR, foundStatusCode+1);
    if ( foundSecondSpace == string::npos ) return false;
    const size_t foundReason= line.find_first_not_of(Constants::SPACE_CHAR, foundSecondSpace+1);
    if ( foundReason == string::npos ) return false;

    // parse version numbers
    string temp = line.substr(foundVersion, foundFirstSpace - foundVersion);
    if ( (temp.find(Constants::HTTP_STRING) != 0) || (temp.size() != 8) )
        return false;
    const int major = static_cast<int>(temp.at(5) - '0');
    const int minor = static_cast<int>(temp.at(7) - '0');
    SetVersion(major, minor);

    // parse status code
    temp = line.substr(foundStatusCode, foundSecondSpace - foundStatusCode);
    if ( temp.size() != 3 ) return false;
    m_statusCode = atoi( temp.c_str() );

    // reason phrase should be everything else left
    m_reason = line.substr(foundReason);

    // if we get here, return success
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
je 0x540b7
movq %rbx, %rdi
movq %r14, %rsi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x33650
cmpq $0x0, 0x8(%r14)
je 0x54229
xorl %r15d, %r15d
pushq $0x20
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x32e10
cmpq $-0x1, %rax
je 0x5422c
movq %rax, %rbp
leaq 0x1(%rax), %rdx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x33d30
cmpq $-0x1, %rax
je 0x54229
movq %rax, %r15
leaq 0x1(%rax), %rdx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x32e10
cmpq $-0x1, %rax
je 0x54229
movq %rax, %r12
leaq 0x1(%rax), %rdx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x33d30
cmpq $-0x1, %rax
je 0x54229
movq %rax, %r13
leaq 0x1(%rax), %rdx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x32e10
cmpq $-0x1, %rax
je 0x54229
movq %rax, 0x20(%rsp)
subq %rbp, %r15
movq %rsp, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x332a0
leaq 0x2429c(%rip), %rsi     # 0x78408
movq %rsp, %rdi
xorl %edx, %edx
callq 0x35770
testq %rax, %rax
jne 0x5423e
cmpq $0x8, 0x8(%rsp)
jne 0x5423e
movq %rsp, %rdi
pushq $0x5
popq %rsi
callq 0x35570
movsbl (%rax), %ebp
movq %rsp, %rdi
pushq $0x7
popq %rsi
callq 0x35570
addl $-0x30, %ebp
movsbl (%rax), %eax
addl $-0x30, %eax
movl %ebp, 0x3c(%rbx)
movl %eax, 0x40(%rbx)
subq %r12, %r13
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x332a0
movq %rsp, %rdi
leaq 0x28(%rsp), %rsi
callq 0x32060
leaq 0x28(%rsp), %rdi
callq 0x33a00
cmpq $0x3, 0x8(%rsp)
jne 0x5423e
movq (%rsp), %rdi
callq 0x34710
movl %eax, 0x44(%rbx)
leaq 0x28(%rsp), %rdi
pushq $-0x1
popq %rcx
movq %r14, %rsi
movq 0x20(%rsp), %rdx
callq 0x332a0
addq $0x48, %rbx
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x32060
leaq 0x28(%rsp), %rdi
callq 0x33a00
movb $0x1, %r15b
jmp 0x54241
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
movq %rsp, %rdi
callq 0x33a00
jmp 0x5422c
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x33a00
jmp 0x54274
jmp 0x54271
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x33a00
jmp 0x54274
jmp 0x54271
jmp 0x54271
jmp 0x54271
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f