LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/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 0x6ba6
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x6e12
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 0x6d6d
movl %ebp, %edi
callq 0x6c1e
jmp 0x6dc2
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
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
movw $0x2, (%rsi)
rolw $0x8, %r15w
movw %r15w, 0x2(%rsi)
leaq 0x64a5(%rip), %rax      # 0xd288
movl 0x14(%rax), %eax
movl %eax, 0x4(%rsi)
movl %ebp, %edi
movl $0x10, %edx
callq 0x2350
cmpl $-0x1, %eax
je 0x6e21
testl %r14d, %r14d
jne 0x6e10
movl %ebp, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x22e0
cmpl $-0x1, %eax
je 0x6e2a
movl %ebp, %ebx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1bf9(%rip), %rdi      # 0x8a21
jmp 0x6e31
leaq 0x1bf7(%rip), %rdi      # 0x8a28
callq 0x23b0
movl %ebp, %edi
callq 0x21b0
jmp 0x6e12
// File: /workspace/github_c_makefile_star2_O1/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 0x6e9e
movl %eax, %ebx
movl %eax, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20f0
testl %eax, %eax
js 0x6e89
orl $0x800, %eax            # imm = 0x800
movl %ebx, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x20f0
testl %eax, %eax
js 0x6e89
movl %ebx, %eax
popq %rbx
retq
leaq 0x1a99(%rip), %rdi      # 0x8929
callq 0x23b0
movl %ebx, %edi
callq 0x21b0
jmp 0x6eaa
leaq 0x1b3d(%rip), %rdi      # 0x89e2
callq 0x23b0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x6e85
// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%rsp)
movl $0x1, 0x4(%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x6fcf
movq %rdi, %r14
callq 0x6e3f
cmpl $-0x1, %eax
je 0x6fcf
movl %eax, %ebp
leaq 0x88(%rsp), %rsi
movq %r14, %rdi
callq 0x2200
testl %eax, %eax
jne 0x6f1f
movl $0xf000, %eax           # imm = 0xF000
andl 0xa0(%rsp), %eax
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x6f1f
movq %r14, %rdi
callq 0x2050
leaq 0x4(%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 0x8(%rsp), %rcx
movl %ebp, %edi
movl $0x1, %esi
movl $0xd, %edx
movl $0x8, %r8d
callq 0x20d0
xorps %xmm0, %xmm0
leaq 0x12(%rsp), %rdi
movaps %xmm0, -0x2(%rdi)
movaps %xmm0, 0xe(%rdi)
movaps %xmm0, 0x1e(%rdi)
movaps %xmm0, 0x2e(%rdi)
movaps %xmm0, 0x3e(%rdi)
movaps %xmm0, 0x4e(%rdi)
movups %xmm0, 0x5c(%rdi)
movw $0x1, -0x2(%rdi)
movq %r14, %rsi
callq 0x2090
leaq 0x10(%rsp), %rsi
movl %ebp, %edi
movl $0x6e, %edx
callq 0x2350
cmpl $-0x1, %eax
je 0x6fdf
movl %ebp, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x22e0
cmpl $-0x1, %eax
je 0x6fe8
movl %ebp, %ebx
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a3b(%rip), %rdi      # 0x8a21
jmp 0x6fef
leaq 0x1a39(%rip), %rdi      # 0x8a28
callq 0x23b0
movl %ebp, %edi
callq 0x21b0
jmp 0x6fcf
// File: /workspace/github_c_makefile_star2_O1/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 0x626b(%rip), %rax      # 0xd270
movl (%rax), %edi
testl %edi, %edi
je 0x7010
callq 0x21b0
leaq 0x6231(%rip), %rax      # 0xd248
movl (%rax), %edi
testl %edi, %edi
js 0x7022
callq 0x21b0
movl $0x3, %ebx
movl %ebx, %edi
callq 0x21b0
incl %ebx
cmpl $0x1f5, %ebx            # imm = 0x1F5
jne 0x7027
callq 0x2100
movl %eax, %edi
movl $0x6, %esi
popq %rbx
jmp 0x22a0
// File: /workspace/github_c_makefile_star2_O1/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
cmpl $0x0, 0x76ec(%rip)      # 0xe758
jle 0x70bd
xorl %r14d, %r14d
leaq 0x62c8(%rip), %r15      # 0xd340
xorl %ebp, %ebp
movq 0x76df(%rip), %rax      # 0xe760
movq (%rax,%r14,8), %rbx
movl (%r15), %ecx
cmpl 0x1c(%rbx), %ecx
jae 0x7098
movslq %ebp, %rcx
incl %ebp
movq %rbx, (%rax,%rcx,8)
jmp 0x70ac
andb $-0x3, 0x27(%rbx)
movq %rbx, %rdi
callq 0x46be
movq %rbx, %rdi
callq 0x489f
incq %r14
movslq 0x76a2(%rip), %rax      # 0xe758
cmpq %rax, %r14
jl 0x707a
jmp 0x70bf
xorl %ebp, %ebp
movl %ebp, 0x7693(%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_O1/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 0x7882
movq %rdi, %rax
cmpq $0x278d01, %rdi         # imm = 0x278D01
jl 0x7885
subl 0x40(%rsi), %eax
retq
xorl %eax, %eax
retq
leaq 0x5ab4(%rip), %rcx      # 0xd340
addl (%rcx), %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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 0x1468(%rip), %rdi      # 0x8efb
callq 0x20b0
leaq 0x146e(%rip), %rdi      # 0x8f0d
callq 0x20b0
leaq 0x1489(%rip), %rdi      # 0x8f34
callq 0x20b0
leaq 0x14c4(%rip), %rdi      # 0x8f7b
callq 0x20b0
leaq 0x14f3(%rip), %rdi      # 0x8fb6
callq 0x20b0
leaq 0x1505(%rip), %rdi      # 0x8fd4
callq 0x20b0
leaq 0x1520(%rip), %rdi      # 0x8ffb
callq 0x20b0
leaq 0x1558(%rip), %rdi      # 0x903f
callq 0x20b0
leaq 0x1595(%rip), %rdi      # 0x9088
callq 0x20b0
leaq 0x15d5(%rip), %rdi      # 0x90d4
callq 0x20b0
leaq 0x1605(%rip), %rdi      # 0x9110
callq 0x20b0
leaq 0x1622(%rip), %rdi      # 0x9139
callq 0x20b0
leaq 0x1658(%rip), %rdi      # 0x917b
callq 0x20b0
leaq 0x168d(%rip), %rdi      # 0x91bc
callq 0x20b0
leaq 0x16a8(%rip), %rdi      # 0x91e3
callq 0x20b0
leaq 0x16cf(%rip), %rdi      # 0x9216
callq 0x20b0
leaq 0x16fd(%rip), %rdi      # 0x9250
callq 0x20b0
leaq 0x172c(%rip), %rdi      # 0x928b
callq 0x20b0
leaq 0x1755(%rip), %rdi      # 0x92c0
popq %rax
jmp 0x20b0
// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r14
movl $0x1, %edi
movl $0x50, %esi
callq 0x2220
testq %rax, %rax
je 0x7bf7
movq %rax, %rbx
addq $0x7, %r14
andq $-0x8, %r14
addq $0xfffff, %r15          # imm = 0xFFFFF
andq $-0x100000, %r15        # imm = 0xFFF00000
movq %r14, (%rax)
movq %r15, 0x8(%rax)
movq %r15, %rax
xorl %edx, %edx
divq %r14
movl %eax, 0x10(%rbx)
movq $0x0, 0x28(%rbx)
movl $0xabcdefaa, 0x48(%rbx) # imm = 0xABCDEFAA
testl %ebp, %ebp
je 0x7bf9
movq %rbx, %rdi
callq 0x7c07
jmp 0x7bf9
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x7c4b
movq %rdi, %r14
cmpq $0x0, 0x18(%rdi)
jne 0x7c4b
cmpq $0x0, 0x20(%r14)
jne 0x7c4b
movq 0x8(%r14), %rsi
movl $0x1, %edi
callq 0x2220
testq %rax, %rax
je 0x7c4b
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_O1/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 0x7c94
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x18(%rdi)
jne 0x7c78
cmpq $0x0, 0x40(%rbx)
jne 0x7c78
movq %rbx, %rdi
callq 0x7c07
testl %eax, %eax
je 0x7cae
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x7c97
movq 0x30(%rbx), %rcx
leaq -0x1(%rax), %rdx
movq %rdx, 0x40(%rbx)
movq -0x8(%rcx,%rax,8), %rax
jmp 0x7cb8
xorl %eax, %eax
retq
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x7cae
decq 0x20(%rbx)
je 0x7cb2
movq (%rbx), %rcx
addq %rax, %rcx
jmp 0x7cb4
xorl %eax, %eax
jmp 0x7cb8
xorl %ecx, %ecx
movq %rcx, 0x18(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x7d27
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x38(%rdi), %rax
cmpq %rax, 0x40(%rdi)
jne 0x7d0e
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x10, %r15d
cmovneq %rcx, %r15
movq 0x30(%r14), %rdi
leaq (,%r15,8), %rsi
callq 0x2310
testq %rax, %rax
je 0x7d22
movq %rax, 0x30(%r14)
movq %r15, 0x38(%r14)
movq 0x30(%r14), %rax
movq 0x40(%r14), %rcx
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_O1/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 0x8dcb
movl %eax, %ecx
movl $0x8, %eax
testl %ecx, %ecx
je 0x2479
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
cmpl $0x20, %ebx
je 0x248f
cmpl $0x40, %ebx
je 0x2472
cmpl $0x30, %ebx
jne 0x2496
movl $0x4, %eax
jmp 0x2472
movl $0x1, %eax
jmp 0x2472
leaq 0x7b77(%rip), %rdi      # 0xa014
movl %ebx, %esi
callq 0x68e9
xorl %eax, %eax
jmp 0x2472
// File: /workspace/github_c_makefile_star2_O1/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 0xce61(%rip), %rdx      # 0xf330
cmpq %rcx, %rax
je 0x24db
movl $0x1, (%rcx,%rdx)
addq $0x4, %rcx
cmpq $0x10, %rcx
jne 0x24cf
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xce3c(%rip), %rax      # 0xf330
xorl %ebx, %ebx
cmpl $0x0, (%rax)
jne 0x254d
incq %rbx
addq $0x4, %rax
cmpq $0x4, %rbx
jne 0x24f6
movl 0xce32(%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, 0xce1b(%rip)      # 0xf340
leaq 0xce5c(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xc7b7(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rdx
leaq 0x7fc4(%rip), %rsi      # 0xa508
xorl %eax, %eax
callq 0x2100
jmp 0x2553
movl $0x0, (%rax)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xcdc3(%rip), %r14      # 0xf330
cmpl $0x0, (%r14,%rbx,4)
je 0x2582
movl %edi, %esi
leaq 0x7aaf(%rip), %rdi      # 0xa02c
callq 0x68e9
movl 0xcdb8(%rip), %eax      # 0xf340
testl %eax, %eax
jle 0x25be
decl %eax
movl %eax, 0xcdac(%rip)      # 0xf340
andl $0x3, %eax
leaq 0xcdea(%rip), %rcx      # 0xf388
movq (%rcx), %rdi
leaq 0xc748(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rdx
leaq 0x8201(%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_O1/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 0xcd0b(%rip), %rcx      # 0xf330
movl $0x1, (%rax,%rcx)
addq $0x4, %rax
cmpq $0x10, %rax
jne 0x2625
cmpl $0x1, 0xcce3(%rip)      # 0xf320
je 0x265f
leaq 0xcd42(%rip), %rax      # 0xf388
movq (%rax), %rsi
leaq 0x79b4(%rip), %rdi      # 0xa004
callq 0x20c0
movl $0x1, 0xccc1(%rip)      # 0xf320
leaq 0xcd22(%rip), %r14      # 0xf388
movq (%r14), %rcx
leaq 0x79da(%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 0x7999(%rip), %rsi      # 0xa054
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x2100
// File: /workspace/github_c_makefile_star2_O1/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, 0xcc38(%rip)      # 0xf320
je 0x270a
leaq 0xcc97(%rip), %rax      # 0xf388
movq (%rax), %rsi
leaq 0x7909(%rip), %rdi      # 0xa004
callq 0x20c0
movl $0x1, 0xcc16(%rip)      # 0xf320
movl $0x0, 0xcc30(%rip)      # 0xf344
cmpl $0x1, 0x24(%rbx)
jne 0x2738
leaq 0xcc67(%rip), %rax      # 0xf388
movq (%rax), %rdi
leaq 0x7b20(%rip), %rsi      # 0xa24b
movq %r14, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x2100
leaq 0xcc49(%rip), %rax      # 0xf388
movq (%rax), %rdi
leaq 0x7b23(%rip), %rsi      # 0xa26c
movq %r14, %rdx
xorl %eax, %eax
callq 0x2100
movq 0x40(%rbx), %rbx
testq %rbx, %rbx
je 0x27b7
movl $0x1, %r14d
movl $0x10, %r12d
movl $0x9, %edi
movl $0x4, %r13d
cmpl $0x7, %r14d
jb 0x2782
movl %r12d, (%rbx)
addl $0x8, %r12d
jmp 0x27ab
movl 0x28(%rbx), %eax
cmpl $0x5, %eax
cmovll %r13d, %eax
addl 0xcbb2(%rip), %eax      # 0xf344
movl %eax, 0xcbac(%rip)      # 0xf344
negl %eax
movl %eax, (%rbx)
leal -0x1(%rdi), %r15d
movq %rbx, %rsi
callq 0x282b
movl %r15d, %edi
incl %r14d
movq 0x38(%rbx), %rbx
testq %rbx, %rbx
jne 0x2773
leaq 0xce32(%rip), %rax      # 0xf5f0
movq (%rax), %rax
testq %rax, %rax
je 0x27f1
movl 0xcb78(%rip), %ecx      # 0xf344
movl $0x4, %edx
movl 0x28(%rax), %esi
cmpl $0x5, %esi
cmovll %edx, %esi
addl %esi, %ecx
movl %ecx, 0xcb62(%rip)      # 0xf344
movl %ecx, %esi
negl %esi
movl %esi, (%rax)
movq 0x38(%rax), %rax
testq %rax, %rax
jne 0x27d1
movl 0xcb4d(%rip), %edx      # 0xf344
addl $0xf, %edx
andl $-0x10, %edx
movl %edx, 0xcb45(%rip)      # 0xf348
leaq 0xcb7e(%rip), %rax      # 0xf388
movq (%rax), %rdi
negl %edx
leaq 0x7a7b(%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_O1/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 0x245a
cmpl $0x8, %eax
jne 0x2868
leaq 0xcb3d(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xc498(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rdx
movl (%r14), %ecx
leaq 0x7d21(%rip), %rsi      # 0xa587
jmp 0x28bc
movl 0x10(%r14), %esi
cmpl $0x30, %esi
je 0x289a
cmpl $0x20, %esi
jne 0x28ca
leaq 0xcb0b(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xc4b6(%rip), %rcx      # 0xed40
movq (%rcx,%rax,8), %rdx
movl (%r14), %ecx
leaq 0x7d04(%rip), %rsi      # 0xa59c
jmp 0x28bc
leaq 0xcae7(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xc4e2(%rip), %rcx      # 0xed90
movq (%rcx,%rax,8), %rdx
movl (%r14), %ecx
leaq 0x7cf5(%rip), %rsi      # 0xa5b1
xorl %eax, %eax
callq 0x2100
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x7cf5(%rip), %rdi      # 0xa5c6
callq 0x68e9
jmp 0x28c3
// File: /workspace/github_c_makefile_star2_O1/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 0xcaa0(%rip), %r14      # 0xf388
movq (%r14), %rdi
leaq 0x7d88(%rip), %rsi      # 0xa67a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2100
movq (%r14), %rdi
movl 0xca44(%rip), %edx      # 0xf348
leaq 0x7986(%rip), %rsi      # 0xa291
xorl %eax, %eax
callq 0x2100
movq (%r14), %rsi
leaq 0x7986(%rip), %rdi      # 0xa2a2
callq 0x20c0
leaq 0xca08(%rip), %rax      # 0xf330
movl $0x1, (%rbx,%rax)
addq $0x4, %rbx
cmpq $0x10, %rbx
jne 0x2928
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x24e7
leaq 0xca16(%rip), %rcx      # 0xf388
movq (%rcx), %rdi
movslq %eax, %r14
leaq 0xc371(%rip), %rax      # 0xecf0
movq (%rax,%r14,8), %rcx
leaq 0x7929(%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_O1/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 0x24e7
leaq 0xc6db(%rip), %rcx      # 0xf388
movq (%rcx), %rdi
movslq %eax, %r14
leaq 0xc036(%rip), %rax      # 0xecf0
movq (%rax,%r14,8), %rcx
leaq 0x76dd(%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_O1/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 0xc5c5(%rip), %r13      # 0xf388
movq (%r13), %rax
movslq %edi, %rbx
leaq 0xbf1f(%rip), %rcx      # 0xecf0
movq (%rcx,%rbx,8), %r14
leaq 0x7607(%rip), %rsi      # 0xa3e3
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2100
movq (%r13), %rcx
leaq 0x75ff(%rip), %rdi      # 0xa3f3
movl $0x5, %esi
movl $0x1, %edx
callq 0x2170
movq (%r13), %rdi
movslq %r12d, %r12
leaq 0xbedf(%rip), %rax      # 0xecf0
movq (%rax,%r12,8), %rdx
leaq 0x75dd(%rip), %rsi      # 0xa3f9
xorl %eax, %eax
callq 0x2100
cmpl $0x18, %r15d
movq (%r13), %rdi
leaq 0x75d2(%rip), %rax      # 0xa404
leaq 0x75db(%rip), %rsi      # 0xa414
cmoveq %rax, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2100
movl %r12d, %edi
callq 0x255c
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_O1/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 0xc443(%rip), %r15      # 0xf388
movq (%r15), %rdi
movslq %esi, %r14
leaq 0xbdee(%rip), %rax      # 0xed40
movq (%rax,%r14,8), %rdx
leaq 0x74f0(%rip), %rsi      # 0xa44d
xorl %eax, %eax
callq 0x2100
movq (%r15), %rdi
movslq %ebx, %rbx
leaq 0xbd7f(%rip), %rax      # 0xecf0
movq (%rax,%rbx,8), %rdx
leaq 0x74e1(%rip), %rsi      # 0xa45d
xorl %eax, %eax
callq 0x2100
movl %r14d, %edi
callq 0x255c
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xc3dd(%rip), %r15      # 0xf388
movq (%r15), %rdi
movslq %esi, %r14
leaq 0xbd88(%rip), %rax      # 0xed40
movq (%rax,%r14,8), %rdx
leaq 0x748a(%rip), %rsi      # 0xa44d
xorl %eax, %eax
callq 0x2100
movq (%r15), %rdi
movslq %ebx, %rbx
leaq 0xbd19(%rip), %rax      # 0xecf0
movq (%rax,%rbx,8), %rdx
leaq 0x748b(%rip), %rsi      # 0xa46d
xorl %eax, %eax
callq 0x2100
movl %r14d, %edi
callq 0x255c
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xc308(%rip), %r12      # 0xf388
movq (%r12), %rax
movslq %edi, %rbx
leaq 0xbc62(%rip), %rcx      # 0xecf0
movq (%rcx,%rbx,8), %r14
leaq 0x73f8(%rip), %rsi      # 0xa491
movq %rax, %rdi
movq %r14, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x2100
movq (%r12), %rdi
leaq 0xbc8c(%rip), %rax      # 0xed40
movq (%rax,%rbx,8), %r15
leaq 0x73e0(%rip), %rsi      # 0xa49f
movq %r15, %rdx
xorl %eax, %eax
callq 0x2100
movq (%r12), %rdi
leaq 0x73d5(%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
// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/cg.c
// Function: cgboolean
int cgboolean(int r, int op, int label) {
  fprintf(Outfile, "\ttest\t%s, %s\n", reglist[r], reglist[r]);
  switch (op) {
  case A_IF:
  case A_WHILE:
  case A_LOGAND:
    fprintf(Outfile, "\tje\tL%d\n", label);
    break;
  case A_LOGOR:
    fprintf(Outfile, "\tjne\tL%d\n", label);
    break;
  default:
    fprintf(Outfile, "\tsetnz\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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %r12d
movl %edi, %ebx
leaq 0xc24f(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %r13
leaq 0xbbaa(%rip), %rax      # 0xecf0
movq (%rax,%r13,8), %r15
leaq 0x7340(%rip), %rsi      # 0xa491
movq %r15, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2100
leal -0x1e(%r12), %eax
cmpl $0x2, %eax
jb 0x3174
cmpl $0x8, %r12d
je 0x3187
cmpl $0x9, %r12d
jne 0x31b3
leaq 0xc20d(%rip), %rax      # 0xf388
movq (%rax), %rdi
leaq 0x7334(%rip), %rsi      # 0xa4b9
jmp 0x3198
leaq 0xc1fa(%rip), %rax      # 0xf388
movq (%rax), %rdi
leaq 0x732a(%rip), %rsi      # 0xa4c2
movl %r14d, %edx
xorl %eax, %eax
callq 0x2100
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc1ce(%rip), %r12      # 0xf388
movq (%r12), %rdi
leaq 0xbb7b(%rip), %rax      # 0xed40
movq (%rax,%r13,8), %r14
leaq 0x72fc(%rip), %rsi      # 0xa4cc
movq %r14, %rdx
xorl %eax, %eax
callq 0x2100
movq (%r12), %rdi
leaq 0x72c4(%rip), %rsi      # 0xa4a9
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2100
jmp 0x31a2
// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/cg.c
// Function: cgcall
int cgcall(struct symtable *sym, int numargs) {
  int outr;

  // 调用函数
  fprintf(Outfile, "\tcall\t%s@PLT\n", sym->name);

  // 删除之前入栈的实参
  if (numargs > 6)
    fprintf(Outfile, "\taddq\t$%d, %%rsp\n", 8 * (numargs - 6));

  // 恢复之前入栈的寄存器
  cgunspillregs();

  // 获取一个新的寄存器,拷贝返回值给他
  outr = cgallocreg();
  fprintf(Outfile, "\tmovq\t%%rax, %s\n", reglist[outr]);
  return (outr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
leaq 0xc180(%rip), %r14      # 0xf388
movq (%r14), %rax
movq 0x8(%rdi), %rdx
leaq 0x72c1(%rip), %rsi      # 0xa4d7
movq %rax, %rdi
xorl %eax, %eax
callq 0x2100
cmpl $0x7, %ebx
jl 0x323d
movq (%r14), %rdi
leal -0x30(,%rbx,8), %edx
leaq 0x72af(%rip), %rsi      # 0xa4e5
xorl %eax, %eax
callq 0x2100
movl $0x3, %r12d
leaq 0xbaa6(%rip), %r15      # 0xecf0
leaq 0x7563(%rip), %rbx      # 0xa7b4
movq (%r14), %rdi
movq (%r15,%r12,8), %rdx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2100
addq $-0x1, %r12
jb 0x3251
callq 0x24e7
movq (%r14), %rdi
movslq %eax, %rbx
movq (%r15,%rbx,8), %rdx
leaq 0x7279(%rip), %rsi      # 0xa4f7
xorl %eax, %eax
callq 0x2100
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/cg.c
// Function: cgcopyarg
void cgcopyarg(int r, int argposn) {

  // 如果实参数量大于6个,那就把大于的都压入栈中
  if (argposn > 6) {
    fprintf(Outfile, "\tpushq\t%s\n", reglist[r]);
  } else {
    // 否则把实参值拷贝到指定的寄存器
    fprintf(Outfile, "\tmovq\t%s, %s\n", reglist[r],
	    reglist[FIRSTPARAMREG - argposn + 1]);
  }
  cgfreereg(r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0xc0e9(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rcx
leaq 0xba44(%rip), %rax      # 0xecf0
movq (%rax,%rcx,8), %rdx
cmpl $0x7, %esi
jl 0x32c5
leaq 0x724c(%rip), %rsi      # 0xa508
xorl %eax, %eax
callq 0x2100
jmp 0x32de
movl $0xa, %ecx
subl %esi, %ecx
movq (%rax,%rcx,8), %rcx
leaq 0x723c(%rip), %rsi      # 0xa513
xorl %eax, %eax
callq 0x2100
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x255c
// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/cg.c
// Function: cgstorglob
int cgstorglob(int r, struct symtable *sym) {

  if (cgprimsize(sym->type) == 8) {
    fprintf(Outfile, "\tmovq\t%s, %s(%%rip)\n", reglist[r], sym->name);
  } else
    switch (sym->type) {
    case P_CHAR:
      fprintf(Outfile, "\tmovb\t%s, %s(%%rip)\n", breglist[r], sym->name);
      break;
    case P_INT:
      fprintf(Outfile, "\tmovl\t%s, %s(%%rip)\n", dreglist[r], sym->name);
      break;
    default:
      fatald("Bad type in cgstorglob:", 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 0x245a
cmpl $0x8, %eax
jne 0x3363
leaq 0xc043(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xb99e(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rdx
movq 0x8(%r14), %rcx
leaq 0x71cf(%rip), %rsi      # 0xa530
jmp 0x33b9
movl 0x10(%r14), %esi
cmpl $0x30, %esi
je 0x3396
cmpl $0x20, %esi
jne 0x33c7
leaq 0xc010(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xb9bb(%rip), %rcx      # 0xed40
movq (%rcx,%rax,8), %rdx
movq 0x8(%r14), %rcx
leaq 0x71b1(%rip), %rsi      # 0xa545
jmp 0x33b9
leaq 0xbfeb(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xb9e6(%rip), %rcx      # 0xed90
movq (%rcx,%rax,8), %rdx
movq 0x8(%r14), %rcx
leaq 0x71a1(%rip), %rsi      # 0xa55a
xorl %eax, %eax
callq 0x2100
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x71a1(%rip), %rdi      # 0xa56f
callq 0x68e9
jmp 0x33c0
// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/cg.c
// Function: cgglobstr
void cgglobstr(int l, char *strvalue, int append) {
  char *cptr;
  if (!append)
    cglabel(l);
  for (cptr = strvalue; *cptr; cptr++) {
    fprintf(Outfile, "\t.byte\t%d\n", *cptr);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
testl %edx, %edx
jne 0x359f
movl %edi, %eax
leaq 0xbdfc(%rip), %rcx      # 0xf388
movq (%rcx), %rdi
leaq 0x70e4(%rip), %rsi      # 0xa67a
movl %eax, %edx
xorl %eax, %eax
callq 0x2100
movb (%rbx), %al
testb %al, %al
je 0x35cf
incq %rbx
leaq 0xbdd9(%rip), %r15      # 0xf388
leaq 0x703a(%rip), %r14      # 0xa5f0
movq (%r15), %rdi
movsbl %al, %edx
movq %r14, %rsi
xorl %eax, %eax
callq 0x2100
movb (%rbx), %al
incq %rbx
testb %al, %al
jne 0x35b6
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/cg.c
// Function: cgcompare_and_set
int cgcompare_and_set(int ASTop, int r1, int r2, int type) {
  int size = cgprimsize(type);


  // 检查语法树操作的范围
  if (ASTop < A_EQ || ASTop > A_GE)
    fatal("Bad ASTop in cgcompare_and_set()");

  switch (size) {
  case 1:
    fprintf(Outfile, "\tcmpb\t%s, %s\n", breglist[r2], breglist[r1]);
    break;
  case 4:
    fprintf(Outfile, "\tcmpl\t%s, %s\n", dreglist[r2], dreglist[r1]);
    break;
  default:
    fprintf(Outfile, "\tcmpq\t%s, %s\n", reglist[r2], reglist[r1]);
  }

  fprintf(Outfile, "\t%s\t%s\n", cmplist[ASTop - A_EQ], breglist[r2]);
  fprintf(Outfile, "\tmovzbq\t%s, %s\n", breglist[r2], reglist[r2]);
  cgfreereg(r1);
  return (r2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %r15d
movl %edi, %ebx
movl %ecx, %edi
callq 0x245a
movl %eax, %r12d
leal -0x13(%rbx), %eax
cmpl $-0x7, %eax
ja 0x3633
leaq 0x6ff9(%rip), %rdi      # 0xa627
callq 0x688f
leaq 0xbd4e(%rip), %r13      # 0xf388
movq (%r13), %rdi
leaq 0xb6fb(%rip), %rax      # 0xed40
cmpl $0x1, %r12d
je 0x3664
cmpl $0x4, %r12d
jne 0x3670
movq %rax, %r12
leaq 0x6ffb(%rip), %rsi      # 0xa656
leaq 0xb72e(%rip), %rax      # 0xed90
jmp 0x3681
leaq 0x6fdd(%rip), %rsi      # 0xa648
movq %rax, %r12
jmp 0x3681
movq %rax, %r12
leaq 0x6fea(%rip), %rsi      # 0xa664
leaq 0xb66f(%rip), %rax      # 0xecf0
movslq %r15d, %r15
movslq %r14d, %r14
movq (%rax,%r14,8), %rdx
movq (%rax,%r15,8), %rcx
xorl %eax, %eax
callq 0x2100
movq (%r13), %rdi
movslq %ebx, %rax
leaq 0x71ec(%rip), %rcx      # 0xa890
movslq -0x34(%rcx,%rax,4), %rdx
addq %rcx, %rdx
movq (%r12,%r14,8), %rbx
leaq 0x6fbb(%rip), %rsi      # 0xa672
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2100
movq (%r13), %rdi
leaq 0xb624(%rip), %rax      # 0xecf0
movq (%rax,%r14,8), %rcx
leaq 0x6dd2(%rip), %rsi      # 0xa4a9
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2100
movl %r15d, %edi
callq 0x255c
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/cg.c
// Function: cgcompare_and_jump
int cgcompare_and_jump(int ASTop, int r1, int r2, int label, int type) {
  int size = cgprimsize(type);

  // 检查语法树操作范围
  if (ASTop < A_EQ || ASTop > A_GE)
    fatal("Bad ASTop in cgcompare_and_set()");

  switch (size) {
  case 1:
    fprintf(Outfile, "\tcmpb\t%s, %s\n", breglist[r2], breglist[r1]);
    break;
  case 4:
    fprintf(Outfile, "\tcmpl\t%s, %s\n", dreglist[r2], dreglist[r1]);
    break;
  default:
    fprintf(Outfile, "\tcmpq\t%s, %s\n", reglist[r2], reglist[r1]);
  }

  fprintf(Outfile, "\t%s\tL%d\n", invcmplist[ASTop - A_EQ], label);
  cgfreereg(r1);
  cgfreereg(r2);
  return (NOREG);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %r15d
movl %esi, %r12d
movl %edi, %r14d
movl %r8d, %edi
callq 0x245a
movl %eax, %r13d
leal -0x13(%r14), %eax
cmpl $-0x7, %eax
ja 0x3753
leaq 0x6ed9(%rip), %rdi      # 0xa627
callq 0x688f
leaq 0xbc2e(%rip), %rax      # 0xf388
movq (%rax), %rdi
cmpl $0x1, %r13d
je 0x377c
cmpl $0x4, %r13d
jne 0x378f
movq %rax, %r13
leaq 0x6ee3(%rip), %rsi      # 0xa656
leaq 0xb616(%rip), %rax      # 0xed90
jmp 0x37a0
movq %rax, %r13
leaq 0x6ec2(%rip), %rsi      # 0xa648
leaq 0xb5b3(%rip), %rax      # 0xed40
jmp 0x37a0
movq %rax, %r13
leaq 0x6ecb(%rip), %rsi      # 0xa664
leaq 0xb550(%rip), %rax      # 0xecf0
movslq %r12d, %r12
movslq %r15d, %r15
movq (%rax,%r15,8), %rdx
movq (%rax,%r12,8), %rcx
xorl %eax, %eax
callq 0x2100
movq (%r13), %rdi
movslq %r14d, %rax
leaq 0x70e5(%rip), %rcx      # 0xa8a8
movslq -0x34(%rcx,%rax,4), %rdx
addq %rcx, %rdx
leaq 0x6eb8(%rip), %rsi      # 0xa68a
movl %ebx, %ecx
xorl %eax, %eax
callq 0x2100
movl %r12d, %edi
callq 0x255c
movl %r15d, %edi
callq 0x255c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/cg.c
// Function: cgreturn
void cgreturn(int reg, struct symtable *sym) {

  // 处理有返回值的
  if (reg != NOREG) {
    // 处理指针，不能把它放在下面的switch语句里面一起处理
    if (ptrtype(sym->type))
      fprintf(Outfile, "\tmovq\t%s, %%rax\n", reglist[reg]);
    else {
      // 根据函数类型生成相应汇编代码
      switch (sym->type) {
      case P_CHAR:
        fprintf(Outfile, "\tmovzbl\t%s, %%eax\n", breglist[reg]);
        break;
      case P_INT:
        fprintf(Outfile, "\tmovl\t%s, %%eax\n", dreglist[reg]);
        break;
      case P_LONG:
        fprintf(Outfile, "\tmovq\t%s, %%rax\n", reglist[reg]);
        break;
      default:
	      fatald("Bad function type in cgreturn:", sym->type);
      }
    }
  }

  cgjump(sym->stu.st_endlabel);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
cmpl $-0x1, %edi
je 0x384b
movl %edi, %r14d
movl 0x10(%rbx), %edi
callq 0x8dcb
testl %eax, %eax
je 0x3869
leaq 0xbb5c(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %r14d, %rax
leaq 0xb4b7(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rdx
leaq 0x6e4f(%rip), %rsi      # 0xa693
xorl %eax, %eax
callq 0x2100
movl (%rbx), %edx
leaq 0xbb34(%rip), %rax      # 0xf388
movq (%rax), %rdi
leaq 0x6e22(%rip), %rsi      # 0xa680
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x2100
movl 0x10(%rbx), %esi
cmpl $0x40, %esi
je 0x3825
cmpl $0x30, %esi
je 0x389c
cmpl $0x20, %esi
jne 0x38bd
leaq 0xbb06(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %r14d, %rax
leaq 0xb4b1(%rip), %rcx      # 0xed40
movq (%rcx,%rax,8), %rdx
leaq 0x6e0a(%rip), %rsi      # 0xa6a4
jmp 0x3844
leaq 0xbae5(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %r14d, %rax
leaq 0xb4e0(%rip), %rcx      # 0xed90
movq (%rcx,%rax,8), %rdx
leaq 0x6dfc(%rip), %rsi      # 0xa6b7
jmp 0x3844
leaq 0x6e04(%rip), %rdi      # 0xa6c8
callq 0x68e9
jmp 0x384b
// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/cg.c
// Function: cgaddress
int cgaddress(struct symtable *sym) {
  int r = cgallocreg();

  if (sym->class == C_GLOBAL ||
      sym->class == C_EXTERN || sym->class == C_STATIC)
    fprintf(Outfile, "\tleaq\t%s(%%rip), %s\n", sym->name, reglist[r]);
  else
    fprintf(Outfile, "\tleaq\t%d(%%rbp), %s\n", sym->stu.st_posn, reglist[r]);
  return (r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
callq 0x24e7
movl %eax, %ebx
movl 0x24(%r14), %eax
cmpl $0x5, %eax
ja 0x391b
movl $0x32, %ecx
btl %eax, %ecx
jae 0x391b
leaq 0xba92(%rip), %rax      # 0xf388
movq (%rax), %rdi
movq 0x8(%r14), %rdx
movslq %ebx, %rax
leaq 0xb3e9(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rcx
leaq 0x69c5(%rip), %rsi      # 0xa2d7
xorl %eax, %eax
callq 0x2100
jmp 0x3944
leaq 0xba66(%rip), %rax      # 0xf388
movq (%rax), %rdi
movl (%r14), %edx
movslq %ebx, %rax
leaq 0xb3be(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rcx
leaq 0x6985(%rip), %rsi      # 0xa2c2
xorl %eax, %eax
callq 0x2100
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ejunjsh[P]mycc/cg.c
// Function: cgderef
int cgderef(int r, int type) {
  // 获得指针指向的类型
  int newtype = value_at(type);
  // 获得类型大小
  int size = cgprimsize(newtype);

  switch (size) {
  case 1:
    fprintf(Outfile, "\tmovzbq\t(%s), %s\n", reglist[r], reglist[r]);
    break;
  case 4:
    fprintf(Outfile, "\tmovslq\t(%s), %s\n", reglist[r], reglist[r]);
    break;
  case 8:
    fprintf(Outfile, "\tmovq\t(%s), %s\n", reglist[r], reglist[r]);
    break;
  default:
    fatald("Can't cgderef on type:", type);
  }
  return (r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movl %edi, %ebx
movl %esi, %edi
callq 0x8e03
movl %eax, %edi
callq 0x245a
cmpl $0x8, %eax
je 0x39b6
cmpl $0x4, %eax
je 0x3995
cmpl $0x1, %eax
jne 0x39e1
leaq 0xba0d(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xb368(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rcx
leaq 0x6d54(%rip), %rsi      # 0xa6e7
jmp 0x39d5
leaq 0xb9ec(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xb347(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rcx
leaq 0x6d45(%rip), %rsi      # 0xa6f9
jmp 0x39d5
leaq 0xb9cb(%rip), %rax      # 0xf388
movq (%rax), %rdi
movslq %ebx, %rax
leaq 0xb326(%rip), %rcx      # 0xecf0
movq (%rcx,%rax,8), %rcx
leaq 0x6d36(%rip), %rsi      # 0xa70b
movq %rcx, %rdx
xorl %eax, %eax
callq 0x2100
jmp 0x39f0
leaq 0x6d33(%rip), %rdi      # 0xa71b
movl %r14d, %esi
callq 0x68e9
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq