LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/ae.c
// Function: aeResizeSetSize
int aeResizeSetSize(aeEventLoop *eventLoop, int setsize) {
    int i;

    if (setsize == eventLoop->setsize) return AE_OK;
    if (eventLoop->maxfd >= setsize) return AE_ERR;
    if (aeApiResize(eventLoop,setsize) == -1) return AE_ERR;

    eventLoop->events = realloc(eventLoop->events,sizeof(aeFileEvent)*setsize);
    eventLoop->fired = realloc(eventLoop->fired,sizeof(aeFiredEvent)*setsize);
    eventLoop->setsize = setsize;

    /* Make sure that if we created new slots, they are initialized with
     * an AE_NONE mask. */
    for (i = eventLoop->maxfd+1; i < setsize; i++)
        eventLoop->events[i].mask = AE_NONE;
    return AE_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpl %esi, 0x4(%rdi)
je 0x270b
movq %rdi, %r14
cmpl %esi, (%rdi)
jge 0x2708
movq 0x38(%r14), %r12
movq 0x8(%r12), %rdi
movslq %esi, %r15
imulq $0xc, %r15, %rsi
callq 0x2310
movq %rax, 0x8(%r12)
movq 0x18(%r14), %rdi
movq %r15, %rsi
shlq $0x5, %rsi
callq 0x2310
movq %rax, 0x18(%r14)
movq 0x20(%r14), %rdi
leaq (,%r15,8), %rsi
callq 0x2310
movq %rax, 0x20(%r14)
movl %r15d, 0x4(%r14)
movslq (%r14), %rax
leaq 0x1(%rax), %rcx
shlq $0x5, %rax
addq $0x20, %rax
cmpq %r15, %rcx
jge 0x270b
movq 0x18(%r14), %rdx
andl $0x0, (%rdx,%rax)
incq %rcx
jmp 0x26f2
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/ae.c
// Function: aeDeleteTimeEvent
int aeDeleteTimeEvent(aeEventLoop *eventLoop, long long id)
{
    aeTimeEvent *te, *prev = NULL;

    te = eventLoop->timeEventHead;
    while(te) {
        if (te->id == id) {
            if (prev == NULL)
                eventLoop->timeEventHead = te->next;
            else
                prev->next = te->next;
            if (te->finalizerProc)
                te->finalizerProc(eventLoop, te->clientData);
            free(te);
            return AE_OK;
        }
        prev = te;
        te = te->next;
    }
    return AE_ERR; /* NO event with the specified ID found */
}

// Assembly:
pushq %rbx
leaq 0x28(%rdi), %rcx
xorl %edx, %edx
pushq $-0x1
popq %rax
movq %rcx, %r8
movq (%r8), %rbx
testq %rbx, %rbx
je 0x2a45
cmpq %rsi, (%rbx)
je 0x2a1a
leaq 0x30(%rbx), %r8
movq %rbx, %rdx
jmp 0x2a04
leaq 0x30(%rdx), %rax
testq %rdx, %rdx
cmoveq %rcx, %rax
movq 0x30(%rbx), %rcx
movq %rcx, (%rax)
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x2a3b
movq 0x28(%rbx), %rsi
callq *%rax
movq %rbx, %rdi
callq 0x2030
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/assoc.c
// Function: assoc_init
void assoc_init(void) {
    unsigned int hash_size = hashsize(HASHPOWER) * sizeof(void*);
    hashtable = malloc(hash_size);
    if (! hashtable) {
        fprintf(stderr, "Failed to init hashtable.\n");
        exit(1);
    }
    memset(hashtable, 0, hash_size);
}

// Assembly:
pushq %rax
pushq $0x1
popq %rdi
movl $0x800000, %esi         # imm = 0x800000
callq 0x2220
movq %rax, 0xa25c(%rip)      # 0xd258
testq %rax, %rax
je 0x3003
popq %rax
retq
movq 0x9fee(%rip), %rax      # 0xcff8
movq (%rax), %rcx
leaq 0x5024(%rip), %rdi      # 0x8038
pushq $0x1a
popq %rsi
pushq $0x1
popq %rdx
callq 0x2420
pushq $0x1
popq %rdi
callq 0x2410
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/assoc.c
// Function: assoc_find
item *assoc_find(char *key) {
    ub4 hv = hash(key, strlen(key), 0) & hashmask(HASHPOWER);
    item *it = hashtable[hv];

    while (it) {
        if (strcmp(key, ITEM_key(it)) == 0)
            return it;
        it = it->h_next;
    }
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x2120
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x2e08
movq %rax, %r14
andl $0xfffff, %r14d         # imm = 0xFFFFF
shll $0x3, %r14d
addq 0xa203(%rip), %r14      # 0xd258
movq (%r14), %r14
testq %r14, %r14
je 0x3073
leaq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0x2230
testl %eax, %eax
je 0x3073
addq $0x10, %r14
jmp 0x3055
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/assoc.c
// Function: assoc_insert
int assoc_insert(char *key, item *it) {
    ub4 hv;
    assert(assoc_find(key) == 0);  /* shouldn't have duplicately named things defined */
    hv = hash(key, strlen(key), 0) & hashmask(HASHPOWER);
    it->h_next = hashtable[hv];
    hashtable[hv] = it;
    return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2120
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x2e08
andl $0xfffff, %eax          # imm = 0xFFFFF
movq 0xa1b2(%rip), %rcx      # 0xd258
movq (%rcx,%rax,8), %rdx
movq %rdx, 0x10(%rbx)
movq %rbx, (%rcx,%rax,8)
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/assoc.c
// Function: assoc_delete
void assoc_delete(char *key) {
    item **before = _hashitem_before(key);
    if (*before) {
        item *nxt = (*before)->h_next;
        (*before)->h_next = 0;   /* probably pointless, but whatever. */
        *before = nxt;
        return;
    }
    /* Note:  we never actually get here.  the callers don't delete things
       they can't find. */
    assert(*before != 0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x2120
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x2e08
movq %rax, %r14
andl $0xfffff, %r14d         # imm = 0xFFFFF
shll $0x3, %r14d
addq 0xa16c(%rip), %r14      # 0xd258
movq %r14, %r15
movq (%r14), %r14
testq %r14, %r14
je 0x3115
leaq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0x2230
addq $0x10, %r14
testl %eax, %eax
jne 0x30ec
movq (%r14), %rax
andq $0x0, (%r14)
movq %rax, (%r15)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/command.c
// Function: command_service_create
command_service_ptr command_service_create() {
    command_service_ptr cmd_srv;
    cmd_srv = (command_service_ptr)calloc(1, sizeof(command_service));
    if (NULL == cmd_srv) {
        exit(-1);
    }
    return cmd_srv;
}

// Assembly:
pushq %rax
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x2220
testq %rax, %rax
je 0x312f
popq %rcx
retq
pushq $-0x1
popq %rdi
callq 0x2410
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/command.c
// Function: command_service_run
int32_t command_service_run(command_service_ptr service, char *cmd_s, int argc, char **argv) {
    command_info_ptr cmd;
    for (cmd = service->command_list; NULL != cmd; cmd = cmd->next) {
        if (FIXED_PREFIX == cmd->type && strncmp(cmd_s, cmd->cmd, cmd->cmd_len) == 0) {
            return cmd->handler(cmd_s, argc, argv);
        }
        if (FULL_MATCH == cmd->type && strcmp(cmd_s, cmd->cmd) == 0) {
            return cmd->handler(cmd_s, argc, argv);
        }
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
movq (%r15), %r15
testq %r15, %r15
je 0x3322
movl 0xc(%r15), %eax
testl %eax, %eax
je 0x330d
cmpl $0x1, %eax
jne 0x331c
movq (%r15), %rsi
movl 0x8(%r15), %edx
movq %r14, %rdi
callq 0x2070
jmp 0x3318
movq (%r15), %rsi
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
je 0x3330
addq $0x18, %r15
jmp 0x32e7
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r15), %rax
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rax
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/command.c
// Function: command_service_destory
void command_service_destory(command_service_ptr service) {
    command_info_ptr cmd, next_cmd;
    
    if (NULL == service) {
        return;
    }
    cmd = service->command_list;
    while (NULL != cmd) {
        next_cmd = cmd->next;
        free(cmd->cmd);
        free(cmd);
        cmd = next_cmd;
    }
}

// Assembly:
testq %rdi, %rdi
je 0x3379
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %rbx
testq %rbx, %rbx
je 0x3372
movq (%rbx), %rdi
movq 0x18(%rbx), %r14
callq 0x2030
movq %rbx, %rdi
callq 0x2030
movq %r14, %rbx
jmp 0x3354
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/connection.c
// Function: conn_cleanup
void conn_cleanup(conn *c) {
    if (c->item) {
        item_free(c->item);
        c->item = 0;
    }

    if (c->ileft) {
        for (; c->ileft > 0; c->ileft--,c->icurr++) {
            item_remove(*(c->icurr));
        }
    }

    if (c->write_and_free) {
        free(c->write_and_free);
        c->write_and_free = 0;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x68(%rdi), %rdi
testq %rdi, %rdi
je 0x36c2
callq 0x3e61
andq $0x0, 0x68(%rbx)
movl 0xb8(%rbx), %eax
testl %eax, %eax
je 0x36f7
testl %eax, %eax
jle 0x36f7
movq 0xb0(%rbx), %rax
movq (%rax), %rdi
callq 0x3fb4
movl 0xb8(%rbx), %eax
decl %eax
movl %eax, 0xb8(%rbx)
addq $0x8, 0xb0(%rbx)
jmp 0x36cc
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x370a
callq 0x2030
andq $0x0, 0x50(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/connection.c
// Function: conn_close
void conn_close(conn *c) {
    /* delete the event, the socket and the conn */
    aeDeleteFileEvent(g_el, c->sfd, AE_READABLE); 
    aeDeleteFileEvent(g_el, c->sfd, AE_WRITABLE);

    LOG_DEBUG_F1("<%d connection closed.\n", c->sfd);

    close(c->sfd);
    conn_cleanup(c);

    /* if the connection has big buffers, just free it */
    if (c->rsize > READ_BUFFER_HIGHWAT) {
        conn_free(c);
    } else if (freecurr < freetotal) {
        /* if we have enough space in the free connections array, put the structure there */
        freeconns[freecurr++] = c;
    } else {
        /* try to enlarge free connections array */
        conn **new_freeconns = realloc(freeconns, sizeof(conn *)*freetotal*2);
        if (new_freeconns) {
            freetotal *= 2;
            freeconns = new_freeconns;
            freeconns[freecurr++] = c;
        } else {
            conn_free(c);
        }
    }

    -- stats.curr_conns;

    return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x9b5d(%rip), %r14      # 0xd278
movq (%r14), %rdi
movl (%rbx), %esi
pushq $0x1
popq %rdx
callq 0x2827
movq (%r14), %rdi
movl (%rbx), %esi
pushq $0x2
popq %rdx
callq 0x2827
leaq 0x9b4c(%rip), %rax      # 0xd288
cmpl $0x2, 0x18(%rax)
jge 0x37d3
movl (%rbx), %edi
callq 0x21b0
movq %rbx, %rdi
callq 0x36ab
cmpl $0x2001, 0x28(%rbx)     # imm = 0x2001
jl 0x3768
movq %rbx, %rdi
callq 0x37f2
jmp 0x37c3
movslq 0x9af5(%rip), %r14      # 0xd264
movslq 0x9aea(%rip), %r15      # 0xd260
movq 0x9aeb(%rip), %rdi      # 0xd268
cmpl %r15d, %r14d
jge 0x3793
movl %r14d, %eax
incl %eax
movl %eax, 0x9ad7(%rip)      # 0xd264
movq %rbx, (%rdi,%r14,8)
jmp 0x37c3
movq %r15, %rsi
shlq $0x4, %rsi
callq 0x2310
testq %rax, %rax
je 0x375e
addl %r15d, %r15d
movl %r15d, 0x9ab2(%rip)     # 0xd260
movq %rax, 0x9ab3(%rip)      # 0xd268
leal 0x1(%r14), %ecx
movl %ecx, 0x9aa5(%rip)      # 0xd264
movq %rbx, (%rax,%r14,8)
leaq 0x9b16(%rip), %rax      # 0xd2e0
decl 0x10(%rax)
popq %rbx
popq %r14
popq %r15
retq
movq 0x981e(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movl (%rbx), %edx
leaq 0x49fb(%rip), %rsi      # 0x81e1
xorl %eax, %eax
callq 0x2260
jmp 0x3746
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/connection.c
// Function: conn_free
static void conn_free(conn *c) {
    if (c) {
        if (c->hdrbuf)
            free(c->hdrbuf);
        if (c->msglist)
            free(c->msglist);
        if (c->rbuf)
            free(c->rbuf);
        if (c->wbuf)
            free(c->wbuf);
        if (c->ilist)
            free(c->ilist);
        if (c->iov)
            free(c->iov);
        free(c);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x3843
pushq %rbx
movq %rdi, %rbx
movq 0xd8(%rdi), %rdi
callq 0x2030
movq 0x88(%rbx), %rdi
callq 0x2030
movq 0x18(%rbx), %rdi
callq 0x2030
movq 0x30(%rbx), %rdi
callq 0x2030
movq 0xa0(%rbx), %rdi
callq 0x2030
movq 0x78(%rbx), %rdi
callq 0x2030
movq %rbx, %rdi
popq %rbx
jmp 0x2030
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/connection.c
// Function: do_realloc
int do_realloc(void **orig, int newsize, int bytes_per_item, int *size) {
    void *newbuf = realloc(*orig, newsize * bytes_per_item);
    if (newbuf) {
        *orig = newbuf;
        *size = newsize;
       return 1;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rcx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq (%rdi), %rdi
imull %esi, %edx
movslq %edx, %rsi
callq 0x2310
testq %rax, %rax
je 0x386d
movq %rax, (%r14)
movl %ebp, (%rbx)
pushq $0x1
popq %rax
jmp 0x386f
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/connection.c
// Function: conn_shrink
void conn_shrink(conn *c) {
    if (c->udp)
        return;

    if (c->rsize > READ_BUFFER_HIGHWAT && c->rbytes < DATA_BUFFER_SIZE) {
       do_realloc((void **)&c->rbuf, DATA_BUFFER_SIZE, 1, &c->rsize);
    }

    if (c->isize > ITEM_LIST_HIGHWAT) {
        do_realloc((void **)&c->ilist, ITEM_LIST_INITIAL, sizeof(c->ilist[0]), &c->isize);
    }

    if (c->msgsize > MSG_LIST_HIGHWAT) {
        do_realloc((void **)&c->msglist, MSG_LIST_INITIAL, sizeof(c->msglist[0]), &c->msgsize);
    }

    if (c->iovsize > IOV_LIST_HIGHWAT) {
        do_realloc((void **)&c->iov, IOV_LIST_INITIAL, sizeof(c->iov[0]), &c->iovsize);
    }
}

// Assembly:
pushq %rbx
cmpl $0x0, 0xbc(%rdi)
jne 0x391d
movq %rdi, %rbx
cmpl $0x2001, 0x28(%rdi)     # imm = 0x2001
jl 0x38ac
cmpl $0x7ff, 0x2c(%rbx)      # imm = 0x7FF
jg 0x38ac
leaq 0x28(%rbx), %rcx
leaq 0x18(%rbx), %rdi
pushq $0x1
popq %rdx
movl $0x800, %esi            # imm = 0x800
callq 0x3844
cmpl $0x191, 0xa8(%rbx)      # imm = 0x191
jl 0x38d3
leaq 0xa8(%rbx), %rcx
leaq 0xa0(%rbx), %rdi
pushq $0x8
popq %rdx
movl $0xc8, %esi
callq 0x3844
cmpl $0x65, 0x90(%rbx)
jl 0x38f5
leaq 0x90(%rbx), %rcx
leaq 0x88(%rbx), %rdi
pushq $0xa
popq %rsi
pushq $0x38
popq %rdx
callq 0x3844
cmpl $0x259, 0x80(%rbx)      # imm = 0x259
jl 0x391d
leaq 0x80(%rbx), %rcx
addq $0x78, %rbx
pushq $0x10
popq %rdx
movq %rbx, %rdi
movl $0x190, %esi            # imm = 0x190
popq %rbx
jmp 0x3844
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/connection.c
// Function: conn_set_state
void conn_set_state(conn *c, int state) {
    if (state != c->state) {
        if (state == conn_read) {
            conn_shrink(c);
        }
        c->state = state;
    }
}

// Assembly:
cmpl %esi, 0x4(%rdi)
je 0x3945
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
cmpl $0x1, %esi
jne 0x393a
movq %r14, %rdi
callq 0x3874
movl %ebx, 0x4(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/connection.c
// Function: out_string
void out_string(conn *c, char *str) {
    int len;

    LOG_DEBUG_F2(">%d %s\n", c->sfd, str);

    len = strlen(str);
    if (len + 2 > c->wsize) {
        /* ought to be always enough. just fail for simplicity */
        str = "SERVER_ERROR output line too long";
        len = strlen(str);
    }

    strcpy(c->wbuf, str);
    strcpy(c->wbuf + len, "\r\n");
    c->wbytes = len + 2;
    c->wcurr = c->wbuf;

    conn_set_state(c, conn_write);
    c->write_and_go = conn_read;
    return;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x9931(%rip), %rax      # 0xd288
cmpl $0x2, 0x18(%rax)
jge 0x39be
movq %r14, %rdi
callq 0x2120
leal 0x2(%rax), %ecx
cmpl 0x40(%rbx), %ecx
leaq 0x488f(%rip), %rsi      # 0x8201
cmovleq %r14, %rsi
pushq $0x21
popq %rbp
cmovlel %eax, %ebp
movq 0x30(%rbx), %rdi
callq 0x2090
movq 0x30(%rbx), %rax
movslq %ebp, %rcx
movw $0xa0d, (%rax,%rcx)     # imm = 0xA0D
movb $0x0, 0x2(%rax,%rcx)
addl $0x2, %ecx
movl %ecx, 0x44(%rbx)
movq 0x30(%rbx), %rax
movq %rax, 0x38(%rbx)
cmpl $0x2, 0x4(%rbx)
je 0x39b2
movl $0x2, 0x4(%rbx)
movl $0x1, 0x48(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
movq 0x9633(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movl (%rbx), %edx
leaq 0x4828(%rip), %rsi      # 0x81f9
movq %r14, %rcx
xorl %eax, %eax
callq 0x2260
jmp 0x395d
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/connection.c
// Function: add_iov
int add_iov(conn *c, const void *buf, int len) {
    struct msghdr *m;
    int leftover;
    int limit_to_mtu;

    do {
        m = &c->msglist[c->msgused - 1];

        /*
         * Limit UDP packets, and the first payloads of TCP replies, to
         * UDP_MAX_PAYLOAD_SIZE bytes.
         */
        limit_to_mtu = c->udp || (1 == c->msgused);

        /* We may need to start a new msghdr if this one is full. */
        if (m->msg_iovlen == IOV_MAX ||
                (limit_to_mtu && c->msgbytes >= UDP_MAX_PAYLOAD_SIZE)) {
            add_msghdr(c);
            m = &c->msglist[c->msgused - 1];
        }

        if (ensure_iov_space(c))
            return -1;

        /* If the fragment is too big to fit in the datagram, split it up */
        if (limit_to_mtu && len + c->msgbytes > UDP_MAX_PAYLOAD_SIZE) {
            leftover = len + c->msgbytes - UDP_MAX_PAYLOAD_SIZE;
            len -= leftover;
        } else {
            leftover = 0;
        }

        m = &c->msglist[c->msgused - 1];
        m->msg_iov[m->msg_iovlen].iov_base = (void*) buf;
        m->msg_iov[m->msg_iovlen].iov_len = len;

        c->msgbytes += len;
        c->iovused++;
        m->msg_iovlen++;

        buf = ((char *)buf) + len;
        len = leftover;
    } while (leftover > 0);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movq 0x88(%rdi), %rax
movslq 0x94(%rdi), %rcx
imulq $0x38, %rcx, %rdx
movq -0x20(%rax,%rdx), %rdx
pushq $-0x1
popq %rbp
cmpl $0x0, 0xbc(%r14)
setne %al
cmpl $0x1, %ecx
sete %r12b
orb %al, %r12b
cmpq $0x400, %rdx            # imm = 0x400
jne 0x3a30
movq %r14, %rdi
callq 0x3ada
jmp 0x3a42
testb %r12b, %r12b
je 0x3a42
cmpl $0x578, 0x9c(%r14) # imm = 0x578
jge 0x3a26
movq %r14, %rdi
xorl %eax, %eax
callq 0x45b4
testl %eax, %eax
jne 0x3acf
movl 0x9c(%r14), %edi
xorl %eax, %eax
testb %r12b, %r12b
je 0x3a75
leal (%rdi,%r15), %esi
cmpl $0x579, %esi            # imm = 0x579
jl 0x3a75
addl $0xfffffa88, %esi       # imm = 0xFFFFFA88
subl %esi, %r15d
jmp 0x3a77
xorl %esi, %esi
movq 0x88(%r14), %r8
movslq 0x94(%r14), %rcx
imulq $0x38, %rcx, %r9
movq -0x28(%r8,%r9), %r10
movq -0x20(%r8,%r9), %rdx
movq %rdx, %r11
shlq $0x4, %r11
movq %rbx, (%r10,%r11)
movslq %r15d, %r15
movq %r15, 0x8(%r10,%r11)
addl %r15d, %edi
movl %edi, 0x9c(%r14)
incl 0x84(%r14)
incq %rdx
movq %rdx, -0x20(%r8,%r9)
addq %r15, %rbx
movl %esi, %r15d
testl %esi, %esi
jne 0x3a08
jmp 0x3ad1
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/connection.c
// Function: add_msghdr
int add_msghdr(conn *c) {
    struct msghdr *msg;

    if (c->msgsize == c->msgused) {
        msg = realloc(c->msglist, c->msgsize * 2 * sizeof(struct msghdr));
        if (! msg)
            return -1;
        c->msglist = msg;
        c->msgsize *= 2;
    }

    msg = c->msglist + c->msgused;

    /* this wipes msg_iovlen, msg_control, msg_controllen, and
       msg_flags, the last 3 of which aren't defined on solaris: */
    memset(msg, 0, sizeof(struct msghdr));

    msg->msg_iov = &c->iov[c->iovused];
    msg->msg_name = &c->request_addr;
    msg->msg_namelen = c->request_addr_size;

    c->msgbytes = 0;
    c->msgused++;

    if (c->udp) {
        /* Leave room for the UDP header, which we'll fill in later. */
        return add_iov(c, NULL, UDP_HEADER_SIZE);
    }

    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movslq 0x90(%rdi), %rdx
movl 0x94(%rdi), %ecx
movq 0x88(%rdi), %rax
cmpl %ecx, %edx
jne 0x3b1e
imulq $0x70, %rdx, %rsi
movq %rax, %rdi
callq 0x2310
testq %rax, %rax
je 0x3b8d
movq %rax, 0x88(%rbx)
shll 0x90(%rbx)
movl 0x94(%rbx), %ecx
movslq %ecx, %rcx
imulq $0x38, %rcx, %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax,%rcx)
movups %xmm0, 0x10(%rax,%rcx)
movups %xmm0, (%rax,%rcx)
andq $0x0, 0x30(%rax,%rcx)
movslq 0x84(%rbx), %rdx
shlq $0x4, %rdx
addq 0x78(%rbx), %rdx
movq %rdx, 0x10(%rax,%rcx)
leaq 0xc4(%rbx), %rdx
movq %rdx, (%rax,%rcx)
movl 0xd4(%rbx), %edx
movl %edx, 0x8(%rax,%rcx)
andl $0x0, 0x9c(%rbx)
incl 0x94(%rbx)
cmpl $0x0, 0xbc(%rbx)
je 0x3b89
pushq $0x8
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x39dd
xorl %eax, %eax
jmp 0x3b90
pushq $-0x1
popq %rax
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movl %edi, %r14d
callq 0x2450
movl %eax, %ebx
cmpl $-0x1, %eax
je 0x3bd5
testl %ebx, %ebx
jne 0x3c25
callq 0x21c0
pushq $-0x1
popq %rbx
cmpl $-0x1, %eax
je 0x3bd5
testl %r14d, %r14d
jne 0x3bcf
leaq 0x465d(%rip), %rdi      # 0x8223
callq 0x2130
testl %eax, %eax
js 0x3bd5
xorl %ebx, %ebx
testl %ebp, %ebp
je 0x3bdc
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x4642(%rip), %rdi      # 0x8225
xorl %ebx, %ebx
pushq $0x2
popq %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2380
cmpl $-0x1, %eax
je 0x3bd5
movl %eax, %ebp
xorl %ebx, %ebx
movl %eax, %edi
xorl %esi, %esi
callq 0x2160
pushq $0x1
popq %rsi
movl %ebp, %edi
callq 0x2160
pushq $0x2
popq %rsi
movl %ebp, %edi
callq 0x2160
cmpl $0x3, %ebp
jl 0x3bd5
movl %ebp, %edi
callq 0x21b0
jmp 0x3bd5
xorl %edi, %edi
callq 0x2080
// File: /workspace/github_c_makefile_star2_O2/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:
leaq 0xa71d(%rip), %rax      # 0xe350
xorl %ecx, %ecx
leaq 0x9714(%rip), %rdx      # 0xd350
leaq 0x9f0d(%rip), %rsi      # 0xdb50
cmpq $0x7f8, %rcx            # imm = 0x7F8
je 0x3c63
andq $0x0, (%rcx,%rdx)
andq $0x0, (%rcx,%rsi)
andl $0x0, (%rax)
addq $0x8, %rcx
addq $0x4, %rax
jmp 0x3c43
retq
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movl %edx, %ebx
movl %esi, %ebp
callq 0x2120
movq %rax, %rcx
leal 0x1(%rax), %esi
pushq $0x4
popq %rdi
movl %esi, %eax
cltd
idivl %edi
subl %edx, %ecx
addl $0x5, %ecx
testl %edx, %edx
cmovel %esi, %ecx
movl %ecx, (%r14)
leal -0x2(%rbx), %ecx
leaq 0x458c(%rip), %rsi      # 0x822f
movq %r12, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2400
movl %eax, (%r15)
movl (%r14), %ecx
addl %eax, %ebx
leal (%rcx,%rbx), %eax
addl $0x30, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
movq %rdi, %rbx
movb 0x27(%rdi), %al
testb $0x1, %al
je 0x3e4f
andb $-0x2, %al
movb %al, 0x27(%rbx)
movzbl 0x29(%rbx), %eax
movzbl 0x26(%rbx), %ecx
addq %rax, %rcx
movslq 0x20(%rbx), %rax
addq %rcx, %rax
leaq 0x94b6(%rip), %rcx      # 0xd2e0
movq 0x8(%rcx), %rdx
negq %rax
addq %rdx, %rax
addq $-0x30, %rax
movq %rax, 0x8(%rcx)
decl (%rcx)
leaq 0x30(%rbx), %rdi
callq 0x30bd
movq %rbx, %rdi
callq 0x3eff
cmpw $0x0, 0x24(%rbx)
je 0x3e58
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0x3e61
// File: /workspace/github_c_makefile_star2_O2/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:
movq %rdi, %rsi
movzbl 0x29(%rdi), %eax
movzbl 0x26(%rdi), %ecx
addl %eax, %ecx
movl 0x20(%rdi), %eax
leal (%rax,%rcx), %edx
addl $0x30, %edx
movb $0x0, 0x28(%rdi)
orb $0x4, 0x27(%rdi)
leaq 0x94b2(%rip), %rax      # 0xd338
movq (%rax), %rdi
jmp 0x44cd
// File: /workspace/github_c_makefile_star2_O2/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:
movzbl 0x28(%rdi), %eax
andq $0x0, 0x8(%rdi)
leaq 0x9489(%rip), %rcx      # 0xd350
movq (%rcx,%rax,8), %rdx
movq %rdx, (%rdi)
testq %rdx, %rdx
je 0x3ed7
movq %rdi, 0x8(%rdx)
leal (,%rax,8), %edx
movq %rdi, (%rdx,%rcx)
leaq 0x9c67(%rip), %rcx      # 0xdb50
cmpq $0x0, (%rdx,%rcx)
jne 0x3ef4
movq %rdi, (%rcx,%rax,8)
leaq 0xa455(%rip), %rcx      # 0xe350
incl (%rcx,%rax,4)
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x9446(%rip), %rcx      # 0xd350
cmpq %rdi, (%rcx,%rax,8)
jne 0x3f17
movq (%rdi), %rdx
movq %rdx, (%rcx,%rax,8)
leaq 0x9c32(%rip), %rcx      # 0xdb50
cmpq %rdi, (%rcx,%rax,8)
jne 0x3f2c
movq 0x8(%rdi), %rdx
movq %rdx, (%rcx,%rax,8)
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
testq %rcx, %rcx
je 0x3f3c
movq %rdx, 0x8(%rcx)
testq %rdx, %rdx
je 0x3f44
movq %rcx, (%rdx)
leaq 0xa405(%rip), %rcx      # 0xe350
decl (%rcx,%rax,4)
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x93e2(%rip), %rax      # 0xd340
movl (%rax), %eax
movl %eax, 0x18(%rdi)
addq $0x30, %rdi
movq %rbx, %rsi
callq 0x307e
movzbl 0x29(%rbx), %eax
movzbl 0x26(%rbx), %ecx
addq %rax, %rcx
movslq 0x20(%rbx), %rax
addq %rcx, %rax
leaq 0x9358(%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 0x3eb7
pushq $0x1
popq %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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:
movzwl 0x24(%rdi), %eax
testw %ax, %ax
je 0x3fc6
decw %ax
movw %ax, 0x24(%rdi)
jne 0x3fd0
testb $0x1, 0x27(%rdi)
je 0x3e61
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x3eff
leaq 0x935f(%rip), %rax      # 0xd340
movl (%rax), %eax
movl %eax, 0x18(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x3eb7
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
cmpl $0xff, %edi
ja 0x40c0
movq %rdx, %rbx
movl %esi, %ebp
movl %edi, %r15d
movl $0x200000, %edi         # imm = 0x200000
callq 0x22c0
testq %rax, %rax
je 0x40c0
movq %rax, %r14
movq %rbx, 0x8(%rsp)
movl %r15d, %eax
leaq 0x9301(%rip), %rcx      # 0xd350
leaq (%rcx,%rax,8), %rbx
xorl %r15d, %r15d
xorl %r12d, %r12d
testl %ebp, %ebp
sete %al
movq (%rbx), %rbx
cmpl %ebp, %r12d
setl %cl
movslq %r15d, %r13
testq %rbx, %rbx
je 0x40c5
orb %cl, %al
je 0x40c5
leaq 0x30(%rbx), %rdx
movl 0x18(%rbx), %r8d
movl 0x20(%rbx), %ecx
addl $-0x2, %ecx
leaq 0x9258(%rip), %rax      # 0xd2e0
addq 0x40(%rax), %r8
leaq 0x10(%rsp), %rdi
leaq 0x41a0(%rip), %rsi      # 0x8238
xorl %eax, %eax
callq 0x2400
addl %eax, %r15d
cmpl $0x1ffffa, %r15d        # imm = 0x1FFFFA
jg 0x40c5
addq %r14, %r13
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2090
incl %r12d
jmp 0x4059
xorl %r14d, %r14d
jmp 0x40e1
movw $0xa, 0x4(%r14,%r13)
movl $0xd444e45, (%r14,%r13) # imm = 0xD444E45
addl $0x5, %r13d
movq 0x8(%rsp), %rax
movl %r13d, (%rax)
movq %r14, %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x9235(%rip), %rax      # 0xd340
movl (%rax), %ebp
cmpl $0x1000, %esi           # imm = 0x1000
jge 0x412c
movups 0x4145(%rip), %xmm0     # 0x8261
movups %xmm0, 0xb(%rbx)
movups 0x412f(%rip), %xmm0     # 0x8256
movups %xmm0, (%rbx)
jmp 0x418c
leaq 0xa21d(%rip), %r12      # 0xe350
leaq 0x9a16(%rip), %r13      # 0xdb50
leaq 0x4130(%rip), %r14      # 0x8271
xorl %r15d, %r15d
cmpq $0xff, %r15
je 0x4186
movq (%r13), %rax
testq %rax, %rax
je 0x4179
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
jmp 0x4144
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_O2/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 0x41e5
movq %r14, %rdi
callq 0x2030
movq %rbx, %r14
xorl %ebx, %ebx
jmp 0x42a7
xorl %r12d, %r12d
movl $0x20000, %edx          # imm = 0x20000
movq %r14, %rdi
xorl %esi, %esi
callq 0x2190
leaq 0x9152(%rip), %rsi      # 0xd350
pushq $0x20
popq %rdi
cmpq $0xff, %r12
je 0x424d
leaq (%rsi,%r12,8), %r8
movq (%r8), %r8
testq %r8, %r8
je 0x4248
movzbl 0x29(%r8), %eax
movzbl 0x26(%r8), %ecx
addl %eax, %ecx
movl 0x20(%r8), %eax
addl %eax, %ecx
addl $0x30, %ecx
movl %ecx, %eax
cltd
idivl %edi
andl $0x1f, %ecx
cmpl $0x1, %ecx
sbbl $-0x1, %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jg 0x420e
cltq
incl (%r14,%rax,4)
jmp 0x420e
incq %r12
jmp 0x4201
andl $0x0, (%r15)
leaq 0x3fd8(%rip), %r12      # 0x8230
movq %r14, %rbp
xorl %r13d, %r13d
xorl %eax, %eax
movslq %eax, %rdi
cmpq $0x100000, %r13         # imm = 0x100000
je 0x4293
movl (%rbp), %ecx
testl %ecx, %ecx
je 0x4289
addq %rbx, %rdi
movq %r12, %rsi
movl %r13d, %edx
xorl %eax, %eax
callq 0x2400
addl (%r15), %eax
movl %eax, (%r15)
addq $0x20, %r13
addq $0x4, %rbp
jmp 0x4260
movw $0xa, 0x4(%rbx,%rdi)
movl $0xd444e45, (%rbx,%rdi) # imm = 0xD444E45
addl $0x5, %edi
movl %edi, (%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_O2/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 0x4459
xorl %eax, %eax
retq
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rax
cmpq 0x28(%rdi), %rax
jae 0x44a1
movq %rbx, %rdi
callq 0x44a9
testq %rax, %rax
je 0x44a1
movq 0x38(%rbx), %rcx
movq (%rcx,%rax,8), %r14
movq 0x28(%r14), %r15
movq %r14, %rdi
callq 0x714d
testq %rax, %rax
je 0x44a1
cmpq 0x28(%r14), %r15
jae 0x44a3
movq 0x8(%r14), %rcx
addq %rcx, 0x30(%rbx)
jmp 0x44a3
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rdx, %rsi
callq 0x44a9
testq %rax, %rax
je 0x44fb
movq 0x38(%r14), %rcx
movq (%rcx,%rax,8), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x71b2
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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 0x3027
testq %rbx, %rbx
je 0x4527
andl $0x0, (%rbx)
testq %rax, %rax
je 0x4557
testb $0x2, 0x27(%rax)
je 0x4559
testq %rbx, %rbx
sete %cl
leaq 0x8e01(%rip), %rdx      # 0xd340
movl (%rdx), %edx
xorl %esi, %esi
cmpl 0x1c(%rax), %edx
setae %dl
cmovbq %rsi, %rax
orb %cl, %dl
jne 0x4559
movl $0x1, (%rbx)
xorl %eax, %eax
testq %rax, %rax
setne %dl
leaq 0x8d22(%rip), %rcx      # 0xd288
movl 0x1c(%rcx), %ecx
testl %ecx, %ecx
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x458a
leaq 0x8dc1(%rip), %rdx      # 0xd340
cmpl (%rdx), %ecx
ja 0x458f
cmpl %ecx, 0x18(%rax)
ja 0x458f
jmp 0x45a1
testq %rax, %rax
je 0x45a9
movl 0x1c(%rax), %ecx
testl %ecx, %ecx
je 0x45ab
leaq 0x8da3(%rip), %rdx      # 0xd340
cmpl (%rdx), %ecx
ja 0x45ab
movq %rax, %rdi
callq 0x3e01
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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:
movslq 0x80(%rdi), %rsi
xorl %eax, %eax
cmpl %esi, 0x84(%rdi)
jl 0x462a
pushq %rbx
movq %rdi, %rbx
movq 0x78(%rdi), %rdi
shlq $0x5, %rsi
callq 0x2310
testq %rax, %rax
je 0x4626
movq %rax, %rcx
movq %rax, 0x78(%rbx)
shll 0x80(%rbx)
movl 0x94(%rbx), %edx
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
imulq $0x38, %rdx, %rdx
xorl %esi, %esi
xorl %edi, %edi
cmpq %rsi, %rdx
je 0x4629
movslq %edi, %rdi
movq %rdi, %r8
shlq $0x4, %r8
addq %rcx, %r8
movq 0x88(%rbx), %r9
movq %r8, 0x10(%r9,%rsi)
addq 0x18(%r9,%rsi), %rdi
addq $0x38, %rsi
jmp 0x45fd
pushq $-0x1
popq %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
movq %rdi, %rbx
movl 0x94(%rdi), %eax
movq 0xd8(%rdi), %rdi
cmpl 0xe0(%rbx), %eax
jle 0x4681
movslq %eax, %rsi
shlq $0x4, %rsi
testq %rdi, %rdi
je 0x4657
callq 0x2310
jmp 0x465f
movq %rsi, %rdi
callq 0x22c0
movq %rax, %rdi
testq %rax, %rax
je 0x46f5
movq %rdi, 0xd8(%rbx)
movl 0x94(%rbx), %eax
leal (%rax,%rax), %ecx
movl %ecx, 0xe0(%rbx)
pushq $0x2
popq %rsi
xorl %r9d, %r9d
movl $0x100, %r8d            # imm = 0x100
xorl %ecx, %ecx
cltq
cmpq %rax, %rcx
jge 0x46f9
movq 0x88(%rbx), %rax
movq (%rax,%rsi,8), %rax
movq %rdi, (%rax)
movq $0x8, 0x8(%rax)
movl 0xc0(%rbx), %eax
cltd
idivl %r8d
movb %al, (%rdi)
movb 0xc0(%rbx), %al
movb %al, 0x1(%rdi)
movb %ch, 0x2(%rdi)
movb %cl, 0x3(%rdi)
movl 0x94(%rbx), %eax
cltd
idivl %r8d
movb %al, 0x4(%rdi)
movb 0x94(%rbx), %al
movb %al, 0x5(%rdi)
andw $0x0, 0x6(%rdi)
addq $0x8, %rdi
incq %rcx
movl 0x94(%rbx), %eax
addq $0x7, %rsi
jmp 0x468f
pushq $-0x1
popq %r9
movl %r9d, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, 0x4(%rsp)
leaq 0x8bc5(%rip), %rax      # 0xd2e0
incq 0x28(%rax)
movzbl 0x29(%r14), %eax
leaq (%r14,%rax), %rcx
addq $0x30, %rcx
movzbl 0x26(%r14), %eax
addq %rcx, %rax
movslq 0x20(%r14), %rcx
cmpb $0xd, -0x2(%rcx,%rax)
jne 0x4774
cmpb $0xa, -0x1(%rax,%rcx)
jne 0x4774
leaq 0x30(%r14), %r15
leaq 0x4(%rsp), %rsi
movq %r15, %rdi
callq 0x4516
testq %rax, %rax
setne %cl
cmpl $0x1, %ebp
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x477d
movq %rax, %rdi
callq 0x3fd1
jmp 0x479f
leaq 0x3bb5(%rip), %rsi      # 0x8330
jmp 0x47a6
testq %rax, %rax
sete %cl
cmpl $0x3, %ebp
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
je 0x479f
cmpl $0x0, 0x4(%rsp)
je 0x47ce
orl $0x2, %ebp
cmpl $0x3, %ebp
jne 0x47c6
leaq 0x3ba6(%rip), %rsi      # 0x834c
movq %rbx, %rdi
callq 0x3946
movq %r14, %rdi
callq 0x3e61
andq $0x0, 0x68(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x3027
testq %rax, %rax
je 0x47e0
movq %rax, %rdi
movq %r14, %rsi
callq 0x3fef
jmp 0x47e8
movq %r14, %rdi
callq 0x3f4f
andq $0x0, 0x68(%rbx)
leaq 0x3b5c(%rip), %rsi      # 0x8350
movq %rbx, %rdi
callq 0x3946
jmp 0x47bb