// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/jkOwnLib/genoFind.c
// Function: gfHitSort2
static void gfHitSort2(struct gfHit **ptArray, int n,
                       struct gfHit ***nosTemp, struct gfHit **nosSwap)
/* This is a fast recursive sort that uses a temporary
 * buffer (nosTemp) that has to be as big as the array
 * that is being sorted. */
{
    struct gfHit **tmp, **pt1, **pt2;
    int n1, n2;

    /* Divide area to sort in two. */
    n1 = (n>>1);
    n2 = n - n1;
    pt1 = ptArray;
    pt2 =  ptArray + n1;

    /* Sort each area separately.  Handle small case (2 or less elements)
     * here.  Otherwise recurse to sort. */
    if (n1 > 2)
        gfHitSort2(pt1, n1, nosTemp, nosSwap);
    else if (n1 == 2 && pt1[0]->diagonal > pt1[1]->diagonal)
    {
        *nosSwap = pt1[1];
        pt1[1]   = pt1[0];
        pt1[0]   = *nosSwap;
    }
    if (n2 > 2)
        gfHitSort2(pt2, n2, nosTemp, nosSwap);
    else if (n2 == 2 && pt2[0]->diagonal > pt2[1]->diagonal)
    {
        *nosSwap = pt2[1];
        pt2[1]   = pt2[0];
        pt2[0]   = *nosSwap;
    }

    /* At this point both halves are internally sorted.
     * Do a merge-sort between two halves copying to temp
     * buffer.  Then copy back sorted result to main buffer. */
    tmp = *nosTemp;
    while (n1 > 0 && n2 > 0)
    {
        if ((*pt1)->diagonal <= (*pt2)->diagonal)
        {
            --n1;
            *tmp++ = *pt1++;
        }
        else
        {
            --n2;
            *tmp++ = *pt2++;
        }
    }
    /* One or both sides are now fully merged. */
    assert(tmp + n1 + n2 == *nosTemp + n);

    /* If some of first side left to merge copy it to end of temp buf. */
    if (n1 > 0)
        memcpy(tmp, pt1, n1 * sizeof(*tmp));

    /* If some of second side left to merge, we finesse it here:
     * simply refrain from copying over it as we copy back temp buf. */
    memcpy(ptArray, *nosTemp, (n - n2) * sizeof(*ptArray));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %esi, %r15d
movq %rdi, %r9
movl %esi, %r12d
sarl %r12d
movl %esi, 0x4(%rsp)
subl %r12d, %r15d
movslq %r12d, %r13
cmpl $0x3, %r13d
jl 0xdd96
movq %r9, %rdi
movl %r12d, %esi
movq %rdx, %rbp
movq %rbx, %rcx
movq %r9, %r14
callq 0xdd53
movq %r14, %r9
jmp 0xddbe
movq %rdx, %rbp
cmpl $0x2, %r12d
jne 0xddbe
movq (%r9), %rcx
movq 0x8(%r9), %rax
movl 0x10(%rcx), %ecx
cmpl 0x10(%rax), %ecx
jbe 0xddbe
movq %rax, (%rbx)
movq (%r9), %rax
movq %rax, 0x8(%r9)
movq (%rbx), %rax
movq %rax, (%r9)
leaq (%r9,%r13,8), %r14
cmpl $0x3, %r15d
jl 0xdde1
movq %r14, %rdi
movl %r15d, %esi
movq %rbp, %rdx
movq %rbx, %rcx
movq %r9, %rbx
callq 0xdd53
movq %rbx, %r9
jmp 0xde06
cmpl $0x2, %r15d
jne 0xde06
movq (%r14), %rcx
movq 0x8(%r14), %rax
movl 0x10(%rcx), %ecx
cmpl 0x10(%rax), %ecx
jbe 0xde06
movq %rax, (%rbx)
movq (%r14), %rax
movq %rax, 0x8(%r14)
movq (%rbx), %rax
movq %rax, (%r14)
movq (%rbp), %rdi
testl %r12d, %r12d
setg %cl
testl %r15d, %r15d
setg %al
andb %cl, %al
cmpb $0x1, %al
jne 0xde5d
movq %r9, %rsi
movq (%rsi), %rax
movl 0x10(%rax), %edx
movq (%r14), %rcx
cmpl 0x10(%rcx), %edx
jbe 0xde39
decl %r15d
addq $0x8, %r14
movq %rcx, %rax
jmp 0xde40
decl %r12d
addq $0x8, %rsi
movq %rax, (%rdi)
addq $0x8, %rdi
testl %r12d, %r12d
setg %cl
jle 0xde54
testl %r15d, %r15d
jg 0xde1f
movq (%rbp), %rax
movslq %r12d, %r13
jmp 0xde63
movq %rdi, %rax
movq %r9, %rsi
leaq (%rdi,%r13,8), %rdx
movslq %r15d, %r8
leaq (%rdx,%r8,8), %rdx
movl 0x4(%rsp), %r14d
movslq %r14d, %r8
leaq (%rax,%r8,8), %r8
cmpq %r8, %rdx
jne 0xdebc
testb %cl, %cl
je 0xde99
shlq $0x3, %r13
movq %r13, %rdx
movq %r9, %rbx
callq 0x6570
movq %rbx, %r9
movq (%rbp), %rax
subl %r15d, %r14d
movslq %r14d, %rdx
shlq $0x3, %rdx
movq %r9, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6570
leaq 0x7fe48(%rip), %rdi     # 0x8dd0b
leaq 0x7fd56(%rip), %rsi     # 0x8dc20
leaq 0x7fe58(%rip), %rcx     # 0x8dd29
movl $0x434, %edx            # imm = 0x434
callq 0x6460