// File: /workspace/github_cpp_makefile_star2_O1/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 0x70e4
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 0x6fe0
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 0x6707
movq %r12, %rdi
movq %rbp, %rsi
callq 0x7026
jmp 0x66e1
leaq 0xbc52(%rip), %rdi      # 0x12360
movq %r15, %rsi
callq 0x73b2
testq %rax, %rax
je 0x6759
leaq 0xbc3e(%rip), %rdi      # 0x12360
movq %r15, %rsi
callq 0x73ec
movl (%rax), %eax
movl %eax, (%r14)
cmpq $0x14, %rax
ja 0x68f6
leaq 0x6b6c(%rip), %rcx      # 0xd2ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6d06
jmp 0x6897
leaq 0x6ba1(%rip), %rsi      # 0xd301
leaq 0x60(%rsp), %rdi
movq %r15, %rdx
callq 0x7063
leaq 0x6b9f(%rip), %rsi      # 0xd313
leaq 0x60(%rsp), %rdi
callq 0x3500
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x67b4
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x67bb
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6b7e
jmp 0x6897
movups (%rcx), %xmm0
movups %xmm0, (%r14)
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 0x67e6
callq 0x32d0
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)
movq (%rsp), %rsi
callq 0x32c0
leaq 0x6aeb(%rip), %rsi      # 0xd316
leaq 0x6aef(%rip), %rcx      # 0xd321
leaq 0x60(%rsp), %rdi
movl $0x3d, %edx
movl $0x4, %r8d
callq 0xb910
leaq 0x60(%rsp), %rdi
callq 0xbc72
addq $0x10, %rax
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rax, %rdi
callq 0x3340
leaq 0x60(%rsp), %rdi
callq 0xbb24
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x687e
callq 0x32d0
xorl %ebx, %ebx
jmp 0x6899
movq %r14, %rsi
callq 0x6e90
jmp 0x6897
movq %rbx, %rdi
movq %r14, %rsi
callq 0x69f4
movl %eax, %ebx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x68ad
callq 0x32d0
movq 0xb714(%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 0x68e2
callq 0x32d0
movl %ebx, %eax
addq $0x368, %rsp            # imm = 0x368
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6a19(%rip), %rsi      # 0xd316
leaq 0x6a1d(%rip), %rcx      # 0xd321
leaq 0x60(%rsp), %rdi
movl $0x5d, %edx
movl $0x5, %r8d
callq 0xb910
leaq 0x60(%rsp), %rdi
callq 0xbc72
addq $0x10, %rax
leaq 0x69f9(%rip), %rsi      # 0xd327
movl $0x17, %edx
movq %rax, %rdi
callq 0x3340
leaq 0x60(%rsp), %rdi
callq 0xbb24
jmp 0x687e
jmp 0x69a0
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xbb24
jmp 0x69a3
movq %rax, %rbx
jmp 0x6982
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x698b
jmp 0x69a3
jmp 0x69a0
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xbb24
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x69a3
callq 0x32d0
jmp 0x69a3
jmp 0x69a0
movq %rax, %rbx
jmp 0x69d8
jmp 0x69a0
movq %rax, %rbx
jmp 0x69b7
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x69b7
callq 0x32d0
movq 0xb60a(%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 0x69ec
callq 0x32d0
movq %rbx, %rdi
callq 0x34d0