// File: /workspace/github_cpp_makefile_star2_O3/Sherhang[P]redis-for-cpp/credis.cpp
// Function: Redis::exec(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
bool Redis::exec(const std::string& cmd, std::vector<std::string>& values)
{
    values.clear();
    if(_context==NULL) 
    {
        return false;
    }
    redisReply* _reply = (redisReply*)::redisCommand(_context, cmd.c_str());
    if(isError(_reply))
    {
        freeReply(_reply);
        return false;
    }
    //DEBUG<<"_reply->type = "<<_reply->type<<std::endl;
    switch (_reply->type)
    {
        case REDIS_REPLY_ERROR:
        {
            freeReply(_reply);
            return false;
        }
        break;

        case REDIS_REPLY_ARRAY:
        {
            int32_t elements = _reply->elements;
            values.reserve(elements);
            for(int32_t i=0; i<elements; ++i)
            {
                std::string strTemp(_reply->element[i]->str, _reply->element[i]->len);
                values.push_back(strTemp);
            }
            freeReply(_reply);
            return true;
        }
        break;
        
        case REDIS_REPLY_INTEGER:
        {
            std::string num = num2str<int64_t>(_reply->integer);
            values.push_back(num);
            freeReply(_reply);
            return true;
        }
        break;

        case REDIS_REPLY_STRING:
        {
            std::string tmp = _reply->str;
            values.push_back(tmp);
            freeReply(_reply);
            return true;
        }
        break;

        case REDIS_REPLY_STATUS:
        {
            std::string tmp = _reply->str;
            values.push_back(tmp);
            freeReply(_reply);
            return true;
        }
        break;

        case REDIS_REPLY_NIL:
        {
            freeReply(_reply);
            return true;
        }
        break;

        default:
        {
            freeReply(_reply);
            return false;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq %rdx, %rdi
callq 0xa780
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x45ea
movq (%rbx), %rsi
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xe1b0
testq %rax, %rax
je 0x46cf
movq %rax, %rbx
movl (%rax), %eax
decl %eax
cmpl $0x5, %eax
ja 0x45e2
leaq 0xfaec(%rip), %rcx      # 0x1409c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%rbx), %rsi
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x3170
movq %rsp, %rsi
movq %r14, %rdi
callq 0xa8a6
movq %rbx, %rdi
callq 0xbb00
jmp 0x46b9
movq %rbx, %rdi
callq 0xbb00
xorl %ebp, %ebp
jmp 0x46cf
movq 0x8(%rbx), %rax
leaq 0x20(%rsp), %rdx
movq %rax, (%rdx)
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xa6ce
movq %r14, %rdi
movq %r12, %rsi
callq 0xa8a6
movq %rbx, %rdi
callq 0xbb00
jmp 0x46b9
movq 0x20(%rbx), %r12
movslq %r12d, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xa7c6
testl %r15d, %r15d
jle 0x468b
leaq 0x10(%rsp), %r13
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
movq %rsp, %r15
movq 0x28(%rbx), %rax
movq (%rax,%rbp,8), %rax
movq 0x18(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
movq %r13, (%rsp)
movq %r15, %rdi
callq 0x42ba
movq %r14, %rdi
movq %r15, %rsi
callq 0xa8a6
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x4683
callq 0x3350
incq %rbp
cmpq %rbp, %r12
jne 0x464b
movq %rbx, %rdi
callq 0xbb00
jmp 0x46cc
movq 0x18(%rbx), %rsi
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x3170
movq %rsp, %rsi
movq %r14, %rdi
callq 0xa8a6
movq %rbx, %rdi
callq 0xbb00
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x46cc
callq 0x3350
movb $0x1, %bpl
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x46fb
jmp 0x46fb
jmp 0x46e8
jmp 0x46e8
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x470c
jmp 0x4711
movq %rax, %rbx
jmp 0x4711
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x4711
callq 0x3350
movq %rbx, %rdi
callq 0x35b0
nop