// File: pfnet-research[P]pml/src/test.cpp
// Function: typecheck_test::typecheck_test()
PML_TEST(typecheck_test) {
    using namespace typechecker;
    assert_(
        typecheck(ast::let_expr_t{ "a",
            make<ast::rand_expr_t>(0, 1),
            make<ast::typed_expr_t>(
                    make<ast::var_expr_t>("a"),
                    ast::refinement_type_t{
                            "x", logic::domain_kind_t::Int,
                            make<logic::eq_formula_t>(
                                    make<logic::prob_term_t>(
                                        make<logic::eq_formula_t>(
                                            make<logic::var_term_t>("x"),
                                            make<logic::int_term_t>(0))),
                                    make<logic::div_term_t>(
                                        make<logic::int_term_t>(1),
                                        make<logic::int_term_t>(2)))})
        }),
        "can not type `let a = rand(0, 1) in a : {x:int | Prob(x=0) = 1/2}`");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x71f20
movq -0x1f0(%rbp), %rax
leaq 0x7577b(%rip), %rcx     # 0xe6c48
movq %rcx, (%rax)
leaq -0x71(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0xa660
movq -0x1e8(%rbp), %rdx
leaq 0x2e571(%rip), %rsi     # 0x9fa5f
leaq -0x70(%rbp), %rdi
callq 0x1dd10
jmp 0x714f9
movl $0x0, -0xac(%rbp)
movl $0x1, -0xb0(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xac(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x68360
jmp 0x71529
leaq -0x98(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x41cc0
leaq 0x2e51c(%rip), %rsi     # 0x9fa5f
leaq -0xe0(%rbp), %rdi
callq 0x68140
jmp 0x71551
leaq -0x118(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0x119(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0xa660
movq -0x200(%rbp), %rdi
movq -0x1f8(%rbp), %rdx
leaq 0x2e607(%rip), %rsi     # 0x9fb8e
callq 0x1dd10
jmp 0x7158e
movb $0x1, -0x1b5(%rbp)
movl $0x0, -0xf8(%rbp)
leaq -0xf0(%rbp), %rax
movq %rax, -0x208(%rbp)
leaq 0x2e5da(%rip), %rsi     # 0x9fb8e
leaq -0x160(%rbp), %rdi
callq 0x69110
jmp 0x715c2
movl $0x0, -0x174(%rbp)
leaq -0x170(%rbp), %rdi
leaq -0x174(%rbp), %rsi
callq 0x68d00
jmp 0x715e1
leaq -0x150(%rbp), %rdi
leaq -0x160(%rbp), %rsi
leaq -0x170(%rbp), %rdx
callq 0x690d0
jmp 0x715fd
leaq -0x140(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x690a0
jmp 0x71612
movl $0x1, -0x19c(%rbp)
leaq -0x198(%rbp), %rdi
leaq -0x19c(%rbp), %rsi
callq 0x68d00
jmp 0x71631
movl $0x2, -0x1b4(%rbp)
leaq -0x1b0(%rbp), %rdi
leaq -0x1b4(%rbp), %rsi
callq 0x68d00
jmp 0x71650
leaq -0x188(%rbp), %rdi
leaq -0x198(%rbp), %rsi
leaq -0x1b0(%rbp), %rdx
callq 0x68cc0
jmp 0x7166c
leaq -0x130(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0x188(%rbp), %rdx
callq 0x69060
jmp 0x71688
movq -0x208(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x252f0
movb $0x0, -0x1b5(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0x118(%rbp), %rdx
callq 0x69020
jmp 0x716be
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x210(%rbp)
leaq -0xd0(%rbp), %rsi
callq 0x41e70
movq -0x210(%rbp), %rcx
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x4a510
jmp 0x716f5
leaq -0x50(%rbp), %rdi
callq 0x97870
movb %al, -0x211(%rbp)
jmp 0x71706
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0xa660
movq -0x220(%rbp), %rdx
leaq 0x2e7b7(%rip), %rsi     # 0x9fede
leaq -0x1d8(%rbp), %rdi
callq 0x1dd10
jmp 0x71735
movq -0x1f0(%rbp), %rdi
movb -0x211(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
leaq -0x1d8(%rbp), %rdx
callq 0x722d0
jmp 0x71756
leaq -0x1d8(%rbp), %rdi
callq 0xa240
leaq -0x1d9(%rbp), %rdi
callq 0xa420
leaq -0x50(%rbp), %rdi
callq 0x4a5b0
leaq -0xc0(%rbp), %rdi
callq 0x13080
leaq -0xd0(%rbp), %rdi
callq 0x41ea0
leaq -0x118(%rbp), %rdi
callq 0x16120
leaq -0x130(%rbp), %rdi
callq 0x25320
leaq -0x188(%rbp), %rdi
callq 0x250f0
leaq -0x1b0(%rbp), %rdi
callq 0x40a10
leaq -0x198(%rbp), %rdi
callq 0x40a10
leaq -0x140(%rbp), %rdi
callq 0x25140
leaq -0x150(%rbp), %rdi
callq 0x25320
leaq -0x170(%rbp), %rdi
callq 0x40a10
leaq -0x160(%rbp), %rdi
callq 0x407a0
leaq -0x119(%rbp), %rdi
callq 0xa420
leaq -0xe0(%rbp), %rdi
callq 0x41d40
leaq -0x98(%rbp), %rdi
callq 0x13080
leaq -0xa8(%rbp), %rdi
callq 0x41cf0
leaq -0x70(%rbp), %rdi
callq 0xa240
leaq -0x71(%rbp), %rdi
callq 0xa420
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x71a80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x71a77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x71a5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x71a47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x71a2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x71a22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x71a16
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x71a0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x719fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x719f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x719e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x719da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x719c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x719aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x719a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x71995
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0xa240
leaq -0x1d9(%rbp), %rdi
callq 0xa420
leaq -0x50(%rbp), %rdi
callq 0x4a5b0
leaq -0xc0(%rbp), %rdi
callq 0x13080
leaq -0xd0(%rbp), %rdi
callq 0x41ea0
leaq -0x118(%rbp), %rdi
callq 0x16120
leaq -0x130(%rbp), %rdi
callq 0x25320
leaq -0x188(%rbp), %rdi
callq 0x250f0
leaq -0x1b0(%rbp), %rdi
callq 0x40a10
leaq -0x198(%rbp), %rdi
callq 0x40a10
leaq -0x140(%rbp), %rdi
callq 0x25140
leaq -0x150(%rbp), %rdi
callq 0x25320
leaq -0x170(%rbp), %rdi
callq 0x40a10
leaq -0x160(%rbp), %rdi
callq 0x407a0
testb $0x1, -0x1b5(%rbp)
jne 0x71a39
jmp 0x71a45
movq -0x200(%rbp), %rdi
callq 0xa240
jmp 0x71a47
leaq -0x119(%rbp), %rdi
callq 0xa420
leaq -0xe0(%rbp), %rdi
callq 0x41d40
leaq -0x98(%rbp), %rdi
callq 0x13080
leaq -0xa8(%rbp), %rdi
callq 0x41cf0
leaq -0x70(%rbp), %rdi
callq 0xa240
leaq -0x71(%rbp), %rdi
callq 0xa420
movq -0x1f0(%rbp), %rdi
callq 0x71f80
movq -0x80(%rbp), %rdi
callq 0xa650
nop