// File: /workspace/github_cpp_makefile_star2_O1/pfnet-research[P]pml/src/translate_to_mdp.cpp
// Function: create_rand_case(int, int)
mdp_with_info_t create_rand_case(int start, int end) {
    int from = translation_data::fresh_location();
    int to = translation_data::fresh_location();
    auto rand_var = translation_data::fresh_var();

    mdp::command_t command {
        make<mdp::binop_expr_t>(
                make<mdp::var_expr_t>("location"),
                make<mdp::int_expr_t>(from),
                mdp::binop_kind_t::Eq),
        {}
    };

    auto prob = make<mdp::binop_expr_t>(
            make<mdp::int_expr_t>(1),
            make<mdp::int_expr_t>(end - start + 1),
            mdp::binop_kind_t::Div);
    auto next = make<mdp::binop_expr_t>(
            make<mdp::var_expr_t>("location'"),
            make<mdp::int_expr_t>(to),
            mdp::binop_kind_t::Eq);
    for (int i=start; i<=end; ++i) {
        auto branch = make<mdp::binop_expr_t>(
                next,
                make<mdp::binop_expr_t>(
                    make<mdp::var_expr_t>(rand_var + "'"),
                    make<mdp::int_expr_t>(i),
                    mdp::binop_kind_t::Eq),
                mdp::binop_kind_t::And);
        command.branches.push_back(mdp::branch_t {prob, branch});
    }

    mdp::mdp_t mdp {
        "default",
        {
            mdp::variable_t {
                "location",
                bound_t{from, to}, from
            },
            mdp::variable_t {
                rand_var,
                bound_t{start, end}, start
            }
        },
        {}, // constants
        {command}
    };

    return mdp_with_info_t {
        mdp, from, to,
        value_info_t {
            rand_var, {bound_t{start, end}}
        }
    };
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %rbx
movl 0x26cf4(%rip), %r14d    # 0x632c8
leal 0x2(%r14), %eax
movl %eax, 0x26cea(%rip)     # 0x632c8
leaq 0x110(%rsp), %rdi
callq 0x40a42
leaq 0x138(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x8b4e(%rip), %rcx      # 0x45150
leaq 0x130(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x38934
movq %rbx, 0xf0(%rsp)
movq $0x0, 0xa8(%rsp)
movl $0x20, %edi
callq 0x92d0
movabsq $0x100000001, %r12      # imm = 0x100000001
movq %r12, 0x8(%rax)
leaq 0x262ee(%rip), %r13     # 0x62938
movq %r13, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x2632d(%rip), %rdx     # 0x62988
movq %rdx, 0x10(%rax)
movl %r14d, 0x18(%rax)
leaq 0xa8(%rsp), %r8
movq %rax, 0x8(%r8)
movq %rcx, (%r8)
leaq 0x80(%rsp), %r9
movl $0x8, (%r9)
leaq 0x20(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x18(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
leaq 0x130(%rsp), %rcx
callq 0x386fa
movups 0x18(%rsp), %xmm0
movups %xmm0, 0x1a0(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
movups %xmm0, 0x1b0(%rsp)
movq $0x0, 0x1c0(%rsp)
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x3c6e3
callq 0xaa12
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3c6f5
callq 0xaa12
movq $0x0, 0x18(%rsp)
movl $0x20, %edi
callq 0x92d0
movq %r12, 0x8(%rax)
movq %r13, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x2626b(%rip), %rbx     # 0x62988
movq %rbx, 0x10(%rax)
movl $0x1, 0x18(%rax)
movq %rax, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movq $0x0, 0x130(%rsp)
movl $0x20, %edi
callq 0x92d0
movl %r15d, %ecx
subl %ebp, %ecx
incl %ecx
movq %r12, 0x8(%rax)
movq %r13, (%rax)
movq %rax, %rdx
addq $0x10, %rdx
movq %rbx, 0x10(%rax)
movl %ecx, 0x18(%rax)
leaq 0x130(%rsp), %r8
movq %rax, 0x8(%r8)
movq %rdx, (%r8)
leaq 0xa8(%rsp), %r9
movl $0x1, (%r9)
leaq 0xe8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0xe0(%rsp), %rsi
leaq 0x80(%rsp), %rdx
leaq 0x18(%rsp), %rcx
callq 0x38b94
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3c7be
callq 0xaa12
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x3c7cd
callq 0xaa12
leaq 0x20(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0xe63e(%rip), %rcx      # 0x4ae1f
leaq 0x18(%rsp), %rsi
leaq 0x130(%rsp), %rdx
callq 0x38da0
movq $0x0, 0x130(%rsp)
movl $0x20, %edi
callq 0x92d0
leal 0x1(%r14), %edx
movq %r12, 0x8(%rax)
movq %r13, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x26166(%rip), %rsi     # 0x62988
movq %rsi, 0x10(%rax)
movq %rdx, 0x100(%rsp)
movl %edx, 0x18(%rax)
leaq 0x130(%rsp), %r8
movq %rax, 0x8(%r8)
movq %rcx, (%r8)
leaq 0xa8(%rsp), %r9
movl $0x8, (%r9)
leaq 0x198(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x190(%rsp), %rsi
leaq 0x80(%rsp), %rdx
leaq 0x18(%rsp), %rcx
callq 0x386fa
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3c88b
callq 0xaa12
movq %r14, 0x108(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x3c8a2
callq 0xaa12
movl %ebp, 0x10(%rsp)
movq %r15, 0xf8(%rsp)
cmpl %ebp, %r15d
jl 0x3cb18
movq 0xf8(%rsp), %rax
incl %eax
movl %eax, 0xa0(%rsp)
leaq 0x18(%rsp), %r14
leaq 0x80(%rsp), %rbx
leaq 0xd0(%rsp), %r12
leaq 0xa8(%rsp), %r13
leaq 0xa4(%rsp), %rbp
movl 0x10(%rsp), %r15d
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0xad30
movq %r14, %rdi
leaq 0xe50a(%rip), %rsi      # 0x4ae2b
callq 0x9540
movq $0x0, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x40e4a
movq $0x0, 0xd0(%rsp)
movl $0x20, %edi
callq 0x92d0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x25fc5(%rip), %rcx     # 0x62938
movq %rcx, (%rax)
movq %rax, %rcx
addq $0x10, %rcx
leaq 0x26004(%rip), %rdx     # 0x62988
movq %rdx, 0x10(%rax)
movl %r15d, 0x18(%rax)
movq %rax, 0xd8(%rsp)
movq %rcx, 0xd0(%rsp)
movl $0x8, 0x14(%rsp)
movq $0x0, 0xa8(%rsp)
leaq 0xb0(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
movq %r12, %r8
leaq 0x14(%rsp), %r9
callq 0x386fa
movl $0xa, 0xa4(%rsp)
movq $0x0, 0x130(%rsp)
leaq 0x138(%rsp), %rdi
leaq 0x130(%rsp), %rsi
leaq 0xf(%rsp), %rdx
leaq 0x190(%rsp), %rcx
movq %r13, %r8
movq %rbp, %r9
callq 0x40d32
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x3ca1f
callq 0xaa12
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x3ca31
callq 0xaa12
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3ca43
callq 0xaa12
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x3ca5f
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x92e0
movq 0xe0(%rsp), %rcx
movq 0xe8(%rsp), %rax
movq %rcx, 0x18(%rsp)
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x3ca93
movq 0x2652b(%rip), %rcx     # 0x62fb0
cmpb $0x0, (%rcx)
je 0x3ca8f
incl 0x8(%rax)
jmp 0x3ca93
lock
incl 0x8(%rax)
movq 0x130(%rsp), %rcx
movq 0x138(%rsp), %rax
movq %rcx, 0x28(%rsp)
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x3cac7
movq 0x264f7(%rip), %rcx     # 0x62fb0
cmpb $0x0, (%rcx)
je 0x3cac3
incl 0x8(%rax)
jmp 0x3cac7
lock
incl 0x8(%rax)
leaq 0x1b0(%rsp), %rdi
movq %r14, %rsi
callq 0x41a24
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3cae6
callq 0xaa12
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x3caf5
callq 0xaa12
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3cb07
callq 0xaa12
incl %r15d
cmpl %r15d, 0xa0(%rsp)
jne 0x3c8f2
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xe2be(%rip), %rsi      # 0x4ade6
leaq 0xe2be(%rip), %rdx      # 0x4aded
leaq 0x18(%rsp), %rdi
callq 0x11866
leaq 0x90(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x8604(%rip), %rsi      # 0x45150
leaq 0x8605(%rip), %rdx      # 0x45158
leaq 0x80(%rsp), %rdi
callq 0x11866
movq 0x108(%rsp), %rbx
leaq 0x140(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
addq %rsi, %rdx
leaq 0x130(%rsp), %r12
movq %r12, %rdi
callq 0xad30
movq 0x100(%rsp), %rax
shlq $0x20, %rax
orq %rbx, %rax
leaq 0x160(%rsp), %r12
movq %rax, -0xc(%r12)
movl %ebx, -0x4(%r12)
movl $0x0, -0x10(%r12)
leaq 0x170(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0xad30
leaq 0x38(%rsp), %rdi
movq 0xf8(%rsp), %rcx
shlq $0x20, %rcx
movl 0x10(%rsp), %eax
movl %eax, %ebp
orq %rcx, %rbp
leaq 0x130(%rsp), %rsi
movq %rbp, 0x54(%rsi)
movl %eax, 0x5c(%rsi)
movl $0x0, 0x50(%rsi)
leaq 0xd0(%rsp), %rcx
movl $0x2, %edx
callq 0x38556
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x1a0(%rsp), %rcx
movq 0x1a8(%rsp), %rax
movq %rcx, 0xa8(%rsp)
movq %rax, 0xb0(%rsp)
testq %rax, %rax
je 0x3cc75
movq 0x26349(%rip), %rcx     # 0x62fb0
cmpb $0x0, (%rcx)
je 0x3cc71
incl 0x8(%rax)
jmp 0x3cc75
lock
incl 0x8(%rax)
leaq 0xb8(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x3920e
leaq 0x68(%rsp), %r14
leaq 0xa8(%rsp), %rsi
leaq 0x14(%rsp), %rcx
movl $0x1, %edx
movq %r14, %rdi
callq 0x385ea
leaq 0xb8(%rsp), %r15
movq %r15, %rdi
callq 0xa9a6
movq -0x8(%r15), %rdi
testq %rdi, %rdi
je 0x3ccc7
callq 0xaa12
movq $-0x60, %rbx
leaq 0x180(%rsp), %r15
movq 0xf0(%rsp), %r12
movq %r15, %rdi
callq 0xab60
movq -0x20(%r15), %rdi
leaq -0x10(%r15), %rax
cmpq %rdi, %rax
je 0x3ccfe
movq (%rax), %rsi
incq %rsi
callq 0x92e0
addq $-0x30, %r15
addq $0x30, %rbx
jne 0x3ccde
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x3cd25
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x92e0
leaq 0x10(%r12), %rbx
movq %rbx, (%r12)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0xad30
leaq 0x20(%r12), %r15
movq %r15, %rdi
leaq 0x38(%rsp), %rsi
callq 0x40eda
leaq 0x38(%r12), %r13
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
callq 0x40f76
leaq 0x50(%r12), %rdi
movq %r14, %rsi
callq 0x41010
movq 0x108(%rsp), %rax
movl %eax, 0x68(%r12)
movq 0x100(%rsp), %rax
movl %eax, 0x6c(%r12)
leaq 0x70(%r12), %rdi
leaq 0x80(%r12), %rax
movq %rax, 0x70(%r12)
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
addq %rsi, %rdx
callq 0xad30
movq %rbp, 0x90(%r12)
movb $0x1, 0x98(%r12)
movq %r14, %rdi
callq 0xa8d4
leaq 0x50(%rsp), %rdi
callq 0xa904
leaq 0x38(%rsp), %rdi
callq 0xa934
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x3ce01
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x92e0
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x3ce13
callq 0xaa12
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x3ce25
callq 0xaa12
leaq 0x1b0(%rsp), %rdi
callq 0xa9a6
movq 0x1a8(%rsp), %rdi
testq %rdi, %rdi
je 0x3ce44
callq 0xaa12
leaq 0x120(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ce65
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %r12, %rax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %r12, %rdi
callq 0xa890
jmp 0x3cec4
movq %rax, %r14
movq %r13, %rdi
callq 0xa904
jmp 0x3ce97
movq %rax, %r14
movq %r15, %rdi
callq 0xa934
jmp 0x3cea4
movq %rax, %r14
movq 0xf0(%rsp), %rax
movq (%rax), %rdi
cmpq %rbx, %rdi
je 0x3cec4
movq (%rbx), %rsi
incq %rsi
callq 0x92e0
jmp 0x3cec4
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xa890
jmp 0x3d0ac
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
callq 0x384ec
jmp 0x3cefa
movq %rax, %r14
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x3cefa
callq 0xaa12
leaq 0x50(%rsp), %rdi
callq 0xa904
leaq 0x38(%rsp), %rdi
callq 0xa934
jmp 0x3cf13
movq %rax, %r14
movl $0x30, %ebx
leaq (%rsp,%rbx), %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x3852e
addq $-0x30, %rbx
cmpq $-0x30, %rbx
jne 0x3cf18
movb $0x1, %bl
jmp 0x3cf3d
jmp 0x3cf38
movq %rax, %r14
xorl %ebx, %ebx
movq 0x80(%rsp), %rdi
cmpq %r13, %rdi
je 0x3cf69
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x3cf69
movq %rax, %r14
xorl %ebx, %ebx
leaq 0x130(%rsp), %r12
leaq 0x130(%rsp), %rax
cmpq %r12, %rax
sete %al
orb %bl, %al
jne 0x3cf94
leaq 0x130(%rsp), %rbx
addq $-0x30, %r12
movq %r12, %rdi
callq 0x3852e
cmpq %rbx, %r12
jne 0x3cf83
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
jne 0x3d09f
jmp 0x3d0ac
jmp 0x3d041
movq %rax, %r14
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3cfc6
callq 0xaa12
jmp 0x3cfc6
movq %rax, %r14
movq 0x20(%rsp), %rdi
jmp 0x3d0b4
movq %rax, %r14
jmp 0x3d0be
movq %rax, %r14
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3cff2
callq 0xaa12
jmp 0x3cff2
movq %rax, %r14
movq 0x20(%rsp), %rdi
jmp 0x3d0c6
movq %rax, %r14
jmp 0x3d0d0
movq %rax, %r14
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x3d01e
callq 0xaa12
jmp 0x3d01e
movq %rax, %r14
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3d0dd
callq 0xaa12
jmp 0x3d0dd
movq %rax, %r14
jmp 0x3d0dd
movq %rax, %r14
jmp 0x3d0ac
jmp 0x3d048
movq %rax, %r14
jmp 0x3d090
movq %rax, %r14
jmp 0x3d07e
movq %rax, %r14
jmp 0x3d06c
movq %rax, %r14
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x3d06c
callq 0xaa12
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x3d07e
callq 0xaa12
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3d090
callq 0xaa12
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x3d0ac
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x92e0
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x3d0be
callq 0xaa12
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x3d0d0
callq 0xaa12
leaq 0x1a0(%rsp), %rdi
callq 0x384ec
leaq 0x120(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d0fe
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x92e0
movq %r14, %rdi
callq 0x94e0
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x3850a
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3d0ac
callq 0xaa12
jmp 0x3d0ac