// File: pfnet-research[P]pml/src/test.cpp
// Function: arith_test::arith_test()
PML_CUSTOM_TEST(arith_test, lang_feature_test) {
    using namespace ast;
    parse_test("1 +(2+3*4) - 3", "Sub(Add(1, Add(2, Mul(3, 4))), 3)");
    eval_test(
            make<sub_expr_t>(
                make<add_expr_t>(
                    make<int_expr_t>(1),
                    make<add_expr_t>(
                        make<int_expr_t>(2),
                        make<mul_expr_t>(
                            make<int_expr_t>(3),
                            make<int_expr_t>(4)))),
                make<int_expr_t>(3)),
            make<int_expr_t>(12));
    parse_test("1-(-3)", "Sub(1, -3)");
    eval_test(
            make<sub_expr_t>(
                make<int_expr_t>(1),
                make<int_expr_t>(-3)),
            make<int_expr_t>(4));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x71b80
movq -0x230(%rbp), %rax
leaq 0x7d393(%rip), %rcx     # 0xe6500
movq %rcx, (%rax)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0xa660
movq -0x228(%rbp), %rdx
leaq 0x36762(%rip), %rsi     # 0x9f8f0
leaq -0x28(%rbp), %rdi
callq 0x1dd10
jmp 0x69199
leaq -0x61(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0xa660
movq -0x238(%rbp), %rdx
leaq 0x36748(%rip), %rsi     # 0x9f8ff
leaq -0x60(%rbp), %rdi
callq 0x1dd10
jmp 0x691c2
movq -0x230(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x71bc0
jmp 0x691d8
leaq -0x60(%rbp), %rdi
callq 0xa240
leaq -0x61(%rbp), %rdi
callq 0xa420
leaq -0x28(%rbp), %rdi
callq 0xa240
leaq -0x29(%rbp), %rdi
callq 0xa420
movl $0x1, -0xac(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xac(%rbp), %rsi
callq 0x67db0
jmp 0x6921b
movl $0x2, -0xd4(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
callq 0x67db0
jmp 0x6923a
movl $0x3, -0xfc(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0xfc(%rbp), %rsi
callq 0x67db0
jmp 0x69259
movl $0x4, -0x114(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x114(%rbp), %rsi
callq 0x67db0
jmp 0x69278
leaq -0xe8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
leaq -0x110(%rbp), %rdx
callq 0x67e20
jmp 0x69294
leaq -0xc0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
callq 0x67de0
jmp 0x692b0
leaq -0x98(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x67d70
jmp 0x692cc
movl $0x3, -0x12c(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0x12c(%rbp), %rsi
callq 0x67db0
jmp 0x692eb
leaq -0x88(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0x128(%rbp), %rdx
callq 0x67d30
jmp 0x69307
leaq -0x78(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x71e50
movl $0xc, -0x154(%rbp)
leaq -0x150(%rbp), %rdi
leaq -0x154(%rbp), %rsi
callq 0x67db0
jmp 0x69336
leaq -0x140(%rbp), %rdi
movq %rdi, -0x240(%rbp)
leaq -0x150(%rbp), %rsi
callq 0x12f60
movq -0x230(%rbp), %rdi
movq -0x240(%rbp), %rdx
leaq -0x78(%rbp), %rsi
callq 0x71cb0
jmp 0x69369
leaq -0x140(%rbp), %rdi
callq 0x13080
leaq -0x150(%rbp), %rdi
callq 0x12f90
leaq -0x78(%rbp), %rdi
callq 0x13080
leaq -0x88(%rbp), %rdi
callq 0x42190
leaq -0x128(%rbp), %rdi
callq 0x12f90
leaq -0x98(%rbp), %rdi
callq 0x42140
leaq -0xc0(%rbp), %rdi
callq 0x42140
leaq -0xe8(%rbp), %rdi
callq 0x420a0
leaq -0x110(%rbp), %rdi
callq 0x12f90
leaq -0xf8(%rbp), %rdi
callq 0x12f90
leaq -0xd0(%rbp), %rdi
callq 0x12f90
leaq -0xa8(%rbp), %rdi
callq 0x12f90
leaq -0x179(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0xa660
movq -0x248(%rbp), %rdx
leaq 0x3650a(%rip), %rsi     # 0x9f921
leaq -0x178(%rbp), %rdi
callq 0x1dd10
jmp 0x69425
leaq -0x1a1(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0xa660
movq -0x250(%rbp), %rdx
leaq 0x364e2(%rip), %rsi     # 0x9f928
leaq -0x1a0(%rbp), %rdi
callq 0x1dd10
jmp 0x69454
movq -0x230(%rbp), %rdi
leaq -0x178(%rbp), %rsi
leaq -0x1a0(%rbp), %rdx
callq 0x71bc0
jmp 0x69470
leaq -0x1a0(%rbp), %rdi
callq 0xa240
leaq -0x1a1(%rbp), %rdi
callq 0xa420
leaq -0x178(%rbp), %rdi
callq 0xa240
leaq -0x179(%rbp), %rdi
callq 0xa420
movl $0x1, -0x1dc(%rbp)
leaq -0x1d8(%rbp), %rdi
leaq -0x1dc(%rbp), %rsi
callq 0x67db0
jmp 0x694bf
movl $0xfffffffd, -0x1f4(%rbp) # imm = 0xFFFFFFFD
leaq -0x1f0(%rbp), %rdi
leaq -0x1f4(%rbp), %rsi
callq 0x67db0
jmp 0x694de
leaq -0x1c8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
leaq -0x1f0(%rbp), %rdx
callq 0x67e60
jmp 0x694fa
leaq -0x1b8(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x71e50
movl $0x4, -0x21c(%rbp)
leaq -0x218(%rbp), %rdi
leaq -0x21c(%rbp), %rsi
callq 0x67db0
jmp 0x6952c
leaq -0x208(%rbp), %rdi
movq %rdi, -0x258(%rbp)
leaq -0x218(%rbp), %rsi
callq 0x12f60
movq -0x230(%rbp), %rdi
movq -0x258(%rbp), %rdx
leaq -0x1b8(%rbp), %rsi
callq 0x71cb0
jmp 0x69562
leaq -0x208(%rbp), %rdi
callq 0x13080
leaq -0x218(%rbp), %rdi
callq 0x12f90
leaq -0x1b8(%rbp), %rdi
callq 0x13080
leaq -0x1c8(%rbp), %rdi
callq 0x42190
leaq -0x1f0(%rbp), %rdi
callq 0x12f90
leaq -0x1d8(%rbp), %rdi
callq 0x12f90
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x695f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x695e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xa240
leaq -0x61(%rbp), %rdi
callq 0xa420
leaq -0x28(%rbp), %rdi
callq 0xa240
leaq -0x29(%rbp), %rdi
callq 0xa420
jmp 0x69818
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x69818
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6972f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x69723
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x69717
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6970b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x696ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x696f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x696e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x696db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x696c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x13080
leaq -0x150(%rbp), %rdi
callq 0x12f90
leaq -0x78(%rbp), %rdi
callq 0x13080
leaq -0x88(%rbp), %rdi
callq 0x42190
leaq -0x128(%rbp), %rdi
callq 0x12f90
leaq -0x98(%rbp), %rdi
callq 0x42140
leaq -0xc0(%rbp), %rdi
callq 0x42140
leaq -0xe8(%rbp), %rdi
callq 0x420a0
leaq -0x110(%rbp), %rdi
callq 0x12f90
leaq -0xf8(%rbp), %rdi
callq 0x12f90
leaq -0xd0(%rbp), %rdi
callq 0x12f90
leaq -0xa8(%rbp), %rdi
callq 0x12f90
jmp 0x69818
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6978c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x69774
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0xa240
leaq -0x1a1(%rbp), %rdi
callq 0xa420
leaq -0x178(%rbp), %rdi
callq 0xa240
leaq -0x179(%rbp), %rdi
callq 0xa420
jmp 0x69818
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6980c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x69800
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x697e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x13080
leaq -0x218(%rbp), %rdi
callq 0x12f90
leaq -0x1b8(%rbp), %rdi
callq 0x13080
leaq -0x1c8(%rbp), %rdi
callq 0x42190
leaq -0x1f0(%rbp), %rdi
callq 0x12f90
leaq -0x1d8(%rbp), %rdi
callq 0x12f90
movq -0x230(%rbp), %rdi
callq 0x71f50
movq -0x38(%rbp), %rdi
callq 0xa650
nopl (%rax)