// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/fuzzyFind.c
// Function: weaveAli
static struct ffAli *weaveAli(struct ffAli *hitList,
                              DNA *ns, DNA *ne, DNA *hs, DNA *he, double freq[4], int *rBestVal,
                              enum ffStringency stringency, struct lm **ffMemPool)
/* Weave together best looking alignment out of the hitList list. */
{
    struct ffAli *ali, *lastAli;
    struct protoGene *proto, *protoList = NULL;
    int protoCount = 0;

    /* Sort initial hits and remove duplicates. */
    ffAliSort(&hitList, ffCmpHitsHayFirst);
    ali = hitList;
    for (;;)
    {
        lastAli = ali;
        if ((ali = ali->right) == NULL)
            break;
        if (ali->hStart == lastAli->hStart && ali->hEnd == lastAli->hEnd
                && ali->nStart == lastAli->nStart && ali->nEnd == lastAli->nEnd)
        {
            unlinkAli(&hitList, lastAli);
        }
    }

    /* Lump together things which look to be separated only by small
     * amounts of noise. */
    while ((proto = lumpHits(&hitList, ns, hs, ffMemPool)) != NULL)
    {
        proto->left = protoList;
        protoList = proto;
        ++protoCount;
    }
    if (protoCount > 200)
    {
        thinProtoList(&protoList, 200);
    }
    protoList = (struct protoGene *)ffMakeRightLinks((struct ffAli*)protoList);


    /* Lump together any other ones that can, starting with ones
     * that go together best. */
    ffAliSort((struct ffAli**)(void*)&protoList, cmpProtoNeedle);
    lumpProtoGenes(&protoList, ns, hs, stringency );
    for (proto = protoList; proto != NULL; proto = proto->right)
    {
        ffAliSort((struct ffAli**)&proto->hits, ffCmpHitsNeedleFirst);
        /*    removeThrowbackHits(proto); */
        proto->score = ffScore(proto->hits,stringency);
    }

    /* Sort by score and return the best. */
    ffAliSort((struct ffAli **)(void*)&protoList, cmpProtoScore);
    *rBestVal = protoList->score;
    return protoList->hits;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x20(%rbp), %rax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
leaq -0x8(%rbp), %rdi
leaq 0xed6b(%rip), %rsi      # 0x1a980
callq 0x1a900
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0xbc3e
jmp 0xbc95
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x40(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jne 0xbc93
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x40(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jne 0xbc93
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0xbc93
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jne 0xbc93
movq -0x40(%rbp), %rsi
leaq -0x8(%rbp), %rdi
callq 0x9e00
jmp 0xbc22
jmp 0xbc97
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0x20(%rbp), %rcx
leaq -0x8(%rbp), %rdi
callq 0xa3a0
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0xbcd4
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xbc97
cmpl $0xc8, -0x54(%rbp)
jle 0xbceb
leaq -0x50(%rbp), %rdi
movl $0xc8, %esi
callq 0xa560
movq -0x50(%rbp), %rdi
callq 0x37bc0
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x1e73(%rip), %rsi     # 0x9e90
callq 0x1a900
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl 0x18(%rbp), %ecx
leaq -0x50(%rbp), %rdi
callq 0xa340
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0xbd66
movq -0x48(%rbp), %rdi
addq $0x10, %rdi
leaq 0xeca6(%rip), %rsi      # 0x1a9e0
callq 0x1a900
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movl 0x18(%rbp), %esi
callq 0x38510
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0xbd24
leaq -0x50(%rbp), %rdi
leaq -0x1ea1(%rip), %rsi     # 0x9ed0
callq 0x1a900
movq -0x50(%rbp), %rax
movl 0x38(%rax), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)