// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/jkOwnLib/fuzzyFind.c
// Function: expandLeft
static boolean expandLeft(struct ffAli *ali, DNA *needleStart, DNA *needleEnd,
                          DNA *hayStart, DNA *hayEnd, int numSkips, int gapPenalty, int maxSkip,
                          struct lm **ffMemPool)
/* Given a matching segment, try to expand the aligned parts to the
 * right. */
{
    DNA *ns = ali->nStart;
    DNA *hs = ali->hStart;
    int score;
    DNA *oldNs = ns;

    for (;;)
    {
        while (ns > needleStart && hs > hayStart && ns[-1] == hs[-1])
        {
            --hs;
            --ns;
        }
        if (ns <= needleStart || hs <= hayStart)
        {
            ali->nStart = ns;
            ali->hStart = hs;
            return ns != oldNs;
        }
        /* Find fuzzy score to the left. */
        {
            int windowSize = 5;
            int nSize = ns-needleStart;
            int hSize = hs-hayStart;
            if (windowSize > nSize) windowSize = nSize;
            if (windowSize > hSize) windowSize = hSize;
            if (windowSize > 0)
                score = dnaScoreMatch(ns-windowSize, hs-windowSize, windowSize);
            else
                score = -1;

            if (score >= windowSize-2)
            {
                hs -= windowSize;
                ns -= windowSize;
            }
            else if (--numSkips >= 0)
            {
                struct ffAli *newAli = ffNeedMem(sizeof(*newAli), ffMemPool);
                ali->nStart = ns;
                ali->hStart = hs;
                if (ns - needleStart < 3 ||
                        !leftNextMatch(newAli, needleStart, ns, hayStart, hs, gapPenalty, maxSkip))
                {
                    return ns != oldNs; /* We did our best... */
                }
                newAli->right = ali;
                newAli->left = ali->left;
                if (ali->left)
                    ali->left->right = newAli;
                ali->left = newAli;
                ali = newAli;
                expandRight(ali, needleStart, ns, hayStart, hs, 0, gapPenalty, maxSkip, ffMemPool);
                ns = ali->nStart;
                hs = ali->hStart;
            }
            else
            {
                ali->nStart = ns;
                ali->hStart = hs;
                return ns != oldNs;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r9d, 0x24(%rsp)
movl %r8d, 0x2c(%rsp)
movl %ecx, 0x28(%rsp)
movq %rdx, %r8
movq %rsi, %r9
movq 0x10(%rdi), %rsi
leal 0x1(%rdx), %eax
movl %eax, 0x64(%rsp)
movl $0x1, %r10d
subl %r8d, %r10d
movq %rsi, %rax
movq %rdi, 0x58(%rsp)
movq 0x20(%rdi), %rcx
leaq 0x1(%rcx), %rdi
leal (%r10,%rcx), %r12d
leaq 0x1(%rax), %r15
movq %rax, %rbp
movq %rcx, %r13
movq %rax, %rbx
subq %r9, %rbx
jbe 0xc01a
movq %r13, %r14
subq %r8, %r14
jbe 0xc01a
leaq -0x1(%rbp), %rax
movb -0x1(%rbp), %dl
leaq -0x1(%r13), %rcx
decq %rdi
decl %r12d
decq %r15
cmpb -0x1(%r13), %dl
je 0xbbd0
cmpl %r14d, %ebx
movl %r14d, %eax
cmovll %ebx, %eax
cmpl $0x5, %eax
movl $0x5, %edx
cmovll %eax, %edx
testl %eax, %eax
jle 0xbc76
movl %edx, %eax
movq %r10, 0x48(%rsp)
movq %rdi, 0x38(%rsp)
movq %rbp, %rdi
subq %rax, %rdi
movq %rsi, 0x18(%rsp)
movq %r13, %rsi
subq %rax, %rsi
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rdx
movq %r8, 0x30(%rsp)
movq %r9, 0x50(%rsp)
callq 0x25b71
movq 0x8(%rsp), %rdx
movq 0x38(%rsp), %rdi
movq 0x48(%rsp), %r10
movq 0x50(%rsp), %r9
movq 0x30(%rsp), %r8
movq 0x18(%rsp), %rsi
jmp 0xbc7b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leal -0x2(%rdx), %ecx
cmpl %ecx, %eax
jl 0xbc96
movslq %edx, %rax
subq %rax, %r13
subq %rax, %rbp
movq %r13, %rcx
movq %rbp, %rax
jmp 0xbbc4
cmpl $0x0, 0x28(%rsp)
jle 0xc01a
movq %rdi, 0x38(%rsp)
movq %r10, 0x48(%rsp)
movq %r9, 0x50(%rsp)
movq %r8, 0x30(%rsp)
movq 0x110(%rsp), %rax
movq (%rax), %rdi
movq %rsi, 0x18(%rsp)
movl $0x38, %esi
callq 0x2c325
movq 0x18(%rsp), %rsi
movq %rax, 0x88(%rsp)
movq 0x58(%rsp), %rax
movq %rbp, 0x10(%rax)
movq %r13, 0x20(%rax)
cmpq $0x3, %rbx
jl 0xc027
leal (%rbx,%r14), %ecx
movl 0x24(%rsp), %eax
cmpl %eax, %ecx
cmovgel %eax, %ecx
movq %rcx, 0x40(%rsp)
testl %ecx, %ecx
jle 0xc027
decl 0x28(%rsp)
movl 0x64(%rsp), %eax
subl %r13d, %eax
movslq %ebx, %rcx
movq %rcx, 0x90(%rsp)
movl %r13d, %ecx
subl 0x30(%rsp), %ecx
movl %ecx, 0x60(%rsp)
movslq %r14d, %rcx
movq %rcx, 0x68(%rsp)
movq 0x40(%rsp), %rcx
incl %ecx
movq %rcx, 0x40(%rsp)
movl $0x1, %ecx
testl %eax, %eax
movl $0x0, %edx
movl %eax, 0x14(%rsp)
cmovgl %eax, %edx
movq %rdx, 0x80(%rsp)
movq %rcx, %rax
subq 0x68(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %rcx, %rdi
movq %rcx, 0x70(%rsp)
callq 0x32789
movq 0x80(%rsp), %r8
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
movq 0x70(%rsp), %rcx
cmovgl %r14d, %ecx
testl %esi, %esi
movl $0x0, %edx
cmovlel %edx, %esi
movq %rsi, %rdx
testl %ecx, %ecx
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
movabsq $0x100000000, %rdi      # imm = 0x100000000
js 0xbf3d
addl 0x2c(%rsp), %eax
movl %ebx, %ecx
subl %edx, %ecx
cmpl %ecx, %eax
jg 0xbf3d
movl 0x14(%rsp), %edx
movl %edx, %ecx
sarl $0x1f, %ecx
andl %edx, %ecx
leal (%r12,%rcx), %edx
movslq %edx, %rdx
movslq %eax, %r9
movq %r9, %r10
negq %r10
movq %r10, %r11
subq %rdx, %r11
shlq $0x20, %rdx
movq %rsi, %rax
subq %rdx, %rax
movq %rax, %rdx
movq %r8, %rax
shlq $0x20, %rax
subq %rax, %rsi
movq %r15, %rax
subq %r8, %rax
movq %rax, 0x98(%rsp)
addl 0x60(%rsp), %ecx
movslq %ecx, %rcx
movq 0x68(%rsp), %rax
subq %r9, %rax
movq %rax, 0xd0(%rsp)
movq 0x90(%rsp), %rax
movq %r9, 0x78(%rsp)
subq %r9, %rax
movq %rax, 0xc8(%rsp)
addq 0x38(%rsp), %r11
movq %r11, 0xa0(%rsp)
movq %rsi, %r11
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
xorl %r9d, %r9d
cmpq 0xd0(%rsp), %rcx
jg 0xbf17
movq %r11, %rax
sarq $0x20, %rax
movb (%rbp,%rax), %al
movq %rcx, 0x8(%rsp)
movq %rdx, %rcx
sarq $0x20, %rcx
cmpb (%r13,%rcx), %al
movq 0x8(%rsp), %rcx
jne 0xbf17
movq 0x98(%rsp), %rax
leaq (%rax,%r10), %rdi
movq 0xa0(%rsp), %rax
leaq (%rax,%r9), %rsi
movq %rdx, 0xb0(%rsp)
movq 0x78(%rsp), %rdx
movq %r10, 0xc0(%rsp)
movq %r9, 0xb8(%rsp)
movq %r11, 0xa8(%rsp)
callq 0x6710
movq 0x8(%rsp), %rcx
movq 0xa8(%rsp), %r11
movq 0xb0(%rsp), %rdx
movq 0xb8(%rsp), %r9
movq 0xc0(%rsp), %r10
movq 0x80(%rsp), %r8
movabsq $0x100000000, %rdi      # imm = 0x100000000
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
testl %eax, %eax
je 0xbf60
testq %rcx, %rcx
jle 0xbf3d
leaq (%r8,%r9), %rax
decq %rcx
incq %r9
addq %rdi, %rdx
decq %r10
addq %rsi, %r11
cmpq 0xc8(%rsp), %rax
jl 0xbe5b
movq 0x70(%rsp), %rcx
incq %rcx
movl 0x14(%rsp), %eax
incl %eax
cmpq 0x40(%rsp), %rcx
movq 0x18(%rsp), %rsi
jne 0xbd47
jmp 0xc027
movl 0x14(%rsp), %edx
testl %edx, %edx
movl $0x0, %eax
cmovgl %edx, %eax
movl $0x0, %ecx
cmovnsl %ecx, %edx
subq %rax, %r15
addq %r15, %r10
movq 0x88(%rsp), %rbx
movq %r10, 0x10(%rbx)
subq %r9, %r15
movq %r15, 0x18(%rbx)
addl %edx, %r12d
movslq %r12d, %rax
movq 0x78(%rsp), %rsi
addq %rax, %rsi
movq 0x38(%rsp), %rdx
movq %rdx, %rcx
subq %rsi, %rcx
addq %r9, %rcx
movq %rcx, 0x20(%rbx)
subq %rax, %rdx
addq %r9, %rdx
movq %rdx, 0x28(%rbx)
movq 0x58(%rsp), %rcx
movq %rcx, 0x8(%rbx)
movq (%rcx), %rax
movq %rax, (%rbx)
testq %rax, %rax
je 0xbfd1
movq %rbx, 0x8(%rax)
movq %rbx, (%rcx)
movq 0x110(%rsp), %rax
movq %rax, (%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
movl 0x2c(%rsp), %r8d
movl 0x24(%rsp), %r9d
callq 0xc041
movq 0x10(%rbx), %rax
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %r8
movq 0x50(%rsp), %r9
movq 0x48(%rsp), %r10
jmp 0xbbbb
movq 0x58(%rsp), %rax
movq %rbp, 0x10(%rax)
movq %r13, 0x20(%rax)
xorl %eax, %eax
cmpq %rsi, %rbp
setne %al
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq