LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: cgen_get_field_ptr(Local*)
llvalue_t cgen_get_field_ptr(Local *field) {
    assert(field->kind == (int)LOCAL_KIND::FIELD);
    llvalue_t reg0 = register_llv(0, {});
    llvalue_t ptr = reg0;
    int account_for_vptr = field->offset + 8;
    ptr = llvm_getelementptr_i8(reg0, account_for_vptr);
    return llvm_bitcast_from_i8p(field->type, ptr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
cmpb $0x2, 0x38(%rsi)
jne 0x4ebd
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rsi), %r13
movq 0x14bf0(%rip), %r15     # 0x19a28
leaq 0x1(%r15), %rax
movq %rax, 0x14be5(%rip)     # 0x19a28
movl $0x4, %ebp
leaq 0xc28b(%rip), %r12      # 0x110da
movq %r12, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x4e4f
addl $0x8, %r13d
movslq %r13d, %rcx
leaq 0xc504(%rip), %rdi      # 0x1136f
movq %r15, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x479d
movq 0x8(%r14), %rsi
movl $0x2, 0x28(%rsp)
movl $0x0, 0x38(%rsp)
movq %r15, 0x40(%rsp)
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x4f59
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc2ad(%rip), %rdi      # 0x11171
leaq 0xc0ba(%rip), %rsi      # 0x10f85
leaq 0xc2c5(%rip), %rcx      # 0x11197
movl $0xee, %edx
callq 0x20b0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_getelementptr_i8(llvalue_t, unsigned long)
llvalue_t llvm_getelementptr_i8(llvalue_t ptr, size_t offset) {
    llvalue_t v;
    v.reg = gen_reg();
    v.kind = LLVALUE::REG;
    print_codegen_indentation();
    emit("%%%ld = getelementptr inbounds i8, i8* %%%ld, i32 %zd\n", v.reg, ptr.reg, offset);
    return v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x40(%rsp), %r13
xorl %eax, %eax
movl %eax, (%rdi)
movl %eax, 0x10(%rdi)
movq 0x14b28(%rip), %r15     # 0x19a28
leaq 0x1(%r15), %rax
movq %rax, 0x14b1d(%rip)     # 0x19a28
movq %r15, 0x18(%rdi)
movl $0x2, (%rdi)
movl $0x4, %ebp
leaq 0xc1b9(%rip), %r12      # 0x110da
movq %r12, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x4f21
movq 0x18(%r13), %rdx
leaq 0xc435(%rip), %rdi      # 0x1136f
movq %r15, %rsi
movq %r14, %rcx
xorl %eax, %eax
callq 0x479d
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_bitcast_from_i8p(Type*, llvalue_t)
llvalue_t llvm_bitcast_from_i8p(Type *type, llvalue_t ptr) {
    llvalue_t v;
    assert(ptr.kind == LLVALUE::REG);
    v.reg = gen_reg();
    v.kind = LLVALUE::REG;
    print_codegen_indentation();
    // Assume that `ptr` has type i8*
    switch (type->kind) {
    case TY::BOOL:
    {
        emit("%%%ld = bitcast i8* %%%ld to i1*\n", v.reg, ptr.reg);
    } break;
    case TY::INT:
    {
        emit("%%%ld = bitcast i8* %%%ld to i32*\n", v.reg, ptr.reg);
    } break;
    case TY::ARR:
    {
        emit("%%%ld = bitcast i8* %%%ld to i32**\n", v.reg, ptr.reg);
    } break;
    case TY::ID:
    {
        emit("%%%ld = bitcast i8* %%%ld to i8**\n", v.reg, ptr.reg);
    } break;
    default: assert(0);
    }
    return v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %eax, %eax
movl %eax, (%rdi)
movl %eax, 0x10(%rdi)
cmpl $0x2, 0x40(%rsp)
jne 0x4fee
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x40(%rsp), %r13
movq 0x14aa4(%rip), %r14     # 0x19a28
leaq 0x1(%r14), %rax
movq %rax, 0x14a99(%rip)     # 0x19a28
movq %r14, 0x18(%rdi)
movl $0x2, (%rdi)
movl $0x4, %ebp
leaq 0xc135(%rip), %r12      # 0x110da
movq %r12, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x4fa5
movl 0x4(%r15), %eax
decl %eax
cmpl $0x4, %eax
jae 0x500d
movl %eax, %eax
leaq 0xbdb9(%rip), %rcx      # 0x10d80
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
movq 0x18(%r13), %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x479d
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc1c8(%rip), %rdi      # 0x111bd
leaq 0xbf89(%rip), %rsi      # 0x10f85
leaq 0xc1d3(%rip), %rcx      # 0x111d6
movl $0xf8, %edx
callq 0x20b0
leaq 0xd69e(%rip), %rdi      # 0x126b2
leaq 0xbf6a(%rip), %rsi      # 0x10f85
leaq 0xc1b4(%rip), %rcx      # 0x111d6
movl $0x10e, %edx            # imm = 0x10E
callq 0x20b0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_bitcast_i8p_to_i8ppp(llvalue_t)
llvalue_t llvm_bitcast_i8p_to_i8ppp(llvalue_t i8p) {
  llvalue_t i8ppp = register_llv(gen_reg(), {});
  print_codegen_indentation();
  emit("%%%ld = bitcast i8* %%%ld to i8***\n", i8ppp.reg, i8p.reg);
  return i8ppp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x30(%rsp), %r12
movq 0x149e5(%rip), %r14     # 0x19a28
leaq 0x1(%r14), %rax
movq %rax, 0x149da(%rip)     # 0x19a28
movl $0x0, 0x10(%rdi)
movl $0x2, (%rdi)
movq %r14, 0x18(%rdi)
movq $0x0, 0x8(%rdi)
movl $0x4, %ebp
leaq 0xc067(%rip), %r15      # 0x110da
movq %r15, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x5073
movq 0x18(%r12), %rdx
leaq 0xc208(%rip), %rdi      # 0x11295
movq %r14, %rsi
xorl %eax, %eax
callq 0x479d
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: cgen_store_vptr(llvalue_t, IdType*)
void cgen_store_vptr(llvalue_t i8ppp, IdType *type) {
  llvalue_t i8pp_to_vtable = register_llv(gen_reg(), {});
  print_codegen_indentation();
  emit("%%%ld = bitcast [%ld x i8*]* @.%s to i8**\n", i8pp_to_vtable.reg,
       type->vmethods_len, type->id);
  print_codegen_indentation();
  emit("store i8** %%%ld, i8*** %%%ld\n", i8pp_to_vtable.reg, i8ppp.reg);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
leaq 0x30(%rsp), %r12
movq 0x1496e(%rip), %rbx     # 0x19a28
leaq 0x1(%rbx), %rax
movq %rax, 0x14963(%rip)     # 0x19a28
movl $0x4, %ebp
leaq 0xc009(%rip), %r15      # 0x110da
movq %r15, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x50d1
movq 0x8(%r14), %rcx
movq 0x70(%r14), %rdx
leaq 0xc1cb(%rip), %rdi      # 0x112b9
movq %rbx, %rsi
xorl %eax, %eax
callq 0x479d
movl $0x4, %ebp
leaq 0xbfd6(%rip), %r14      # 0x110da
movq %r14, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x5104
movq 0x18(%r12), %rdx
leaq 0xc1c6(%rip), %rdi      # 0x112e4
movq %rbx, %rsi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x479d
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_getelementptr_i32(llvalue_t, llvalue_t)
llvalue_t llvm_getelementptr_i32(llvalue_t ptr, llvalue_t index) {
    assert(ptr.kind == LLVALUE::REG);
    llvalue_t v;
    v.reg = gen_reg();
    v.kind = LLVALUE::REG;
    print_codegen_indentation();
    emit("%%%ld = getelementptr inbounds i32, i32* %%%ld, i32 ", v.reg, ptr.reg);
    cgen_print_llvalue(index);
    emit("\n");
    return v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x2, 0x40(%rsp)
jne 0x51ef
movq %rdi, %rbx
leaq 0x60(%rsp), %r12
leaq 0x40(%rsp), %r13
xorl %eax, %eax
movl %eax, (%rdi)
movl %eax, 0x10(%rdi)
movq 0x148c7(%rip), %r14     # 0x19a28
leaq 0x1(%r14), %rax
movq %rax, 0x148bc(%rip)     # 0x19a28
movq %r14, 0x18(%rdi)
movl $0x2, (%rdi)
movl $0x4, %ebp
leaq 0xbf58(%rip), %r15      # 0x110da
movq %r15, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x5182
movq 0x18(%r13), %rdx
leaq 0xc19f(%rip), %rdi      # 0x1133a
movq %r14, %rsi
xorl %eax, %eax
callq 0x479d
movq 0x18(%r12), %rsi
cmpl $0x1, (%r12)
jne 0x51c1
leaq 0xc8a4(%rip), %rdi      # 0x11a5c
xorl %eax, %eax
callq 0x479d
jmp 0x51cf
leaq 0xc530(%rip), %rdi      # 0x116f8
xorl %eax, %eax
callq 0x479d
leaq 0xc342(%rip), %rdi      # 0x11518
xorl %eax, %eax
callq 0x479d
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbfc7(%rip), %rdi      # 0x111bd
leaq 0xbd88(%rip), %rsi      # 0x10f85
leaq 0xc0ff(%rip), %rcx      # 0x11303
movl $0x125, %edx            # imm = 0x125
callq 0x20b0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_load(Type*, llvalue_t)
llvalue_t llvm_load(Type *type, llvalue_t ptr) {
    assert(ptr.kind == LLVALUE::REG);
    llvalue_t v;
    v.reg = gen_reg();
    v.kind = LLVALUE::REG;
    print_codegen_indentation();
    switch (type->kind) {
    case TY::BOOL:
    {
        emit("%%%ld = load i1, i1* %%%ld\n", v.reg, ptr.reg);
    } break;
    case TY::INT:
    {
        emit("%%%ld = load i32, i32* %%%ld, align 4\n", v.reg, ptr.reg);
    } break;
    case TY::ARR:
    {
        emit("%%%ld = load i32*, i32** %%%ld, align 8\n", v.reg, ptr.reg);
    } break;
    case TY::ID:
    {
        emit("%%%ld = load i8*, i8** %%%ld\n", v.reg, ptr.reg);
    } break;
    default: assert(0);
    }
    return v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x2, 0x40(%rsp)
jne 0x52a7
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x40(%rsp), %r13
xorl %eax, %eax
movl %eax, (%rdi)
movl %eax, 0x10(%rdi)
movq 0x147eb(%rip), %r14     # 0x19a28
leaq 0x1(%r14), %rax
movq %rax, 0x147e0(%rip)     # 0x19a28
movq %r14, 0x18(%rdi)
movl $0x2, (%rdi)
movl $0x4, %ebp
leaq 0xbe7c(%rip), %r12      # 0x110da
movq %r12, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x525e
movl 0x4(%r15), %eax
decl %eax
cmpl $0x4, %eax
jae 0x52c6
movl %eax, %eax
leaq 0xbb10(%rip), %rcx      # 0x10d90
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
movq 0x18(%r13), %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x479d
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbf0f(%rip), %rdi      # 0x111bd
leaq 0xbcd0(%rip), %rsi      # 0x10f85
leaq 0xc0ea(%rip), %rcx      # 0x113a6
movl $0x13a, %edx            # imm = 0x13A
callq 0x20b0
leaq 0xd3e5(%rip), %rdi      # 0x126b2
leaq 0xbcb1(%rip), %rsi      # 0x10f85
leaq 0xc0cb(%rip), %rcx      # 0x113a6
movl $0x150, %edx            # imm = 0x150
callq 0x20b0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: not_llvalue(llvalue_t)
llvalue_t not_llvalue(llvalue_t v) {
    assert(v.kind == LLVALUE::REG);
    long reg = gen_reg();
    print_codegen_indentation();
    emit("%%%ld = icmp eq i1 %%%ld, 0\n", reg, v.reg);
    v.reg = reg;
    return v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpl $0x2, 0x30(%rsp)
jne 0x5369
movq %rdi, %rbx
leaq 0x30(%rsp), %r12
movq 0x14725(%rip), %r14     # 0x19a28
leaq 0x1(%r14), %rax
movq %rax, 0x1471a(%rip)     # 0x19a28
movl $0x4, %ebp
leaq 0xbdc0(%rip), %r15      # 0x110da
movq %r15, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x531a
movq 0x18(%r12), %rdx
leaq 0xc13d(%rip), %rdi      # 0x11471
movq %r14, %rsi
xorl %eax, %eax
callq 0x479d
movq %r14, 0x18(%r12)
movups (%r12), %xmm0
movups %xmm0, (%rbx)
movq 0x10(%r12), %rax
movq %rax, 0x10(%rbx)
movq 0x18(%r12), %rax
movq %rax, 0x18(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc0c9(%rip), %rdi      # 0x11439
leaq 0xbc0e(%rip), %rsi      # 0x10f85
leaq 0xc0d2(%rip), %rcx      # 0x11450
movl $0x156, %edx            # imm = 0x156
callq 0x20b0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_calloc(llvalue_t)
llvalue_t llvm_calloc(llvalue_t sz) {
    llvalue_t v = register_llv(gen_reg(), {});
    print_codegen_indentation();
    if (sz.kind == LLVALUE::CONST) {
        emit("%%%ld = call noalias i8* @calloc(i32 1, i32 %d)\n", v.reg, sz.val);
    } else {
        emit("%%%ld = call noalias i8* @calloc(i32 1, i32 %%%ld)\n", v.reg, sz.reg);
    }
    return v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x30(%rsp), %r12
movq 0x14689(%rip), %r14     # 0x19a28
leaq 0x1(%r14), %rax
movq %rax, 0x1467e(%rip)     # 0x19a28
movl $0x0, 0x10(%rdi)
movl $0x2, (%rdi)
movq %r14, 0x18(%rdi)
movq $0x0, 0x8(%rdi)
movl $0x4, %ebp
leaq 0xbd0b(%rip), %r15      # 0x110da
movq %r15, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x53cf
cmpl $0x1, (%r12)
jne 0x53fc
movl 0x18(%r12), %edx
leaq 0xc09e(%rip), %rdi      # 0x1148e
movq %r14, %rsi
xorl %eax, %eax
callq 0x479d
jmp 0x5412
movq 0x18(%r12), %rdx
leaq 0xc0b7(%rip), %rdi      # 0x114bf
movq %r14, %rsi
xorl %eax, %eax
callq 0x479d
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_branch_cond(llvalue_t, llvm_label_t, llvm_label_t)
void llvm_branch_cond(llvalue_t cond, llvm_label_t l1, llvm_label_t l2) {
    print_codegen_indentation();
    emit("br i1 ");
    cgen_print_llvalue(cond);
    emit(", label %%%s, label %%%s\n\n", l1.lbl, l2.lbl);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl $0x4, %ebp
leaq 0x30(%rsp), %r12
leaq 0xbc7f(%rip), %r15      # 0x110da
movq %r15, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x545b
leaq 0xc088(%rip), %rdi      # 0x114f8
xorl %eax, %eax
callq 0x479d
movq 0x18(%r12), %rsi
cmpl $0x1, (%r12)
jne 0x5493
leaq 0xc5d2(%rip), %rdi      # 0x11a5c
xorl %eax, %eax
callq 0x479d
jmp 0x54a1
leaq 0xc25e(%rip), %rdi      # 0x116f8
xorl %eax, %eax
callq 0x479d
leaq 0xc057(%rip), %rdi      # 0x114ff
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x479d
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_phi_node(Type*, llvalue_t, llvalue_t, llvm_label_t, llvm_label_t, long)
llvalue_t llvm_phi_node(Type *type, llvalue_t val1,
                    llvalue_t val2, llvm_label_t lbl1,
                    llvm_label_t lbl2, long reg) {
    llvalue_t phi_value;
    phi_value.kind = LLVALUE::REG;
    if (reg == -1) {
        phi_value.reg = gen_reg();
    } else {
        phi_value.reg = reg;
    }
    print_codegen_indentation();
    emit("%%%ld = phi ", phi_value.reg);
    cgen_print_lltype(type);
    emit(" [ ");
    cgen_print_llvalue(val1);
    emit(", %%%s ], [ ", lbl1.lbl);
    cgen_print_llvalue(val2);
    emit(", %%%s ]\n", lbl2.lbl);
    return phi_value;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, (%rsp)
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movl $0x0, 0x10(%rdi)
movl $0x2, (%rdi)
cmpq $-0x1, %r8
jne 0x5530
movq 0x14503(%rip), %r8      # 0x19a28
leaq 0x1(%r8), %rax
movq %rax, 0x144f8(%rip)     # 0x19a28
leaq 0x40(%rsp), %r14
movq %r8, 0x18(%rbx)
movl $0x4, %ebp
leaq 0xbb95(%rip), %r13      # 0x110da
movq %r13, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x5545
movq 0x18(%rbx), %rsi
leaq 0xbfcc(%rip), %rdi      # 0x1152a
xorl %eax, %eax
callq 0x479d
movq %r12, %rdi
callq 0x4b55
leaq 0xbfcc(%rip), %rdi      # 0x11540
xorl %eax, %eax
callq 0x479d
movq 0x18(%r14), %rsi
cmpl $0x1, (%r14)
jne 0x5595
leaq 0xc4d0(%rip), %rdi      # 0x11a5c
xorl %eax, %eax
callq 0x479d
jmp 0x55a3
leaq 0xc15c(%rip), %rdi      # 0x116f8
xorl %eax, %eax
callq 0x479d
leaq 0xbf8d(%rip), %rdi      # 0x11537
movq %r15, %rsi
xorl %eax, %eax
callq 0x479d
leaq 0x60(%rsp), %rax
movq 0x18(%rax), %rsi
cmpl $0x1, (%rax)
jne 0x55d2
leaq 0xc493(%rip), %rdi      # 0x11a5c
xorl %eax, %eax
callq 0x479d
jmp 0x55e0
leaq 0xc11f(%rip), %rdi      # 0x116f8
xorl %eax, %eax
callq 0x479d
leaq 0xbf5d(%rip), %rdi      # 0x11544
movq (%rsp), %rsi
xorl %eax, %eax
callq 0x479d
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_alloca(Type*)
llvalue_t llvm_alloca(Type *type) {
    llvalue_t v;
    v.reg = gen_reg();
    v.kind = LLVALUE::REG;
    print_codegen_indentation();
    switch (type->kind) {
    case TY::BOOL:
    {
        emit("%%%ld = alloca i1\n", v.reg);
    } break;
    case TY::INT:
    {
        emit("%%%ld = alloca i32, align 4\n", v.reg);
    } break;
    case TY::ARR:
    {
        emit("%%%ld = alloca i32*, align 8\n", v.reg);
    } break;
    case TY::ID:
    {
        IdType *idtype = (IdType*) type;
        assert(idtype->is_IdType());
        emit("%%%ld = alloca %%class.%s*, align 8\n", v.reg, idtype->id);
    } break;
    // We don't actually want to assert here because we might have an undefined
    // type. The error has been issued elsewhere.
    default: break;
    }
    return v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
xorl %eax, %eax
movl %eax, (%rdi)
movl %eax, 0x10(%rdi)
movq 0x14218(%rip), %r14     # 0x19a28
leaq 0x1(%r14), %rax
movq %rax, 0x1420d(%rip)     # 0x19a28
movq %r14, 0x18(%rdi)
movl $0x2, (%rdi)
movl $0x4, %ebp
leaq 0xb8a9(%rip), %r12      # 0x110da
movq %r12, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x5831
movl 0x4(%r15), %eax
leal -0x1(%rax), %ecx
cmpl $0x3, %ecx
ja 0x589f
leaq 0xb50e(%rip), %rdx      # 0x10d60
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0xbdac(%rip), %rdi      # 0x1160e
jmp 0x5895
leaq 0xbd90(%rip), %rdi      # 0x115fb
jmp 0x5895
testq %r15, %r15
je 0x58ab
cmpl $0x4, %eax
jne 0x58ab
movq 0x8(%r15), %rdx
leaq 0xbdf9(%rip), %rdi      # 0x1167b
movq %r14, %rsi
xorl %eax, %eax
callq 0x479d
jmp 0x589f
leaq 0xbd96(%rip), %rdi      # 0x1162b
movq %r14, %rsi
xorl %eax, %eax
callq 0x479d
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbd97(%rip), %rdi      # 0x11649
leaq 0xb6cc(%rip), %rsi      # 0x10f85
leaq 0xbd9d(%rip), %rcx      # 0x1165d
movl $0x1c6, %edx            # imm = 0x1C6
callq 0x20b0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_store(Type*, llvalue_t, llvalue_t)
void llvm_store(Type *type, llvalue_t value, llvalue_t ptr) {
    assert(ptr.kind == LLVALUE::REG);
    print_codegen_indentation();
    emit("store ");
    cgen_print_lltype(type);
    emit(" ");
    cgen_print_llvalue(value);
    emit(", ");
    cgen_print_lltype(type);
    emit("* ");
    cgen_print_llvalue(ptr);
    emit("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpl $0x2, 0x50(%rsp)
jne 0x599e
movq %rdi, %rbx
leaq 0x50(%rsp), %r15
leaq 0x30(%rsp), %r12
movl $0x4, %ebp
leaq 0xb7e4(%rip), %r14      # 0x110da
movq %r14, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x58f6
leaq 0xbdc3(%rip), %rdi      # 0x116ce
xorl %eax, %eax
callq 0x479d
movq %rbx, %rdi
callq 0x4b55
leaq 0xb7b9(%rip), %rdi      # 0x110da
xorl %eax, %eax
callq 0x479d
movq 0x18(%r12), %rsi
cmpl $0x1, (%r12)
jne 0x5944
leaq 0xc121(%rip), %rdi      # 0x11a5c
xorl %eax, %eax
callq 0x479d
jmp 0x5952
leaq 0xbdad(%rip), %rdi      # 0x116f8
xorl %eax, %eax
callq 0x479d
leaq 0xd466(%rip), %rdi      # 0x12dbf
xorl %eax, %eax
callq 0x479d
movq %rbx, %rdi
callq 0x4b55
leaq 0xb76a(%rip), %rdi      # 0x110d9
xorl %eax, %eax
callq 0x479d
movq 0x18(%r15), %rsi
leaq 0xbd77(%rip), %rdi      # 0x116f8
xorl %eax, %eax
callq 0x479d
leaq 0xbb89(%rip), %rdi      # 0x11518
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x479d
leaq 0xb818(%rip), %rdi      # 0x111bd
leaq 0xb5d9(%rip), %rsi      # 0x10f85
leaq 0xbced(%rip), %rcx      # 0x116a0
movl $0x1d1, %edx            # imm = 0x1D1
callq 0x20b0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: cgen_cast_value(llvalue_t, Type*, Type*)
llvalue_t cgen_cast_value(llvalue_t value, Type *from_ty, Type *to_ty) {
    long reg = gen_reg();
    print_codegen_indentation();
    emit("%%%ld = bitcast ", reg);
    cgen_print_lltype(from_ty);
    emit(" ");
    cgen_print_llvalue(value);
    emit(" to ");
    cgen_print_lltype(to_ty);
    emit("\n");
    value.kind = LLVALUE::REG;
    value.reg = reg;
    return value;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, (%rsp)
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x40(%rsp), %rbp
movq 0x13ea5(%rip), %r14     # 0x19a28
leaq 0x1(%r14), %rax
movq %rax, 0x13e9a(%rip)     # 0x19a28
movl $0x4, %r15d
leaq 0xb53f(%rip), %r13      # 0x110da
movq %r13, %rdi
xorl %eax, %eax
callq 0x479d
decl %r15d
jne 0x5b9b
leaq 0xbb67(%rip), %rdi      # 0x11718
movq %r14, %rsi
xorl %eax, %eax
callq 0x479d
movq %r12, %rdi
callq 0x4b55
leaq 0xb510(%rip), %rdi      # 0x110da
xorl %eax, %eax
callq 0x479d
movq 0x18(%rbp), %rsi
cmpl $0x1, (%rbp)
jne 0x5beb
leaq 0xbe7a(%rip), %rdi      # 0x11a5c
xorl %eax, %eax
callq 0x479d
jmp 0x5bf9
leaq 0xbb06(%rip), %rdi      # 0x116f8
xorl %eax, %eax
callq 0x479d
leaq 0xb56c(%rip), %rdi      # 0x1116c
xorl %eax, %eax
callq 0x479d
movq (%rsp), %rdi
callq 0x4b55
leaq 0xb901(%rip), %rdi      # 0x11518
xorl %eax, %eax
callq 0x479d
movl $0x2, (%rbp)
movq %r14, 0x18(%rbp)
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rbx)
movq 0x18(%rbp), %rax
movq %rax, 0x18(%rbx)
movl (%rbp), %eax
movl %eax, (%rbx)
movq 0x4(%rbp), %rax
movq %rax, 0x4(%rbx)
movl 0xc(%rbp), %eax
movl %eax, 0xc(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/llvm.cpp
// Function: llvm_ret(Type*, llvalue_t)
void llvm_ret(Type *ty, llvalue_t val) {
    print_codegen_indentation();
    emit("ret ");
    cgen_print_lltype(ty);
    emit(" ");
    cgen_print_llvalue(val);
    emit("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x4, %ebp
leaq 0x30(%rsp), %r15
leaq 0xb461(%rip), %r14      # 0x110da
movq %r14, %rdi
xorl %eax, %eax
callq 0x479d
decl %ebp
jne 0x5c79
leaq 0xba9b(%rip), %rdi      # 0x11729
xorl %eax, %eax
callq 0x479d
movq %rbx, %rdi
callq 0x4b55
leaq 0xb436(%rip), %rdi      # 0x110da
xorl %eax, %eax
callq 0x479d
movq 0x18(%r15), %rsi
cmpl $0x1, (%r15)
jne 0x5cc5
leaq 0xbda0(%rip), %rdi      # 0x11a5c
xorl %eax, %eax
callq 0x479d
jmp 0x5cd3
leaq 0xba2c(%rip), %rdi      # 0x116f8
xorl %eax, %eax
callq 0x479d
leaq 0xb83e(%rip), %rdi      # 0x11518
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x479d
nop
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/main.cpp
// Function: parse_and_return_goal()
Goal parse_and_return_goal() {
    std::ifstream input_file(filename);
    if (!input_file.good()) {
        assert(0);
    }
    std::stringstream sstr;
    sstr << input_file.rdbuf();
    std::string file_contents_str = sstr.str();
    input_file.close();

    const char *file_contents = file_contents_str.c_str();

    parse_init(file_contents, filename);
    Goal goal = parse_goal();
    return goal;
    // Here `file_contents_str` memory gets deallocated because
    // of destructor.
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x3b8, %rsp            # imm = 0x3B8
movq %rdi, %rbx
movq 0x13d40(%rip), %rsi     # 0x19a40
leaq 0x1b0(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x21d0
movq (%r14), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x1d0(%rsp,%rax)
jne 0x5dcf
leaq 0x28(%rsp), %rdi
callq 0x20c0
leaq 0x38(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x2060
leaq 0x40(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x21a0
leaq 0x1b0(%rsp), %rdi
callq 0x2050
movq 0x8(%rsp), %rdi
movq 0x13cd2(%rip), %rsi     # 0x19a40
callq 0x65e4
movq %rbx, %rdi
callq 0x5f4c
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5d96
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2100
movq 0x13233(%rip), %rsi     # 0x18fd0
leaq 0x28(%rsp), %rdi
callq 0x20d0
leaq 0xa8(%rsp), %rdi
callq 0x2080
leaq 0x1b0(%rsp), %rdi
callq 0x2070
movq %rbx, %rax
addq $0x3b8, %rsp            # imm = 0x3B8
popq %rbx
popq %r14
retq
leaq 0xc8dc(%rip), %rdi      # 0x126b2
leaq 0xba1f(%rip), %rsi      # 0x117fc
leaq 0xba21(%rip), %rcx      # 0x11805
movl $0x18, %edx
callq 0x20b0
jmp 0x5dfc
jmp 0x5df2
movq %rax, %rbx
jmp 0x5e1a
movq %rax, %rbx
jmp 0x5e38
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5e1a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2100
movq 0x131af(%rip), %rsi     # 0x18fd0
leaq 0x28(%rsp), %rdi
callq 0x20d0
leaq 0xa8(%rsp), %rdi
callq 0x2080
leaq 0x1b0(%rsp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x21c0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/main.cpp
// Function: main
int main(int argc, char **argv) {
    filename = argv[1];

    config.log = false;
    config.ansi_style = true;
    config.unused = true;
    config.offsets = false;
    config.codegen = false;

    for (int i = 1; i != argc; ++i) {
        if (!strcmp(argv[i], "-v")) {
            config.log = true;
        }
        if (!strcmp(argv[i], "-unused")) {
            config.unused = false;
        }
        if (!strcmp(argv[i], "-no-style")) {
            config.ansi_style = false;
        }
        if (!strcmp(argv[i], "-offsets")) {
            config.offsets = true;
        }
        if (!strcmp(argv[i], "-codegen")) {
            config.codegen = true;
        }
    }

    Goal goal = parse_and_return_goal();

    // TODO: Check for fatal parsing errors here and don't continue
    // if they exist.
    
    typecheck(&goal);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq 0x8(%rsi), %rax
movq %rax, 0x13bda(%rip)     # 0x19a40
movl $0x10100, 0x13bc8(%rip) # imm = 0x10100
movb $0x0, 0x13bc5(%rip)     # 0x19a3c
cmpl $0x1, %edi
je 0x5f24
movq %rsi, %rbx
movl %edi, %r15d
movl $0x1, %r12d
leaq 0xb9a4(%rip), %r13      # 0x11837
leaq 0xb9a6(%rip), %rbp      # 0x11840
movq (%rbx,%r12,8), %r14
movq %r14, %rdi
leaq 0xb97a(%rip), %rsi      # 0x11822
callq 0x2170
testl %eax, %eax
jne 0x5eb8
movb $0x1, 0x13b80(%rip)     # 0x19a38
movq %r14, %rdi
leaq 0xb963(%rip), %rsi      # 0x11825
callq 0x2170
testl %eax, %eax
jne 0x5ed2
movb $0x0, 0x13b68(%rip)     # 0x19a3a
movq %r14, %rdi
leaq 0xb951(%rip), %rsi      # 0x1182d
callq 0x2170
testl %eax, %eax
jne 0x5eec
movb $0x0, 0x13b4d(%rip)     # 0x19a39
movq %r14, %rdi
movq %r13, %rsi
callq 0x2170
testl %eax, %eax
jne 0x5f02
movb $0x1, 0x13b39(%rip)     # 0x19a3b
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2170
testl %eax, %eax
jne 0x5f18
movb $0x1, 0x13b24(%rip)     # 0x19a3c
incq %r12
cmpq %r12, %r15
jne 0x5e9a
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x5cec
movq %rbx, %rdi
callq 0x8bc7
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/parse.cpp
// Function: parse_init(char const*, char const*)
void parse_init(const char *file_contents, const char *filename) {
    lexer_init(file_contents, filename);
    // TODO: Move this to some general initialization.
    EOI_has_been_found = false;
    main_method_string = str_intern("main");
    length_ = str_intern("length");
    set_indent_char('-');
}

// Assembly:
pushq %rax
callq 0x43e6
movb $0x0, 0x1345f(%rip)     # 0x19a50
leaq 0xb2cf(%rip), %rdi      # 0x118c7
callq 0x8238
movq %rax, 0x13444(%rip)     # 0x19a48
leaq 0xb2c1(%rip), %rdi      # 0x118cc
callq 0x8238
movq %rax, 0x13441(%rip)     # 0x19a58
movl $0x2d, %edi
popq %rax
jmp 0x3693
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/parse.cpp
// Function: expect_token_in_rule(TOK, char const*, bool)
static bool expect_token_in_rule(TOK kind, const char *rule, bool advance = false) {
    if (EOI_has_been_found) return false;
    if (is_token(TOK::EOI)) {
        EOI_has_been_found = true;
    }
    bool res;
    if (is_token(kind)) {
        next_token();
        return true;
    } else {
        syntax_error("Expected `", kind, "` in: ", rule, ", found `", token, "`");
        res = false;
    }
    if (advance) {
        next_token();
    }
    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x0, 0x1341c(%rip)     # 0x19a50
je 0x663e
xorl %r12d, %r12d
jmp 0x6763
movq %rsi, %rbx
movl %edi, %r15d
leaq 0x1304d(%rip), %rax     # 0x19698
movl (%rax), %ebp
cmpl $0x1, %ebp
jne 0x6659
movb $0x1, 0x133f7(%rip)     # 0x19a50
cmpl %r15d, %ebp
jne 0x666b
callq 0x3a45
movb $0x1, %r12b
jmp 0x6763
movq 0x8(%rax), %r14
leaq 0x1301a(%rip), %rax     # 0x19690
movl (%rax), %edx
leaq 0x133c1(%rip), %rax     # 0x19a40
movq (%rax), %rsi
leaq 0xa66d(%rip), %rdi      # 0x10cf6
xorl %eax, %eax
callq 0x2030
leaq 0x133a1(%rip), %r12     # 0x19a38
cmpb $0x1, 0x1(%r12)
jne 0x66ad
leaq 0x9e59(%rip), %rdi      # 0x104ff
xorl %eax, %eax
callq 0x2030
cmpb $0x1, 0x1(%r12)
jne 0x66c3
leaq 0xa643(%rip), %rdi      # 0x10cff
xorl %eax, %eax
callq 0x2030
leaq 0x9cea(%rip), %rdi      # 0x103b4
leaq 0xa615(%rip), %rsi      # 0x10ce6
xorl %eax, %eax
callq 0x2030
cmpb $0x1, 0x1(%r12)
jne 0x66ee
leaq 0x9e1e(%rip), %rdi      # 0x10505
xorl %eax, %eax
callq 0x2030
cmpb $0x1, 0x1(%r12)
jne 0x6704
leaq 0x9e08(%rip), %rdi      # 0x10505
xorl %eax, %eax
callq 0x2030
leaq 0x9ca9(%rip), %r13      # 0x103b4
leaq 0xb337(%rip), %rsi      # 0x11a49
xorl %r12d, %r12d
movq %r13, %rdi
xorl %eax, %eax
callq 0x2030
movl %r15d, %edi
callq 0x8258
movq %r13, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
leaq 0xb319(%rip), %rsi      # 0x11a54
movq %r13, %rdi
xorl %eax, %eax
callq 0x2030
leaq 0xb398(%rip), %rsi      # 0x11ae4
movq %rbx, %rdi
movl %ebp, %edx
movq %r14, %rcx
callq 0x6b8c
movl $0xa, %edi
callq 0x2160
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/./error.cpp
// Function: void syntax_error_no_ln<char const*>(char const*)
static void syntax_error_no_ln(Args... args) {
    log(loc);
    red_on();
    bold_on();
    log(" Syntax Error: ");
    bold_off();
    red_off();
    log(args...);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x12f0d(%rip), %rax     # 0x19690
movl (%rax), %edx
leaq 0x132b4(%rip), %rax     # 0x19a40
movq (%rax), %rsi
leaq 0xa560(%rip), %rdi      # 0x10cf6
xorl %eax, %eax
callq 0x2030
leaq 0x13294(%rip), %r14     # 0x19a38
cmpb $0x1, 0x1(%r14)
jne 0x67b9
leaq 0x9d4d(%rip), %rdi      # 0x104ff
xorl %eax, %eax
callq 0x2030
cmpb $0x1, 0x1(%r14)
jne 0x67ce
leaq 0xa538(%rip), %rdi      # 0x10cff
xorl %eax, %eax
callq 0x2030
leaq 0x9bdf(%rip), %rdi      # 0x103b4
leaq 0xa50a(%rip), %rsi      # 0x10ce6
xorl %eax, %eax
callq 0x2030
cmpb $0x1, 0x1(%r14)
jne 0x67f8
leaq 0x9d14(%rip), %rdi      # 0x10505
xorl %eax, %eax
callq 0x2030
cmpb $0x1, 0x1(%r14)
jne 0x680d
leaq 0x9cff(%rip), %rdi      # 0x10505
xorl %eax, %eax
callq 0x2030
leaq 0x9ba0(%rip), %rdi      # 0x103b4
movq %rbx, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2030
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/parse.cpp
// Function: starts_local()
static bool starts_local() {
    if (!starts_type(token.kind)) {
        return false;
    } else if (is_token(TOK::ID)) {
        // A little bit of hackiness:
        // An identifer can start both a statement
        // and a type. So, you have to peek a token
        // and see. The logic of peeking
        // is hidden in the lexer.
        token_t save_token = peek_token();
        if (save_token.kind == TOK::ASGN ||
            save_token.kind == TOK::LBRACKET)
        {
            return false;
        }
        return true;
    } else {
        return true;
    }
}

// Assembly:
leaq 0x12d81(%rip), %rax     # 0x19698
movl (%rax), %eax
leal -0x5(%rax), %ecx
cmpl $0x2, %ecx
jae 0x6924
movb $0x1, %al
retq
cmpl $0x8, %eax
jne 0x6942
pushq %rax
callq 0x42b4
cmpl $0x18, %eax
setne %cl
cmpl $0x24, %eax
setne %al
andb %cl, %al
addq $0x8, %rsp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/./error.cpp
// Function: log(token_t)
static void log(token_t tok) {
    printf("%s", token_name(tok.kind));
    if (tok.kind == TOK::INTLIT) {
        printf(" %d", tok.val);
    } else if (tok.kind == TOK::ID) {
        printf(" %s", tok.id);
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
callq 0x8258
leaq 0x97c6(%rip), %rdi      # 0x103b4
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
cmpl $0x8, %ebp
je 0x6c18
cmpl $0x2, %ebp
jne 0x6c2f
leaq 0xae52(%rip), %rdi      # 0x11a5b
movl %ebx, %esi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2030
leaq 0x9794(%rip), %rdi      # 0x103b3
movq %rbx, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2030
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/parse.cpp
// Function: parse_typespec()
static Typespec parse_typespec() {
    Typespec tspec;
    tspec.kind = TYSPEC::UNDEFINED;
    // The contract is that if the caller called this function,
    // then a type _must_ follow. In other words, the caller
    // is responsible to check whether a type follows.
    // The caller is also responsible for checking whether
    // an TYSPEC::UNDEFINED was returned.
    if (!starts_type(token.kind)) {
        syntax_error("Expected start of type specifier"
                     " (`int` or `boolean`), found ", token);
        return tspec;
    }
    switch (token.kind) {
    case TOK::INT:
    {
        next_token();
        if (match_token(TOK::LBRACKET)) {
            expect_token_in_rule(TOK::RBRACKET, "int array type specifier");
            tspec.kind = TYSPEC::ARR;
        } else {
            tspec.kind = TYSPEC::INT;
        }
    } break;
    case TOK::BOOLEAN:
    {
        next_token();
        tspec.kind = TYSPEC::BOOL;
        if (match_token(TOK::LBRACKET)) {
            syntax_error("You can't have arrays of `boolean` type, only of `int`.");
            match_token(TOK::RBRACKET);
        }
    } break;
    case TOK::ID:
    {
        tspec.id = token.id;
        tspec.kind = TYSPEC::ID;
        next_token();
    } break;
    default: tspec.kind = TYSPEC::UNDEFINED;
    }
    // The caller is responsible for recognizing
    // an UNDEFINED type specifier and issuing
    // a message.
    return tspec;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x1294b(%rip), %r14     # 0x19698
movl (%r14), %edi
cmpl $0x5, %edi
je 0x6d97
cmpl $0x6, %edi
je 0x6d6f
cmpl $0x8, %edi
jne 0x6dcf
movq 0x8(%r14), %r14
callq 0x3a45
movl $0x4, %ebx
jmp 0x6de1
callq 0x3a45
cmpl $0x24, (%r14)
jne 0x6ddc
callq 0x3a45
leaq 0xadd1(%rip), %rsi      # 0x11b57
movl $0x1b, %edi
callq 0x6622
movl $0x1, %ebx
jmp 0x6de1
callq 0x3a45
movl $0x3, %ebx
cmpl $0x24, (%r14)
jne 0x6de1
callq 0x3a45
leaq 0xadbd(%rip), %rdi      # 0x11b70
callq 0x6775
movl $0xa, %edi
callq 0x2160
cmpl $0x1b, (%r14)
jne 0x6de1
callq 0x3a45
jmp 0x6de1
movq 0x8(%r14), %rsi
callq 0x6dee
xorl %ebx, %ebx
jmp 0x6de1
movl $0x2, %ebx
movl %ebx, %eax
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/parse.cpp
// Function: expect_token(TOK, bool)
static bool expect_token(TOK kind, bool advance = false) {
    if (EOI_has_been_found) return false;
    if (is_token(TOK::EOI)) {
        EOI_has_been_found = true;
    }
    bool res;
    if (is_token(kind)) {
        next_token();
        return true;
    } else {
        syntax_error("Expected `", kind, "`, found `", token, "`");
        res = false;
    }
    if (advance) {
        next_token();
    }
    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x0, 0x12665(%rip)     # 0x19a50
je 0x73f8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %edi, %ebp
leaq 0x12297(%rip), %rax     # 0x19698
movl (%rax), %ebx
cmpl $0x1, %ebx
jne 0x740f
movb $0x1, 0x12641(%rip)     # 0x19a50
cmpl %ebp, %ebx
jne 0x7422
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3a45
movq 0x8(%rax), %r14
leaq 0x12263(%rip), %rax     # 0x19690
movl (%rax), %edx
leaq 0x1260a(%rip), %rax     # 0x19a40
movq (%rax), %rsi
leaq 0x98b6(%rip), %rdi      # 0x10cf6
xorl %eax, %eax
callq 0x2030
leaq 0x125ea(%rip), %r15     # 0x19a38
cmpb $0x1, 0x1(%r15)
jne 0x7463
leaq 0x90a3(%rip), %rdi      # 0x104ff
xorl %eax, %eax
callq 0x2030
cmpb $0x1, 0x1(%r15)
jne 0x7478
leaq 0x988e(%rip), %rdi      # 0x10cff
xorl %eax, %eax
callq 0x2030
leaq 0x8f35(%rip), %rdi      # 0x103b4
leaq 0x9860(%rip), %rsi      # 0x10ce6
xorl %eax, %eax
callq 0x2030
cmpb $0x1, 0x1(%r15)
jne 0x74a2
leaq 0x906a(%rip), %rdi      # 0x10505
xorl %eax, %eax
callq 0x2030
cmpb $0x1, 0x1(%r15)
jne 0x74b7
leaq 0x9055(%rip), %rdi      # 0x10505
xorl %eax, %eax
callq 0x2030
leaq 0x8ef6(%rip), %r15      # 0x103b4
leaq 0xa584(%rip), %rsi      # 0x11a49
movq %r15, %rdi
xorl %eax, %eax
callq 0x2030
movl %ebp, %edi
callq 0x8258
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
leaq 0xa901(%rip), %rsi      # 0x11deb
movq %r15, %rdi
xorl %eax, %eax
callq 0x2030
movl %ebx, %edi
movq %r14, %rsi
callq 0x6bda
movl $0x60, %edi
callq 0x2160
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2160
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/./buf.h
// Function: Buf<LocalDeclaration*>::_grow(unsigned long)
void _grow(size_t new_len) {
        constexpr size_t size_t_max = std::numeric_limits<size_t>::max();
        assert(cap <= (size_t_max - 1) / 2);
        size_t new_cap = MAX(MAX(2*cap, new_len), 16);
        assert(new_len <= new_cap);
        assert(new_cap <= (size_t_max) / sizeof(T));
        size_t new_size = new_cap * sizeof(T);
        data = (T *) realloc(data, new_size);
        assert(data);
        cap = new_cap;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %rax
testq %rax, %rax
js 0x7dd6
addq %rax, %rax
cmpq %rsi, %rax
cmovbeq %rsi, %rax
cmpq $0x11, %rax
movl $0x10, %r14d
cmovaeq %rax, %r14
shrq $0x3d, %rax
jne 0x7df5
movq %rdi, %rbx
leaq (,%r14,8), %rsi
movq 0x10(%rdi), %rdi
callq 0x21b0
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x7e14
movq %r14, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x9dcb(%rip), %rdi      # 0x11ba8
leaq 0x9de0(%rip), %rsi      # 0x11bc4
leaq 0x9de1(%rip), %rcx      # 0x11bcc
movl $0x21, %edx
callq 0x20b0
leaq 0x9e15(%rip), %rdi      # 0x11c11
leaq 0x9dc1(%rip), %rsi      # 0x11bc4
leaq 0x9dc2(%rip), %rcx      # 0x11bcc
movl $0x24, %edx
callq 0x20b0
leaq 0x9e1a(%rip), %rdi      # 0x11c35
leaq 0x9da2(%rip), %rsi      # 0x11bc4
leaq 0x9da3(%rip), %rcx      # 0x11bcc
movl $0x27, %edx
callq 0x20b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/typecheck.cpp
// Function: install_type_declarations(Goal*)
TypeTable install_type_declarations(Goal *goal) {
    DeclarationVisitor decl_visitor(goal->type_decls.len);
    goal->accept(&decl_visitor);

    // Free memory that was used for allocating objects
    // for parsing that doenot persist in pass 2 of type-checking.
    deallocate(MEM::PARSE_TEMP);

    return decl_visitor.type_table;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x50(%rsi), %rsi
xorps %xmm0, %xmm0
leaq 0x8(%rsp), %r15
movups %xmm0, 0x60(%r15)
movups %xmm0, 0x50(%r15)
movups %xmm0, 0x40(%r15)
movups %xmm0, 0x30(%r15)
movq $0x0, 0x70(%r15)
incq %rsi
movq %r15, %rdi
callq 0x9062
movq %r15, %rdi
movq %rbx, %rsi
callq 0x90fc
movl $0x1, %edi
callq 0x240c
movl $0xf, %ecx
movq %r14, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/typecheck.cpp
// Function: check_method_for_overriding(Method*, IdType*, VirtualTable*)
bool check_method_for_overriding(Method *method, IdType *type, VirtualTable *vtable) {
    VMethod *vmethod = vtable->find(method->id);
    if (!vmethod) {
      return false;
    }
    Method *method_parent = vmethod->method;
    assert(method_parent);
    if (!methods_have_same_signature(method, method_parent)) {
        typecheck_error_no_ln(method->loc, method->ret_type->name(), " ", method->id, "(");
        print_param_types(method);
        printf(") in `%s` can't override %s %s(", type->id, method_parent->ret_type->name(),
               method_parent->id);
        print_param_types(method_parent);
        printf(") in `%s`\n", vmethod->enclosing);
        return false;
    }
    vmethod->enclosing = type->id;
    method->offset = method_parent->offset;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rsi
movl $0xbebca0a0, %eax       # imm = 0xBEBCA0A0
imulq %rsi, %rax
shrq $0x20, %rax
andl $0x1f, %eax
imulq $0x98, %rax, %rax
leaq (%rdx,%rax), %rdi
addq $0x8, %rdi
callq 0xf43a
cmpq $-0x1, %rax
sete %cl
movq 0x1318(%rbx), %r13
testq %r13, %r13
sete %dl
orb %cl, %dl
je 0x8422
xorl %ebx, %ebx
jmp 0x84ca
shlq $0x4, %rax
addq %rax, %r13
movq (%r13), %r12
testq %r12, %r12
je 0x84db
movq %r15, %rdi
movq %r12, %rsi
callq 0x834c
movl %eax, %ebx
testb %al, %al
je 0x845a
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movq 0x48(%r12), %rax
movq %rax, 0x48(%r15)
jmp 0x84ca
movl 0x50(%r15), %ebp
movq 0x8(%r15), %rdi
callq 0x84fa
movq (%r15), %rcx
leaq 0x8c69(%rip), %rdx      # 0x110da
leaq 0xa17a(%rip), %r8       # 0x125f2
movl %ebp, %edi
movq %rax, %rsi
callq 0xeba0
movq %r15, %rdi
callq 0x8558
movq 0x8(%r14), %r14
movq 0x8(%r12), %rdi
callq 0x84fa
movq (%r12), %rcx
leaq 0xa03e(%rip), %rdi      # 0x124e1
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2030
movq %r12, %rdi
callq 0x8558
movq 0x8(%r13), %rsi
leaq 0xa03e(%rip), %rdi      # 0x12501
xorl %eax, %eax
callq 0x2030
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9f9e(%rip), %rdi      # 0x12480
leaq 0x9fa5(%rip), %rsi      # 0x1248e
leaq 0x9fac(%rip), %rcx      # 0x1249c
movl $0x115, %edx            # imm = 0x115
callq 0x20b0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/typecheck.cpp
// Function: Type::name() const
const char *Type::name() const {
    switch (kind) {
    case TY::UNDEFINED: return "Undefined Type (Error)";
    case TY::INT: return "int";
    case TY::ARR: return "int[]";
    case TY::BOOL: return "boolean";
    case TY::ID: return ((IdType *)this)->id; 
    default: assert(0);
    }
}

// Assembly:
movl 0x4(%rdi), %eax
cmpq $0x4, %rax
ja 0x8538
leaq 0x9e8a(%rip), %rcx      # 0x12394
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb17f(%rip), %rax      # 0x13699
retq
movq 0x8(%rdi), %rax
retq
leaq 0x7e72(%rip), %rax      # 0x10399
retq
leaq 0x7e74(%rip), %rax      # 0x103a3
retq
leaq 0x7e68(%rip), %rax      # 0x1039f
retq
pushq %rax
leaq 0xa172(%rip), %rdi      # 0x126b2
leaq 0x9f47(%rip), %rsi      # 0x1248e
leaq 0xb162(%rip), %rcx      # 0x136b0
movl $0x8f6, %edx            # imm = 0x8F6
callq 0x20b0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/typecheck.cpp
// Function: lookup_local(char const*, Method*, IdType*)
static void print_param_types(Method *method) {
    size_t param_len = method->param_len;
    for (size_t i = 0; i != param_len; ++i) {
        Local *param = method->locals[i];
        printf("%s", param->type->name());
        if (i + 1 != param_len) {
            printf(", ");
        }
    }
}

// Assembly:
pushq %rbx
movq 0x18(%rsi), %rcx
testq %rcx, %rcx
je 0xc8a0
testq %rdi, %rdi
je 0xc980
imull $0x5f5e505, %edi, %r8d  # imm = 0x5F5E505
imulq %rcx, %r8
shrq $0x20, %r8
movq 0x20(%rsi), %r10
xorl %eax, %eax
movq %r8, %r9
movq (%r10,%r9,8), %r11
cmpq %rdi, %r11
je 0xc8a4
testq %r11, %r11
je 0xc8ac
incq %r9
cmpq %rcx, %r9
cmoveq %rax, %r9
cmpq %r8, %r9
jne 0xc881
jmp 0xc8ac
xorl %eax, %eax
jmp 0xc8ac
movq 0x28(%rsi), %rax
movq (%rax,%r9,8), %rax
testq %rax, %rax
jne 0xc97e
movq 0x10(%rdx), %rcx
testq %rcx, %rcx
je 0xc8fd
testq %rdi, %rdi
je 0xc980
imull $0x5f5e505, %edi, %esi  # imm = 0x5F5E505
imulq %rcx, %rsi
shrq $0x20, %rsi
movq 0x18(%rdx), %r9
xorl %eax, %eax
movq %rsi, %r8
movq (%r9,%r8,8), %r10
cmpq %rdi, %r10
je 0xc901
testq %r10, %r10
je 0xc909
incq %r8
cmpq %rcx, %r8
cmoveq %rax, %r8
cmpq %rsi, %r8
jne 0xc8de
jmp 0xc909
xorl %eax, %eax
jmp 0xc909
movq 0x20(%rdx), %rax
movq (%rax,%r8,8), %rax
testq %rax, %rax
jne 0xc97e
imull $0x5f5e505, %edi, %ecx  # imm = 0x5F5E505
xorl %esi, %esi
movq %rdx, %r8
movq 0x78(%r8), %r8
testq %r8, %r8
je 0xc97c
movq 0x10(%r8), %r9
testq %r9, %r9
je 0xc966
testq %rdi, %rdi
je 0xc980
movq %r9, %r10
imulq %rcx, %r10
shrq $0x20, %r10
movq 0x18(%r8), %rbx
movq %r10, %r11
movq (%rbx,%r11,8), %rax
cmpq %rdi, %rax
je 0xc96a
testq %rax, %rax
je 0xc966
incq %r11
cmpq %r9, %r11
cmoveq %rsi, %r11
movl $0x0, %eax
cmpq %r10, %r11
jne 0xc942
jmp 0xc972
xorl %eax, %eax
jmp 0xc972
movq 0x20(%r8), %rax
movq (%rax,%r11,8), %rax
testq %rax, %rax
jne 0xc97e
cmpq %rdx, %r8
jne 0xc919
xorl %eax, %eax
popq %rbx
retq
leaq 0x6e8d(%rip), %rdi      # 0x13814
leaq 0x6e8a(%rip), %rsi      # 0x13818
leaq 0x741c(%rip), %rcx      # 0x13db1
movl $0x5e, %edx
callq 0x20b0
// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/typecheck.cpp
// Function: TypeTable::offset_computation()
void TypeTable::offset_computation() {
    VirtualTable vtable;
    for (IdType *type : inher_roots) {
        //printf("-- Inheritance root: %s -- \n\n", type->id);
        constexpr size_t start_fields = 0;
        constexpr size_t start_methods = 0;
        compute_and_print_offsets_for_type(type, start_fields, start_methods, &vtable);
        vtable.clear();
        //printf("\n");
    }
    deallocate(MEM::CHILDREN);
    emit("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1328, %rsp           # imm = 0x1328
movq %rdi, %rbx
leaq 0x10(%rsp), %r15
xorl %eax, %eax
xorps %xmm0, %xmm0
leaq (%r15,%rax), %rcx
movups %xmm0, 0x90(%rsp,%rax)
movq %rcx, 0xa0(%rsp,%rax)
addq $0x98, %rax
cmpq $0x1300, %rax           # imm = 0x1300
jne 0x8ad6
leaq 0x1310(%rsp), %r14
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
xorl %r12d, %r12d
movq %r12, 0x10(%r14)
movl $0x20, %esi
movq %r14, %rdi
callq 0xf684
movq %r12, -0x1308(%r14)
movq 0x12f4f(%rip), %rax     # 0x1ba78
testq %rax, %rax
je 0x8b9d
movq 0x12f4b(%rip), %r12     # 0x1ba80
leaq (%r12,%rax,8), %r13
leaq 0xa0(%rsp), %rbp
xorl %r14d, %r14d
movq (%r12), %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
leaq 0x8(%rsp), %r8
callq 0x85c8
movq %r14, 0x8(%rsp)
movq %r14, 0x1318(%rsp)
xorl %eax, %eax
xorps %xmm0, %xmm0
leaq (%r15,%rax), %rcx
movups %xmm0, -0x10(%rbp,%rax)
movq %rcx, 0xa0(%rsp,%rax)
addq $0x98, %rax
cmpq $0x1300, %rax           # imm = 0x1300
jne 0x8b6b
movl $0x5, %edi
callq 0x240c
addq $0x8, %r12
cmpq %r13, %r12
jne 0x8b44
movl $0x6, %edi
callq 0x240c
leaq 0x896a(%rip), %rdi      # 0x11518
xorl %eax, %eax
callq 0x479d
addq $0x1328, %rsp           # imm = 0x1328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq