// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/db.c
// Function: expireGenericCommand
void expireGenericCommand(client *c, long long basetime, int unit) {
    robj *key = c->argv[1], *param = c->argv[2];
    long long when; /* unix time in milliseconds when the key will expire. */

    if (getLongLongFromObjectOrReply(c, param, &when, NULL) != C_OK)
        return;

    if (unit == UNIT_SECONDS) when *= 1000;
    when += basetime;

    /* No key, return zero. */
    if (lookupKeyWrite(c->db,key) == NULL) {
        addReply(c,shared.czero);
        return;
    }

    /* EXPIRE with negative TTL, or EXPIREAT with a timestamp into the past
     * should never be executed as a DEL when load the AOF or in the context
     * of a slave instance.
     *
     * Instead we take the other branch of the IF statement setting an expire
     * (possibly in the past) and wait for an explicit DEL from the master. */
    if (when <= mstime() && !server.loading && !server.masterhost) {
        robj *aux;

        serverAssertWithInfo(c,key,dbDelete(c->db,key));
        server.dirty++;

        /* Replicate/AOF this as an explicit DEL. */
        aux = createStringObject("DEL",3);
        rewriteClientCommandVector(c,2,aux,key);
        decrRefCount(aux);
        signalModifiedKey(c->db,key);
        notifyKeyspaceEvent(NOTIFY_GENERIC,"del",key,c->db->id);
        addReply(c, shared.cone);
        return;
    } else {
        setExpire(c->db,key,when);
        addReply(c,shared.cone);
        signalModifiedKey(c->db,key);
        notifyKeyspaceEvent(NOTIFY_GENERIC,"expire",key,c->db->id);
        server.dirty++;
        return;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq 0x8(%rax), %r14
movq 0x10(%rax), %rsi
leaq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x44b44
testl %eax, %eax
jne 0x4693f
testl %ebp, %ebp
jne 0x467fc
imulq $0x3e8, 0x8(%rsp), %rax # imm = 0x3E8
movq %rax, 0x8(%rsp)
addq %r15, 0x8(%rsp)
movq 0x10(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x44eae
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x44dec
testq %rax, %rax
je 0x468dc
movq 0x8(%rsp), %r12
callq 0x330c8
leaq 0xc0021(%rip), %r15     # 0x106858
movq 0x10(%rbx), %rdi
cmpq %rax, %r12
jg 0x468f1
cmpl $0x0, 0x31c(%r15)
jne 0x468f1
cmpq $0x0, 0x818(%r15)
jne 0x468f1
movq %r14, %rsi
callq 0x452f3
testl %eax, %eax
je 0x4694c
incq 0x710(%r15)
leaq 0x797a4(%rip), %rdi     # 0xc0022
movl $0x3, %esi
callq 0x43ba8
movq %rax, %r15
movq %rbx, %rdi
movl $0x2, %esi
movq %rax, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x42a6f
movq %r15, %rdi
callq 0x440f3
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x64bc5
movq 0x10(%rbx), %rax
movl 0x30(%rax), %ecx
leaq 0x7abf4(%rip), %rsi     # 0xc14b6
movl $0x4, %edi
movq %r14, %rdx
callq 0x800c9
leaq 0xc09da(%rip), %rax     # 0x1072b0
movq 0x28(%rax), %rsi
jmp 0x468e7
leaq 0xc09cd(%rip), %rax     # 0x1072b0
movq 0x20(%rax), %rsi
movq %rbx, %rdi
callq 0x3fc19
jmp 0x4693f
movq 0x8(%rsp), %rdx
movq %r14, %rsi
callq 0x46505
leaq 0xc09ab(%rip), %rax     # 0x1072b0
movq 0x28(%rax), %rsi
movq %rbx, %rdi
callq 0x3fc19
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x64bc5
movq 0x10(%rbx), %rax
movl 0x30(%rax), %ecx
leaq 0x8b8dc(%rip), %rsi     # 0xd2207
movl $0x4, %edi
movq %r14, %rdx
callq 0x800c9
incq 0x710(%r15)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7d729(%rip), %rdx     # 0xc407c
leaq 0x7f035(%rip), %rcx     # 0xc598f
movq %rbx, %rdi
movq %r14, %rsi
movl $0x3c8, %r8d            # imm = 0x3C8
callq 0x66380
movl $0x1, %edi
callq 0x263d0