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

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

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

    // walk through request line, storing positions
    //    GET /path/to/resource HTTP/1.1
    //    ^  ^^                ^^
    const size_t foundMethod = line.find_first_not_of(Constants::SPACE_CHAR); // skip any leading whitespace
    if ( foundMethod == string::npos ) return false;
    const size_t foundFirstSpace = line.find(Constants::SPACE_CHAR, foundMethod+1);
    if ( foundFirstSpace == string::npos ) return false;
    const size_t foundResource = line.find_first_not_of(Constants::SPACE_CHAR, foundFirstSpace+1);
    if ( foundResource == string::npos ) return false;
    const size_t foundSecondSpace = line.find(Constants::SPACE_CHAR, foundResource+1);
    if ( foundSecondSpace == string::npos ) return false;
    const size_t foundVersion= line.find_first_not_of(Constants::SPACE_CHAR, foundSecondSpace+1);
    if ( foundVersion == string::npos ) return false;

    // parse out method & resource
    m_method   = line.substr(foundMethod,   foundFirstSpace  - foundMethod);
    m_resource = line.substr(foundResource, foundSecondSpace - foundResource);

    // parse out version numbers
    const string temp = line.substr(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);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
je 0x53c2d
movq %rbx, %rdi
movq %r14, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x33650
cmpq $0x0, 0x8(%r14)
je 0x53d85
xorl %r15d, %r15d
pushq $0x20
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x32e10
cmpq $-0x1, %rax
je 0x53d88
movq %rax, %r13
leaq 0x1(%rax), %rdx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x33d30
cmpq $-0x1, %rax
je 0x53d85
movq %rax, %r15
leaq 0x1(%rax), %rdx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x32e10
cmpq $-0x1, %rax
je 0x53d85
movq %rax, %r12
leaq 0x1(%rax), %rdx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x33d30
cmpq $-0x1, %rax
je 0x53d85
movq %rax, %rbp
leaq 0x1(%rax), %rdx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x32e10
cmpq $-0x1, %rax
je 0x53d85
movq %rax, 0x20(%rsp)
subq %r13, %r15
movq %rsp, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x332a0
leaq 0x48(%rbx), %rdi
movq %rsp, %rsi
callq 0x32060
movq %rsp, %rdi
callq 0x33a00
subq %r12, %rbp
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x332a0
leaq 0x68(%rbx), %rdi
movq %r15, %rsi
callq 0x32060
movq %rsp, %rdi
callq 0x33a00
movq %rsp, %r15
pushq $-0x1
popq %rcx
movq %r15, %rdi
movq %r14, %rsi
movq 0x20(%rsp), %rdx
callq 0x332a0
leaq 0x246d1(%rip), %rsi     # 0x78408
movq %r15, %rdi
xorl %edx, %edx
callq 0x35770
movq 0x8(%rsp), %rcx
xorq $0x8, %rcx
orq %rcx, %rax
sete %r15b
jne 0x53d7b
movq %rsp, %rdi
pushq $0x5
popq %rsi
callq 0x33930
movsbl (%rax), %ebp
movq %rsp, %rdi
pushq $0x7
popq %rsi
callq 0x33930
addl $-0x30, %ebp
movsbl (%rax), %eax
addl $-0x30, %eax
movl %ebp, 0x3c(%rbx)
movl %eax, 0x40(%rbx)
movq %rsp, %rdi
callq 0x33a00
jmp 0x53d88
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x53d9e
jmp 0x53d9e
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x53dc3
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x53dc3
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop