// File: 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
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf390
cmpl $0x3, 0x8(%rax)
jne 0x1834f
movq -0x10(%rbp), %rdi
callq 0xf450
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x18580
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xa010
movq -0x188(%rbp), %rsi
movq %rax, %rdx
leaq -0x40(%rbp), %rdi
callq 0x185f0
movl $0x30, %edi
callq 0x4290
movq %rax, -0x180(%rbp)
jmp 0x17e16
movb $0x1, -0x91(%rbp)
leaq -0x70(%rbp), %rdi
movq %rdi, -0x190(%rbp)
leaq -0x40(%rbp), %rsi
movq %rsi, -0x198(%rbp)
callq 0x73a0
movq -0x198(%rbp), %rdi
callq 0x7310
movq %rax, %rdi
callq 0x73d0
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x7400
movq -0x198(%rbp), %rdi
callq 0x7310
movq %rax, %rdi
callq 0x7440
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x7400
movq -0x180(%rbp), %rdi
movq -0x190(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq -0x88(%rbp), %rcx
callq 0x7470
jmp 0x17eab
movq -0x180(%rbp), %rsi
movb $0x0, -0x91(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x74e0
jmp 0x17ec4
leaq -0x70(%rbp), %rdi
callq 0x72b0
movl $0x30, %edi
callq 0x4290
movq %rax, -0x1a0(%rbp)
jmp 0x17ee0
movb $0x1, -0xd9(%rbp)
leaq -0x30(%rbp), %rsi
movq %rsi, -0x1b0(%rbp)
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x73a0
movq -0x1b0(%rbp), %rdi
callq 0x7310
movq %rax, %rdi
callq 0x73d0
movq %rax, -0xc8(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x7400
movq -0x1b0(%rbp), %rdi
callq 0x7310
movq %rax, %rdi
callq 0x7440
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x7400
movq -0x1a0(%rbp), %rdi
movq -0x1a8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
movq -0xd0(%rbp), %rcx
callq 0x7470
jmp 0x17f84
movq -0x1a0(%rbp), %rsi
movb $0x0, -0xd9(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x74e0
jmp 0x17fa0
leaq -0xb8(%rbp), %rdi
callq 0x72b0
movl $0x10, %edi
callq 0x4290
movq %rax, -0x1b8(%rbp)
jmp 0x17fbf
movb $0x1, -0x101(%rbp)
leaq -0x100(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
leaq -0x50(%rbp), %rsi
callq 0xab40
movq -0x1b8(%rbp), %rdi
movq -0x1c0(%rbp), %rsi
callq 0x7510
jmp 0x17ff2
movq -0x1b8(%rbp), %rsi
movb $0x0, -0x101(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x7530
jmp 0x1800e
leaq -0x100(%rbp), %rdi
callq 0x7560
movl $0x10, %edi
callq 0x4290
movq %rax, -0x1c8(%rbp)
jmp 0x1802d
movb $0x1, -0x129(%rbp)
leaq -0x128(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
leaq -0xa8(%rbp), %rsi
callq 0xab40
movq -0x1c8(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
callq 0x7510
jmp 0x18063
movq -0x1c8(%rbp), %rsi
movb $0x0, -0x129(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x7530
jmp 0x1807f
leaq -0x128(%rbp), %rdi
callq 0x7560
movl $0x40, %edi
callq 0x4290
movq %rax, -0x1d8(%rbp)
jmp 0x1809e
movb $0x1, -0x171(%rbp)
leaq -0x150(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
leaq -0xf0(%rbp), %rsi
callq 0x7790
leaq -0x160(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
leaq -0x118(%rbp), %rsi
callq 0x7790
leaq -0x20(%rbp), %rdi
callq 0xa010
movq -0x1d8(%rbp), %rdi
movq -0x1e8(%rbp), %rsi
movq -0x1e0(%rbp), %rdx
movups (%rax), %xmm0
movaps %xmm0, -0x170(%rbp)
movq -0x170(%rbp), %rcx
movq -0x168(%rbp), %r8
callq 0x7880
jmp 0x18116
movq -0x1d8(%rbp), %rsi
movb $0x0, -0x171(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x7900
jmp 0x18132
movq -0x10(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x18640
leaq -0x140(%rbp), %rdi
callq 0x7560
leaq -0x160(%rbp), %rdi
callq 0x7750
leaq -0x150(%rbp), %rdi
callq 0x7750
movb $0x1, -0x1(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x7750
leaq -0xf0(%rbp), %rdi
callq 0x7750
leaq -0xa8(%rbp), %rdi
callq 0x7560
leaq -0x50(%rbp), %rdi
callq 0x7560
leaq -0x40(%rbp), %rdi
callq 0x18670
jmp 0x18353
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x18344
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x72b0
testb $0x1, -0x91(%rbp)
jne 0x181d6
jmp 0x181e7
movq -0x180(%rbp), %rdi
movl $0x30, %esi
callq 0x42a0
jmp 0x18344
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x1833b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x72b0
testb $0x1, -0xd9(%rbp)
jne 0x18220
jmp 0x18231
movq -0x1a0(%rbp), %rdi
movl $0x30, %esi
callq 0x42a0
jmp 0x1833b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x1832f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x7560
testb $0x1, -0x101(%rbp)
jne 0x1826a
jmp 0x1827b
movq -0x1b8(%rbp), %rdi
movl $0x10, %esi
callq 0x42a0
jmp 0x1832f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x18323
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x7560
testb $0x1, -0x129(%rbp)
jne 0x182b4
jmp 0x182c5
movq -0x1c8(%rbp), %rdi
movl $0x10, %esi
callq 0x42a0
jmp 0x18323
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x18317
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x7750
leaq -0x150(%rbp), %rdi
callq 0x7750
testb $0x1, -0x171(%rbp)
jne 0x18304
jmp 0x18315
movq -0x1d8(%rbp), %rdi
movl $0x40, %esi
callq 0x42a0
jmp 0x18317
leaq -0x118(%rbp), %rdi
callq 0x7750
leaq -0xf0(%rbp), %rdi
callq 0x7750
leaq -0xa8(%rbp), %rdi
callq 0x7560
leaq -0x50(%rbp), %rdi
callq 0x7560
leaq -0x40(%rbp), %rdi
callq 0x18670
jmp 0x18361
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x4420
nopw (%rax,%rax)