// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 %r13
pushq %r12
pushq %rbx
pushq %rax
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 0x3a932
movl %eax, %r15d
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
leaq 0xc0fb2(%rip), %r12     # 0x1072b0
movq 0x78(%r12), %rdx
movq %rbx, %rdi
callq 0x44fbb
testq %rax, %rax
je 0x46376
testl %r15d, %r15d
je 0x46385
movq %rax, %r14
movq %rax, %rdi
callq 0x43c0c
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x46484
movq %rax, (%rsp)
movq %r12, %r15
movq 0x10(%rbx), %r12
movq 0x40(%rbx), %rax
movq 0x10(%rax), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x44eae
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x44dec
testq %rax, %rax
je 0x463af
testl %ebp, %ebp
je 0x4639e
movq %r14, %rdi
callq 0x440f3
movq 0x20(%r15), %rsi
jmp 0x4646e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %ebp, %ebp
movl $0x8, %eax
movl $0x20, %ecx
cmoveq %rax, %rcx
movq (%r12,%rcx), %rsi
jmp 0x4646e
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0x452f3
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
movq %r14, %rdx
callq 0x45007
movq (%rsp), %rdx
cmpq $-0x1, %rdx
je 0x463de
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0x46505
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x452f3
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x64bc5
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0x64bc5
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x7dbeb(%rip), %rsi     # 0xc4012
movl $0x4, %edi
callq 0x800c9
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq 0x10(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x7dbd7(%rip), %rsi     # 0xc401e
movl $0x4, %edi
callq 0x800c9
leaq 0xc0400(%rip), %rax     # 0x106858
incq 0x710(%rax)
xorl %eax, %eax
testl %ebp, %ebp
setne %al
shll $0x5, %eax
movq 0x8(%r15,%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3fc19