// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq (%rdi), %r12
movq 0x8(%rdi), %rdx
movq %r12, %rdi
movl $0xa, %esi
callq 0x7550
testq %rax, %rax
je 0x2490c
movq %rax, %rcx
subq %r12, %rcx
leaq 0x1(%rcx), %rcx
movq %rcx, 0x10(%r14)
je 0x2490c
cmpb $0xd, -0x1(%rax)
jne 0x2490c
leaq -0x1(%rax), %rbx
movq %r12, %r15
decq %r15
incq %r12
cmpb $0x20, 0x1(%r15)
leaq 0x1(%r15), %r15
je 0x24440
subq %r12, %rax
movq %r15, %rdi
movl $0x20, %esi
movq %rax, %rdx
callq 0x7550
testq %rax, %rax
cmoveq %rbx, %rax
movq %rax, %rcx
subq %r12, %rcx
leaq -0x2(%rcx), %rdx
cmpq $0x7, %rdx
ja 0x2490c
incq %rcx
leaq 0x127ea(%rip), %rsi     # 0x36c70
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movzwl (%r15), %ecx
xorl $0x6573, %ecx           # imm = 0x6573
movzbl 0x2(%r15), %edx
xorl $0x74, %edx
orw %cx, %dx
je 0x2473e
movzwl (%r15), %ecx
xorl $0x6461, %ecx           # imm = 0x6461
movzbl 0x2(%r15), %edx
xorl $0x64, %edx
orw %cx, %dx
je 0x247c1
movzwl (%r15), %ecx
xorl $0x6567, %ecx           # imm = 0x6567
movzbl 0x2(%r15), %edx
xorl $0x74, %edx
orw %cx, %dx
je 0x24837
movzwl (%r15), %ecx
xorl $0x6163, %ecx           # imm = 0x6163
movzbl 0x2(%r15), %edx
xorl $0x73, %edx
orw %cx, %dx
jne 0x2490c
movl $0x6, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
movl $0x1, %ecx
jmp 0x248ce
movabsq $0x615f6b636f6c6e75, %rdx # imm = 0x615F6B636F6C6E75
xorq (%r15), %rdx
movzwl 0x8(%r15), %esi
xorq $0x6c6c, %rsi           # imm = 0x6C6C
orq %rdx, %rsi
je 0x247b4
leaq -0x3(%rcx), %rdx
cmpq $0x6, %rdx
ja 0x2490c
leaq 0x12743(%rip), %rsi     # 0x36c90
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movabsq $0x6c615f6873756c66, %rdx # imm = 0x6C615F6873756C66
xorq (%r15), %rdx
movzbl 0x8(%r15), %esi
xorq $0x6c, %rsi
orq %rdx, %rsi
je 0x24793
movabsq $0x7469736f62726576, %rdx # imm = 0x7469736F62726576
xorq (%r15), %rdx
movzbl 0x8(%r15), %esi
xorq $0x79, %rsi
orq %rdx, %rsi
je 0x24816
leaq -0x3(%rcx), %rdx
cmpq $0x4, %rdx
ja 0x2490c
leaq 0x12703(%rip), %rsi     # 0x36cac
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movl $0x73726576, %edx       # imm = 0x73726576
xorl (%r15), %edx
movl $0x6e6f6973, %esi       # imm = 0x6E6F6973
xorl 0x3(%r15), %esi
orl %edx, %esi
je 0x24786
movl $0x70657270, %edx       # imm = 0x70657270
xorl (%r15), %edx
movl $0x646e6570, %esi       # imm = 0x646E6570
xorl 0x3(%r15), %esi
orl %edx, %esi
je 0x24809
movl $0x6c706572, %edx       # imm = 0x6C706572
xorl (%r15), %edx
movl $0x6563616c, %esi       # imm = 0x6563616C
xorl 0x3(%r15), %esi
orl %edx, %esi
je 0x248bb
leaq -0x3(%rcx), %rdx
cmpq $0x3, %rdx
ja 0x2490c
leaq 0x126ae(%rip), %rsi     # 0x36cc0
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movl $0x65707061, %edx       # imm = 0x65707061
xorl (%r15), %edx
movzwl 0x4(%r15), %esi
xorl $0x646e, %esi           # imm = 0x646E
orl %edx, %esi
je 0x24779
movl $0x656c6564, %edx       # imm = 0x656C6564
xorl (%r15), %edx
movzwl 0x4(%r15), %esi
xorl $0x6574, %esi           # imm = 0x6574
orl %edx, %esi
je 0x247e8
movl $0x6f6c6e75, %edx       # imm = 0x6F6C6E75
xorl (%r15), %edx
movzwl 0x4(%r15), %esi
xorl $0x6b63, %esi           # imm = 0x6B63
orl %edx, %esi
je 0x2489a
cmpq $0x3, %rcx
je 0x2448f
cmpq $0x4, %rcx
je 0x246e2
cmpq $0x5, %rcx
jne 0x2490c
movl $0x63756f74, %edx       # imm = 0x63756F74
xorl (%r15), %edx
movzbl 0x4(%r15), %esi
xorl $0x68, %esi
orl %edx, %esi
je 0x24758
movl $0x62616c73, %edx       # imm = 0x62616C73
xorl (%r15), %edx
movzbl 0x4(%r15), %esi
xorl $0x73, %esi
orl %edx, %esi
je 0x247db
movl $0x74617473, %edx       # imm = 0x74617473
xorl (%r15), %edx
movzbl 0x4(%r15), %esi
xorl $0x73, %esi
orl %edx, %esi
je 0x24879
cmpq $0x3, %rcx
je 0x2448f
cmpq $0x4, %rcx
jne 0x2490c
cmpl $0x73746567, (%r15)     # imm = 0x73746567
je 0x2474b
cmpl $0x72636e69, (%r15)     # imm = 0x72636E69
je 0x247ce
cmpl $0x72636564, (%r15)     # imm = 0x72636564
je 0x24858
cmpl $0x6b636f6c, (%r15)     # imm = 0x6B636F6C
je 0x248de
cmpl $0x74697571, (%r15)     # imm = 0x74697571
je 0x248ff
cmpl $0x7379656b, (%r15)     # imm = 0x7379656B
je 0x24918
leaq -0x2(%rax), %rcx
cmpq %r12, %rcx
je 0x2448f
jmp 0x2490c
movl $0x1, 0x18(%r14)
jmp 0x248c3
movl $0x8, 0x18(%r14)
jmp 0x2483f
movl $0xc, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32be0
movl $0x4, 0x18(%r14)
jmp 0x248c3
movl $0x13, 0x18(%r14)
jmp 0x24907
movl $0x12, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x323c8
movl $0xf, 0x18(%r14)
jmp 0x24907
movl $0x2, 0x18(%r14)
jmp 0x248c3
movl $0xa, 0x18(%r14)
jmp 0x24860
movl $0x10, 0x18(%r14)
jmp 0x24907
movl $0x9, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32a8a
movl $0x5, 0x18(%r14)
jmp 0x248c3
movl $0x14, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32554
movl $0x7, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32e8e
movl $0xb, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32ef0
movl $0x11, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32d94
movl $0xe, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x32b6a
movl $0x3, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x326d6
movl $0xd, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3307a
movl $0x15, 0x18(%r14)
movb $0x1, 0x1c(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0x16, 0x18(%r14)
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x330f0
nop