// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: delete_handler
int32_t delete_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    char key[251];
    item *it;
    int res;
    time_t exptime = 0;
    conn *c = (conn*)argv;

    if (settings.managed) {
        int bucket = c->bucket;
        if (bucket == -1) {
            out_string(c, "CLIENT_ERROR no BG data in managed mode");
            return COMMAND_OK;
        }
        c->bucket = -1;
        if (buckets[bucket] != c->gen) {
            out_string(c, "ERROR_NOT_OWNER");
            return COMMAND_OK;
        }
    }
    res = sscanf(command, "%*s %250s %ld", key, &exptime);
    if (res < 0) {
        out_string(c, "ERROR");
        return COMMAND_OK;
    }
    it = get_item(key);
    if (!it) {
        out_string(c, "NOT_FOUND");
        return COMMAND_OK;
    }
    if (exptime == 0) {
        item_unlink(it);
        out_string(c, "DELETED");
        return COMMAND_OK;
    }
    if (delcurr >= deltotal) {
        item **new_delete = realloc(todelete, sizeof(item *) * deltotal * 2);
        if (new_delete) {
            todelete = new_delete;
            deltotal *= 2;
        } else {
            /*
             * can't delete it immediately, user wants a delay,
             * but we ran out of memory for the delete queue
             */
            out_string(c, "SERVER_ERROR out of memory");
            return COMMAND_OK;
        }
    }

    it->refcount++;
    /* use its expiration time as its deletion time now */
    it->exptime = realtime(exptime, &stats);
    it->it_flags |= ITEM_DELETED;
    todelete[delcurr++] = it;
    out_string(c, "DELETED");
    return COMMAND_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movq %rdx, %rbx
andq $0x0, 0x8(%rsp)
leaq 0x8448(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x4e74
movslq 0xe8(%rbx), %rax
cmpq $-0x1, %rax
je 0x4f31
orl $-0x1, 0xe8(%rbx)
movq 0x98eb(%rip), %rcx      # 0xe750
movl (%rcx,%rax,4), %eax
cmpl 0xec(%rbx), %eax
jne 0x4f43
leaq 0x35be(%rip), %rsi      # 0x8439
leaq 0x10(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x22d0
testl %eax, %eax
js 0x4f3a
leaq 0x10(%rsp), %rdi
callq 0x45ad
testq %rax, %rax
je 0x4f4c
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4f55
movslq 0x989d(%rip), %r15      # 0xe75c
cmpl %r15d, 0x9892(%rip)     # 0xe758
jl 0x4efa
movq 0x9891(%rip), %rdi      # 0xe760
movq %r15, %rsi
shlq $0x4, %rsi
callq 0x2310
testq %rax, %rax
je 0x4f7b
movq %rax, 0x9875(%rip)      # 0xe760
addl %r15d, %r15d
movl %r15d, 0x9867(%rip)     # 0xe75c
movq 0x8(%rsp), %rdi
incw 0x24(%r14)
leaq 0x83da(%rip), %rsi      # 0xd2e0
callq 0x6d41
movl %eax, 0x1c(%r14)
orb $0x2, 0x27(%r14)
movq 0x9845(%rip), %rax      # 0xe760
movslq 0x9836(%rip), %rcx      # 0xe758
leal 0x1(%rcx), %edx
movl %edx, 0x982d(%rip)      # 0xe758
movq %r14, (%rax,%rcx,8)
jmp 0x4f5d
leaq 0x341f(%rip), %rsi      # 0x8357
jmp 0x4f64
leaq 0x3506(%rip), %rsi      # 0x8447
jmp 0x4f64
leaq 0x3435(%rip), %rsi      # 0x837f
jmp 0x4f64
leaq 0x34d9(%rip), %rsi      # 0x842c
jmp 0x4f64
movq %r14, %rdi
callq 0x3e01
leaq 0x34e9(%rip), %rsi      # 0x844d
movq %rbx, %rdi
callq 0x3946
xorl %eax, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r14
popq %r15
retq
leaq 0x32d4(%rip), %rsi      # 0x8256
jmp 0x4f64