// File: /workspace/github_cpp_makefile_star2_O3/cybozu[P]yrmcds/src/memcache/memcache.cpp
// Function: yrmcds::memcache::text_request::parse()
void text_request::parse() noexcept {
    const char* eol = cfind(m_p, LF, m_len);
    if( eol == nullptr ) return; // incomplete

    m_request_len = eol - m_p + 1;
    if( m_request_len == 1 ) return;  // invalid
    if( *(--eol) != CR ) return;

    const char* cmd_start = m_p;
    while( *cmd_start == SP ) ++cmd_start;
    const char* cmd_end = cfind(cmd_start, SP, (eol - cmd_start));
    if( cmd_end == nullptr ) cmd_end = eol;
    std::size_t cmd_len = (cmd_end - cmd_start);

    if( cmd_len == 10 ) {
        if( std::memcmp(cmd_start, "unlock_all", 10) == 0 ) {
            m_command = text_command::UNLOCK_ALL;
            m_valid = true;
            return;
        }
    }
    if( cmd_len == 9 ) {
        if( std::memcmp(cmd_start, "flush_all", 9) == 0 ) {
            m_command = text_command::FLUSH_ALL;
            parse_flushall(cmd_end, eol);
            return;
        }
        if( std::memcmp(cmd_start, "verbosity", 9) == 0 ) {
            m_command = text_command::VERBOSITY;
            parse_verbosity(cmd_end, eol);
            return;
        }
    }
    if( cmd_len == 7 ) {
        if( std::memcmp(cmd_start, "version", 7) == 0 ) {
            m_command = text_command::VERSION;
            m_valid = true;
            return;
        }
        if( std::memcmp(cmd_start, "prepend", 7) == 0 ) {
            m_command = text_command::PREPEND;
            parse_storage(cmd_end, eol, false);
            return;
        }
        if( std::memcmp(cmd_start, "replace", 7) == 0 ) {
            m_command = text_command::REPLACE;
            parse_storage(cmd_end, eol, false);
            return;
        }
    }
    if( cmd_len == 6 ) {
        if( std::memcmp(cmd_start, "append", 6) == 0 ) {
            m_command = text_command::APPEND;
            parse_storage(cmd_end, eol, false);
            return;
        }
        if( std::memcmp(cmd_start, "delete", 6) == 0 ) {
            m_command = text_command::DELETE;
            parse_delete(cmd_end, eol);
            return;
        }
        if( std::memcmp(cmd_start, "unlock", 6) == 0 ) {
            m_command = text_command::UNLOCK;
            parse_unlock(cmd_end, eol);
            return;
        }
    }
    if( cmd_len == 5 ) {
        if( std::memcmp(cmd_start, "touch", 5) == 0 ) {
            m_command = text_command::TOUCH;
            parse_touch(cmd_end, eol);
            return;
        }
        if( std::memcmp(cmd_start, "slabs", 5) == 0 ) {
            m_command = text_command::SLABS;
            m_valid = true;
            // ignore.
            return;
        }
        if( std::memcmp(cmd_start, "stats", 5) == 0 ) {
            m_command = text_command::STATS;
            parse_stats(cmd_end, eol);
            return;
        }
    }
    if( cmd_len == 4 ) {
        if( std::memcmp(cmd_start, "gets", 4) == 0 ) {
            m_command = text_command::GETS;
            parse_get(cmd_end, eol);
            return;
        }
        if( std::memcmp(cmd_start, "incr", 4) == 0 ) {
            m_command = text_command::INCR;
            parse_incdec(cmd_end, eol);
            return;
        }
        if( std::memcmp(cmd_start, "decr", 4) == 0 ) {
            m_command = text_command::DECR;
            parse_incdec(cmd_end, eol);
            return;
        }
        if( std::memcmp(cmd_start, "lock", 4) == 0 ) {
            m_command = text_command::LOCK;
            parse_lock(cmd_end, eol);
            return;
        }
        if( std::memcmp(cmd_start, "quit", 4) == 0 ) {
            m_command = text_command::QUIT;
            m_valid = true;
            return;
        }
        if( std::memcmp(cmd_start, "keys", 4) == 0 ) {
            m_command = text_command::KEYS;
            parse_keys(cmd_end, eol);
            return;
        }
    }
    if( cmd_len == 3 ) {
        if( std::memcmp(cmd_start, "set", 3) == 0 ) {
            m_command = text_command::SET;
            parse_storage(cmd_end, eol, false);
            return;
        }
        if( std::memcmp(cmd_start, "add", 3) == 0 ) {
            m_command = text_command::ADD;
            parse_storage(cmd_end, eol, false);
            return;
        }
        if( std::memcmp(cmd_start, "get", 3) == 0 ) {
            m_command = text_command::GET;
            parse_get(cmd_end, eol);
            return;
        }
        if( std::memcmp(cmd_start, "cas", 3) == 0 ) {
            m_command = text_command::CAS;
            parse_storage(cmd_end, eol, true);
            return;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r12
movq 0x8(%rdi), %rdx
movq %r12, %rdi
movl $0xa, %esi
callq 0x7540
testq %rax, %rax
je 0x23e8b
movq %rax, %rcx
subq %r12, %rcx
leaq 0x1(%rcx), %rcx
movq %rcx, 0x10(%rbx)
je 0x23e8b
cmpb $0xd, -0x1(%rax)
jne 0x23e8b
leaq -0x1(%rax), %r14
movq %r12, %r15
decq %r15
incq %r12
cmpb $0x20, 0x1(%r15)
leaq 0x1(%r15), %r15
je 0x23b08
subq %r12, %rax
movq %r15, %rdi
movl $0x20, %esi
movq %rax, %rdx
callq 0x7540
testq %rax, %rax
cmoveq %r14, %rax
movq %rax, %rcx
subq %r12, %rcx
addq $-0x2, %rcx
cmpq $0x7, %rcx
ja 0x23e8b
leaq 0x13115(%rip), %rdx     # 0x36c60
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movzwl (%r15), %ecx
xorl $0x6573, %ecx           # imm = 0x6573
movzbl 0x2(%r15), %edx
xorl $0x74, %edx
orw %cx, %dx
je 0x23e30
movzwl (%r15), %ecx
xorl $0x6461, %ecx           # imm = 0x6461
movzbl 0x2(%r15), %edx
xorl $0x64, %edx
orw %cx, %dx
je 0x23e77
movzwl (%r15), %ecx
xorl $0x6567, %ecx           # imm = 0x6567
movzbl 0x2(%r15), %edx
xorl $0x74, %edx
orw %cx, %dx
je 0x23ef9
movzwl (%r15), %ecx
xorl $0x6163, %ecx           # imm = 0x6163
movzbl 0x2(%r15), %edx
xorl $0x73, %edx
orw %cx, %dx
jne 0x23e8b
movl $0x6, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
movl $0x1, %ecx
jmp 0x23ec9
movabsq $0x6c615f6873756c66, %rcx # imm = 0x6C615F6873756C66
xorq (%r15), %rcx
movzbl 0x8(%r15), %edx
xorq $0x6c, %rdx
orq %rcx, %rdx
je 0x23e04
movabsq $0x7469736f62726576, %rcx # imm = 0x7469736F62726576
xorq (%r15), %rcx
movzbl 0x8(%r15), %edx
xorq $0x79, %rdx
orq %rcx, %rdx
jne 0x23e8b
movl $0x14, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x31c26
cmpl $0x73746567, (%r15)     # imm = 0x73746567
je 0x23e24
cmpl $0x72636e69, (%r15)     # imm = 0x72636E69
je 0x23e6e
cmpl $0x72636564, (%r15)     # imm = 0x72636564
je 0x23ed9
cmpl $0x6b636f6c, (%r15)     # imm = 0x6B636F6C
je 0x23f19
cmpl $0x74697571, (%r15)     # imm = 0x74697571
je 0x23f39
cmpl $0x7379656b, (%r15)     # imm = 0x7379656B
jne 0x23e8b
movl $0x16, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32714
movabsq $0x615f6b636f6c6e75, %rax # imm = 0x615F6B636F6C6E75
xorq (%r15), %rax
movzwl 0x8(%r15), %ecx
xorq $0x6c6c, %rcx           # imm = 0x6C6C
orq %rax, %rcx
jne 0x23e8b
movl $0xf, 0x18(%rbx)
jmp 0x23e87
movl $0x63756f74, %ecx       # imm = 0x63756F74
xorl (%r15), %ecx
movzbl 0x4(%r15), %edx
xorl $0x68, %edx
orl %ecx, %edx
je 0x23e3c
movl $0x62616c73, %ecx       # imm = 0x62616C73
xorl (%r15), %ecx
movzbl 0x4(%r15), %edx
xorl $0x73, %edx
orl %ecx, %edx
je 0x23e80
movl $0x74617473, %ecx       # imm = 0x74617473
xorl (%r15), %ecx
movzbl 0x4(%r15), %edx
xorl $0x73, %edx
orl %ecx, %edx
jne 0x23e8b
movl $0x11, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x323da
movl $0x65707061, %ecx       # imm = 0x65707061
xorl (%r15), %ecx
movzwl 0x4(%r15), %edx
xorl $0x646e, %edx           # imm = 0x646E
orl %ecx, %edx
je 0x23e5c
movl $0x656c6564, %ecx       # imm = 0x656C6564
xorl (%r15), %ecx
movzwl 0x4(%r15), %edx
xorl $0x6574, %edx           # imm = 0x6574
orl %ecx, %edx
je 0x23e97
movl $0x6f6c6e75, %ecx       # imm = 0x6F6C6E75
xorl (%r15), %ecx
movzwl 0x4(%r15), %edx
xorl $0x6b63, %edx           # imm = 0x6B63
orl %ecx, %edx
jne 0x23e8b
movl $0xe, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x321ca
movl $0x73726576, %ecx       # imm = 0x73726576
xorl (%r15), %ecx
movl $0x6e6f6973, %edx       # imm = 0x6E6F6973
xorl 0x3(%r15), %edx
orl %ecx, %edx
je 0x23e65
movl $0x70657270, %ecx       # imm = 0x70657270
xorl (%r15), %ecx
movl $0x646e6570, %edx       # imm = 0x646E6570
xorl 0x3(%r15), %edx
orl %ecx, %edx
je 0x23eb7
movl $0x6c706572, %ecx       # imm = 0x6C706572
xorl (%r15), %ecx
movl $0x6563616c, %edx       # imm = 0x6563616C
xorl 0x3(%r15), %edx
orl %ecx, %edx
jne 0x23e8b
movl $0x3, 0x18(%rbx)
jmp 0x23ebe
movl $0x12, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x31aac
movl $0x8, 0x18(%rbx)
jmp 0x23f00
movl $0x1, 0x18(%rbx)
jmp 0x23ebe
movl $0xc, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32240
movl $0x4, 0x18(%rbx)
jmp 0x23ebe
movl $0x13, 0x18(%rbx)
jmp 0x23e87
movl $0xa, 0x18(%rbx)
jmp 0x23ee0
movl $0x2, 0x18(%rbx)
jmp 0x23ebe
movl $0x10, 0x18(%rbx)
movb $0x1, 0x1c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0x9, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x320ea
movl $0x5, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x31d88
movl $0xb, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32514
movl $0x7, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x324b2
movl $0xd, 0x18(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3269e
movl $0x15, 0x18(%rbx)
jmp 0x23e87
nop