LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_unlink_q
void item_unlink_q(item *it) {
    item **head, **tail;
    /* always true, warns: assert(it->slabs_clsid <= LARGEST_ID); */
    head = &heads[it->slabs_clsid];
    tail = &tails[it->slabs_clsid];

    if (*head == it) {
        assert(it->prev == 0);
        *head = it->next;
    }
    if (*tail == it) {
        assert(it->next == 0);
        *tail = it->prev;
    }
    assert(it->next != it);
    assert(it->prev != it);

    if (it->next) it->next->prev = it->prev;
    if (it->prev) it->prev->next = it->next;
    sizes[it->slabs_clsid]--;
    return;
}

// Assembly:
movzbl 0x28(%rdi), %eax
leaq 0x8b61(%rip), %rcx      # 0xd350
cmpq %rdi, (%rcx,%rax,8)
jne 0x47fc
movq (%rdi), %rdx
movq %rdx, (%rcx,%rax,8)
leaq 0x934d(%rip), %rcx      # 0xdb50
cmpq %rdi, (%rcx,%rax,8)
jne 0x4811
movq 0x8(%rdi), %rdx
movq %rdx, (%rcx,%rax,8)
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x4821
movq 0x8(%rdi), %rdx
movq %rdx, 0x8(%rcx)
movq 0x8(%rdi), %rdx
testq %rdx, %rdx
je 0x482d
movq %rcx, (%rdx)
leaq 0x9b1c(%rip), %rcx      # 0xe350
decl (%rcx,%rax,4)
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_link
int item_link(item *it) {
    assert((it->it_flags & (ITEM_LINKED|ITEM_SLABBED)) == 0);
    assert(it->nbytes < 1048576);
    it->it_flags |= ITEM_LINKED;
    it->time = current_time;
    assoc_insert(ITEM_key(it), it);

    stats.curr_bytes += ITEM_ntotal(it);
    stats.curr_items += 1;
    stats.total_items += 1;

    item_link_q(it);

    return 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
orb $0x1, 0x27(%rdi)
leaq 0x8af9(%rip), %rax      # 0xd340
movl (%rax), %eax
movl %eax, 0x18(%rdi)
addq $0x30, %rdi
movq %rbx, %rsi
callq 0x387c
movzbl 0x29(%rbx), %eax
movzbl 0x26(%rbx), %ecx
addq %rax, %rcx
movslq 0x20(%rbx), %rax
addq %rcx, %rax
leaq 0x8a6f(%rip), %rcx      # 0xd2e0
movq 0x8(%rcx), %rdx
addq %rdx, %rax
addq $0x30, %rax
movq %rax, 0x8(%rcx)
movq (%rcx), %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, (%rcx)
movq %rbx, %rdi
callq 0x4799
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_remove
void item_remove(item *it) {
    assert((it->it_flags & ITEM_SLABBED) == 0);
    if (it->refcount) {
        -- it->refcount;
    }
    assert((it->it_flags & ITEM_DELETED) == 0 || it->refcount);
    if (it->refcount == 0 && (it->it_flags & ITEM_LINKED) == 0) {
        item_free(it);
    }
}

// Assembly:
movq %rdi, %rsi
movzwl 0x24(%rdi), %eax
testw %ax, %ax
je 0x48b1
decl %eax
movw %ax, 0x24(%rsi)
cmpw $0x0, 0x24(%rsi)
jne 0x48e9
movb 0x27(%rsi), %al
testb $0x1, %al
jne 0x48e9
movzbl 0x29(%rsi), %ecx
movzbl 0x26(%rsi), %edx
addl %ecx, %edx
movl 0x20(%rsi), %ecx
addl %ecx, %edx
addl $0x30, %edx
movb $0x0, 0x28(%rsi)
orb $0x4, %al
movb %al, 0x27(%rsi)
leaq 0x8a57(%rip), %rax      # 0xd338
movq (%rax), %rdi
jmp 0x4e4b
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_update
void item_update(item *it) {
    assert((it->it_flags & ITEM_SLABBED) == 0);

    item_unlink_q(it);
    it->time = current_time;
    item_link_q(it);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x47e4
leaq 0x8a46(%rip), %rax      # 0xd340
movl (%rax), %eax
movl %eax, 0x18(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x4799
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_cachedump
char *item_cachedump(unsigned int slabs_clsid, unsigned int limit, unsigned int *bytes) {

    int memlimit = 2*1024*1024;
    char *buffer;
    int bufcurr;
    item *it;
    int len;
    int shown = 0;
    char temp[512];

    if (slabs_clsid > LARGEST_ID) return 0;
    it = heads[slabs_clsid];

    buffer = malloc(memlimit);
    if (buffer == 0) return 0;
    bufcurr = 0;

    while (it && (!limit || shown < (int)limit)) {
        len = sprintf(temp, "ITEM %s [%u b; %lu s]\r\n", ITEM_key(it), it->nbytes - 2, it->time + stats.started);
        if (bufcurr + len + 6 > memlimit)  /* 6 is END\r\n\0 */
            break;
        strcpy(buffer + bufcurr, temp);
        bufcurr+=len;
        shown++;
        it = it->next;
    }

    strcpy(buffer+bufcurr, "END\r\n");
    bufcurr+=5;

    *bytes = bufcurr;
    return buffer;
}

// Assembly:
cmpl $0xff, %edi
jbe 0x492b
xorl %eax, %eax
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdx, %rbx
movl %esi, %ebp
movl %edi, %r15d
movl $0x200000, %edi         # imm = 0x200000
callq 0x22c0
xorl %r13d, %r13d
testq %rax, %rax
je 0x49eb
movq %rax, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r15d, %eax
leaq 0x89e3(%rip), %rcx      # 0xd350
movq (%rcx,%rax,8), %rbx
testq %rbx, %rbx
je 0x49f2
xorl %r15d, %r15d
xorl %r12d, %r12d
testl %ebp, %ebp
sete %al
cmpl %ebp, %r15d
setl %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x49ef
leaq 0x30(%rbx), %rdx
movl 0x18(%rbx), %r8d
movl 0x20(%rbx), %ecx
addl $-0x2, %ecx
leaq 0x893d(%rip), %rax      # 0xd2e0
addq 0x40(%rax), %r8
leaq 0x10(%rsp), %r14
movq %r14, %rdi
leaq 0x38ce(%rip), %rsi      # 0x8284
xorl %eax, %eax
callq 0x2400
movl %eax, %r13d
addl %r12d, %r13d
cmpl $0x1ffffa, %r13d        # imm = 0x1FFFFA
jg 0x49ef
movslq %r12d, %rdi
addq (%rsp), %rdi
movq %r14, %rsi
callq 0x2090
incl %r15d
movq (%rbx), %rbx
movl %r13d, %r12d
testq %rbx, %rbx
jne 0x497c
jmp 0x49f2
xorl %eax, %eax
jmp 0x4a11
movl %r12d, %r13d
movslq %r13d, %rdx
movq (%rsp), %rax
movw $0xa, 0x4(%rax,%rdx)
movl $0xd444e45, (%rax,%rdx) # imm = 0xD444E45
addl $0x5, %edx
movq 0x8(%rsp), %rcx
movl %edx, (%rcx)
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_stats
void item_stats(char *buffer, int buflen) {
    int i;
    char *bufcurr = buffer;
    rel_time_t now = current_time;

    if (buflen < 4096) {
        strcpy(buffer, "SERVER_ERROR out of memory");
        return;
    }

    for (i=0; i<LARGEST_ID; i++) {
        if (tails[i])
            bufcurr += sprintf(bufcurr, "STAT items:%u:number %u\r\nSTAT items:%u:age %u\r\n",
                               i, sizes[i], i, now - tails[i]->time);
    }
    strcpy(bufcurr, "END");
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8908(%rip), %rax      # 0xd340
movl (%rax), %ebp
cmpl $0x1000, %esi           # imm = 0x1000
jge 0x4a59
movups 0x3864(%rip), %xmm0     # 0x82ad
movups %xmm0, 0xb(%rbx)
movups 0x384e(%rip), %xmm0     # 0x82a2
movups %xmm0, (%rbx)
jmp 0x4ab7
leaq 0x98f0(%rip), %r12      # 0xe350
leaq 0x90e9(%rip), %r13      # 0xdb50
leaq 0x384f(%rip), %r14      # 0x82bd
xorl %r15d, %r15d
movq (%r13), %rax
testq %rax, %rax
je 0x4a9d
movl (%r12), %ecx
movl %ebp, %r9d
subl 0x18(%rax), %r9d
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x2400
cltq
addq %rax, %rbx
incq %r15
addq $0x4, %r12
addq $0x8, %r13
cmpq $0xff, %r15
jne 0x4a71
movl $0x444e45, (%rbx)       # imm = 0x444E45
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_stats_sizes
char* item_stats_sizes(int *bytes) {
    int num_buckets = 32768;   /* max 1MB object, divided into 32 bytes size buckets */
    unsigned int *histogram = (unsigned int*) malloc(num_buckets * sizeof(int));
    char *buf = (char*) malloc(1024*1024*2*sizeof(char));
    int i;

    if (histogram == 0 || buf == 0) {
        if (histogram) free(histogram);
        if (buf) free(buf);
        return 0;
    }

    /* build the histogram */
    memset(histogram, 0, num_buckets * sizeof(int));
    for (i=0; i<LARGEST_ID; i++) {
        item *iter = heads[i];
        while (iter) {
            int ntotal = ITEM_ntotal(iter);
            int bucket = ntotal / 32;
            if (ntotal % 32) bucket++;
            if (bucket < num_buckets) histogram[bucket]++;
            iter = iter->next;
        }
    }

    /* write the buffer */
    *bytes = 0;
    for (i=0; i<num_buckets; i++) {
        if (histogram[i]) {
            *bytes += sprintf(&buf[*bytes], "%u %u\r\n", i*32, histogram[i]);
        }
    }
    *bytes += sprintf(&buf[*bytes], "END\r\n");
    free(histogram);
    return buf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movl $0x20000, %edi          # imm = 0x20000
callq 0x22c0
movq %rax, %r14
movl $0x200000, %edi         # imm = 0x200000
callq 0x22c0
movq %rax, %rbx
testq %r14, %r14
setne %al
testq %rbx, %rbx
setne %cl
testb %cl, %al
jne 0x4b23
testq %r14, %r14
je 0x4b0b
movq %r14, %rdi
callq 0x2030
xorl %eax, %eax
movq %rbx, %r14
testq %rbx, %rbx
movl $0x0, %ebx
jne 0x4be7
jmp 0x4bf2
xorl %r12d, %r12d
movl $0x20000, %edx          # imm = 0x20000
movq %r14, %rdi
xorl %esi, %esi
callq 0x2190
leaq 0x8814(%rip), %rax      # 0xd350
movq (%rax,%r12,8), %rcx
testq %rcx, %rcx
je 0x4b82
movzbl 0x29(%rcx), %edx
movzbl 0x26(%rcx), %esi
addl %edx, %esi
movl 0x20(%rcx), %edx
leal (%rdx,%rsi), %edi
addl $0x30, %edi
addl %esi, %edx
addl $0x4f, %edx
testl %edi, %edi
cmovnsl %edi, %edx
sarl $0x5, %edx
andl $0x1f, %edi
cmpl $0x1, %edi
sbbl $-0x1, %edx
cmpl $0x7fff, %edx           # imm = 0x7FFF
jg 0x4b7d
movslq %edx, %rdx
incl (%r14,%rdx,4)
movq (%rcx), %rcx
jmp 0x4b40
incq %r12
cmpq $0xff, %r12
jne 0x4b3c
movl $0x0, (%r15)
leaq 0x36e0(%rip), %r12      # 0x827c
movq %r14, %rbp
xorl %r13d, %r13d
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x4bbf
movslq (%r15), %rdi
addq %rbx, %rdi
movq %r12, %rsi
movl %r13d, %edx
xorl %eax, %eax
callq 0x2400
addl %eax, (%r15)
addq $0x20, %r13
addq $0x4, %rbp
cmpq $0x100000, %r13         # imm = 0x100000
jne 0x4ba2
movslq (%r15), %rax
movw $0xa, 0x4(%rbx,%rax)
movl $0xd444e45, (%rbx,%rax) # imm = 0xD444E45
addl $0x5, %eax
movl %eax, (%r15)
movq %r14, %rdi
callq 0x2030
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/mem_cache.c
// Function: mem_cache_alloc
void *mem_cache_alloc(mem_cache_ptr mem_cache, size_t size) {
    void *ptr;
    slab_ptr slab;
    size_t org_page_total;
    
    if (NULL == mem_cache || size <= 0) {
        return 0;
    }

    if (mem_cache->mem_malloced >= mem_cache->mem_limit) {
        return NULL;
    }

    size_t slab_id = mem_cache_clsid(mem_cache, size);
    if (slab_id <= 0) {
        return NULL;
    }

    slab = mem_cache->slabclass[slab_id];
    org_page_total = slab->page_total;
    ptr = slab_alloc_chunk(slab);

    if (NULL == ptr) {
        return NULL;
    }

    if (org_page_total < slab->page_total) {
        mem_cache->mem_malloced += slab->page_size;
    }

    return ptr;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0x4da8
xorl %eax, %eax
retq
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rax
cmpq 0x28(%rdi), %rax
jae 0x4e13
movq 0x18(%rbx), %rax
movq 0x38(%rbx), %rcx
movq (%rcx,%rax,8), %rdx
cmpq %rsi, (%rdx)
jae 0x4de5
movq 0x20(%rbx), %rdx
cmpq %rdx, %rax
jae 0x4de3
movq 0x8(%rcx,%rax,8), %rdi
incq %rax
cmpq %rsi, (%rdi)
jb 0x4dcf
jmp 0x4de5
xorl %eax, %eax
testq %rax, %rax
je 0x4e13
movq 0x38(%rbx), %rcx
movq (%rcx,%rax,8), %r14
movq 0x28(%r14), %r15
movq %r14, %rdi
callq 0x7c55
testq %rax, %rax
je 0x4e13
cmpq 0x28(%r14), %r15
jae 0x4e15
movq 0x8(%r14), %rcx
addq %rcx, 0x30(%rbx)
jmp 0x4e15
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/mem_cache.c
// Function: mem_cache_clsid
size_t mem_cache_clsid(mem_cache_ptr mem_cache, size_t size) {
    size_t res;
    if(0 == size) {
        return 0;
    }

    res = mem_cache->power_smallest;
    while (size > mem_cache->slabclass[res]->chunk_size) {
        /* won't fit in the biggest slab */
        if (res >= mem_cache->power_largest) {
            return 0;
        }
        ++ res;
    }
    return res;
}

// Assembly:
testq %rsi, %rsi
je 0x4e48
movq 0x18(%rdi), %rax
movq 0x38(%rdi), %rcx
movq (%rcx,%rax,8), %rdx
cmpq %rsi, (%rdx)
jae 0x4e47
movq 0x20(%rdi), %rdx
cmpq %rdx, %rax
jae 0x4e48
movq 0x8(%rcx,%rax,8), %rdi
incq %rax
cmpq %rsi, (%rdi)
jb 0x4e35
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: get_item_notedeleted
item *get_item_notedeleted(char *key, int *delete_locked) {
    item *it = assoc_find(key);
    if (delete_locked) *delete_locked = 0;
    if (it && (it->it_flags & ITEM_DELETED)) {
        /* it's flagged as delete-locked.  let's see if that condition
           is past due, and the 5-second delete_timer just hasn't
           gotten to it yet... */
        if (! item_delete_lock_over(it)) {
            if (delete_locked) *delete_locked = 1;
            it = 0;
        }
    }
    if (it && settings.oldest_live && settings.oldest_live <= current_time &&
        it->time <= settings.oldest_live) {
        item_unlink(it);
        it = 0;
    }
    if (it && it->exptime && it->exptime <= current_time) {
        item_unlink(it);
        it = 0;
    }
    return it;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
callq 0x3820
testq %rbx, %rbx
je 0x4eb6
movl $0x0, (%rbx)
testq %rax, %rax
je 0x4ee6
testb $0x2, 0x27(%rax)
je 0x4ee8
testq %rbx, %rbx
sete %cl
leaq 0x8472(%rip), %rdx      # 0xd340
movl (%rdx), %edx
xorl %esi, %esi
cmpl 0x1c(%rax), %edx
setae %dl
cmovbq %rsi, %rax
orb %cl, %dl
jne 0x4ee8
movl $0x1, (%rbx)
xorl %eax, %eax
testq %rax, %rax
setne %dl
leaq 0x8393(%rip), %rcx      # 0xd288
movl 0x1c(%rcx), %ecx
testl %ecx, %ecx
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x4f21
leaq 0x8432(%rip), %rdx      # 0xd340
cmpl (%rdx), %ecx
ja 0x4f21
cmpl %ecx, 0x18(%rax)
ja 0x4f21
movq %rax, %rdi
callq 0x46be
xorl %eax, %eax
testq %rax, %rax
je 0x4f40
movl 0x1c(%rax), %ecx
testl %ecx, %ecx
je 0x4f42
leaq 0x840c(%rip), %rdx      # 0xd340
cmpl (%rdx), %ecx
ja 0x4f42
movq %rax, %rdi
callq 0x46be
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: ensure_iov_space
int ensure_iov_space(conn *c) {
    if (c->iovused >= c->iovsize) {
        int i, iovnum;
        struct iovec *new_iov = (struct iovec *) realloc(c->iov,
                                (c->iovsize * 2) * sizeof(struct iovec));
        if (! new_iov)
            return -1;
        c->iov = new_iov;
        c->iovsize *= 2;

        /* Point all the msghdr structures at the new list. */
        for (i = 0, iovnum = 0; i < c->msgused; i++) {
            c->msglist[i].msg_iov = &c->iov[iovnum];
            iovnum += c->msglist[i].msg_iovlen;
        }
    }

    return 0;
}

// Assembly:
pushq %rbx
movslq 0x80(%rdi), %rsi
cmpl %esi, 0x84(%rdi)
jl 0x4fc3
movq %rdi, %rbx
movq 0x78(%rdi), %rdi
shlq $0x5, %rsi
callq 0x2310
movq %rax, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x4fc5
movq %rcx, 0x78(%rbx)
shll 0x80(%rbx)
movslq 0x94(%rbx), %rsi
testq %rsi, %rsi
jle 0x4fbe
movq 0x88(%rbx), %rdx
imulq $0x38, %rsi, %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movslq %r8d, %r8
movq %r8, %r9
shlq $0x4, %r9
addq %rcx, %r9
movq %r9, 0x10(%rdx,%rdi)
addq 0x18(%rdx,%rdi), %r8
addq $0x38, %rdi
cmpq %rdi, %rsi
jne 0x4f9e
testq %rcx, %rcx
je 0x4fc5
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: build_udp_headers
int build_udp_headers(conn *c) {
    int i;
    unsigned char *hdr;

    if (c->msgused > c->hdrsize) {
        void *new_hdrbuf;
        if (c->hdrbuf)
            new_hdrbuf = realloc(c->hdrbuf, c->msgused * 2 * UDP_HEADER_SIZE);
        else
            new_hdrbuf = malloc(c->msgused * 2 * UDP_HEADER_SIZE);
        if (! new_hdrbuf)
            return -1;
        c->hdrbuf = (unsigned char *) new_hdrbuf;
        c->hdrsize = c->msgused * 2;
    }

    hdr = c->hdrbuf;
    for (i = 0; i < c->msgused; i++) {
        c->msglist[i].msg_iov[0].iov_base = hdr;
        c->msglist[i].msg_iov[0].iov_len = UDP_HEADER_SIZE;
        *hdr++ = c->request_id / 256;
        *hdr++ = c->request_id % 256;
        *hdr++ = i / 256;
        *hdr++ = i % 256;
        *hdr++ = c->msgused / 256;
        *hdr++ = c->msgused % 256;
        *hdr++ = 0;
        *hdr++ = 0;
        assert((void*) hdr == (void*) c->msglist[i].msg_iov[0].iov_base + UDP_HEADER_SIZE);
    }

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movslq 0x94(%rdi), %rsi
cmpl 0xe0(%rdi), %esi
jle 0x501c
movq 0xd8(%r14), %rdi
shlq $0x4, %rsi
testq %rdi, %rdi
je 0x4ff4
callq 0x2310
jmp 0x4ffc
movq %rsi, %rdi
callq 0x22c0
testq %rax, %rax
je 0x50b8
movq %rax, 0xd8(%r14)
movl 0x94(%r14), %eax
addl %eax, %eax
movl %eax, 0xe0(%r14)
cmpl $0x0, 0x94(%r14)
jle 0x50b3
movq 0xd8(%r14), %rcx
movl $0x2, %r8d
xorl %r9d, %r9d
movl $0xff, %esi
xorl %eax, %eax
movq 0x88(%r14), %rdi
movq (%rdi,%r8,8), %rdi
movq %rcx, (%rdi)
movq $0x8, 0x8(%rdi)
movl 0xc0(%r14), %edi
leal (%rdi,%rsi), %edx
testl %edi, %edi
cmovnsl %edi, %edx
movb %dh, (%rcx)
movb 0xc0(%r14), %dl
movb %dl, 0x1(%rcx)
movb %ah, 0x2(%rcx)
movb %al, 0x3(%rcx)
movl 0x94(%r14), %edx
leal (%rdx,%rsi), %ebx
testl %edx, %edx
cmovnsl %edx, %ebx
movb %bh, 0x4(%rcx)
movb 0x94(%r14), %dl
movb %dl, 0x5(%rcx)
movw $0x0, 0x6(%rcx)
incq %rax
movslq 0x94(%r14), %rdx
addq $0x7, %r8
addq $0x8, %rcx
cmpq %rdx, %rax
jl 0x5041
jmp 0x50be
xorl %r9d, %r9d
jmp 0x50be
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl %r9d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: complete_nread
void complete_nread(conn *c) {
    item *it = c->item;
    int comm = c->item_comm;
    item *old_it;
    int delete_locked = 0;
    char *key = ITEM_key(it);

    stats.set_cmds++;

    if (strncmp(ITEM_data(it) + it->nbytes - 2, "\r\n", 2) != 0) {
        out_string(c, "CLIENT_ERROR bad data chunk");
        goto err;
    }

    old_it = get_item_notedeleted(key, &delete_locked);

    if (old_it && comm == NREAD_ADD) {
        item_update(old_it);  /* touches item, promotes to head of LRU */
        out_string(c, "NOT_STORED");
        goto err;
    }

    if (!old_it && comm == NREAD_REPLACE) {
        out_string(c, "NOT_STORED");
        goto err;
    }

    if (delete_locked) {
        if (comm == NREAD_REPLACE || comm == NREAD_ADD) {
            out_string(c, "NOT_STORED");
            goto err;
        }

        /* but "set" commands can override the delete lock
         window... in which case we have to find the old hidden item
         that's in the namespace/LRU but wasn't returned by
         get_item.... because we need to replace it (below) */
        old_it = assoc_find(key);
    }

    if (old_it)
        item_replace(old_it, it);
    else
        item_link(it);

    c->item = 0;
    out_string(c, "STORED");
    return;

err:
     item_free(it);
     c->item = 0;
     return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x68(%rdi), %r14
movl 0x70(%rdi), %ebp
leaq 0x81ff(%rip), %rax      # 0xd2e0
incq 0x28(%rax)
movl $0x0, 0x4(%rsp)
movzbl 0x29(%r14), %eax
addq %r14, %rax
addq $0x30, %rax
movzbl 0x26(%r14), %ecx
addq %rax, %rcx
movslq 0x20(%r14), %rax
leaq (%rax,%rcx), %rdi
addq $-0x2, %rdi
leaq 0x3437(%rip), %rsi      # 0x854b
movl $0x2, %edx
callq 0x2070
testl %eax, %eax
je 0x512b
leaq 0x3247(%rip), %rsi      # 0x8370
jmp 0x5186
leaq 0x30(%r14), %r15
leaq 0x4(%rsp), %rsi
movq %r15, %rdi
callq 0x4ea2
testq %rax, %rax
setne %cl
cmpl $0x1, %ebp
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x5160
movq %rax, %rdi
callq 0x48ea
leaq 0x322e(%rip), %rsi      # 0x838c
jmp 0x5186
testq %rax, %rax
sete %cl
cmpl $0x3, %ebp
sete %dl
leaq 0x3219(%rip), %rsi      # 0x838c
testb %dl, %cl
jne 0x5186
cmpl $0x0, 0x4(%rsp)
je 0x51b1
orl $0x2, %ebp
cmpl $0x3, %ebp
jne 0x51a9
movq %rbx, %rdi
callq 0x41c9
movq %r14, %rdi
callq 0x4743
movq $0x0, 0x68(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x3820
testq %rax, %rax
je 0x51c3
movq %rax, %rdi
movq %r14, %rsi
callq 0x4908
jmp 0x51cb
movq %r14, %rdi
callq 0x4838
movq $0x0, 0x68(%rbx)
leaq 0x31b6(%rip), %rsi      # 0x8390
movq %rbx, %rdi
callq 0x41c9
jmp 0x519e
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: command_replace
int32_t command_replace(char *command, conn *c, int com_type) {
    int comm = com_type;
    char key[251];
    int flags;
    time_t expire;
    int len, res;
    item *it;

    res = sscanf(command, "%*s %250s %u %ld %d\n", key, &flags, &expire, &len);
    if (res!=4 || strlen(key)==0 ) {
        out_string(c, "CLIENT_ERROR bad command line format");
        return COMMAND_OK;
    }

    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;
        }
    }

    expire = realtime(expire, &stats);
    it = item_alloc(key, flags, expire, len+2);

    if (it == 0) {
        if (! item_size_ok(key, flags, len + 2))
            out_string(c, "SERVER_ERROR object too large for cache");
        else
            out_string(c, "SERVER_ERROR out of memory");
        /* swallow the data line */
        c->write_and_go = conn_swallow;
        c->sbytes = len+2;
        return COMMAND_OK;
    }

    c->item_comm = comm;
    c->item = it;
    c->ritem = ITEM_data(it);
    c->rlbytes = it->nbytes;
    conn_set_state(c, conn_nread);
    return COMMAND_OK;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %edx, %ebp
movq %rsi, %rbx
leaq 0x2f50(%rip), %rsi      # 0x83fc
leaq 0x10(%rsp), %rdx
leaq 0x4(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %rsp, %r9
xorl %eax, %eax
callq 0x22d0
cmpl $0x4, %eax
jne 0x557c
cmpb $0x0, 0x10(%rsp)
je 0x557c
leaq 0x7da8(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x5517
movslq 0xe8(%rbx), %rax
cmpq $-0x1, %rax
je 0x5597
movl $0xffffffff, 0xe8(%rbx) # imm = 0xFFFFFFFF
movq 0x9248(%rip), %rcx      # 0xe750
movl (%rcx,%rax,4), %eax
cmpl 0xec(%rbx), %eax
jne 0x55e2
movq 0x8(%rsp), %rdi
leaq 0x7dbd(%rip), %rsi      # 0xd2e0
callq 0x786d
movl %eax, %ecx
movq %rcx, 0x8(%rsp)
movl 0x4(%rsp), %esi
movl (%rsp), %ecx
addl $0x2, %ecx
leaq 0x10(%rsp), %rdi
movl %eax, %edx
callq 0x4563
testq %rax, %rax
je 0x55a0
movl %ebp, 0x70(%rbx)
movq %rax, 0x68(%rbx)
movzbl 0x29(%rax), %ecx
addq %rax, %rcx
movzbl 0x26(%rax), %edx
addq %rdx, %rcx
addq $0x30, %rcx
movq %rcx, 0x58(%rbx)
movl 0x20(%rax), %eax
movl %eax, 0x60(%rbx)
movq %rbx, %rdi
movl $0x3, %esi
callq 0x41a2
jmp 0x558b
leaq 0x2e8e(%rip), %rsi      # 0x8411
movq %rbx, %rdi
callq 0x41c9
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %rbp
retq
leaq 0x2df9(%rip), %rsi      # 0x8397
jmp 0x5583
movl 0x4(%rsp), %esi
movl (%rsp), %edx
addl $0x2, %edx
leaq 0x10(%rsp), %rdi
callq 0x4770
testl %eax, %eax
leaq 0x2e79(%rip), %rax      # 0x8436
leaq 0x2cde(%rip), %rsi      # 0x82a2
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x41c9
movl $0x4, 0x48(%rbx)
movl (%rsp), %eax
addl $0x2, %eax
movl %eax, 0x74(%rbx)
jmp 0x558b
leaq 0x2dd6(%rip), %rsi      # 0x83bf
jmp 0x5583
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: own_handler
int32_t own_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    int bucket, gen;
    char *start = command+4;
    conn *c = (conn*)argv;
    if (!settings.managed) {
        out_string(c, "CLIENT_ERROR not a managed instance");
        return COMMAND_OK;
    }
    if (sscanf(start, "%u:%u\r\n", &bucket,&gen) == 2) {
        if ((bucket < 0) || (bucket >= MAX_BUCKETS)) {
            out_string(c, "CLIENT_ERROR bucket number out of range");
            return COMMAND_OK;
        }
        buckets[bucket] = gen;
        out_string(c, "OWNED");
        return COMMAND_OK;
    } else {
        out_string(c, "CLIENT_ERROR bad format");
        return COMMAND_OK;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0x78bd(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x5a07
addq $0x4, %rdi
leaq 0x2add(%rip), %rsi      # 0x84b9
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x22d0
cmpl $0x2, %eax
jne 0x5a10
movl 0xc(%rsp), %eax
cmpq $0x7fff, %rax           # imm = 0x7FFF
jbe 0x5a19
leaq 0x2abc(%rip), %rsi      # 0x84c1
jmp 0x5a2e
leaq 0x2a87(%rip), %rsi      # 0x8495
jmp 0x5a2e
leaq 0x2ad2(%rip), %rsi      # 0x84e9
jmp 0x5a2e
movl 0x8(%rsp), %ecx
movq 0x8d2c(%rip), %rdx      # 0xe750
movl %ecx, (%rdx,%rax,4)
leaq 0x2ad6(%rip), %rsi      # 0x8504
movq %rbx, %rdi
callq 0x41c9
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: disown_handler
int32_t disown_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    int bucket;
    char *start = command+7;
    conn *c = (conn*)argv;
    if (!settings.managed) {
        out_string(c, "CLIENT_ERROR not a managed instance");
        return COMMAND_OK;
    }
    if (sscanf(start, "%u\r\n", &bucket) == 1) {
        if ((bucket < 0) || (bucket >= MAX_BUCKETS)) {
            out_string(c, "CLIENT_ERROR bucket number out of range");
            return COMMAND_OK;
        }
        buckets[bucket] = 0;
        out_string(c, "DISOWNED");
        return COMMAND_OK;
    } else {
        out_string(c, "CLIENT_ERROR bad format");
        return COMMAND_OK;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0x783b(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x5a84
addq $0x7, %rdi
leaq 0x2ab5(%rip), %rsi      # 0x8513
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x22d0
cmpl $0x1, %eax
jne 0x5a8d
movl 0xc(%rsp), %eax
cmpq $0x7fff, %rax           # imm = 0x7FFF
jbe 0x5a96
leaq 0x2a3f(%rip), %rsi      # 0x84c1
jmp 0x5aab
leaq 0x2a0a(%rip), %rsi      # 0x8495
jmp 0x5aab
leaq 0x2a55(%rip), %rsi      # 0x84e9
jmp 0x5aab
movq 0x8cb3(%rip), %rcx      # 0xe750
movl $0x0, (%rcx,%rax,4)
leaq 0x2a56(%rip), %rsi      # 0x8501
movq %rbx, %rdi
callq 0x41c9
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_reset_handler
int32_t stats_reset_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    conn *c = (conn*)argv;
    stats_reset(&stats);
    out_string(c, "RESET");
    return COMMAND_OK;
}

// Assembly:
pushq %rbx
movq %rdx, %rbx
leaq 0x757c(%rip), %rdi      # 0xd2e0
callq 0x7d52
leaq 0x2966(%rip), %rsi      # 0x86d6
movq %rbx, %rdi
callq 0x41c9
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_malloc_handler
int32_t stats_malloc_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    conn *c = (conn*)argv;
    char temp[512];
    struct mallinfo info;
    char *pos = temp;
    info = mallinfo();
    pos += sprintf(pos, "STAT arena_size %d\r\n", info.arena);
    pos += sprintf(pos, "STAT free_chunks %d\r\n", info.ordblks);
    pos += sprintf(pos, "STAT fastbin_blocks %d\r\n", info.smblks);
    pos += sprintf(pos, "STAT mmapped_regions %d\r\n", info.hblks);
    pos += sprintf(pos, "STAT mmapped_space %d\r\n", info.hblkhd);
    pos += sprintf(pos, "STAT max_total_alloc %d\r\n", info.usmblks);
    pos += sprintf(pos, "STAT fastbin_space %d\r\n", info.fsmblks);
    pos += sprintf(pos, "STAT total_alloc %d\r\n", info.uordblks);
    pos += sprintf(pos, "STAT total_free %d\r\n", info.fordblks);
    pos += sprintf(pos, "STAT releasable_space %d\r\nEND", info.keepcost);
    out_string(c, temp);
    return COMMAND_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdx, 0x18(%rsp)
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0x2170
movl (%r12), %edx
movl 0x4(%r12), %r13d
movl 0x8(%r12), %r15d
movl 0xc(%r12), %ebp
movl 0x10(%r12), %ebx
movl 0x14(%r12), %r14d
movl 0x18(%r12), %eax
movl %eax, 0x8(%rsp)
movl 0x1c(%r12), %eax
movl %eax, 0xc(%rsp)
movl 0x20(%r12), %eax
movl %eax, 0x10(%rsp)
movl 0x24(%r12), %eax
movl %eax, 0x14(%rsp)
leaq 0x28f5(%rip), %rsi      # 0x86dc
leaq 0x20(%rsp), %rdi
xorl %eax, %eax
callq 0x2400
cltq
leaq (%rsp,%rax), %r12
addq $0x20, %r12
leaq 0x28ed(%rip), %rsi      # 0x86f1
movq %r12, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %r13
addq %r12, %r13
leaq 0x28e9(%rip), %rsi      # 0x8707
movq %r13, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r13, %r15
leaq 0x28e8(%rip), %rsi      # 0x8720
movq %r15, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
leaq 0x28e9(%rip), %rsi      # 0x873a
movq %r12, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %rbx
addq %r12, %rbx
leaq 0x28e8(%rip), %rsi      # 0x8752
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %r14
addq %rbx, %r14
leaq 0x28e8(%rip), %rsi      # 0x876c
movq %r14, %rdi
movl 0x8(%rsp), %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %rbx
addq %r14, %rbx
leaq 0x28e5(%rip), %rsi      # 0x8784
movq %rbx, %rdi
movl 0xc(%rsp), %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %r14
addq %rbx, %r14
leaq 0x28e0(%rip), %rsi      # 0x879a
movq %r14, %rdi
movl 0x10(%rsp), %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %rdi
addq %r14, %rdi
leaq 0x28da(%rip), %rsi      # 0x87af
movl 0x14(%rsp), %edx
xorl %eax, %eax
callq 0x2400
movq 0x18(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x41c9
xorl %eax, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_maps_handler
int32_t stats_maps_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    char *wbuf;
    int wsize = 8192; /* should be enough */
    int fd;
    int res;
    conn *c = (conn*)argv;

    wbuf = (char *)malloc(wsize);
    if (wbuf == 0) {
        out_string(c, "SERVER_ERROR out of memory");
        return COMMAND_OK;
    }

    fd = open("/proc/self/maps", O_RDONLY);
    if (fd == -1) {
        out_string(c, "SERVER_ERROR cannot open the maps file");
        free(wbuf);
        return COMMAND_OK;
    }

    res = read(fd, wbuf, wsize - 6);  /* 6 = END\r\n\0 */
    if (res == wsize - 6) {
        out_string(c, "SERVER_ERROR buffer overflow");
        free(wbuf); close(fd);
        return COMMAND_OK;
    }
    if (res == 0 || res == -1) {
        out_string(c, "SERVER_ERROR can't read the maps file");
        free(wbuf); close(fd);
        return COMMAND_OK;
    }
    strcpy(wbuf + res, "END\r\n");
    c->write_and_free=wbuf;
    c->wcurr=wbuf;
    c->wbytes = res + 6;
    conn_set_state(c, conn_write);
    c->write_and_go = conn_read;
    close(fd);

    return COMMAND_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl $0x2000, %edi           # imm = 0x2000
callq 0x22c0
testq %rax, %rax
je 0x5f52
movq %rax, %r14
leaq 0x28aa(%rip), %rdi      # 0x87cd
xorl %esi, %esi
xorl %eax, %eax
callq 0x2380
cmpl $-0x1, %eax
je 0x5f63
movl %eax, %ebp
movl $0x1ffa, %edx           # imm = 0x1FFA
movl %eax, %edi
movq %r14, %rsi
callq 0x21f0
cmpl $0x1ffa, %eax           # imm = 0x1FFA
jne 0x5f7c
leaq 0x28b4(%rip), %rsi      # 0x8804
jmp 0x5f8b
leaq 0x2349(%rip), %rsi      # 0x82a2
movq %rbx, %rdi
callq 0x41c9
jmp 0x5fd9
leaq 0x2873(%rip), %rsi      # 0x87dd
movq %rbx, %rdi
callq 0x41c9
movq %r14, %rdi
callq 0x2030
jmp 0x5fd9
leal 0x1(%rax), %ecx
cmpl $0x1, %ecx
ja 0x5f9d
leaq 0x2896(%rip), %rsi      # 0x8821
movq %rbx, %rdi
callq 0x41c9
movq %r14, %rdi
callq 0x2030
jmp 0x5fd2
movslq %eax, %rcx
movw $0xa, 0x4(%r14,%rcx)
movl $0xd444e45, (%r14,%rcx) # imm = 0xD444E45
movq %r14, 0x50(%rbx)
movq %r14, 0x38(%rbx)
addl $0x6, %eax
movl %eax, 0x44(%rbx)
movq %rbx, %rdi
movl $0x2, %esi
callq 0x41a2
movl $0x1, 0x48(%rbx)
movl %ebp, %edi
callq 0x21b0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_cachedump_handler
int32_t stats_cachedump_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    char *buf;
    unsigned int bytes, id, limit = 0;
    conn *c = (conn*)argv;
    char *start = command + 15;
    if (sscanf(start, "%u %u\r\n", &id, &limit) < 1) {
        out_string(c, "CLIENT_ERROR bad command line");
        return COMMAND_OK;
    }

    buf = item_cachedump(id, limit, &bytes);
    if (buf == 0) {
        out_string(c, "SERVER_ERROR out of memory");
        return COMMAND_OK;
    }

    c->write_and_free = buf;
    c->wcurr = buf;
    c->wbytes = bytes;
    conn_set_state(c, conn_write);
    c->write_and_go = conn_read;

    return COMMAND_OK;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0x4(%rsp), %rcx
movl $0x0, (%rcx)
addq $0xf, %rdi
leaq 0x227e(%rip), %rsi      # 0x827c
leaq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x22d0
testl %eax, %eax
jle 0x604a
movl 0x8(%rsp), %edi
movl 0x4(%rsp), %esi
leaq 0xc(%rsp), %rdx
callq 0x4920
testq %rax, %rax
je 0x6053
movq %rax, 0x50(%rbx)
movq %rax, 0x38(%rbx)
movl 0xc(%rsp), %eax
movl %eax, 0x44(%rbx)
movq %rbx, %rdi
movl $0x2, %esi
callq 0x41a2
movl $0x1, 0x48(%rbx)
jmp 0x6062
leaq 0x27f6(%rip), %rsi      # 0x8847
jmp 0x605a
leaq 0x2248(%rip), %rsi      # 0x82a2
movq %rbx, %rdi
callq 0x41c9
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_items_handler
int32_t stats_items_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    conn *c = (conn*)argv;
    char buffer[4096];
    item_stats(buffer, 4096);
    out_string(c, buffer);
    return COMMAND_OK;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdx, %rbx
movq %rsp, %r14
movq %r14, %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x4a23
movq %rbx, %rdi
movq %r14, %rsi
callq 0x41c9
xorl %eax, %eax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_sizes_handler
int32_t stats_sizes_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    int bytes = 0;
    char *buf = item_stats_sizes(&bytes);
    conn *c = (conn*)argv;
    if (! buf) {
        out_string(c, "SERVER_ERROR out of memory");
        return COMMAND_OK;
    }

    c->write_and_free = buf;
    c->wcurr = buf;
    c->wbytes = bytes;
    conn_set_state(c, conn_write);
    c->write_and_go = conn_read;

    return COMMAND_OK;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0xc(%rsp), %rdi
movl $0x0, (%rdi)
callq 0x4ac6
testq %rax, %rax
je 0x60e4
movq %rax, 0x50(%rbx)
movq %rax, 0x38(%rbx)
movl 0xc(%rsp), %eax
movl %eax, 0x44(%rbx)
movq %rbx, %rdi
movl $0x2, %esi
callq 0x41a2
movl $0x1, 0x48(%rbx)
jmp 0x60f3
leaq 0x21b7(%rip), %rsi      # 0x82a2
movq %rbx, %rdi
callq 0x41c9
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: flush_all_handler
int32_t flush_all_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    time_t exptime = 0;
    int res;
    conn *c = (conn*)argv;
    set_current_time(&stats);

    if (strcmp(command, "flush_all") == 0) {
        settings.oldest_live = current_time;
        out_string(c, "OK");
        return COMMAND_OK;
    }

    res = sscanf(command, "%*s %ld", &exptime);
    if (res != 1) {
        out_string(c, "ERROR");
        return COMMAND_OK;
    }

    settings.oldest_live = realtime(exptime, &stats);
    out_string(c, "OK");
    return COMMAND_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movq $0x0, (%rsp)
leaq 0x71a3(%rip), %rdi      # 0xd2e0
callq 0x7854
leaq 0x272a(%rip), %rsi      # 0x8873
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
je 0x6180
leaq 0x2724(%rip), %rsi      # 0x8880
movq %rsp, %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x22d0
cmpl $0x1, %eax
jne 0x619c
movq (%rsp), %rdi
leaq 0x7167(%rip), %rsi      # 0xd2e0
callq 0x786d
jmp 0x6189
leaq 0x71b9(%rip), %rax      # 0xd340
movl (%rax), %eax
leaq 0x70f8(%rip), %rcx      # 0xd288
movl %eax, 0x1c(%rcx)
leaq 0x26e3(%rip), %rsi      # 0x887d
jmp 0x61a3
leaq 0x22e4(%rip), %rsi      # 0x8487
movq %rbx, %rdi
callq 0x41c9
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: bg_handler
int32_t bg_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    int bucket, gen;
    char *start = command + 3;
    conn *c = (conn*)argv;
    if (!settings.managed) {
        out_string(c, "CLIENT_ERROR not a managed instance");
        return COMMAND_OK;
    }
    if (sscanf(start, "%u:%u\r\n", &bucket,&gen) == 2) {
        /* we never write anything back, even if input's wrong */
        if ((bucket < 0) || (bucket >= MAX_BUCKETS) || (gen<=0)) {
            /* do nothing, bad input */
        } else {
            c->bucket = bucket;
            c->gen = gen;
        }
        conn_set_state(c, conn_read);
        return COMMAND_OK;
    } else {
        out_string(c, "CLIENT_ERROR bad format");
        return COMMAND_OK;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0x70c4(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x6221
addq $0x3, %rdi
leaq 0x22e4(%rip), %rsi      # 0x84b9
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x22d0
cmpl $0x2, %eax
jne 0x622a
movl 0xc(%rsp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
setae %dl
movl 0x8(%rsp), %ecx
testl %ecx, %ecx
setle %sil
orb %dl, %sil
jne 0x6212
movl %eax, 0xe8(%rbx)
movl %ecx, 0xec(%rbx)
movq %rbx, %rdi
movl $0x1, %esi
callq 0x41a2
jmp 0x6239
leaq 0x226d(%rip), %rsi      # 0x8495
jmp 0x6231
leaq 0x22b8(%rip), %rsi      # 0x84e9
movq %rbx, %rdi
callq 0x41c9
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: process_command
void process_command(conn *c, char *command) {

    LOG_DEBUG_F2("<%d %s\n", c->sfd, command);
    c->msgcurr = 0;
    c->msgused = 0;
    c->iovused = 0;
    if (add_msghdr(c)) {
        out_string(c, "SERVER_ERROR out of memory");
        return;
    }

    if(command_service_run(g_cmd_srv, command, 0, (char **)c) < 0) {
        out_string(c, "ERROR");
    }
    return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x7036(%rip), %rax      # 0xd288
cmpl $0x2, 0x18(%rax)
jge 0x62bb
movq $0x0, 0x94(%rbx)
movl $0x0, 0x84(%rbx)
movq %rbx, %rdi
callq 0x4359
testl %eax, %eax
je 0x628f
leaq 0x2022(%rip), %rsi      # 0x82a2
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x41c9
leaq 0x6fea(%rip), %rax      # 0xd280
movq (%rax), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x3aa5
testl %eax, %eax
js 0x62b2
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x21ce(%rip), %rsi      # 0x8487
jmp 0x6280
movq 0x6d36(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movl (%rbx), %edx
leaq 0x25ba(%rip), %rsi      # 0x8888
movq %r14, %rcx
xorl %eax, %eax
callq 0x2260
jmp 0x6258
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: try_read_udp
int try_read_udp(conn *c) {
    int res;

    c->request_addr_size = sizeof(c->request_addr);
    res = recvfrom(c->sfd, c->rbuf, c->rsize,
                   0, &c->request_addr, &c->request_addr_size);
    if (res > 8) {
        unsigned char *buf = (unsigned char *)c->rbuf;
        stats.bytes_read += res;

        /* Beginning of UDP packet is the request ID; save it. */
        c->request_id = buf[0] * 256 + buf[1];

        /* If this is a multi-packet request, drop it. */
        if (buf[4] != 0 || buf[5] != 1) {
            out_string(c, "SERVER_ERROR multi-packet request not supported");
            return 0;
        }

        /* Don't care about any of the rest of the header. */
        res -= 8;
        memmove(c->rbuf, c->rbuf + 8, res);

        c->rbytes += res;
        c->rcurr = c->rbuf;
        return 1;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xd4(%rdi), %r9
movl $0x10, 0xd4(%rdi)
movl (%rdi), %edi
movq 0x18(%rbx), %rsi
movslq 0x28(%rbx), %rdx
leaq 0xc4(%rbx), %r8
xorl %ebp, %ebp
xorl %ecx, %ecx
callq 0x22f0
cmpl $0x9, %eax
jl 0x63ee
movq 0x18(%rbx), %rdi
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leaq 0x6f44(%rip), %rdx      # 0xd2e0
addq %rcx, 0x48(%rdx)
movzwl (%rdi), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
movl %ecx, 0xc0(%rbx)
cmpb $0x0, 0x4(%rdi)
jne 0x63df
cmpb $0x1, 0x5(%rdi)
jne 0x63df
leal -0x8(%rax), %r14d
leaq 0x8(%rdi), %rsi
movq %r14, %rdx
callq 0x2360
addl %r14d, 0x2c(%rbx)
movq 0x18(%rbx), %rax
movq %rax, 0x20(%rbx)
movl $0x1, %ebp
jmp 0x63ee
leaq 0x24aa(%rip), %rsi      # 0x8890
movq %rbx, %rdi
callq 0x41c9
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: try_read_network
int try_read_network(conn *c) {
    int gotdata = 0;
    int res;

    if (c->rcurr != c->rbuf) {
        if (c->rbytes != 0) /* otherwise there's nothing to copy */
            memmove(c->rbuf, c->rcurr, c->rbytes);
        c->rcurr = c->rbuf;
    }

    while (1) {
        if (c->rbytes >= c->rsize) {
            char *new_rbuf = realloc(c->rbuf, c->rsize*2);
            if (!new_rbuf) {
                LOG_INFO("Couldn't realloc input buffer\n");
                c->rbytes = 0; /* ignore what we read */
                out_string(c, "SERVER_ERROR out of memory");
                c->write_and_go = conn_closing;
                return 1;
            }
            c->rcurr  = c->rbuf = new_rbuf;
            c->rsize *= 2;
        }

        /* unix socket mode doesn't need this, so zeroed out.  but why
         * is this done for every command?  presumably for UDP
         * mode.  */
        if (!settings.socketpath) {
            c->request_addr_size = sizeof(c->request_addr);
        } else {
            c->request_addr_size = 0;
        }

        res = read(c->sfd, c->rbuf + c->rbytes, c->rsize - c->rbytes);
        if (res > 0) {
            stats.bytes_read += res;
            gotdata = 1;
            c->rbytes += res;
            continue;
        }
        if (res == 0) {
            /* connection closed */
            conn_set_state(c, conn_closing);
            return 1;
        }
        if (res == -1) {
            if (errno == EAGAIN || errno == EWOULDBLOCK) break;
            else return 0;
        }
    }
    return gotdata;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x20(%rbx), %rsi
cmpq %rdi, %rsi
je 0x6426
movslq 0x2c(%rbx), %rdx
testq %rdx, %rdx
je 0x641e
callq 0x2360
movq 0x18(%rbx), %rax
movq %rax, 0x20(%rbx)
xorl %ebp, %ebp
leaq 0x6e59(%rip), %r12      # 0xd288
leaq 0x6eaa(%rip), %r13      # 0xd2e0
leaq 0x1e65(%rip), %r14      # 0x82a2
movslq 0x28(%rbx), %rsi
cmpl %esi, 0x2c(%rbx)
jl 0x6495
movq 0x18(%rbx), %rdi
addq %rsi, %rsi
callq 0x2310
movq %rax, %r15
testq %rax, %rax
je 0x6467
movq %r15, 0x18(%rbx)
movq %r15, 0x20(%rbx)
shll 0x28(%rbx)
jmp 0x648c
cmpl $0x0, 0x18(%r12)
jg 0x64f8
movl $0x0, 0x2c(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x41c9
movl $0x5, 0x48(%rbx)
testq %r15, %r15
je 0x6521
cmpq $0x0, 0x28(%r12)
je 0x64a9
movl $0x0, 0xd4(%rbx)
jmp 0x64b3
movl $0x10, 0xd4(%rbx)
movl (%rbx), %edi
movslq 0x2c(%rbx), %rax
movq 0x18(%rbx), %rsi
addq %rax, %rsi
movslq 0x28(%rbx), %rdx
subq %rax, %rdx
callq 0x21f0
testl %eax, %eax
jg 0x64df
cmpl $-0x1, %eax
je 0x6502
testl %eax, %eax
jne 0x643d
jmp 0x6514
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, 0x48(%r13)
addl %eax, 0x2c(%rbx)
movl $0x1, %ebp
jmp 0x643d
callq 0x259e
jmp 0x6473
callq 0x2040
movq %rax, %rcx
xorl %eax, %eax
cmpl $0xb, (%rcx)
cmovel %ebp, %eax
jmp 0x6526
movq %rbx, %rdi
movl $0x5, %esi
callq 0x41a2
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: new_socket
int new_socket(int is_udp) {
    int sfd;
    int flags;

    if ((sfd = socket(AF_INET, is_udp ? SOCK_DGRAM : SOCK_STREAM, 0)) == -1) {
        perror("socket()");
        return -1;
    }

    if ((flags = fcntl(sfd, F_GETFL, 0)) < 0 ||
        fcntl(sfd, F_SETFL, flags | O_NONBLOCK) < 0) {
        perror("setting O_NONBLOCK");
        close(sfd);
        return -1;
    }
    return sfd;
}

// Assembly:
pushq %rbx
cmpl $0x1, %edi
movl $0x2, %esi
sbbl $0x0, %esi
movl $0x2, %edi
xorl %edx, %edx
callq 0x2460
cmpl $-0x1, %eax
je 0x6c0b
movl %eax, %ebx
movl %eax, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20f0
testl %eax, %eax
js 0x6bf6
orl $0x800, %eax            # imm = 0x800
movl %ebx, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x20f0
testl %eax, %eax
js 0x6bf6
movl %ebx, %eax
popq %rbx
retq
leaq 0x1d2c(%rip), %rdi      # 0x8929
callq 0x23b0
movl %ebx, %edi
callq 0x21b0
jmp 0x6c17
leaq 0x1dd0(%rip), %rdi      # 0x89e2
callq 0x23b0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x6bf2
// File: /workspace/github_c_makefile_star2_O1/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: maximize_sndbuf
void maximize_sndbuf(int sfd) {
    socklen_t intsize = sizeof(int);
    int last_good = 0;
    int min, max, avg;
    int old_size;

    /* Start with the default size. */
    if (getsockopt(sfd, SOL_SOCKET, SO_SNDBUF, &old_size, &intsize)) {
        if (settings.verbose > 0)
            perror("getsockopt(SO_SNDBUF)");
        return;
    }

    /* Binary-search for the real maximum. */
    min = old_size;
    max = MAX_SENDBUF_SIZE;

    while (min <= max) {
        avg = ((unsigned int) min + max) / 2;
        if (setsockopt(sfd, SOL_SOCKET, SO_SNDBUF, &avg, intsize) == 0) {
            last_good = avg;
            min = avg + 1;
        } else {
            max = avg - 1;
        }
    }

    LOG_DEBUG_F3("<%d send buffer was %d, now %d\n", sfd, old_size, last_good);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
leaq 0xc(%rsp), %r8
movl $0x4, (%r8)
leaq 0x4(%rsp), %rcx
movl $0x1, %esi
movl $0x7, %edx
callq 0x2210
testl %eax, %eax
je 0x6c6b
leaq 0x6631(%rip), %rax      # 0xd288
cmpl $0x0, 0x18(%rax)
jle 0x6cd9
leaq 0x1d87(%rip), %rdi      # 0x89eb
callq 0x23b0
jmp 0x6cd9
movl 0x4(%rsp), %r15d
xorl %ebp, %ebp
cmpl $0x10000000, %r15d      # imm = 0x10000000
jg 0x6ccc
xorl %ebp, %ebp
movl $0x10000000, %r12d      # imm = 0x10000000
leaq 0x8(%rsp), %r14
leal (%r12,%r15), %eax
shrl %eax
movl %eax, 0x8(%rsp)
movl 0xc(%rsp), %r8d
movl %ebx, %edi
movl $0x1, %esi
movl $0x7, %edx
movq %r14, %rcx
callq 0x20d0
movl 0x8(%rsp), %ecx
leal 0x1(%rcx), %edx
leal -0x1(%rcx), %esi
testl %eax, %eax
cmovel %ecx, %ebp
cmovnel %r15d, %edx
cmovel %r12d, %esi
movl %esi, %r12d
movl %edx, %r15d
cmpl %esi, %edx
jle 0x6c88
leaq 0x65b5(%rip), %rax      # 0xd288
cmpl $0x2, 0x18(%rax)
jge 0x6ce6
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x630b(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movl 0x4(%rsp), %ecx
leaq 0x1d06(%rip), %rsi      # 0x8a01
movl %ebx, %edx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2260
jmp 0x6cd9