// File: pfnet-research[P]pml/src/translate_to_mdp.cpp
// Function: create_neg_case(ast::expr_t const&, environment_t<value_info_t> const&)
mdp_with_info_t create_neg_case(ast::expr_t const& inner, var_env_t const& var_env) {
    auto inner_ = trans_impl(inner, var_env);
    auto accept_loc = translation_data::fresh_location();
    auto result_var_name = translation_data::fresh_var();

    auto result_var = mdp::variable_t{result_var_name, true};

    // [] location=accept-of-inner -> 1:location'=accept_loc&result_var_name'=!inner
    auto concat = make_concat(
            inner_.accept, accept_loc,
            make<mdp::binop_expr_t>(
                make<mdp::var_expr_t>(result_var_name+"'"),
                make<mdp::neg_expr_t>(
                    make<mdp::var_expr_t>(inner_.value.name)),
                mdp::binop_kind_t::Eq));

    inner_.mdp.commands.push_back(concat);
    inner_.mdp.variables.push_back(result_var);

    return mdp_with_info_t {
        inner_.mdp, inner_.init, accept_loc,
        value_info_t {
            result_var_name, util::nullopt
        }
    };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x1d8(%rbp)
movq %rdi, %rax
movq %rax, -0x1d0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
callq 0x881e0
callq 0x8b550
movl %eax, -0x1c4(%rbp)
jmp 0x8a029
movl -0x1c4(%rbp), %eax
movl %eax, -0xbc(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x8b570
jmp 0x8a043
leaq -0x120(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
movl $0x1, %edx
callq 0x8b9c0
jmp 0x8a05d
movl -0x4c(%rbp), %eax
movl %eax, -0x1e0(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x1dc(%rbp)
leaq 0x15c06(%rip), %rdx     # 0x9fc7f
leaq -0x198(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x8b610
jmp 0x8a08e
leaq -0x178(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x86fb0
jmp 0x8a0a3
leaq -0x48(%rbp), %rsi
leaq -0x1b8(%rbp), %rdi
callq 0x88500
jmp 0x8a0b5
leaq -0x1a8(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x88fa0
jmp 0x8a0ca
movl $0x8, -0x1bc(%rbp)
leaq -0x168(%rbp), %rdi
leaq -0x178(%rbp), %rsi
leaq -0x1a8(%rbp), %rdx
leaq -0x1bc(%rbp), %rcx
callq 0x8a3b0
jmp 0x8a0f7
leaq -0x158(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
leaq -0x168(%rbp), %rsi
callq 0x7a500
movl -0x1e0(%rbp), %esi
movl -0x1dc(%rbp), %edx
movq -0x1e8(%rbp), %rcx
leaq -0x148(%rbp), %rdi
callq 0x873d0
jmp 0x8a132
leaq -0x158(%rbp), %rdi
callq 0xceb0
leaq -0x168(%rbp), %rdi
callq 0x7a670
leaq -0x1a8(%rbp), %rdi
callq 0x8bae0
leaq -0x1b8(%rbp), %rdi
callq 0x7a6b0
leaq -0x178(%rbp), %rdi
callq 0x7a6b0
leaq -0x198(%rbp), %rdi
callq 0xa240
leaq -0x68(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x8b8e0
jmp 0x8a18c
leaq -0x98(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x8bb00
jmp 0x8a1a1
movq -0x1d8(%rbp), %rdi
movq %rdi, %rax
movq %rax, -0x1f0(%rbp)
leaq -0xb8(%rbp), %rsi
callq 0x8b6f0
jmp 0x8a1c0
movq -0x1d8(%rbp), %rdi
movl -0x50(%rbp), %eax
movl %eax, 0x68(%rdi)
movl -0xbc(%rbp), %eax
movl %eax, 0x6c(%rdi)
addq $0x70, %rdi
movq %rdi, -0x1f8(%rbp)
leaq -0xf0(%rbp), %rsi
callq 0xa190
jmp 0x8a1ef
movq -0x1f8(%rbp), %rdi
addq $0x20, %rdi
callq 0x8bb70
leaq -0x148(%rbp), %rdi
callq 0xce20
leaq -0x120(%rbp), %rdi
callq 0xdda0
leaq -0xf0(%rbp), %rdi
callq 0xa240
leaq -0xb8(%rbp), %rdi
callq 0x79690
movq -0x1d0(%rbp), %rax
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8a389
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8a37d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8a371
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8a325
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8a319
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8a30d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8a301
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x158(%rbp), %rdi
callq 0xceb0
leaq -0x168(%rbp), %rdi
callq 0x7a670
leaq -0x1a8(%rbp), %rdi
callq 0x8bae0
leaq -0x1b8(%rbp), %rdi
callq 0x7a6b0
leaq -0x178(%rbp), %rdi
callq 0x7a6b0
leaq -0x198(%rbp), %rdi
callq 0xa240
jmp 0x8a371
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8a365
movq -0x1f0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
callq 0xc340
leaq -0x148(%rbp), %rdi
callq 0xce20
leaq -0x120(%rbp), %rdi
callq 0xdda0
leaq -0xf0(%rbp), %rdi
callq 0xa240
leaq -0xb8(%rbp), %rdi
callq 0x79690
movq -0xc8(%rbp), %rdi
callq 0xa650
nopw %cs:(%rax,%rax)