// File: pfnet-research[P]pml/src/logic.cpp
// Function: logic::to_debug_string[abi:cxx11](logic::term_t const&)
std::string to_debug_string(term_t const& term) {
    switch (term.kind()) {
    case term_kind_t::Var:
        return cast<var_term_t>(term).name;
    case term_kind_t::Int:
        return std::to_string(cast<int_term_t>(term).n);
    case term_kind_t::Add:
        return "Add(" +
            to_debug_string(*cast<add_term_t>(term).lhs) + ", " +
            to_debug_string(*cast<add_term_t>(term).rhs) + ")";
    case term_kind_t::Sub:
        return "Sub(" +
            to_debug_string(*cast<sub_term_t>(term).lhs) + ", " +
            to_debug_string(*cast<sub_term_t>(term).rhs) + ")";
    case term_kind_t::Mul:
        return "Mul(" +
            to_debug_string(*cast<mul_term_t>(term).lhs) + ", " +
            to_debug_string(*cast<mul_term_t>(term).rhs) + ")";
    case term_kind_t::Div:
        return "Div(" +
            to_debug_string(*cast<div_term_t>(term).lhs) + ", " +
            to_debug_string(*cast<div_term_t>(term).rhs) + ")";
    case term_kind_t::Prob:
        return "Prob(" + to_debug_string(*cast<prob_term_t>(term).inner) + ")";
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x340, %rsp            # imm = 0x340
movq %rdi, -0x2f8(%rbp)
movq %rdi, %rax
movq %rax, -0x2f0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
movl %eax, %ecx
movq %rcx, -0x2e8(%rbp)
subl $0x6, %eax
ja 0x211f8
movq -0x2e8(%rbp), %rax
leaq 0x7b094(%rip), %rcx     # 0x9bae4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
callq 0x21220
movq -0x2f8(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0xa190
jmp 0x211fa
movq -0x10(%rbp), %rdi
callq 0x21260
movq -0x2f8(%rbp), %rdi
movl 0x8(%rax), %esi
callq 0x1e010
jmp 0x211fa
movq -0x10(%rbp), %rdi
callq 0x212a0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0x20a00
movq -0x300(%rbp), %rdx
leaq 0x7b0f8(%rip), %rsi     # 0x9bbc8
leaq -0x70(%rbp), %rdi
callq 0x12fb0
jmp 0x20adb
leaq 0x7adf1(%rip), %rdx     # 0x9b8d3
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x1ddc0
jmp 0x20af1
movq -0x10(%rbp), %rdi
callq 0x212a0
movq %rax, -0x308(%rbp)
jmp 0x20b03
movq -0x308(%rbp), %rdi
addq $0x18, %rdi
callq 0x24f80
movq %rax, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x20a00
jmp 0x20b24
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x1de10
jmp 0x20b3a
movq -0x2f8(%rbp), %rdi
leaq 0x7886a(%rip), %rdx     # 0x993b2
leaq -0x30(%rbp), %rsi
callq 0x1ddc0
jmp 0x20b53
leaq -0x30(%rbp), %rdi
callq 0xa240
leaq -0xc0(%rbp), %rdi
callq 0xa240
leaq -0x50(%rbp), %rdi
callq 0xa240
leaq -0x70(%rbp), %rdi
callq 0xa240
leaq -0x90(%rbp), %rdi
callq 0xa240
jmp 0x211fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20c14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20c0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20c02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20bf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xa240
leaq -0xc0(%rbp), %rdi
callq 0xa240
leaq -0x50(%rbp), %rdi
callq 0xa240
leaq -0x70(%rbp), %rdi
callq 0xa240
leaq -0x90(%rbp), %rdi
callq 0xa240
jmp 0x2120a
movq -0x10(%rbp), %rdi
callq 0x212e0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq %rax, %rsi
leaq -0x140(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x20a00
movq -0x310(%rbp), %rdx
leaq 0x7af6f(%rip), %rsi     # 0x9bbcd
leaq -0x120(%rbp), %rdi
callq 0x12fb0
jmp 0x20c6c
leaq 0x7ac60(%rip), %rdx     # 0x9b8d3
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x1ddc0
jmp 0x20c88
movq -0x10(%rbp), %rdi
callq 0x212e0
movq %rax, -0x318(%rbp)
jmp 0x20c9a
movq -0x318(%rbp), %rdi
addq $0x18, %rdi
callq 0x24f80
movq %rax, %rsi
leaq -0x160(%rbp), %rdi
callq 0x20a00
jmp 0x20cbb
leaq -0xe0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0x160(%rbp), %rdx
callq 0x1de10
jmp 0x20cd7
movq -0x2f8(%rbp), %rdi
leaq 0x786cd(%rip), %rdx     # 0x993b2
leaq -0xe0(%rbp), %rsi
callq 0x1ddc0
jmp 0x20cf3
leaq -0xe0(%rbp), %rdi
callq 0xa240
leaq -0x160(%rbp), %rdi
callq 0xa240
leaq -0x100(%rbp), %rdi
callq 0xa240
leaq -0x120(%rbp), %rdi
callq 0xa240
leaq -0x140(%rbp), %rdi
callq 0xa240
jmp 0x211fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20dc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20dba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20dae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20da2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0xa240
leaq -0x160(%rbp), %rdi
callq 0xa240
leaq -0x100(%rbp), %rdi
callq 0xa240
leaq -0x120(%rbp), %rdi
callq 0xa240
leaq -0x140(%rbp), %rdi
callq 0xa240
jmp 0x2120a
movq -0x10(%rbp), %rdi
callq 0x21320
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq %rax, %rsi
leaq -0x1e0(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x20a00
movq -0x320(%rbp), %rdx
leaq 0x7adc2(%rip), %rsi     # 0x9bbd2
leaq -0x1c0(%rbp), %rdi
callq 0x12fb0
jmp 0x20e1e
leaq 0x7aaae(%rip), %rdx     # 0x9b8d3
leaq -0x1a0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x1ddc0
jmp 0x20e3a
movq -0x10(%rbp), %rdi
callq 0x21320
movq %rax, -0x328(%rbp)
jmp 0x20e4c
movq -0x328(%rbp), %rdi
addq $0x18, %rdi
callq 0x24f80
movq %rax, %rsi
leaq -0x200(%rbp), %rdi
callq 0x20a00
jmp 0x20e6d
leaq -0x180(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
leaq -0x200(%rbp), %rdx
callq 0x1de10
jmp 0x20e89
movq -0x2f8(%rbp), %rdi
leaq 0x7851b(%rip), %rdx     # 0x993b2
leaq -0x180(%rbp), %rsi
callq 0x1ddc0
jmp 0x20ea5
leaq -0x180(%rbp), %rdi
callq 0xa240
leaq -0x200(%rbp), %rdi
callq 0xa240
leaq -0x1a0(%rbp), %rdi
callq 0xa240
leaq -0x1c0(%rbp), %rdi
callq 0xa240
leaq -0x1e0(%rbp), %rdi
callq 0xa240
jmp 0x211fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20f78
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20f6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20f60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x20f54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0xa240
leaq -0x200(%rbp), %rdi
callq 0xa240
leaq -0x1a0(%rbp), %rdi
callq 0xa240
leaq -0x1c0(%rbp), %rdi
callq 0xa240
leaq -0x1e0(%rbp), %rdi
callq 0xa240
jmp 0x2120a
movq -0x10(%rbp), %rdi
callq 0x21360
movq %rax, %rdi
addq $0x8, %rdi
callq 0x24f80
movq %rax, %rsi
leaq -0x280(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x20a00
movq -0x330(%rbp), %rdx
leaq 0x7ac15(%rip), %rsi     # 0x9bbd7
leaq -0x260(%rbp), %rdi
callq 0x12fb0
jmp 0x20fd0
leaq 0x7a8fc(%rip), %rdx     # 0x9b8d3
leaq -0x240(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x1ddc0
jmp 0x20fec
movq -0x10(%rbp), %rdi
callq 0x21360
movq %rax, -0x338(%rbp)
jmp 0x20ffe
movq -0x338(%rbp), %rdi
addq $0x18, %rdi
callq 0x24f80
movq %rax, %rsi
leaq -0x2a0(%rbp), %rdi
callq 0x20a00
jmp 0x2101f
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
leaq -0x2a0(%rbp), %rdx
callq 0x1de10
jmp 0x2103b
movq -0x2f8(%rbp), %rdi
leaq 0x78369(%rip), %rdx     # 0x993b2
leaq -0x220(%rbp), %rsi
callq 0x1ddc0
jmp 0x21057
leaq -0x220(%rbp), %rdi
callq 0xa240
leaq -0x2a0(%rbp), %rdi
callq 0xa240
leaq -0x240(%rbp), %rdi
callq 0xa240
leaq -0x260(%rbp), %rdi
callq 0xa240
leaq -0x280(%rbp), %rdi
callq 0xa240
jmp 0x211fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x2112a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x2111e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x21112
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x21106
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0xa240
leaq -0x2a0(%rbp), %rdi
callq 0xa240
leaq -0x240(%rbp), %rdi
callq 0xa240
leaq -0x260(%rbp), %rdi
callq 0xa240
leaq -0x280(%rbp), %rdi
callq 0xa240
jmp 0x2120a
movq -0x10(%rbp), %rdi
callq 0x22220
movq %rax, %rdi
addq $0x8, %rdi
callq 0x115e0
movq %rax, %rsi
leaq -0x2e0(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x213a0
movq -0x340(%rbp), %rdx
leaq 0x7aa68(%rip), %rsi     # 0x9bbdc
leaq -0x2c0(%rbp), %rdi
callq 0x12fb0
jmp 0x21182
movq -0x2f8(%rbp), %rdi
leaq 0x78222(%rip), %rdx     # 0x993b2
leaq -0x2c0(%rbp), %rsi
callq 0x1ddc0
jmp 0x2119e
leaq -0x2c0(%rbp), %rdi
callq 0xa240
leaq -0x2e0(%rbp), %rdi
callq 0xa240
jmp 0x211fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x211ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0xa240
leaq -0x2e0(%rbp), %rdi
callq 0xa240
jmp 0x2120a
ud2
movq -0x2f0(%rbp), %rax
addq $0x340, %rsp            # imm = 0x340
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0xa650
nopw %cs:(%rax,%rax)