// File: /workspace/github_cpp_makefile_star2_O1/pfnet-research[P]pml/src/translate_to_mdp.cpp
// Function: create_if_case(ast::expr_t const&, ast::expr_t const&, ast::expr_t const&, environment_t<value_info_t> const&)
mdp_with_info_t create_if_case(
        ast::expr_t const& cond,
        ast::expr_t const& tr, ast::expr_t const& fl,
        var_env_t const& var_env) {

    auto cond_ = trans_impl(cond, var_env);
    auto tr_ = trans_impl(tr, var_env);
    auto fl_ = trans_impl(fl, var_env);

    auto result_mdp = mdp::mdp_t::merge(
            mdp::mdp_t::merge(std::move(cond_.mdp), std::move(tr_.mdp)),
            std::move(fl_.mdp));

    // [] location=accept-of-cond & cond -> 1:location'=init-of-tr
    auto concat_to_true = make_concat_with_cond(
            cond_.accept, tr_.init,
            make<mdp::var_expr_t>(cond_.value.name));
    // [] location=accept-of-cond & !cond -> 1:location'=init-of-fl
    auto concat_to_false = make_concat(
            cond_.accept, fl_.init,
            make<mdp::neg_expr_t>(make<mdp::var_expr_t>(cond_.value.name)));

    auto accept_loc = translation_data::fresh_location();
    auto result_var_name = translation_data::fresh_var();
    // [] location=accept-of-tr -> 1:location'=accept & value_name'=value_name-of-tr
    auto phi_true = make_concat(
            tr_.accept, accept_loc,
            make<mdp::binop_expr_t>(
                make<mdp::var_expr_t>(result_var_name + "'"),
                make<mdp::var_expr_t>(tr_.value.name),
                mdp::binop_kind_t::Eq));
    // [] location=accept-of-fl -> 1:location'=accept & value_name'=value_name-of-fl
    auto phi_false = make_concat(
            fl_.accept, accept_loc,
            make<mdp::binop_expr_t>(
                make<mdp::var_expr_t>(result_var_name+"'"),
                make<mdp::var_expr_t>(fl_.value.name),
                mdp::binop_kind_t::Eq));

    result_mdp.commands.push_back(concat_to_true);
    result_mdp.commands.push_back(concat_to_false);
    result_mdp.commands.push_back(phi_true);
    result_mdp.commands.push_back(phi_false);

    if (!tr_.value.bound != !fl_.value.bound)
        throw std::logic_error{"invalid if expression"};

    auto result_var = tr_.value.bound ?
        mdp::variable_t{result_var_name, *tr_.value.bound | *fl_.value.bound, 0} :
        mdp::variable_t{result_var_name, true};

    result_mdp.variables.push_back(result_var);

    return mdp_with_info_t {
        result_mdp, cond_.init, accept_loc,
        value_info_t {
            result_var_name,
            result_var.is_int() ?
                util::make_optional(result_var.as_int().bound) :
                util::nullopt
        }
    };
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3c8, %rsp            # imm = 0x3C8
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %rbx
leaq 0x328(%rsp), %rdi
movq %r8, %rdx
callq 0x3e126
leaq 0x288(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x3e126
leaq 0x1e8(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3e126
leaq 0x78(%rsp), %rdi
leaq 0x328(%rsp), %rsi
leaq 0x288(%rsp), %rdx
callq 0x9b9c
movq %rbx, 0x30(%rsp)
leaq 0x158(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x1e8(%rsp), %rdx
callq 0x9b9c
leaq 0xc8(%rsp), %rdi
callq 0xa8d4
leaq 0xb0(%rsp), %rdi
callq 0xa904
leaq 0x98(%rsp), %r14
movq %r14, %rdi
callq 0xa934
movq -0x20(%r14), %rdi
leaq 0x88(%rsp), %r13
cmpq %r13, %rdi
je 0x3e471
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x398(%rsp), %r14
movl -0x4(%r14), %ebp
movl 0x2f0(%rsp), %r15d
leaq 0x138(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x130(%rsp), %rsi
leaq 0x108(%rsp), %rdx
movq %r14, %rcx
callq 0x41612
movups 0x130(%rsp), %xmm0
leaq 0x78(%rsp), %rcx
movups %xmm0, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x130(%rsp)
leaq 0x1c0(%rsp), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x3d7a0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x3e4ec
callq 0xaa12
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3e4fe
callq 0xaa12
movl 0x394(%rsp), %ebp
movl 0x250(%rsp), %r15d
leaq 0xe8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0xe0(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %r14, %rcx
callq 0x41612
leaq 0x110(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x108(%rsp), %rsi
leaq 0x48(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
callq 0x41702
movups 0x108(%rsp), %xmm0
leaq 0x78(%rsp), %rcx
movups %xmm0, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x108(%rsp)
leaq 0x130(%rsp), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x3d42c
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x3e59b
callq 0xaa12
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x3e5ad
callq 0xaa12
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x3e5bf
callq 0xaa12
movl 0x24d02(%rip), %r14d    # 0x632c8
leal 0x1(%r14), %eax
movl %eax, 0x24cf8(%rip)     # 0x632c8
leaq 0x48(%rsp), %rdi
callq 0x40a42
movl 0x2f4(%rsp), %ebp
leaq 0x78(%rsp), %rdi
movq %r13, (%rdi)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
callq 0xad30
leaq 0xc829(%rip), %rsi      # 0x4ae2b
leaq 0x78(%rsp), %rdi
callq 0x9540
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x78(%rsp), %rcx
callq 0x40e4a
leaq 0x2f8(%rsp), %rcx
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x41612
leaq 0x68(%rsp), %r9
movl $0x8, (%r9)
leaq 0x40(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x38(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x20(%rsp), %rcx
leaq 0x10(%rsp), %r8
callq 0x4150c
movups 0x38(%rsp), %xmm0
leaq 0xe0(%rsp), %rcx
movups %xmm0, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rsp)
leaq 0x108(%rsp), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x3d42c
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x3e6bf
callq 0xaa12
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x3e6ce
callq 0xaa12
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3e6dd
callq 0xaa12
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x3e6ec
callq 0xaa12
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x3e706
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x92e0
movl 0x254(%rsp), %ebp
leaq 0x78(%rsp), %rdi
movq %r13, (%rdi)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
callq 0xad30
leaq 0xc6fd(%rip), %rsi      # 0x4ae2b
leaq 0x78(%rsp), %rdi
callq 0x9540
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x68(%rsp), %rdx
leaq 0x78(%rsp), %rcx
callq 0x40e4a
leaq 0x258(%rsp), %rcx
leaq 0x70(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x68(%rsp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x41612
leaq 0xc(%rsp), %r9
movl $0x8, (%r9)
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0xb(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x68(%rsp), %r8
callq 0x4150c
movups 0x20(%rsp), %xmm0
leaq 0x38(%rsp), %rcx
movups %xmm0, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rsp)
leaq 0xe0(%rsp), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x3d42c
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x3e7e5
callq 0xaa12
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x3e7f4
callq 0xaa12
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3e803
callq 0xaa12
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3e812
callq 0xaa12
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x3e82c
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x1a8(%rsp), %rbx
leaq 0x1c0(%rsp), %rsi
movq %rbx, %rdi
callq 0x40c18
leaq 0x130(%rsp), %rsi
movq %rbx, %rdi
callq 0x40c18
leaq 0x108(%rsp), %rsi
movq %rbx, %rdi
callq 0x40c18
leaq 0xe0(%rsp), %rsi
movq %rbx, %rdi
callq 0x40c18
movb 0x320(%rsp), %al
cmpb 0x280(%rsp), %al
jne 0x3ec66
movq %r14, %rbx
testb %al, %al
je 0x3e8fd
movl 0x278(%rsp), %ebp
movl 0x27c(%rsp), %r12d
movq %r13, %rax
movl 0x318(%rsp), %r13d
movl 0x31c(%rsp), %r14d
leaq 0x78(%rsp), %rdi
movq %rax, %r15
movq %rax, (%rdi)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
callq 0xad30
cmpl %r12d, %r14d
cmovgl %r14d, %r12d
shlq $0x20, %r12
cmpl %r13d, %ebp
cmovll %ebp, %r13d
orq %r12, %r13
movq %r13, 0x9c(%rsp)
xorl %eax, %eax
movl %eax, 0xa4(%rsp)
movl %eax, 0x98(%rsp)
jmp 0x3e92d
leaq 0x78(%rsp), %rdi
movq %r13, %r15
movq %r13, (%rdi)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
callq 0xad30
movb $0x1, 0x9c(%rsp)
movl $0x1, 0x98(%rsp)
movq 0x30(%rsp), %r14
leaq 0x178(%rsp), %r13
leaq 0x78(%rsp), %rsi
movq %r13, %rdi
callq 0x40c42
leaq 0x10(%r14), %r12
movq %r12, (%r14)
movq 0x158(%rsp), %rsi
movq 0x160(%rsp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0xad30
leaq 0x20(%r14), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x40eda
leaq 0x38(%r14), %r13
leaq 0x190(%rsp), %rsi
movq %r13, %rdi
callq 0x40f76
leaq 0x50(%r14), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x41010
movl 0x390(%rsp), %eax
movl %eax, 0x68(%r14)
movl %ebx, 0x6c(%r14)
leaq 0x70(%r14), %rbp
leaq 0x80(%r14), %r12
movq %r12, 0x70(%r14)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
movq %r14, %rbx
callq 0xad30
movl 0x98(%rsp), %eax
movl %eax, %ecx
sarl $0x1f, %ecx
cmpl %eax, %ecx
leaq 0x178(%rsp), %r13
jne 0x3ea03
leaq 0x78(%rsp), %rdi
callq 0x1b7f8
movq (%rax), %rax
movq %rax, 0x90(%rbx)
movb $0x1, %al
jmp 0x3ea05
xorl %eax, %eax
leaq 0x98(%rsp), %r14
movb %al, 0x98(%rbx)
movq %r14, %rdi
callq 0xab60
movq -0x20(%r14), %rdi
cmpq %r15, %rdi
je 0x3ea34
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0xf0(%rsp), %r14
movq %r14, %rdi
callq 0xa9a6
movq -0x8(%r14), %rdi
testq %rdi, %rdi
leaq 0x1a8(%rsp), %r15
je 0x3ea5a
callq 0xaa12
leaq 0x118(%rsp), %r14
movq %r14, %rdi
callq 0xa9a6
movq -0x8(%r14), %rdi
testq %rdi, %rdi
je 0x3ea78
callq 0xaa12
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ea93
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x140(%rsp), %r14
movq %r14, %rdi
callq 0xa9a6
movq -0x8(%r14), %rdi
testq %rdi, %rdi
je 0x3eab1
callq 0xaa12
leaq 0x1d0(%rsp), %r14
movq %r14, %rdi
callq 0xa9a6
movq -0x8(%r14), %rdi
testq %rdi, %rdi
je 0x3eacf
callq 0xaa12
movq %r15, %rdi
callq 0xa8d4
leaq 0x190(%rsp), %rdi
callq 0xa904
movq %r13, %rdi
callq 0xa934
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3eb0d
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x268(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3eb2e
movq 0x268(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x238(%rsp), %rdi
callq 0xa8d4
leaq 0x220(%rsp), %rdi
callq 0xa904
leaq 0x208(%rsp), %r14
movq %r14, %rdi
callq 0xa934
movq -0x20(%r14), %rdi
leaq 0x1f8(%rsp), %rax
cmpq %rax, %rdi
je 0x3eb79
movq 0x1f8(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x308(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3eb9a
movq 0x308(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x2d8(%rsp), %rdi
callq 0xa8d4
leaq 0x2c0(%rsp), %rdi
callq 0xa904
leaq 0x2a8(%rsp), %r14
movq %r14, %rdi
callq 0xa934
movq -0x20(%r14), %rdi
leaq 0x298(%rsp), %rax
cmpq %rax, %rdi
je 0x3ebe5
movq 0x298(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x3a8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ec06
movq 0x3a8(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x378(%rsp), %rdi
callq 0xa8d4
leaq 0x360(%rsp), %rdi
callq 0xa904
leaq 0x348(%rsp), %r14
movq %r14, %rdi
callq 0xa934
movq -0x20(%r14), %rdi
leaq 0x338(%rsp), %rax
cmpq %rax, %rdi
je 0x3ec51
movq 0x338(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %rbx, %rax
addq $0x3c8, %rsp            # imm = 0x3C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x9150
movq %rax, %rbx
leaq 0xc836(%rip), %rsi      # 0x4b4b0
movq %rax, %rdi
callq 0x93c0
movq 0x24347(%rip), %rsi     # 0x62fd0
movq 0x24318(%rip), %rdx     # 0x62fa8
movq %rbx, %rdi
callq 0x94b0
movq %rax, %r14
movq (%rbp), %rdi
cmpq %r12, %rdi
je 0x3ecc5
movq (%r12), %rsi
incq %rsi
callq 0x92e0
jmp 0x3ecc5
movq %rax, %r14
movq %rbx, %rdi
callq 0x9200
jmp 0x3eed1
movq %rax, %r14
movq 0x30(%rsp), %rdi
callq 0xa890
jmp 0x3eec2
movq %rax, %r14
movq %r13, %rdi
callq 0xa904
jmp 0x3ece4
movq %rax, %r14
movq %rbp, %rdi
callq 0xa934
jmp 0x3ecf1
movq %rax, %r14
movq 0x30(%rsp), %rax
movq (%rax), %rdi
cmpq %r12, %rdi
je 0x3eec2
movq (%r12), %rsi
incq %rsi
callq 0x92e0
jmp 0x3eec2
jmp 0x3eece
movq %rax, %r14
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x3ed2a
callq 0xaa12
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x3ed3e
callq 0xaa12
jmp 0x3ed3e
movq %rax, %r14
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3ed52
callq 0xaa12
jmp 0x3ed52
movq %rax, %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3ed68
callq 0xaa12
jmp 0x3ed68
jmp 0x3ed65
movq %rax, %r14
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x3eede
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x3eede
movq %rax, %r14
jmp 0x3eede
movq %rax, %r14
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x3eda8
callq 0xaa12
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x3edbc
callq 0xaa12
jmp 0x3edbc
movq %rax, %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3edd0
callq 0xaa12
jmp 0x3edd0
movq %rax, %r14
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x3ede6
callq 0xaa12
jmp 0x3ede6
jmp 0x3ede3
movq %rax, %r14
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x3eeeb
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x3eeeb
movq %rax, %r14
jmp 0x3eeeb
movq %rax, %r14
jmp 0x3ef06
movq %rax, %r14
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x3ee2e
callq 0xaa12
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x3ee45
callq 0xaa12
jmp 0x3ee45
movq %rax, %r14
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x3ef13
callq 0xaa12
jmp 0x3ef13
movq %rax, %r14
jmp 0x3ef13
movq %rax, %r14
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x3ee7d
callq 0xaa12
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3ef20
callq 0xaa12
jmp 0x3ef20
movq %rax, %r14
jmp 0x3ef20
movq %rax, %r14
leaq 0x78(%rsp), %rdi
jmp 0x3ef28
movq %rax, %r14
jmp 0x3ef2d
movq %rax, %r14
jmp 0x3ef3a
movq %rax, %r14
jmp 0x3ef47
movq %rax, %r14
leaq 0x78(%rsp), %rdi
callq 0x3852e
jmp 0x3eed1
movq %rax, %r14
leaq 0xe0(%rsp), %rdi
callq 0x384ec
leaq 0x108(%rsp), %rdi
callq 0x384ec
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ef06
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x130(%rsp), %rdi
callq 0x384ec
leaq 0x1c0(%rsp), %rdi
callq 0x384ec
leaq 0x158(%rsp), %rdi
callq 0xa890
leaq 0x1e8(%rsp), %rdi
callq 0x382e4
leaq 0x288(%rsp), %rdi
callq 0x382e4
leaq 0x328(%rsp), %rdi
callq 0x382e4
movq %r14, %rdi
callq 0x94e0