// File: /workspace/github_cpp_makefile_star2_O1/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 0xe6cb
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 0xe8fa
movl $0x30, %edi
callq 0x4270
movq -0xa8(%rbp), %rcx
movq -0xa0(%rbp), %r15
testq %r15, %r15
je 0xe3b7
movq 0xac19(%rip), %rdx      # 0x18fc0
cmpb $0x0, (%rdx)
je 0xe3b2
incl 0x8(%r15)
jmp 0xe3b7
lock
incl 0x8(%r15)
movq -0xa8(%rbp), %rsi
movq (%rsi), %rdx
movq 0x8(%rsi), %rsi
movl $0x3, 0x8(%rax)
leaq 0xa2ad(%rip), %r13      # 0x18680
movq %r13, (%rax)
movq %rcx, 0x10(%rax)
movq %r15, 0x18(%rax)
testq %r15, %r15
je 0xe3fa
movq 0xabd6(%rip), %rcx      # 0x18fc0
cmpb $0x0, (%rcx)
je 0xe3f5
incl 0x8(%r15)
jmp 0xe3fa
lock
incl 0x8(%r15)
movq %rdx, 0x20(%rax)
movq %rsi, 0x28(%rax)
leaq -0x80(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0x723c
testq %r15, %r15
je 0xe41f
movq %r15, %rdi
callq 0x6810
movl $0x30, %edi
callq 0x4270
movq -0x98(%rbp), %rcx
movq -0x90(%rbp), %r15
testq %r15, %r15
je 0xe453
movq 0xab7d(%rip), %rdx      # 0x18fc0
cmpb $0x0, (%rdx)
je 0xe44e
incl 0x8(%r15)
jmp 0xe453
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)
testq %r15, %r15
je 0xe48f
movq 0xab41(%rip), %rcx      # 0x18fc0
cmpb $0x0, (%rcx)
je 0xe48a
incl 0x8(%r15)
jmp 0xe48f
lock
incl 0x8(%r15)
movq %rdx, 0x20(%rax)
movq %rsi, 0x28(%rax)
leaq -0x70(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0x723c
testq %r15, %r15
je 0xe4b4
movq %r15, %rdi
callq 0x6810
movl $0x10, %edi
callq 0x4270
movq -0x88(%rbp), %rcx
movq -0x80(%rbp), %r15
testq %r15, %r15
je 0xe4e0
movq 0xaaeb(%rip), %rdx      # 0x18fc0
cmpb $0x0, (%rdx)
je 0xe4e9
incl 0x8(%r15)
jmp 0xe4ee
movq %rcx, (%rax)
movq %r15, 0x8(%rax)
jmp 0xe50a
lock
incl 0x8(%r15)
movq %rcx, (%rax)
movq %r15, 0x8(%rax)
testq %r15, %r15
je 0xe50a
cmpb $0x0, (%rdx)
je 0xe505
incl 0x8(%r15)
jmp 0xe50a
lock
incl 0x8(%r15)
leaq -0x60(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0x731a
testq %r15, %r15
je 0xe527
movq %r15, %rdi
callq 0x6810
movl $0x10, %edi
callq 0x4270
movq -0x78(%rbp), %rcx
movq -0x70(%rbp), %r15
testq %r15, %r15
je 0xe550
movq 0xaa7b(%rip), %rdx      # 0x18fc0
cmpb $0x0, (%rdx)
je 0xe559
incl 0x8(%r15)
jmp 0xe55e
movq %rcx, (%rax)
movq %r15, 0x8(%rax)
jmp 0xe57a
lock
incl 0x8(%r15)
movq %rcx, (%rax)
movq %r15, 0x8(%rax)
testq %r15, %r15
je 0xe57a
cmpb $0x0, (%rdx)
je 0xe575
incl 0x8(%r15)
jmp 0xe57a
lock
incl 0x8(%r15)
leaq -0x50(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0x731a
testq %r15, %r15
je 0xe597
movq %r15, %rdi
callq 0x6810
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 0xe5ce
movq 0xaa00(%rip), %rcx      # 0x18fc0
cmpb $0x0, (%rcx)
je 0xe5ca
incl 0x8(%rax)
jmp 0xe5ce
lock
incl 0x8(%rax)
movq -0x58(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0xe5f8
movq 0xa9d6(%rip), %rcx      # 0x18fc0
cmpb $0x0, (%rcx)
je 0xe5f4
incl 0x8(%rax)
jmp 0xe5f8
lock
incl 0x8(%rax)
movq (%r14), %rcx
movq 0x8(%r14), %r8
leaq -0x48(%rbp), %rsi
leaq -0x38(%rbp), %rdx
movq %r15, %rdi
callq 0x679e
leaq -0xb8(%rbp), %rdi
movq %r15, -0x8(%rdi)
movq %r15, %rsi
callq 0x92d2
movaps -0xc0(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0xc0(%rbp)
movq 0x8(%rbx), %rdi
movups %xmm0, (%rbx)
testq %rdi, %rdi
je 0xe644
callq 0x6810
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0xe655
callq 0x6810
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xe663
callq 0x6810
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xe671
callq 0x6810
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xe67f
callq 0x6810
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0xe68d
callq 0x6810
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0xe69b
callq 0x6810
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0xe6a9
callq 0x6810
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0xe6ba
callq 0x6810
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0xe6cb
callq 0x6810
cmpl $0x3, %r12d
sete %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xe6f5
callq 0x6810
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xe708
callq 0x6810
jmp 0xe708
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
jne 0xe71e
jmp 0xe728
movq %rax, %rbx
testq %r15, %r15
je 0xe728
movq %r15, %rdi
callq 0x6810
jmp 0xe728
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
jne 0xe73e
jmp 0xe748
movq %rax, %rbx
testq %r15, %r15
je 0xe748
movq %r15, %rdi
callq 0x6810
jmp 0xe748
movq %rax, %rbx
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0xe768
callq 0x6810
jmp 0xe768
movq %rax, %rbx
testq %r15, %r15
je 0xe768
movq %r15, %rdi
jmp 0xe751
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0xe776
callq 0x6810
leaq -0xa8(%rbp), %rdi
callq 0xe8cc
movq %rbx, %rdi
callq 0x4400
movq %rax, %rbx
testq %r15, %r15
je 0xe776
movq %r15, %rdi
jmp 0xe771
movq %rax, %rbx
jmp 0xe776