// File: /workspace/github_cpp_makefile_star2_O3/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 $0x28, %rsp
movq %rdx, %rbx
movq %rdi, %r13
leaq 0x10(%rdi), %rcx
movq %rcx, (%rdi)
movq (%rsi), %rdx
leaq 0x10(%rsi), %rax
cmpq %rax, %rdx
je 0x9ba0
movq %rdx, (%r13)
movq (%rax), %rcx
movq %rcx, 0x10(%r13)
jmp 0x9ba6
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x8(%rsi), %rcx
movq %rcx, 0x8(%r13)
movq %rax, (%rsi)
xorl %ecx, %ecx
movq %rcx, 0x8(%rsi)
movb $0x0, 0x10(%rsi)
leaq 0x20(%r13), %rdi
movq 0x20(%rsi), %rdx
movq %rdx, 0x20(%r13)
movq 0x28(%rsi), %rax
movq %rax, 0x28(%r13)
movq 0x30(%rsi), %r8
movq %r8, 0x30(%r13)
movq %rcx, 0x30(%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rsi)
movups 0x38(%rsi), %xmm1
movups %xmm1, 0x38(%r13)
movq 0x48(%rsi), %r8
movq %r8, 0x48(%r13)
movq %rcx, 0x48(%rsi)
movups %xmm0, 0x38(%rsi)
movups 0x50(%rsi), %xmm1
movups %xmm1, 0x50(%r13)
movq 0x60(%rsi), %r8
movq %r8, 0x60(%r13)
movq %rcx, 0x60(%rsi)
movups %xmm0, 0x50(%rsi)
subq %rdx, %rax
sarq $0x4, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
movq 0x28(%rbx), %rsi
subq 0x20(%rbx), %rsi
imulq %rcx, %rax
sarq $0x4, %rsi
imulq %rcx, %rsi
addq %rax, %rsi
movq %rdi, 0x10(%rsp)
movq %r13, 0x8(%rsp)
callq 0xa548
movq 0x20(%rbx), %r12
movq %rbx, 0x20(%rsp)
movq 0x28(%rbx), %rax
movq %rax, 0x18(%rsp)
cmpq %rax, %r12
je 0x9dcd
movl 0x20(%r12), %eax
movl %eax, %ecx
sarl $0x1f, %ecx
cmpl %eax, %ecx
jne 0x9c8b
movq %r12, %rdi
leaq 0x3b4d2(%rip), %rsi     # 0x45150
callq 0x90c0
testl %eax, %eax
je 0x9dbe
movq 0x20(%r13), %rbp
movq 0x28(%r13), %r15
movq %r15, %rax
subq %rbp, %rax
movq %rax, %rbx
sarq $0x4, %rbx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rbx
sarq $0x2, %rbx
testq %rbx, %rbx
jle 0x9d41
leaq (%rbx,%rbx,2), %r14
shlq $0x6, %r14
addq %rbp, %r14
incq %rbx
movq %r12, %rdi
movq %rbp, %rsi
callq 0xa4ec
testb %al, %al
jne 0x9da4
leaq 0x30(%rbp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xa4ec
testb %al, %al
jne 0x9da7
leaq 0x60(%rbp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xa4ec
testb %al, %al
jne 0x9da7
leaq 0x90(%rbp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xa4ec
testb %al, %al
jne 0x9da7
addq $0xc0, %rbp
decq %rbx
cmpq $0x1, %rbx
jg 0x9cc9
movq %r15, %rax
subq %r14, %rax
movq 0x8(%rsp), %r13
jmp 0x9d44
movq %rbp, %r14
sarq $0x4, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq $0x1, %rax
je 0x9d8e
cmpq $0x2, %rax
je 0x9d7b
cmpq $0x3, %rax
jne 0x9db1
movq %r12, %rdi
movq %r14, %rsi
callq 0xa4ec
testb %al, %al
jne 0x9d9f
addq $0x30, %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0xa4ec
testb %al, %al
jne 0x9d9f
addq $0x30, %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0xa4ec
testb %al, %al
cmoveq %r15, %r14
movq %r14, %r13
jmp 0x9da7
movq %rbp, %r13
cmpq %r15, %r13
movq 0x8(%rsp), %r13
jne 0x9dbe
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0xa5f4
addq $0x30, %r12
cmpq 0x18(%rsp), %r12
jne 0x9c66
leaq 0x38(%r13), %rdi
movq 0x40(%r13), %rax
subq 0x38(%r13), %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
movq 0x20(%rsp), %rbx
movq 0x40(%rbx), %rsi
subq 0x38(%rbx), %rsi
imulq %rcx, %rax
sarq $0x3, %rsi
imulq %rcx, %rsi
addq %rax, %rsi
movq %rdi, 0x10(%rsp)
callq 0xa62e
movq 0x38(%rbx), %r12
movq 0x40(%rbx), %rax
movq %rax, 0x18(%rsp)
cmpq %rax, %r12
je 0x9f55
movq 0x38(%r13), %rbp
movq 0x40(%r13), %r15
movq %r15, %rax
subq %rbp, %rax
movq %rax, %rbx
sarq $0x3, %rbx
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rbx
sarq $0x2, %rbx
testq %rbx, %rbx
jle 0x9ec9
leaq (%rbx,%rbx,4), %r13
shlq $0x5, %r13
addq %rbp, %r13
incq %rbx
movq %r12, %rdi
movq %rbp, %rsi
callq 0xa51a
testb %al, %al
jne 0x9f2c
leaq 0x28(%rbp), %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0xa51a
testb %al, %al
jne 0x9f2f
leaq 0x50(%rbp), %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0xa51a
testb %al, %al
jne 0x9f2f
leaq 0x78(%rbp), %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0xa51a
testb %al, %al
jne 0x9f2f
addq $0xa0, %rbp
decq %rbx
cmpq $0x1, %rbx
jg 0x9e5d
movq %r15, %rax
subq %r13, %rax
jmp 0x9ecc
movq %rbp, %r13
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
cmpq $0x1, %rax
je 0x9f16
cmpq $0x2, %rax
je 0x9f03
cmpq $0x3, %rax
jne 0x9f34
movq %r12, %rdi
movq %r13, %rsi
callq 0xa51a
testb %al, %al
jne 0x9f27
addq $0x28, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xa51a
testb %al, %al
jne 0x9f27
addq $0x28, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xa51a
testb %al, %al
cmoveq %r15, %r13
movq %r13, %r14
jmp 0x9f2f
movq %rbp, %r14
cmpq %r15, %r14
jne 0x9f41
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0xa6dc
addq $0x28, %r12
cmpq 0x18(%rsp), %r12
movq 0x8(%rsp), %r13
jne 0x9e23
leaq 0x50(%r13), %r15
movq 0x58(%r13), %rax
subq 0x50(%r13), %rax
sarq $0x3, %rax
movq 0x20(%rsp), %rbx
movq 0x58(%rbx), %rsi
subq 0x50(%rbx), %rsi
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
sarq $0x3, %rsi
imulq %rcx, %rsi
addq %rax, %rsi
movq %r15, %rdi
callq 0xa716
movq 0x50(%rbx), %r14
movq 0x58(%rbx), %rax
subq %r14, %rax
testq %rax, %rax
jle 0x9fd2
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
mulq %rcx
movq %rdx, %r12
shrq $0x5, %r12
incq %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0xb254
addq $0x28, %r14
decq %r12
cmpq $0x1, %r12
ja 0x9fba
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9fea
jmp 0x9fea
jmp 0x9fea
movq %rax, %r14
movq 0x8(%rsp), %rdi
callq 0xa7c4
movq %r14, %rdi
callq 0x94e0