// File: /workspace/github_cpp_makefile_star2_O3/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 0x4d1af
movq %rbx, %rdi
movq %r14, %rsi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x27a60
cmpq $0x0, 0x8(%r14)
je 0x4d334
xorl %r15d, %r15d
movq %r14, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x27440
cmpq $-0x1, %rax
je 0x4d337
movq %rax, %rbp
leaq 0x1(%rax), %rdx
movq %r14, %rdi
movl $0x20, %esi
callq 0x27ef0
cmpq $-0x1, %rax
je 0x4d334
movq %rax, %r15
leaq 0x1(%rax), %rdx
movq %r14, %rdi
movl $0x20, %esi
callq 0x27440
cmpq $-0x1, %rax
je 0x4d334
movq %rax, %r12
leaq 0x1(%rax), %rdx
movq %r14, %rdi
movl $0x20, %esi
callq 0x27ef0
cmpq $-0x1, %rax
je 0x4d334
movq %rax, %r13
leaq 0x1(%rax), %rdx
movq %r14, %rdi
movl $0x20, %esi
callq 0x27440
cmpq $-0x1, %rax
je 0x4d334
movq %rax, 0x20(%rsp)
subq %rbp, %r15
movq %rsp, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x277f0
movq 0x206f2(%rip), %rsi     # 0x6d960
movq 0x206f3(%rip), %rcx     # 0x6d968
movq %rsp, %rdi
xorl %edx, %edx
callq 0x28af0
testq %rax, %rax
jne 0x4d349
cmpq $0x8, 0x8(%rsp)
jne 0x4d349
movq (%rsp), %rax
movsbl 0x5(%rax), %ecx
addl $-0x30, %ecx
movsbl 0x7(%rax), %eax
addl $-0x30, %eax
movl %ecx, 0x3c(%rbx)
movl %eax, 0x40(%rbx)
subq %r12, %r13
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x277f0
movq %rsp, %rdi
leaq 0x28(%rsp), %rsi
callq 0x26b80
leaq 0x38(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x4d2e2
callq 0x27560
cmpq $0x3, 0x8(%rsp)
jne 0x4d349
movq (%rsp), %rdi
callq 0x28640
movl %eax, 0x44(%rbx)
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq 0x20(%rsp), %rdx
movq $-0x1, %rcx
callq 0x277f0
addq $0x48, %rbx
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x26b80
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x4d32f
callq 0x27560
movb $0x1, %r15b
jmp 0x4d34c
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
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4d337
callq 0x27560
jmp 0x4d337
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
jne 0x4d383
jmp 0x4d38f
jmp 0x4d38c
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4d38f
callq 0x27560
jmp 0x4d38f
jmp 0x4d38c
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4d3a2
callq 0x27560
movq %rbx, %rdi
callq 0x28c10