// File: pfnet-research[P]pml/src/simple_type.cpp
// Function: simty::to_debug_string[abi:cxx11](simty::type_t const&)
std::string to_debug_string(type_t const& ty) {
    switch (ty.kind()) {
    case simty::kind_t::Int:
        return "Int";
    case simty::kind_t::Bool:
        return "Bool";
    case simty::kind_t::Fun: {
        auto const& fun_ty = cast<fun_type_t>(ty);
        std::string result = "(" + to_debug_string(*fun_ty.args[0]);
        for (size_t i=1; i<fun_ty.args.size(); ++i)
            result += ", " + to_debug_string(*fun_ty.args[i]);
        result += ") -> ";
        result += to_debug_string(*fun_ty.ret);
        return result;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xd8(%rbp)
movq %rdi, %rax
movq %rax, -0xd0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
movl %eax, %ecx
movl %ecx, -0xc4(%rbp)
testl %eax, %eax
je 0x5e94f
jmp 0x5e92e
movl -0xc4(%rbp), %eax
subl $0x1, %eax
je 0x5e9a3
jmp 0x5e93b
movl -0xc4(%rbp), %eax
subl $0x2, %eax
je 0x5e9f7
jmp 0x5ebfc
leaq -0x11(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0xa660
movq -0xd8(%rbp), %rdi
movq -0xe0(%rbp), %rdx
leaq 0x3cf3f(%rip), %rsi     # 0x9b8b3
callq 0x1dd10
jmp 0x5e97b
leaq -0x11(%rbp), %rdi
callq 0xa420
jmp 0x5ebfe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x11(%rbp), %rdi
callq 0xa420
jmp 0x5ec0e
leaq -0x25(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0xa660
movq -0xd8(%rbp), %rdi
movq -0xe8(%rbp), %rdx
leaq 0x3ceef(%rip), %rsi     # 0x9b8b7
callq 0x1dd10
jmp 0x5e9cf
leaq -0x25(%rbp), %rdi
callq 0xa420
jmp 0x5ebfe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x25(%rbp), %rdi
callq 0xa420
jmp 0x5ec0e
movq -0x10(%rbp), %rdi
callq 0x5e340
movq %rax, -0x30(%rbp)
movb $0x0, -0x31(%rbp)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5fb00
movq %rax, %rdi
callq 0x5f9e0
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x5e8f0
movq -0xd8(%rbp), %rdi
movq -0xf0(%rbp), %rdx
leaq 0x3d21a(%rip), %rsi     # 0x9bc63
callq 0x12fb0
jmp 0x5ea50
leaq -0x58(%rbp), %rdi
callq 0xa240
movq $0x1, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
callq 0x5fae0
movq %rax, %rcx
movq -0xf8(%rbp), %rax
cmpq %rcx, %rax
jae 0x5eb66
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movq -0x60(%rbp), %rsi
callq 0x5fb00
movq %rax, %rdi
callq 0x5f9e0
movq %rax, %rsi
leaq -0xa0(%rbp), %rdi
callq 0x5e8f0
jmp 0x5eab6
leaq 0x3ce16(%rip), %rsi     # 0x9b8d3
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x12fb0
jmp 0x5eacf
movq -0xd8(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xa4e0
jmp 0x5eae1
leaq -0x80(%rbp), %rdi
callq 0xa240
leaq -0xa0(%rbp), %rdi
callq 0xa240
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x5ea61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xa240
jmp 0x5ec0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x5ebee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x5eb55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xa240
leaq -0xa0(%rbp), %rdi
callq 0xa240
jmp 0x5ebee
movq -0xd8(%rbp), %rdi
leaq 0x3eb75(%rip), %rsi     # 0x9d6e9
callq 0xa380
jmp 0x5eb7b
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
callq 0x5f9e0
movq %rax, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x5e8f0
jmp 0x5eb99
movq -0xd8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xa4e0
jmp 0x5ebae
leaq -0xc0(%rbp), %rdi
callq 0xa240
movb $0x1, -0x31(%rbp)
testb $0x1, -0x31(%rbp)
jne 0x5ebec
jmp 0x5ebe0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0xa240
jmp 0x5ebee
movq -0xd8(%rbp), %rdi
callq 0xa240
jmp 0x5ebfe
movq -0xd8(%rbp), %rdi
callq 0xa240
jmp 0x5ec0e
ud2
movq -0xd0(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0xa650
nopw (%rax,%rax)