// File: /workspace/github_cpp_makefile_star2_O2/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 $0xd8, %rsp
movq (%rdi), %r15
movl 0x8(%r15), %r14d
cmpl $0x3, %r14d
jne 0xb959
movq %rdi, %rbx
movq %r15, %rdi
callq 0xbad4
leaq -0x100(%rbp), %rdi
movq %r15, %rsi
movq %rax, -0x30(%rbp)
movq %rax, %rdx
callq 0xbb0a
pushq $0x30
popq %rdi
callq 0x4270
movq %rax, %r15
leaq -0xe0(%rbp), %r12
leaq -0x100(%rbp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x5a64
movq (%r13), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rcx
movq %r15, %rdi
movq %r12, %rsi
callq 0x57b0
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x6414
leaq -0xd8(%rbp), %rdi
callq 0x59d4
pushq $0x30
popq %rdi
callq 0x4270
movq %rax, %r15
leaq -0xf0(%rbp), %r12
leaq -0xd0(%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x5a64
movq (%r12), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rcx
movq %r15, %rdi
movq %r13, %rsi
callq 0x57b0
leaq -0x60(%rbp), %rdi
movq %r15, %rsi
callq 0x6414
leaq -0xc8(%rbp), %rdi
callq 0x59d4
pushq $0x10
popq %rdi
callq 0x4270
movq %rax, %r15
leaq -0xc0(%rbp), %r12
leaq -0x70(%rbp), %rsi
movq %r12, %rdi
callq 0x6510
movq %r15, %rdi
movq %r12, %rsi
callq 0x6510
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x6528
leaq -0xb8(%rbp), %rdi
callq 0x59d4
pushq $0x10
popq %rdi
callq 0x4270
movq %rax, %r15
leaq -0xb0(%rbp), %r12
leaq -0x60(%rbp), %rsi
movq %r12, %rdi
callq 0x6510
movq %r15, %rdi
movq %r12, %rsi
callq 0x6510
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x6528
leaq -0xa8(%rbp), %rdi
callq 0x59d4
pushq $0x40
popq %rdi
callq 0x4270
movq %rax, %r15
leaq -0x90(%rbp), %r12
leaq -0x50(%rbp), %rsi
movq %r12, %rdi
callq 0x5aa2
leaq -0x80(%rbp), %r13
leaq -0x40(%rbp), %rsi
movq %r13, %rdi
callq 0x5aa2
movq -0x30(%rbp), %rax
movq (%rax), %rcx
movq 0x8(%rax), %r8
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x58ac
leaq -0xa0(%rbp), %rdi
movq %r15, %rsi
callq 0x7db8
leaq -0xa0(%rbp), %rsi
movq %rbx, %rdi
callq 0xbc5e
leaq -0x98(%rbp), %rdi
callq 0x59d4
leaq -0x78(%rbp), %rdi
callq 0x59d4
leaq -0x88(%rbp), %rdi
callq 0x59d4
leaq -0x38(%rbp), %rdi
callq 0x59d4
leaq -0x48(%rbp), %rdi
callq 0x59d4
leaq -0x58(%rbp), %rdi
callq 0x59d4
leaq -0x68(%rbp), %rdi
callq 0x59d4
leaq -0x100(%rbp), %rdi
callq 0xbb30
cmpl $0x3, %r14d
sete %al
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x59d4
leaq -0x88(%rbp), %rdi
callq 0x59d4
jmp 0xb98f
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
jmp 0xb99f
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x59d4
jmp 0xb9a9
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
jmp 0xb9b9
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0x59d4
leaq -0x58(%rbp), %rdi
callq 0x59d4
leaq -0x68(%rbp), %rdi
callq 0x59d4
leaq -0x100(%rbp), %rdi
callq 0xbb30
movq %rbx, %rdi
callq 0x43e0
movq %rax, %rbx
jmp 0xb9be
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
jmp 0xb9c2
movq %rax, %rbx
jmp 0xb9c7
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
jmp 0xb9cb
movq %rax, %rbx
jmp 0xb9d0