// File: /workspace/github_cpp_makefile_star2_O1/baziotis[P]minijava-cpp/ast.cpp
// Function: expr_print(Expression*)
void expr_print(Expression *e) {
    LOG_SCOPE;
    if (!e) return;
    switch (e->kind) {
    case EXPR::PLUS:
    case EXPR::MINUS:
    case EXPR::TIMES:
    case EXPR::CMP:
    case EXPR::AND:
    case EXPR::ARR_LOOK:
    {
        BinaryExpression *be = (BinaryExpression*) e;
        debug_print("(");
        printf("%s\n", expr_name(be->kind));
        expr_print(be->e1);
        expr_print(be->e2);
        debug_line(")");
    } break;
    case EXPR::THIS:
    {
        debug_line("(ThisExpression)");
    } break;
    case EXPR::INT_LIT:
    case EXPR::BOOL_LIT:
    {
        debug_print("(");
        printf("%s %d)\n", expr_name(e->kind), e->lit_val);
    } break;
    case EXPR::MSG_SEND:
    {
        BinaryExpression *be = (BinaryExpression*) e;
        debug_print("(MessageSend\n");
        expr_print(be->e1);
        // For some reason, debug_line does not work here
        debug_print("- Id: %s\n", be->msd->id);
        debug_print("- Expression list:\n");
        for (Expression* e2 : be->msd->expr_list) {
            expr_print(e2);
        }
        debug_print(")\n");
    } break;
    case EXPR::ID:
    {
        debug_print("(");
        printf("%s %s)\n", expr_name(e->kind), e->id);
    } break;
    case EXPR::UNDEFINED:
    {
        debug_print("(");
        printf("Undefined ");
        red_on();
        printf("(Error)");
        red_off();
        printf(")\n");
    } break;
    case EXPR::ARR_LEN:
    case EXPR::ARR_ALLOC:
    case EXPR::NOT:
    {
        debug_print("(%s\n", expr_name(e->kind));
        expr_print(e->e1);
        debug_line(")");
    } break;
    default: printf("Expression print error: %s\n", expr_name(e->kind)); assert(0);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0xf(%rsp), %rdi
callq 0x34d0
testq %rbx, %rbx
je 0x2ab3
movl 0x4(%rbx), %edi
cmpq $0xe, %rdi
ja 0x2ac7
leaq 0xdada(%rip), %rax      # 0x1004c
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x10070(%rip), %rdi     # 0x125f2
xorl %eax, %eax
callq 0x3541
movslq 0x4(%rbx), %rax
leaq 0xdba4(%rip), %rcx      # 0x10138
movq %rcx, 0x1706d(%rip)     # 0x19608
leaq 0x1705e(%rip), %rcx     # 0x19600
leaq 0xdb9d(%rip), %rdx      # 0x10146
movq %rdx, 0x17060(%rip)     # 0x19610
leaq 0xdb9d(%rip), %rdx      # 0x10154
movq %rdx, 0x1705a(%rip)     # 0x19618
leaq 0xdba0(%rip), %rdx      # 0x10165
movq %rdx, 0x17054(%rip)     # 0x19620
leaq 0xdba4(%rip), %rdx      # 0x10177
movq %rdx, 0x1704e(%rip)     # 0x19628
leaq 0xdba8(%rip), %rdx      # 0x10189
movq %rdx, 0x17048(%rip)     # 0x19630
leaq 0xdba6(%rip), %rdx      # 0x10195
movq %rdx, 0x17042(%rip)     # 0x19638
leaq 0xdba4(%rip), %rdx      # 0x101a1
movq %rdx, 0x1703c(%rip)     # 0x19640
leaq 0xdba2(%rip), %rdx      # 0x101ad
movq %rdx, 0x17036(%rip)     # 0x19648
leaq 0xdba2(%rip), %rdx      # 0x101bb
movq %rdx, 0x17030(%rip)     # 0x19650
leaq 0xdb9f(%rip), %rdx      # 0x101c6
movq %rdx, 0x1702a(%rip)     # 0x19658
leaq 0xdba0(%rip), %rdx      # 0x101d5
movq %rdx, 0x17024(%rip)     # 0x19660
leaq 0xdb9e(%rip), %rdx      # 0x101e1
movq %rdx, 0x1701e(%rip)     # 0x19668
leaq 0xdb9f(%rip), %rdx      # 0x101f0
movq %rdx, 0x17018(%rip)     # 0x19670
leaq 0xdb96(%rip), %rdx      # 0x101f5
movq %rdx, 0x17012(%rip)     # 0x19678
leaq 0xdb9d(%rip), %rdx      # 0x1020a
movq %rdx, 0x16f8c(%rip)     # 0x19600
movq (%rcx,%rax,8), %rdi
callq 0x2190
movq 0x10(%rbx), %rdi
callq 0x253f
movq 0x18(%rbx), %rdi
callq 0x253f
leaq 0x10225(%rip), %rdi     # 0x128bb
xorl %eax, %eax
callq 0x35ee
jmp 0x2ab3
movslq %edi, %rax
leaq 0xda8c(%rip), %rcx      # 0x10138
movq %rcx, 0x16f55(%rip)     # 0x19608
leaq 0x16f46(%rip), %rcx     # 0x19600
leaq 0xda85(%rip), %rdx      # 0x10146
movq %rdx, 0x16f48(%rip)     # 0x19610
leaq 0xda85(%rip), %rdx      # 0x10154
movq %rdx, 0x16f42(%rip)     # 0x19618
leaq 0xda88(%rip), %rdx      # 0x10165
movq %rdx, 0x16f3c(%rip)     # 0x19620
leaq 0xda8c(%rip), %rdx      # 0x10177
movq %rdx, 0x16f36(%rip)     # 0x19628
leaq 0xda90(%rip), %rdx      # 0x10189
movq %rdx, 0x16f30(%rip)     # 0x19630
leaq 0xda8e(%rip), %rdx      # 0x10195
movq %rdx, 0x16f2a(%rip)     # 0x19638
leaq 0xda8c(%rip), %rdx      # 0x101a1
movq %rdx, 0x16f24(%rip)     # 0x19640
leaq 0xda8a(%rip), %rdx      # 0x101ad
movq %rdx, 0x16f1e(%rip)     # 0x19648
leaq 0xda8a(%rip), %rdx      # 0x101bb
movq %rdx, 0x16f18(%rip)     # 0x19650
leaq 0xda87(%rip), %rdx      # 0x101c6
movq %rdx, 0x16f12(%rip)     # 0x19658
leaq 0xda88(%rip), %rdx      # 0x101d5
movq %rdx, 0x16f0c(%rip)     # 0x19660
leaq 0xda86(%rip), %rdx      # 0x101e1
movq %rdx, 0x16f06(%rip)     # 0x19668
leaq 0xda87(%rip), %rdx      # 0x101f0
movq %rdx, 0x16f00(%rip)     # 0x19670
leaq 0xda7e(%rip), %rdx      # 0x101f5
movq %rdx, 0x16efa(%rip)     # 0x19678
leaq 0xda85(%rip), %rdx      # 0x1020a
movq %rdx, 0x16e74(%rip)     # 0x19600
movq (%rcx,%rax,8), %rsi
leaq 0xdadd(%rip), %rdi      # 0x10274
xorl %eax, %eax
callq 0x3541
movq 0x10(%rbx), %rdi
callq 0x253f
leaq 0x1010d(%rip), %rdi     # 0x128bb
jmp 0x2944
leaq 0xfe38(%rip), %rdi      # 0x125f2
xorl %eax, %eax
callq 0x3541
movslq 0x4(%rbx), %rax
leaq 0xd96c(%rip), %rcx      # 0x10138
movq %rcx, 0x16e35(%rip)     # 0x19608
leaq 0x16e26(%rip), %rcx     # 0x19600
leaq 0xd965(%rip), %rdx      # 0x10146
movq %rdx, 0x16e28(%rip)     # 0x19610
leaq 0xd965(%rip), %rdx      # 0x10154
movq %rdx, 0x16e22(%rip)     # 0x19618
leaq 0xd968(%rip), %rdx      # 0x10165
movq %rdx, 0x16e1c(%rip)     # 0x19620
leaq 0xd96c(%rip), %rdx      # 0x10177
movq %rdx, 0x16e16(%rip)     # 0x19628
leaq 0xd970(%rip), %rdx      # 0x10189
movq %rdx, 0x16e10(%rip)     # 0x19630
leaq 0xd96e(%rip), %rdx      # 0x10195
movq %rdx, 0x16e0a(%rip)     # 0x19638
leaq 0xd96c(%rip), %rdx      # 0x101a1
movq %rdx, 0x16e04(%rip)     # 0x19640
leaq 0xd96a(%rip), %rdx      # 0x101ad
movq %rdx, 0x16dfe(%rip)     # 0x19648
leaq 0xd96a(%rip), %rdx      # 0x101bb
movq %rdx, 0x16df8(%rip)     # 0x19650
leaq 0xd967(%rip), %rdx      # 0x101c6
movq %rdx, 0x16df2(%rip)     # 0x19658
leaq 0xd968(%rip), %rdx      # 0x101d5
movq %rdx, 0x16dec(%rip)     # 0x19660
leaq 0xd966(%rip), %rdx      # 0x101e1
movq %rdx, 0x16de6(%rip)     # 0x19668
leaq 0xd967(%rip), %rdx      # 0x101f0
movq %rdx, 0x16de0(%rip)     # 0x19670
leaq 0xd95e(%rip), %rdx      # 0x101f5
movq %rdx, 0x16dda(%rip)     # 0x19678
leaq 0xd965(%rip), %rdx      # 0x1020a
movq %rdx, 0x16d54(%rip)     # 0x19600
movq (%rcx,%rax,8), %rsi
movl 0x10(%rbx), %edx
leaq 0xd973(%rip), %rdi      # 0x1022d
xorl %eax, %eax
callq 0x2030
jmp 0x2ab3
leaq 0xd968(%rip), %rdi      # 0x10235
xorl %eax, %eax
callq 0x3541
movq 0x10(%rbx), %rdi
callq 0x253f
movq 0x18(%rbx), %rax
movq (%rax), %rsi
leaq 0xd958(%rip), %rdi      # 0x10243
xorl %eax, %eax
callq 0x3541
leaq 0xd954(%rip), %rdi      # 0x1024d
xorl %eax, %eax
callq 0x3541
movq 0x18(%rbx), %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0x292a
movq 0x18(%rax), %r14
shlq $0x3, %rbx
xorl %r15d, %r15d
movq (%r14,%r15), %rdi
callq 0x253f
addq $0x8, %r15
cmpq %r15, %rbx
jne 0x2918
leaq 0x10822(%rip), %rdi     # 0x13153
xorl %eax, %eax
callq 0x3541
jmp 0x2ab3
leaq 0xd8d8(%rip), %rdi      # 0x1021c
xorl %eax, %eax
callq 0x35ee
jmp 0x2ab3
leaq 0xfc9b(%rip), %rdi      # 0x125f2
xorl %eax, %eax
callq 0x3541
movslq 0x4(%rbx), %rax
leaq 0xd7cf(%rip), %rcx      # 0x10138
movq %rcx, 0x16c98(%rip)     # 0x19608
leaq 0x16c89(%rip), %rcx     # 0x19600
leaq 0xd7c8(%rip), %rdx      # 0x10146
movq %rdx, 0x16c8b(%rip)     # 0x19610
leaq 0xd7c8(%rip), %rdx      # 0x10154
movq %rdx, 0x16c85(%rip)     # 0x19618
leaq 0xd7cb(%rip), %rdx      # 0x10165
movq %rdx, 0x16c7f(%rip)     # 0x19620
leaq 0xd7cf(%rip), %rdx      # 0x10177
movq %rdx, 0x16c79(%rip)     # 0x19628
leaq 0xd7d3(%rip), %rdx      # 0x10189
movq %rdx, 0x16c73(%rip)     # 0x19630
leaq 0xd7d1(%rip), %rdx      # 0x10195
movq %rdx, 0x16c6d(%rip)     # 0x19638
leaq 0xd7cf(%rip), %rdx      # 0x101a1
movq %rdx, 0x16c67(%rip)     # 0x19640
leaq 0xd7cd(%rip), %rdx      # 0x101ad
movq %rdx, 0x16c61(%rip)     # 0x19648
leaq 0xd7cd(%rip), %rdx      # 0x101bb
movq %rdx, 0x16c5b(%rip)     # 0x19650
leaq 0xd7ca(%rip), %rdx      # 0x101c6
movq %rdx, 0x16c55(%rip)     # 0x19658
leaq 0xd7cb(%rip), %rdx      # 0x101d5
movq %rdx, 0x16c4f(%rip)     # 0x19660
leaq 0xd7c9(%rip), %rdx      # 0x101e1
movq %rdx, 0x16c49(%rip)     # 0x19668
leaq 0xd7ca(%rip), %rdx      # 0x101f0
movq %rdx, 0x16c43(%rip)     # 0x19670
leaq 0xd7c1(%rip), %rdx      # 0x101f5
movq %rdx, 0x16c3d(%rip)     # 0x19678
leaq 0xd7c8(%rip), %rdx      # 0x1020a
movq %rdx, 0x16bb7(%rip)     # 0x19600
movq (%rcx,%rax,8), %rsi
movq 0x10(%rbx), %rdx
leaq 0xd809(%rip), %rdi      # 0x10261
xorl %eax, %eax
callq 0x2030
jmp 0x2ab3
leaq 0xfb8a(%rip), %rdi      # 0x125f2
xorl %eax, %eax
callq 0x3541
leaq 0xd7f3(%rip), %rdi      # 0x10269
xorl %eax, %eax
callq 0x2030
leaq 0xda7b(%rip), %rdi      # 0x104ff
xorl %eax, %eax
callq 0x2030
leaq 0xd8ff(%rip), %rdi      # 0x10391
xorl %eax, %eax
callq 0x2030
leaq 0xda65(%rip), %rdi      # 0x10505
xorl %eax, %eax
callq 0x2030
leaq 0xfe0d(%rip), %rdi      # 0x128bb
callq 0x2190
leaq 0xf(%rsp), %rdi
callq 0x34e4
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
callq 0x2450
leaq 0xd7a6(%rip), %rdi      # 0x10279
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
leaq 0xfbce(%rip), %rdi      # 0x126b2
leaq 0xd7aa(%rip), %rsi      # 0x10295
leaq 0xd7ab(%rip), %rcx      # 0x1029d
movl $0x64, %edx
callq 0x20b0
jmp 0x2b02
jmp 0x2b02
jmp 0x2b02
movq %rax, %rbx
leaq 0xf(%rsp), %rdi
callq 0x34e4
movq %rbx, %rdi
callq 0x21c0
nop