// File: /workspace/github_cpp_makefile_star2_O1/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, %r13d
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 0x67e5
cvttsd2si %xmm0, %r15d
cmpl %r13d, %r15d
jge 0x67e5
cmpl $0x5, %r15d
jle 0x67e5
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl 0xc(%rsp), %ecx
movq %r14, %r8
callq 0x6684
movabsq $-0x100000000, %rbp     # imm = 0xFFFFFFFF00000000
movl %r15d, %eax
movl %r15d, %r12d
movl %r13d, 0x10(%rsp)
subl %r15d, %r13d
movl %eax, 0x14(%rsp)
cmpl %eax, %r13d
cmovll %r13d, %r12d
movq %r15, 0x20(%rsp)
movslq %r15d, %rax
leaq (%rbx,%rax,4), %r15
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movl %r12d, %edx
movl 0xc(%rsp), %ecx
movq %r14, %r8
callq 0x6684
testl %r12d, %r12d
jle 0x6760
movl %r12d, %eax
xorl %ecx, %ecx
movl (%r15,%rcx,4), %esi
movl %esi, (%r14,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x6750
testl %r12d, %r12d
movq 0x20(%rsp), %r15
jle 0x67cf
leal -0x1(%r15), %eax
movl 0x14(%rsp), %ecx
cmpl %r13d, %ecx
cmovll %ecx, %r13d
movslq %r13d, %rcx
movq %rcx, %r9
decq %rcx
testl %eax, %eax
js 0x67bb
movl %eax, %esi
addl %r9d, %eax
shlq $0x20, %rax
movl (%rbx,%rsi,4), %edi
cmpl (%r14,%rcx,4), %edi
jle 0x67b9
movq %rax, %r8
sarq $0x1e, %r8
movl %edi, (%rbx,%r8)
leaq -0x1(%rsi), %rdi
addq %rbp, %rax
testq %rsi, %rsi
movq %rdi, %rsi
jg 0x678f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x67bb
movl %esi, %eax
movl (%r14,%rcx,4), %esi
leal (%r9,%rax), %edi
movslq %edi, %rdi
movl %esi, (%rbx,%rdi,4)
cmpq $0x1, %r9
jg 0x677c
addl %r12d, %r15d
movl %r12d, %eax
movl 0x10(%rsp), %r13d
cmpl %r13d, %r15d
jl 0x6715
jmp 0x682a
cmpl $0x2, %r13d
jl 0x682a
movl %r13d, %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 0x681c
movl %r8d, (%rbx,%rsi,4)
leaq 0x1(%rdi), %r8
movq %rdi, %rsi
cmpq $0x1, %r8
jg 0x67f9
xorl %esi, %esi
movslq %esi, %rsi
movl %edx, (%rbx,%rsi,4)
incq %rcx
cmpq %rax, %rcx
jne 0x67f3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop