// File: /workspace/github_c_makefile_star2_O2/alexj136[P]minijit/src/syntax.c
// Function: Expr_print
void Expr_print(Expr *expr, IntRefVector *local_name_map,
        charVector *global_name_map) {

    if(Expr_isInt(expr)) {
        printf("%d", Int_value(expr));
    }
    else if(Expr_isAdd(expr)) {
        Expr_print(Add_lhs(expr), local_name_map, global_name_map);
        printf(" + ");
        Expr_print(Add_rhs(expr), local_name_map, global_name_map);
    }
    else if(Expr_isSub(expr)) {
        Expr_print(Sub_lhs(expr), local_name_map, global_name_map);
        printf(" - ");
        Expr_print(Sub_rhs(expr), local_name_map, global_name_map);
    }
    else if(Expr_isCall(expr)) {
        printf("%s(", charVector_get(global_name_map, Call_name(expr)));
        int idx;
        for(idx = 0; idx < Call_num_args(expr); idx++) {
            Expr_print(Call_arg(expr, idx), local_name_map, global_name_map);
            if(idx + 1 < Call_num_args(expr)) { printf(", "); }
        }
        printf(")");
    }
    else if(Expr_isVar(expr)) {
        printf("%s", charVector_get(global_name_map,
                IntRef_value(IntRefVector_get(local_name_map,
                Var_name(expr)))));
    }
    else {
        ERROR("Expr type not recognised.");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f48, %rsp           # imm = 0x1F48
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x108d3(%rip), %r13     # 0x1a234
movl (%r15), %eax
cmpq $0x4, %rax
ja 0x9a85
movslq (%r13,%rax,4), %rax
addq %r13, %rax
leaq 0x10a5a(%rip), %r12     # 0x1a3d7
jmpq *%rax
leaq 0x10a4d(%rip), %r12     # 0x1a3d3
movq 0x8(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x993d
movq %r12, %rdi
xorl %eax, %eax
callq 0x6100
movq 0x10(%r15), %r15
jmp 0x9961
movl 0x4(%r15), %esi
movq %r14, %rdi
callq 0x77bb
movl (%rax), %esi
movq %rbx, %rdi
callq 0x690b
leaq 0x10935(%rip), %rdi     # 0x1a2f7
movq %rax, %rsi
xorl %eax, %eax
addq $0x1f48, %rsp           # imm = 0x1F48
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6100
movl 0x4(%r15), %esi
leaq 0x11c5c(%rip), %rdi     # 0x1b644
xorl %eax, %eax
addq $0x1f48, %rsp           # imm = 0x1F48
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6100
movl 0x4(%r15), %esi
movq %rbx, %rdi
callq 0x690b
leaq 0x108e0(%rip), %rdi     # 0x1a2f3
movq %rax, %rsi
xorl %eax, %eax
callq 0x6100
leaq 0x11198(%rip), %r12     # 0x1abbc
xorl %r13d, %r13d
movq 0x18(%r15), %rdi
callq 0x9b87
cmpl %eax, %r13d
jge 0x9a6c
movq 0x18(%r15), %rdi
movl %r13d, %esi
callq 0x9e11
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x993d
incl %r13d
movq 0x18(%r15), %rdi
callq 0x9b87
cmpl %eax, %r13d
jge 0x9a27
movq %r12, %rdi
xorl %eax, %eax
callq 0x6100
jmp 0x9a27
pushq $0x29
popq %rdi
addq $0x1f48, %rsp           # imm = 0x1F48
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6040
leaq 0x10578(%rip), %rdi     # 0x1a004
leaq 0x107b5(%rip), %rsi     # 0x1a248
leaq 0x10941(%rip), %rcx     # 0x1a3db
xorl %r12d, %r12d
movl $0x13e, %edx            # imm = 0x13E
xorl %eax, %eax
callq 0x6100
leaq 0x1057c(%rip), %rbx     # 0x1a02c
leaq 0x1092f(%rip), %rsi     # 0x1a3e6
movq %rbx, %rdi
xorl %eax, %eax
callq 0x6100
leaq -0x1f70(%rbp), %r15
movq %r15, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x60e0
movl %eax, %r14d
movq %r15, %rdi
movl %eax, %esi
callq 0x60b0
movq %rax, %r15
leaq 0x1072a(%rip), %rdi     # 0x1a216
callq 0x6070
testl %r14d, %r14d
cmovlel %r12d, %r14d
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x9b13
movq (%r15,%r12,8), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x6100
incq %r12
jmp 0x9afb
pushq $0x1
popq %rdi
callq 0x61a0