// File: /workspace/github_cpp_makefile_star2_O3/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 $0x3e8, %rsp            # imm = 0x3E8
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %rbx
leaq 0x348(%rsp), %rdi
movq %r8, %rdx
callq 0x3d82e
leaq 0x2a8(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x3d82e
leaq 0x208(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3d82e
leaq 0x80(%rsp), %rdi
leaq 0x348(%rsp), %rsi
leaq 0x2a8(%rsp), %rdx
callq 0x9b6c
movq %rbx, 0x38(%rsp)
leaq 0x178(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x208(%rsp), %rdx
callq 0x9b6c
leaq 0xd0(%rsp), %rdi
callq 0xa808
leaq 0xb8(%rsp), %rdi
callq 0xa838
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
callq 0xa868
movq -0x20(%r14), %rdi
leaq 0x90(%rsp), %r13
cmpq %r13, %rdi
je 0x3db7f
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x3b8(%rsp), %r14
movl -0x4(%r14), %ebp
movl 0x310(%rsp), %r15d
leaq 0x158(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x150(%rsp), %rsi
leaq 0x120(%rsp), %rdx
movq %r14, %rcx
callq 0x40d02
movaps 0x150(%rsp), %xmm0
leaq 0x80(%rsp), %rcx
movaps %xmm0, (%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x150(%rsp)
leaq 0x1e0(%rsp), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x3ceba
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3dbfd
callq 0xa946
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x3dc0f
callq 0xa946
movl 0x3b4(%rsp), %ebp
movl 0x270(%rsp), %r15d
leaq 0xf8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0xf0(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %r14, %rcx
callq 0x40d02
leaq 0x128(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x120(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0xf0(%rsp), %rcx
callq 0x40df2
movaps 0x120(%rsp), %xmm0
leaq 0x80(%rsp), %rcx
movaps %xmm0, (%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x120(%rsp)
leaq 0x150(%rsp), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x3cb57
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3dcaf
callq 0xa946
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x3dcc1
callq 0xa946
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x3dcd3
callq 0xa946
movl 0x245ee(%rip), %r14d    # 0x622c8
leal 0x1(%r14), %eax
movl %eax, 0x245e4(%rip)     # 0x622c8
leaq 0x50(%rsp), %rdi
callq 0x4017c
movl 0x314(%rsp), %ebp
leaq 0x80(%rsp), %rdi
movq %r13, (%rdi)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
callq 0xac68
leaq 0xd112(%rip), %rsi      # 0x4ae2b
leaq 0x80(%rsp), %rdi
callq 0x9540
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x28(%rsp), %rdx
leaq 0x80(%rsp), %rcx
callq 0x40566
leaq 0x318(%rsp), %rcx
leaq 0x30(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x28(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x40d02
leaq 0x70(%rsp), %r9
movl $0x8, (%r9)
leaq 0x48(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x40(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x28(%rsp), %r8
callq 0x40c14
movaps 0x40(%rsp), %xmm0
leaq 0xf0(%rsp), %rcx
movaps %xmm0, (%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
leaq 0x120(%rsp), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x3cb57
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x3dddc
callq 0xa946
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x3ddeb
callq 0xa946
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3ddfa
callq 0xa946
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3de09
callq 0xa946
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x3de26
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x92e0
movl 0x274(%rsp), %ebp
leaq 0x80(%rsp), %rdi
movq %r13, (%rdi)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
callq 0xac68
leaq 0xcfda(%rip), %rsi      # 0x4ae2b
leaq 0x80(%rsp), %rdi
callq 0x9540
leaq 0x30(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x28(%rsp), %rsi
leaq 0x70(%rsp), %rdx
leaq 0x80(%rsp), %rcx
callq 0x40566
leaq 0x278(%rsp), %rcx
leaq 0x78(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x70(%rsp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x40d02
leaq 0xc(%rsp), %r9
movl $0x8, (%r9)
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0xb(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0x70(%rsp), %r8
callq 0x40c14
movaps 0x10(%rsp), %xmm0
leaq 0x40(%rsp), %rcx
movaps %xmm0, (%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
leaq 0xf0(%rsp), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x3cb57
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x3df0e
callq 0xa946
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3df1d
callq 0xa946
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x3df2c
callq 0xa946
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3df3b
callq 0xa946
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x3df58
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x1c8(%rsp), %rbx
leaq 0x1e0(%rsp), %rsi
movq %rbx, %rdi
callq 0x40352
leaq 0x150(%rsp), %rsi
movq %rbx, %rdi
callq 0x40352
leaq 0x120(%rsp), %rsi
movq %rbx, %rdi
callq 0x40352
leaq 0xf0(%rsp), %rsi
movq %rbx, %rdi
callq 0x40352
movb 0x340(%rsp), %al
cmpb 0x2a0(%rsp), %al
jne 0x3e39e
movq %r14, %rbx
testb %al, %al
je 0x3e02c
movl 0x298(%rsp), %ebp
movl 0x29c(%rsp), %r12d
movq %r13, %rax
movl 0x338(%rsp), %r13d
movl 0x33c(%rsp), %r14d
leaq 0x80(%rsp), %rdi
movq %rax, %r15
movq %rax, (%rdi)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
callq 0xac68
cmpl %r12d, %r14d
cmovgl %r14d, %r12d
shlq $0x20, %r12
cmpl %r13d, %ebp
cmovll %ebp, %r13d
orq %r12, %r13
movq %r13, 0xa4(%rsp)
xorl %eax, %eax
movl %eax, 0xac(%rsp)
movl %eax, 0xa0(%rsp)
jmp 0x3e05f
leaq 0x80(%rsp), %rdi
movq %r13, %r15
movq %r13, (%rdi)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
callq 0xac68
movb $0x1, 0xa4(%rsp)
movl $0x1, 0xa0(%rsp)
movq 0x38(%rsp), %r14
leaq 0x198(%rsp), %r13
leaq 0x80(%rsp), %rsi
movq %r13, %rdi
callq 0x4037c
leaq 0x10(%r14), %r12
movq %r12, (%r14)
movq 0x178(%rsp), %rsi
movq 0x180(%rsp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0xac68
leaq 0x20(%r14), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x405f6
leaq 0x38(%r14), %r13
leaq 0x1b0(%rsp), %rsi
movq %r13, %rdi
callq 0x40692
leaq 0x50(%r14), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x4072c
movl 0x3b0(%rsp), %eax
movl %eax, 0x68(%r14)
movl %ebx, 0x6c(%r14)
leaq 0x70(%r14), %rbp
leaq 0x80(%r14), %r12
movq %r12, 0x70(%r14)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
movq %r14, %rbx
callq 0xac68
movl 0xa0(%rsp), %eax
movl %eax, %ecx
sarl $0x1f, %ecx
cmpl %eax, %ecx
leaq 0x198(%rsp), %r13
jne 0x3e13b
leaq 0x80(%rsp), %rdi
callq 0x1b578
movq (%rax), %rax
movq %rax, 0x90(%rbx)
movb $0x1, %al
jmp 0x3e13d
xorl %eax, %eax
leaq 0xa0(%rsp), %r14
movb %al, 0x98(%rbx)
movq %r14, %rdi
callq 0xaa94
movq -0x20(%r14), %rdi
cmpq %r15, %rdi
je 0x3e16c
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x100(%rsp), %r14
movq %r14, %rdi
callq 0xa8da
movq -0x8(%r14), %rdi
testq %rdi, %rdi
leaq 0x1c8(%rsp), %r15
je 0x3e192
callq 0xa946
leaq 0x130(%rsp), %r14
movq %r14, %rdi
callq 0xa8da
movq -0x8(%r14), %rdi
testq %rdi, %rdi
je 0x3e1b0
callq 0xa946
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e1cb
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x160(%rsp), %r14
movq %r14, %rdi
callq 0xa8da
movq -0x8(%r14), %rdi
testq %rdi, %rdi
je 0x3e1e9
callq 0xa946
leaq 0x1f0(%rsp), %r14
movq %r14, %rdi
callq 0xa8da
movq -0x8(%r14), %rdi
testq %rdi, %rdi
je 0x3e207
callq 0xa946
movq %r15, %rdi
callq 0xa808
leaq 0x1b0(%rsp), %rdi
callq 0xa838
movq %r13, %rdi
callq 0xa868
leaq 0x188(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e245
movq 0x188(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x288(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e266
movq 0x288(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x258(%rsp), %rdi
callq 0xa808
leaq 0x240(%rsp), %rdi
callq 0xa838
leaq 0x228(%rsp), %r14
movq %r14, %rdi
callq 0xa868
movq -0x20(%r14), %rdi
leaq 0x218(%rsp), %rax
cmpq %rax, %rdi
je 0x3e2b1
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x328(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e2d2
movq 0x328(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x2f8(%rsp), %rdi
callq 0xa808
leaq 0x2e0(%rsp), %rdi
callq 0xa838
leaq 0x2c8(%rsp), %r14
movq %r14, %rdi
callq 0xa868
movq -0x20(%r14), %rdi
leaq 0x2b8(%rsp), %rax
cmpq %rax, %rdi
je 0x3e31d
movq 0x2b8(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x3c8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e33e
movq 0x3c8(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x398(%rsp), %rdi
callq 0xa808
leaq 0x380(%rsp), %rdi
callq 0xa838
leaq 0x368(%rsp), %r14
movq %r14, %rdi
callq 0xa868
movq -0x20(%r14), %rdi
leaq 0x358(%rsp), %rax
cmpq %rax, %rdi
je 0x3e389
movq 0x358(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %rbx, %rax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x9150
movq %rax, %rbx
leaq 0xd0fe(%rip), %rsi      # 0x4b4b0
movq %rax, %rdi
callq 0x93c0
movq 0x23c0f(%rip), %rsi     # 0x61fd0
movq 0x23be0(%rip), %rdx     # 0x61fa8
movq %rbx, %rdi
callq 0x94b0
movq %rax, %r14
movq (%rbp), %rdi
cmpq %r12, %rdi
je 0x3e3fd
movq (%r12), %rsi
incq %rsi
callq 0x92e0
jmp 0x3e3fd
movq %rax, %r14
movq %rbx, %rdi
callq 0x9200
jmp 0x3e61b
movq %rax, %r14
movq 0x38(%rsp), %rdi
callq 0xa7c4
jmp 0x3e609
movq %rax, %r14
movq %r13, %rdi
callq 0xa838
jmp 0x3e41c
movq %rax, %r14
movq %rbp, %rdi
callq 0xa868
jmp 0x3e429
movq %rax, %r14
movq 0x38(%rsp), %rax
movq (%rax), %rdi
cmpq %r12, %rdi
je 0x3e609
movq (%r12), %rsi
incq %rsi
callq 0x92e0
jmp 0x3e609
jmp 0x3e618
movq %rax, %r14
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x3e462
callq 0xa946
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3e476
callq 0xa946
jmp 0x3e476
movq %rax, %r14
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x3e48a
callq 0xa946
jmp 0x3e48a
movq %rax, %r14
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3e4a0
callq 0xa946
jmp 0x3e4a0
jmp 0x3e49d
movq %rax, %r14
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x3e628
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x3e628
movq %rax, %r14
jmp 0x3e628
movq %rax, %r14
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x3e4e3
callq 0xa946
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x3e4f7
callq 0xa946
jmp 0x3e4f7
movq %rax, %r14
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3e50b
callq 0xa946
jmp 0x3e50b
movq %rax, %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3e521
callq 0xa946
jmp 0x3e521
jmp 0x3e51e
movq %rax, %r14
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x3e635
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x3e635
movq %rax, %r14
jmp 0x3e635
movq %rax, %r14
jmp 0x3e650
movq %rax, %r14
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3e56c
callq 0xa946
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x3e583
callq 0xa946
jmp 0x3e583
movq %rax, %r14
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x3e65d
callq 0xa946
jmp 0x3e65d
movq %rax, %r14
jmp 0x3e65d
movq %rax, %r14
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3e5bb
callq 0xa946
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x3e66a
callq 0xa946
jmp 0x3e66a
movq %rax, %r14
jmp 0x3e66a
movq %rax, %r14
leaq 0x80(%rsp), %rdi
jmp 0x3e672
movq %rax, %r14
jmp 0x3e677
movq %rax, %r14
jmp 0x3e684
movq %rax, %r14
jmp 0x3e691
movq %rax, %r14
leaq 0x80(%rsp), %rdi
callq 0x37daa
jmp 0x3e61b
movq %rax, %r14
leaq 0xf0(%rsp), %rdi
callq 0x37d68
leaq 0x120(%rsp), %rdi
callq 0x37d68
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e650
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x150(%rsp), %rdi
callq 0x37d68
leaq 0x1e0(%rsp), %rdi
callq 0x37d68
leaq 0x178(%rsp), %rdi
callq 0xa7c4
leaq 0x208(%rsp), %rdi
callq 0x37b5c
leaq 0x2a8(%rsp), %rdi
callq 0x37b5c
leaq 0x348(%rsp), %rdi
callq 0x37b5c
movq %r14, %rdi
callq 0x94e0