// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
cmpl %edx, %esi
jge 0x145f
movl %edx, %ebx
movq %rdi, %r14
movl %esi, 0xc(%rsp)
movslq %esi, %r13
movq (%rdi), %rax
movl (%rax,%r13,4), %eax
movl %eax, 0x8(%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)
movslq %edx, %r12
movq %r12, 0x50(%rsp)
subq %r13, %r12
leaq 0x4(,%r13,4), %rbp
leaq 0x10(%rsp), %r15
movq (%r14), %rdx
movl (%rdx,%rbp), %eax
cmpl 0x8(%rsp), %eax
jge 0x12eb
movq 0x18(%rsp), %rsi
movq %r15, %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 0x15a4
addq $0x4, %rbp
decq %r12
jne 0x12c0
movq 0x18(%rsp), %rsi
movq %rsi, %r15
subq 0x10(%rsp), %r15
cmpq 0x20(%rsp), %rsi
je 0x1343
movl 0x8(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
movq 0x50(%rsp), %rbp
movl 0xc(%rsp), %r12d
jmp 0x135c
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x15a4
movq 0x50(%rsp), %rbp
movl 0xc(%rsp), %r12d
leaq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
callq 0x16e0
shrq $0x2, %r15
addl %r12d, %r15d
cmpl %ebx, %r12d
jg 0x13a6
movq 0x10(%rsp), %rax
leaq (,%r13,4), %rcx
addq (%r14), %rcx
movl %ebx, %edx
subl %r12d, %edx
incl %edx
xorl %esi, %esi
movl (%rax,%rsi,4), %edi
movl %edi, (%rcx,%rsi,4)
incq %rsi
cmpl %esi, %edx
jne 0x1399
leal -0x1(%r15), %edx
movq %r14, %rdi
movl %r12d, %esi
callq 0x125c
incl %r15d
movq %r14, %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x125c
cmpl %ebx, %r12d
jg 0x1431
subl %r12d, %ebx
incl %ebx
movq 0x2bfa(%rip), %r15      # 0x3fd0
leaq 0xc27(%rip), %r12       # 0x2004
movq (%r14), %rax
movl (%rax,%r13,4), %esi
movq %r15, %rdi
callq 0x1100
cmpq %rbp, %r13
jge 0x1403
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x10d0
jmp 0x142a
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1070
incq %r13
decl %ebx
jne 0x13dd
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1448
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x145f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1474
jmp 0x1474
jmp 0x1474
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x148e
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x14a5
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq %rbx, %rdi
callq 0x1110