// File: /workspace/github_cpp_makefile_star2_O1/pfnet-research[P]pml/src/test.cpp
// Function: letfun_test::letfun_test()
PML_CUSTOM_TEST(letfun_test, lang_feature_test) {
    using namespace ast;
    parse_test("letfun plus4 (a:int, b:int) -> int = a+4 in plus4 (1+3) 0", "LetFun(plus4, [a, b], Add(a, 4), App(plus4, [Add(1, 3), 0]))");
    eval_test(
            make<letfun_expr_t>("plus4",
                dependent_type_t {
                    {
                        refinement_type_t{"a",
                            logic::domain_kind_t::Int,
                            make<logic::top_formula_t>()},
                        refinement_type_t{"b",
                            logic::domain_kind_t::Int,
                            make<logic::top_formula_t>()}
                    },
                    refinement_type_t {"@blah",
                        logic::domain_kind_t::Int,
                        make<logic::top_formula_t>()
                    }
                },
                make<add_expr_t>(
                    make<var_expr_t>("a"),
                    make<int_expr_t>(4)),
                make<app_expr_t>(
                    make<var_expr_t>("plus4"),
                    std::vector<ptr<expr_t>>{
                        make<add_expr_t>(
                                make<int_expr_t>(1),
                                make<int_expr_t>(3)),
                        make<int_expr_t>(0)
                        })),
            make<int_expr_t>(8));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, %r13
movl $0x0, 0x8(%rdi)
leaq 0x32a14(%rip), %rax     # 0x626c8
movq %rax, (%rdi)
leaq 0x140(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1af4c(%rip), %rsi     # 0x4ac16
leaq 0x1af7e(%rip), %rdx     # 0x4ac4f
leaq 0x130(%rsp), %rdi
callq 0x11866
leaq 0xb0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1af5f(%rip), %rsi     # 0x4ac50
leaq 0x1af94(%rip), %rdx     # 0x4ac8c
leaq 0xa0(%rsp), %rdi
callq 0x11866
leaq 0x130(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
movq %r13, %rdi
callq 0x35a02
movq 0xa0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2fd3a
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x92e0
movq 0x130(%rsp), %rdi
cmpq %r14, %rdi
je 0x2fd57
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x130(%rsp), %r12
movq %r14, (%r12)
leaq 0x1aea1(%rip), %rsi     # 0x4ac0b
leaq 0x1ae9b(%rip), %rdx     # 0x4ac0c
movq %r12, %rdi
callq 0x11866
movl $0x0, 0x150(%rsp)
movl $0x18, %edi
callq 0x92d0
movabsq $0x100000001, %rbx      # imm = 0x100000001
movq %rbx, 0x8(%rax)
leaq 0x31b85(%rip), %r15     # 0x61928
movq %r15, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x31bc4(%rip), %r12     # 0x61978
movq %r12, 0x10(%rax)
leaq 0x168(%rsp), %r14
movq %rcx, -0x10(%r14)
movq %rax, -0x8(%r14)
leaq 0x178(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x184f7(%rip), %rsi     # 0x482d2
leaq 0x184f1(%rip), %rdx     # 0x482d3
movq %r14, %rdi
callq 0x11866
movl $0x0, 0x188(%rsp)
movl $0x18, %edi
callq 0x92d0
movq %rbx, 0x8(%rax)
movq %r15, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq %r12, 0x10(%rax)
leaq 0x130(%rsp), %rsi
movq %rcx, 0x60(%rsi)
movq %rax, 0x68(%rsi)
leaq 0xa0(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x2, %edx
callq 0x374a6
leaq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x18545(%rip), %rsi     # 0x48398
leaq 0x18543(%rip), %rdx     # 0x4839d
callq 0x11866
movl $0x0, 0xd8(%rsp)
movl $0x18, %edi
callq 0x92d0
movq %rbx, 0x8(%rax)
movq %r15, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq %r12, 0x10(%rax)
movq %rcx, 0xe0(%rsp)
movq %rax, 0xe8(%rsp)
leaq 0x88(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x1ad5e(%rip), %rcx     # 0x4ac0b
leaq 0x80(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x37386
movq $0x0, 0x110(%rsp)
movl $0x20, %edi
callq 0x92d0
movq %rbx, 0x8(%rax)
leaq 0x30be0(%rip), %r12     # 0x60ac0
movq %r12, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x30c1f(%rip), %r15     # 0x60b10
movq %r15, 0x10(%rax)
movl $0x4, 0x18(%rax)
leaq 0x110(%rsp), %r8
movq %rax, 0x8(%r8)
movq %rcx, (%r8)
leaq 0x98(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x90(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x80(%rsp), %rcx
callq 0x37280
leaq 0x78(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x1ad44(%rip), %rcx     # 0x4ac8d
leaq 0x70(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x3794e
movq $0x0, 0x40(%rsp)
movl $0x20, %edi
callq 0x92d0
movq %rbx, 0x8(%rax)
movq %r12, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq %r15, 0x10(%rax)
movl $0x1, 0x18(%rax)
movq %rax, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq $0x0, 0xf0(%rsp)
movl $0x20, %edi
callq 0x92d0
movq %rbx, 0x8(%rax)
movq %r12, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq %r15, 0x10(%rax)
movl $0x3, 0x18(%rax)
leaq 0xf0(%rsp), %r8
movq %rax, 0x8(%r8)
movq %rcx, (%r8)
leaq 0x58(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x50(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0x36c98
movups 0x50(%rsp), %xmm0
movups %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rsp)
movl $0x20, %edi
callq 0x92d0
movq %r13, %rbx
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
movq %r12, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq %r15, 0x10(%rax)
movl $0x0, 0x18(%rax)
leaq 0x10(%rsp), %rsi
movq %rcx, 0x10(%rsi)
movq %rax, 0x18(%rsi)
leaq 0x1a0(%rsp), %rdi
leaq 0xe(%rsp), %rcx
movl $0x2, %edx
callq 0x374ee
leaq 0x108(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x100(%rsp), %r13
leaq 0x30(%rsp), %rdx
leaq 0x70(%rsp), %rcx
leaq 0x1a0(%rsp), %r8
movq %r13, %rsi
callq 0x3786c
leaq 0x68(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r13, (%rsp)
leaq 0x1abf0(%rip), %rcx     # 0x4ac8d
leaq 0x60(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0xa0(%rsp), %r8
leaq 0x90(%rsp), %r9
callq 0x37572
movups 0x60(%rsp), %xmm0
movups %xmm0, 0x120(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rsp)
movl $0x20, %edi
callq 0x92d0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
movq %r12, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq %r15, 0x10(%rax)
movl $0x8, 0x18(%rax)
leaq 0x30(%rsp), %rdx
movq %rcx, (%rdx)
movq %rax, 0x8(%rdx)
leaq 0x120(%rsp), %rsi
movq %rbx, %rdi
callq 0x35a7c
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x30129
callq 0xaa12
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x3013b
callq 0xaa12
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x3014a
callq 0xaa12
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x3015c
callq 0xaa12
leaq 0x1a0(%rsp), %rdi
callq 0x24fd6
movl $0x20, %ebx
movq 0x8(%rsp,%rbx), %rdi
testq %rdi, %rdi
je 0x3017d
callq 0xaa12
addq $-0x10, %rbx
jne 0x3016e
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x30192
callq 0xaa12
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x301a4
callq 0xaa12
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x301b3
callq 0xaa12
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x301c2
callq 0xaa12
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x301d4
callq 0xaa12
movq 0x118(%rsp), %rdi
testq %rdi, %rdi
je 0x301e6
callq 0xaa12
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x301f8
callq 0xaa12
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x3020a
callq 0xaa12
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x3022f
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0xa0(%rsp), %rdi
callq 0xcf76
xorl %ebx, %ebx
movq 0x198(%rsp,%rbx), %rdi
testq %rdi, %rdi
je 0x30250
callq 0xaa12
movq 0x168(%rsp,%rbx), %rdi
leaq (%rbx,%rbp), %rax
cmpq %rdi, %rax
je 0x30271
movq 0x178(%rsp,%rbx), %rsi
incq %rsi
callq 0x92e0
addq $-0x38, %rbx
cmpq $-0x70, %rbx
jne 0x3023e
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x302a4
callq 0xaa12
jmp 0x302a4
movq %rax, %r15
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x302b6
callq 0xaa12
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x302ca
callq 0xaa12
jmp 0x302ca
movq %rax, %r15
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x302e1
callq 0xaa12
jmp 0x302e1
movq %rax, %r15
leaq 0x1a0(%rsp), %rdi
callq 0x24fd6
jmp 0x302f3
movq %rax, %r15
movl $0x20, %ebx
movq 0x8(%rsp,%rbx), %rdi
testq %rdi, %rdi
je 0x30307
callq 0xaa12
addq $-0x10, %rbx
jne 0x302f8
movb $0x1, %r12b
leaq 0x20(%rsp), %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x30339
callq 0xaa12
jmp 0x30339
movq %rax, %r15
xorl %r12d, %r12d
jmp 0x30310
movq %rax, %r15
leaq 0x10(%rsp), %rbx
xorl %r12d, %r12d
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x30358
callq 0xaa12
jmp 0x30358
movq %rax, %r15
leaq 0x10(%rsp), %rbx
xorl %r12d, %r12d
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x30374
callq 0xaa12
jmp 0x30374
movq %rax, %r15
xorl %r12d, %r12d
leaq 0x10(%rsp), %rbx
leaq 0x10(%rsp), %rax
cmpq %rbx, %rax
sete %al
orb %r12b, %al
jne 0x303a0
leaq 0x10(%rsp), %r12
movq -0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x30397
callq 0xaa12
addq $-0x10, %rbx
cmpq %r12, %rbx
jne 0x30389
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x303af
callq 0xaa12
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x303c1
callq 0xaa12
movq 0x118(%rsp), %rdi
testq %rdi, %rdi
je 0x303d3
callq 0xaa12
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x303e5
callq 0xaa12
leaq 0xa0(%rsp), %rdi
callq 0x24e60
xorl %ebx, %ebx
testb %bl, %bl
je 0x3043f
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x3043f
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x3043f
movq %rax, %r15
jmp 0x303af
movq %rax, %r15
jmp 0x303c1
movq %rax, %r15
jmp 0x303d3
movq %rax, %r15
jmp 0x303e5
movq %rax, %r15
movb $0x1, %bl
jmp 0x303f4
movq %rax, %r15
movb $0x1, %bl
testb %bl, %bl
je 0x30450
leaq 0xa0(%rsp), %rdi
callq 0xcf76
movl $0x38, %ebx
leaq (%rsp,%rbx), %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x24c5c
addq $-0x38, %rbx
cmpq $-0x38, %rbx
jne 0x30455
xorl %ebx, %ebx
testb %bl, %bl
je 0x30492
movq 0x168(%rsp), %rdi
cmpq %rbp, %rdi
je 0x30492
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x92e0
xorl %eax, %eax
testb %al, %al
je 0x304bd
movq 0x130(%rsp), %rdi
leaq 0x140(%rsp), %rax
cmpq %rax, %rdi
je 0x304bd
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x130(%rsp), %rax
cmpq %r14, %rax
sete %al
xorb $0x1, %bl
orb %al, %bl
jne 0x304eb
leaq 0x130(%rsp), %rbx
addq $-0x38, %r14
movq %r14, %rdi
callq 0x24c5c
cmpq %rbx, %r14
jne 0x304da
movq %r15, %rdi
callq 0x94e0
movq %rax, %r15
jmp 0x30450
movq %rax, %r15
movb $0x1, %bl
jmp 0x30471
movq %rax, %r15
movb $0x1, %bl
jmp 0x30492
movq %rax, %r15
movb $0x1, %al
leaq 0x130(%rsp), %r14
movb $0x1, %bl
jmp 0x30494
movq %rax, %r15
movb $0x1, %bl
movq %r12, %r14
jmp 0x304bd
movq %rax, %r15
movq 0xa0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x3054f
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x3054f
movq %rax, %r15
movq 0x130(%rsp), %rdi
cmpq %r14, %rdi
je 0x304eb
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x304eb
movq %rax, %r15
jmp 0x304eb
nop