// File: /workspace/github_cpp_makefile_star2_O3/pfnet-research[P]pml/src/test.cpp
// Function: parsing_reftype_test::parsing_reftype_test()
PML_TEST(parsing_reftype_test) {
    std::unordered_map<std::string, std::string> inputs = {
        {"{x:int|true}", "Ref(x, Int, Top)"},
        {"{x:bool|x}", "Ref(x, Bool, x)"},
        {"int", "Ref(@blah, Int, Top)"},
        {"bool", "Ref(@blah, Bool, Top)"},
        {"x:int", "Ref(x, Int, Top)"},
        {"x:bool", "Ref(x, Bool, Top)"}
    };
    for (auto const& input : inputs) {
        parser::parse_reftype(input.first).case_of(
            ok >> [&](ast::refinement_type_t const& ty) {
                assert_eq(
                    ast::to_debug_string(ty),
                    input.second);
            },
            error >> [&](parser::error_t err) {
                assert_(false, format("parse error at {} : {}",
                        std::to_string(err.pos), err.message));
            });
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rdi, %rbx
movl $0x0, 0x8(%rdi)
leaq 0x2f288(%rip), %rax     # 0x61a30
movq %rax, (%rdi)
leaq 0x1870d(%rip), %rsi     # 0x4aebf
leaq 0x18713(%rip), %rdx     # 0x4aecc
leaq 0x68(%rsp), %r14
movq %r14, %rdi
callq 0x39816
leaq 0xa8(%rsp), %r15
leaq 0x1879e(%rip), %rsi     # 0x4af73
leaq 0x18701(%rip), %rdx     # 0x4aedd
movq %r15, %rdi
callq 0x39894
leaq 0xe8(%rsp), %r15
leaq 0x187c2(%rip), %rsi     # 0x4afb5
leaq 0x186f3(%rip), %rdx     # 0x4aeed
movq %r15, %rdi
callq 0x39912
leaq 0x128(%rsp), %r15
leaq 0x1870f(%rip), %rsi     # 0x4af20
leaq 0x186ea(%rip), %rdx     # 0x4af02
movq %r15, %rdi
callq 0x39990
leaq 0x168(%rsp), %r15
leaq 0x186e9(%rip), %rsi     # 0x4af18
leaq 0x18696(%rip), %rdx     # 0x4aecc
movq %r15, %rdi
callq 0x39a0e
leaq 0x1a8(%rsp), %r15
leaq 0x186d1(%rip), %rsi     # 0x4af1e
leaq 0x186d1(%rip), %rdx     # 0x4af25
movq %r15, %rdi
callq 0x39a8c
leaq 0x1e8(%rsp), %rdx
leaq 0x8(%rsp), %rax
movq %rax, (%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x20(%rsp), %r8
leaq 0x10(%rsp), %r9
xorl %ecx, %ecx
callq 0x39c5a
movq $-0x180, %r14           # imm = 0xFE80
leaq 0x1d8(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x328ab
movq (%r15), %rsi
incq %rsi
callq 0x92e0
movq -0x30(%r15), %rdi
leaq -0x20(%r15), %rax
cmpq %rdi, %rax
je 0x328c3
movq (%rax), %rsi
incq %rsi
callq 0x92e0
addq $-0x40, %r15
addq $0x40, %r14
jne 0x32897
movq 0x40(%rsp), %r14
testq %r14, %r14
je 0x32936
leaq 0x68(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x8(%r14), %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x245ac
movq %rbx, 0x20(%rsp)
movq %rbp, 0x28(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x39b40
movq %r15, %rdi
callq 0x282a8
movq (%r14), %r14
testq %r14, %r14
jne 0x328e6
leaq 0x30(%rsp), %rdi
callq 0x3a3e8
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x140, %r14d           # imm = 0x140
leaq (%rsp,%r14), %rdi
addq $0x68, %rdi
callq 0x39b0a
addq $-0x40, %r14
cmpq $-0x40, %r14
jne 0x3295b
jmp 0x329ab
movq %rax, %rbx
jmp 0x329ab
movq %rax, %rbx
addq $-0x40, %r15
movq %r15, %rdi
callq 0x39b0a
cmpq %r14, %r15
jne 0x3297c
jmp 0x329ab
movq %rax, %rbx
jmp 0x329a1
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x282a8
leaq 0x30(%rsp), %rdi
callq 0x3a3e8
movq %rbx, %rdi
callq 0x94e0
nop