// File: 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
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x20(%rbp), %rdi
callq 0xb890
movq -0xe8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x54e2
movb $0x0, -0x1(%rbp)
jmp 0x58a9
movq -0xe8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3190
movq -0xf0(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x11a60
movq -0xe8(%rbp), %rdi
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
callq 0x59f0
testb $0x1, %al
jne 0x5528
jmp 0x5541
movq -0xe8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x59c0
movb $0x0, -0x1(%rbp)
jmp 0x58a9
movq -0x28(%rbp), %rax
movl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0xf8(%rbp)
subl $0x5, %eax
ja 0x5895
movq -0xf8(%rbp), %rax
leaq 0x12b0b(%rip), %rcx     # 0x18074
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0xe8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x59c0
movb $0x0, -0x1(%rbp)
jmp 0x58a9
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0xb8b0
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x566f
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0x108(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x110(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x3670
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
movq -0x100(%rbp), %rcx
leaq -0x50(%rbp), %rdi
callq 0x3450
jmp 0x560c
leaq -0x51(%rbp), %rdi
callq 0x3410
movq -0x20(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xb9b0
jmp 0x5624
leaq -0x50(%rbp), %rdi
callq 0x3290
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x55aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x51(%rbp), %rdi
callq 0x3410
jmp 0x58b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x3290
jmp 0x58b7
movq -0xe8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x59c0
movb $0x1, -0x1(%rbp)
jmp 0x58a9
movq -0xe8(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
movq %rdi, -0x118(%rbp)
leaq -0x90(%rbp), %rdx
callq 0xb740
movq -0x118(%rbp), %rsi
movq -0x20(%rbp), %rdi
callq 0xb9b0
jmp 0x56ca
movq -0xe8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x59c0
jmp 0x56dc
movb $0x1, -0x1(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3290
jmp 0x58a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3290
jmp 0x58b7
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x128(%rbp)
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x3670
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
callq 0x3510
jmp 0x574c
leaq -0xb1(%rbp), %rdi
callq 0x3410
movq -0x20(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0xb9b0
jmp 0x576a
movq -0xe8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x59c0
jmp 0x577c
movb $0x1, -0x1(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3290
jmp 0x58a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xb1(%rbp), %rdi
callq 0x3410
jmp 0x58b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3290
jmp 0x58b7
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x138(%rbp)
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x3670
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
leaq -0xd8(%rbp), %rdi
callq 0x3510
jmp 0x5809
leaq -0xd9(%rbp), %rdi
callq 0x3410
movq -0x20(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0xb9b0
jmp 0x5827
movq -0xe8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x59c0
jmp 0x5839
movb $0x1, -0x1(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x3290
jmp 0x58a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xd9(%rbp), %rdi
callq 0x3410
jmp 0x58b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x3290
jmp 0x58b7
movq -0xe8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x59c0
movb $0x1, -0x1(%rbp)
jmp 0x58a9
movq -0xe8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x59c0
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x3660