// File: /workspace/github_cpp_makefile_star2_O1/lszp[P]SmallWebServer/http/http_conn.cpp
// Function: http_conn::parse_request_line(char*)
http_conn::HTTP_CODE http_conn::parse_request_line(char *text)
{
    m_url = strpbrk(text, " \t");
    if (!m_url)
    {
        return BAD_REQUEST;
    }
    *m_url++ = '\0';
    char *method = text;
    if (strcasecmp(method, "GET") == 0)
        m_method = GET;
    else if (strcasecmp(method, "POST") == 0)
    {
        m_method = POST;
        cgi = 1;
    }
    else
        return BAD_REQUEST;
    m_url += strspn(m_url, " \t");
    m_version = strpbrk(m_url, " \t");
    if (!m_version)
        return BAD_REQUEST;
    *m_version++ = '\0';
    m_version += strspn(m_version, " \t");
    if (strcasecmp(m_version, "HTTP/1.1") != 0)
        return BAD_REQUEST;
    if (strncasecmp(m_url, "http://", 7) == 0)
    {
        m_url += 7;
        m_url = strchr(m_url, '/');
    }

    if (strncasecmp(m_url, "https://", 8) == 0)
    {
        m_url += 8;
        m_url = strchr(m_url, '/');
    }

    if (!m_url || m_url[0] != '/')
        return BAD_REQUEST;
    //当url为/时，显示判断界面
    if (strlen(m_url) == 1)
        strcat(m_url, "judge.html");
    m_check_state = CHECK_STATE_HEADER;
    return NO_REQUEST;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x5760(%rip), %rsi      # 0xa270
movq %r14, %rdi
callq 0x36d0
movq %rax, 0xd08(%rbx)
movl $0x2, %ebp
testq %rax, %rax
je 0x4c04
movq %rax, %rcx
incq %rcx
movq %rcx, 0xd08(%rbx)
movb $0x0, (%rax)
leaq 0x572f(%rip), %rsi      # 0xa273
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
je 0x4b7d
leaq 0x5720(%rip), %rsi      # 0xa277
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
jne 0x4c04
movl $0x1, 0xc3c(%rbx)
movl $0x1, %eax
movl $0xde4, %ecx            # imm = 0xDE4
jmp 0x4b84
xorl %eax, %eax
movl $0xc3c, %ecx            # imm = 0xC3C
movl %eax, (%rbx,%rcx)
movq 0xd08(%rbx), %r14
leaq 0x56db(%rip), %r15      # 0xa270
movq %r14, %rdi
movq %r15, %rsi
callq 0x3170
addq %rax, %r14
movq %r14, 0xd08(%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x36d0
movq %rax, 0xd10(%rbx)
testq %rax, %rax
je 0x4c04
movq %rax, %rcx
incq %rcx
movq %rcx, 0xd10(%rbx)
movb $0x0, (%rax)
movq 0xd10(%rbx), %r14
leaq 0x5691(%rip), %rsi      # 0xa270
movq %r14, %rdi
callq 0x3170
addq %rax, %r14
movq %r14, 0xd10(%rbx)
leaq 0x5684(%rip), %rsi      # 0xa27c
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
je 0x4c11
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xd08(%rbx), %r14
leaq 0x5666(%rip), %rsi      # 0xa285
movl $0x7, %edx
movq %r14, %rdi
callq 0x3560
testl %eax, %eax
jne 0x4c4f
addq $0x7, %r14
movq %r14, 0xd08(%rbx)
movq %r14, %rdi
movl $0x2f, %esi
callq 0x3150
movq %rax, 0xd08(%rbx)
movq 0xd08(%rbx), %r14
leaq 0x5630(%rip), %rsi      # 0xa28d
movl $0x8, %edx
movq %r14, %rdi
callq 0x3560
testl %eax, %eax
jne 0x4c8d
addq $0x8, %r14
movq %r14, 0xd08(%rbx)
movq %r14, %rdi
movl $0x2f, %esi
callq 0x3150
movq %rax, 0xd08(%rbx)
movq 0xd08(%rbx), %r14
testq %r14, %r14
je 0x4c04
cmpb $0x2f, (%r14)
jne 0x4c04
movq %r14, %rdi
callq 0x3180
cmpq $0x1, %rax
jne 0x4cd4
movq %r14, %rdi
callq 0x3180
movabsq $0x74682e656764756a, %rcx # imm = 0x74682E656764756A
movq %rcx, (%r14,%rax)
movl $0x6c6d74, 0x7(%r14,%rax) # imm = 0x6C6D74
movl $0x1, 0xc38(%rbx)
xorl %ebp, %ebp
jmp 0x4c04
nop