LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/daemon.c
// Function: daemon
int daemon(int nochdir, int noclose) {
    int fd;

    switch (fork()) {
        case -1:
            return (-1);
        case 0:
            break;
        default:
            _exit(0);
    }

    if (setsid() == -1)
        return (-1);

    if (!nochdir) {
        if (chdir("/") < 0) {
            return -1;
        }
    }

    if (!noclose && (fd = open("/dev/null", O_RDWR, 0)) != -1) {
        (void)dup2(fd, STDIN_FILENO);
        (void)dup2(fd, STDOUT_FILENO);
        (void)dup2(fd, STDERR_FILENO);
        if (fd > STDERR_FILENO)
            (void)close(fd);
    }
    return (0);
}

// Assembly:
subq $0x18, %rsp
movl %edi, 0x10(%rsp)
movl %esi, 0xc(%rsp)
callq 0x2460
movl %eax, %ecx
movl %ecx, 0x4(%rsp)
subl $-0x1, %eax
je 0x5458
jmp 0x544e
movl 0x4(%rsp), %eax
testl %eax, %eax
je 0x5465
jmp 0x5467
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x550f
jmp 0x546e
xorl %edi, %edi
callq 0x2080
callq 0x21e0
cmpl $-0x1, %eax
jne 0x5485
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x550f
cmpl $0x0, 0x10(%rsp)
jne 0x54a9
leaq 0x6d90(%rip), %rdi      # 0xc223
callq 0x2120
cmpl $0x0, %eax
jge 0x54a7
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x550f
jmp 0x54a9
cmpl $0x0, 0xc(%rsp)
jne 0x5507
leaq 0x6d6e(%rip), %rdi      # 0xc225
movl $0x2, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x23a0
movl %eax, 0x8(%rsp)
cmpl $-0x1, %eax
je 0x5507
movl 0x8(%rsp), %edi
xorl %esi, %esi
callq 0x2160
movl 0x8(%rsp), %edi
movl $0x1, %esi
callq 0x2160
movl 0x8(%rsp), %edi
movl $0x2, %esi
callq 0x2160
cmpl $0x2, 0x8(%rsp)
jle 0x5505
movl 0x8(%rsp), %edi
callq 0x21d0
jmp 0x5507
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_init
void item_init() {
    int i;
    for(i=0; i<LARGEST_ID; i++) {
        heads[i]=0;
        tails[i]=0;
        sizes[i]=0;
    }
}

// Assembly:
movl $0x0, -0x4(%rsp)
cmpl $0xff, -0x4(%rsp)
jge 0x557a
movslq -0x4(%rsp), %rcx
leaq 0xbe22(%rip), %rax      # 0x11360
movq $0x0, (%rax,%rcx,8)
movslq -0x4(%rsp), %rcx
leaq 0xc60e(%rip), %rax      # 0x11b60
movq $0x0, (%rax,%rcx,8)
movslq -0x4(%rsp), %rcx
leaq 0xcdfa(%rip), %rax      # 0x12360
movl $0x0, (%rax,%rcx,4)
movl -0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rsp)
jmp 0x5528
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_make_header
int item_make_header(char *key, int flags, int nbytes,
                     char *suffix, int *nsuffix, int *keylen) {
    *keylen = strlen(key) + 1; 
    if(*keylen % 4) {
        *keylen += 4 - (*keylen % 4);
    }
    *nsuffix = sprintf(suffix, " %u %u\r\n", flags, nbytes - 2);
    return sizeof(item) + *keylen + *nsuffix + nbytes;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movl %edx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq %r8, 0x8(%rsp)
movq %r9, (%rsp)
movq 0x20(%rsp), %rdi
callq 0x2110
addq $0x1, %rax
movl %eax, %ecx
movq (%rsp), %rax
movl %ecx, (%rax)
movq (%rsp), %rax
movl (%rax), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x55e5
movq (%rsp), %rax
movl (%rax), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl $0x4, %ecx
subl %edx, %ecx
movq (%rsp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq 0x10(%rsp), %rdi
movl 0x1c(%rsp), %edx
movl 0x18(%rsp), %ecx
subl $0x2, %ecx
leaq 0x6c33(%rip), %rsi      # 0xc22f
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq 0x8(%rsp), %rax
movl %ecx, (%rax)
movq (%rsp), %rax
movslq (%rax), %rax
addq $0x30, %rax
movq 0x8(%rsp), %rcx
movslq (%rcx), %rcx
addq %rcx, %rax
movslq 0x18(%rsp), %rcx
addq %rcx, %rax
addq $0x28, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_unlink
void item_unlink(item *it) {
    if (it->it_flags & ITEM_LINKED) {
        it->it_flags &= ~ITEM_LINKED;
        stats.curr_bytes -= ITEM_ntotal(it);
        stats.curr_items -= 1;
        assoc_delete(ITEM_key(it));
        item_unlink_q(it);
    }
    if (it->refcount == 0) {
        item_free(it);
    }
}

// Assembly:
pushq %rax
movq %rdi, (%rsp)
movq (%rsp), %rax
movzbl 0x27(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x5929
movq (%rsp), %rax
movzbl 0x27(%rax), %ecx
andl $-0x2, %ecx
movb %cl, 0x27(%rax)
movq (%rsp), %rax
movzbl 0x29(%rax), %eax
addq $0x30, %rax
movq (%rsp), %rcx
movzbl 0x26(%rcx), %ecx
addq %rcx, %rax
movq (%rsp), %rcx
movslq 0x20(%rcx), %rcx
addq %rcx, %rax
leaq 0xba04(%rip), %rcx      # 0x112f0
movq 0x8(%rcx), %rcx
subq %rax, %rcx
leaq 0xb9f6(%rip), %rax      # 0x112f0
movq %rcx, 0x8(%rax)
leaq 0xb9eb(%rip), %rax      # 0x112f0
movl (%rax), %ecx
subl $0x1, %ecx
leaq 0xb9df(%rip), %rax      # 0x112f0
movl %ecx, (%rax)
movq (%rsp), %rdi
addq $0x30, %rdi
callq 0x40b0
movq (%rsp), %rdi
callq 0x5ae0
movq (%rsp), %rax
movzwl 0x24(%rax), %eax
cmpl $0x0, %eax
jne 0x593f
movq (%rsp), %rdi
callq 0x5950
popq %rax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_free
void item_free(item *it) {
    unsigned int ntotal = ITEM_ntotal(it);
    assert((it->it_flags & ITEM_LINKED) == 0);
    assert(it != heads[it->slabs_clsid]);
    assert(it != tails[it->slabs_clsid]);
    assert(it->refcount == 0);

    /* so slab size changer can tell later if item is already free or not */
    it->slabs_clsid = 0;
    it->it_flags |= ITEM_SLABBED;
    mem_cache_free(mem_cache, it, ntotal);
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movzbl 0x29(%rax), %eax
addq $0x30, %rax
movq 0x10(%rsp), %rcx
movzbl 0x26(%rcx), %ecx
addq %rcx, %rax
movq 0x10(%rsp), %rcx
movslq 0x20(%rcx), %rcx
addq %rcx, %rax
movl %eax, 0xc(%rsp)
movq 0x10(%rsp), %rax
movb $0x0, 0x28(%rax)
movq 0x10(%rsp), %rax
movzbl 0x27(%rax), %ecx
orl $0x4, %ecx
movb %cl, 0x27(%rax)
leaq 0xb9a7(%rip), %rax      # 0x11348
movq (%rax), %rdi
movq 0x10(%rsp), %rsi
movl 0xc(%rsp), %eax
movl %eax, %edx
callq 0x6660
addq $0x18, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/items.c
// Function: item_link_q
void item_link_q(item *it) { /* item is the new head */
    item **head, **tail;
    /* always true, warns: assert(it->slabs_clsid <= LARGEST_ID); */
    assert((it->it_flags & ITEM_SLABBED) == 0);

    head = &heads[it->slabs_clsid];
    tail = &tails[it->slabs_clsid];
    assert(it != *head);
    assert((*head && *tail) || (*head == 0 && *tail == 0));
    it->prev = 0;
    it->next = *head;
    if (it->next) it->next->prev = it;
    *head = it;
    if (*tail == 0) *tail = it;
    sizes[it->slabs_clsid]++;
    return;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movzbl 0x28(%rax), %eax
movl %eax, %ecx
leaq 0xb939(%rip), %rax      # 0x11360
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movzbl 0x28(%rax), %eax
movl %eax, %ecx
leaq 0xc11b(%rip), %rax      # 0x11b60
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rsp)
movq -0x8(%rsp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rsp), %rax
movq (%rax), %rcx
movq -0x8(%rsp), %rax
movq %rcx, (%rax)
movq -0x8(%rsp), %rax
cmpq $0x0, (%rax)
je 0x5a8a
movq -0x8(%rsp), %rcx
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rsp), %rcx
movq -0x10(%rsp), %rax
movq %rcx, (%rax)
movq -0x18(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x5aaf
movq -0x8(%rsp), %rcx
movq -0x18(%rsp), %rax
movq %rcx, (%rax)
movq -0x8(%rsp), %rax
movzbl 0x28(%rax), %eax
movl %eax, %ecx
leaq 0xc89f(%rip), %rax      # 0x12360
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
leaq 0xc892(%rip), %rax      # 0x12360
movl %edx, (%rax,%rcx,4)
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movzbl 0x28(%rax), %eax
movl %eax, %ecx
leaq 0xb869(%rip), %rax      # 0x11360
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rax
movzbl 0x28(%rax), %eax
movl %eax, %ecx
leaq 0xc04b(%rip), %rax      # 0x11b60
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rsp)
movq -0x10(%rsp), %rax
movq (%rax), %rax
cmpq -0x8(%rsp), %rax
jne 0x5b40
movq -0x8(%rsp), %rax
movq (%rax), %rcx
movq -0x10(%rsp), %rax
movq %rcx, (%rax)
movq -0x18(%rsp), %rax
movq (%rax), %rax
cmpq -0x8(%rsp), %rax
jne 0x5b60
movq -0x8(%rsp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rsp), %rax
movq %rcx, (%rax)
movq -0x8(%rsp), %rax
cmpq $0x0, (%rax)
je 0x5b80
movq -0x8(%rsp), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x5ba0
movq -0x8(%rsp), %rax
movq (%rax), %rcx
movq -0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x8(%rsp), %rax
movzbl 0x28(%rax), %eax
movl %eax, %ecx
leaq 0xc7ae(%rip), %rax      # 0x12360
movl (%rax,%rcx,4), %edx
addl $-0x1, %edx
leaq 0xc7a1(%rip), %rax      # 0x12360
movl %edx, (%rax,%rcx,4)
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rax
movq %rdi, (%rsp)
movq (%rsp), %rax
movzbl 0x27(%rax), %ecx
orl $0x1, %ecx
movb %cl, 0x27(%rax)
leaq 0xb766(%rip), %rax      # 0x11350
movl (%rax), %ecx
movq (%rsp), %rax
movl %ecx, 0x18(%rax)
movq (%rsp), %rdi
addq $0x30, %rdi
movq (%rsp), %rsi
callq 0x4030
movq (%rsp), %rax
movzbl 0x29(%rax), %eax
movl %eax, %ecx
addq $0x30, %rcx
movq (%rsp), %rax
movzbl 0x26(%rax), %eax
addq %rax, %rcx
movq (%rsp), %rax
movslq 0x20(%rax), %rax
addq %rax, %rcx
leaq 0xb6c1(%rip), %rax      # 0x112f0
addq 0x8(%rax), %rcx
leaq 0xb6b6(%rip), %rax      # 0x112f0
movq %rcx, 0x8(%rax)
leaq 0xb6ab(%rip), %rax      # 0x112f0
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0xb69f(%rip), %rax      # 0x112f0
movl %ecx, (%rax)
leaq 0xb696(%rip), %rax      # 0x112f0
movl 0x4(%rax), %ecx
addl $0x1, %ecx
leaq 0xb689(%rip), %rax      # 0x112f0
movl %ecx, 0x4(%rax)
movq (%rsp), %rdi
callq 0x5a10
movl $0x1, %eax
popq %rcx
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rax
movq %rdi, (%rsp)
movq (%rsp), %rax
cmpw $0x0, 0x24(%rax)
je 0x5ca0
movq (%rsp), %rax
movw 0x24(%rax), %cx
addw $-0x1, %cx
movw %cx, 0x24(%rax)
movq (%rsp), %rax
movzwl 0x24(%rax), %eax
cmpl $0x0, %eax
jne 0x5cc6
movq (%rsp), %rax
movzbl 0x27(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x5cc6
movq (%rsp), %rdi
callq 0x5950
popq %rax
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rax
movq %rdi, (%rsp)
movq (%rsp), %rdi
callq 0x5ae0
leaq 0xb66b(%rip), %rax      # 0x11350
movl (%rax), %ecx
movq (%rsp), %rax
movl %ecx, 0x18(%rax)
movq (%rsp), %rdi
callq 0x5a10
popq %rax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x258, %rsp            # imm = 0x258
movl %edi, 0x24c(%rsp)
movl %esi, 0x248(%rsp)
movq %rdx, 0x240(%rsp)
movl $0x200000, 0x23c(%rsp) # imm = 0x200000
movl $0x0, 0x218(%rsp)
cmpl $0xff, 0x24c(%rsp)
jbe 0x5d81
movq $0x0, 0x250(%rsp)
jmp 0x5f39
movl 0x24c(%rsp), %eax
movl %eax, %ecx
leaq 0xb5cf(%rip), %rax      # 0x11360
movq (%rax,%rcx,8), %rax
movq %rax, 0x220(%rsp)
movslq 0x23c(%rsp), %rdi
callq 0x22e0
movq %rax, 0x230(%rsp)
cmpq $0x0, 0x230(%rsp)
jne 0x5dce
movq $0x0, 0x250(%rsp)
jmp 0x5f39
movl $0x0, 0x22c(%rsp)
xorl %eax, %eax
cmpq $0x0, 0x220(%rsp)
movb %al, 0xf(%rsp)
je 0x5e17
movb $0x1, %al
cmpl $0x0, 0x248(%rsp)
movb %al, 0xe(%rsp)
je 0x5e0f
movl 0x218(%rsp), %eax
cmpl 0x248(%rsp), %eax
setl %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x5e24
jmp 0x5ee8
leaq 0x10(%rsp), %rdi
movq 0x220(%rsp), %rdx
addq $0x30, %rdx
movq 0x220(%rsp), %rax
movl 0x20(%rax), %ecx
subl $0x2, %ecx
movq 0x220(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, %r8d
leaq 0xb498(%rip), %rax      # 0x112f0
addq 0x40(%rax), %r8
leaq 0x63d5(%rip), %rsi      # 0xc238
movb $0x0, %al
callq 0x2420
movl %eax, 0x21c(%rsp)
movl 0x22c(%rsp), %eax
addl 0x21c(%rsp), %eax
addl $0x6, %eax
cmpl 0x23c(%rsp), %eax
jle 0x5e8d
jmp 0x5ee8
movq 0x230(%rsp), %rdi
movslq 0x22c(%rsp), %rax
addq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2090
movl 0x21c(%rsp), %eax
addl 0x22c(%rsp), %eax
movl %eax, 0x22c(%rsp)
movl 0x218(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x218(%rsp)
movq 0x220(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x220(%rsp)
jmp 0x5dd9
movq 0x230(%rsp), %rdi
movslq 0x22c(%rsp), %rax
addq %rax, %rdi
leaq 0x634e(%rip), %rsi      # 0xc250
callq 0x2090
movl 0x22c(%rsp), %eax
addl $0x5, %eax
movl %eax, 0x22c(%rsp)
movl 0x22c(%rsp), %ecx
movq 0x240(%rsp), %rax
movl %ecx, (%rax)
movq 0x230(%rsp), %rax
movq %rax, 0x250(%rsp)
movq 0x250(%rsp), %rax
addq $0x258, %rsp            # imm = 0x258
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0xb3e2(%rip), %rax      # 0x11350
movl (%rax), %eax
movl %eax, 0xc(%rsp)
cmpl $0x1000, 0x1c(%rsp)     # imm = 0x1000
jge 0x5f94
movq 0x20(%rsp), %rdi
leaq 0x62cc(%rip), %rsi      # 0xc256
callq 0x2090
jmp 0x6032
movl $0x0, 0x18(%rsp)
cmpl $0xff, 0x18(%rsp)
jge 0x6021
movslq 0x18(%rsp), %rcx
leaq 0xbbae(%rip), %rax      # 0x11b60
cmpq $0x0, (%rax,%rcx,8)
je 0x600f
movq 0x10(%rsp), %rdi
movl 0x18(%rsp), %edx
movslq 0x18(%rsp), %rcx
leaq 0xc392(%rip), %rax      # 0x12360
movl (%rax,%rcx,4), %ecx
movl 0x18(%rsp), %r8d
movl 0xc(%rsp), %r9d
movslq 0x18(%rsp), %rsi
leaq 0xbb79(%rip), %rax      # 0x11b60
movq (%rax,%rsi,8), %rax
subl 0x18(%rax), %r9d
leaq 0x627b(%rip), %rsi      # 0xc271
movb $0x0, %al
callq 0x2420
movl %eax, %ecx
movq 0x10(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
jmp 0x6011
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x5f9c
movq 0x10(%rsp), %rdi
leaq 0x676c(%rip), %rsi      # 0xc799
callq 0x2090
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
xorl %eax, %eax
cmpq 0x28(%rsp), %rax
je 0x64ef
cmpq $0x0, 0x20(%rsp)
ja 0x64fd
movq $0x0, 0x30(%rsp)
jmp 0x65bb
movq 0x28(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x28(%rsp), %rcx
cmpq 0x28(%rcx), %rax
jb 0x651f
movq $0x0, 0x30(%rsp)
jmp 0x65bb
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x65d0
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
ja 0x6544
movq $0x0, 0x30(%rsp)
jmp 0x65bb
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0xb660
movq %rax, 0x18(%rsp)
xorl %eax, %eax
cmpq 0x18(%rsp), %rax
jne 0x658b
movq $0x0, 0x30(%rsp)
jmp 0x65bb
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
cmpq 0x28(%rcx), %rax
jae 0x65b1
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x28(%rsp), %rax
addq 0x30(%rax), %rcx
movq %rcx, 0x30(%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
xorl %eax, %eax
cmpq -0x18(%rsp), %rax
jne 0x65ee
movq $0x0, -0x8(%rsp)
jmp 0x664d
movq -0x10(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rsp)
movq -0x18(%rsp), %rax
movq -0x10(%rsp), %rcx
movq 0x38(%rcx), %rcx
movq -0x20(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpq (%rcx), %rax
jbe 0x6643
movq -0x20(%rsp), %rax
movq -0x10(%rsp), %rcx
cmpq 0x20(%rcx), %rax
jb 0x6633
movq $0x0, -0x8(%rsp)
jmp 0x664d
movq -0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rsp)
jmp 0x65fc
movq -0x20(%rsp), %rax
movq %rax, -0x8(%rsp)
movq -0x8(%rsp), %rax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/mem_cache.c
// Function: mem_cache_free
void mem_cache_free(mem_cache_ptr mem_cache, void *ptr, size_t size) {
    size_t slab_id = mem_cache_clsid(mem_cache, size);
    if (slab_id <= 0) {
        return;
    }
    slab_free_chunk(mem_cache->slabclass[slab_id], ptr);
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x65d0
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
ja 0x6691
jmp 0x66ad
movq 0x20(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x18(%rsp), %rsi
callq 0xb760
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x3f90
movq %rax, (%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x670f
movq 0x8(%rsp), %rax
movl $0x0, (%rax)
cmpq $0x0, (%rsp)
je 0x6751
movq (%rsp), %rax
movzbl 0x27(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x6751
movq (%rsp), %rdi
callq 0x66c0
cmpl $0x0, %eax
jne 0x674f
cmpq $0x0, 0x8(%rsp)
je 0x6747
movq 0x8(%rsp), %rax
movl $0x1, (%rax)
movq $0x0, (%rsp)
jmp 0x6751
cmpq $0x0, (%rsp)
je 0x67a0
leaq 0xab39(%rip), %rax      # 0x11298
cmpl $0x0, 0x1c(%rax)
je 0x67a0
leaq 0xab2c(%rip), %rax      # 0x11298
movl 0x1c(%rax), %eax
leaq 0xabda(%rip), %rcx      # 0x11350
movl (%rcx), %ecx
cmpl %ecx, %eax
ja 0x67a0
movq (%rsp), %rax
movl 0x18(%rax), %eax
leaq 0xab0e(%rip), %rcx      # 0x11298
cmpl 0x1c(%rcx), %eax
ja 0x67a0
movq (%rsp), %rdi
callq 0x58a0
movq $0x0, (%rsp)
cmpq $0x0, (%rsp)
je 0x67d6
movq (%rsp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x67d6
movq (%rsp), %rax
movl 0x1c(%rax), %eax
leaq 0xab91(%rip), %rcx      # 0x11350
movl (%rcx), %ecx
cmpl %ecx, %eax
ja 0x67d6
movq (%rsp), %rdi
callq 0x58a0
movq $0x0, (%rsp)
movq (%rsp), %rax
addq $0x18, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq 0x18(%rsp), %rax
movl 0x84(%rax), %eax
movq 0x18(%rsp), %rcx
cmpl 0x80(%rcx), %eax
jl 0x690b
movq 0x18(%rsp), %rax
movq 0x78(%rax), %rdi
movq 0x18(%rsp), %rax
movl 0x80(%rax), %eax
shll %eax
movslq %eax, %rsi
shlq $0x4, %rsi
callq 0x2330
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x6861
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x6913
movq 0x8(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x78(%rax)
movq 0x18(%rsp), %rax
movl 0x80(%rax), %ecx
shll %ecx
movl %ecx, 0x80(%rax)
movl $0x0, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
movl 0x14(%rsp), %eax
movq 0x18(%rsp), %rcx
cmpl 0x94(%rcx), %eax
jge 0x6909
movq 0x18(%rsp), %rax
movq 0x78(%rax), %rcx
movslq 0x10(%rsp), %rax
shlq $0x4, %rax
addq %rax, %rcx
movq 0x18(%rsp), %rax
movq 0x88(%rax), %rax
movslq 0x14(%rsp), %rdx
imulq $0x38, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rax
movq 0x88(%rax), %rax
movslq 0x14(%rsp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rcx
movslq 0x10(%rsp), %rax
addq %rcx, %rax
movl %eax, 0x10(%rsp)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x6892
jmp 0x690b
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x28(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
leaq 0x9648(%rip), %rax      # 0x11298
cmpl $0x0, 0x20(%rax)
jne 0x7c73
movq (%rsp), %rdi
leaq 0x4804(%rip), %rsi      # 0xc465
callq 0x4fc0
movl $0x0, 0x34(%rsp)
jmp 0x7d05
movq 0x8(%rsp), %rdi
leaq 0x480a(%rip), %rsi      # 0xc489
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movb $0x0, %al
callq 0x22f0
cmpl $0x2, %eax
jne 0x7ced
cmpl $0x0, 0x14(%rsp)
jl 0x7ca6
cmpl $0x8000, 0x14(%rsp)     # imm = 0x8000
jl 0x7cc0
movq (%rsp), %rdi
leaq 0x47e0(%rip), %rsi      # 0xc491
callq 0x4fc0
movl $0x0, 0x34(%rsp)
jmp 0x7d05
movl 0x10(%rsp), %edx
movq 0xaa95(%rip), %rax      # 0x12760
movslq 0x14(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq (%rsp), %rdi
leaq 0x47f6(%rip), %rsi      # 0xc4d4
callq 0x4fc0
movl $0x0, 0x34(%rsp)
jmp 0x7d05
movq (%rsp), %rdi
leaq 0x47c1(%rip), %rsi      # 0xc4b9
callq 0x4fc0
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x28(%rsp), %rax
addq $0x7, %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
leaq 0x9558(%rip), %rax      # 0x11298
cmpl $0x0, 0x20(%rax)
jne 0x7d63
movq (%rsp), %rdi
leaq 0x4714(%rip), %rsi      # 0xc465
callq 0x4fc0
movl $0x0, 0x34(%rsp)
jmp 0x7df0
movq 0x8(%rsp), %rdi
leaq 0x4774(%rip), %rsi      # 0xc4e3
leaq 0x14(%rsp), %rdx
movb $0x0, %al
callq 0x22f0
cmpl $0x1, %eax
jne 0x7dd8
cmpl $0x0, 0x14(%rsp)
jl 0x7d91
cmpl $0x8000, 0x14(%rsp)     # imm = 0x8000
jl 0x7dab
movq (%rsp), %rdi
leaq 0x46f5(%rip), %rsi      # 0xc491
callq 0x4fc0
movl $0x0, 0x34(%rsp)
jmp 0x7df0
movq 0xa9ae(%rip), %rax      # 0x12760
movslq 0x14(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movq (%rsp), %rdi
leaq 0x4708(%rip), %rsi      # 0xc4d1
callq 0x4fc0
movl $0x0, 0x34(%rsp)
jmp 0x7df0
movq (%rsp), %rdi
leaq 0x46d6(%rip), %rsi      # 0xc4b9
callq 0x4fc0
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x8fbd(%rip), %rdi      # 0x112f0
callq 0xb8f0
movq 0x8(%rsp), %rdi
leaq 0x4362(%rip), %rsi      # 0xc6a6
callq 0x4fc0
xorl %eax, %eax
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movq %rdx, 0x28(%rsp)
movl $0x2000, 0x1c(%rsp)     # imm = 0x2000
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movslq 0x1c(%rsp), %rdi
callq 0x22e0
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0x85b9
movq 0x8(%rsp), %rdi
leaq 0x3caf(%rip), %rsi      # 0xc256
callq 0x4fc0
movl $0x0, 0x44(%rsp)
jmp 0x8704
leaq 0x41dd(%rip), %rdi      # 0xc79d
xorl %esi, %esi
movb $0x0, %al
callq 0x23a0
movl %eax, 0x18(%rsp)
cmpl $-0x1, 0x18(%rsp)
jne 0x85fc
movq 0x8(%rsp), %rdi
leaq 0x41cd(%rip), %rsi      # 0xc7ad
callq 0x4fc0
movq 0x20(%rsp), %rdi
callq 0x2030
movl $0x0, 0x44(%rsp)
jmp 0x8704
movl 0x18(%rsp), %edi
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %eax
subl $0x6, %eax
movslq %eax, %rdx
callq 0x2210
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
movl 0x1c(%rsp), %ecx
subl $0x6, %ecx
cmpl %ecx, %eax
jne 0x8658
movq 0x8(%rsp), %rdi
leaq 0x41a1(%rip), %rsi      # 0xc7d4
callq 0x4fc0
movq 0x20(%rsp), %rdi
callq 0x2030
movl 0x18(%rsp), %edi
callq 0x21d0
movl $0x0, 0x44(%rsp)
jmp 0x8704
cmpl $0x0, 0x14(%rsp)
je 0x8666
cmpl $-0x1, 0x14(%rsp)
jne 0x8694
movq 0x8(%rsp), %rdi
leaq 0x417f(%rip), %rsi      # 0xc7f1
callq 0x4fc0
movq 0x20(%rsp), %rdi
callq 0x2030
movl 0x18(%rsp), %edi
callq 0x21d0
movl $0x0, 0x44(%rsp)
jmp 0x8704
movq 0x20(%rsp), %rdi
movslq 0x14(%rsp), %rax
addq %rax, %rdi
leaq 0x3ba8(%rip), %rsi      # 0xc250
callq 0x2090
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x50(%rax)
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x38(%rax)
movl 0x14(%rsp), %ecx
addl $0x6, %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x44(%rax)
movq 0x8(%rsp), %rdi
movl $0x2, %esi
callq 0x4f80
movq 0x8(%rsp), %rax
movl $0x1, 0x48(%rax)
movl 0x18(%rsp), %edi
callq 0x21d0
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movq %rdx, 0x28(%rsp)
movl $0x0, 0x14(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rax
addq $0xf, %rax
movq %rax, (%rsp)
movq (%rsp), %rdi
leaq 0x3ae4(%rip), %rsi      # 0xc230
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %rcx
movb $0x0, %al
callq 0x22f0
cmpl $0x1, %eax
jge 0x8780
movq 0x8(%rsp), %rdi
leaq 0x40a9(%rip), %rsi      # 0xc817
callq 0x4fc0
movl $0x0, 0x44(%rsp)
jmp 0x8805
movl 0x18(%rsp), %edi
movl 0x14(%rsp), %esi
leaq 0x1c(%rsp), %rdx
callq 0x5d30
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0x87ba
movq 0x8(%rsp), %rdi
leaq 0x3aab(%rip), %rsi      # 0xc256
callq 0x4fc0
movl $0x0, 0x44(%rsp)
jmp 0x8805
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x50(%rax)
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x38(%rax)
movl 0x1c(%rsp), %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x44(%rax)
movq 0x8(%rsp), %rdi
movl $0x2, %esi
callq 0x4f80
movq 0x8(%rsp), %rax
movl $0x1, 0x48(%rax)
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x1028, %rsp           # imm = 0x1028
movq %rdi, 0x1020(%rsp)
movl %esi, 0x101c(%rsp)
movq %rdx, 0x1010(%rsp)
movq 0x1010(%rsp), %rax
movq %rax, 0x1008(%rsp)
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x5f50
movq 0x1008(%rsp), %rdi
movq %rsp, %rsi
callq 0x4fc0
xorl %eax, %eax
addq $0x1028, %rsp           # imm = 0x1028
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
leaq 0x14(%rsp), %rdi
callq 0x6040
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x88e4
movq (%rsp), %rdi
leaq 0x3981(%rip), %rsi      # 0xc256
callq 0x4fc0
movl $0x0, 0x34(%rsp)
jmp 0x892a
movq 0x8(%rsp), %rcx
movq (%rsp), %rax
movq %rcx, 0x50(%rax)
movq 0x8(%rsp), %rcx
movq (%rsp), %rax
movq %rcx, 0x38(%rax)
movl 0x14(%rsp), %ecx
movq (%rsp), %rax
movl %ecx, 0x44(%rax)
movq (%rsp), %rdi
movl $0x2, %esi
callq 0x4f80
movq (%rsp), %rax
movl $0x1, 0x48(%rax)
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: version_handler
int32_t version_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    conn *c = (conn*)argv;
    out_string(c, "VERSION " VERSION);
    return COMMAND_OK;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x3ecd(%rip), %rsi      # 0xc835
callq 0x4fc0
xorl %eax, %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: quit_handler
int32_t quit_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    conn *c = (conn*)argv;
    conn_set_state(c, conn_closing);
    return COMMAND_OK;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
movl $0x5, %esi
callq 0x4f80
xorl %eax, %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
leaq 0x88e5(%rip), %rdi      # 0x112f0
callq 0xaf40
movq 0x28(%rsp), %rdi
leaq 0x3e27(%rip), %rsi      # 0xc843
callq 0x2250
cmpl $0x0, %eax
jne 0x8a53
leaq 0x8923(%rip), %rax      # 0x11350
movl (%rax), %ecx
leaq 0x8862(%rip), %rax      # 0x11298
movl %ecx, 0x1c(%rax)
movq (%rsp), %rdi
leaq 0x3e09(%rip), %rsi      # 0xc84d
callq 0x4fc0
movl $0x0, 0x34(%rsp)
jmp 0x8ac5
movq 0x28(%rsp), %rdi
leaq 0x3df1(%rip), %rsi      # 0xc850
leaq 0x10(%rsp), %rdx
movb $0x0, %al
callq 0x22f0
movl %eax, 0xc(%rsp)
cmpl $0x1, 0xc(%rsp)
je 0x8a90
movq (%rsp), %rdi
leaq 0x39d6(%rip), %rsi      # 0xc457
callq 0x4fc0
movl $0x0, 0x34(%rsp)
jmp 0x8ac5
movq 0x10(%rsp), %rdi
leaq 0x8854(%rip), %rsi      # 0x112f0
callq 0xaf70
movl %eax, %ecx
leaq 0x87ee(%rip), %rax      # 0x11298
movl %ecx, 0x1c(%rax)
movq (%rsp), %rdi
leaq 0x3d95(%rip), %rsi      # 0xc84d
callq 0x4fc0
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x28(%rsp), %rax
addq $0x3, %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
leaq 0x8798(%rip), %rax      # 0x11298
cmpl $0x0, 0x20(%rax)
jne 0x8b23
movq (%rsp), %rdi
leaq 0x3954(%rip), %rsi      # 0xc465
callq 0x4fc0
movl $0x0, 0x34(%rsp)
jmp 0x8bab
movq 0x8(%rsp), %rdi
leaq 0x395a(%rip), %rsi      # 0xc489
leaq 0x14(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movb $0x0, %al
callq 0x22f0
cmpl $0x2, %eax
jne 0x8b93
cmpl $0x0, 0x14(%rsp)
jl 0x8b5d
cmpl $0x8000, 0x14(%rsp)     # imm = 0x8000
jge 0x8b5d
cmpl $0x0, 0x10(%rsp)
jg 0x8b5f
jmp 0x8b7b
movl 0x14(%rsp), %ecx
movq (%rsp), %rax
movl %ecx, 0xe8(%rax)
movl 0x10(%rsp), %ecx
movq (%rsp), %rax
movl %ecx, 0xec(%rax)
movq (%rsp), %rdi
movl $0x1, %esi
callq 0x4f80
movl $0x0, 0x34(%rsp)
jmp 0x8bab
movq (%rsp), %rdi
leaq 0x391b(%rip), %rsi      # 0xc4b9
callq 0x4fc0
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
leaq 0x86c3(%rip), %rax      # 0x11298
cmpl $0x1, 0x18(%rax)
jle 0x8bff
movq 0x8416(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq 0x10(%rsp), %rax
movl (%rax), %edx
movq 0x8(%rsp), %rcx
leaq 0x3c60(%rip), %rsi      # 0xc858
movb $0x0, %al
callq 0x2280
jmp 0x8c01
movq 0x10(%rsp), %rax
movl $0x0, 0x98(%rax)
movq 0x10(%rsp), %rax
movl $0x0, 0x94(%rax)
movq 0x10(%rsp), %rax
movl $0x0, 0x84(%rax)
movq 0x10(%rsp), %rdi
callq 0x52d0
cmpl $0x0, %eax
je 0x8c50
movq 0x10(%rsp), %rdi
leaq 0x360d(%rip), %rsi      # 0xc256
callq 0x4fc0
jmp 0x8c83
leaq 0x8639(%rip), %rax      # 0x11290
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rcx
xorl %edx, %edx
callq 0x4470
cmpl $0x0, %eax
jge 0x8c81
movq 0x10(%rsp), %rdi
leaq 0x37db(%rip), %rsi      # 0xc457
callq 0x4fc0
jmp 0x8c83
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq 0x18(%rsp), %rax
movl $0x10, 0xd4(%rax)
movq 0x18(%rsp), %rax
movl (%rax), %edi
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x18(%rsp), %rax
movslq 0x28(%rax), %rdx
movq 0x18(%rsp), %r8
addq $0xc4, %r8
movq 0x18(%rsp), %r9
addq $0xd4, %r9
xorl %ecx, %ecx
callq 0x2310
movl %eax, 0x14(%rsp)
cmpl $0x8, 0x14(%rsp)
jle 0x8ec6
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
movslq 0x14(%rsp), %rcx
leaq 0x84e7(%rip), %rax      # 0x112f0
addq 0x48(%rax), %rcx
leaq 0x84dc(%rip), %rax      # 0x112f0
movq %rcx, 0x48(%rax)
movq 0x8(%rsp), %rax
movzbl (%rax), %ecx
shll $0x8, %ecx
movq 0x8(%rsp), %rax
movzbl 0x1(%rax), %eax
addl %eax, %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0xc0(%rax)
movq 0x8(%rsp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
jne 0x8e55
movq 0x8(%rsp), %rax
movzbl 0x5(%rax), %eax
cmpl $0x1, %eax
je 0x8e70
movq 0x18(%rsp), %rdi
leaq 0x39ff(%rip), %rsi      # 0xc860
callq 0x4fc0
movl $0x0, 0x24(%rsp)
jmp 0x8ece
movl 0x14(%rsp), %eax
subl $0x8, %eax
movl %eax, 0x14(%rsp)
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rsi
addq $0x8, %rsi
movslq 0x14(%rsp), %rdx
callq 0x2380
movl 0x14(%rsp), %ecx
movq 0x18(%rsp), %rax
addl 0x2c(%rax), %ecx
movl %ecx, 0x2c(%rax)
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x20(%rax)
movl $0x1, 0x24(%rsp)
jmp 0x8ece
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: update_event
int update_event(conn *c, int new_flags) {
    if (c->ev_flags == new_flags)
        return 1;
    c->ev_flags = new_flags;
    if(aeCreateFileEvent(g_el, c->sfd, AE_READABLE, event_handler, (void *)c) == AE_ERR) {
        return 0;
    }
    return 1;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movl %esi, 0x4(%rsp)
movq 0x8(%rsp), %rax
movswl 0x10(%rax), %eax
cmpl 0x4(%rsp), %eax
jne 0x9136
movl $0x1, 0x14(%rsp)
jmp 0x9184
movl 0x4(%rsp), %eax
movw %ax, %cx
movq 0x8(%rsp), %rax
movw %cx, 0x10(%rax)
leaq 0x813b(%rip), %rax      # 0x11288
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movl (%rax), %esi
movq 0x8(%rsp), %r8
movl $0x1, %edx
leaq 0x28(%rip), %rcx        # 0x9190
callq 0x29b0
cmpl $-0x1, %eax
jne 0x917c
movl $0x0, 0x14(%rsp)
jmp 0x9184
movl $0x1, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: event_handler
void event_handler(aeEventLoop *el, int fd, void *privdata, int mask) {
    AE_NOTUSED(el); 
    AE_NOTUSED(mask); 

    conn *c;
    c = (conn *)privdata;
    /*
     * c->which = which;
     */

    /* sanity */
    if (fd != c->sfd) {
        LOG_INFO("Catastrophic: event fd doesn't match conn fd!\n");
        conn_close(c);
        return;
    }

    /* do as much I/O as possible until we block */
    drive_machine(c);

    /* wait for next event */
    return;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movq %rdx, 0x10(%rsp)
movl %ecx, 0xc(%rsp)
movq 0x10(%rsp), %rax
movq %rax, (%rsp)
movl 0x1c(%rsp), %eax
movq (%rsp), %rcx
cmpl (%rcx), %eax
je 0x91ef
jmp 0x91bd
leaq 0x80d4(%rip), %rax      # 0x11298
cmpl $0x0, 0x18(%rax)
jle 0x91e2
movq 0x7e27(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x37a8(%rip), %rsi      # 0xc983
movb $0x0, %al
callq 0x2280
jmp 0x91e4
movq (%rsp), %rdi
callq 0x4bf0
jmp 0x91f8
movq (%rsp), %rdi
callq 0x9480
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movl %edi, 0x10(%rsp)
movl 0x10(%rsp), %ecx
movl $0x1, %esi
movl $0x2, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
movl $0x2, %edi
xorl %edx, %edx
callq 0x2470
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
jne 0x9ce7
leaq 0x2cda(%rip), %rdi      # 0xc9b2
callq 0x23d0
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x9d48
movl 0xc(%rsp), %edi
movl $0x3, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x20e0
movl %eax, 0x8(%rsp)
cmpl $0x0, %eax
jl 0x9d21
movl 0xc(%rsp), %edi
movl 0x8(%rsp), %edx
orl $0x800, %edx            # imm = 0x800
movl $0x4, %esi
movb $0x0, %al
callq 0x20e0
cmpl $0x0, %eax
jge 0x9d40
leaq 0x2bd1(%rip), %rdi      # 0xc8f9
callq 0x23d0
movl 0xc(%rsp), %edi
callq 0x21d0
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x9d48
movl 0xc(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)