// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x39fb0
cmpl $0x0, %eax
jne 0x4c1f7
movl $0x1, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0x12ca32(%rip), %rax    # 0x178c40
movq 0x78(%rax), %rdx
callq 0x4a780
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x4c226
jmp 0x4c429
cmpl $0x0, -0x24(%rbp)
je 0x4c26c
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x4c24b
leaq 0x12c9ff(%rip), %rax    # 0x178c40
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x4c25a
leaq 0x12c9ee(%rip), %rax    # 0x178c40
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x42cc0
jmp 0x4c429
movq -0x18(%rbp), %rdi
callq 0x487b0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x4c430
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x4a6f0
cmpq $0x0, %rax
je 0x4c2f2
cmpl $0x0, -0xc(%rbp)
je 0x4c2d9
movq -0x18(%rbp), %rdi
callq 0x48f70
movq -0x8(%rbp), %rdi
leaq 0x12c975(%rip), %rax    # 0x178c40
movq 0x20(%rax), %rsi
callq 0x42cc0
jmp 0x4c429
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x4ac10
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x4a7d0
cmpq $-0x1, -0x20(%rbp)
je 0x4c333
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x4c4f0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x4ac10
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x4aa60
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x4aa60
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %ecx
movl $0x4, %edi
leaq 0xef631(%rip), %rsi     # 0x13b9d2
callq 0x9ce20
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %ecx
movl $0x4, %edi
leaq 0xef615(%rip), %rsi     # 0x13b9de
callq 0x9ce20
leaq 0x12be03(%rip), %rax    # 0x1781d8
movq 0x720(%rax), %rcx
addq $0x1, %rcx
leaq 0x12bdf1(%rip), %rax    # 0x1781d8
movq %rcx, 0x720(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x4c40d
leaq 0x12c83d(%rip), %rax    # 0x178c40
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x4c41c
leaq 0x12c82c(%rip), %rax    # 0x178c40
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x42cc0
addq $0x50, %rsp
popq %rbp
retq
nop