// File: pfnet-research[P]pml/src/translate_to_mdp.cpp
// Function: make_concat(int, int, std::shared_ptr<mdp::expr_t> const&)
mdp::command_t make_concat(int from, int to, ptr<mdp::expr_t> const& update) {
    return mdp::command_t {
        make<mdp::binop_expr_t>(
                make<mdp::var_expr_t>("location"),
                make<mdp::int_expr_t>(from),
                mdp::binop_kind_t::Eq),
        {
            mdp::branch_t{
                make<mdp::int_expr_t>(1),
                make<mdp::binop_expr_t>(
                        make<mdp::binop_expr_t>(
                            make<mdp::var_expr_t>("location'"),
                            make<mdp::int_expr_t>(to),
                            mdp::binop_kind_t::Eq),
                        update,
                        mdp::binop_kind_t::And)
            }
        }
    };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x110(%rbp)
movq %rdi, %rax
movq %rax, -0x108(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %rdi, -0x100(%rbp)
leaq 0x11d5c(%rip), %rsi     # 0x99164
leaq -0x38(%rbp), %rdi
callq 0x86e70
leaq -0x48(%rbp), %rdi
leaq -0xc(%rbp), %rsi
callq 0x86ea0
jmp 0x87420
movl $0x8, -0x58(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x48(%rbp), %rdx
leaq -0x58(%rbp), %rcx
callq 0x86e30
jmp 0x8743e
movq -0x100(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x7a500
movq -0x110(%rbp), %rax
movb $0x1, -0xf4(%rbp)
addq $0x10, %rax
movq %rax, -0x120(%rbp)
movb $0x1, -0xf2(%rbp)
leaq -0x88(%rbp), %rax
movq %rax, -0x118(%rbp)
movq %rax, -0x90(%rbp)
movl $0x1, -0xa4(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa4(%rbp), %rsi
callq 0x86f10
jmp 0x874a2
movq -0x118(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x7b4b0
movb $0x1, -0xf1(%rbp)
leaq -0x78(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq 0x187a5(%rip), %rsi     # 0x9fc73
leaq -0xd8(%rbp), %rdi
callq 0x86f40
jmp 0x874dc
leaq -0xe8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x86ea0
jmp 0x874ee
movl $0x8, -0xec(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
leaq -0xec(%rbp), %rcx
callq 0x86e30
jmp 0x8751b
movq -0x18(%rbp), %rdx
movl $0xa, -0xf0(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
leaq -0xf0(%rbp), %rcx
callq 0x87830
jmp 0x87545
movq -0x128(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x7a500
movb $0x0, -0xf1(%rbp)
movb $0x0, -0xf2(%rbp)
leaq -0x88(%rbp), %rax
movq %rax, -0x68(%rbp)
movq $0x1, -0x60(%rbp)
leaq -0xf3(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x7a530
movq -0x120(%rbp), %rdi
movq -0x130(%rbp), %rcx
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x7a550
jmp 0x875a9
movb $0x0, -0xf4(%rbp)
leaq -0xf3(%rbp), %rdi
callq 0xd0d0
leaq -0x88(%rbp), %rax
movq %rax, -0x140(%rbp)
addq $0x20, %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x148(%rbp)
callq 0xcfe0
movq -0x140(%rbp), %rcx
movq -0x148(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x138(%rbp)
jne 0x875d5
leaq -0xb8(%rbp), %rdi
callq 0x7a670
leaq -0xc8(%rbp), %rdi
callq 0x7a670
leaq -0xe8(%rbp), %rdi
callq 0x7a690
leaq -0xd8(%rbp), %rdi
callq 0x7a6b0
leaq -0xa0(%rbp), %rdi
callq 0x7a690
leaq -0x28(%rbp), %rdi
callq 0x7a670
leaq -0x48(%rbp), %rdi
callq 0x7a690
leaq -0x38(%rbp), %rdi
callq 0x7a6b0
movq -0x108(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x87817
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x8780e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x87796
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x87773
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x87767
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x8775b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x8774f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xf3(%rbp), %rdi
callq 0xd0d0
leaq -0x88(%rbp), %rax
movq %rax, -0x158(%rbp)
addq $0x20, %rax
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x160(%rbp)
callq 0xcfe0
movq -0x158(%rbp), %rcx
movq -0x160(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x150(%rbp)
jne 0x87712
leaq -0xb8(%rbp), %rdi
callq 0x7a670
leaq -0xc8(%rbp), %rdi
callq 0x7a670
leaq -0xe8(%rbp), %rdi
callq 0x7a690
leaq -0xd8(%rbp), %rdi
callq 0x7a6b0
testb $0x1, -0xf1(%rbp)
jne 0x8777e
jmp 0x8778a
movq -0x118(%rbp), %rdi
callq 0xceb0
leaq -0xa0(%rbp), %rdi
callq 0x7a690
testb $0x1, -0xf2(%rbp)
jne 0x877a1
jmp 0x877ee
movq -0x90(%rbp), %rax
leaq -0x88(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x168(%rbp)
je 0x877ec
movq -0x168(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x170(%rbp)
callq 0xcfe0
movq -0x170(%rbp), %rax
leaq -0x88(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x168(%rbp)
jne 0x877bb
jmp 0x877ee
testb $0x1, -0xf4(%rbp)
jne 0x877f9
jmp 0x87805
movq -0x100(%rbp), %rdi
callq 0xceb0
leaq -0x28(%rbp), %rdi
callq 0x7a670
leaq -0x48(%rbp), %rdi
callq 0x7a690
leaq -0x38(%rbp), %rdi
callq 0x7a6b0
movq -0x50(%rbp), %rdi
callq 0xa650
nopl (%rax)