// File: /workspace/github_cpp_makefile_star2_O3/Rjerk[P]ratabase/Parser.cpp
// Function: ratabase::Parser::parse(cmd_v&)
bool Parser::parse(cmd_v& cmd)
{
    string buf = string(buffer_);
    istringstream cmdstr(buf);
    cmd.cmd_name.clear();
    cmdstr >> cmd.cmd_name; // read command name
    cmd.obj_name.clear();
    cmdstr >> cmd.obj_name; // read object name
    string param;
    cmd.params.clear();
    while (cmdstr >> param) {
        cmd.params.push_back(param);
    }

    if (cmd_map.find(cmd.cmd_name) == cmd_map.end()) {
        string reply = "Unknown command \"" + cmd.cmd_name + "\"\n";
        writeReplyBuf(reply);
        LOG_ERROR << reply;
        return false;
    }
    cmd.type = cmd_map[cmd.cmd_name];
    switch (cmd.type) {
        case cmd_type::DISPLAY: // check 0 argument after command
            return check0(cmd);
        case cmd_type::CREATE:
        case cmd_type::SELECT:
        case cmd_type::DELETE:
        case cmd_type::SLEN:
        case cmd_type::SCLR:
        case cmd_type::LPOP:
        case cmd_type::LSIZE:
        case cmd_type::DSIZE:
            return check1(cmd); // check 1 argument after command

        case cmd_type::SSET:
        case cmd_type::SAPP:
        case cmd_type::LSET:
        case cmd_type::LPUSH:
        case cmd_type::LIDX:
        case cmd_type::LGET:
        case cmd_type::LDEL:
        case cmd_type::DGET:
        case cmd_type::DDEL:
			return check2(cmd); // check 2 arguments after command

        case cmd_type::DSET:
        case cmd_type::DADD:
			return checkMore(cmd); // check more arguments
        default:
            LOG_FATAL << "No way you come here ?!";
            return false; // never come.
    };
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x368, %rsp            # imm = 0x368
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rdi), %r15
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r15, %rdi
callq 0x3160
leaq (%rbx,%rax), %rdx
addq $0x8, %rdx
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x7106
leaq 0x1e8(%rsp), %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x3490
leaq 0x8(%r14), %r15
movq $0x0, 0x10(%r14)
movq 0x8(%r14), %rax
movb $0x0, (%rax)
leaq 0x1e8(%rsp), %rdi
movq %r15, %rsi
callq 0x3370
leaq 0x28(%r14), %rsi
movq $0x0, 0x30(%r14)
movq 0x28(%r14), %rax
movb $0x0, (%rax)
leaq 0x1e8(%rsp), %rdi
callq 0x3370
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x48(%r14), %r12
movq %r12, %rdi
callq 0x7002
leaq 0x1e8(%rsp), %r13
leaq 0x20(%rsp), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3370
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x671b
movq %r12, %rdi
movq %rbp, %rsi
callq 0x7048
jmp 0x66f5
leaq 0xbc3e(%rip), %rdi      # 0x12360
movq %r15, %rsi
callq 0x739c
testq %rax, %rax
je 0x676d
leaq 0xbc2a(%rip), %rdi      # 0x12360
movq %r15, %rsi
callq 0x73d6
movl (%rax), %eax
movl %eax, (%r14)
cmpq $0x14, %rax
ja 0x690d
leaq 0x6b58(%rip), %rcx      # 0xd2ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6d24
jmp 0x68ae
leaq 0x6b8d(%rip), %rsi      # 0xd301
leaq 0x60(%rsp), %rdi
movq %r15, %rdx
callq 0x7085
leaq 0x6b8b(%rip), %rsi      # 0xd313
leaq 0x60(%rsp), %rdi
callq 0x3500
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x67c8
movq %rsi, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x67d2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6b98
jmp 0x68ae
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq %r14, %rsi
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6801
callq 0x32d0
movq (%rsp), %rsi
leaq 0x6c(%rbx), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0xbc(%rbx)
movups %xmm0, 0xac(%rbx)
movups %xmm0, 0x9c(%rbx)
movups %xmm0, 0x8c(%rbx)
movups %xmm0, 0x7c(%rbx)
movups %xmm0, 0x6c(%rbx)
movl $0x0, 0xcc(%rbx)
callq 0x32c0
leaq 0x6ad4(%rip), %rsi      # 0xd316
leaq 0x6ad8(%rip), %rcx      # 0xd321
leaq 0x60(%rsp), %rdi
movl $0x3d, %edx
movl $0x4, %r8d
callq 0xb8ee
leaq 0x60(%rsp), %rdi
callq 0xbc50
addq $0x10, %rax
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rax, %rdi
callq 0x3340
leaq 0x60(%rsp), %rdi
callq 0xbb02
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x6895
callq 0x32d0
xorl %ebx, %ebx
jmp 0x68b0
movq %r14, %rsi
callq 0x6eb2
jmp 0x68ae
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6a0c
movl %eax, %ebx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x68c4
callq 0x32d0
movq 0xb6fd(%rip), %rsi      # 0x11fc8
leaq 0x1e8(%rsp), %rdi
callq 0x33e0
leaq 0x260(%rsp), %rdi
callq 0x30e0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x68f9
callq 0x32d0
movl %ebx, %eax
addq $0x368, %rsp            # imm = 0x368
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6a02(%rip), %rsi      # 0xd316
leaq 0x6a06(%rip), %rcx      # 0xd321
leaq 0x60(%rsp), %rdi
movl $0x5d, %edx
movl $0x5, %r8d
callq 0xb8ee
leaq 0x60(%rsp), %rdi
callq 0xbc50
addq $0x10, %rax
leaq 0x69e2(%rip), %rsi      # 0xd327
movl $0x17, %edx
movq %rax, %rdi
callq 0x3340
leaq 0x60(%rsp), %rdi
callq 0xbb02
jmp 0x6895
jmp 0x69b7
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xbb02
jmp 0x69ba
movq %rax, %rbx
jmp 0x6999
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x69a2
jmp 0x69ba
jmp 0x69b7
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xbb02
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x69ba
callq 0x32d0
jmp 0x69ba
jmp 0x69b7
movq %rax, %rbx
jmp 0x69ef
jmp 0x69b7
movq %rax, %rbx
jmp 0x69ce
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x69ce
callq 0x32d0
movq 0xb5f3(%rip), %rsi      # 0x11fc8
leaq 0x1e8(%rsp), %rdi
callq 0x33e0
leaq 0x260(%rsp), %rdi
callq 0x30e0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6a03
callq 0x32d0
movq %rbx, %rdi
callq 0x34d0
nop