LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: command_replace
int32_t command_replace(char *command, conn *c, int com_type) {
    int comm = com_type;
    char key[251];
    int flags;
    time_t expire;
    int len, res;
    item *it;

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

    if (settings.managed) {
        int bucket = c->bucket;
        if (bucket == -1) {
            out_string(c, "CLIENT_ERROR no BG data in managed mode");
            return COMMAND_OK;
        }
        c->bucket = -1;
        if (buckets[bucket] != c->gen) {
            out_string(c, "ERROR_NOT_OWNER");
            return COMMAND_OK;
        }
    }

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

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

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

// Assembly:
pushq %rbp
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %edx, %ebp
movq %rsi, %rbx
leaq 0x3923(%rip), %rsi      # 0x83bc
leaq 0x10(%rsp), %rdx
leaq 0x4(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %rsp, %r9
xorl %eax, %eax
callq 0x22d0
cmpl $0x4, %eax
jne 0x4b64
cmpb $0x0, 0x10(%rsp)
je 0x4b64
leaq 0x87bb(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x4b01
movslq 0xe8(%rbx), %rax
cmpq $-0x1, %rax
je 0x4b7f
orl $-0x1, 0xe8(%rbx)
movq 0x9c5e(%rip), %rcx      # 0xe750
movl (%rcx,%rax,4), %eax
cmpl 0xec(%rbx), %eax
jne 0x4bca
movq 0x8(%rsp), %rdi
leaq 0x87d3(%rip), %rsi      # 0xd2e0
callq 0x6d41
movl %eax, %ecx
movq %rcx, 0x8(%rsp)
movl 0x4(%rsp), %esi
movl (%rsp), %ecx
addl $0x2, %ecx
leaq 0x10(%rsp), %rdi
movl %eax, %edx
callq 0x3cc6
testq %rax, %rax
je 0x4b88
movl %ebp, 0x70(%rbx)
movq %rax, 0x68(%rbx)
movzbl 0x29(%rax), %ecx
addq %rax, %rcx
movzbl 0x26(%rax), %edx
addq %rdx, %rcx
addq $0x30, %rcx
movq %rcx, 0x58(%rbx)
movl 0x20(%rax), %eax
movl %eax, 0x60(%rbx)
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x391f
jmp 0x4b73
leaq 0x3866(%rip), %rsi      # 0x83d1
movq %rbx, %rdi
callq 0x3946
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %rbp
retq
leaq 0x37d1(%rip), %rsi      # 0x8357
jmp 0x4b6b
movl 0x4(%rsp), %esi
movl (%rsp), %edx
addl $0x2, %edx
leaq 0x10(%rsp), %rdi
callq 0x3e8e
testl %eax, %eax
leaq 0x3851(%rip), %rax      # 0x83f6
leaq 0x36aa(%rip), %rsi      # 0x8256
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x3946
movl $0x4, 0x48(%rbx)
movl (%rsp), %eax
addl $0x2, %eax
movl %eax, 0x74(%rbx)
jmp 0x4b73
leaq 0x37ae(%rip), %rsi      # 0x837f
jmp 0x4b6b
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: own_handler
int32_t own_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    int bucket, gen;
    char *start = command+4;
    conn *c = (conn*)argv;
    if (!settings.managed) {
        out_string(c, "CLIENT_ERROR not a managed instance");
        return COMMAND_OK;
    }
    if (sscanf(start, "%u:%u\r\n", &bucket,&gen) == 2) {
        if ((bucket < 0) || (bucket >= MAX_BUCKETS)) {
            out_string(c, "CLIENT_ERROR bucket number out of range");
            return COMMAND_OK;
        }
        buckets[bucket] = gen;
        out_string(c, "OWNED");
        return COMMAND_OK;
    } else {
        out_string(c, "CLIENT_ERROR bad format");
        return COMMAND_OK;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0x82f5(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x4fcf
addq $0x4, %rdi
leaq 0x34d5(%rip), %rsi      # 0x8479
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x22d0
cmpl $0x2, %eax
jne 0x4fd8
movl 0xc(%rsp), %eax
cmpq $0x8000, %rax           # imm = 0x8000
jb 0x4fe1
leaq 0x34b4(%rip), %rsi      # 0x8481
jmp 0x4ff6
leaq 0x347f(%rip), %rsi      # 0x8455
jmp 0x4ff6
leaq 0x34ca(%rip), %rsi      # 0x84a9
jmp 0x4ff6
movl 0x8(%rsp), %ecx
movq 0x9764(%rip), %rdx      # 0xe750
movl %ecx, (%rdx,%rax,4)
leaq 0x34ce(%rip), %rsi      # 0x84c4
movq %rbx, %rdi
callq 0x3946
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: disown_handler
int32_t disown_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    int bucket;
    char *start = command+7;
    conn *c = (conn*)argv;
    if (!settings.managed) {
        out_string(c, "CLIENT_ERROR not a managed instance");
        return COMMAND_OK;
    }
    if (sscanf(start, "%u\r\n", &bucket) == 1) {
        if ((bucket < 0) || (bucket >= MAX_BUCKETS)) {
            out_string(c, "CLIENT_ERROR bucket number out of range");
            return COMMAND_OK;
        }
        buckets[bucket] = 0;
        out_string(c, "DISOWNED");
        return COMMAND_OK;
    } else {
        out_string(c, "CLIENT_ERROR bad format");
        return COMMAND_OK;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0x8273(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x504c
addq $0x7, %rdi
leaq 0x34ad(%rip), %rsi      # 0x84d3
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x22d0
cmpl $0x1, %eax
jne 0x5055
movl 0xc(%rsp), %eax
cmpq $0x8000, %rax           # imm = 0x8000
jb 0x505e
leaq 0x3437(%rip), %rsi      # 0x8481
jmp 0x5070
leaq 0x3402(%rip), %rsi      # 0x8455
jmp 0x5070
leaq 0x344d(%rip), %rsi      # 0x84a9
jmp 0x5070
movq 0x96eb(%rip), %rcx      # 0xe750
andl $0x0, (%rcx,%rax,4)
leaq 0x3451(%rip), %rsi      # 0x84c1
movq %rbx, %rdi
callq 0x3946
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_reset_handler
int32_t stats_reset_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    conn *c = (conn*)argv;
    stats_reset(&stats);
    out_string(c, "RESET");
    return COMMAND_OK;
}

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdx, 0x18(%rsp)
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0x2170
movl (%r12), %edx
movl 0x4(%r12), %r13d
movl 0x8(%r12), %r15d
movl 0xc(%r12), %ebp
movl 0x10(%r12), %ebx
movl 0x14(%r12), %r14d
movl 0x18(%r12), %eax
movl %eax, 0x8(%rsp)
movl 0x1c(%r12), %eax
movl %eax, 0xc(%rsp)
movl 0x20(%r12), %eax
movl %eax, 0x10(%rsp)
movl 0x24(%r12), %eax
movl %eax, 0x14(%rsp)
leaq 0x32f2(%rip), %rsi      # 0x869c
leaq 0x20(%rsp), %rdi
xorl %eax, %eax
callq 0x2400
cltq
leaq (%rsp,%rax), %r12
addq $0x20, %r12
leaq 0x32ea(%rip), %rsi      # 0x86b1
movq %r12, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %r13
addq %r12, %r13
leaq 0x32e6(%rip), %rsi      # 0x86c7
movq %r13, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %r15
addq %r13, %r15
leaq 0x32e5(%rip), %rsi      # 0x86e0
movq %r15, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %r12
addq %r15, %r12
leaq 0x32e6(%rip), %rsi      # 0x86fa
movq %r12, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %rbx
addq %r12, %rbx
leaq 0x32e5(%rip), %rsi      # 0x8712
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %r14
addq %rbx, %r14
leaq 0x32e5(%rip), %rsi      # 0x872c
movq %r14, %rdi
movl 0x8(%rsp), %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %rbx
addq %r14, %rbx
leaq 0x32e2(%rip), %rsi      # 0x8744
movq %rbx, %rdi
movl 0xc(%rsp), %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %r14
addq %rbx, %r14
leaq 0x32dd(%rip), %rsi      # 0x875a
movq %r14, %rdi
movl 0x10(%rsp), %edx
xorl %eax, %eax
callq 0x2400
movslq %eax, %rdi
addq %r14, %rdi
leaq 0x32d7(%rip), %rsi      # 0x876f
movl 0x14(%rsp), %edx
xorl %eax, %eax
callq 0x2400
movq 0x18(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x3946
xorl %eax, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_maps_handler
int32_t stats_maps_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    char *wbuf;
    int wsize = 8192; /* should be enough */
    int fd;
    int res;
    conn *c = (conn*)argv;

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

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

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

    return COMMAND_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl $0x2000, %edi           # imm = 0x2000
callq 0x22c0
testq %rax, %rax
je 0x5515
movq %rax, %r14
leaq 0x32a7(%rip), %rdi      # 0x878d
xorl %esi, %esi
xorl %eax, %eax
callq 0x2380
cmpl $-0x1, %eax
je 0x5526
movl %eax, %ebp
movl $0x1ffa, %edx           # imm = 0x1FFA
movl %eax, %edi
movq %r14, %rsi
callq 0x21f0
cmpl $0x1ffa, %eax           # imm = 0x1FFA
jne 0x553f
leaq 0x32b1(%rip), %rsi      # 0x87c4
jmp 0x554e
leaq 0x2d3a(%rip), %rsi      # 0x8256
movq %rbx, %rdi
callq 0x3946
jmp 0x559a
leaq 0x3270(%rip), %rsi      # 0x879d
movq %rbx, %rdi
callq 0x3946
movq %r14, %rdi
callq 0x2030
jmp 0x559a
leal 0x1(%rax), %ecx
cmpl $0x1, %ecx
ja 0x5560
leaq 0x3293(%rip), %rsi      # 0x87e1
movq %rbx, %rdi
callq 0x3946
movq %r14, %rdi
callq 0x2030
jmp 0x5593
movslq %eax, %rcx
movw $0xa, 0x4(%r14,%rcx)
movl $0xd444e45, (%r14,%rcx) # imm = 0xD444E45
movq %r14, 0x50(%rbx)
movq %r14, 0x38(%rbx)
addl $0x6, %eax
movl %eax, 0x44(%rbx)
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x391f
movl $0x1, 0x48(%rbx)
movl %ebp, %edi
callq 0x21b0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_cachedump_handler
int32_t stats_cachedump_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    char *buf;
    unsigned int bytes, id, limit = 0;
    conn *c = (conn*)argv;
    char *start = command + 15;
    if (sscanf(start, "%u %u\r\n", &id, &limit) < 1) {
        out_string(c, "CLIENT_ERROR bad command line");
        return COMMAND_OK;
    }

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

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

    return COMMAND_OK;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0x4(%rsp), %rcx
andl $0x0, (%rcx)
addq $0xf, %rdi
leaq 0x2c74(%rip), %rsi      # 0x8230
leaq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x22d0
testl %eax, %eax
jle 0x5606
movl 0x8(%rsp), %edi
movl 0x4(%rsp), %esi
leaq 0xc(%rsp), %rdx
callq 0x4005
testq %rax, %rax
je 0x560f
movq %rax, 0x50(%rbx)
movq %rax, 0x38(%rbx)
movl 0xc(%rsp), %eax
movl %eax, 0x44(%rbx)
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x391f
movl $0x1, 0x48(%rbx)
jmp 0x561e
leaq 0x31fa(%rip), %rsi      # 0x8807
jmp 0x5616
leaq 0x2c40(%rip), %rsi      # 0x8256
movq %rbx, %rdi
callq 0x3946
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_items_handler
int32_t stats_items_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    conn *c = (conn*)argv;
    char buffer[4096];
    item_stats(buffer, 4096);
    out_string(c, buffer);
    return COMMAND_OK;
}

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

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

    return COMMAND_OK;
}

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

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

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

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
andq $0x0, (%rsp)
leaq 0x7bf1(%rip), %rdi      # 0xd2e0
callq 0x6d28
leaq 0x3138(%rip), %rsi      # 0x8833
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
je 0x5732
leaq 0x3132(%rip), %rsi      # 0x8840
movq %rsp, %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x22d0
cmpl $0x1, %eax
jne 0x574e
movq (%rsp), %rdi
leaq 0x7bb5(%rip), %rsi      # 0xd2e0
callq 0x6d41
jmp 0x573b
leaq 0x7c07(%rip), %rax      # 0xd340
movl (%rax), %eax
leaq 0x7b46(%rip), %rcx      # 0xd288
movl %eax, 0x1c(%rcx)
leaq 0x30f1(%rip), %rsi      # 0x883d
jmp 0x5755
leaq 0x2cf2(%rip), %rsi      # 0x8447
movq %rbx, %rdi
callq 0x3946
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: bg_handler
int32_t bg_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    int bucket, gen;
    char *start = command + 3;
    conn *c = (conn*)argv;
    if (!settings.managed) {
        out_string(c, "CLIENT_ERROR not a managed instance");
        return COMMAND_OK;
    }
    if (sscanf(start, "%u:%u\r\n", &bucket,&gen) == 2) {
        /* we never write anything back, even if input's wrong */
        if ((bucket < 0) || (bucket >= MAX_BUCKETS) || (gen<=0)) {
            /* do nothing, bad input */
        } else {
            c->bucket = bucket;
            c->gen = gen;
        }
        conn_set_state(c, conn_read);
        return COMMAND_OK;
    } else {
        out_string(c, "CLIENT_ERROR bad format");
        return COMMAND_OK;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0x7b12(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x57d1
addq $0x3, %rdi
leaq 0x2cf2(%rip), %rsi      # 0x8479
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x22d0
cmpl $0x2, %eax
jne 0x57da
movl 0xc(%rsp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
setae %dl
movl 0x8(%rsp), %ecx
testl %ecx, %ecx
setle %sil
orb %dl, %sil
jne 0x57c4
movl %eax, 0xe8(%rbx)
movl %ecx, 0xec(%rbx)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x391f
jmp 0x57e9
leaq 0x2c7d(%rip), %rsi      # 0x8455
jmp 0x57e1
leaq 0x2cc8(%rip), %rsi      # 0x84a9
movq %rbx, %rdi
callq 0x3946
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: process_command
void process_command(conn *c, char *command) {

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

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x7a86(%rip), %rax      # 0xd288
cmpl $0x2, 0x18(%rax)
jge 0x5865
andq $0x0, 0x94(%rbx)
andl $0x0, 0x84(%rbx)
movq %rbx, %rdi
callq 0x3ada
testl %eax, %eax
je 0x5839
leaq 0x2a2c(%rip), %rsi      # 0x8256
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3946
leaq 0x7a40(%rip), %rax      # 0xd280
movq (%rax), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x32d5
testl %eax, %eax
js 0x585c
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x2be4(%rip), %rsi      # 0x8447
jmp 0x582a
movq 0x778c(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movl (%rbx), %edx
leaq 0x2fd0(%rip), %rsi      # 0x8848
movq %r14, %rcx
xorl %eax, %eax
callq 0x2260
jmp 0x5808
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: try_read_udp
int try_read_udp(conn *c) {
    int res;

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

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

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

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

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

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xd4(%rdi), %r9
movl $0x10, 0xd4(%rdi)
movl (%rdi), %edi
movq 0x18(%rbx), %rsi
movslq 0x28(%rbx), %rdx
leaq 0xc4(%rbx), %r8
xorl %ebp, %ebp
xorl %ecx, %ecx
callq 0x22f0
cmpl $0x9, %eax
jl 0x598f
movq 0x18(%rbx), %rdi
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leaq 0x79a1(%rip), %rdx      # 0xd2e0
addq %rcx, 0x48(%rdx)
movzwl (%rdi), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
movl %ecx, 0xc0(%rbx)
cmpb $0x0, 0x4(%rdi)
jne 0x5980
cmpb $0x1, 0x5(%rdi)
jne 0x5980
leal -0x8(%rax), %r14d
leaq 0x8(%rdi), %rsi
movq %r14, %rdx
callq 0x2360
addl %r14d, 0x2c(%rbx)
movq 0x18(%rbx), %rax
movq %rax, 0x20(%rbx)
pushq $0x1
popq %rbp
jmp 0x598f
leaq 0x2ec9(%rip), %rsi      # 0x8850
movq %rbx, %rdi
callq 0x3946
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbx
movq %rdx, %rbx
cmpl %esi, (%rdx)
jne 0x5b0c
movq %rbx, %rdi
popq %rbx
jmp 0x5c8c
leaq 0x7775(%rip), %rax      # 0xd288
cmpl $0x0, 0x18(%rax)
jg 0x5b22
movq %rbx, %rdi
popq %rbx
jmp 0x370c
movq 0x74cf(%rip), %rax      # 0xcff8
movq (%rax), %rcx
leaq 0x2e40(%rip), %rdi      # 0x8973
pushq $0x2e
popq %rsi
pushq $0x1
popq %rdx
callq 0x2420
jmp 0x5b19
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: new_socket
int new_socket(int is_udp) {
    int sfd;
    int flags;

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

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

// Assembly:
pushq %rbx
cmpl $0x1, %edi
pushq $0x2
popq %rdi
movl %edi, %esi
sbbl $0x0, %esi
xorl %edx, %edx
callq 0x2460
cmpl $-0x1, %eax
je 0x60e1
movl %eax, %ebx
pushq $0x3
popq %rsi
movl %eax, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20f0
testl %eax, %eax
js 0x60cc
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %ebx, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x20f0
testl %eax, %eax
js 0x60cc
movl %ebx, %eax
popq %rbx
retq
leaq 0x2816(%rip), %rdi      # 0x88e9
callq 0x23b0
movl %ebx, %edi
callq 0x21b0
jmp 0x60ed
leaq 0x28ba(%rip), %rdi      # 0x89a2
callq 0x23b0
pushq $-0x1
popq %rbx
jmp 0x60c8
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: maximize_sndbuf
void maximize_sndbuf(int sfd) {
    socklen_t intsize = sizeof(int);
    int last_good = 0;
    int min, max, avg;
    int old_size;

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

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

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
leaq 0x14(%rsp), %r8
movl $0x4, (%r8)
pushq $0x1
popq %rsi
pushq $0x7
popq %rdx
leaq 0xc(%rsp), %rcx
callq 0x2210
testl %eax, %eax
je 0x613d
leaq 0x715f(%rip), %rax      # 0xd288
cmpl $0x0, 0x18(%rax)
jle 0x61a3
leaq 0x2875(%rip), %rdi      # 0x89ab
callq 0x23b0
jmp 0x61a3
movl $0x10000000, %r13d      # imm = 0x10000000
xorl %ebp, %ebp
movl 0xc(%rsp), %r14d
pushq $0x7
popq %r15
leaq 0x10(%rsp), %r12
cmpl %r13d, %r14d
jg 0x6196
leal (%r14,%r13), %eax
shrl %eax
movl %eax, 0x10(%rsp)
movl 0x14(%rsp), %r8d
movl %ebx, %edi
pushq $0x1
popq %rsi
movl %r15d, %edx
movq %r12, %rcx
callq 0x20d0
movl 0x10(%rsp), %ecx
leal 0x1(%rcx), %edx
leal -0x1(%rcx), %esi
testl %eax, %eax
cmovel %ecx, %ebp
cmovnel %r14d, %edx
cmovel %r13d, %esi
movl %edx, %r14d
movl %esi, %r13d
jmp 0x6153
leaq 0x70eb(%rip), %rax      # 0xd288
cmpl $0x2, 0x18(%rax)
jge 0x61b2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6e3f(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movl 0xc(%rsp), %ecx
leaq 0x27fa(%rip), %rsi      # 0x89c1
movl %ebx, %edx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2260
jmp 0x61a3
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: server_socket
int server_socket(int port, int is_udp) {
    int sfd;
    struct linger ling = {0, 0};
    struct sockaddr_in addr;
    int flags =1;

    if ((sfd = new_socket(is_udp)) == -1) {
        return -1;
    }

    setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
    if (is_udp) {
        maximize_sndbuf(sfd);
    } else {
        setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, &flags, sizeof(flags));
        setsockopt(sfd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
        setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, &flags, sizeof(flags));
    }

    /*
     * the memset call clears nonstandard fields in some impementations
     * that otherwise mess things up.
     */
    memset(&addr, 0, sizeof(addr));

    addr.sin_family = AF_INET;
    addr.sin_port = htons(port);
    addr.sin_addr = settings.interface;
    if (bind(sfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
        perror("bind()");
        close(sfd);
        return -1;
    }
    if (! is_udp && listen(sfd, 1024) == -1) {
        perror("listen()");
        close(sfd);
        return -1;
    }
    return sfd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %r14d
movl %edi, %r15d
andq $0x0, 0x10(%rsp)
movl $0x1, 0xc(%rsp)
movl %esi, %edi
callq 0x6085
pushq $-0x1
popq %rbx
cmpl $-0x1, %eax
je 0x62c4
movl %eax, %ebp
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
leaq 0xc(%rsp), %rcx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x20d0
testl %r14d, %r14d
je 0x6230
movl %ebp, %edi
callq 0x60f2
jmp 0x6277
pushq $0x1
popq %r12
pushq $0x9
popq %rdx
leaq 0xc(%rsp), %r13
pushq $0x4
popq %r8
movl %ebp, %edi
movl %r12d, %esi
movq %r13, %rcx
callq 0x20d0
pushq $0xd
popq %rdx
leaq 0x10(%rsp), %rcx
pushq $0x8
popq %r8
movl %ebp, %edi
movl %r12d, %esi
callq 0x20d0
pushq $0x6
popq %rsi
movl %ebp, %edi
movl %r12d, %edx
movq %r13, %rcx
pushq $0x4
popq %r8
callq 0x20d0
leaq 0x18(%rsp), %rsi
andq $0x0, 0x8(%rsi)
movw $0x2, (%rsi)
rolw $0x8, %r15w
movw %r15w, 0x2(%rsi)
leaq 0x6ff1(%rip), %rax      # 0xd288
movl 0x14(%rax), %eax
movl %eax, 0x4(%rsi)
pushq $0x10
popq %rdx
movl %ebp, %edi
callq 0x2350
cmpl $-0x1, %eax
je 0x62d5
testl %r14d, %r14d
jne 0x62c2
movl %ebp, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x22e0
cmpl $-0x1, %eax
je 0x62de
movl %ebp, %ebx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2705(%rip), %rdi      # 0x89e1
jmp 0x62e5
leaq 0x2703(%rip), %rdi      # 0x89e8
callq 0x23b0
movl %ebp, %edi
callq 0x21b0
jmp 0x62c4
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: new_socket_unix
int new_socket_unix(void) {
    int sfd;
    int flags;

    if ((sfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
        perror("socket()");
        return -1;
    }

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

// Assembly:
pushq %rbx
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x2460
cmpl $-0x1, %eax
je 0x6349
movl %eax, %ebx
pushq $0x3
popq %rsi
movl %eax, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20f0
testl %eax, %eax
js 0x6334
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %ebx, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x20f0
testl %eax, %eax
js 0x6334
movl %ebx, %eax
popq %rbx
retq
leaq 0x25ae(%rip), %rdi      # 0x88e9
callq 0x23b0
movl %ebx, %edi
callq 0x21b0
jmp 0x6355
leaq 0x2652(%rip), %rdi      # 0x89a2
callq 0x23b0
pushq $-0x1
popq %rbx
jmp 0x6330
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: server_socket_unix
int server_socket_unix(char *path) {
    int sfd;
    struct linger ling = {0, 0};
    struct sockaddr_un addr;
    struct stat tstat;
    int flags =1;

    if (!path) {
        return -1;
    }

    if ((sfd = new_socket_unix()) == -1) {
        return -1;
    }

    /*
     * Clean up a previous socket file if we left it around
     */
    if (!lstat(path, &tstat)) {
        if (S_ISSOCK(tstat.st_mode))
            unlink(path);
    }

    setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
    setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, &flags, sizeof(flags));
    setsockopt(sfd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));

    /*
     * the memset call clears nonstandard fields in some impementations
     * that otherwise mess things up.
     */
    memset(&addr, 0, sizeof(addr));

    addr.sun_family = AF_UNIX;
    strcpy(addr.sun_path, path);
    if (bind(sfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
        perror("bind()");
        close(sfd);
        return -1;
    }
    if (listen(sfd, 1024) == -1) {
        perror("listen()");
        close(sfd);
        return -1;
    }
    return sfd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
andq $0x0, 0x10(%rsp)
movl $0x1, 0xc(%rsp)
pushq $-0x1
popq %rbx
testq %rdi, %rdi
je 0x6468
movq %rdi, %r14
callq 0x62f3
cmpl $-0x1, %eax
je 0x6468
movl %eax, %ebp
leaq 0x88(%rsp), %rsi
movq %r14, %rdi
callq 0x2200
testl %eax, %eax
jne 0x63c7
movl $0xf000, %eax           # imm = 0xF000
andl 0xa0(%rsp), %eax
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x63c7
movq %r14, %rdi
callq 0x2050
pushq $0x1
popq %r15
pushq $0x2
popq %rdx
leaq 0xc(%rsp), %r12
pushq $0x4
popq %r13
movl %ebp, %edi
movl %r15d, %esi
movq %r12, %rcx
movl %r13d, %r8d
callq 0x20d0
pushq $0x9
popq %rdx
movl %ebp, %edi
movl %r15d, %esi
movq %r12, %rcx
movl %r13d, %r8d
callq 0x20d0
pushq $0xd
popq %rdx
leaq 0x10(%rsp), %rcx
pushq $0x8
popq %r8
movl %ebp, %edi
movl %r15d, %esi
callq 0x20d0
leaq 0x1c(%rsp), %rdi
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x5c(%rdi)
movw $0x1, -0x2(%rdi)
movq %r14, %rsi
callq 0x2090
leaq 0x1a(%rsp), %rsi
pushq $0x6e
popq %rdx
movl %ebp, %edi
callq 0x2350
cmpl $-0x1, %eax
je 0x647c
movl %ebp, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x22e0
cmpl $-0x1, %eax
je 0x6485
movl %ebp, %ebx
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x255e(%rip), %rdi      # 0x89e1
jmp 0x648c
leaq 0x255c(%rip), %rdi      # 0x89e8
callq 0x23b0
movl %ebp, %edi
callq 0x21b0
jmp 0x6468
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: pre_gdb
void pre_gdb () {
    int i = 0;
    if(l_socket) close(l_socket);
    if(u_socket > -1) close(u_socket);
    for (i=3; i<=500; i++) close(i); /* so lame */
    kill(getpid(), SIGABRT);
}

// Assembly:
pushq %rbx
leaq 0x6dce(%rip), %rax      # 0xd270
movl (%rax), %edi
testl %edi, %edi
je 0x64ad
callq 0x21b0
leaq 0x6d94(%rip), %rax      # 0xd248
movl (%rax), %edi
testl %edi, %edi
js 0x64bf
callq 0x21b0
pushq $0x3
popq %rbx
cmpl $0x1f5, %ebx            # imm = 0x1F5
je 0x64d5
movl %ebx, %edi
callq 0x21b0
incl %ebx
jmp 0x64c2
callq 0x2100
pushq $0x6
popq %rsi
movl %eax, %edi
popq %rbx
jmp 0x22a0
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: timer_delete_handler
int timer_delete_handler(struct aeEventLoop *eventLoop, long long id, void *clientData) {
    AE_NOTUSED(eventLoop);
    AE_NOTUSED(id);
    AE_NOTUSED(clientData);
    
    int i, j=0;
    for (i=0; i<delcurr; i++) {
        item *it = todelete[i];
        if (item_delete_lock_over(it)) {
            assert(it->refcount > 0);
            it->it_flags &= ~ITEM_DELETED;
            item_unlink(it);
            item_remove(it);
        } else {
            todelete[j++] = it;
        }
    }
    delcurr = j;
    return 1000;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %r14d, %r14d
movl 0x824f(%rip), %eax      # 0xe758
leaq 0x6e30(%rip), %r15      # 0xd340
xorl %ebp, %ebp
movslq %eax, %rcx
cmpq %rcx, %r14
jge 0x6557
movq 0x823f(%rip), %rcx      # 0xe760
movq (%rcx,%r14,8), %rbx
movl (%r15), %edx
cmpl 0x1c(%rbx), %edx
jae 0x6538
movslq %ebp, %rdx
incl %ebp
movq %rbx, (%rcx,%rdx,8)
jmp 0x6552
andb $-0x3, 0x27(%rbx)
movq %rbx, %rdi
callq 0x3e01
movq %rbx, %rdi
callq 0x3fb4
movl 0x8206(%rip), %eax      # 0xe758
incq %r14
jmp 0x6512
movl %ebp, 0x81fb(%rip)      # 0xe758
movl $0x3e8, %eax            # imm = 0x3E8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/memcached_time.c
// Function: realtime
rel_time_t realtime(time_t exptime, struct stats *stats) {
    /* no. of seconds in 30 days - largest possible delta exptime */
    if (exptime == 0) return 0; /* 0 means never expire */

    if (exptime > REALTIME_MAXDELTA)
        return (rel_time_t) (exptime - stats->started);
    else {
        return (rel_time_t) (exptime + current_time);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x6d56
movq %rdi, %rax
cmpq $0x278d01, %rdi         # imm = 0x278D01
jl 0x6d59
subl 0x40(%rsi), %eax
retq
xorl %eax, %eax
retq
leaq 0x65e0(%rip), %rcx      # 0xd340
addl (%rcx), %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/settings.c
// Function: usage
void usage(void) {
    printf(PACKAGE " " VERSION "\n");
    printf("-p <num>      port number to listen on\n");
    printf("-s <file>     unix socket path to listen on (disables network support)\n");
    printf("-l <ip_addr>  interface to listen on, default is INDRR_ANY\n");
    printf("-d            run as a daemon\n");
    printf("-r            maximize core file limit\n");
    printf("-u <username> assume identity of <username> (only when run as root)\n");
    printf("-m <num>      max memory to use for items in megabytes, default is 64 MB\n");
    printf("-M            return error on memory exhausted (rather than removing items)\n");
    printf("-c <num>      max simultaneous connections, default is 1024\n");
    printf("-k            lock down all paged memory\n");
    printf("-v            verbose (print errors/warnings while in event loop)\n");
    printf("-vv           very verbose (also print client commands/reponses)\n");
    printf("-h            print this help and exit\n");
    printf("-i            print memcached and libevent license\n");
    printf("-b            run a managed instanced (mnemonic: buckets)\n");
    printf("-P <file>     save PID in <file>, only used with -d option\n");
    printf("-f <factor>   chunk size growth factor, default 1.25\n");
    printf("-n <bytes>    minimum space allocated for key+value+flags, default 48\n");
    return;
}

// Assembly:
pushq %rax
leaq 0x1f22(%rip), %rdi      # 0x8ebb
callq 0x20b0
leaq 0x1f28(%rip), %rdi      # 0x8ecd
callq 0x20b0
leaq 0x1f43(%rip), %rdi      # 0x8ef4
callq 0x20b0
leaq 0x1f7e(%rip), %rdi      # 0x8f3b
callq 0x20b0
leaq 0x1fad(%rip), %rdi      # 0x8f76
callq 0x20b0
leaq 0x1fbf(%rip), %rdi      # 0x8f94
callq 0x20b0
leaq 0x1fda(%rip), %rdi      # 0x8fbb
callq 0x20b0
leaq 0x2012(%rip), %rdi      # 0x8fff
callq 0x20b0
leaq 0x204f(%rip), %rdi      # 0x9048
callq 0x20b0
leaq 0x208f(%rip), %rdi      # 0x9094
callq 0x20b0
leaq 0x20bf(%rip), %rdi      # 0x90d0
callq 0x20b0
leaq 0x20dc(%rip), %rdi      # 0x90f9
callq 0x20b0
leaq 0x2112(%rip), %rdi      # 0x913b
callq 0x20b0
leaq 0x2147(%rip), %rdi      # 0x917c
callq 0x20b0
leaq 0x2162(%rip), %rdi      # 0x91a3
callq 0x20b0
leaq 0x2189(%rip), %rdi      # 0x91d6
callq 0x20b0
leaq 0x21b7(%rip), %rdi      # 0x9210
callq 0x20b0
leaq 0x21e6(%rip), %rdi      # 0x924b
callq 0x20b0
leaq 0x220f(%rip), %rdi      # 0x9280
popq %rax
jmp 0x20b0
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/slab.c
// Function: slab_create
slab_ptr slab_create(size_t chunk_size, size_t page_size, int pre_alloc) {
    slab_ptr slab;
    slab = (slab_ptr)calloc(1, sizeof(*slab));
    if (NULL == slab) {
        return NULL;
    }

    /* Make sure chunk are always n-byte aligned */
    if (chunk_size % CHUNK_ALIGN_BYTES) {
        chunk_size += CHUNK_ALIGN_BYTES - (chunk_size % CHUNK_ALIGN_BYTES);
    }
    
    /* Make sure page are always n-byte aligned */
    if (page_size % PAGE_ALIGN_BYTES) {
        page_size += PAGE_ALIGN_BYTES - (page_size % PAGE_ALIGN_BYTES);
    }

    slab->chunk_size = chunk_size;
    slab->page_size = page_size;
    slab->chunk_number_per_page = page_size / chunk_size;
    slab->page_total = 0;
    slab->magic_number = SLAB_MAGIC_NUMBER;
    /* Preallocate as many slab pages as possible (called from mem_cache_init)
       on start-up, so users don't get confused out-of-memory errors when
       they do have free (in-slab) space, but no space to make new mem_cache.
       if maxmem_cache is 18 (POWER_LARGEST - POWER_SMALLEST + 1), then all
       slab types can be made.  if max memory is less than 18 MB, only the
       smaller ones will be made.  */
    if (pre_alloc) {
        /* pre-allocate a 1MB slab in every size class so people don't get
           confused by non-intuitive "SERVER_ERROR out of memory"
           messages.  this is the most common question on the mailing
           list.  if you really don't want this, you can rebuild without
           these three lines.  */
       slab_new_page(slab);

    }
    return slab;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r15
pushq $0x1
popq %rdi
pushq $0x50
popq %rsi
callq 0x2220
movq %rax, %r14
testq %rax, %rax
je 0x70f4
addq $0x7, %r15
andq $-0x8, %r15
addq $0xfffff, %r12          # imm = 0xFFFFF
andq $-0x100000, %r12        # imm = 0xFFF00000
movq %r15, (%r14)
movq %r12, 0x8(%r14)
movq %r12, %rax
xorl %edx, %edx
divq %r15
movl %eax, 0x10(%r14)
movl $0xabcdefaa, 0x48(%r14) # imm = 0xABCDEFAA
testl %ebx, %ebx
je 0x70f4
movq %r14, %rdi
callq 0x7103
movq %r14, %rax
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/slab.c
// Function: slab_new_page
int slab_new_page(slab_ptr slab) {
    char *ptr;
    if (NULL == slab) {
        return 0;
    }

    if (slab->end_page_ptr != NULL || slab->end_page_free > 0) {
        return 0;
    }

    ptr = calloc(1, slab->page_size);
    if (NULL == ptr) {
        return 0;
    }
    slab->end_page_ptr = ptr;
    slab->end_page_free = slab->chunk_number_per_page;

    ++ slab->page_total;
    return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x7143
movq %rdi, %r14
cmpq $0x0, 0x18(%rdi)
jne 0x7143
cmpq $0x0, 0x20(%r14)
jne 0x7143
movq 0x8(%r14), %rsi
pushq $0x1
popq %rdi
callq 0x2220
testq %rax, %rax
je 0x7143
movq %rax, 0x18(%r14)
movl 0x10(%r14), %eax
movq %rax, 0x20(%r14)
incq 0x28(%r14)
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/slab.c
// Function: slab_alloc_chunk
void *slab_alloc_chunk(slab_ptr slab) {
    if (NULL == slab) {
        return NULL;
    }

    /* fail unless we have space at the end of a recently allocated page,
       we have something on our freelist, or we could allocate a new page */
    if (! (slab->end_page_ptr || slab->free_chunk_end || slab_new_page(slab))) {
        return 0;
    }

    /* return off our freelist, if we have one */
    if (0 != slab->free_chunk_end) {
        return slab->free_chunk_list[ -- slab->free_chunk_end];
    }
    /* if we recently allocated a whole page, return from that */
    if (slab->end_page_ptr) {
        void *ptr = slab->end_page_ptr;
        if (-- slab->end_page_free) {
            slab->end_page_ptr += slab->chunk_size;
        } else {
            slab->end_page_ptr = 0;
        }
        return ptr;
    }
    
    return 0;  /* shouldn't ever get here */
}

// Assembly:
testq %rdi, %rdi
je 0x718c
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x18(%rdi)
jne 0x7170
cmpq $0x0, 0x40(%rbx)
jne 0x7170
movq %rbx, %rdi
callq 0x7103
testl %eax, %eax
je 0x71a6
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x718f
movq 0x30(%rbx), %rcx
leaq -0x1(%rax), %rdx
movq %rdx, 0x40(%rbx)
movq -0x8(%rcx,%rax,8), %rax
jmp 0x71b0
xorl %eax, %eax
retq
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x71a6
decq 0x20(%rbx)
je 0x71aa
movq (%rbx), %rcx
addq %rax, %rcx
jmp 0x71ac
xorl %eax, %eax
jmp 0x71b0
xorl %ecx, %ecx
movq %rcx, 0x18(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zuocheng-liu[P]ae-memcached/src/slab.c
// Function: slab_free_chunk
void slab_free_chunk(slab_ptr slab, void *ptr) {
    if (NULL == slab || NULL == ptr) {
        return ;
    }
    if (slab->free_chunk_end == slab->free_chunk_list_length) { /* need more space on the free list */
        size_t new_size = slab->free_chunk_list_length ? slab->free_chunk_list_length*2 : 16;  /* 16 is arbitrary */
        void **new_list = realloc(slab->free_chunk_list, new_size * sizeof(void *));
        if (NULL == new_list) {
            return;
        }
        slab->free_chunk_list = new_list;
        slab->free_chunk_list_length = new_size;
    }
    slab->free_chunk_list[slab->free_chunk_end ++] = ptr;
    return;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x721f
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x40(%rdi), %rcx
cmpq 0x38(%rdi), %rcx
jne 0x720a
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
pushq $0x10
popq %r15
cmovneq %rax, %r15
movq 0x30(%r14), %rdi
leaq (,%r15,8), %rsi
callq 0x2310
testq %rax, %rax
je 0x721a
movq %rax, 0x30(%r14)
movq %r15, 0x38(%r14)
movq 0x40(%r14), %rcx
jmp 0x720e
movq 0x30(%r14), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x40(%r14)
movq %rbx, (%rax,%rcx,8)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/ejunjsh[P]mycc/cg.c
// Function: cgprimsize
int cgprimsize(int type) {
  if (ptrtype(type))
    return (8);
  switch (type) {
  case P_CHAR:
    return (1);
  case P_INT:
    return (4);
  case P_LONG:
    return (8);
  default:
    fatald("Bad type in cgprimsize:", type);
  }
  return (0);	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0x8743
movl %eax, %ecx
pushq $0x8
popq %rax
testl %ecx, %ecx
jne 0x2358
cmpl $0x20, %ebx
je 0x2343
cmpl $0x40, %ebx
je 0x2358
cmpl $0x30, %ebx
jne 0x2348
pushq $0x4
jmp 0x2345
pushq $0x1
popq %rax
jmp 0x2358
leaq 0x6cc5(%rip), %rdi      # 0x9014
movl %ebx, %esi
callq 0x656d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ejunjsh[P]mycc/cg.c
// Function: cgfreeallregs
void cgfreeallregs(int keepreg) {
  int i;
  // fprintf(Outfile, "# freeing all registers\n");
  for (i = 0; i < NUMFREEREGS; i++)
    if (i != keepreg)
      freereg[i] = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, %eax
shlq $0x2, %rax
xorl %ecx, %ecx
leaq 0xbfaa(%rip), %rdx      # 0xe330
cmpq $0x10, %rcx
je 0x239e
cmpq %rcx, %rax
je 0x2398
movl $0x1, (%rcx,%rdx)
addq $0x4, %rcx
jmp 0x2386
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ejunjsh[P]mycc/cg.c
// Function: cgallocreg
int cgallocreg(void) {
  int reg;

  for (reg = 0; reg < NUMFREEREGS; reg++) {
    if (freereg[reg]) {
      freereg[reg] = 0;
      // fprintf(Outfile, "# allocated register %s\n", reglist[reg]);
      return (reg);
    }
  }

  // 没有可用寄存器,溢出一个
  reg = (spillreg % NUMFREEREGS);
  spillreg++;
  // fprintf(Outfile, "# spilling reg %s\n", reglist[reg]);
  pushreg(reg);
  return (reg);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xbf83(%rip), %rax      # 0xe330
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x23c3
cmpl $0x0, (%rax)
jne 0x23e4
incq %rbx
addq $0x4, %rax
jmp 0x23af
movl 0xbf77(%rip), %ecx      # 0xe340
pushq $0x4
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movl %edx, %ebx
incl %ecx
movl %ecx, 0xbf65(%rip)      # 0xe340
movl %edx, %edi
callq 0x23f0
jmp 0x23e7
andl $0x0, (%rax)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ejunjsh[P]mycc/cg.c
// Function: cgfreereg
void cgfreereg(int reg) {
  if (freereg[reg] != 0) {
    // fprintf(Outfile, "# error trying to free register %s\n", reglist[reg]);
    fatald("Error trying to free register", reg);
  }
  // 如果这个是溢出来的, 从栈中恢复
  if (spillreg > 0) {
    spillreg--;
    reg = (spillreg % NUMFREEREGS);
    // fprintf(Outfile, "# unspilling reg %s\n", reglist[reg]);
    popreg(reg);
  } else {
    // fprintf(Outfile, "# freeing reg %s\n", reglist[reg]);
    freereg[reg] = 1;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movslq %edi, %rbx
leaq 0xbf01(%rip), %r14      # 0xe330
cmpl $0x0, (%r14,%rbx,4)
je 0x2444
movl %edi, %esi
leaq 0x6bed(%rip), %rdi      # 0x902c
callq 0x656d
movl 0xbef6(%rip), %edi      # 0xe340
testl %edi, %edi
jle 0x245f
decl %edi
movl %edi, 0xbeea(%rip)      # 0xe340
andl $0x3, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x246c
movl $0x1, (%r14,%rbx,4)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ejunjsh[P]mycc/cg.c
// Function: cgpreamble
void cgpreamble(char *filename) {
  cgfreeallregs(NOREG);
  cgtextseg();
  fprintf(Outfile, "\t.file 1 ");
  fputc('"', Outfile);
  fprintf(Outfile, "%s", filename);
  fputc('"', Outfile);
  fputc('\n', Outfile);
  fprintf(Outfile,
	  "# internal switch(expr) routine\n"
	  "# %%rsi = switch table, %%rax = expr\n"
	  "# from SubC: http://www.t3x.org/subc/\n"
	  "\n"
	  "__switch:\n"
	  "        pushq   %%rsi\n"
	  "        movq    %%rdx, %%rsi\n"
	  "        movq    %%rax, %%rbx\n"
	  "        cld\n"
	  "        lodsq\n"
	  "        movq    %%rax, %%rcx\n"
	  "__next:\n"
	  "        lodsq\n"
	  "        movq    %%rax, %%rdx\n"
	  "        lodsq\n"
	  "        cmpq    %%rdx, %%rbx\n"
	  "        jnz     __no\n"
	  "        popq    %%rsi\n"
	  "        jmp     *%%rax\n"
	  "__no:\n"
	  "        loop    __next\n"
	  "        lodsq\n"
	  "        popq    %%rsi\n" "        jmp     *%%rax\n\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $-0x1
popq %rdi
callq 0x2373
callq 0x22bc
leaq 0xbeaf(%rip), %r15      # 0xe388
movq (%r15), %rcx
leaq 0x6b67(%rip), %rdi      # 0x904a
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
callq 0x2180
movq (%r15), %rsi
pushq $0x22
popq %r14
movl %r14d, %edi
callq 0x20e0
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x20c0
movq (%r15), %rsi
movl %r14d, %edi
callq 0x20e0
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x20e0
movq (%r15), %rdi
leaq 0x6b2c(%rip), %rsi      # 0x9054
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2100