// File: /workspace/github_cpp_makefile_star2_O3/ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: FastInsertionSort<int>::_sort(int*, int, int, int*)
void _sort(T *A, int n, int l, T *b)
    {
        float exp = (float)(l - 1) / l;
        int k = pow(n, exp);
        if (n <= k || k <= 5 || l <= 1)
        {
            is.sort(A, n);
            return;
        }

        _sort(A, k, l - 1, b);
        for (int i = k; i < n; i += k)
        {
            if (n - i < k)
                k = n - i;

            _sort(A + i, k, l - 1, b);

            for (int h = 0; h < k; h++)
                b[h] = A[i + h];

            int j = i - 1;
            int s = k - 1;
            while (s >= 0)
            {
                while (j >= 0 && A[j] > b[s])
                {
                    A[j + s + 1] = A[j];
                    j--;
                }
                A[j + s + 1] = b[s];
                s--;
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r14
movl %ecx, %r15d
movl %edx, %r12d
movq %rsi, %rbx
leal -0x1(%r15), %eax
movl %eax, 0xc(%rsp)
cvtsi2ss %eax, %xmm1
movq %rdi, 0x18(%rsp)
cvtsi2ss %ecx, %xmm0
divss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
cvtss2sd %xmm1, %xmm1
callq 0x3290
cmpl $0x2, %r15d
jl 0x6813
cvttsd2si %xmm0, %r13d
cmpl %r12d, %r13d
jge 0x6813
cmpl $0x5, %r13d
jle 0x6813
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl %r13d, %edx
movl 0xc(%rsp), %ecx
movq %r14, %r8
callq 0x66b8
movabsq $-0x100000000, %rbp     # imm = 0xFFFFFFFF00000000
movl %r13d, %edx
movl %r12d, 0x10(%rsp)
movq %r13, 0x20(%rsp)
subl %r13d, %r12d
movl %edx, 0x14(%rsp)
cmpl %edx, %r12d
cmovll %r12d, %edx
movslq %r13d, %rax
leaq (%rbx,%rax,4), %r15
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movl 0xc(%rsp), %ecx
movq %r14, %r8
movl %edx, %r13d
callq 0x66b8
movl %r13d, %edx
movq 0x20(%rsp), %r13
testl %edx, %edx
jle 0x6800
movl %edx, %eax
xorl %ecx, %ecx
movl (%r15,%rcx,4), %esi
movl %esi, (%r14,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x6787
testl %edx, %edx
jle 0x6800
leal -0x1(%r13), %eax
movl 0x14(%rsp), %ecx
cmpl %r12d, %ecx
cmovll %ecx, %r12d
movslq %r12d, %rcx
movq %rcx, %r9
decq %rcx
testl %eax, %eax
js 0x67ec
movl %eax, %esi
addl %r9d, %eax
shlq $0x20, %rax
movl (%rbx,%rsi,4), %edi
cmpl (%r14,%rcx,4), %edi
jle 0x67ea
movq %rax, %r8
sarq $0x1e, %r8
movl %edi, (%rbx,%r8)
leaq -0x1(%rsi), %rdi
addq %rbp, %rax
testq %rsi, %rsi
movq %rdi, %rsi
jg 0x67c0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x67ec
movl %esi, %eax
movl (%r14,%rcx,4), %esi
leal (%r9,%rax), %edi
movslq %edi, %rdi
movl %esi, (%rbx,%rdi,4)
cmpq $0x1, %r9
jg 0x67ad
addl %edx, %r13d
movl 0x10(%rsp), %r12d
cmpl %r12d, %r13d
jl 0x6746
jmp 0x6858
cmpl $0x2, %r12d
jl 0x6858
movl %r12d, %eax
movl $0x1, %ecx
movl (%rbx,%rcx,4), %edx
movq %rcx, %rsi
leaq -0x1(%rsi), %rdi
movl %edi, %r8d
movl (%rbx,%r8,4), %r8d
cmpl %edx, %r8d
jle 0x684a
movl %r8d, (%rbx,%rsi,4)
leaq 0x1(%rdi), %r8
movq %rdi, %rsi
cmpq $0x1, %r8
jg 0x6827
xorl %esi, %esi
movslq %esi, %rsi
movl %edx, (%rbx,%rsi,4)
incq %rcx
cmpq %rax, %rcx
jne 0x6821
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop