// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/db.c
// Function: renameGenericCommand
void renameGenericCommand(client *c, int nx) {
    robj *o;
    long long expire;
    int samekey = 0;

    /* When source and dest key is the same, no operation is performed,
     * if the key exists, however we still return an error on unexisting key. */
    if (sdscmp(c->argv[1]->ptr,c->argv[2]->ptr) == 0) samekey = 1;

    if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.nokeyerr)) == NULL)
        return;

    if (samekey) {
        addReply(c,nx ? shared.czero : shared.ok);
        return;
    }

    incrRefCount(o);
    expire = getExpire(c->db,c->argv[1]);
    if (lookupKeyWrite(c->db,c->argv[2]) != NULL) {
        if (nx) {
            decrRefCount(o);
            addReply(c,shared.czero);
            return;
        }
        /* Overwrite: delete the old key before creating the new one
         * with the same name. */
        dbDelete(c->db,c->argv[2]);
    }
    dbAdd(c->db,c->argv[2],o);
    if (expire != -1) setExpire(c->db,c->argv[2],expire);
    dbDelete(c->db,c->argv[1]);
    signalModifiedKey(c->db,c->argv[1]);
    signalModifiedKey(c->db,c->argv[2]);
    notifyKeyspaceEvent(NOTIFY_GENERIC,"rename_from",
        c->argv[1],c->db->id);
    notifyKeyspaceEvent(NOTIFY_GENERIC,"rename_to",
        c->argv[2],c->db->id);
    server.dirty++;
    addReply(c,nx ? shared.cone : shared.ok);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
callq 0x31fb8
movl %eax, %r15d
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
leaq 0xbe39c(%rip), %r12     # 0xfa310
movq 0x78(%r12), %rdx
movq %rbx, %rdi
callq 0x3af15
testq %rax, %rax
je 0x3bfd6
testl %r15d, %r15d
je 0x3bfdf
movq %rax, %r14
movq %rax, %rdi
callq 0x39e74
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x3c0d3
movq %rax, %r15
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0x3aec2
testq %rax, %rax
je 0x3c005
testl %ebp, %ebp
je 0x3bff4
movq %r14, %rdi
callq 0x3a265
movq 0x20(%r12), %rsi
jmp 0x3c0c3
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
testl %ebp, %ebp
pushq $0x8
popq %rax
pushq $0x20
popq %rcx
cmoveq %rax, %rcx
movq (%r12,%rcx), %rsi
jmp 0x3c0c3
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0x3b1df
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
movq %r14, %rdx
callq 0x3af45
cmpq $-0x1, %r15
je 0x3c033
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
movq %r15, %rdx
callq 0x3c14f
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x3b1df
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x572df
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0x572df
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x767f6(%rip), %rsi     # 0xb2872
pushq $0x4
popq %r14
movl %r14d, %edi
callq 0x6fb58
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq 0x10(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x767e0(%rip), %rsi     # 0xb287e
movl %r14d, %edi
callq 0x6fb58
leaq 0xbd7fb(%rip), %rax     # 0xf98a8
incq 0x720(%rax)
xorl %eax, %eax
testl %ebp, %ebp
setne %al
shll $0x5, %eax
movq 0x8(%r12,%rax), %rsi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x36987