// File: /workspace/github_cpp_makefile_star2_O3/ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: InplaceInsertionBlock<int>::sort(int*, int)
virtual void sort(T *A, int n)
    {
        int k = sqrt(n);
        if (n < k)
        {
            insertion_sort(A, n);
            return;
        }

        int i;
        for (i = k + 1; i < n - k; i += k)
        {
            insertion_sort(A + i, k);
            inplace_insertion_block(A, i + k - 1, k);
        }
        i -= k;
        while (k > 1)
        {
            k = (n - i) / 2;
            i += k;
            insertion_sort(A + i, k);
            inplace_insertion_block(A, i + k - 1, k);
        }

        for (; i < n; i++)
            insertion(A, i);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r14d
movq %rsi, %rbx
cvtsi2sd %edx, %xmm0
movq %rdi, 0x8(%rsp)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4779
sqrtsd %xmm0, %xmm0
jmp 0x477e
callq 0x3130
cvttsd2si %xmm0, %r15d
movl %r14d, %eax
subl %r15d, %eax
jge 0x47d0
cmpl $0x2, %r14d
jl 0x494f
movl %r14d, %eax
movl $0x1, %ecx
movl (%rbx,%rcx,4), %edx
movq %rcx, %rsi
movl -0x4(%rbx,%rsi,4), %edi
cmpl %edx, %edi
jle 0x47bd
movl %edi, (%rbx,%rsi,4)
decq %rsi
leaq 0x1(%rsi), %rdi
cmpq $0x1, %rdi
ja 0x47a3
xorl %esi, %esi
movslq %esi, %rsi
movl %edx, (%rbx,%rsi,4)
incq %rcx
cmpq %rax, %rcx
jne 0x479d
jmp 0x494f
leal 0x1(%r15), %r12d
cmpl %eax, %r12d
jge 0x487c
movl %r14d, 0x14(%rsp)
movl %r15d, %r13d
movslq %r12d, %r12
movslq %r15d, %rbp
cltq
movq %rax, 0x20(%rsp)
leaq (%rbx,%r12,4), %r14
addq $0x4, %r14
leaq (,%rbp,4), %rax
movq %rax, 0x18(%rsp)
cmpl $0x2, %r15d
jl 0x4853
leaq (%rbx,%r12,4), %rax
movl $0x1, %ecx
movq %r14, %rdx
movl (%rax,%rcx,4), %esi
movq %rdx, %r8
movq %rcx, %rdi
movl -0x4(%r8), %r9d
cmpl %esi, %r9d
jle 0x4841
decq %rdi
movl %r9d, (%r8)
leaq 0x1(%rdi), %r9
addq $-0x4, %r8
cmpq $0x1, %r9
ja 0x4822
xorl %edi, %edi
movslq %edi, %rdi
movl %esi, (%rax,%rdi,4)
incq %rcx
addq $0x4, %rdx
cmpq %r13, %rcx
jne 0x4819
addq %rbp, %r12
leal -0x1(%r12), %edx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl %r15d, %ecx
callq 0x4982
addq 0x18(%rsp), %r14
cmpq 0x20(%rsp), %r12
jl 0x4807
movl 0x14(%rsp), %r14d
subl %r15d, %r12d
cmpl $0x2, %r15d
jl 0x490e
movl %r14d, %ebp
subl %r12d, %ebp
movl %ebp, %ecx
shrl $0x1f, %ecx
addl %ebp, %ecx
sarl %ecx
addl %ecx, %r12d
cmpl $0x3, %ebp
jle 0x48fb
movslq %r12d, %rax
leaq (%rbx,%rax,4), %rax
movl %ecx, %edx
movl $0x1, %esi
movl (%rax,%rsi,4), %edi
movq %rsi, %r8
movl -0x4(%rax,%r8,4), %r9d
cmpl %edi, %r9d
jle 0x48d2
movl %r9d, (%rax,%r8,4)
decq %r8
leaq 0x1(%r8), %r9
cmpq $0x1, %r9
ja 0x48b4
xorl %r8d, %r8d
movslq %r8d, %r8
movl %edi, (%rax,%r8,4)
incq %rsi
cmpq %rdx, %rsi
jne 0x48ae
leal (%rcx,%r12), %edx
decl %edx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x4982
cmpl $0x3, %ebp
jg 0x4889
jmp 0x490e
leal (%rcx,%r12), %edx
decl %edx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x4982
cmpl %r14d, %r12d
jge 0x494f
movslq %r12d, %rax
movslq %r14d, %rcx
movl (%rbx,%rax,4), %edx
movq %rax, %rsi
testq %rax, %rax
jle 0x4944
movq %rax, %rsi
movl -0x4(%rbx,%rsi,4), %edi
cmpl %edx, %edi
jle 0x4941
movl %edi, (%rbx,%rsi,4)
decq %rsi
leaq 0x1(%rsi), %rdi
cmpq $0x1, %rdi
ja 0x4927
xorl %esi, %esi
movslq %esi, %rsi
movl %edx, (%rbx,%rsi,4)
incq %rax
cmpq %rcx, %rax
jne 0x4919
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq