// File: /workspace/github_cpp_makefile_star2_O3/vividvilla[P]hackerrank/src/quicksort2.cpp
// Function: quickSortAux(std::vector<int, std::allocator<int>>&, int, int)
void quickSortAux(vector<int> & v, int l, int r) {
    if (l >= r)
        return;

    int p = v[l];
    vector<int> p1;
    vector<int> p2;
    for (int i = l + 1; i <= r; i++) {
        if (v[i] < p)
            p1.push_back(v[i]);
        else if (v[i] > p)
            p2.push_back(v[i]);
    }
    int m = l + p1.size();
    p1.push_back(p);
    p1.insert(p1.end(), p2.begin(), p2.end());

    for (int i = l; i <= r; i++)
        v[i] = p1[i - l];

    quickSortAux(v, l, m - 1);
    quickSortAux(v, m + 1, r);

    for (int i = l; i <= r; i++) {
        cout << v[i];
        if (i + 1 <= r)
            cout << " ";
        else
            cout << endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
cmpl %edx, %esi
jge 0x144d
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
movslq %esi, %r12
movq (%rdi), %rax
movl (%rax,%r12,4), %eax
movl %eax, 0x4(%rsp)
xorl %eax, %eax
leaq 0x18(%rsp), %rcx
movq %rax, 0x8(%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rcx)
leaq 0x38(%rsp), %rcx
movq %rax, 0x8(%rcx)
movaps %xmm0, -0x8(%rcx)
movl %edx, 0x8(%rsp)
movslq %edx, %r15
movq %r15, %r13
subq %r12, %r13
leaq 0x4(,%r12,4), %rbp
leaq 0x10(%rsp), %r14
movq (%rbx), %rdx
movl (%rdx,%rbp), %eax
cmpl 0x4(%rsp), %eax
jge 0x12eb
movq 0x18(%rsp), %rsi
movq %r14, %rdi
leaq 0x18(%rsp), %rcx
cmpq 0x20(%rsp), %rsi
je 0x1303
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, (%rcx)
jmp 0x130b
jle 0x130b
movq 0x38(%rsp), %rsi
leaq 0x30(%rsp), %rdi
leaq 0x38(%rsp), %rcx
cmpq 0x40(%rsp), %rsi
jne 0x12e0
addq %rbp, %rdx
callq 0x159c
addq $0x4, %rbp
decq %r13
jne 0x12c0
movq 0x18(%rsp), %rsi
movq %rsi, %r13
subq 0x10(%rsp), %r13
cmpq 0x20(%rsp), %rsi
je 0x133e
movl 0x4(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
movl 0x8(%rsp), %r14d
jmp 0x1357
leaq 0x10(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x159c
movl 0x8(%rsp), %r14d
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
leaq 0x10(%rsp), %rdi
callq 0x16d8
shrq $0x2, %r13
movl 0xc(%rsp), %edx
addl %edx, %r13d
movq 0x10(%rsp), %rax
leaq (,%r12,4), %rcx
addq (%rbx), %rcx
movl %r14d, %ebp
subl %edx, %ebp
incl %ebp
xorl %edx, %edx
movl (%rax,%rdx,4), %esi
movl %esi, (%rcx,%rdx,4)
incq %rdx
cmpl %edx, %ebp
jne 0x138f
leal -0x1(%r13), %edx
movq %rbx, %rdi
movl 0xc(%rsp), %esi
callq 0x125c
incl %r13d
movq %rbx, %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x125c
movq 0x2c0c(%rip), %r14      # 0x3fd0
leaq 0xc39(%rip), %r13       # 0x2004
movq (%rbx), %rax
movl (%rax,%r12,4), %esi
movq %r14, %rdi
callq 0x1100
cmpq %r15, %r12
jge 0x13f1
movl $0x1, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x10d0
jmp 0x1418
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1070
incq %r12
decl %ebp
jne 0x13cb
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1436
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x144d
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1462
jmp 0x1462
jmp 0x1462
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x147c
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1493
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq %rbx, %rdi
callq 0x1110