// File: /workspace/github_cpp_makefile_star2_O1/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, %r13
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x47b1
sqrtsd %xmm0, %xmm0
jmp 0x47b6
callq 0x3130
cvttsd2si %xmm0, %r15d
movl %r14d, %eax
subl %r15d, %eax
jge 0x4808
cmpl $0x2, %r14d
jl 0x4976
movl %r14d, %eax
movl $0x1, %ecx
movl (%rbx,%rcx,4), %edx
movq %rcx, %rsi
movl -0x4(%rbx,%rsi,4), %edi
cmpl %edx, %edi
jle 0x47f5
movl %edi, (%rbx,%rsi,4)
decq %rsi
leaq 0x1(%rsi), %rdi
cmpq $0x1, %rdi
jg 0x47db
xorl %esi, %esi
movslq %esi, %rsi
movl %edx, (%rbx,%rsi,4)
incq %rcx
cmpq %rax, %rcx
jne 0x47d5
jmp 0x4976
leal 0x1(%r15), %r12d
cmpl %eax, %r12d
jge 0x48be
movq %r13, 0x10(%rsp)
movl %r14d, 0xc(%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 0x4890
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 0x487e
decq %rdi
movl %r9d, (%r8)
leaq 0x1(%rdi), %r9
addq $-0x4, %r8
cmpq $0x1, %r9
jg 0x485f
xorl %edi, %edi
movslq %edi, %rdi
movl %esi, (%rax,%rdi,4)
incq %rcx
addq $0x4, %rdx
cmpq %r13, %rcx
jne 0x4856
addq %rbp, %r12
leal -0x1(%r12), %edx
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movl %r15d, %ecx
callq 0x49aa
addq 0x18(%rsp), %r14
cmpq 0x20(%rsp), %r12
jl 0x4844
movl 0xc(%rsp), %r14d
movq 0x10(%rsp), %r13
subl %r15d, %r12d
cmpl $0x2, %r15d
jl 0x4935
movl %r14d, %ebp
subl %r12d, %ebp
movl %ebp, %ecx
shrl $0x1f, %ecx
addl %ebp, %ecx
sarl %ecx
addl %ecx, %r12d
cmpl $0x4, %ebp
jl 0x491f
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 0x4910
movl %r9d, (%rax,%r8,4)
decq %r8
leaq 0x1(%r8), %r9
cmpq $0x1, %r9
jg 0x48f2
xorl %r8d, %r8d
movslq %r8d, %r8
movl %edi, (%rax,%r8,4)
incq %rsi
cmpq %rdx, %rsi
jne 0x48ec
leal (%rcx,%r12), %edx
decl %edx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x49aa
cmpl $0x3, %ebp
jg 0x48c7
cmpl %r14d, %r12d
jge 0x4976
movslq %r12d, %rax
movslq %r14d, %rcx
movl (%rbx,%rax,4), %edx
movq %rax, %rsi
testq %rax, %rax
jle 0x4968
movq %rax, %rsi
movl -0x4(%rbx,%rsi,4), %edi
cmpl %edx, %edi
jle 0x4968
movl %edi, (%rbx,%rsi,4)
decq %rsi
leaq 0x1(%rsi), %rdi
cmpq $0x1, %rdi
jg 0x494e
xorl %esi, %esi
movslq %esi, %rsi
movl %edx, (%rbx,%rsi,4)
incq %rax
cmpq %rcx, %rax
jne 0x4940
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop