LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/src/object.c
// Function: createObject
robj *createObject(int type, void *ptr) {
    robj *o = zmalloc(sizeof(*o));
    o->type = type;
    o->encoding = OBJ_ENCODING_RAW;
    o->ptr = ptr;
    o->refcount = 1;

    /* Set the LRU to the current lruclock (minutes resolution). */
    o->lru = LRU_CLOCK();

#ifdef AOF_NO_COW
    o->aof_version = server.aof_no_cow.version;
    o->shared = 0;
#endif

    return o;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
pushq $0x10
popq %rdi
callq 0x32755
andl $0xf, %ebp
movb %bpl, (%rax)
movq %rbx, 0x8(%rax)
movl $0x1, 0x4(%rax)
leaq 0xc4b34(%rip), %rcx     # 0xfe858
movl 0x48(%rcx), %ecx
shll $0x8, %ecx
orl %ebp, %ecx
movl %ecx, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/src/object.c
// Function: createEmbeddedStringObject
robj *createEmbeddedStringObject(const char *ptr, size_t len) {
    robj *o = zmalloc(sizeof(robj)+sizeof(struct sdshdr8)+len+1);
    struct sdshdr8 *sh = (void*)(o+1);

    o->type = OBJ_STRING;
    o->encoding = OBJ_ENCODING_EMBSTR;
    o->ptr = sh+1;
    o->refcount = 1;
    o->lru = LRU_CLOCK();

#ifdef AOF_NO_COW
    o->aof_version = server.aof_no_cow.version;
    o->shared = 0;
#endif

    sh->len = len;
    sh->alloc = len;
    sh->flags = SDS_TYPE_8;
    if (ptr) {
        memcpy(sh->buf,ptr,len);
        sh->buf[len] = '\0';
    } else {
        memset(sh->buf,0,len+1);
    }
    return o;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x14(%rsi), %rdi
callq 0x32755
movq %rax, %r14
movb $-0x80, (%rax)
leaq 0x13(%rax), %r12
movq %r12, 0x8(%rax)
movl $0x1, 0x4(%rax)
leaq 0xc4adf(%rip), %rax     # 0xfe858
movl 0x48(%rax), %eax
shll $0x8, %eax
orl $0x80, %eax
movl %eax, (%r14)
movb %bl, 0x10(%r14)
movb %bl, 0x11(%r14)
movb $0x1, 0x12(%r14)
testq %r15, %r15
je 0x39dae
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x26c60
movb $0x0, (%r12,%rbx)
jmp 0x39dbe
incq %rbx
movq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x26110
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/src/aof.c
// Function: stopAppendOnly
void stopAppendOnly(void) {
    serverAssert(server.aof_state != AOF_OFF);
    flushAppendOnlyFile(1);
    aof_fsync(server.aof_fd);
    close(server.aof_fd);

    server.aof_fd = -1;
    server.aof_selected_db = -1;
    server.aof_state = AOF_OFF;
    /* rewrite operation in progress? kill it, wait child exit */
    if (server.aof_child_pid != -1) {
        int statloc;

        serverLog(LL_NOTICE,"Killing running AOF rewrite child: %ld",
            (long) server.aof_child_pid);
        if (kill(server.aof_child_pid,SIGUSR1) != -1) {
#ifndef AOF_NO_COW
            while(wait3(&statloc,0,NULL) != server.aof_child_pid);
#else
            while(wait3(&statloc, __WALL, NULL) != server.aof_child_pid);
#endif
        }
        /* reset the buffer accumulating changes while the child saves */
        aofRewriteBufferReset();
        aofRemoveTempFile(server.aof_child_pid);
        server.aof_child_pid = -1;
        server.aof_rewrite_time_start = -1;
        /* close pipes used for IPC between the two processes. */
        aofClosePipes();
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0xaaea2(%rip), %r14     # 0xfe858
cmpl $0x0, 0x658(%r14)
je 0x53a6e
pushq $0x1
popq %rdi
callq 0x53a8e
movl 0x6a0(%r14), %edi
callq 0x26580
movl 0x6a0(%r14), %edi
callq 0x26180
orq $-0x1, 0x6a0(%r14)
andl $0x0, 0x658(%r14)
movslq 0x68c(%r14), %rdx
cmpq $-0x1, %rdx
je 0x53a66
leaq 0x64845(%rip), %rsi     # 0xb824d
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x2b6a1
movl 0x68c(%r14), %edi
pushq $0xa
popq %rsi
callq 0x26670
cmpl $-0x1, %eax
je 0x53a40
leaq 0x4(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x26880
cmpl 0x68c(%r14), %eax
jne 0x53a2b
callq 0x53694
movl 0x68c(%r14), %edi
callq 0x53f23
orl $-0x1, 0x68c(%r14)
orq $-0x1, 0x6c0(%r14)
callq 0x53f57
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x647b6(%rip), %rdi     # 0xb822b
leaq 0x647cb(%rip), %rsi     # 0xb8247
movl $0xd6, %edx
callq 0x578b0
pushq $0x1
popq %rdi
callq 0x263d0
// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/src/cluster.c
// Function: representClusterNodeFlags
sds representClusterNodeFlags(sds ci, uint16_t flags) {
    if (flags == 0) {
        ci = sdscat(ci,"noflags,");
    } else {
        int i, size = sizeof(redisNodeFlagsTable)/sizeof(struct redisNodeFlags);
        for (i = 0; i < size; i++) {
            struct redisNodeFlags *nodeflag = redisNodeFlagsTable + i;
            if (flags & nodeflag->flag) ci = sdscat(ci, nodeflag->name);
        }
    }
    sdsIncrLen(ci,-1); /* Remove trailing comma. */
    return ci;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x5c940
movl %esi, %ebp
pushq $0x8
popq %r14
leaq 0x9a283(%rip), %r15     # 0xf6ba0
cmpq $0x78, %r14
je 0x5c952
testw %bp, -0x8(%r14,%r15)
je 0x5c93a
movq (%r14,%r15), %rsi
movq %rbx, %rdi
callq 0x31753
movq %rax, %rbx
addq $0x10, %r14
jmp 0x5c91d
leaq 0x5ed15(%rip), %rsi     # 0xbb65c
movq %rbx, %rdi
callq 0x31753
movq %rax, %rbx
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x314b0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/src/cluster.c
// Function: clusterDelNodeSlots
int clusterDelNodeSlots(clusterNode *node) {
    int deleted = 0, j;

    for (j = 0; j < CLUSTER_SLOTS; j++) {
        if (clusterNodeGetSlotBit(node,j)) clusterDelSlot(j);
        deleted++;
    }
    return deleted;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %ebp, %ebp
cmpl $0x4000, %ebp           # imm = 0x4000
je 0x5d9bd
movl %ebp, %eax
shrl $0x3, %eax
movzbl 0x40(%rbx,%rax), %eax
movl %ebp, %ecx
andl $0x7, %ecx
btl %ecx, %eax
jae 0x5d9b9
movl %ebp, %edi
callq 0x5ba70
incl %ebp
jmp 0x5d996
movl $0x4000, %eax           # imm = 0x4000
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/src/cluster.c
// Function: clusterRedirectBlockedClientIfNeeded
int clusterRedirectBlockedClientIfNeeded(client *c) {
    if (c->flags & CLIENT_BLOCKED && c->btype == BLOCKED_LIST) {
        dictEntry *de;
        dictIterator *di;

        /* If the cluster is down, unblock the client with the right error. */
        if (server.cluster->state == CLUSTER_FAIL) {
            clusterRedirectClient(c,NULL,0,CLUSTER_REDIR_DOWN_STATE);
            return 1;
        }

        di = dictGetIterator(c->bpop.keys);
        while((de = dictNext(di)) != NULL) {
            robj *key = dictGetKey(de);
            int slot = keyHashSlot((char*)key->ptr, sdslen(key->ptr));
            clusterNode *node = server.cluster->slots[slot];

            /* We send an error and unblock the client if:
             * 1) The slot is unassigned, emitting a cluster down error.
             * 2) The slot is not handled by this node, nor being imported. */
            if (node != myself &&
                server.cluster->importing_slots_from[slot] == NULL)
            {
                if (node == NULL) {
                    clusterRedirectClient(c,NULL,0,
                        CLUSTER_REDIR_DOWN_UNBOUND);
                } else {
                    clusterRedirectClient(c,node,slot,
                        CLUSTER_REDIR_MOVED);
                }
                return 1;
            }
        }
        dictReleaseIterator(di);
    }
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %ebx, %ebx
testb $0x10, 0x98(%rdi)
je 0x61c80
movq %rdi, %r14
cmpl $0x1, 0x168(%rdi)
jne 0x61c80
leaq 0x9cc68(%rip), %r13     # 0xfe858
movq 0x9a0(%r13), %rax
cmpl $0x1, 0x10(%rax)
jne 0x61c11
pushq $0x5
popq %rcx
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x61af0
pushq $0x1
popq %rbx
jmp 0x61c80
movq 0x178(%r14), %rdi
callq 0x2a9a7
movq %rax, %r15
movq %r15, %rdi
callq 0x2a9db
testq %rax, %rax
je 0x61c78
movq (%rax), %rax
movq 0x8(%rax), %r12
movq %r12, %rdi
callq 0x5b3e5
movq %r12, %rdi
movl %eax, %esi
callq 0x5bd8b
movq 0x9a0(%r13), %rcx
movl %eax, %edx
movq 0x40028(%rcx,%rdx,8), %rsi
cmpq 0xb1572(%rip), %rsi     # 0x1131d0
je 0x61c20
cmpq $0x0, 0x20028(%rcx,%rdx,8)
jne 0x61c20
testq %rsi, %rsi
je 0x61c8c
pushq $0x4
popq %rcx
movq %r14, %rdi
jmp 0x61c07
movq %r15, %rdi
callq 0x2aa9c
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
pushq $0x6
jmp 0x61bff
nop
// File: /workspace/github_c_makefile_star2_O2/trumabrat[P]GrandProjet/hachageMain.c
// Function: main
int main()
{
    // Q4.2
    float k;
    for (int i = 0; i < 11; i++)
    {
        for (int j = 0; j < 11; j++)
        {
            k = fonctionCle(i, j);
            printf("x = %d, y = %d, k = %.2f\n", i, j, k);
        }
    }

    // lecture et creation d'une instance de Chaines et de Reseau
    FILE* f = NULL;
    f = fopen("00014_burma.cha", "r");
    Chaines *c = lectureChaines(f);
    fclose(f);
    Reseau *R = reconstitueReseauHachage(c, 5);
    FILE* f2 = NULL;

    // // l'enregistrement dans un fichier
    f2 = fopen("resHachage.txt", "w");
    ecrireReseau(R, f2);
    fclose(f2);

    // affichage
    afficheReseauSVG(R, "resoHachage");

    // liberation de memoire
    liberer_chaines(c);
    liberation_reseau(R);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
xorl %ebx, %ebx
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
leaq 0xfe4(%rip), %r14       # 0x33ec
cmpl $0xb, %ebx
je 0x246e
xorl %ebp, %ebp
xorpd %xmm1, %xmm1
cmpl $0xb, %ebp
je 0x2458
movsd (%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
movsd 0x10(%rsp), %xmm1
callq 0x121c
fstps 0xc(%rsp)
cvtss2sd 0xc(%rsp), %xmm0
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
movb $0x1, %al
callq 0x1080
movsd 0x10(%rsp), %xmm1
addsd 0xbb4(%rip), %xmm1      # 0x3008
incl %ebp
jmp 0x2413
movsd (%rsp), %xmm0
addsd 0xba3(%rip), %xmm0      # 0x3008
movsd %xmm0, (%rsp)
incl %ebx
jmp 0x2408
leaq 0xf91(%rip), %rdi       # 0x3406
leaq 0xf9a(%rip), %rsi       # 0x3416
callq 0x10e0
movq %rax, %r14
movq %rax, %rdi
callq 0x1eec
movq %rax, %rbx
movq %r14, %rdi
callq 0x1060
pushq $0x5
popq %rsi
movq %rbx, %rdi
callq 0x14ad
movq %rax, %r14
leaq 0xf6c(%rip), %rdi       # 0x3418
leaq 0xd93(%rip), %rsi       # 0x3246
callq 0x10e0
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x192e
movq %r15, %rdi
callq 0x1060
leaq 0xf52(%rip), %rsi       # 0x3427
movq %r14, %rdi
callq 0x1add
movq %rbx, %rdi
callq 0x23d4
movq %r14, %rdi
callq 0x1ce5
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/alloc.c
// Function: alloc_homes
void alloc_homes(program_t *prog) {
    pair_t *pair;
    map_for_each(prog->fn_defs, pair) {
        fn_def_t *curr_fn = pair->value;
        debug("allocating for function %s\n", string_get(curr_fn->name));
        curr_fn->sp_offset = alloc_scoped_env(curr_fn->env, 0);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rdi)
leaq 0x8(%rsp), %r14
addq $0x10, %rdi
movq %r14, %rsi
callq 0x2dfe
testb %al, %al
je 0x1280
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r15
movq 0x20(%r15), %rdi
xorl %esi, %esi
callq 0x128a
cltq
movq %rax, 0x28(%r15)
movq (%rbx), %rax
movq (%rax), %rdi
jmp 0x124e
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/alloc.c
// Function: alloc_scoped_env
static int alloc_scoped_env(env_t *env, int offset) {
    pair_t *pair;

    // Allocate homes for each variable at the current level
    map_for_each(env->homes, pair) {
        var_info_t *v = pair->value;
        string_t *name = pair->key;

        offset -= 8;
        debug("Found variable %s\n", string_get(name));
        v->home.reg = REG_RBP;
        v->home.offset = offset;
    }

    // Recursively allocate vars for all child envs
    env_t *child_env;
    list_for_each(env->children, child_env) {
        int child_offset = alloc_scoped_env(child_env, offset); 
        if (child_offset < offset)
            offset = child_offset;
    }

    return offset;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rdi)
movslq %esi, %r12
addq $-0x8, %r12
leaq 0x10(%rsp), %r15
addq $0x10, %rdi
movq %r15, %rsi
callq 0x2dfe
testb %al, %al
je 0x12ea
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movl $0x5, 0x8(%rax)
movq %r12, 0x10(%rax)
movq (%r14), %rax
movq (%rax), %rdi
addl $-0x8, %ebx
addq $-0x8, %r12
jmp 0x12b7
movq 0x8(%r14), %rdi
movq (%rdi), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rdi)
leaq 0x8(%rsp), %r15
addq $0x10, %rdi
movq %r15, %rsi
callq 0x2dfe
testb %al, %al
je 0x1325
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0x128a
cmpl %ebx, %eax
cmovll %eax, %ebx
movq 0x8(%r14), %rdi
jmp 0x12fe
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: new_label
static output_t *new_label(string_t *name, int linkage) {
    output_t *ret = malloc(sizeof(output_t));
    ret->type = OUTPUT_LABEL;
    ret->label.name = name;
    ret->label.linkage = linkage;
    return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
pushq $0x40
popq %rdi
callq 0x10e0
movl $0x1, (%rax)
movq %r14, 0x8(%rax)
movl %ebx, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: unique_label
static string_t *unique_label(char *seed) {
    static int count = 0;
    char buf[32];

    string_t *name = string_new();
    string_append(name, seed, strnlen(seed, 100));

    snprintf(buf, 32, "%d", count++);
    string_append(name, buf, strnlen(buf, 32));
    return name;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
callq 0x487f
movq %rax, %rbx
pushq $0x64
popq %rsi
movq %r14, %rdi
callq 0x10b0
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x48a0
movl 0x7a27(%rip), %ecx      # 0x90ac
leal 0x1(%rcx), %eax
movl %eax, 0x7a1e(%rip)      # 0x90ac
leaq 0x3c15(%rip), %rdx      # 0x52aa
movq %rsp, %r14
pushq $0x20
popq %r15
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1090
movq %r14, %rdi
movq %r15, %rsi
callq 0x10b0
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x48a0
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: instr_noarg
static output_t *instr_noarg(opcode_t op) {
    output_t *out = malloc(sizeof(output_t));
    if (!out) {
        UNREACHABLE("instr: malloc failed");
    }

    out->instr.num_args = op_to_num_args(op);
    if (out->instr.num_args != 0) {
        UNREACHABLE("instr: opcode has nonzero number of args\n");
    }

    out->type = OUTPUT_INSTR;
    out->instr.op = op;

    return out;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
pushq $0x40
popq %rdi
callq 0x10e0
testq %rax, %rax
je 0x1cdf
leal -0x1(%rbx), %ecx
cmpl $0x16, %ecx
ja 0x1cd3
movl $0x7fdffb, %edx         # imm = 0x7FDFFB
btl %ecx, %edx
jb 0x1cfb
andl $0x0, 0xc(%rax)
andl $0x0, (%rax)
movl %ebx, 0x8(%rax)
popq %rbx
retq
leaq 0x344e(%rip), %rdi      # 0x5134
leaq 0x3481(%rip), %rsi      # 0x516e
leaq 0x3961(%rip), %rcx      # 0x5655
movl $0xcc, %edx
jmp 0x1d24
movl %ecx, %ecx
leaq 0x33d4(%rip), %rdx      # 0x50d8
movl (%rdx,%rcx,4), %ecx
movl %ecx, 0xc(%rax)
leaq 0x3423(%rip), %rdi      # 0x5134
leaq 0x3456(%rip), %rsi      # 0x516e
leaq 0x394b(%rip), %rcx      # 0x566a
movl $0xd1, %edx
xorl %eax, %eax
callq 0x1080
pushq $-0x1
popq %rdi
callq 0x1110
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: instr_r
static output_t *instr_r(opcode_t op, reg_t src) {
    output_t *out = malloc(sizeof(output_t));
    if (!out) {
        UNREACHABLE("instr_r: malloc failed\n");
    }

    out->instr.num_args = op_to_num_args(op);
    if (out->instr.num_args != 1) {
        UNREACHABLE("instr_r: num args != 1 for this opcode\n");
    }

    out->type = OUTPUT_INSTR;
    out->instr.op = op;

    out->instr.src.type = OPERAND_REG;
    out->instr.src.reg = src;
    return out;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movl %edi, %ebx
pushq $0x40
popq %rdi
callq 0x10e0
testq %rax, %rax
je 0x1d6e
cmpl $0x17, %ebx
ja 0x1dc3
movl $0xff93e0, %ecx         # imm = 0xFF93E0
btl %ebx, %ecx
jae 0x1d8a
movq $0x1, 0xc(%rax)
andl $0x0, (%rax)
movl %ebx, 0x8(%rax)
movl %ebp, 0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x33bf(%rip), %rdi      # 0x5134
leaq 0x33f2(%rip), %rsi      # 0x516e
leaq 0x3453(%rip), %rcx      # 0x51d6
movl $0xa2, %edx
jmp 0x1db4
movl $0x2c16, %ecx           # imm = 0x2C16
btl %ebx, %ecx
jae 0x1dc3
pushq $0x2
popq %rcx
movl %ecx, 0xc(%rax)
leaq 0x3393(%rip), %rdi      # 0x5134
leaq 0x33c6(%rip), %rsi      # 0x516e
leaq 0x343f(%rip), %rcx      # 0x51ee
movl $0xa7, %edx
xorl %eax, %eax
callq 0x1080
pushq $-0x1
popq %rdi
callq 0x1110
xorl %ecx, %ecx
jmp 0x1d97
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: instr_r2r
static output_t *instr_r2r(opcode_t op, reg_t src, reg_t dst) {
    output_t *out = malloc(sizeof(output_t));
    if (!out) {
        UNREACHABLE("instr_r2r: malloc failed\n");
    }

    out->instr.num_args = op_to_num_args(op);
    if (out->instr.num_args != 2) {
        UNREACHABLE("instr_r2r: num args != 2\n");
    }

    out->type = OUTPUT_INSTR;
    out->instr.op = op;
    out->instr.src.type = OPERAND_REG;
    out->instr.src.reg = src;

    out->instr.dst.type = OPERAND_REG;
    out->instr.dst.reg = dst;
    return out;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %r14d
movl %edi, %ebp
pushq $0x40
popq %rdi
callq 0x10e0
testq %rax, %rax
je 0x1e35
cmpl $0x17, %ebp
ja 0x1e5c
movl $0x2c16, %ecx           # imm = 0x2C16
btl %ebp, %ecx
jae 0x1e0c
movq $0x2, 0xc(%rax)
andl $0x0, (%rax)
movl %ebp, 0x8(%rax)
movl %r14d, 0x18(%rax)
andl $0x0, 0x28(%rax)
movl %ebx, 0x30(%rax)
popq %rbx
popq %r14
popq %rbp
retq
movl $0xff93e0, %ecx         # imm = 0xFF93E0
btl %ebp, %ecx
jae 0x1e5c
pushq $0x1
popq %rcx
movl %ecx, 0xc(%rax)
leaq 0x3311(%rip), %rdi      # 0x5134
leaq 0x3344(%rip), %rsi      # 0x516e
leaq 0x33ff(%rip), %rcx      # 0x5230
pushq $0x42
jmp 0x1e4c
leaq 0x32f8(%rip), %rdi      # 0x5134
leaq 0x332b(%rip), %rsi      # 0x516e
leaq 0x33cc(%rip), %rcx      # 0x5216
pushq $0x3d
popq %rdx
xorl %eax, %eax
callq 0x1080
pushq $-0x1
popq %rdi
callq 0x1110
xorl %ecx, %ecx
jmp 0x1e19
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: instr_i2r
static output_t *instr_i2r(opcode_t op, imm_t src, reg_t dst) {
    output_t *out = malloc(sizeof(output_t));
    if (!out) {
        UNREACHABLE("instr_i2r: malloc failed\n");
    }

    out->instr.num_args = op_to_num_args(op);
    if (out->instr.num_args != 2) {
        UNREACHABLE("instr_i2r: num args != 2\n");
    }

    out->type = OUTPUT_INSTR;
    out->instr.op = op;

    out->instr.src.type = OPERAND_IMM;
    out->instr.src.imm = src;

    out->instr.dst.type = OPERAND_REG;
    out->instr.dst.reg = dst;
    return out;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %ebp
pushq $0x40
popq %rdi
callq 0x10e0
testq %rax, %rax
je 0x1ed4
cmpl $0x17, %ebp
ja 0x1efb
movl $0x2c16, %ecx           # imm = 0x2C16
btl %ebp, %ecx
jae 0x1eab
movabsq $0x300000002, %rcx      # imm = 0x300000002
movq %rcx, 0xc(%rax)
andl $0x0, (%rax)
movl %ebp, 0x8(%rax)
movq %r14, 0x18(%rax)
andl $0x0, 0x28(%rax)
movl %ebx, 0x30(%rax)
popq %rbx
popq %r14
popq %rbp
retq
movl $0xff93e0, %ecx         # imm = 0xFF93E0
btl %ebp, %ecx
jae 0x1efb
pushq $0x1
popq %rcx
movl %ecx, 0xc(%rax)
leaq 0x3272(%rip), %rdi      # 0x5134
leaq 0x32a5(%rip), %rsi      # 0x516e
leaq 0x3394(%rip), %rcx      # 0x5264
pushq $0x57
jmp 0x1eeb
leaq 0x3259(%rip), %rdi      # 0x5134
leaq 0x328c(%rip), %rsi      # 0x516e
leaq 0x3361(%rip), %rcx      # 0x524a
pushq $0x52
popq %rdx
xorl %eax, %eax
callq 0x1080
pushq $-0x1
popq %rdi
callq 0x1110
xorl %ecx, %ecx
jmp 0x1eb8
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: instr_r2m
static output_t *instr_r2m(opcode_t op, reg_t src, mem_loc_t dst) {
    output_t *out = malloc(sizeof(output_t)); 
    out->instr.num_args = op_to_num_args(op);
    if (out->instr.num_args != 2) {
        UNREACHABLE("instr_r2m requires opcode that uses 2 args\n");
    }

    out->type = OUTPUT_INSTR;
    out->instr.op = op;

    out->instr.src.type = OPERAND_REG;
    out->instr.src.reg = src;

    out->instr.dst.type = OPERAND_MEM_LOC;
    out->instr.dst.mem = dst;
    return out;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movl %edi, %r14d
pushq $0x40
popq %rdi
callq 0x10e0
andl $0x0, (%rax)
movabsq $0x200000001, %rcx      # imm = 0x200000001
movq %rcx, 0x8(%rax)
andl $0x0, 0x10(%rax)
movl %r14d, 0x18(%rax)
movl $0x1, 0x28(%rax)
movl %ebp, 0x30(%rax)
movq %rbx, 0x38(%rax)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: instr_label
static output_t *instr_label(opcode_t op, string_t *label) {
    if (op != OP_JMP && op != OP_JE && op != OP_JNE && op != OP_CALL) {
        UNREACHABLE("intsr_label: not a jmp or call opcode\n");
    }

    if (!label) {
        UNREACHABLE("intsr_label: null label\n");
    }

    output_t *out = malloc(sizeof(output_t));
    out->type = OUTPUT_INSTR;
 
    out->instr.num_args = op_to_num_args(op);
    if (out->instr.num_args != 1) {
        UNREACHABLE("instr_label: opcode has wrong number of args, not even sure how this happens\n");
    }

    out->instr.op = op;
    out->instr.src.type = OPERAND_LABEL;
    out->instr.src.label = label;
    return out;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %r14d
leal -0x18(%r14), %eax
cmpl $-0x5, %eax
jbe 0x299f
movq %rsi, %rbx
testq %rsi, %rsi
je 0x29bb
pushq $0x40
popq %rdi
callq 0x10e0
andl $0x0, (%rax)
movabsq $0x400000001, %rcx      # imm = 0x400000001
movq %rcx, 0xc(%rax)
movl %r14d, 0x8(%rax)
movq %rbx, 0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x278e(%rip), %rdi      # 0x5134
leaq 0x27c1(%rip), %rsi      # 0x516e
leaq 0x2c61(%rip), %rcx      # 0x5615
movl $0xb4, %edx
jmp 0x29d5
leaq 0x2772(%rip), %rdi      # 0x5134
leaq 0x27a5(%rip), %rsi      # 0x516e
leaq 0x2c6c(%rip), %rcx      # 0x563c
movl $0xb8, %edx
xorl %eax, %eax
callq 0x1080
pushq $-0x1
popq %rdi
callq 0x1110
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: block_or_single_to_instrs
static list_t *block_or_single_to_instrs(block_or_single_t *block_or_single, context_t context) {
    list_t *ret = list_new();
    if (block_or_single->type == SINGLE) {
        list_concat(ret, stmt_to_instrs(block_or_single->single, context));
    } else {
        list_concat(ret, block_to_instrs(block_or_single->block, context));
    }
    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
leaq 0x40(%rsp), %r15
callq 0x2c34
movq %rax, %rbx
cmpl $0x1, (%r14)
movq 0x8(%r14), %rdi
jne 0x2a20
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x16ce
jmp 0x2a37
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x2a4f
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2cbd
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: block_to_instrs
static list_t *block_to_instrs(block_t *block, context_t context) {
    list_t *ret = list_new();
    stmt_t *curr_stmt = list_pop(block->stmts);
    context.env = block->env;
    for (; curr_stmt; curr_stmt = list_pop(block->stmts)) {
        list_concat(ret, stmt_to_instrs(curr_stmt, context));
    }
    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x40(%rsp), %r15
callq 0x2c34
movq %rax, %r14
movq (%rbx), %rdi
callq 0x2d0a
movq 0x8(%rbx), %rcx
movq %rcx, 0x18(%r15)
testq %rax, %rax
je 0x2aac
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rax, %rdi
callq 0x16ce
movq %r14, %rdi
movq %rax, %rsi
callq 0x2cbd
movq (%rbx), %rdi
callq 0x2d0a
jmp 0x2a78
movq %r14, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/asm.c
// Function: instr_i2m
static output_t *instr_i2m(opcode_t op, imm_t src, mem_loc_t dst) {
    output_t *out = malloc(sizeof(output_t)); 
    out->instr.num_args = op_to_num_args(op);
    if (out->instr.num_args != 2) {
        UNREACHABLE("instr_r2m requires opcode that uses 2 args\n");
    }

    out->type = OUTPUT_INSTR;
    out->instr.op = op;

    out->instr.src.type = OPERAND_IMM;
    out->instr.src.imm = src;

    out->instr.dst.type = OPERAND_MEM_LOC;
    out->instr.dst.mem = dst;
    return out;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movl %edi, %r14d
pushq $0x40
popq %rdi
callq 0x10e0
cmpl $0x17, %r14d
ja 0x2b46
movl $0x2c16, %ecx           # imm = 0x2C16
btl %r14d, %ecx
jae 0x2b0e
movabsq $0x300000002, %rcx      # imm = 0x300000002
movq %rcx, 0xc(%rax)
andl $0x0, (%rax)
movl %r14d, 0x8(%rax)
movq $0x1, 0x18(%rax)
movl $0x1, 0x28(%rax)
movl %ebp, 0x30(%rax)
movq %rbx, 0x38(%rax)
popq %rbx
popq %r14
popq %rbp
retq
movl $0xff93e0, %ecx         # imm = 0xFF93E0
btl %r14d, %ecx
jae 0x2b46
pushq $0x1
popq %rcx
movl %ecx, 0xc(%rax)
leaq 0x260e(%rip), %rdi      # 0x5134
leaq 0x2641(%rip), %rsi      # 0x516e
leaq 0x274a(%rip), %rcx      # 0x527e
pushq $0x7b
popq %rdx
xorl %eax, %eax
callq 0x1080
pushq $-0x1
popq %rdi
callq 0x1110
xorl %ecx, %ecx
jmp 0x2b1c
nop
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/env.c
// Function: env_new
env_t *env_new(env_t *parent) {
    env_t *new_env = malloc(sizeof(env_t));
    if (!new_env)
        return NULL;

    new_env->parent = parent;
    new_env->children = list_new();
    new_env->homes = map_new();

    if (parent)
        list_push(parent->children, new_env);

    return new_env;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $0x18
popq %rdi
callq 0x10e0
movq %rax, %rbx
testq %rax, %rax
je 0x2b89
movq %r14, 0x10(%rbx)
callq 0x2c34
movq %rax, 0x8(%rbx)
callq 0x2eb0
movq %rax, (%rbx)
testq %r14, %r14
je 0x2b89
movq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x2c7e
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/env.c
// Function: env_get
var_info_t *env_get(env_t *env, string_t *var) {
    var_info_t *ret = NULL;
    while (env) {
        if ((ret = map_get(env->homes, var)))
            return ret;
        env = env->parent;
    }
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %ebx, %ebx
testq %r15, %r15
je 0x2bbf
movq (%r15), %rdi
movq %r14, %rsi
callq 0x2ed9
testq %rax, %rax
jne 0x2bbc
movq 0x10(%r15), %r15
jmp 0x2ba1
movq %rax, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/env.c
// Function: env_get_declared
var_info_t *env_get_declared(env_t *env, string_t *var) {
    var_info_t *ret = NULL;
    while (env) {
        if ((ret = map_get(env->homes, var)) && ret->declared)
            return ret;
        env = env->parent;
    }
    return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testq %r14, %r14
je 0x2bf3
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x2ed9
testq %rax, %rax
je 0x2bed
cmpb $0x0, 0x18(%rax)
jne 0x2bf5
movq 0x10(%r14), %r14
jmp 0x2bd2
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/env.c
// Function: env_add
void env_add(env_t *env, string_t *name, builtin_type_t type, bool declared) {
    var_info_t *info = malloc(sizeof(var_info_t)); 
    info->type = type;
    info->declared = declared;
    map_set(env->homes, name, info);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
pushq $0x20
popq %rdi
callq 0x10e0
movl %ebp, (%rax)
movb %bl, 0x18(%rax)
movq (%r15), %rdi
movq %r14, %rsi
movq %rax, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2f53
nop
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/list.c
// Function: list_new
list_t *list_new(void) {
    list_t *list = malloc(sizeof(list_t));
    if (list_init(list) < 0)
        return NULL;
    return list;
}

// Assembly:
pushq %rbx
pushq $0x20
popq %rdi
callq 0x10e0
movq %rax, %rbx
movq %rax, %rdi
callq 0x2c55
xorl %ecx, %ecx
testl %eax, %eax
cmovnsq %rbx, %rcx
movq %rcx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/list.c
// Function: list_init
int list_init(list_t *list) {
    if (!list)
        return -1;
    list->len = 0;
    list->head = list->tail = malloc(sizeof(list_node_t));
    list->head->next = NULL;
    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x2c7a
pushq %rbx
movq %rdi, %rbx
andl $0x0, 0x18(%rdi)
pushq $0x10
popq %rdi
callq 0x10e0
movq %rax, 0x8(%rbx)
movq %rax, (%rbx)
andq $0x0, 0x8(%rax)
xorl %eax, %eax
popq %rbx
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/list.c
// Function: list_push
int list_push(list_t *list, void *data) {
    if (!data)
        return -1;

    list_node_t *new_node = malloc(sizeof(list_node_t));
    if (!new_node)
        return -1;

    new_node->data = data;
    new_node->next = NULL;
    list->tail->next = new_node;
    list->tail = list->tail->next;
    list->len++;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
pushq $-0x1
popq %rbp
testq %rsi, %rsi
je 0x2cb6
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x10e0
testq %rax, %rax
je 0x2cb6
movq %r14, (%rax)
andq $0x0, 0x8(%rax)
movq 0x8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq %rax, 0x8(%rbx)
incl 0x18(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/list.c
// Function: list_concat
int list_concat(list_t *l1, list_t *l2) {
    if (!l1 || !l2)
        return -1;

    l1->tail->next = l2->head->next;
    if (l2->len)
        l1->tail = l2->tail;
    l1->len += l2->len;
    free(l2->head);
    free(l2);
    return 0;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x2d06
pushq %rbx
movq %rsi, %rbx
movq (%rsi), %rax
movq 0x8(%rax), %rcx
movq 0x8(%rdi), %rdx
movq %rcx, 0x8(%rdx)
movl 0x18(%rsi), %ecx
testl %ecx, %ecx
je 0x2cef
movq 0x8(%rbx), %rdx
movq %rdx, 0x8(%rdi)
addl %ecx, 0x18(%rdi)
movq %rax, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
xorl %eax, %eax
popq %rbx
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/list.c
// Function: list_pop
void *list_pop(list_t *list) {
    if (!list)
        return NULL;
    if (list->len == 0)
        return NULL;
    assert(list->head->next);
    list_node_t *removed = list->head->next;
    void *ret_data = removed->data;
    list->head->next = removed->next;
    list->len--;
    if (list->len == 0)
        list->tail = NULL;

    free(removed);
    return ret_data;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x2d44
movl 0x18(%rdi), %ecx
testl %ecx, %ecx
je 0x2d44
movq (%rdi), %rdx
movq 0x8(%rdx), %rax
testq %rax, %rax
je 0x2d4b
movq (%rax), %rbx
movq 0x8(%rax), %rsi
movq %rsi, 0x8(%rdx)
decl %ecx
movl %ecx, 0x18(%rdi)
jne 0x2d3a
andq $0x0, 0x8(%rdi)
movq %rax, %rdi
callq 0x1030
jmp 0x2d46
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
leaq 0x2942(%rip), %rdi      # 0x5694
leaq 0x294c(%rip), %rsi      # 0x56a5
leaq 0x294c(%rip), %rcx      # 0x56ac
pushq $0x39
popq %rdx
callq 0x10a0
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/list.c
// Function: list_peek
void *list_peek(list_t *list) {
    if (!list)
        return NULL;
    if (!list->len)
        return NULL;
    assert(list->head->next);
    return list->head->next->data;
}

// Assembly:
testq %rdi, %rdi
je 0x2d83
cmpl $0x0, 0x18(%rdi)
je 0x2d83
movq (%rdi), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x2d86
movq (%rax), %rax
retq
xorl %eax, %eax
retq
pushq %rax
leaq 0x2906(%rip), %rdi      # 0x5694
leaq 0x2910(%rip), %rsi      # 0x56a5
leaq 0x2929(%rip), %rcx      # 0x56c5
pushq $0x4a
popq %rdx
callq 0x10a0
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/list.c
// Function: list_free
void list_free(list_t *list) {
    if (!list)
        return;
    void *data;
    while ((data = list_pop(list))) {
        // assume it's heap allocated
        free(data);
    }
    assert(list->head->next == list->tail);
    free(list->head);
    free(list);
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x2ddf
movq %rdi, %rbx
movq %rbx, %rdi
callq 0x2d0a
testq %rax, %rax
je 0x2dc4
movq %rax, %rdi
callq 0x1030
jmp 0x2dad
movq (%rbx), %rdi
movq 0x8(%rdi), %rax
cmpq 0x8(%rbx), %rax
jne 0x2de1
callq 0x1030
movq %rbx, %rdi
popq %rbx
jmp 0x1030
popq %rbx
retq
leaq 0x28f7(%rip), %rdi      # 0x56df
leaq 0x28b6(%rip), %rsi      # 0x56a5
leaq 0x2908(%rip), %rcx      # 0x56fe
pushq $0x57
popq %rdx
callq 0x10a0
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/list.c
// Function: _list_iterate
inline bool __list_iterate(list_node_t **node, void **data) {
    if (*node == NULL)
        return false;

    *data = (*node)->data;
    *node = (*node)->next;
    return true;
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2e16
movq (%rax), %rcx
movq %rcx, (%rsi)
movq (%rdi), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, (%rdi)
testq %rax, %rax
setne %al
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/main.c
// Function: main
int main(int argc, char **argv) {
    if (argc != 2) {
        usage();
        return -1;
    }
   
    char *filename = argv[1];
    string_t *input = file_to_string(filename);
    if (!input || !input->len)
        return -1;

    debug("Tokenizing...\n");
    list_t *tokens = tokenize(input);
    if (!tokens || !tokens->len)
        return -1;

    debug("Parsing...\n");
    program_t *prog = parse(tokens);
    if (!prog || !prog->fn_defs)
        return -1;

    /*
     * TODO - do variable allocation here.
     */
    debug("Allocating variable homes...\n");
    alloc_homes(prog);

    debug("Generating asm...\n");
    list_t *instrs = gen_asm(prog);
    if (!instrs || !instrs->len)
        return -1;

    debug("Outputting asm...\n");
    print_asm(instrs);
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jne 0x2e9c
movq 0x8(%rsi), %rdi
callq 0x4800
pushq $-0x1
popq %rbx
testq %rax, %rax
je 0x2ea4
cmpl $0x0, 0x8(%rax)
je 0x2ea4
movq %rax, %rdi
callq 0x49e0
testq %rax, %rax
je 0x2ea4
cmpl $0x0, 0x18(%rax)
je 0x2ea4
movq %rax, %rdi
callq 0x329c
testq %rax, %rax
je 0x2ea4
movq %rax, %r14
cmpq $0x0, (%rax)
je 0x2ea4
movq %r14, %rdi
callq 0x122c
movq %r14, %rdi
callq 0x1334
testq %rax, %rax
je 0x2ea4
cmpl $0x0, 0x18(%rax)
je 0x2ea4
movq %rax, %rdi
callq 0x2fbc
xorl %ebx, %ebx
jmp 0x2ea4
callq 0x2e20
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/map.c
// Function: map_new
map_t *map_new(void) {
    map_t *ret = malloc(sizeof(map_t)); 
    if (!ret)
        return NULL;
    ret->pairs = list_new();
    if (!ret->pairs)
        return NULL;
    return ret;
}

// Assembly:
pushq %rbx
pushq $0x8
popq %rdi
callq 0x10e0
testq %rax, %rax
je 0x2ed2
movq %rax, %rbx
callq 0x2c34
movq %rax, (%rbx)
testq %rax, %rax
cmoveq %rax, %rbx
jmp 0x2ed4
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/map.c
// Function: map_get_pair_from_key
static pair_t *map_get_pair_from_key(map_t *map, string_t *key) {
    pair_t *pair;
    list_for_each(map->pairs, pair) {
        if (string_eq(key, pair->key) == 0) {
            return pair;
        }
    }
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rax
movq (%rax), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq %rsp, %r12
xorl %ebx, %ebx
movq (%r15), %rdi
addq $0x10, %rdi
movq %r12, %rsi
callq 0x2dfe
testb %al, %al
je 0x2f44
movq (%rsp), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x4990
testl %eax, %eax
jne 0x2f1a
movq (%rsp), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/map.c
// Function: map_set
int map_set(map_t *map, string_t *key, void *value) {
    if (!map)
        return -1;

    // Overwrite the value if the key already exists in the map
    pair_t *pair = map_get_pair_from_key(map, key);
    if (pair) {
        pair->value = value;
        return 0;
    }
   
    pair = malloc(sizeof(pair_t));
    if (!pair)
        return -1;
    pair->key = key;
    pair->value = value;
    list_push(map->pairs, pair);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
pushq $-0x1
popq %rbx
testq %rdi, %rdi
je 0x2f9d
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
callq 0x2ef9
testq %rax, %rax
je 0x2f7c
movq %r14, 0x8(%rax)
jmp 0x2f9b
pushq $0x10
popq %rdi
callq 0x10e0
testq %rax, %rax
je 0x2f9d
movq %r12, (%rax)
movq %r14, 0x8(%rax)
movq (%r15), %rdi
movq %rax, %rsi
callq 0x2c7e
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/output.c
// Function: print_asm
void print_asm(list_t *output) {
    if (!output)
        return;

    output_t *curr = list_pop(output);
    for (; curr; curr = list_pop(output)) {
        if (curr->type == OUTPUT_LABEL) {
            if (curr->label.linkage == LABEL_GLOBAL) {
                printf(".globl %s\n", string_get(curr->label.name));
            }
            printf("%s:\n", string_get(curr->label.name));
            continue;
        }

        if (curr->type == OUTPUT_INSTR) {
            instr_t instr = curr->instr;
            if (instr.num_args == 2) {
                printf("\t%s %s, %s\n", op_to_string(instr.op), operand_to_string(instr.src), operand_to_string(instr.dst));
            } else if (instr.num_args == 1) {
                printf("\t%s %s\n", op_to_string(instr.op), operand_to_string(instr.src));
            } else if (instr.num_args == 0) {
                printf("\t%s\n", op_to_string(instr.op));
            } else {
                printf("BAD NUM ARGS\n");
                exit(-1);
            }
            continue;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
testq %rdi, %rdi
je 0x3136
movq %rdi, %rbx
callq 0x2d0a
movq %rax, %r14
leaq 0x28(%rsp), %r12
leaq 0x2745(%rip), %r13      # 0x572f
leaq 0x2749(%rip), %rbp      # 0x573a
testq %r14, %r14
je 0x3136
movl (%r14), %eax
testl %eax, %eax
je 0x3038
cmpl $0x1, %eax
jne 0x3126
cmpl $0x1, 0x10(%r14)
jne 0x3027
movq 0x8(%r14), %rdi
callq 0x4958
movq %r13, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x1080
movq 0x8(%r14), %rdi
callq 0x4958
movq %rbp, %rdi
jmp 0x311c
movups 0x8(%r14), %xmm0
movups 0x18(%r14), %xmm1
movups 0x28(%r14), %xmm2
movaps %xmm0, 0x20(%rsp)
movq 0x38(%r14), %rax
movq %rax, 0x50(%rsp)
movaps %xmm2, 0x40(%rsp)
movaps %xmm1, 0x30(%rsp)
movl 0x24(%rsp), %eax
testl %eax, %eax
je 0x310c
cmpl $0x1, %eax
je 0x30d2
cmpl $0x2, %eax
jne 0x3145
movl 0x20(%rsp), %edi
callq 0x3159
movq %rax, %r14
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
callq 0x317e
movq %rax, %r15
movq 0x28(%r12), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%r12), %xmm0
movups %xmm0, (%rsp)
callq 0x317e
leaq 0x267f(%rip), %rdi      # 0x573f
movq %r14, %rsi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x1080
jmp 0x3126
movl 0x20(%rsp), %edi
callq 0x3159
movq %rax, %r14
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
callq 0x317e
leaq 0x264e(%rip), %rdi      # 0x574b
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1080
jmp 0x3126
movl 0x20(%rsp), %edi
callq 0x3159
leaq 0x2637(%rip), %rdi      # 0x5753
movq %rax, %rsi
xorl %eax, %eax
callq 0x1080
movq %rbx, %rdi
callq 0x2d0a
movq %rax, %r14
jmp 0x2ff1
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26f2(%rip), %rdi      # 0x583e
callq 0x1050
pushq $-0x1
popq %rdi
callq 0x1110
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/output.c
// Function: operand_to_string
static char *operand_to_string(operand_t operand) {
    if (operand.type == OPERAND_REG) {
        return reg_to_string(operand.reg);
    }

    if (operand.type == OPERAND_LABEL) {
        return string_get(operand.label);
    }

    if (operand.type == OPERAND_VAR) {
        UNREACHABLE("VARs should not be in output\n");
    }

    string_t string;
    char buf[100];
    if (string_init(&string) < 0)
        return NULL;
    
    if (operand.type == OPERAND_IMM) {
        snprintf(buf, 100, "$%ld", operand.imm);
    } else if (operand.type == OPERAND_MEM_LOC) {
        snprintf(buf, 100, "%ld(%s)", operand.mem.offset, reg_to_string(operand.mem.reg));
    }
    string_append(&string, buf, strlen(buf));
    return string_get(&string);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
leaq 0x90(%rsp), %r14
movl (%r14), %ebx
testl %ebx, %ebx
je 0x31e4
cmpl $0x4, %ebx
je 0x31d4
cmpl $0x2, %ebx
je 0x324e
movq %rsp, %rdi
callq 0x48dd
testl %eax, %eax
js 0x31f4
cmpl $0x1, %ebx
je 0x31f8
cmpl $0x3, %ebx
jne 0x3221
movq 0x8(%r14), %rcx
leaq 0x2630(%rip), %rdx      # 0x57f3
leaq 0x10(%rsp), %rdi
pushq $0x64
popq %rsi
xorl %eax, %eax
callq 0x1090
jmp 0x3221
movq 0x8(%r14), %rdi
addq $0x78, %rsp
popq %rbx
popq %r14
jmp 0x4958
movl 0x8(%r14), %edi
addq $0x78, %rsp
popq %rbx
popq %r14
jmp 0x3275
xorl %eax, %eax
jmp 0x3246
movq 0x10(%r14), %rbx
movl 0x8(%r14), %edi
callq 0x3275
leaq 0x25ec(%rip), %rdx      # 0x57f8
leaq 0x10(%rsp), %rdi
pushq $0x64
popq %rsi
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x1090
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x1070
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x48a0
movq %r14, %rdi
callq 0x4958
addq $0x78, %rsp
popq %rbx
popq %r14
retq
leaq 0x1edf(%rip), %rdi      # 0x5134
leaq 0x2570(%rip), %rsi      # 0x57cc
leaq 0x2572(%rip), %rcx      # 0x57d5
pushq $0x5c
popq %rdx
xorl %eax, %eax
callq 0x1080
pushq $-0x1
popq %rdi
callq 0x1110
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/parse.c
// Function: match
static bool match(list_t *tokens, token_type_t expectation) {
    token_t *next = list_peek(tokens);
    if (!next || next->type != expectation) {
        return false;
    }
    debug("Found expected\n");
    list_pop(tokens);
    return true;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
callq 0x2d68
testq %rax, %rax
je 0x35ca
cmpl %ebp, (%rax)
jne 0x35ca
movq %rbx, %rdi
callq 0x2d0a
movb $0x1, %al
jmp 0x35cc
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/parse.c
// Function: parse_stmt_list
static list_t *parse_stmt_list(list_t *tokens, env_t *env) {
    expect_next(tokens, TOK_OPEN_BRACE);
    list_t *stmt_list = list_new();
    token_t *curr;
    debug("parsing statement list\n");
    while ((curr = list_peek(tokens)) && curr->type != TOK_CLOSE_BRACE) {
        list_push(stmt_list, parse_stmt(tokens, env));
    }
    debug("done parsing statement list\n");
    expect_next(tokens, TOK_CLOSE_BRACE);
    return stmt_list;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
pushq $0xc
popq %rsi
callq 0x3666
callq 0x2c34
movq %rax, %r15
movq %rbx, %rdi
callq 0x2d68
testq %rax, %rax
je 0x3618
cmpl $0xd, (%rax)
je 0x3618
movq %rbx, %rdi
movq %r14, %rsi
callq 0x36a0
movq %r15, %rdi
movq %rax, %rsi
callq 0x2c7e
jmp 0x35ee
pushq $0xd
popq %rsi
movq %rbx, %rdi
callq 0x3666
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/parse.c
// Function: expect_next
static token_t *expect_next(list_t *tokens, token_type_t expectation) {
    token_t *next = list_pop(tokens);
    if (!next || next->type != expectation) {
        debug("Unexpected token: %u\n", (unsigned)next->type);
        UNREACHABLE("Parse failed");
    }
    return next;
}

// Assembly:
pushq %rbx
movl %esi, %ebx
callq 0x2d0a
testq %rax, %rax
je 0x3679
cmpl %ebx, (%rax)
jne 0x3679
popq %rbx
retq
leaq 0x1ab4(%rip), %rdi      # 0x5134
leaq 0x21f5(%rip), %rsi      # 0x587c
leaq 0x22cd(%rip), %rcx      # 0x595b
pushq $0x20
popq %rdx
xorl %eax, %eax
callq 0x1080
pushq $-0x1
popq %rdi
callq 0x1110
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/parse.c
// Function: parse_block
static block_t *parse_block(list_t *tokens, env_t *outer) {
    block_t *block = malloc(sizeof(block_t));
    block->env = env_new(outer);
    block->stmts = parse_stmt_list(tokens, block->env);
    return block;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x10
popq %rdi
callq 0x10e0
movq %rax, %r15
movq %rbx, %rdi
callq 0x2b4c
movq %rax, 0x8(%r15)
movq %r14, %rdi
movq %rax, %rsi
callq 0x35d3
movq %rax, (%r15)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/parse.c
// Function: parse_block_or_single
static block_or_single_t *parse_block_or_single(list_t *tokens, env_t *env) {
    block_or_single_t *ret = malloc(sizeof(block_or_single_t));
    if (check_next(tokens, TOK_OPEN_BRACE)) {
        debug("Parsing block\n");
        ret->type = BLOCK;
        ret->block = parse_block(tokens, env);
    } else {
        debug("Parsing single\n");
        ret->type = SINGLE;
        ret->single = parse_stmt(tokens, env);
        if (ret->single->type == STMT_DECLARE) {
            UNREACHABLE("Error: in single of block or single, statement cannot be a declare");
        }
    }
    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
pushq $0x10
popq %rdi
callq 0x10e0
movq %rax, %rbx
pushq $0xc
popq %rsi
movq %r15, %rdi
callq 0x3c7c
testb %al, %al
je 0x3c30
andl $0x0, (%rbx)
movq %r15, %rdi
movq %r14, %rsi
callq 0x3b20
movq %rax, 0x8(%rbx)
jmp 0x3c4a
movl $0x1, (%rbx)
movq %r15, %rdi
movq %r14, %rsi
callq 0x36a0
movq %rax, 0x8(%rbx)
cmpl $0x1, (%rax)
je 0x3c53
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x14da(%rip), %rdi      # 0x5134
leaq 0x1c1b(%rip), %rsi      # 0x587c
leaq 0x1d00(%rip), %rcx      # 0x5968
movl $0x25d, %edx            # imm = 0x25D
xorl %eax, %eax
callq 0x1080
pushq $-0x1
popq %rdi
callq 0x1110
// File: /workspace/github_c_makefile_star2_O2/johnvtan[P]ccccc/parse.c
// Function: new_primary_int
static expr_t *new_primary_int(int val) {
    expr_t *expr = malloc(sizeof(expr_t));
    expr->type = PRIMARY;
    expr->primary = malloc(sizeof(primary_t));
    expr->primary->type = PRIMARY_INT;
    expr->primary->integer = val;
    expr->c_type = TYPE_INT;
    return expr;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edi, %ebx
pushq $0x10
popq %r14
movq %r14, %rdi
callq 0x10e0
movq %rax, %r15
andl $0x0, (%rax)
movq %r14, %rdi
callq 0x10e0
andl $0x0, (%rax)
movq %rax, 0x8(%r15)
movl %ebx, 0x8(%rax)
movl $0x1, 0x4(%r15)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq