// File: pfnet-research[P]pml/src/test.cpp
// Function: if_test::if_test()
PML_CUSTOM_TEST(if_test, lang_feature_test) {
    using namespace ast;
    parse_test("if true then 42 else 1", "If(true, 42, 1)");
    eval_test(
            make<if_expr_t>(
                make<bool_expr_t>(true),
                make<int_expr_t>(42),
                make<int_expr_t>(1)),
            make<int_expr_t>(42));

    parse_test("let x = false in if x then 31 else 21", "Let(x, false, If(x, 31, 21))");
    eval_test(
            make<let_expr_t>("x",
                make<bool_expr_t>(false),
                make<if_expr_t>(
                    make<var_expr_t>("x"),
                    make<int_expr_t>(31),
                    make<int_expr_t>(21))),
            make<int_expr_t>(21));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x71b80
movq -0x208(%rbp), %rax
leaq 0x7af4b(%rip), %rcx     # 0xe66b8
movq %rcx, (%rax)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0xa660
movq -0x200(%rbp), %rdx
leaq 0x34396(%rip), %rsi     # 0x9fb24
leaq -0x28(%rbp), %rdi
callq 0x1dd10
jmp 0x6b799
leaq -0x61(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0xa660
movq -0x210(%rbp), %rdx
leaq 0x34384(%rip), %rsi     # 0x9fb3b
leaq -0x60(%rbp), %rdi
callq 0x1dd10
jmp 0x6b7c2
movq -0x208(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x71bc0
jmp 0x6b7d8
leaq -0x60(%rbp), %rdi
callq 0xa240
leaq -0x61(%rbp), %rdi
callq 0xa420
leaq -0x28(%rbp), %rdi
callq 0xa240
leaq -0x29(%rbp), %rdi
callq 0xa420
movb $0x1, -0x99(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0x99(%rbp), %rsi
callq 0x67fd0
jmp 0x6b818
movl $0x2a, -0xb4(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb4(%rbp), %rsi
callq 0x67db0
jmp 0x6b837
movl $0x1, -0xcc(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xcc(%rbp), %rsi
callq 0x67db0
jmp 0x6b856
leaq -0x88(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
callq 0x68260
jmp 0x6b879
leaq -0x78(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x41c70
movl $0x2a, -0xf4(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xf4(%rbp), %rsi
callq 0x67db0
jmp 0x6b8a8
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x218(%rbp)
leaq -0xf0(%rbp), %rsi
callq 0x12f60
movq -0x208(%rbp), %rdi
movq -0x218(%rbp), %rdx
leaq -0x78(%rbp), %rsi
callq 0x71cb0
jmp 0x6b8db
leaq -0xe0(%rbp), %rdi
callq 0x13080
leaq -0xf0(%rbp), %rdi
callq 0x12f90
leaq -0x78(%rbp), %rdi
callq 0x13080
leaq -0x88(%rbp), %rdi
callq 0x41ca0
leaq -0xc8(%rbp), %rdi
callq 0x12f90
leaq -0xb0(%rbp), %rdi
callq 0x12f90
leaq -0x98(%rbp), %rdi
callq 0x12f40
leaq -0x119(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0xa660
movq -0x220(%rbp), %rdx
leaq 0x341fe(%rip), %rsi     # 0x9fb4b
leaq -0x118(%rbp), %rdi
callq 0x1dd10
jmp 0x6b95b
leaq -0x141(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0xa660
movq -0x228(%rbp), %rdx
leaq 0x341f5(%rip), %rsi     # 0x9fb71
leaq -0x140(%rbp), %rdi
callq 0x1dd10
jmp 0x6b98a
movq -0x208(%rbp), %rdi
leaq -0x118(%rbp), %rsi
leaq -0x140(%rbp), %rdx
callq 0x71bc0
jmp 0x6b9a6
leaq -0x140(%rbp), %rdi
callq 0xa240
leaq -0x141(%rbp), %rdi
callq 0xa420
leaq -0x118(%rbp), %rdi
callq 0xa240
leaq -0x119(%rbp), %rdi
callq 0xa420
movb $0x0, -0x179(%rbp)
leaq -0x178(%rbp), %rdi
leaq -0x179(%rbp), %rsi
callq 0x67fd0
jmp 0x6b9f2
leaq 0x34195(%rip), %rsi     # 0x9fb8e
leaq -0x1a0(%rbp), %rdi
callq 0x68140
jmp 0x6ba07
movl $0x1f, -0x1b4(%rbp)
leaq -0x1b0(%rbp), %rdi
leaq -0x1b4(%rbp), %rsi
callq 0x67db0
jmp 0x6ba26
movl $0x15, -0x1cc(%rbp)
leaq -0x1c8(%rbp), %rdi
leaq -0x1cc(%rbp), %rsi
callq 0x67db0
jmp 0x6ba45
leaq -0x190(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
leaq -0x1b0(%rbp), %rdx
leaq -0x1c8(%rbp), %rcx
callq 0x682e0
jmp 0x6ba68
leaq 0x3411f(%rip), %rsi     # 0x9fb8e
leaq -0x168(%rbp), %rdi
leaq -0x178(%rbp), %rdx
leaq -0x190(%rbp), %rcx
callq 0x682a0
jmp 0x6ba8b
leaq -0x158(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x41ac0
movl $0x15, -0x1f4(%rbp)
leaq -0x1f0(%rbp), %rdi
leaq -0x1f4(%rbp), %rsi
callq 0x67db0
jmp 0x6babd
leaq -0x1e0(%rbp), %rdi
movq %rdi, -0x230(%rbp)
leaq -0x1f0(%rbp), %rsi
callq 0x12f60
movq -0x208(%rbp), %rdi
movq -0x230(%rbp), %rdx
leaq -0x158(%rbp), %rsi
callq 0x71cb0
jmp 0x6baf3
leaq -0x1e0(%rbp), %rdi
callq 0x13080
leaq -0x1f0(%rbp), %rdi
callq 0x12f90
leaq -0x158(%rbp), %rdi
callq 0x13080
leaq -0x168(%rbp), %rdi
callq 0x41af0
leaq -0x190(%rbp), %rdi
callq 0x41ca0
leaq -0x1c8(%rbp), %rdi
callq 0x12f90
leaq -0x1b0(%rbp), %rdi
callq 0x12f90
leaq -0x1a0(%rbp), %rdi
callq 0x41d40
leaq -0x178(%rbp), %rdi
callq 0x12f40
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bbab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bb99
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 0x6bd93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bd93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bc53
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bc47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bc3b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bc26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x13080
leaq -0xf0(%rbp), %rdi
callq 0x12f90
leaq -0x78(%rbp), %rdi
callq 0x13080
leaq -0x88(%rbp), %rdi
callq 0x41ca0
leaq -0xc8(%rbp), %rdi
callq 0x12f90
leaq -0xb0(%rbp), %rdi
callq 0x12f90
leaq -0x98(%rbp), %rdi
callq 0x12f40
jmp 0x6bd93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bcb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bc98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0xa240
leaq -0x141(%rbp), %rdi
callq 0xa420
leaq -0x118(%rbp), %rdi
callq 0xa240
leaq -0x119(%rbp), %rdi
callq 0xa420
jmp 0x6bd93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bd87
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bd7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bd6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bd63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bd57
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x6bd3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x13080
leaq -0x1f0(%rbp), %rdi
callq 0x12f90
leaq -0x158(%rbp), %rdi
callq 0x13080
leaq -0x168(%rbp), %rdi
callq 0x41af0
leaq -0x190(%rbp), %rdi
callq 0x41ca0
leaq -0x1c8(%rbp), %rdi
callq 0x12f90
leaq -0x1b0(%rbp), %rdi
callq 0x12f90
leaq -0x1a0(%rbp), %rdi
callq 0x41d40
leaq -0x178(%rbp), %rdi
callq 0x12f40
movq -0x208(%rbp), %rdi
callq 0x71f50
movq -0x38(%rbp), %rdi
callq 0xa650
nopl (%rax,%rax)