// File: /workspace/github_cpp_makefile_star2_O1/pfnet-research[P]pml/src/MDP.cpp
// Function: mdp::mdp_t::merge(mdp::mdp_t&&, mdp::mdp_t&&)
mdp_t mdp_t::merge(mdp_t&& lhs, mdp_t&& rhs) {
    mdp_t result{std::move(lhs)};

    result.variables.reserve(result.variables.size() + rhs.variables.size());
    for (auto&& var : rhs.variables) {
        if (var.is_int() && var.name == "location")
            continue;
        auto found = std::find_if(
                result.variables.begin(), result.variables.end(),
                [&](mdp::variable_t const& var_) {
                    return var_.name == var.name;
                });
        if (found != result.variables.end())
            continue;
        result.variables.emplace_back(std::move(var));
    }

    result.constants.reserve(result.constants.size() + rhs.constants.size());
    for (auto&& cnst : rhs.constants) {
        auto found = std::find_if(
                result.constants.begin(), result.constants.end(),
                [&](mdp::constant_t const& cnst_) {
                    return cnst_.name == cnst.name;
                });
        if (found != result.constants.end())
            continue;
        result.constants.emplace_back(std::move(cnst));
    }

    result.commands.reserve(result.commands.size() + rhs.commands.size());
    std::move(
            rhs.commands.begin(), rhs.commands.end(),
            std::back_inserter(result.commands));
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rcx
movq %rcx, (%rdi)
movq (%rsi), %rdx
leaq 0x10(%rsi), %rax
cmpq %rax, %rdx
je 0x9bcf
movq %rdx, (%rbx)
movq (%rax), %rcx
movq %rcx, 0x10(%rbx)
jmp 0x9bd5
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x8(%rsi), %rcx
movq %rcx, 0x8(%rbx)
movq %rax, (%rsi)
xorl %eax, %eax
movq %rax, 0x8(%rsi)
movb $0x0, 0x10(%rsi)
leaq 0x20(%rbx), %rdi
movq 0x20(%rsi), %rcx
movq %rcx, 0x20(%rbx)
movq 0x28(%rsi), %rdx
movq %rdx, 0x28(%rbx)
movq 0x30(%rsi), %rdx
movq %rdx, 0x30(%rbx)
movq %rax, 0x30(%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rsi)
movq 0x38(%rsi), %rdx
movq %rdx, 0x38(%rbx)
movq 0x40(%rsi), %rdx
movq %rdx, 0x40(%rbx)
movq 0x48(%rsi), %rdx
movq %rdx, 0x48(%rbx)
movq %rax, 0x48(%rsi)
movups %xmm0, 0x38(%rsi)
movq 0x50(%rsi), %rdx
movq %rdx, 0x50(%rbx)
movq 0x58(%rsi), %rdx
movq %rdx, 0x58(%rbx)
movq 0x60(%rsi), %rdx
movq %rdx, 0x60(%rbx)
movq %rax, 0x60(%rsi)
movups %xmm0, 0x50(%rsi)
movq 0x28(%rbx), %rax
subq %rcx, %rax
sarq $0x4, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
movq 0x28(%r14), %rsi
subq 0x20(%r14), %rsi
imulq %rcx, %rax
sarq $0x4, %rsi
imulq %rcx, %rsi
addq %rax, %rsi
movq %rdi, 0x20(%rsp)
movq %rbx, 0x8(%rsp)
callq 0xa624
movq 0x20(%r14), %r12
movq %r14, 0x30(%rsp)
movq 0x28(%r14), %rax
movq %rax, 0x10(%rsp)
cmpq %rax, %r12
je 0x9e35
leaq 0x28(%rsp), %rbp
movl 0x20(%r12), %eax
movl %eax, %ecx
sarl $0x1f, %ecx
cmpl %eax, %ecx
jne 0x9cd1
movq %r12, %rdi
leaq 0x3b48c(%rip), %rsi     # 0x45150
callq 0x90c0
testl %eax, %eax
je 0x9e26
movq 0x20(%rbx), %r13
movq 0x28(%rbx), %rdx
movq %r12, 0x28(%rsp)
movq %rdx, %r15
subq %r13, %r15
sarq $0x4, %r15
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r15
sarq $0x2, %r15
testq %r15, %r15
jle 0x9d86
movq %rdx, 0x18(%rsp)
leaq (%r15,%r15,2), %rbx
shlq $0x6, %rbx
addq %r13, %rbx
incq %r15
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa5c0
testb %al, %al
jne 0x9dcb
leaq 0x30(%r13), %r14
movq %rbp, %rdi
movq %r14, %rsi
callq 0xa5c0
testb %al, %al
jne 0x9dce
leaq 0x60(%r13), %r14
movq %rbp, %rdi
movq %r14, %rsi
callq 0xa5c0
testb %al, %al
jne 0x9dce
leaq 0x90(%r13), %r14
movq %rbp, %rdi
movq %r14, %rsi
callq 0xa5c0
testb %al, %al
jne 0x9dce
addq $0xc0, %r13
decq %r15
cmpq $0x1, %r15
jg 0x9d16
movq %rbx, %r13
movq 0x8(%rsp), %rbx
movq 0x18(%rsp), %rdx
movq %rdx, %rax
subq %r13, %rax
sarq $0x4, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq $0x1, %rax
je 0x9df4
cmpq $0x2, %rax
je 0x9dda
movq %rdx, %r14
cmpq $0x3, %rax
jne 0x9e14
movq %rdx, %r15
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa5c0
testb %al, %al
jne 0x9dec
addq $0x30, %r13
jmp 0x9ddd
movq %r13, %r14
movq 0x8(%rsp), %rbx
movq 0x18(%rsp), %rdx
jmp 0x9e14
movq %rdx, %r15
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa5c0
testb %al, %al
je 0x9df9
movq %r13, %r14
movq %r15, %rdx
jmp 0x9e14
movq %rdx, %r15
jmp 0x9dfd
addq $0x30, %r13
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa5c0
testb %al, %al
movq %r15, %rdx
cmoveq %r15, %r13
movq %r13, %r14
cmpq %rdx, %r14
jne 0x9e26
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0xa6d0
addq $0x30, %r12
cmpq 0x10(%rsp), %r12
jne 0x9cac
leaq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rax
subq 0x38(%rbx), %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %r15 # imm = 0xCCCCCCCCCCCCCCCD
movq 0x30(%rsp), %r14
movq 0x40(%r14), %rsi
subq 0x38(%r14), %rsi
imulq %r15, %rax
sarq $0x3, %rsi
imulq %r15, %rsi
addq %rax, %rsi
movq %rdi, 0x20(%rsp)
callq 0xa702
movq 0x38(%r14), %r12
movq 0x40(%r14), %rax
movq %rax, 0x18(%rsp)
cmpq %rax, %r12
je 0x9fe7
leaq 0x28(%rsp), %r13
movq 0x38(%rbx), %r14
movq 0x40(%rbx), %rcx
movq %r12, 0x28(%rsp)
movq %rcx, %rbx
subq %r14, %rbx
sarq $0x3, %rbx
imulq %r15, %rbx
sarq $0x2, %rbx
testq %rbx, %rbx
movq %rcx, 0x10(%rsp)
jle 0x9f41
leaq (%rbx,%rbx,4), %r15
shlq $0x5, %r15
addq %r14, %r15
incq %rbx
movq %r13, %rdi
movq %r14, %rsi
callq 0xa5f2
testb %al, %al
jne 0x9f90
leaq 0x28(%r14), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0xa5f2
testb %al, %al
jne 0x9f93
leaq 0x50(%r14), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0xa5f2
testb %al, %al
jne 0x9f93
leaq 0x78(%r14), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0xa5f2
testb %al, %al
jne 0x9f93
addq $0xa0, %r14
decq %rbx
cmpq $0x1, %rbx
jg 0x9ecb
movq %r15, %r14
movabsq $-0x3333333333333333, %r15 # imm = 0xCCCCCCCCCCCCCCCD
movq 0x10(%rsp), %rcx
movq %rcx, %rax
subq %r14, %rax
sarq $0x3, %rax
imulq %r15, %rax
cmpq $0x1, %rax
movq 0x8(%rsp), %rbx
je 0x9fad
cmpq $0x2, %rax
je 0x9f7c
movq %rcx, %rbp
cmpq $0x3, %rax
jne 0x9fc6
movq %r13, %rdi
movq %r14, %rsi
callq 0xa5f2
testb %al, %al
jne 0x9f8b
addq $0x28, %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0xa5f2
testb %al, %al
je 0x9fa9
movq %r14, %rbp
jmp 0x9fa2
movq %r14, %rbp
movq 0x8(%rsp), %rbx
movabsq $-0x3333333333333333, %r15 # imm = 0xCCCCCCCCCCCCCCCD
movq 0x10(%rsp), %rcx
jmp 0x9fc6
addq $0x28, %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0xa5f2
testb %al, %al
movq 0x10(%rsp), %rcx
cmoveq %rcx, %r14
movq %r14, %rbp
cmpq %rcx, %rbp
jne 0x9fd8
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0xa7b0
addq $0x28, %r12
cmpq 0x18(%rsp), %r12
jne 0x9e90
leaq 0x50(%rbx), %r14
movq 0x58(%rbx), %rax
subq 0x50(%rbx), %rax
sarq $0x3, %rax
movq 0x30(%rsp), %r12
movq 0x58(%r12), %rsi
subq 0x50(%r12), %rsi
imulq %r15, %rax
sarq $0x3, %rsi
imulq %r15, %rsi
addq %rax, %rsi
movq %r14, %rdi
callq 0xa7e2
movq 0x50(%r12), %r15
movq 0x58(%r12), %rax
subq %r15, %rax
testq %rax, %rax
jle 0xa05e
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
mulq %rcx
movq %rdx, %r12
shrq $0x5, %r12
incq %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0xb312
addq $0x28, %r15
decq %r12
cmpq $0x1, %r12
jg 0xa046
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa076
jmp 0xa076
jmp 0xa076
movq %rax, %r14
movq 0x8(%rsp), %rdi
callq 0xa890
movq %r14, %rdi
callq 0x94e0