LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/bootstrap1.c
// Function: pass1SimpleExpr
long pass1SimpleExpr(long expr, long cont)
{
    long clauses, test, args, f, cpArgs, cp, name;
    goto L1;
L1:
    switch (runtime_class(expr)) {
    case CLASS_Fixnum:
        goto L2;
    case CLASS_String:
        goto L2;
    case CLASS_Id:
        name = prim_fetch(expr, runtime_makeNumber(0));
        goto L3;
    case CLASS_HiConsApp:
        cp = prim_fetch(expr, runtime_makeNumber(0));
        cpArgs = prim_fetch(expr, runtime_makeNumber(1));
        goto L4;
    case CLASS_HiPrimApp:
        cp = prim_fetch(expr, runtime_makeNumber(0));
        cpArgs = prim_fetch(expr, runtime_makeNumber(1));
        goto L4;
    case CLASS_HiCall:
        f = prim_fetch(expr, runtime_makeNumber(0));
        args = prim_fetch(expr, runtime_makeNumber(1));
        goto L5;
    case CLASS_HiMatch:
        test = prim_fetch(expr, runtime_makeNumber(0));
        clauses = prim_fetch(expr, runtime_makeNumber(1));
        goto L6;
    default:
        runtime_matchFailure(__LINE__);
    }
L2:
    return pass1TrivialExpr(expr, cont);
L3:
    return pass1TrivialExpr(expr, cont);
L4:
    return pass1TrivialExpr(expr, cont);
L5:
    return pass1CallExpr(f, args, cont);
L6:
    return pass1MatchExpr(test, clauses, cont);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x3afb
cmpw $0xf, %ax
ja 0x1797
movzwl %ax, %eax
leaq 0x288d(%rip), %rcx      # 0x4004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %edi, %edi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
pushq $0x1
popq %rdi
jmp 0x17e0
movl $0x122, %edi            # imm = 0x122
callq 0x3e37
jmp 0x17f0
xorl %edi, %edi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r15
pushq $0x1
popq %rdi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x1b29
xorl %edi, %edi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x183b
xorl %edi, %edi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r15
pushq $0x1
popq %rdi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x1a4b
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/bootstrap1.c
// Function: pass1CallExpr
long pass1CallExpr(long f, long args, long cont)
{
    long x5, x4, label, x3, x2, contBlocks, explicitCont, x1;
    goto L1;
L1:
    x1 = pass1ExplicitCont(cont);
    goto L2;
L2:
    switch (runtime_class(x1)) {
    case CLASS_Pair:
        explicitCont = prim_fetch(x1, runtime_makeNumber(0));
        contBlocks = prim_fetch(x1, runtime_makeNumber(1));
        goto L3;
    default:
        runtime_matchFailure(__LINE__);
    }
L3:
    switch (runtime_class(explicitCont)) {
    case CLASS_P1TailCont:
        goto L4;
    case CLASS_P1BlockCont:
        label = prim_fetch(explicitCont, runtime_makeNumber(0));
        goto L5;
    default:
        runtime_matchFailure(__LINE__);
    }
L4:
    x2 = FiCall(nil, f, args);
    x3 = Triple(nil, x2, nil);
    return x3;
L5:
    x4 = FiCall(label, f, args);
    x5 = Triple(nil, x4, contBlocks);
    return x5;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rdx, %rdi
callq 0x1be2
movq %rax, %r15
movq %rax, %rdi
callq 0x3afb
cmpw $0x1f, %ax
jne 0x1a9f
xorl %edi, %edi
callq 0x3b81
movq %r15, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r12
pushq $0x1
popq %rdi
callq 0x3b81
movq %r15, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r15
jmp 0x1aa9
movl $0x13e, %edi            # imm = 0x13E
callq 0x3e37
movq %r12, %rdi
callq 0x3afb
cmpw $0x21, %ax
je 0x1afb
movzwl %ax, %eax
cmpl $0x22, %eax
jne 0x1af1
xorl %edi, %edi
callq 0x3b81
movq %r12, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1d0b
leaq 0x25742(%rip), %rcx     # 0x27228
movq (%rcx), %rdi
movq %rax, %rsi
movq %r15, %rdx
jmp 0x1b19
movl $0x148, %edi            # imm = 0x148
callq 0x3e37
leaq 0x25726(%rip), %r15     # 0x27228
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1d0b
movq (%r15), %rdi
movq %rax, %rsi
movq %rdi, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x123a
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/bootstrap1.c
// Function: pass1MatchExpr
long pass1MatchExpr(long test, long clauses, long cont)
{
    long x5, x4, clauseBlocks, x3, x2, contBlocks, explicitCont, x1, labeledClauses;
    goto L1;
L1:
    labeledClauses = pass1LabeledClauses(clauses);
    goto L2;
L2:
    x1 = pass1ExplicitCont(cont);
    goto L3;
L3:
    switch (runtime_class(x1)) {
    case CLASS_Pair:
        explicitCont = prim_fetch(x1, runtime_makeNumber(0));
        contBlocks = prim_fetch(x1, runtime_makeNumber(1));
        goto L4;
    default:
        runtime_matchFailure(__LINE__);
    }
L4:
    clauseBlocks = pass1ClauseBlocks(labeledClauses, explicitCont);
    goto L6;
L5:
    x3 = FiMatch(test, x2);
    x4 = append(contBlocks, clauseBlocks);
    goto L7;
L6:
    x2 = pass1TransformedClauses(labeledClauses);
    goto L5;
L7:
    x5 = Triple(nil, x3, x4);
    return x5;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x1d1c
movq %rax, %r14
movq %r15, %rdi
callq 0x1be2
movq %rax, %r15
movq %rax, %rdi
callq 0x3afb
cmpw $0x1f, %ax
jne 0x1bd8
xorl %edi, %edi
callq 0x3b81
movq %r15, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r12
pushq $0x1
popq %rdi
callq 0x3b81
movq %r15, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r15
movq %r14, %rdi
movq %r12, %rsi
callq 0x1d7f
movq %rax, %r12
movq %r14, %rdi
callq 0x1df9
pushq $0x1a
popq %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x3cbd
movq %rax, %rbx
movq %r15, %rdi
movq %r12, %rsi
callq 0x125a
leaq 0x25669(%rip), %rcx     # 0x27228
movq (%rcx), %rdi
movq %rbx, %rsi
movq %rax, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x123a
movl $0x165, %edi            # imm = 0x165
callq 0x3e37
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/bootstrap1.c
// Function: pass1ExplicitCont
long pass1ExplicitCont(long cont)
{
    long x2, explicitCont, contBlocks, blk, args, blks, xfer, stmts, triple, x1, label, formsCont, forms, x;
    goto L1;
L1:
    switch (runtime_class(cont)) {
    case CLASS_P1TrivialCont:
        x = prim_fetch(cont, runtime_makeNumber(0));
        forms = prim_fetch(cont, runtime_makeNumber(1));
        formsCont = prim_fetch(cont, runtime_makeNumber(2));
        goto L2;
    default:
        goto L3;
    }
L2:
    label = prim_genLabel();
    triple = pass1Begin(forms, formsCont);
    goto L4;
L3:
    x1 = Pair(cont, nil);
    return x1;
L4:
    switch (runtime_class(triple)) {
    case CLASS_Triple:
        stmts = prim_fetch(triple, runtime_makeNumber(0));
        xfer = prim_fetch(triple, runtime_makeNumber(1));
        blks = prim_fetch(triple, runtime_makeNumber(2));
        goto L5;
    default:
        runtime_matchFailure(__LINE__);
    }
L5:
    args = prim_cons(x, nil);
    blk = FiBlock(label, args, stmts, xfer);
    contBlocks = prim_cons(blk, blks);
    explicitCont = P1BlockCont(label);
    x2 = Pair(explicitCont, contBlocks);
    return x2;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
callq 0x3afb
cmpw $0x23, %ax
jne 0x1ca5
xorl %edi, %edi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %rbx
pushq $0x1
popq %rdi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r15
pushq $0x2
popq %rdi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r12
callq 0x3ec9
movq %rax, %r14
movq %r15, %rdi
movq %r12, %rsi
callq 0x155f
movq %rax, %r12
movq %rax, %rdi
callq 0x3afb
cmpw $0x20, %ax
jne 0x1cb4
xorl %edi, %edi
callq 0x3b81
movq %r12, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r15
pushq $0x1
popq %rdi
callq 0x3b81
movq %r12, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r13
pushq $0x2
popq %rdi
callq 0x3b81
movq %r12, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r12
jmp 0x1cbe
leaq 0x2557c(%rip), %rax     # 0x27228
movq (%rax), %rsi
movq %r14, %rdi
jmp 0x1cfd
movl $0x289, %edi            # imm = 0x289
callq 0x3e37
leaq 0x25563(%rip), %rax     # 0x27228
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x3e73
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x1743
movq %rax, %rdi
movq %r12, %rsi
callq 0x3e73
movq %rax, %rbx
movq %r14, %rdi
callq 0x12c4
movq %rax, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x122c
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/bootstrap1.c
// Function: pass1LabeledClauses
long pass1LabeledClauses(long clauses)
{
    long x2, x1, moreClauses, clause;
    goto L1;
L1:
    switch (runtime_class(clauses)) {
    case CLASS_Cons:
        clause = prim_fetch(clauses, runtime_makeNumber(0));
        moreClauses = prim_fetch(clauses, runtime_makeNumber(1));
        goto L2;
    default:
        goto L3;
    }
L2:
    x1 = prim_genLabel();
    x2 = Pair(x1, clause);
    return x2;
L3:
    return nil;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x3afb
cmpw $0x3, %ax
jne 0x1d6d
xorl %edi, %edi
callq 0x3b81
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r14
pushq $0x1
popq %rdi
callq 0x3b81
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b22
callq 0x3ec9
movq %rax, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x122c
leaq 0x254b4(%rip), %rax     # 0x27228
movq (%rax), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/bootstrap1.c
// Function: pass1ClauseBlocks
long pass1ClauseBlocks(long labeledClauses, long cont)
{
    long x2, x1, moreLabeledClauses, labeledClause;
    goto L1;
L1:
    switch (runtime_class(labeledClauses)) {
    case CLASS_Cons:
        labeledClause = prim_fetch(labeledClauses, runtime_makeNumber(0));
        moreLabeledClauses = prim_fetch(labeledClauses, runtime_makeNumber(1));
        goto L2;
    default:
        goto L3;
    }
L2:
    x1 = pass1OneClauseBlocks(labeledClause, cont);
    goto L4;
L3:
    return nil;
L4:
    x2 = pass1ClauseBlocks(moreLabeledClauses, cont);
    goto L5;
L5:
    return append(x1, x2);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x3afb
cmpw $0x3, %ax
jne 0x1de9
xorl %edi, %edi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r15
pushq $0x1
popq %rdi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r14
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1f52
movq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1d7f
movq %r15, %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x125a
leaq 0x25438(%rip), %rax     # 0x27228
movq (%rax), %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/bootstrap1.c
// Function: pass1TransformedClauses
long pass1TransformedClauses(long labeledClauses)
{
    long x5, x4, x3, x2, elseBlk, x1, caseBlk, caseArgs, c, clause, label, moreLabeledClauses, labeledClause;
    goto L1;
L1:
    switch (runtime_class(labeledClauses)) {
    case CLASS_Cons:
        labeledClause = prim_fetch(labeledClauses, runtime_makeNumber(0));
        moreLabeledClauses = prim_fetch(labeledClauses, runtime_makeNumber(1));
        goto L2;
    default:
        goto L3;
    }
L2:
    switch (runtime_class(labeledClause)) {
    case CLASS_Pair:
        label = prim_fetch(labeledClause, runtime_makeNumber(0));
        clause = prim_fetch(labeledClause, runtime_makeNumber(1));
        goto L4;
    default:
        runtime_matchFailure(__LINE__);
    }
L3:
    return nil;
L4:
    switch (runtime_class(clause)) {
    case CLASS_HiCase:
        c = prim_fetch(clause, runtime_makeNumber(0));
        caseArgs = prim_fetch(clause, runtime_makeNumber(1));
        caseBlk = prim_fetch(clause, runtime_makeNumber(2));
        goto L5;
    case CLASS_HiElse:
        elseBlk = prim_fetch(clause, runtime_makeNumber(0));
        goto L6;
    default:
        runtime_matchFailure(__LINE__);
    }
L5:
    x1 = FiCase(c, label);
        x3 = x1;
    goto L7;
L6:
    x2 = FiElse(label);
        x3 = x2;
    goto L7;
L7:
    x4 = pass1TransformedClauses(moreLabeledClauses);
    goto L8;
L8:
    x5 = prim_cons(x3, x4);
    return x5;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x3afb
cmpw $0x3, %ax
jne 0x1ede
xorl %edi, %edi
callq 0x3b81
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r15
pushq $0x1
popq %rdi
callq 0x3b81
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %rbx
movq %r15, %rdi
callq 0x3afb
cmpw $0x1f, %ax
jne 0x1ed4
xorl %edi, %edi
callq 0x3b81
movq %r15, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r14
pushq $0x1
popq %rdi
callq 0x3b81
movq %r15, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r15
movq %rax, %rdi
callq 0x3afb
cmpw $0x10, %ax
jne 0x1ef4
xorl %edi, %edi
callq 0x3b81
movq %r15, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, %r12
pushq $0x1
popq %rdi
callq 0x3b81
movq %r15, %rdi
movq %rax, %rsi
callq 0x3b22
pushq $0x2
popq %rdi
callq 0x3b81
movq %r15, %rdi
movq %rax, %rsi
callq 0x3b22
pushq $0x1b
popq %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x3cbd
jmp 0x1f19
movl $0x18a, %edi            # imm = 0x18A
callq 0x3e37
leaq 0x25343(%rip), %rax     # 0x27228
movq (%rax), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movzwl %ax, %eax
cmpl $0x11, %eax
jne 0x1f3a
xorl %edi, %edi
callq 0x3b81
movq %r15, %rdi
movq %rax, %rsi
callq 0x3b22
pushq $0x1c
popq %rdi
movq %r14, %rsi
callq 0x3c05
movq %rax, %r14
movq %rbx, %rdi
callq 0x1df9
movq %r14, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3e73
movl $0x199, %edi            # imm = 0x199
callq 0x3e37
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/printer.c
// Function: match
static int match(long x, unsigned short class, ...)
{
    va_list ap;
    long *p;
    int arity, i, matched;

    va_start(ap, class);

    matched = (runtime_class(x) == class);
    arity = runtime_classArities[class];
    for (i = 0; i < arity; i++) {
        p = va_arg(ap, long *);
        if (matched)
            *p = prim_fetch(x, runtime_makeNumber(i));
    }

    va_end(ap);

    return matched;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %esi, %ebx
movq %rdi, %r14
leaq 0x20(%rsp), %rsi
movq %rdx, 0x10(%rsi)
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x3754
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsi, 0x10(%rsp)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsp)
callq 0x3afb
movl %eax, %ebp
movl %ebx, %eax
leaq 0x39fc(%rip), %rcx      # 0x7180
movzbl (%rcx,%rax), %r12d
xorl %r15d, %r15d
cmpq %r15, %r12
je 0x37dc
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x37aa
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x37b8
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
cmpw %bx, %bp
jne 0x37d7
movq (%rax), %r13
movq %r15, %rdi
callq 0x3b81
movq %r14, %rdi
movq %rax, %rsi
callq 0x3b22
movq %rax, (%r13)
incq %r15
jmp 0x378c
xorl %eax, %eax
cmpw %bx, %bp
sete %al
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/printer.c
// Function: prFuncSpec
static void prFuncSpec(long name, long args)
{
    pr("long "), prStr(name), pr("(");
    if (length(args) > 0)
        prTypedIds(args);
    else
        pr("void");
    pr(")");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xd62(%rip), %rdi       # 0x4582
xorl %eax, %eax
callq 0x1070
movq %r14, %rdi
callq 0x399f
pushq $0x28
popq %rdi
callq 0x1040
movq %rbx, %rdi
callq 0x38dc
testl %eax, %eax
jle 0x38a8
leaq 0x8(%rsp), %rax
movq %rbx, (%rax)
leaq 0xd55(%rip), %r13       # 0x45a7
pushq $0x3
popq %rbp
leaq 0x10(%rsp), %r15
leaq 0xd21(%rip), %r12       # 0x4582
leaq 0xca6(%rip), %r14       # 0x450e
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x36ee
testl %eax, %eax
je 0x38b6
movq %r13, %rdi
xorl %eax, %eax
callq 0x1070
movq %r12, %rdi
xorl %eax, %eax
callq 0x1070
movq 0x10(%rsp), %rdi
callq 0x37f6
movq 0x8(%rsp), %rbx
movq %r14, %r13
jmp 0x3868
leaq 0xcca(%rip), %rdi       # 0x4579
xorl %eax, %eax
callq 0x1070
pushq $0x29
popq %rdi
callq 0x1040
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/printer.c
// Function: prIds
static void prIds(long ids)
{
    long id;
    const char *sep = "";

    forEach(ids, id)
        pr(sep), prId(id), sep = ", ";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsp, %rbx
movq %rdi, (%rbx)
leaq 0xc6c(%rip), %r15       # 0x45a7
pushq $0x3
popq %rbp
leaq 0x8(%rsp), %r14
leaq 0xbc4(%rip), %r12       # 0x450e
movl %ebp, %esi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x36ee
testl %eax, %eax
je 0x397a
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movq 0x8(%rsp), %rdi
callq 0x37f6
movq (%rsp), %rdi
movq %r12, %r15
jmp 0x394a
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/printer.c
// Function: findArgs
static long findArgs(long key, long blocks)
{
    const char *keyString;
    long id, args, stmts, transfer, block;

    keyString = runtime_stringValue(key);
    forEach(blocks, block) {
        if (match(block, CLASS_FiBlock, &id, &args, &stmts, &transfer))
            if (!strcmp(runtime_stringValue(idName(id)), keyString))
                return args;
    }

    die("Failed to find arguments for block.");
    return nil;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r13
callq 0x3aca
movq %rax, %rbx
leaq 0x8(%rsp), %rax
movq %r13, (%rax)
leaq 0x10(%rsp), %r15
leaq 0x18(%rsp), %r12
leaq 0x30(%rsp), %rbp
leaq 0x28(%rsp), %r14
movq %r13, %rdi
pushq $0x3
popq %rsi
movq %r15, %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x36ee
testl %eax, %eax
je 0x3a47
movq 0x10(%rsp), %rdi
pushq $0x15
popq %rsi
leaq 0x20(%rsp), %rdx
movq %r12, %rcx
movq %rbp, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x36ee
testl %eax, %eax
je 0x3a40
movq 0x20(%rsp), %rdi
callq 0x38cd
movq %rax, %rdi
callq 0x3aca
movq %rax, %rdi
movq %rbx, %rsi
callq 0x10a0
testl %eax, %eax
je 0x3a5f
movq 0x8(%rsp), %r13
jmp 0x39e5
leaq 0xc0b(%rip), %rdi       # 0x4659
callq 0x3fb8
leaq 0x237ce(%rip), %rax     # 0x27228
movq (%rax), %rax
jmp 0x3a64
movq 0x18(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/runtime.c
// Function: makeString
static long makeString(const char *s)
{
    unsigned long align;
    unsigned long size;
    unsigned long len;
    unsigned long i;

    len = strlen(s);
    align = sizeof(long);
    size = sizeof(long) + len + 1;
    i = storeAlloc(align, size);
    *(long *)(store.data + i) = makeNumber((long)len);
    memmove(store.data + i + sizeof(long), s, len + 1);

    return (long)(i << 16 | CLASS_String);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x1060
movq %rax, %r14
leaq 0x9(%rax), %rdi
callq 0x3c6e
movq %rax, %r15
movq %r14, %rax
shlq $0x10, %rax
movq 0x23758(%rip), %rcx     # 0x271f8
leaq (%rcx,%r15), %rdi
addq $0x8, %rdi
movq %rax, -0x8(%rdi)
incq %r14
movq %rbx, %rsi
movq %r14, %rdx
callq 0x10f0
shlq $0x10, %r15
incq %r15
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/runtime.c
// Function: prim_fetch
long prim_fetch(long m, long k)
{
    long *tuple;
    unsigned char arity;
    long i;

    /* TODO What sanity checks do we want here? */

    arity = runtime_classArities[runtime_class(m)];
    i = fixnumValue(k);

    if (i >= arity)
        die("Fetching slot that does not exist.");

    tuple = storeAddr(m);
    return tuple[i];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rdi, 0x236b0(%rip)     # 0x271e0
movzwl %bx, %eax
leaq 0x3646(%rip), %rcx      # 0x7180
movzbl (%rax,%rcx), %eax
movq %rsi, %rcx
shrq $0x10, %rcx
movabsq $-0x1000000000000, %r14 # imm = 0xFFFF000000000000
orq %rcx, %r14
testq %rsi, %rsi
cmovnsq %rcx, %r14
cmpq %rax, %r14
jl 0x3b6a
leaq 0xba2(%rip), %rdi       # 0x4707
callq 0x3fb8
shrq $0x10, %rbx
addq 0x23683(%rip), %rbx     # 0x271f8
movq (%rbx,%r14,8), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/runtime.c
// Function: prim_die
long prim_die(long e)
{
    const char *s;

    mustBe(CLASS_String, e);

    s = storeAddr(e) + sizeof(long);
    die(s);

    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq %rdi, 0x2364c(%rip)     # 0x271e0
cmpw $0x1, %bx
je 0x3ba6
leaq 0xb5a(%rip), %rdi       # 0x46fb
callq 0x3fb8
movq 0x2364b(%rip), %rax     # 0x271f8
shrq $0x10, %rbx
leaq (%rax,%rbx), %rdi
addq $0x8, %rdi
callq 0x3fb8
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/runtime.c
// Function: runtime_makeTuple0
long runtime_makeTuple0(unsigned short class)
{
    if (runtime_classArities[class] != 0) {
        fprintf(stderr, "Class: %d Arity: %d\n", (int)class, 0);
        die("Arity error while making tuple.");
    }

    return (long)class;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
leaq 0x35b4(%rip), %rax      # 0x7180
cmpb $0x0, (%rbx,%rax)
jne 0x3bd7
movq %rbx, %rax
popq %rbx
retq
movq 0x341a(%rip), %rax      # 0x6ff8
movq (%rax), %rax
movzwl %di, %edx
leaq 0xb3f(%rip), %rsi       # 0x472a
movq %rax, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x10b0
leaq 0xb41(%rip), %rdi       # 0x473f
callq 0x3fb8
jmp 0x3bd2
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/runtime.c
// Function: runtime_makeTuple1
long runtime_makeTuple1(unsigned short class, long a)
{
    unsigned long align;
    unsigned long size;
    unsigned long i;
    long *tuple;

    if (runtime_classArities[class] != 1) {
        fprintf(stderr, "Class: %d Arity: %d\n", (int)class, 1);
        die("Arity error while making tuple.");
    }

    align = sizeof(long);
    size = sizeof(long);
    i = storeAlloc(align, size);
    tuple = store.data + i;

    tuple[0] = a;

    return (long)(i << 16 | class);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
leaq 0x356a(%rip), %rax      # 0x7180
cmpb $0x1, (%r14,%rax)
jne 0x3c3f
pushq $0x8
popq %rdi
callq 0x3c6e
movq 0x235cc(%rip), %rcx     # 0x271f8
movq %rbx, (%rcx,%rax)
shlq $0x10, %rax
orq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x33b2(%rip), %rax      # 0x6ff8
movq (%rax), %rax
movzwl %di, %edx
leaq 0xad7(%rip), %rsi       # 0x472a
pushq $0x1
popq %rcx
movq %rax, %rdi
xorl %eax, %eax
callq 0x10b0
leaq 0xad8(%rip), %rdi       # 0x473f
callq 0x3fb8
jmp 0x3c1d
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/runtime.c
// Function: storeAlloc
static long storeAlloc(unsigned long align, unsigned long size)
{
    unsigned long i;

    i = align * (store.firstFree + align - 1) / align;
    if (i + size > store.size)
        die("Out of memory.");

    store.firstFree = i + size;

    return i;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x23574(%rip), %rax     # 0x271f0
addq $0x7, %rax
movabsq $0x1fffffffffffffff, %r14 # imm = 0x1FFFFFFFFFFFFFFF
andq %rax, %r14
addq %r14, %rbx
movzbl 0x23551(%rip), %eax     # 0x271e8
shll $0x1b, %eax
cmpq %rax, %rbx
jbe 0x3cab
leaq 0xae4(%rip), %rdi       # 0x478a
callq 0x3fb8
movq %rbx, 0x2353e(%rip)     # 0x271f0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/runtime.c
// Function: runtime_makeTuple2
long runtime_makeTuple2(unsigned short class, long a, long b)
{
    unsigned long align;
    unsigned long size;
    unsigned long i;
    long *tuple;

    if (runtime_classArities[class] != 2) {
        fprintf(stderr, "Class: %d Arity: %d\n", (int)class, 2);
        die("Arity error while making tuple.");
    }

    align = sizeof(long);
    size = 2 * sizeof(long);
    i = storeAlloc(align, size);
    tuple = store.data + i;

    tuple[0] = a;
    tuple[1] = b;

    return (long)(i << 16 | class);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r15d
leaq 0x34ae(%rip), %rax      # 0x7180
cmpb $0x2, (%r15,%rax)
jne 0x3cfe
pushq $0x10
popq %rdi
callq 0x3c6e
movq 0x23510(%rip), %rcx     # 0x271f8
movq %r14, (%rcx,%rax)
movq %rbx, 0x8(%rcx,%rax)
shlq $0x10, %rax
orq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
movq 0x32f3(%rip), %rax      # 0x6ff8
movq (%rax), %rax
movzwl %di, %edx
leaq 0xa18(%rip), %rsi       # 0x472a
pushq $0x2
popq %rcx
movq %rax, %rdi
xorl %eax, %eax
callq 0x10b0
leaq 0xa19(%rip), %rdi       # 0x473f
callq 0x3fb8
jmp 0x3cd9
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/runtime.c
// Function: runtime_makeTuple3
long runtime_makeTuple3(unsigned short class, long a, long b, long c)
{
    unsigned long align;
    unsigned long size;
    unsigned long i;
    long *tuple;

    if (runtime_classArities[class] != 3) {
        fprintf(stderr, "Class: %d Arity: %d\n", (int)class, 3);
        die("Arity error while making tuple.");
    }

    align = sizeof(long);
    size = 3 * sizeof(long);
    i = storeAlloc(align, size);
    tuple = store.data + i;

    tuple[0] = a;
    tuple[1] = b;
    tuple[2] = c;

    return (long)(i << 16 | class);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %r12d
leaq 0x3438(%rip), %rax      # 0x7180
cmpb $0x3, (%r12,%rax)
jne 0x3d7f
pushq $0x18
popq %rdi
callq 0x3c6e
movq 0x2349a(%rip), %rcx     # 0x271f8
movq %r15, (%rcx,%rax)
movq %r14, 0x8(%rcx,%rax)
movq %rbx, 0x10(%rcx,%rax)
shlq $0x10, %rax
orq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x3272(%rip), %rax      # 0x6ff8
movq (%rax), %rax
movzwl %di, %edx
leaq 0x997(%rip), %rsi       # 0x472a
pushq $0x3
popq %rcx
movq %rax, %rdi
xorl %eax, %eax
callq 0x10b0
leaq 0x998(%rip), %rdi       # 0x473f
callq 0x3fb8
jmp 0x3d4f
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/runtime.c
// Function: runtime_makeTuple4
long runtime_makeTuple4(unsigned short class, long a, long b, long c, long d)
{
    unsigned long align;
    unsigned long size;
    unsigned long i;
    long *tuple;

    if (runtime_classArities[class] != 4) {
        fprintf(stderr, "Class: %d Arity: %d\n", (int)class, 4);
        die("Arity error while making tuple.");
    }

    align = sizeof(long);
    size = 4 * sizeof(long);
    i = storeAlloc(align, size);
    tuple = store.data + i;

    tuple[0] = a;
    tuple[1] = b;
    tuple[2] = c;
    tuple[3] = d;

    return (long)(i << 16 | class);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movl %edi, %r13d
leaq 0x33b3(%rip), %rax      # 0x7180
cmpb $0x4, (%r13,%rax)
jne 0x3e08
pushq $0x20
popq %rdi
callq 0x3c6e
movq 0x23414(%rip), %rcx     # 0x271f8
movq %r12, (%rcx,%rax)
movq %r15, 0x8(%rcx,%rax)
movq %r14, 0x10(%rcx,%rax)
movq %rbx, 0x18(%rcx,%rax)
shlq $0x10, %rax
orq %r13, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x31e9(%rip), %rax      # 0x6ff8
movq (%rax), %rax
movzwl %di, %edx
leaq 0x90e(%rip), %rsi       # 0x472a
pushq $0x4
popq %rcx
movq %rax, %rdi
xorl %eax, %eax
callq 0x10b0
leaq 0x90f(%rip), %rdi       # 0x473f
callq 0x3fb8
jmp 0x3dd5
// File: /workspace/github_c_makefile_star2_O2/ebb[P]chisa/runtime.c
// Function: runtime_init
void runtime_init(void)
{
    storeInit(128 * 1024 * 1024);
    runtime_0 = runtime_makeNumber(0);
    runtime_1 = runtime_makeNumber(1);
    runtime_2 = runtime_makeNumber(2);
    runtime_3 = runtime_makeNumber(3);
    nil = runtime_makeTuple0(CLASS_Nil);
}

// Assembly:
pushq %rax
movb $0x1, 0x23296(%rip)     # 0x271e8
andq $0x0, 0x23296(%rip)     # 0x271f0
movl $0x8000000, %edi        # imm = 0x8000000
callq 0x10d0
movq %rax, 0x2328d(%rip)     # 0x271f8
testq %rax, %rax
jne 0x3f7c
leaq 0x841(%rip), %rdi       # 0x47b8
callq 0x3fb8
andq $0x0, 0x23284(%rip)     # 0x27208
movq $0x10000, 0x23281(%rip) # imm = 0x10000
movq $0x20000, 0x2327e(%rip) # imm = 0x20000
movq $0x30000, 0x2327b(%rip) # imm = 0x30000
pushq $0x2
popq %rdi
callq 0x3bc2
movq %rax, 0x23274(%rip)     # 0x27228
popq %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/dthread.c
// Function: dthread_init
void dthread_init(void) {
    threads = (queue *)malloc(sizeof(queue));
    td_cur = (dthread *)malloc(sizeof(dthread));
    init_threads(threads);

    //initialising the current thread with main thread details
    td_cur->tid = tid_count++;
    td_cur->status = RUNNING;
    td_cur->state = JOINABLE;
    td_cur->start_routine = NULL;
    td_cur->args = NULL;
    td_cur->retval = NULL;
    td_cur->signal = -1;
    sigsetjmp(td_cur->context, 1);


    //initialising signal for timer
    struct sigaction sa;
    sigset_t mask;
    sigemptyset(&mask);
    sigaddset(&mask,SIGVTALRM);
    //whenever sigvtalrm is raised, scheduler is called
    sa.sa_handler = &scheduler;
    sa.sa_flags = 0;
    sa.sa_mask = mask;
    sigaction (SIGVTALRM, &sa, NULL);
    atexit(dthread_cleanup);
    start_timer(&timer);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
pushq $0x18
popq %rdi
callq 0x10c0
movq %rax, %rbx
movq %rax, 0x2e7c(%rip)      # 0x40b8
movl $0x100, %edi            # imm = 0x100
callq 0x10c0
movq %rax, 0x2e73(%rip)      # 0x40c0
movq %rbx, %rdi
callq 0x1724
movq 0x2e6c(%rip), %rax      # 0x40c8
leaq 0x1(%rax), %rcx
movq %rcx, 0x2e61(%rip)      # 0x40c8
movq 0x2e52(%rip), %rdi      # 0x40c0
movq %rax, (%rdi)
movabsq $0x200000001, %rax      # imm = 0x200000001
movq %rax, 0x8(%rdi)
xorps %xmm0, %xmm0
andq $0x0, 0x28(%rdi)
movups %xmm0, 0x18(%rdi)
orl $-0x1, 0xf8(%rdi)
addq $0x30, %rdi
pushq $0x1
popq %rsi
callq 0x1100
leaq -0x128(%rbp), %rbx
movq %rbx, %rdi
callq 0x10b0
pushq $0x1a
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1110
leaq 0xe6(%rip), %rax        # 0x13a9
leaq -0xa0(%rbp), %rdi
movq %rax, -0x8(%rdi)
andl $0x0, 0x80(%rdi)
pushq $0x10
popq %rcx
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
xorl %eax, %eax
movl %eax, %edx
leaq -0xa8(%rbp), %rsi
movl %r14d, %edi
callq 0x1060
leaq 0x1d(%rip), %rdi        # 0x1315
callq 0x1c00
leaq 0x2dcc(%rip), %rdi      # 0x40d0
callq 0x1352
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/dthread.c
// Function: dthread_cleanup
void dthread_cleanup() {
    dthread *td;
    int count = threads->count;
    for(int i = 0; i < count; i++){
        td = dequeue(threads);
        free(td);
    }
    //final threads remove
    free(threads);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x2d96(%rip), %rax      # 0x40b8
movl 0x10(%rax), %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovgl %eax, %ebx
movq 0x2d85(%rip), %rdi      # 0x40b8
subl $0x1, %ebx
jb 0x1347
callq 0x177b
movq %rax, %rdi
callq 0x1040
jmp 0x132c
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/dthread.c
// Function: start_timer
void start_timer(struct itimerval *timer) {
    timer->it_value.tv_sec = 0;
    timer->it_value.tv_usec = ALARM;
    timer->it_interval.tv_sec = 0;
    timer->it_interval.tv_usec = ALARM;
    setitimer(ITIMER_VIRTUAL, timer, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, %rsi
andq $0x0, 0x10(%rdi)
movl $0x7d0, %eax            # imm = 0x7D0
movq %rax, 0x18(%rdi)
andq $0x0, (%rdi)
movq %rax, 0x8(%rdi)
movl $0x1, %edi
xorl %edx, %edx
popq %rbp
jmp 0x10d0
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/dthread.c
// Function: fn
void fn(void) {
    td_cur->retval = td_cur->start_routine(td_cur->args);
    td_cur->status = TERMINATED;
    raise(SIGVTALRM);
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x2d39(%rip), %rax      # 0x40c0
movq 0x20(%rax), %rdi
callq *0x18(%rax)
movq 0x2d2b(%rip), %rcx      # 0x40c0
movq %rax, 0x28(%rcx)
movl $0x3, 0xc(%rcx)
pushq $0x1a
popq %rdi
popq %rbp
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/dthread.c
// Function: scheduler
void scheduler(int sig) {
    stop_timer(&timer);
    dthread_t temp_tid = td_cur->tid;
    if(sigsetjmp(td_cur->context, 1) == 1) {
        return;
    }
    
    enqueue(threads, td_cur);
    if(td_cur->status == RUNNING) {
        td_cur->status = READY;
    }

    //getting the next thread details:
    //in loop, to check if the thread is already terminated or not
    dthread *temp;
    int threads_count = threads->count;
    for(int i = 0; i < threads_count; i++) {
        temp = dequeue(threads);
        if(temp->status == READY) {
            td_cur = temp;
            td_cur->status = RUNNING;
            break;
        }
        else if(temp->status == TERMINATED) {
            enqueue(threads, temp);
        }
    }
    if(td_cur->tid == temp_tid) {
        exit(0);
    }
    if(td_cur->signal != -1) {
        raise(td_cur->signal);
        td_cur->signal = -1;
    }

    start_timer(&timer);
    siglongjmp(td_cur->context, 1);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x2d19(%rip), %rdi      # 0x40d0
callq 0x14ac
movq 0x2cfd(%rip), %rdi      # 0x40c0
movq (%rdi), %rbx
addq $0x30, %rdi
pushq $0x1
popq %rsi
callq 0x1100
cmpl $0x1, %eax
jne 0x13dc
popq %rbx
popq %r14
popq %rbp
retq
movq 0x2cd5(%rip), %rdi      # 0x40b8
movq 0x2cd6(%rip), %rsi      # 0x40c0
callq 0x1734
movq 0x2cca(%rip), %rax      # 0x40c0
cmpl $0x2, 0xc(%rax)
jne 0x1403
movl $0x1, 0xc(%rax)
movq 0x2cae(%rip), %rax      # 0x40b8
movl 0x10(%rax), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovgl %eax, %ecx
movl %ecx, %r14d
subl $0x1, %r14d
jb 0x1449
movq 0x2c94(%rip), %rdi      # 0x40b8
callq 0x177b
movl 0xc(%rax), %ecx
movq %rax, %rsi
cmpl $0x3, %ecx
je 0x143b
cmpl $0x1, %ecx
jne 0x1417
jmp 0x1452
movq 0x2c76(%rip), %rdi      # 0x40b8
callq 0x1734
jmp 0x1417
movq 0x2c70(%rip), %rax      # 0x40c0
jmp 0x1463
movq %rsi, 0x2c67(%rip)      # 0x40c0
movl $0x2, 0xc(%rsi)
movq %rsi, %rax
cmpq %rbx, (%rax)
jne 0x146f
xorl %edi, %edi
callq 0x10f0
movl 0xf8(%rax), %edi
cmpl $-0x1, %edi
je 0x148d
callq 0x1030
movq 0x2c3a(%rip), %rax      # 0x40c0
orl $-0x1, 0xf8(%rax)
leaq 0x2c3c(%rip), %rdi      # 0x40d0
callq 0x1352
movq 0x2c20(%rip), %rdi      # 0x40c0
addq $0x30, %rdi
pushq $0x1
popq %rsi
callq 0x1090
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/dthread.c
// Function: dthread_create
int dthread_create(dthread_t *thread, void *(*start_routine) (void *), void *args) {

    struct dthread *t;
    t = (dthread *) malloc(sizeof(dthread));

    t->tid = tid_count++;
	t->args = args;
    t->status = READY;
	t->start_routine = start_routine;
    t->signal = -1;
    t->state = JOINABLE;

    // allocate the memory for stack with mmap

    t->stack = mmap(NULL,THREAD_STACK_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK,-1, 0);

    if(t->stack == MAP_FAILED) {
        start_timer(&timer);
        printf("Insufficient res");
        return EAGAIN;  //insufficient resources
    }

    //assigning the thread with the tid
    *thread = t->tid;

    //saving the context and changing the stack pointer, base pointer and program counter
    sigsetjmp(t->context, 1);
    t->context[0].__jmpbuf[6] = i64_ptr_mangle((long int) t->stack + THREAD_STACK_SIZE - sizeof(long int));
    t->context[0].__jmpbuf[1] = i64_ptr_mangle((long int) t->stack + THREAD_STACK_SIZE - sizeof(long int));
	t->context[0].__jmpbuf[7] = i64_ptr_mangle((long int) fn);
    // printf("%p", t->context);

    enqueue(threads, t);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movl $0x100, %edi            # imm = 0x100
callq 0x10c0
movq %rax, %r14
movq 0x2bd3(%rip), %r13      # 0x40c8
movq %r13, (%rax)
movq %r15, 0x20(%rax)
movq %r12, 0x18(%rax)
orl $-0x1, 0xf8(%rax)
leaq 0x1(%r13), %rax
movq %rax, 0x2bb6(%rip)      # 0x40c8
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%r14)
xorl %r12d, %r12d
movl %r12d, %edi
pushq $0x3
popq %rdx
pushq $-0x1
popq %r8
movl $0x10000, %esi          # imm = 0x10000
movl $0x20022, %ecx          # imm = 0x20022
movq %rdi, %r9
callq 0x1070
movq %rax, 0x10(%r14)
cmpq $-0x1, %rax
je 0x15b7
movq %r14, %r15
movq %r13, (%rbx)
addq $0x30, %r14
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x1100
movl $0xfff8, %eax           # imm = 0xFFF8
addq 0x10(%r15), %rax
movq %rax, %rcx
movq %rcx, %rax
xorq %fs:0x30, %rax
rolq $0x11, %rax
movq %rax, %rcx
movq %rcx, 0x60(%r15)
movq %rcx, 0x38(%r15)
leaq -0x210(%rip), %rcx      # 0x137c
movq %rcx, %rax
xorq %fs:0x30, %rax
rolq $0x11, %rax
movq %rax, %rcx
movq %rcx, 0x68(%r15)
movq 0x2b0e(%rip), %rdi      # 0x40b8
movq %r15, %rsi
callq 0x1734
movl %r12d, %eax
jmp 0x15d4
leaq 0x2b12(%rip), %rdi      # 0x40d0
callq 0x1352
leaq 0xa3a(%rip), %rdi       # 0x2004
xorl %eax, %eax
callq 0x1080
pushq $0xb
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/dthread.c
// Function: dthread_join
int dthread_join(dthread_t thread, void **retval) {

    //find the node having that particular thread id
    
    dthread *temp;
    if(thread == td_cur->tid) {
        return EDEADLK;
    }
    temp = get_node_by_tid(threads,thread);
    if(temp == NULL) {
        return ESRCH;
    }

    //check if the thread is already joined or not
    if(temp->state == JOINED) {
        return EINVAL;
    }
    temp->state = JOINED;

    //othewise loop until the process is terminated
    while(1) {
        if (temp->status == TERMINATED) {
            break;
        }
    }
    //updating the retval  with the routine return value
    if(retval) {
        *retval = temp->retval;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x2ad0(%rip), %rax      # 0x40c0
cmpq %rdi, (%rax)
jne 0x15f9
pushq $0x23
jmp 0x161f
movq %rsi, %rbx
movq %rdi, %rsi
movq 0x2ab2(%rip), %rdi      # 0x40b8
callq 0x1811
testq %rax, %rax
je 0x161d
movq %rax, %rcx
cmpl $0x2, 0x8(%rax)
jne 0x1627
pushq $0x16
jmp 0x161f
pushq $0x3
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x2, 0x8(%rcx)
cmpl $0x3, 0xc(%rcx)
jne 0x1644
xorl %eax, %eax
testq %rbx, %rbx
je 0x1620
movq 0x28(%rcx), %rcx
movq %rcx, (%rbx)
jmp 0x1620
jmp 0x1644
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/dthread.c
// Function: dthread_exit
void dthread_exit(void *retval) {
    // changing the retval for the current running thread.
    td_cur->retval = retval;
    td_cur->status = TERMINATED;
    
    //raising the signal to call the scheduler 
    raise(SIGVTALRM);
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x2a6f(%rip), %rax      # 0x40c0
movq %rdi, 0x28(%rax)
movl $0x3, 0xc(%rax)
movl $0x1a, %edi
popq %rbp
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/dthread.c
// Function: dthread_kill
int dthread_kill(dthread_t thread, int sig) {
    //no signal
    if(sig == 0) {
        return 0;
    }
    //invalid signal
    if(sig < 0 || sig > 64) {
        return EINVAL;
    }

    // check if current thread id is same as the thread passed

    int status = -1;
    if(thread == td_cur->tid) {
        status = raise(sig);
    }

    //otherwise store it into the thread structure to raise it later
    else {
        dthread *temp = get_node_by_tid(threads, thread);
        if(temp != NULL) {
            temp->signal = sig;
            status = 0;
        }
        else {
            status = ESRCH;
        }
    }
   
    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
xorl %ebx, %ebx
testl %esi, %esi
je 0x16b5
cmpl $0x40, %r14d
jbe 0x1682
pushq $0x16
popq %rbx
jmp 0x16b5
movq %rdi, %rsi
movq 0x2a34(%rip), %rax      # 0x40c0
cmpq %rdi, (%rax)
jne 0x169d
movl %r14d, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x1030
movq 0x2a14(%rip), %rdi      # 0x40b8
callq 0x1811
testq %rax, %rax
je 0x16bc
movl %r14d, 0xf8(%rax)
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x3
jmp 0x167f
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/queue.c
// Function: enqueue
void enqueue(queue *t, dthread *td) {
    node *ptr = (node *)malloc(sizeof(node));
    //assigning the new node details
    ptr->td = td;
    ptr->next = NULL;
    //checking if the queue is empty, if empty head and tail points to ptr
    if(t->count == 0) {
        t->head = t->tail = ptr;
    }

    //otherwise append the node to last changing the tail pointer to ptr
    else {
        t->tail->next = ptr;
        t->tail = ptr;
    }
    //increment the count
    t->count = t->count+ 1;
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x10c0
movq %r14, (%rax)
andq $0x0, 0x8(%rax)
movl 0x10(%rbx), %ecx
leaq 0x8(%rbx), %rdx
testl %ecx, %ecx
je 0x1765
movq (%rdx), %rsi
addq $0x8, %rsi
jmp 0x176b
movq %rdx, %rsi
movq %rbx, %rdx
movq %rax, (%rsi)
movq %rax, (%rdx)
incl %ecx
movl %ecx, 0x10(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/queue.c
// Function: dequeue
dthread* dequeue(queue *t) {
    //check if the queue is empty
     if(t->count == 0 ) {
        return NULL;
     }
    dthread *td = t->head->td;
    t->head = t->head->next;
    t->count = t->count - 1;
    //check if the new head is null or not , if yes then change the tail
    if(t->head == NULL) {
        t->tail = NULL;
    }
    return(td);
}

// Assembly:
movl 0x10(%rdi), %ecx
testl %ecx, %ecx
je 0x17a4
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rdx
movq (%rdx), %rax
movq 0x8(%rdx), %rdx
movq %rdx, (%rdi)
decl %ecx
movl %ecx, 0x10(%rdi)
testq %rdx, %rdx
jne 0x17a2
andq $0x0, 0x8(%rdi)
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/queue.c
// Function: show
void show(queue *t) {
    node *ptr;
    if(t->head == NULL) {
        printf("\nEmpty");
        return;
    }
    ptr = t->head;
    while(ptr != NULL) {
        printf("\nTID: %ld", ptr->td->tid);
        ptr = ptr->next;
    }
    printf("\nTOTAL: %d",t->count);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %r15
testq %r15, %r15
je 0x17f9
movq %rdi, %rbx
leaq 0x859(%rip), %r14       # 0x201c
testq %r15, %r15
je 0x17de
movq (%r15), %rax
movq (%rax), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1080
movq 0x8(%r15), %r15
jmp 0x17c3
movl 0x10(%rbx), %esi
leaq 0x83e(%rip), %rdi       # 0x2026
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1080
leaq 0x815(%rip), %rdi       # 0x2015
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1080
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/queue.c
// Function: get_node_by_tid
dthread* get_node_by_tid(queue *t, dthread_t tid) {
    node *temp;
    dthread *td;
    if(t->head == NULL) {
        return NULL;
    }
    temp = t->head;
    while(temp != NULL) {
        if(tid == temp->td->tid) {
            return temp->td;
        }
        else {
            temp = temp->next;
        }
    }
    return NULL;
}

// Assembly:
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x1830
pushq %rbp
movq %rsp, %rbp
testq %rcx, %rcx
je 0x1833
movq (%rcx), %rax
cmpq %rsi, (%rax)
je 0x1835
movq 0x8(%rcx), %rcx
jmp 0x181d
xorl %eax, %eax
retq
xorl %eax, %eax
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/test/methods.c
// Function: deadlock
void* deadlock(void *args) {
    
    int d  = dthread_join(t1[2], NULL);

    check = testing(d,EDEADLK);
    if(check == 0) {
        printf(RED "**FAILED**: Deadlock Join test\n" NONE);
    }
    else {
        printf(GREEN "**PASSED**: Deadlock join test\n" NONE);
    }
    return (void *)(intptr_t)(d);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x2892(%rip), %rdi      # 0x4100
xorl %esi, %esi
callq 0x15e3
movl %eax, %ebx
cmpl $0x23, %eax
leaq 0x7dd(%rip), %rax       # 0x205e
leaq 0x7a9(%rip), %rdi       # 0x2031
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x1080
movslq %ebx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/many-one/test/methods.c
// Function: exit_control
void* exit_control(void *args) {
    counter++;
    dthread_exit(NULL);
    counter++;
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
incl 0x2889(%rip)            # 0x4140
xorl %edi, %edi
callq 0x1646
incl 0x287c(%rip)            # 0x4140
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_1/exercise_1_23/c_remove_comments.c
// Function: main
int main(void)
{
  /**
   * This is multiline
   * block
   * comment.
  */

  char str[MAXSTR];
  char no_com_str[MAXSTR];

  get_str(str, MAXSTR);

  remove_comments(str, no_com_str);

  printf("%s", no_com_str);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x4e28, %rsp           # imm = 0x4E28
leaq 0x2710(%rsp), %rbx
movq %rbx, %rdi
movl $0x2710, %esi           # imm = 0x2710
callq 0x1197
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11de
leaq 0xe84(%rip), %rdi       # 0x2004
movq %r14, %rsi
xorl %eax, %eax
callq 0x1030
xorl %eax, %eax
addq $0x4e28, %rsp           # imm = 0x4E28
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_1/exercise_1_23/c_remove_comments.c
// Function: get_str
int get_str(char str[], int limit)
{
  int c, i = 0;

  while (i < limit - 1 && (c = getchar()) != EOF)
  {
    str[i++] = c;
  }
  str[i] = '\0';

  return i;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x2, %esi
pushq $0x1
popq %r14
cmovgel %esi, %r14d
decl %r14d
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x11c8
callq 0x1040
cmpl $-0x1, %eax
je 0x11cd
movb %al, (%rbx,%r15)
incq %r15
jmp 0x11b0
movq %r14, %r15
jmp 0x11d0
movl %r15d, %r14d
movb $0x0, (%rbx,%r15)
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq