// File: /workspace/github_cpp_makefile_star2_O3/Baobaobear[P]sort/./sortlib.hpp
// Function: void baobao::internal::quick_sort_loop<baobao::internal::indirect_sort_iter_warp<baobao::TestClass*>*, baobao::internal::indirect_sort_comp_warp<baobao::TestClass*, std::less<baobao::TestClass>>>(baobao::internal::indirect_sort_iter_warp<baobao::TestClass*>*, baobao::internal::indirect_sort_iter_warp<baobao::TestClass*>*, int, baobao::internal::indirect_sort_comp_warp<baobao::TestClass*, std::less<baobao::TestClass>>, bool)
void quick_sort_loop(RandomAccessIterator beg, RandomAccessIterator end, int deep, Comp compare, bool leftmost)
{
    if (end - beg <= qsort_insertion_sort_threshold)
    {
        if (leftmost)
        {
            q_insert_sort(beg, end, compare);
        }
        else
        {
            unguarded_q_insert_sort(beg, end, compare);
        }
        return;
    }
    if (deep <= 0)
    {
        shell_sort(beg, end, compare);
        return;
    }

    bool swaped = false;
    RandomAccessIterator l = quick_sort_partition(beg, end, compare, swaped), r = l + 1;
    if (!swaped && !compare(*(l - 1), *beg))
    {
        RandomAccessIterator i = leftmost ? insert_sort_limit(beg, l, compare, 1)
            : unguarded_insert_sort_limit(beg, l, compare, 1);
        if (i == l)
        {
            i = unguarded_insert_sort_limit(r, end, compare, 1);
        }
        if (i == end)
        {
            return;
        }
        if (i >= l)
        {
            while (r < end && util::object_equal(*r, *l, compare)) ++r;
            return quick_sort_loop(r, end, deep - 1, compare, false);
        }
    }
    while (r < end && util::object_equal(*r, *l, compare)) ++r;

    quick_sort_loop(beg, l, deep - 1, compare, leftmost);
    quick_sort_loop(r, end, deep - 1, compare, false);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq %rsi, %rax
subq %rdi, %rax
cmpq $0x28f, %rax            # imm = 0x28F
jg 0xa6b1
testb %r8b, %r8b
je 0xa760
leaq 0x17(%rsp), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xa840
jmp 0xa782
testl %edx, %edx
jle 0xa772
movl %edx, 0x8(%rsp)
movl %r8d, %ebp
leaq 0x14(%rsp), %r13
movb $0x0, (%r13)
leaq 0x13(%rsp), %rdx
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rcx
callq 0xaca3
movq %rax, %r12
leaq 0x10(%rax), %r14
cmpb $0x0, (%r13)
movl %ebp, %r13d
jne 0xa703
movq -0x8(%r12), %rax
movq 0x8(%r15), %rcx
movl (%rax), %eax
movl (%rcx), %ecx
cmpl %ecx, %eax
jge 0xa791
cmpq %rbx, %r14
jae 0xa72d
movq 0x8(%r12), %rax
movl (%rax), %eax
movq 0x8(%r14), %rcx
movl (%rcx), %ecx
cmpl %eax, %ecx
jl 0xa72d
jg 0xa72d
movq (%r14), %rcx
cmpq %rcx, (%r12)
jne 0xa72d
addq $0x10, %r14
cmpq %rbx, %r14
jb 0xa70f
movl 0x8(%rsp), %ebp
decl %ebp
movzbl %r13b, %r8d
leaq 0xe(%rsp), %rcx
movq %r15, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0xa671
leaq 0xd(%rsp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
xorl %r8d, %r8d
callq 0xa671
jmp 0xa782
leaq 0x16(%rsp), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xa939
jmp 0xa782
leaq 0x15(%rsp), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xa9f3
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jg 0xa7a1
movq -0x10(%r12), %rax
cmpq (%r15), %rax
jb 0xa703
testb %r13b, %r13b
je 0xa7bd
leaq 0x12(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %ecx
callq 0xb2af
jmp 0xa7d2
leaq 0x11(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %ecx
callq 0xb375
cmpq %r12, %rax
jne 0xa7ec
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
callq 0xb375
cmpq %rbx, %rax
je 0xa782
cmpq %r12, %rax
jb 0xa703
cmpq %rbx, %r14
jae 0xa82a
movq 0x8(%r12), %rax
movl (%rax), %eax
movl 0x8(%rsp), %edx
movq 0x8(%r14), %rcx
movl (%rcx), %ecx
cmpl %eax, %ecx
jl 0xa82e
jg 0xa82e
movq (%r14), %rcx
cmpq %rcx, (%r12)
jne 0xa82e
addq $0x10, %r14
cmpq %rbx, %r14
jb 0xa80a
jmp 0xa82e
movl 0x8(%rsp), %edx
decl %edx
leaq 0xf(%rsp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0xa756