// File: /workspace/github_cpp_makefile_star2_O2/pfnet-research[P]pml/src/expr_ast.cpp
// Function: ast::to_debug_string[abi:cxx11](ast::expr_t const&)
std::string to_debug_string(expr_t const& e) {
    switch (e.kind()) {
    case expr_kind_t::Let: {
            auto const& let = cast<let_expr_t>(e);
            return "Let(" +
                let.name + ", " +
                to_debug_string(*let.init) + ", " +
                to_debug_string(*let.body) + ")";
        }
    case expr_kind_t::LetFun: {
            auto const& letfun = cast<letfun_expr_t>(e);
            std::string args = letfun.type.args[0].name;
            for (size_t i=1; i<letfun.type.args.size(); ++i)
                args += ", " + letfun.type.args[i].name;
            auto init = to_debug_string(*letfun.init);
            auto body = to_debug_string(*letfun.body);
            return format("LetFun({}, [{}], {}, {})",
                    letfun.name, args, init, body);
        }
    case expr_kind_t::If: {
            auto const& if_expr = cast<if_expr_t>(e);
            return "If(" +
                to_debug_string(*if_expr.cond_expr) + ", " +
                to_debug_string(*if_expr.true_expr) + ", " +
                to_debug_string(*if_expr.false_expr) + ")";
        }
    case expr_kind_t::App: {
            auto const& app_expr = cast<app_expr_t>(e);
            auto f = to_debug_string(*app_expr.f);
            std::string args = to_debug_string(*app_expr.args[0]);
            for (size_t i=1; i<app_expr.args.size(); ++i) {
                args += ", " + to_debug_string(*app_expr.args[i]);
            }
            return format("App({}, [{}])", f, args);
        }
    case expr_kind_t::Rand: {
            auto const& rand_expr = cast<rand_expr_t>(e);
            return "Rand(" +
                std::to_string(rand_expr.start) + ", " +
                std::to_string(rand_expr.end) + ")";
        }
    case expr_kind_t::Eq:  case expr_kind_t::Neq:
    case expr_kind_t::Leq: case expr_kind_t::Geq:
    case expr_kind_t::Add: case expr_kind_t::Sub:
    case expr_kind_t::Mul: case expr_kind_t::Div:
    case expr_kind_t::And: case expr_kind_t::Or:  {
            auto const& binop_expr = cast<binop_expr_t>(e);
            return to_string(binop_expr.kind()) + "(" +
                to_debug_string(*binop_expr.lhs) + ", " +
                to_debug_string(*binop_expr.rhs) + ")";
        }
    case expr_kind_t::Neg:
        return "Neg(" + to_debug_string(*cast<neg_expr_t>(e).inner) + ")";
    case expr_kind_t::Typed: {
            auto const& typed_expr = cast<typed_expr_t>(e);
            return "Typed(" +
                to_debug_string(*typed_expr.expr) + ", " +
                to_debug_string(typed_expr.type) + ")";
        }
    case expr_kind_t::Int:
        return std::to_string(cast<int_expr_t>(e).n);
    case expr_kind_t::Bool:
        if (cast<bool_expr_t>(e).b)
            return "true";
        else
            return "false";
    case expr_kind_t::Var:
        return cast<var_expr_t>(e).name;
    default:
        throw std::logic_error{"invalid expr to make debug string : " + std::to_string(static_cast<int>(e.kind()))};
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %r15
movq %rdi, %rbx
movq (%rsi), %rax
movq %rsi, %rdi
callq *(%rax)
cmpl $0x14, %eax
ja 0xe1ad
movl %eax, %eax
leaq 0x2a8fd(%rip), %rcx     # 0x383dc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r15, %rdi
callq 0xda04
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
callq *(%rax)
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movl %eax, %esi
callq 0xd430
leaq 0x2ad0f(%rip), %rdx     # 0x38823
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0xeb69
movq 0x8(%r14), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xdaae
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0xeb88
leaq 0x2a947(%rip), %rdx     # 0x38497
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xeb69
movq 0x18(%r14), %rsi
leaq 0xa8(%rsp), %rdi
callq 0xdaae
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0xeb88
leaq 0x287fd(%rip), %rdx     # 0x36389
movq %rsp, %rsi
movq %rbx, %rdi
callq 0xeb69
movq %rsp, %rdi
callq 0x9130
leaq 0xa8(%rsp), %rdi
callq 0x9130
leaq 0x20(%rsp), %rdi
callq 0x9130
leaq 0x40(%rsp), %rdi
callq 0x9130
leaq 0xc8(%rsp), %rdi
callq 0x9130
leaq 0x60(%rsp), %rdi
callq 0x9130
leaq 0x80(%rsp), %rdi
callq 0x9130
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4be78(%rip), %rsi     # 0x59a78
leaq 0x4c041(%rip), %rdx     # 0x59c48
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x9330
testq %rax, %rax
je 0xe1a8
addq $0x8, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x93a0
jmp 0xdbe4
movq %r15, %rdi
callq 0xd9e2
movq %rax, %r14
movl 0x8(%rax), %esi
leaq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0xec65
leaq 0x2a878(%rip), %rsi     # 0x384c5
leaq 0x40(%rsp), %rdi
movq %r15, %rdx
callq 0xb97b
leaq 0x2a836(%rip), %rdx     # 0x38497
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xeb69
movl 0xc(%r14), %esi
leaq 0x80(%rsp), %rdi
callq 0xec65
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq 0xeb88
leaq 0x286ec(%rip), %rdx     # 0x36389
movq %rsp, %rsi
movq %rbx, %rdi
callq 0xeb69
jmp 0xde76
movq %rbx, 0xa0(%rsp)
movq %r15, %rdi
callq 0xd972
movq %rax, %r14
movq 0x28(%rax), %rsi
movq %rsp, %rdi
callq 0x93a0
pushq $0x1
popq %rbx
pushq $0x38
popq %r15
leaq 0x2a7bd(%rip), %r12     # 0x38497
leaq 0x20(%rsp), %r13
movq %r15, %rbp
movq 0x28(%r14), %rcx
movq 0x30(%r14), %rax
subq %rcx, %rax
cqto
idivq %r15
cmpq %rax, %rbx
jae 0xe0d5
addq %rbp, %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rcx, %rdx
callq 0xebef
movq %rsp, %rdi
movq %r13, %rsi
callq 0x9540
movq %r13, %rdi
callq 0x9130
incq %rbx
addq $0x38, %rbp
jmp 0xdce2
movq %r15, %rdi
callq 0xd950
movq %rax, %r14
leaq 0x8(%rax), %rdx
leaq 0x2a754(%rip), %rsi     # 0x38492
leaq 0x80(%rsp), %r15
movq %r15, %rdi
callq 0xebef
leaq 0x2a742(%rip), %rdx     # 0x38497
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0xeb69
movq 0x28(%r14), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xdaae
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0xeb88
leaq 0x2a706(%rip), %rdx     # 0x38497
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xeb69
movq 0x38(%r14), %rsi
leaq 0xa8(%rsp), %rdi
callq 0xdaae
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0xeb88
leaq 0x285bc(%rip), %rdx     # 0x36389
movq %rsp, %rsi
movq %rbx, %rdi
callq 0xeb69
jmp 0xdb97
movq %r15, %rdi
callq 0xda6a
movl 0x8(%rax), %esi
movq %rbx, %rdi
callq 0xec65
jmp 0xdbe4
movq %r15, %rdi
callq 0xda48
movq %rax, %r14
movq 0x8(%rax), %rsi
leaq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0xdaae
leaq 0x2a6b8(%rip), %rsi     # 0x384d0
leaq 0x40(%rsp), %rdi
movq %r15, %rdx
callq 0xb97b
leaq 0x2a66b(%rip), %rdx     # 0x38497
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xeb69
addq $0x18, %r14
leaq 0x80(%rsp), %rdi
movq %r14, %rsi
callq 0x34dea
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq 0xeb88
leaq 0x2851e(%rip), %rdx     # 0x36389
movq %rsp, %rsi
movq %rbx, %rdi
callq 0xeb69
movq %rsp, %rdi
callq 0x9130
leaq 0x80(%rsp), %rdi
callq 0x9130
leaq 0x20(%rsp), %rdi
callq 0x9130
leaq 0x40(%rsp), %rdi
callq 0x9130
leaq 0x60(%rsp), %rdi
jmp 0xdbdf
movq %r15, %rdi
callq 0xda26
movq 0x8(%rax), %rsi
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0xdaae
leaq 0x2a602(%rip), %rsi     # 0x384cb
movq %rsp, %rdi
movq %r14, %rdx
callq 0xb97b
leaq 0x284ae(%rip), %rdx     # 0x36389
movq %rsp, %rsi
movq %rbx, %rdi
callq 0xeb69
movq %rsp, %rdi
callq 0x9130
leaq 0x20(%rsp), %rdi
jmp 0xdbdf
movq %r15, %rdi
callq 0xd994
movq %rax, %r14
movq 0x8(%rax), %rsi
leaq 0xc8(%rsp), %r15
movq %r15, %rdi
callq 0xdaae
leaq 0x2a595(%rip), %rsi     # 0x384b3
leaq 0x80(%rsp), %rdi
movq %r15, %rdx
callq 0xb97b
leaq 0x2a562(%rip), %rdx     # 0x38497
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0xeb69
movq 0x18(%r14), %rsi
leaq 0xa8(%rsp), %rdi
callq 0xdaae
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0xeb88
leaq 0x2a521(%rip), %rdx     # 0x38497
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xeb69
movq 0x28(%r14), %rsi
leaq 0xe8(%rsp), %rdi
callq 0xdaae
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0xeb88
leaq 0x283d7(%rip), %rdx     # 0x36389
movq %rsp, %rsi
movq %rbx, %rdi
callq 0xeb69
movq %rsp, %rdi
callq 0x9130
leaq 0xe8(%rsp), %rdi
callq 0x9130
leaq 0x20(%rsp), %rdi
callq 0x9130
leaq 0x40(%rsp), %rdi
callq 0x9130
leaq 0xa8(%rsp), %rdi
callq 0x9130
leaq 0x60(%rsp), %rdi
callq 0x9130
leaq 0x80(%rsp), %rdi
callq 0x9130
leaq 0xc8(%rsp), %rdi
jmp 0xdbdf
movq %rbx, 0xa0(%rsp)
movq %r15, %rdi
callq 0xd9b6
movq %rax, %r14
movq 0x8(%rax), %rsi
movq %rsp, %rdi
callq 0xdaae
movq 0x18(%r14), %rax
movq (%rax), %rsi
leaq 0x20(%rsp), %rdi
callq 0xdaae
pushq $0x1
popq %rbx
pushq $0x10
popq %r12
leaq 0x60(%rsp), %r15
leaq 0x40(%rsp), %r13
leaq 0x20(%rsp), %rbp
movq 0x18(%r14), %rax
movq 0x20(%r14), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
cmpq %rcx, %rbx
jae 0xe142
movq (%rax,%r12), %rsi
movq %r15, %rdi
callq 0xdaae
movq %r13, %rdi
leaq 0x2a40c(%rip), %rsi     # 0x38497
movq %r15, %rdx
callq 0xb97b
movq %rbp, %rdi
movq %r13, %rsi
callq 0x9540
movq %r13, %rdi
callq 0x9130
movq %r15, %rdi
callq 0x9130
incq %rbx
addq $0x10, %r12
jmp 0xe05d
movq %r15, %rdi
callq 0xda8c
cmpb $0x1, 0x8(%rax)
jne 0xe191
leaq 0x304bb(%rip), %rsi     # 0x3e58b
jmp 0xe198
movq 0x78(%r14), %rsi
leaq 0x20(%rsp), %rdi
callq 0xdaae
movq 0x88(%r14), %rsi
leaq 0x40(%rsp), %rdi
callq 0xdaae
movq 0xa0(%rsp), %rbx
leaq 0x2a397(%rip), %rsi     # 0x3849a
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0xeb2e
addq $0x8, %r14
leaq 0x60(%rsp), %rsi
movq %rsp, %rcx
leaq 0x20(%rsp), %r8
leaq 0x40(%rsp), %r9
movq %rbx, %rdi
movq %r14, %rdx
callq 0xe42a
leaq 0x60(%rsp), %rdi
callq 0x9130
jmp 0xe175
leaq 0x2a36e(%rip), %rsi     # 0x384b7
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0xeb2e
leaq 0x40(%rsp), %rsi
movq %rsp, %rdx
leaq 0x20(%rsp), %rcx
movq 0xa0(%rsp), %rbx
movq %rbx, %rdi
callq 0xe7ba
leaq 0x40(%rsp), %rdi
callq 0x9130
leaq 0x20(%rsp), %rdi
callq 0x9130
movq %rsp, %rdi
jmp 0xdbdf
leaq 0x2e327(%rip), %rsi     # 0x3c4bf
movq %rsp, %rdx
movq %rbx, %rdi
callq 0xeb2e
jmp 0xdbe4
callq 0x9510
pushq $0x10
popq %rdi
callq 0x9150
movq %rax, %r14
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
leaq 0x20(%rsp), %rdi
movl %eax, %esi
callq 0xec65
leaq 0x2a304(%rip), %rsi     # 0x384d7
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0xb97b
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x93f0
xorl %ebp, %ebp
movq 0x4ddd9(%rip), %rsi     # 0x5bfd0
movq 0x4dd9a(%rip), %rdx     # 0x5bf98
movq %r14, %rdi
callq 0x94b0
movq %rax, %rbx
movq %rsp, %rdi
callq 0x9130
jmp 0xe219
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x20(%rsp), %rdi
callq 0x9130
testb %bpl, %bpl
jne 0xe230
jmp 0xe422
movq %rax, %rbx
movq %r14, %rdi
callq 0x9210
jmp 0xe422
jmp 0xe253
jmp 0xe408
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x9130
jmp 0xe256
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0xe3ff
jmp 0xe408
jmp 0xe417
movq %rax, %rbx
movq %rsp, %rdi
callq 0x9130
jmp 0xe27a
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x9130
jmp 0xe291
jmp 0xe37d
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x9130
jmp 0xe2a5
jmp 0xe38a
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x9130
jmp 0xe2c8
jmp 0xe2b8
jmp 0xe39c
movq %rax, %rbx
movq %rsp, %rdi
callq 0x9130
jmp 0xe303
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x9130
leaq 0x60(%rsp), %rdi
callq 0x9130
leaq 0x80(%rsp), %rdi
callq 0x9130
leaq 0xc8(%rsp), %rdi
jmp 0xe41d
jmp 0xe300
jmp 0xe3ab
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x9130
jmp 0xe321
movq %rax, %rbx
jmp 0xe2d5
jmp 0xe31e
jmp 0xe3ba
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x9130
jmp 0xe349
movq %rax, %rbx
jmp 0xe2df
movq %rax, %rbx
movq %rsp, %rdi
callq 0x9130
jmp 0xe362
jmp 0xe346
jmp 0xe3de
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x9130
jmp 0xe373
jmp 0xe417
movq %rax, %rbx
jmp 0xe2ec
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0xe41d
jmp 0xe370
jmp 0xe3e3
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0xe41d
movq %rax, %rbx
movq %rsp, %rdi
callq 0x9130
jmp 0xe38d
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x9130
jmp 0xe39f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x9130
jmp 0xe3ae
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x9130
jmp 0xe3bd
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x9130
leaq 0x60(%rsp), %rdi
callq 0x9130
leaq 0x80(%rsp), %rdi
jmp 0xe41d
movq %rax, %rbx
jmp 0xe3ca
movq %rax, %rbx
jmp 0xe3d4
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x9130
jmp 0xe3fa
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x9130
jmp 0xe40b
jmp 0xe408
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x9130
jmp 0xe41a
movq %rax, %rbx
movq %rsp, %rdi
callq 0x9130
movq %rbx, %rdi
callq 0x94d0