// File: /workspace/github_cpp_makefile_star2_O3/UBOdin[P]jitd-cpp/include/transform/transform_atomic.hpp
// Function: bool randomSplitArray<Record>(std::shared_ptr<Cog<Record>>&)
bool randomSplitArray(CogPtr<Tuple> &cog)
    {
      if(cog->type == COG_ARRAY) {
        ArrayCog<Tuple> *arr = (ArrayCog<Tuple> *)cog.get();
        BufferElement<Tuple> pivot = arr->randElement();
        std::pair<Buffer<Tuple>,Buffer<Tuple>> splits = arr->split(*pivot);
        CogPtr<Tuple> lhsC =
          CogPtr<Tuple>(
            new ArrayCog<Tuple>(
              splits.first, 
              splits.first->begin(), 
              splits.first->end()
            ));
        CogPtr<Tuple> rhsC =
          CogPtr<Tuple>(
            new ArrayCog<Tuple>(
              splits.second, 
              splits.second->begin(), 
              splits.second->end()
            ));


        CogHandle<Tuple> lhsH(new CogHandleBase<Tuple>(lhsC));
        CogHandle<Tuple> rhsH(new CogHandleBase<Tuple>(rhsC));

        cog = CogPtr<Tuple>(new BTreeCog<Tuple>(lhsH, rhsH, *pivot));
        return true;
      }
      return false;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq (%rdi), %r14
movl 0x8(%r14), %r12d
cmpl $0x3, %r12d
jne 0xe649
movq %rdi, %rbx
callq 0x4070
cltq
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rcx
movq %rcx, %rdi
subq %rsi, %rdi
sarq $0x4, %rdi
cqto
idivq %rdi
movq %rdx, %r14
shlq $0x4, %r14
addq %rsi, %r14
leaq -0xa8(%rbp), %rdi
movq %rcx, %rdx
movq %r14, %rcx
callq 0xe8a4
movl $0x30, %edi
callq 0x4270
movq -0xa8(%rbp), %rcx
movq -0xa0(%rbp), %r15
leaq 0x93ba(%rip), %r13      # 0x176b0
testq %r15, %r15
je 0xe310
movq 0x9cbe(%rip), %rdi      # 0x17fc0
cmpb $0x0, (%rdi)
je 0xe32b
incl 0x8(%r15)
movq %rcx, %rsi
jmp 0xe337
movq (%rcx), %rdx
movq 0x8(%rcx), %rsi
movl $0x3, 0x8(%rax)
movq %r13, (%rax)
movq %rcx, 0x10(%rax)
movq %r15, 0x18(%rax)
jmp 0xe360
lock
incl 0x8(%r15)
movq -0xa8(%rbp), %rsi
movq (%rsi), %rdx
movq 0x8(%rsi), %rsi
movl $0x3, 0x8(%rax)
movq %r13, (%rax)
movq %rcx, 0x10(%rax)
movq %r15, 0x18(%rax)
cmpb $0x0, (%rdi)
je 0xe35b
incl 0x8(%r15)
jmp 0xe360
lock
incl 0x8(%r15)
movq %rdx, 0x20(%rax)
movq %rsi, 0x28(%rax)
leaq -0x80(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0x6eb0
testq %r15, %r15
je 0xe385
movq %r15, %rdi
callq 0x65c2
movl $0x30, %edi
callq 0x4270
movq -0x98(%rbp), %rcx
movq -0x90(%rbp), %r15
testq %r15, %r15
je 0xe3b7
movq 0x9c17(%rip), %rdi      # 0x17fc0
cmpb $0x0, (%rdi)
je 0xe3d2
incl 0x8(%r15)
movq %rcx, %rsi
jmp 0xe3de
movq (%rcx), %rdx
movq 0x8(%rcx), %rsi
movl $0x3, 0x8(%rax)
movq %r13, (%rax)
movq %rcx, 0x10(%rax)
movq %r15, 0x18(%rax)
jmp 0xe407
lock
incl 0x8(%r15)
movq -0x98(%rbp), %rsi
movq (%rsi), %rdx
movq 0x8(%rsi), %rsi
movl $0x3, 0x8(%rax)
movq %r13, (%rax)
movq %rcx, 0x10(%rax)
movq %r15, 0x18(%rax)
cmpb $0x0, (%rdi)
je 0xe402
incl 0x8(%r15)
jmp 0xe407
lock
incl 0x8(%r15)
movq %rdx, 0x20(%rax)
movq %rsi, 0x28(%rax)
leaq -0x70(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0x6eb0
testq %r15, %r15
je 0xe42c
movq %r15, %rdi
callq 0x65c2
movl $0x10, %edi
callq 0x4270
movq -0x88(%rbp), %rcx
movq -0x80(%rbp), %r15
testq %r15, %r15
je 0xe45f
movq 0x9b73(%rip), %rdx      # 0x17fc0
cmpb $0x0, (%rdx)
je 0xe46c
incl 0x8(%r15)
movq %rcx, (%rax)
movq %r15, 0x8(%rax)
jmp 0xe481
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
jmp 0xe485
lock
incl 0x8(%r15)
cmpb $0x0, (%rdx)
movq %rcx, (%rax)
movq %r15, 0x8(%rax)
je 0xe662
incl 0x8(%r15)
leaq -0x60(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0x6f94
testq %r15, %r15
je 0xe4a2
movq %r15, %rdi
callq 0x65c2
movl $0x10, %edi
callq 0x4270
movq -0x78(%rbp), %rcx
movq -0x70(%rbp), %r15
testq %r15, %r15
je 0xe4d2
movq 0x9b00(%rip), %rdx      # 0x17fc0
cmpb $0x0, (%rdx)
je 0xe4df
incl 0x8(%r15)
movq %rcx, (%rax)
movq %r15, 0x8(%rax)
jmp 0xe4f4
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
jmp 0xe4f8
lock
incl 0x8(%r15)
cmpb $0x0, (%rdx)
movq %rcx, (%rax)
movq %r15, 0x8(%rax)
je 0xe66c
incl 0x8(%r15)
leaq -0x50(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0x6f94
testq %r15, %r15
je 0xe515
movq %r15, %rdi
callq 0x65c2
movl $0x40, %edi
callq 0x4270
movq %rax, %r15
movq -0x68(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq %rax, -0x40(%rbp)
testq %rax, %rax
je 0xe54c
movq 0x9a82(%rip), %rcx      # 0x17fc0
cmpb $0x0, (%rcx)
je 0xe548
incl 0x8(%rax)
jmp 0xe54c
lock
incl 0x8(%rax)
movq -0x58(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0xe576
movq 0x9a58(%rip), %rcx      # 0x17fc0
cmpb $0x0, (%rcx)
je 0xe572
incl 0x8(%rax)
jmp 0xe576
lock
incl 0x8(%rax)
movq (%r14), %rcx
movq 0x8(%r14), %r8
leaq -0x48(%rbp), %rsi
leaq -0x38(%rbp), %rdx
movq %r15, %rdi
callq 0x6550
leaq -0xb8(%rbp), %rdi
movq %r15, -0x8(%rdi)
movq %r15, %rsi
callq 0x8f8a
movaps -0xc0(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0xc0(%rbp)
movq 0x8(%rbx), %rdi
movups %xmm0, (%rbx)
testq %rdi, %rdi
je 0xe5d3
callq 0x65c2
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0xe5d3
callq 0x65c2
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xe5e1
callq 0x65c2
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xe5ef
callq 0x65c2
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xe5fd
callq 0x65c2
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0xe60b
callq 0x65c2
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0xe619
callq 0x65c2
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0xe627
callq 0x65c2
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0xe638
callq 0x65c2
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0xe649
callq 0x65c2
cmpl $0x3, %r12d
sete %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
lock
incl 0x8(%r15)
jmp 0xe485
lock
incl 0x8(%r15)
jmp 0xe4f8
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xe687
callq 0x65c2
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xe69a
callq 0x65c2
jmp 0xe69a
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
jne 0xe6b0
jmp 0xe6ba
movq %rax, %rbx
testq %r15, %r15
je 0xe6ba
movq %r15, %rdi
callq 0x65c2
jmp 0xe6ba
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
jne 0xe6d0
jmp 0xe6da
movq %rax, %rbx
testq %r15, %r15
je 0xe6da
movq %r15, %rdi
callq 0x65c2
jmp 0xe6da
movq %rax, %rbx
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0xe6fa
callq 0x65c2
jmp 0xe6fa
movq %rax, %rbx
testq %r15, %r15
je 0xe6fa
movq %r15, %rdi
jmp 0xe6e3
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0xe708
callq 0x65c2
leaq -0xa8(%rbp), %rdi
callq 0xe876
movq %rbx, %rdi
callq 0x4400
movq %rax, %rbx
testq %r15, %r15
je 0xe708
movq %r15, %rdi
jmp 0xe703
movq %rax, %rbx
jmp 0xe708