// File: /workspace/github_cpp_makefile_star2_O1/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 0xa88a
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x45d2
movq (%rbx), %rsi
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xe300
testq %rax, %rax
je 0x46b7
movq %rax, %rbx
movl (%rax), %eax
decl %eax
cmpl $0x5, %eax
ja 0x45ca
leaq 0xfb04(%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 0xa9b0
movq %rbx, %rdi
callq 0xbc50
jmp 0x46a1
movq %rbx, %rdi
callq 0xbc50
xorl %ebp, %ebp
jmp 0x46b7
movq 0x8(%rbx), %rax
leaq 0x20(%rsp), %rdx
movq %rax, (%rdx)
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xa7d8
movq %r14, %rdi
movq %r12, %rsi
callq 0xa9b0
movq %rbx, %rdi
callq 0xbc50
jmp 0x46a1
movq 0x20(%rbx), %r12
movslq %r12d, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xa8d0
testl %r15d, %r15d
jle 0x4673
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 0x42a6
movq %r14, %rdi
movq %r15, %rsi
callq 0xa9b0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x466b
callq 0x3350
incq %rbp
cmpq %rbp, %r12
jne 0x4633
movq %rbx, %rdi
callq 0xbc50
jmp 0x46b4
movq 0x18(%rbx), %rsi
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x3170
movq %rsp, %rsi
movq %r14, %rdi
callq 0xa9b0
movq %rbx, %rdi
callq 0xbc50
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x46b4
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 0x46e3
jmp 0x46e3
jmp 0x46d0
jmp 0x46d0
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x46f4
jmp 0x46f9
movq %rax, %rbx
jmp 0x46f9
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x46f9
callq 0x3350
movq %rbx, %rdi
callq 0x35b0
nop