// File: /workspace/github_c_makefile_star2_O3/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
movq $0x0, 0x8(%rsp)
leaq 0x7a66(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x5859
movslq 0xe8(%rbx), %rax
cmpq $-0x1, %rax
je 0x5918
movl $0xffffffff, 0xe8(%rbx) # imm = 0xFFFFFFFF
movq 0x8f06(%rip), %rcx      # 0xe750
movl (%rcx,%rax,4), %eax
cmpl 0xec(%rbx), %eax
jne 0x592a
leaq 0x2c19(%rip), %rsi      # 0x8479
leaq 0x10(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x22d0
testl %eax, %eax
js 0x5921
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x4e76
testq %rax, %rax
je 0x5933
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x593c
movslq 0x8eb6(%rip), %r15      # 0xe75c
cmpl %r15d, 0x8eab(%rip)     # 0xe758
jl 0x58e1
movq 0x8eaa(%rip), %rdi      # 0xe760
movq %r15, %rsi
shlq $0x4, %rsi
callq 0x2310
testq %rax, %rax
je 0x5962
movq %rax, 0x8e8e(%rip)      # 0xe760
addl %r15d, %r15d
movl %r15d, 0x8e80(%rip)     # 0xe75c
movq 0x8(%rsp), %rdi
incw 0x24(%r14)
leaq 0x79f3(%rip), %rsi      # 0xd2e0
callq 0x7759
movl %eax, 0x1c(%r14)
orb $0x2, 0x27(%r14)
movq 0x8e5e(%rip), %rax      # 0xe760
movslq 0x8e4f(%rip), %rcx      # 0xe758
leal 0x1(%rcx), %edx
movl %edx, 0x8e46(%rip)      # 0xe758
movq %r14, (%rax,%rcx,8)
jmp 0x5944
leaq 0x2a78(%rip), %rsi      # 0x8397
jmp 0x594b
leaq 0x2b5f(%rip), %rsi      # 0x8487
jmp 0x594b
leaq 0x2a8e(%rip), %rsi      # 0x83bf
jmp 0x594b
leaq 0x2b32(%rip), %rsi      # 0x846c
jmp 0x594b
movq %r14, %rdi
callq 0x46bd
leaq 0x2b42(%rip), %rsi      # 0x848d
movq %rbx, %rdi
callq 0x41b0
xorl %eax, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2939(%rip), %rsi      # 0x82a2
jmp 0x594b