// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/db.c
// Function: moveCommand
void moveCommand(client *c) {
    robj *o;
    redisDb *src, *dst;
    int srcid;
    long long dbid, expire;

    if (server.cluster_enabled) {
        addReplyError(c,"MOVE is not allowed in cluster mode");
        return;
    }

    /* Obtain source and target DB pointers */
    src = c->db;
    srcid = c->db->id;

    if (getLongLongFromObject(c->argv[2],&dbid) == C_ERR ||
        dbid < INT_MIN || dbid > INT_MAX ||
        selectDb(c,dbid) == C_ERR)
    {
        addReply(c,shared.outofrangeerr);
        return;
    }
    dst = c->db;
    selectDb(c,srcid); /* Back to the source DB */

    /* If the user is moving using as target the same
     * DB as the source DB it is probably an error. */
    if (src == dst) {
        addReply(c,shared.sameobjecterr);
        return;
    }

    /* Check if the element exists and get a reference */
    o = lookupKeyWrite(c->db,c->argv[1]);
    if (!o) {
        addReply(c,shared.czero);
        return;
    }
    expire = getExpire(c->db,c->argv[1]);

    /* Return zero if the key already exists in the target DB */
    if (lookupKeyWrite(dst,c->argv[1]) != NULL) {
        addReply(c,shared.czero);
        return;
    }
    dbAdd(dst,c->argv[1],o);
    if (expire != -1) setExpire(dst,c->argv[1],expire);
    incrRefCount(o);

    /* OK! key moved, free the entry in the source DB */
    dbDelete(src,c->argv[1]);
    server.dirty++;
    addReply(c,shared.cone);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xbd6da(%rip), %rbp     # 0xf98a8
cmpl $0x0, 0x99c(%rbp)
je 0x3c1f4
leaq 0x766aa(%rip), %rsi     # 0xb2888
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x36b6f
movq 0x10(%rbx), %r14
movq 0x40(%rbx), %rax
movl 0x30(%r14), %r12d
movq 0x10(%rax), %rdi
movq %rsp, %r15
movq %r15, %rsi
callq 0x3aa55
cmpl $-0x1, %eax
sete %al
movq (%r15), %r15
movslq %r15d, %rcx
cmpq %r15, %rcx
setne %cl
orb %al, %cl
je 0x3c24a
leaq 0xbe0e4(%rip), %rax     # 0xfa310
movq 0x90(%rax), %rsi
movq %rbx, %rdi
callq 0x36987
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r15, %r15
js 0x3c225
cmpl %r15d, 0x610(%rbp)
jle 0x3c225
movq 0x28(%rbp), %rax
shlq $0x6, %r15
addq %rax, %r15
movq %r15, 0x10(%rbx)
movq %r15, %rdi
testl %r12d, %r12d
js 0x3c289
movq %r15, %rdi
cmpl %r12d, 0x610(%rbp)
jle 0x3c289
shlq $0x6, %r12
addq %r12, %rax
movq %rax, 0x10(%rbx)
movq %rax, %rdi
cmpq %r15, %r14
je 0x3c2dc
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x3aec2
testq %rax, %rax
je 0x3c2cc
movq %rax, %r12
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x3c0d3
movq %rax, %r13
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r15, %rdi
callq 0x3aec2
testq %rax, %rax
je 0x3c2ef
leaq 0xbe03d(%rip), %rax     # 0xfa310
movq 0x20(%rax), %rsi
jmp 0x3c233
leaq 0xbe02d(%rip), %rax     # 0xfa310
movq 0x88(%rax), %rsi
jmp 0x3c233
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x3af45
cmpq $-0x1, %r13
je 0x3c31b
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r15, %rdi
movq %r13, %rdx
callq 0x3c14f
movq %r12, %rdi
callq 0x39e74
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0x3b1df
incq 0x720(%rbp)
leaq 0xbdfcf(%rip), %rax     # 0xfa310
movq 0x28(%rax), %rsi
jmp 0x3c233