// File: /workspace/github_cpp_makefile_star2_O1/Sherhang[P]redis-for-cpp/credis.cpp
// Function: Redis::hscan(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&)
int32_t Redis::hscan(const std::string& key, int32_t cursor, const std::string& pattern, int32_t count, std::map<std::string, std::string>& key_value)
{
    
     if(_context==NULL)
    {
        //DEBUG<<"NULL"<<std::endl;
        return -1;
    }
    
    if (count <= 0)
    {
        // DEBUG
        return 0;
    }
    std::string cmd = "HSCAN " + key + " " + num2str<int32_t>(cursor)
                    + (pattern.empty() ? "" : (" MATCH " + pattern))
                    + (count < 0 ? "" : " COUNT " + num2str<int32_t>(count));
    
    redisReply* _reply = (redisReply*)::redisCommand(_context, cmd.c_str());
    if(isError(_reply))
    {
        //DEBUG<<"isError"<<std::endl;
        freeReply(_reply);
        return -2;
    }
    //DEBUG<<"_reply->type "<<_reply->type<<std::endl;
    if(_reply->type != REDIS_REPLY_ARRAY)
    {
        //DEBUG<<"not array"<<std::endl;
        freeReply(_reply);
        return -3;
    }
    redisReply* sub_reply = (_reply->element[1]);
    uint32_t len = sub_reply->elements;
    key_value.clear();
    if(len & 0x01)
    {
        //DEBUG<<"return not match"<<std::endl;
        return -4;
    }
    for(uint32_t i=0;i<len;i=i+2)
    {
        std::string key(sub_reply->element[i]->str, sub_reply->element[i]->len);
        std::string val(sub_reply->element[i+1]->str, sub_reply->element[i+1]->len);
        key_value[key] = val;
    }
    int32_t ret = -1;
    std::string strTemp(_reply->element[0]->str, _reply->element[0]->len);
    ret = str2num<int32_t>(strTemp);
    freeReply(_reply);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %r9, 0x78(%rsp)
movl %edx, 0x54(%rsp)
movl %r8d, 0x2c(%rsp)
cmpq $0x0, 0x8(%rdi)
je 0x9bf4
testl %r8d, %r8d
jle 0x9bfe
movq %rcx, %r15
movq %rsi, %rax
movq %rdi, %r13
leaq 0xa653(%rip), %rsi      # 0x141f4
leaq 0x128(%rsp), %r12
movq %r12, %rdi
movq %rax, %rdx
callq 0xa756
leaq 0xb037(%rip), %rsi      # 0x14bf2
movq %r12, %rdi
callq 0x3600
leaq 0xd0(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x9c05
movq %rdx, 0xc0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xd0(%rsp)
jmp 0x9c0d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xa183
xorl %ebp, %ebp
jmp 0xa183
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0xc8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xe8(%rsp), %rdi
leaq 0x54(%rsp), %rdx
movq %r13, %rsi
callq 0x41b0
movq 0xc0(%rsp), %rcx
movq 0xc8(%rsp), %r8
movq 0xf0(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r12, %rcx
je 0x9c6b
movq 0xd0(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x9c90
leaq 0xf8(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x9c8b
movq 0xf8(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x9ca7
movq 0xe8(%rsp), %rsi
leaq 0xc0(%rsp), %rdi
callq 0x3110
jmp 0x9cb8
leaq 0xe8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x33e0
leaq 0x40(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x9cdc
movq %rsi, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0x9ce2
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x38(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
cmpq $0x0, 0x8(%r15)
je 0x9d1f
leaq 0xa408(%rip), %rsi      # 0x14115
leaq 0xa0(%rsp), %rdi
movq %r15, %rdx
callq 0xa756
jmp 0x9d42
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xa570(%rip), %rdx      # 0x142a2
leaq 0xa0(%rsp), %rdi
movq %rdx, %rsi
callq 0x42a6
leaq 0x40(%rsp), %rdi
movq -0x10(%rdi), %rcx
movq -0x8(%rdi), %r8
movq 0xa8(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %rdi, %rcx
je 0x9d6a
movq 0x40(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x9d8f
leaq 0xb0(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x9d8a
movq 0xb0(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x9da3
movq 0xa0(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x3110
jmp 0x9db4
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x33e0
leaq 0x18(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x9dd8
movq %rsi, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x9dde
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movl 0x2c(%rsp), %ebp
testl %ebp, %ebp
setns %r15b
js 0x9e61
leaq 0x108(%rsp), %rdi
leaq 0x2c(%rsp), %rdx
movq %r13, %rsi
callq 0x41b0
leaq 0xa2fa(%rip), %rcx      # 0x1411d
leaq 0x108(%rsp), %rdi
movl $0x7, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x33e0
leaq 0x68(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x9e80
movq %rsi, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0x9e86
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xa431(%rip), %rdx      # 0x142a2
leaq 0x58(%rsp), %rdi
movq %rdx, %rsi
callq 0x42a6
jmp 0x9e9e
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x60(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x18(%rsp), %rdi
movq -0x10(%rdi), %rcx
movq -0x8(%rdi), %r8
movq 0x60(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %rdi, %rcx
je 0x9ec3
movq 0x18(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x9ee2
leaq 0x68(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x9edd
movq 0x68(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x9ef3
movq 0x58(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x3110
jmp 0x9f01
leaq 0x58(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x33e0
leaq 0x90(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x9f2e
movq %rsi, 0x80(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x90(%rsp)
jmp 0x9f34
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x88(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9f67
callq 0x3350
testl %ebp, %ebp
js 0x9f81
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9f81
callq 0x3350
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9f95
callq 0x3350
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9fab
callq 0x3350
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x9fbf
callq 0x3350
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9fd5
callq 0x3350
movq 0xc0(%rsp), %rdi
cmpq %r12, %rdi
je 0x9fe7
callq 0x3350
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9ffd
callq 0x3350
movq 0x8(%r13), %rdi
movq 0x80(%rsp), %rsi
xorl %eax, %eax
callq 0xe300
movq %rax, %r15
testq %rax, %rax
je 0xa159
cmpl $0x2, (%r15)
jne 0xa160
movq 0x28(%r15), %rax
movq 0x8(%rax), %rbx
movq 0x20(%rbx), %r14
movq 0x78(%rsp), %rdi
callq 0xafa6
movl $0xfffffffc, %ebp       # imm = 0xFFFFFFFC
testb $0x1, %r14b
jne 0xa16d
movq %r13, 0xe0(%rsp)
testl %r14d, %r14d
je 0xa103
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
leaq 0x30(%rsp), %r13
movq 0x28(%rbx), %rax
movl %ebp, %ecx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
callq 0x42a6
movq 0x28(%rbx), %rax
leal 0x1(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %r13, %rdi
callq 0x42a6
movq 0x78(%rsp), %rdi
movq %r12, %rsi
callq 0xac78
movq %rax, %rdi
movq %r13, %rsi
callq 0x3200
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xa0e3
callq 0x3350
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xa0f7
callq 0x3350
addl $0x2, %ebp
cmpl %r14d, %ebp
jb 0xa068
movq 0x28(%r15), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
callq 0x42a6
leaq 0x8(%rsp), %rsi
movq 0xe0(%rsp), %rdi
callq 0xa9ee
movl %eax, %ebp
movq %r15, %rdi
callq 0xbc50
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xa16d
callq 0x3350
jmp 0xa16d
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
jmp 0xa16d
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
movq %r15, %rdi
callq 0xbc50
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa183
callq 0x3350
movl %ebp, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa273
jmp 0xa278
movq %rax, %rbx
jmp 0xa1ea
movq %rax, %rbx
movb $0x1, %r15b
jmp 0xa1cc
movq %rax, %rbx
movb $0x1, %r15b
jmp 0xa1e7
movq %rax, %rbx
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa1cc
callq 0x3350
testb %r15b, %r15b
je 0xa1e7
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa1e7
callq 0x3350
testb %r15b, %r15b
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa202
callq 0x3350
jmp 0xa202
movq %rax, %rbx
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa21d
callq 0x3350
jmp 0xa21d
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa235
callq 0x3350
jmp 0xa235
movq %rax, %rbx
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa250
callq 0x3350
jmp 0xa250
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r12, %rdi
je 0xa267
callq 0x3350
jmp 0xa267
movq %rax, %rbx
leaq 0x138(%rsp), %rax
jmp 0xa2b0
jmp 0xa273
movq %rax, %rbx
jmp 0xa2a8
movq %rax, %rbx
jmp 0xa294
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xa294
callq 0x3350
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xa2a8
callq 0x3350
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa2be
callq 0x3350
movq %rbx, %rdi
callq 0x35b0