// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/fuzzyFind.c
// Function: findAliBetween
struct ffAli *findAliBetween(DNA *tile, int tileSize, DNA *ns, DNA *ne, DNA *hs, DNA *he, struct lm **ffMemPool)
{
    DNA *match;
    DNA *tileEnd = tile + tileSize;
    int tries = 0;

    for (;;)
    {
        if ((match = matchInMem(tile, tileEnd, hs, he)) == NULL)
            return NULL;
        if (matchInMem(tile, tileEnd, match+1, he) == NULL)
        {
            /* Got exactly one match, whoopie! */
            struct ffAli *ali = ffNeedMem(sizeof(*ali), ffMemPool);
            ali->nStart = tile;
            ali->nEnd = tileEnd;
            ali->hStart = match;
            ali->hEnd = match + (tileEnd-tile);
            ffExpandExactLeft(ali, ns, hs);
            ffExpandExactRight(ali, ne, he);
            return ali;
        }

        /* Got more than one match.  Expand tile to make it more specific.
         * In general first add base to start, then base to beginning.  If
         * at beginning or end already are constrained.  If already spanning
         * full needle, can't expand, so you're done. */
        if (tile <= ns)
        {
            if (tileEnd >= ne)
                return NULL;
            ++tileEnd;
        }
        else if (tile >= tileEnd)
        {
            --tile;
        }
        else if (tries & 1)
        {
            ++tileEnd;
        }
        else
        {
            --tile;
        }
        ++tries;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x99b0
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x9ad5
movq $0x0, -0x8(%rbp)
jmp 0x9beb
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq $0x1, %rdx
movq -0x38(%rbp), %rcx
callq 0x99b0
cmpq $0x0, %rax
jne 0x9b70
movq 0x10(%rbp), %rsi
movl $0x38, %edi
callq 0x9c00
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x40(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rdx
subq %rdx, %rax
addq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x58(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x1aae0
movq -0x58(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x1aa40
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x9beb
movq -0x10(%rbp), %rax
cmpq -0x20(%rbp), %rax
ja 0x9b9c
movq -0x48(%rbp), %rax
cmpq -0x28(%rbp), %rax
jb 0x9b8e
movq $0x0, -0x8(%rbp)
jmp 0x9beb
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x9bdd
movq -0x10(%rbp), %rax
cmpq -0x48(%rbp), %rax
jb 0x9bb4
movq -0x10(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x9bdb
movl -0x4c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x9bcd
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x9bd9
movq -0x10(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x9bdb
jmp 0x9bdd
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x9aa9
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)