LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_cachedump_handler
int32_t stats_cachedump_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(argc); 
    char *buf;
    unsigned int bytes, id, limit = 0;
    conn *c = (conn*)argv;
    char *start = command + 15;
    if (sscanf(start, "%u %u\r\n", &id, &limit) < 1) {
        out_string(c, "CLIENT_ERROR bad command line");
        return COMMAND_OK;
    }

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

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

    return COMMAND_OK;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
leaq 0x4(%rsp), %rcx
movl $0x0, (%rcx)
addq $0xf, %rdi
leaq 0x22cf(%rip), %rsi      # 0x827c
leaq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x22d0
testl %eax, %eax
jle 0x5ff9
movl 0x8(%rsp), %edi
movl 0x4(%rsp), %esi
leaq 0xc(%rsp), %rdx
callq 0x4917
testq %rax, %rax
je 0x6002
movq %rax, 0x50(%rbx)
movq %rax, 0x38(%rbx)
movl 0xc(%rsp), %eax
movl %eax, 0x44(%rbx)
movq %rbx, %rdi
movl $0x2, %esi
callq 0x4189
movl $0x1, 0x48(%rbx)
jmp 0x6011
leaq 0x2847(%rip), %rsi      # 0x8847
jmp 0x6009
leaq 0x2299(%rip), %rsi      # 0x82a2
movq %rbx, %rdi
callq 0x41b0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x4a1a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x41b0
xorl %eax, %eax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: stats_sizes_handler
int32_t stats_sizes_handler(char *command, int argc, char ** argv) {
    AE_NOTUSED(command); 
    AE_NOTUSED(argc); 
    int bytes = 0;
    char *buf = item_stats_sizes(&bytes);
    conn *c = (conn*)argv;
    if (! buf) {
        out_string(c, "SERVER_ERROR out of memory");
        return COMMAND_OK;
    }

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

    return COMMAND_OK;
}

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

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

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

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movq $0x0, (%rsp)
leaq 0x71f4(%rip), %rdi      # 0xd2e0
callq 0x7740
leaq 0x277b(%rip), %rsi      # 0x8873
movq %r14, %rdi
callq 0x2230
testl %eax, %eax
je 0x612f
leaq 0x2775(%rip), %rsi      # 0x8880
movq %rsp, %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x22d0
cmpl $0x1, %eax
jne 0x614b
movq (%rsp), %rdi
leaq 0x71b8(%rip), %rsi      # 0xd2e0
callq 0x7759
jmp 0x6138
leaq 0x720a(%rip), %rax      # 0xd340
movl (%rax), %eax
leaq 0x7149(%rip), %rcx      # 0xd288
movl %eax, 0x1c(%rcx)
leaq 0x2734(%rip), %rsi      # 0x887d
jmp 0x6152
leaq 0x2335(%rip), %rsi      # 0x8487
movq %rbx, %rdi
callq 0x41b0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7115(%rip), %rax      # 0xd288
cmpl $0x0, 0x20(%rax)
je 0x61d0
addq $0x3, %rdi
leaq 0x2335(%rip), %rsi      # 0x84b9
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x22d0
cmpl $0x2, %eax
jne 0x61d9
movl 0xc(%rsp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
setae %dl
movl 0x8(%rsp), %ecx
testl %ecx, %ecx
setle %sil
orb %dl, %sil
jne 0x61c1
movl %eax, 0xe8(%rbx)
movl %ecx, 0xec(%rbx)
movq %rbx, %rdi
movl $0x1, %esi
callq 0x4189
jmp 0x61e8
leaq 0x22be(%rip), %rsi      # 0x8495
jmp 0x61e0
leaq 0x2309(%rip), %rsi      # 0x84e9
movq %rbx, %rdi
callq 0x41b0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7087(%rip), %rax      # 0xd288
cmpl $0x2, 0x18(%rax)
jge 0x626a
movq $0x0, 0x94(%rbx)
movl $0x0, 0x84(%rbx)
movq %rbx, %rdi
callq 0x4372
testl %eax, %eax
je 0x623e
leaq 0x2073(%rip), %rsi      # 0x82a2
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x41b0
leaq 0x703b(%rip), %rax      # 0xd280
movq (%rax), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x3ac0
testl %eax, %eax
js 0x6261
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x221f(%rip), %rsi      # 0x8487
jmp 0x622f
movq 0x6d87(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movl (%rbx), %edx
leaq 0x260b(%rip), %rsi      # 0x8888
movq %r14, %rcx
xorl %eax, %eax
callq 0x2260
jmp 0x6207
// File: /workspace/github_c_makefile_star2_O3/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 0x639d
movq 0x18(%rbx), %rdi
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leaq 0x6f95(%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 0x638e
cmpb $0x1, 0x5(%rdi)
jne 0x638e
leal -0x8(%rax), %r14d
leaq 0x8(%rdi), %rsi
movq %r14, %rdx
callq 0x2360
addl %r14d, 0x2c(%rbx)
movq 0x18(%rbx), %rax
movq %rax, 0x20(%rbx)
movl $0x1, %ebp
jmp 0x639d
leaq 0x24fb(%rip), %rsi      # 0x8890
movq %rbx, %rdi
callq 0x41b0
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: try_read_network
int try_read_network(conn *c) {
    int gotdata = 0;
    int res;

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

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

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x20(%rbx), %rsi
cmpq %rdi, %rsi
je 0x63d1
movslq 0x2c(%rbx), %rdx
testq %rdx, %rdx
je 0x63cd
callq 0x2360
movq 0x18(%rbx), %rdi
movq %rdi, 0x20(%rbx)
xorl %ebp, %ebp
leaq 0x6eae(%rip), %r14      # 0xd288
leaq 0x6eff(%rip), %r15      # 0xd2e0
movl 0x28(%rbx), %eax
cmpl %eax, 0x2c(%rbx)
jl 0x6411
movslq %eax, %rsi
movq 0x18(%rbx), %rdi
addq %rsi, %rsi
callq 0x2310
testq %rax, %rax
je 0x6482
movq %rax, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movl 0x28(%rbx), %eax
addl %eax, %eax
movl %eax, 0x28(%rbx)
xorl %ecx, %ecx
cmpq $0x0, 0x28(%r14)
sete %cl
shll $0x4, %ecx
movl %ecx, 0xd4(%rbx)
movl (%rbx), %edi
movslq 0x2c(%rbx), %rcx
movq 0x18(%rbx), %rsi
addq %rcx, %rsi
movslq %eax, %rdx
subq %rcx, %rdx
callq 0x21f0
testl %eax, %eax
jg 0x644b
cmpl $-0x1, %eax
je 0x6461
testl %eax, %eax
jne 0x63e1
jmp 0x6473
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, 0x48(%r15)
addl %eax, 0x2c(%rbx)
movl $0x1, %ebp
jmp 0x63e1
callq 0x2040
movq %rax, %rcx
xorl %eax, %eax
cmpl $0xb, (%rcx)
cmovel %ebp, %eax
jmp 0x64ab
movq %rbx, %rdi
movl $0x5, %esi
callq 0x4189
jmp 0x64a6
cmpl $0x0, 0x18(%r14)
jg 0x64b6
movl $0x0, 0x2c(%rbx)
leaq 0x1e0b(%rip), %rsi      # 0x82a2
movq %rbx, %rdi
callq 0x41b0
movl $0x5, 0x48(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x259e
jmp 0x6489
// File: /workspace/github_c_makefile_star2_O3/zuocheng-liu[P]ae-memcached/src/memcached.c
// Function: new_socket
int new_socket(int is_udp) {
    int sfd;
    int flags;

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

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

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

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

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

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
leaq 0xc(%rsp), %r8
movl $0x4, (%r8)
leaq 0x4(%rsp), %rcx
movl $0x1, %esi
movl $0x7, %edx
callq 0x2210
testl %eax, %eax
je 0x6b6e
leaq 0x672e(%rip), %rax      # 0xd288
cmpl $0x0, 0x18(%rax)
jle 0x6bdc
leaq 0x1e84(%rip), %rdi      # 0x89eb
callq 0x23b0
jmp 0x6bdc
movl 0x4(%rsp), %r15d
xorl %ebp, %ebp
cmpl $0x10000000, %r15d      # imm = 0x10000000
jg 0x6bcf
xorl %ebp, %ebp
movl $0x10000000, %r12d      # imm = 0x10000000
leaq 0x8(%rsp), %r14
leal (%r12,%r15), %eax
shrl %eax
movl %eax, 0x8(%rsp)
movl 0xc(%rsp), %r8d
movl %ebx, %edi
movl $0x1, %esi
movl $0x7, %edx
movq %r14, %rcx
callq 0x20d0
movl 0x8(%rsp), %ecx
leal 0x1(%rcx), %edx
leal -0x1(%rcx), %esi
testl %eax, %eax
cmovel %ecx, %ebp
cmovnel %r15d, %edx
cmovel %r12d, %esi
movl %esi, %r12d
movl %edx, %r15d
cmpl %esi, %edx
jle 0x6b8b
leaq 0x66b2(%rip), %rax      # 0xd288
cmpl $0x2, 0x18(%rax)
jge 0x6be9
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x6408(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movl 0x4(%rsp), %ecx
leaq 0x1e03(%rip), %rsi      # 0x8a01
movl %ebx, %edx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2260
jmp 0x6bdc
// File: /workspace/github_c_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x20, %rsp
movl %esi, %r14d
movl %edi, %r15d
movq $0x0, 0x8(%rsp)
movl $0x1, 0x4(%rsp)
movl %esi, %edi
callq 0x6aa9
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x6d17
movl %eax, %ebp
leaq 0x4(%rsp), %rcx
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x20d0
testl %r14d, %r14d
je 0x6c70
movl %ebp, %edi
callq 0x6b21
jmp 0x6cc5
leaq 0x4(%rsp), %r12
movl %ebp, %edi
movl $0x1, %esi
movl $0x9, %edx
movq %r12, %rcx
movl $0x4, %r8d
callq 0x20d0
leaq 0x8(%rsp), %rcx
movl %ebp, %edi
movl $0x1, %esi
movl $0xd, %edx
movl $0x8, %r8d
callq 0x20d0
movl %ebp, %edi
movl $0x6, %esi
movl $0x1, %edx
movq %r12, %rcx
movl $0x4, %r8d
callq 0x20d0
leaq 0x10(%rsp), %rsi
movq $0x0, 0x8(%rsi)
movw $0x2, (%rsi)
rolw $0x8, %r15w
movw %r15w, 0x2(%rsi)
leaq 0x65a0(%rip), %rax      # 0xd288
movl 0x14(%rax), %eax
movl %eax, 0x4(%rsi)
movl %ebp, %edi
movl $0x10, %edx
callq 0x2350
cmpl $-0x1, %eax
je 0x6d26
testl %r14d, %r14d
jne 0x6d15
movl %ebp, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x22e0
cmpl $-0x1, %eax
je 0x6d2f
movl %ebp, %ebx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1cf4(%rip), %rdi      # 0x8a21
jmp 0x6d36
leaq 0x1cf2(%rip), %rdi      # 0x8a28
callq 0x23b0
movl %ebp, %edi
callq 0x21b0
jmp 0x6d17
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2460
cmpl $-0x1, %eax
je 0x6da3
movl %eax, %ebx
movl %eax, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20f0
testl %eax, %eax
js 0x6d8e
orl $0x800, %eax            # imm = 0x800
movl %ebx, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x20f0
testl %eax, %eax
js 0x6d8e
movl %ebx, %eax
popq %rbx
retq
leaq 0x1b94(%rip), %rdi      # 0x8929
callq 0x23b0
movl %ebx, %edi
callq 0x21b0
jmp 0x6daf
leaq 0x1c38(%rip), %rdi      # 0x89e2
callq 0x23b0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x6d8a
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
subq $0x118, %rsp            # imm = 0x118
movq $0x0, 0x10(%rsp)
movl $0x1, 0xc(%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x6ed3
movq %rdi, %r14
callq 0x6d44
cmpl $-0x1, %eax
je 0x6ed3
movl %eax, %ebp
leaq 0x88(%rsp), %rsi
movq %r14, %rdi
callq 0x2200
testl %eax, %eax
jne 0x6e24
movl $0xf000, %eax           # imm = 0xF000
andl 0xa0(%rsp), %eax
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x6e24
movq %r14, %rdi
callq 0x2050
leaq 0xc(%rsp), %r15
movl %ebp, %edi
movl $0x1, %esi
movl $0x2, %edx
movq %r15, %rcx
movl $0x4, %r8d
callq 0x20d0
movl %ebp, %edi
movl $0x1, %esi
movl $0x9, %edx
movq %r15, %rcx
movl $0x4, %r8d
callq 0x20d0
leaq 0x10(%rsp), %rcx
movl %ebp, %edi
movl $0x1, %esi
movl $0xd, %edx
movl $0x8, %r8d
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
movl %ebp, %edi
movl $0x6e, %edx
callq 0x2350
cmpl $-0x1, %eax
je 0x6ee3
movl %ebp, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x22e0
cmpl $-0x1, %eax
je 0x6eec
movl %ebp, %ebx
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b37(%rip), %rdi      # 0x8a21
jmp 0x6ef3
leaq 0x1b35(%rip), %rdi      # 0x8a28
callq 0x23b0
movl %ebp, %edi
callq 0x21b0
jmp 0x6ed3
// File: /workspace/github_c_makefile_star2_O3/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 0x6367(%rip), %rax      # 0xd270
movl (%rax), %edi
testl %edi, %edi
je 0x6f14
callq 0x21b0
leaq 0x632d(%rip), %rax      # 0xd248
movl (%rax), %edi
testl %edi, %edi
js 0x6f26
callq 0x21b0
movl $0x3, %ebx
movl %ebx, %edi
callq 0x21b0
incl %ebx
cmpl $0x1f5, %ebx            # imm = 0x1F5
jne 0x6f2b
callq 0x2100
movl %eax, %edi
movl $0x6, %esi
popq %rbx
jmp 0x22a0
// File: /workspace/github_c_makefile_star2_O3/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
movl 0x77e9(%rip), %eax      # 0xe758
testl %eax, %eax
jle 0x6fcb
xorl %r14d, %r14d
movq 0x77e3(%rip), %rcx      # 0xe760
leaq 0x63bc(%rip), %r15      # 0xd340
xorl %ebp, %ebp
movq (%rcx,%r14,8), %rbx
movl (%r15), %edx
cmpl 0x1c(%rbx), %edx
jae 0x6f9d
movslq %ebp, %rdx
incl %ebp
movq %rbx, (%rcx,%rdx,8)
jmp 0x6fbe
andb $-0x3, 0x27(%rbx)
movq %rbx, %rdi
callq 0x46bd
movq %rbx, %rdi
callq 0x489a
movq 0x77a8(%rip), %rcx      # 0xe760
movl 0x779a(%rip), %eax      # 0xe758
incq %r14
movslq %eax, %rdx
cmpq %rdx, %r14
jl 0x6f86
jmp 0x6fcd
xorl %ebp, %ebp
movl %ebp, 0x7785(%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_O3/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 0x776e
movq %rdi, %rax
cmpq $0x278d01, %rdi         # imm = 0x278D01
jl 0x7771
subl 0x40(%rsi), %eax
retq
xorl %eax, %eax
retq
leaq 0x5bc8(%rip), %rcx      # 0xd340
addl (%rcx), %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x157c(%rip), %rdi      # 0x8efb
callq 0x20b0
leaq 0x1582(%rip), %rdi      # 0x8f0d
callq 0x20b0
leaq 0x159d(%rip), %rdi      # 0x8f34
callq 0x20b0
leaq 0x15d8(%rip), %rdi      # 0x8f7b
callq 0x20b0
leaq 0x1607(%rip), %rdi      # 0x8fb6
callq 0x20b0
leaq 0x1619(%rip), %rdi      # 0x8fd4
callq 0x20b0
leaq 0x1634(%rip), %rdi      # 0x8ffb
callq 0x20b0
leaq 0x166c(%rip), %rdi      # 0x903f
callq 0x20b0
leaq 0x16a9(%rip), %rdi      # 0x9088
callq 0x20b0
leaq 0x16e9(%rip), %rdi      # 0x90d4
callq 0x20b0
leaq 0x1719(%rip), %rdi      # 0x9110
callq 0x20b0
leaq 0x1736(%rip), %rdi      # 0x9139
callq 0x20b0
leaq 0x176c(%rip), %rdi      # 0x917b
callq 0x20b0
leaq 0x17a1(%rip), %rdi      # 0x91bc
callq 0x20b0
leaq 0x17bc(%rip), %rdi      # 0x91e3
callq 0x20b0
leaq 0x17e3(%rip), %rdi      # 0x9216
callq 0x20b0
leaq 0x1811(%rip), %rdi      # 0x9250
callq 0x20b0
leaq 0x1840(%rip), %rdi      # 0x928b
callq 0x20b0
leaq 0x1869(%rip), %rdi      # 0x92c0
popq %rax
jmp 0x20b0
// File: /workspace/github_c_makefile_star2_O3/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 0x7b2b
movq %rdi, %r14
cmpq $0x0, 0x18(%rdi)
jne 0x7b2b
cmpq $0x0, 0x20(%r14)
jne 0x7b2b
movq 0x8(%r14), %rsi
movl $0x1, %edi
callq 0x2220
testq %rax, %rax
je 0x7b2b
movq %rax, 0x18(%r14)
movl 0x10(%r14), %eax
movq %rax, 0x20(%r14)
incq 0x28(%r14)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7b74
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x18(%rdi)
jne 0x7b58
cmpq $0x0, 0x40(%rbx)
jne 0x7b58
movq %rbx, %rdi
callq 0x7ae7
testl %eax, %eax
je 0x7b8e
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x7b77
movq 0x30(%rbx), %rcx
leaq -0x1(%rax), %rdx
movq %rdx, 0x40(%rbx)
movq -0x8(%rcx,%rax,8), %rax
jmp 0x7b98
xorl %eax, %eax
retq
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x7b8e
decq 0x20(%rbx)
je 0x7b92
movq (%rbx), %rcx
addq %rax, %rcx
jmp 0x7b94
xorl %eax, %eax
jmp 0x7b98
xorl %ecx, %ecx
movq %rcx, 0x18(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7c09
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x40(%rdi), %rcx
cmpq 0x38(%rdi), %rcx
jne 0x7bf4
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
movl $0x10, %r15d
cmovneq %rax, %r15
movq 0x30(%r14), %rdi
leaq (,%r15,8), %rsi
callq 0x2310
testq %rax, %rax
je 0x7c04
movq %rax, 0x30(%r14)
movq %r15, 0x38(%r14)
movq 0x40(%r14), %rcx
jmp 0x7bf8
movq 0x30(%r14), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x40(%r14)
movq %rbx, (%rax,%rcx,8)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x8e43
movl %eax, %ecx
movl $0x8, %eax
testl %ecx, %ecx
je 0x2499
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
cmpl $0x20, %ebx
je 0x24af
cmpl $0x40, %ebx
je 0x2492
cmpl $0x30, %ebx
jne 0x24b6
movl $0x4, %eax
jmp 0x2492
movl $0x1, %eax
jmp 0x2492
leaq 0x7b57(%rip), %rdi      # 0xa014
movl %ebx, %esi
callq 0x6991
xorl %eax, %eax
jmp 0x2492
// File: /workspace/github_c_makefile_star2_O3/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 0xce41(%rip), %rdx      # 0xf330
cmpq %rcx, %rax
je 0x24fb
movl $0x1, (%rcx,%rdx)
addq $0x4, %rcx
cmpq $0x10, %rcx
jne 0x24ef
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xce1c(%rip), %rax      # 0xf330
xorl %ebx, %ebx
cmpl $0x0, (%rax)
jne 0x256d
incq %rbx
addq $0x4, %rax
cmpq $0x4, %rbx
jne 0x2516
movl 0xce12(%rip), %eax      # 0xf340
leal 0x3(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
andl $-0x4, %ecx
movl %eax, %ebx
subl %ecx, %ebx
incl %eax
movl %eax, 0xcdfb(%rip)      # 0xf340
leaq 0xce3c(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xc797(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rdx
leaq 0x7fa4(%rip), %rsi      # 0xa508
xorl %eax, %eax
callq 0x2100
jmp 0x2573
movl $0x0, (%rax)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xcda3(%rip), %r14      # 0xf330
cmpl $0x0, (%r14,%rbx,4)
je 0x25a2
movl %edi, %esi
leaq 0x7a8f(%rip), %rdi      # 0xa02c
callq 0x6991
movl 0xcd98(%rip), %eax      # 0xf340
testl %eax, %eax
jle 0x25de
decl %eax
movl %eax, 0xcd8c(%rip)      # 0xf340
andl $0x3, %eax
leaq 0xcdca(%rip), %rcx      # 0xf388
movq (%rcx), %rdi
leaq 0xc728(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rdx
leaq 0x81e1(%rip), %rsi      # 0xa7b4
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x2100
movl $0x1, (%r14,%rbx,4)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
movq %rdi, %rbx
xorl %eax, %eax
leaq 0xcceb(%rip), %rcx      # 0xf330
movl $0x1, (%rax,%rcx)
addq $0x4, %rax
cmpq $0x10, %rax
jne 0x2645
cmpl $0x1, 0xccc3(%rip)      # 0xf320
je 0x267f
leaq 0xcd22(%rip), %rax      # 0xf388
movq (%rax), %rsi
leaq 0x7994(%rip), %rdi      # 0xa004
callq 0x20c0
movl $0x1, 0xcca1(%rip)      # 0xf320
leaq 0xcd02(%rip), %r14      # 0xf388
movq (%r14), %rcx
leaq 0x79ba(%rip), %rdi      # 0xa04a
movl $0x9, %esi
movl $0x1, %edx
callq 0x2170
movq (%r14), %rsi
movl $0x22, %edi
callq 0x20e0
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x20c0
movq (%r14), %rsi
movl $0x22, %edi
callq 0x20e0
movq (%r14), %rsi
movl $0xa, %edi
callq 0x20e0
movq (%r14), %rdi
leaq 0x7979(%rip), %rsi      # 0xa054
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x2100
// File: /workspace/github_c_makefile_star2_O3/ejunjsh[P]mycc/cg.c
// Function: cgfuncpreamble
void cgfuncpreamble(struct symtable *sym) {
  char *name = sym->name;
  struct symtable *parm, *locvar;
  int cnt;
  int paramOffset = 16;		// 超过6个的那部分参数所在栈的开始位置
  int paramReg = FIRSTPARAMREG;	// 上面参数寄存器列表的索引

  // 输出text段，重设本地变量位移
  cgtextseg();
  localOffset = 0;

  // 输出函数开始标签，保存%rbp 和 %rsp
  if (sym->class == C_GLOBAL)
    fprintf(Outfile, "\t.globl\t%s\n" "\t.type\t%s, @function\n", name, name);
  fprintf(Outfile, "%s:\n" "\tpushq\t%%rbp\n" "\tmovq\t%%rsp, %%rbp\n", name);

  // 拷贝在寄存器里面的参数到栈
  // 如果大于6个参数都已经在栈了
  for (parm = sym->member, cnt = 1; parm != NULL; parm = parm->next, cnt++) {
    if (cnt > 6) {
      parm->stu.st_posn = paramOffset;
      paramOffset += 8;
    } else {
      parm->stu.st_posn = newlocaloffset(parm->size);
      cgstorlocal(paramReg--, parm);
    }
  }

  // 计算本地变量的栈位置
  for (locvar = Loclhead; locvar != NULL; locvar = locvar->next) {
    locvar->stu.st_posn = newlocaloffset(locvar->size);
  }

  // 对齐栈指针到16的倍数
  stackOffset = (localOffset + 15) & ~15;
  fprintf(Outfile, "\taddq\t$%d,%%rsp\n", -stackOffset);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
cmpl $0x1, 0xcc18(%rip)      # 0xf320
je 0x272a
leaq 0xcc77(%rip), %rax      # 0xf388
movq (%rax), %rsi
leaq 0x78e9(%rip), %rdi      # 0xa004
callq 0x20c0
movl $0x1, 0xcbf6(%rip)      # 0xf320
movl $0x0, 0xcc10(%rip)      # 0xf344
cmpl $0x1, 0x24(%rbx)
jne 0x2758
leaq 0xcc47(%rip), %rax      # 0xf388
movq (%rax), %rdi
leaq 0x7b00(%rip), %rsi      # 0xa24b
movq %r14, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x2100
leaq 0xcc29(%rip), %rax      # 0xf388
movq (%rax), %rdi
leaq 0x7b03(%rip), %rsi      # 0xa26c
movq %r14, %rdx
xorl %eax, %eax
callq 0x2100
movq 0x40(%rbx), %rbx
testq %rbx, %rbx
je 0x27d7
movl $0x1, %r14d
movl $0x10, %r12d
movl $0x9, %edi
movl $0x4, %r13d
cmpl $0x7, %r14d
jb 0x27a2
movl %r12d, (%rbx)
addl $0x8, %r12d
jmp 0x27cb
movl 0x28(%rbx), %eax
cmpl $0x5, %eax
cmovll %r13d, %eax
addl 0xcb92(%rip), %eax      # 0xf344
movl %eax, 0xcb8c(%rip)      # 0xf344
negl %eax
movl %eax, (%rbx)
leal -0x1(%rdi), %r15d
movq %rbx, %rsi
callq 0x284b
movl %r15d, %edi
incl %r14d
movq 0x38(%rbx), %rbx
testq %rbx, %rbx
jne 0x2793
movl 0xcb67(%rip), %edx      # 0xf344
leaq 0xce0c(%rip), %rax      # 0xf5f0
movq (%rax), %rax
testq %rax, %rax
je 0x2817
movl $0x4, %ecx
movl 0x28(%rax), %esi
cmpl $0x5, %esi
cmovll %ecx, %esi
addl %esi, %edx
movl %edx, 0xcb42(%rip)      # 0xf344
movl %edx, %esi
negl %esi
movl %esi, (%rax)
movq 0x38(%rax), %rax
testq %rax, %rax
jne 0x27f1
movl 0xcb2d(%rip), %edx      # 0xf344
addl $0xf, %edx
andl $-0x10, %edx
movl %edx, 0xcb25(%rip)      # 0xf348
leaq 0xcb5e(%rip), %rax      # 0xf388
movq (%rax), %rdi
negl %edx
leaq 0x7a5b(%rip), %rsi      # 0xa291
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2100
// File: /workspace/github_c_makefile_star2_O3/ejunjsh[P]mycc/cg.c
// Function: cgstorlocal
int cgstorlocal(int r, struct symtable *sym) {

  if (cgprimsize(sym->type) == 8) {
    fprintf(Outfile, "\tmovq\t%s, %d(%%rbp)\n", reglist[r], sym->stu.st_posn);
  } else
    switch (sym->type) {
    case P_CHAR:
      fprintf(Outfile, "\tmovb\t%s, %d(%%rbp)\n", breglist[r], sym->stu.st_posn);
      break;
    case P_INT:
      fprintf(Outfile, "\tmovl\t%s, %d(%%rbp)\n", dreglist[r], sym->stu.st_posn);
      break;
    default:
      fatald("Bad type in cgstorlocal:", sym->type);
    }
  return (r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edi, %ebx
movl 0x10(%rsi), %edi
callq 0x247a
cmpl $0x8, %eax
jne 0x2888
leaq 0xcb1d(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xc478(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rdx
movl (%r14), %ecx
leaq 0x7d01(%rip), %rsi      # 0xa587
jmp 0x28dc
movl 0x10(%r14), %esi
cmpl $0x30, %esi
je 0x28ba
cmpl $0x20, %esi
jne 0x28ea
leaq 0xcaeb(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xc496(%rip), %rcx      # 0xed40
movq (%rcx,%rax,8), %rdx
movl (%r14), %ecx
leaq 0x7ce4(%rip), %rsi      # 0xa59c
jmp 0x28dc
leaq 0xcac7(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xc4c2(%rip), %rcx      # 0xed90
movq (%rcx,%rax,8), %rdx
movl (%r14), %ecx
leaq 0x7cd5(%rip), %rsi      # 0xa5b1
xorl %eax, %eax
callq 0x2100
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x7cd5(%rip), %rdi      # 0xa5c6
callq 0x6991
jmp 0x28e3
// File: /workspace/github_c_makefile_star2_O3/ejunjsh[P]mycc/cg.c
// Function: cgfuncpostamble
void cgfuncpostamble(struct symtable *sym) {
  cglabel(sym->stu.st_endlabel);
  fprintf(Outfile, "\taddq\t$%d,%%rsp\n", stackOffset);
  fputs("\tpopq	%rbp\n" "\tret\n", Outfile);
  cgfreeallregs(NOREG);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl (%rdi), %edx
leaq 0xca80(%rip), %r14      # 0xf388
movq (%r14), %rdi
leaq 0x7d68(%rip), %rsi      # 0xa67a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2100
movq (%r14), %rdi
movl 0xca24(%rip), %edx      # 0xf348
leaq 0x7966(%rip), %rsi      # 0xa291
xorl %eax, %eax
callq 0x2100
movq (%r14), %rsi
leaq 0x7966(%rip), %rdi      # 0xa2a2
callq 0x20c0
leaq 0xc9e8(%rip), %rax      # 0xf330
movl $0x1, (%rbx,%rax)
addq $0x4, %rbx
cmpq $0x10, %rbx
jne 0x2948
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ejunjsh[P]mycc/cg.c
// Function: cgloadint
int cgloadint(int value, int type) {
  // 分配一个新的寄存器
  int r = cgallocreg();

  fprintf(Outfile, "\tmovq\t$%d, %s\n", value, reglist[r]);
  return (r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
callq 0x2507
leaq 0xc9f6(%rip), %rcx      # 0xf388
movq (%rcx), %rdi
movslq %eax, %r14
leaq 0xc351(%rip), %rax      # 0xecf0
movq (%rax,%r14,8), %rcx
leaq 0x7909(%rip), %rsi      # 0xa2b3
movl %ebx, %edx
xorl %eax, %eax
callq 0x2100
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ejunjsh[P]mycc/cg.c
// Function: cgloadglobstr
int cgloadglobstr(int label) {
  // 分配一个新的寄存器
  int r = cgallocreg();
  fprintf(Outfile, "\tleaq\tL%d(%%rip), %s\n", label, reglist[r]);
  return (r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
callq 0x2507
leaq 0xc6ba(%rip), %rcx      # 0xf388
movq (%rcx), %rdi
movslq %eax, %r14
leaq 0xc015(%rip), %rax      # 0xecf0
movq (%rax,%r14,8), %rcx
leaq 0x76bc(%rip), %rsi      # 0xa3a2
movl %ebx, %edx
xorl %eax, %eax
callq 0x2100
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ejunjsh[P]mycc/cg.c
// Function: cgdivmod
int cgdivmod(int r1, int r2, int op) {
  fprintf(Outfile, "\tmovq\t%s,%%rax\n", reglist[r1]);
  fprintf(Outfile, "\tcqo\n");
  fprintf(Outfile, "\tidivq\t%s\n", reglist[r2]);
  if (op == A_DIVIDE)
    fprintf(Outfile, "\tmovq\t%%rax,%s\n", reglist[r1]);
  else
    fprintf(Outfile, "\tmovq\t%%rdx,%s\n", reglist[r1]);
  cgfreereg(r2);
  return (r1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %r12d
leaq 0xc5a4(%rip), %r13      # 0xf388
movq (%r13), %rax
movslq %edi, %rbx
leaq 0xbefe(%rip), %rcx      # 0xecf0
movq (%rcx,%rbx,8), %r14
leaq 0x75e6(%rip), %rsi      # 0xa3e3
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2100
movq (%r13), %rcx
leaq 0x75de(%rip), %rdi      # 0xa3f3
movl $0x5, %esi
movl $0x1, %edx
callq 0x2170
movq (%r13), %rdi
movslq %r12d, %r12
leaq 0xbebe(%rip), %rax      # 0xecf0
movq (%rax,%r12,8), %rdx
leaq 0x75bc(%rip), %rsi      # 0xa3f9
xorl %eax, %eax
callq 0x2100
cmpl $0x18, %r15d
movq (%r13), %rdi
leaq 0x75b1(%rip), %rax      # 0xa404
leaq 0x75ba(%rip), %rsi      # 0xa414
cmoveq %rax, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2100
movl %r12d, %edi
callq 0x257c
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ejunjsh[P]mycc/cg.c
// Function: cgshl
int cgshl(int r1, int r2) {
  fprintf(Outfile, "\tmovb\t%s, %%cl\n", breglist[r2]);
  fprintf(Outfile, "\tshlq\t%%cl, %s\n", reglist[r1]);
  cgfreereg(r2);
  return (r1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0xc422(%rip), %r15      # 0xf388
movq (%r15), %rdi
movslq %esi, %r14
leaq 0xbdcd(%rip), %rax      # 0xed40
movq (%rax,%r14,8), %rdx
leaq 0x74cf(%rip), %rsi      # 0xa44d
xorl %eax, %eax
callq 0x2100
movq (%r15), %rdi
movslq %ebx, %rbx
leaq 0xbd5e(%rip), %rax      # 0xecf0
movq (%rax,%rbx,8), %rdx
leaq 0x74c0(%rip), %rsi      # 0xa45d
xorl %eax, %eax
callq 0x2100
movl %r14d, %edi
callq 0x257c
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ejunjsh[P]mycc/cg.c
// Function: cgshr
int cgshr(int r1, int r2) {
  fprintf(Outfile, "\tmovb\t%s, %%cl\n", breglist[r2]);
  fprintf(Outfile, "\tshrq\t%%cl, %s\n", reglist[r1]);
  cgfreereg(r2);
  return (r1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0xc3bc(%rip), %r15      # 0xf388
movq (%r15), %rdi
movslq %esi, %r14
leaq 0xbd67(%rip), %rax      # 0xed40
movq (%rax,%r14,8), %rdx
leaq 0x7469(%rip), %rsi      # 0xa44d
xorl %eax, %eax
callq 0x2100
movq (%r15), %rdi
movslq %ebx, %rbx
leaq 0xbcf8(%rip), %rax      # 0xecf0
movq (%rax,%rbx,8), %rdx
leaq 0x746a(%rip), %rsi      # 0xa46d
xorl %eax, %eax
callq 0x2100
movl %r14d, %edi
callq 0x257c
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ejunjsh[P]mycc/cg.c
// Function: cglognot
int cglognot(int r) {
  fprintf(Outfile, "\ttest\t%s, %s\n", reglist[r], reglist[r]);
  fprintf(Outfile, "\tsete\t%s\n", breglist[r]);
  fprintf(Outfile, "\tmovzbq\t%s, %s\n", breglist[r], reglist[r]);
  return (r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0xc2e7(%rip), %r12      # 0xf388
movq (%r12), %rax
movslq %edi, %rbx
leaq 0xbc41(%rip), %rcx      # 0xecf0
movq (%rcx,%rbx,8), %r14
leaq 0x73d7(%rip), %rsi      # 0xa491
movq %rax, %rdi
movq %r14, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x2100
movq (%r12), %rdi
leaq 0xbc6b(%rip), %rax      # 0xed40
movq (%rax,%rbx,8), %r15
leaq 0x73bf(%rip), %rsi      # 0xa49f
movq %r15, %rdx
xorl %eax, %eax
callq 0x2100
movq (%r12), %rdi
leaq 0x73b4(%rip), %rsi      # 0xa4a9
movq %r15, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x2100
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq