// File: /workspace/github_c_makefile_star2_O1/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)
movq %rdx, %r13
movq %rsi, %r8
movq %rdi, %r15
movq 0x10(%rdi), %r9
movq 0x20(%rdi), %rdx
movl $0x1, %edi
subl %r13d, %edi
leal 0x1(%r13), %eax
movl %eax, 0x48(%rsp)
movq %r9, 0x38(%rsp)
movq %r9, 0x8(%rsp)
movq %rcx, 0x18(%rsp)
leal (%rdi,%rdx), %ebx
movq 0x8(%rsp), %rsi
leaq 0x1(%rsi), %rbp
movq %rdx, %rcx
movq %rsi, %rdx
movq %rdx, %r11
movq %rcx, %r9
movq %rdx, %r14
subq %r8, %r14
seta %cl
movq %r9, %r12
subq %r13, %r12
seta %r10b
andb %cl, %r10b
cmpb $0x1, %r10b
jne 0xc1af
leaq -0x1(%r11), %rdx
movb -0x1(%r11), %sil
leaq -0x1(%r9), %rcx
decl %ebx
decq %rbp
cmpb -0x1(%r9), %sil
je 0xbd26
testb %r10b, %r10b
je 0xc1af
movq %rbp, 0x80(%rsp)
movl %ebx, 0x4c(%rsp)
movl %eax, 0x28(%rsp)
cmpl %r12d, %r14d
movl %r12d, %eax
cmovll %r14d, %eax
cmpl $0x5, %eax
movl $0x5, %ebx
cmovll %eax, %ebx
testl %eax, %eax
movq %r9, 0x10(%rsp)
movq %r11, 0x8(%rsp)
movq %r15, 0x30(%rsp)
jle 0xbdcc
movl %ebx, %eax
movq %rdi, %r15
movq %r11, %rdi
subq %rax, %rdi
movq %r9, %rsi
subq %rax, %rsi
movl %ebx, %edx
movq %r8, %rbp
callq 0x25866
movq %r15, %rdi
movq 0x30(%rsp), %r15
movq %rbp, %r8
jmp 0xbdd1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x18(%rsp), %r11
leal -0x2(%rbx), %ecx
cmpl %ecx, %eax
jge 0xc0f4
leal -0x1(%r11), %esi
testl %r11d, %r11d
jle 0xc110
movl %esi, 0x20(%rsp)
movq %rdi, 0x50(%rsp)
movq %r8, 0x58(%rsp)
movq %r13, 0x60(%rsp)
movq 0x110(%rsp), %rax
movq (%rax), %rdi
movl $0x38, %esi
callq 0x2bfa9
movq %rax, 0x68(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%r15)
movq 0x10(%rsp), %rdx
movq %rdx, 0x20(%r15)
cmpq $0x3, %r14
jl 0xc0c8
leal (%r14,%r12), %ecx
movl 0x24(%rsp), %eax
cmpl %eax, %ecx
cmovgel %eax, %ecx
movq %rcx, 0x40(%rsp)
testl %ecx, %ecx
jle 0xc0c8
movl 0x48(%rsp), %ecx
subl %edx, %ecx
movslq %r14d, %rax
movq %rax, 0x78(%rsp)
movslq %r12d, %rax
movq %rax, 0x70(%rsp)
movq 0x40(%rsp), %rax
incl %eax
movq %rax, 0x40(%rsp)
movl $0x1, %ebx
testl %ecx, %ecx
movl $0x0, %r13d
movl %ecx, 0x18(%rsp)
cmovgl %ecx, %r13d
movq %rbx, %rdi
callq 0x324a3
movq 0x10(%rsp), %rdx
cmpq 0x70(%rsp), %rbx
movq %rbx, 0xd0(%rsp)
movl %ebx, %ecx
cmovgl %r12d, %ecx
testl %ecx, %ecx
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
movabsq $0x100000000, %rdi      # imm = 0x100000000
js 0xc0ac
movl 0x18(%rsp), %r8d
movl %r8d, %ecx
sarl $0x1f, %ecx
andl %r8d, %ecx
addl 0x4c(%rsp), %ecx
movslq %ecx, %r10
movq %rdx, %rbx
subq %r10, %rbx
movq %r10, %rcx
shlq $0x20, %rcx
movq %rsi, %r15
subq %rcx, %r15
movq %r13, %rcx
shlq $0x20, %rcx
movq %rsi, %rbp
subq %rcx, %rbp
movq 0x80(%rsp), %rdx
movq %rdx, %r11
subq %r13, %r11
movq %r11, 0x88(%rsp)
addl 0x2c(%rsp), %eax
testl %r8d, %r8d
movl $0x0, %r14d
cmovgl %r8d, %r14d
cltq
movq %rax, %r8
negq %r8
movq 0x78(%rsp), %r11
subq %rax, %r11
movq 0x70(%rsp), %r9
movq %rax, 0xc0(%rsp)
subq %rax, %r9
movq %r8, %rax
movq %r8, 0xb8(%rsp)
movq %r9, %r8
subq %r13, %rax
addq %rdx, %rax
movq %rax, 0xa0(%rsp)
movq 0x10(%rsp), %rdx
xorl %r13d, %r13d
movq %r10, 0xc8(%rsp)
movq %r11, 0xb0(%rsp)
movq %r9, 0xa8(%rsp)
cmpq %r11, %r14
jle 0xbf88
movl $0x5, %eax
jmp 0xbf96
leaq (%r10,%r13), %rax
cmpq %r8, %rax
jle 0xbfc8
movl $0x7, %eax
xorl %ecx, %ecx
testl %eax, %eax
je 0xbfa5
cmpl $0x7, %eax
jne 0xc09f
incq %r14
incq %rbx
leaq (%r10,%r13), %rax
decq %rax
decq %r13
incq %rax
addq %rdi, %r15
addq %rsi, %rbp
testq %rax, %rax
jg 0xbf7c
jmp 0xc0ac
movq %rbp, %rax
sarq $0x20, %rax
movq 0x8(%rsp), %rcx
movb (%rcx,%rax), %al
movq %r15, %rcx
sarq $0x20, %rcx
cmpb (%rdx,%rcx), %al
jne 0xc096
movq 0xa0(%rsp), %rax
leaq (%rax,%r13), %rdi
movq 0xb8(%rsp), %rax
leaq (%rbx,%rax), %rsi
movq %rdi, 0x90(%rsp)
movq %rsi, 0x98(%rsp)
movq 0xc0(%rsp), %rdx
callq 0x6710
movq 0xa8(%rsp), %r8
movq 0xb0(%rsp), %r11
movq 0xc8(%rsp), %r10
movabsq $0x100000000, %rdi      # imm = 0x100000000
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
movq 0x10(%rsp), %rdx
testl %eax, %eax
movl $0x0, %eax
movb $0x1, %cl
jne 0xbf98
movq 0x88(%rsp), %rax
addq %r13, %rax
movq 0x68(%rsp), %rcx
movq 0x90(%rsp), %r9
movq %r9, 0x10(%rcx)
movq %rax, 0x18(%rcx)
movq 0x98(%rsp), %rax
movq %rax, 0x20(%rcx)
movq %rbx, 0x28(%rcx)
movl $0x1, %eax
jmp 0xbf96
xorl %eax, %eax
movb $0x1, %cl
jmp 0xbf98
cmpl $0x5, %eax
je 0xc0ac
testb %cl, %cl
je 0xc13f
movq 0xd0(%rsp), %rbx
incq %rbx
movl 0x18(%rsp), %ecx
incl %ecx
cmpq 0x40(%rsp), %rbx
jne 0xbe78
xorl %eax, %eax
movq 0x8(%rsp), %rcx
cmpq 0x38(%rsp), %rcx
setne %al
xorl %r10d, %r10d
movq 0x60(%rsp), %r13
movq 0x58(%rsp), %r8
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %r15
movl 0x20(%rsp), %esi
jmp 0xc12f
movslq %ebx, %rax
movq 0x10(%rsp), %rdx
subq %rax, %rdx
subq %rax, 0x8(%rsp)
movb $0x1, %r10b
movl %r11d, %esi
movl 0x28(%rsp), %eax
jmp 0xc12f
movq 0x8(%rsp), %rcx
movq %rcx, 0x10(%r15)
movq 0x10(%rsp), %rdx
movq %rdx, 0x20(%r15)
xorl %eax, %eax
cmpq 0x38(%rsp), %rcx
setne %al
xorl %r10d, %r10d
movl %esi, %ecx
testb %r10b, %r10b
jne 0xbd0f
jmp 0xc1c1
movq 0x30(%rsp), %rcx
movq 0x68(%rsp), %r15
movq %rcx, 0x8(%r15)
movq (%rcx), %rax
movq %rax, (%r15)
movq (%rcx), %rax
testq %rax, %rax
movq 0x60(%rsp), %r13
je 0xc164
movq %r15, 0x8(%rax)
movq %r15, (%rcx)
movq 0x110(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movq 0x8(%rsp), %rsi
xorl %ecx, %ecx
movl 0x2c(%rsp), %r8d
movl 0x24(%rsp), %r9d
callq 0xc1d3
movq 0x10(%r15), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%r15), %rdx
movb $0x1, %r10b
movq 0x58(%rsp), %r8
movq 0x50(%rsp), %rdi
movl 0x28(%rsp), %eax
jmp 0xc0ee
movq %r11, 0x10(%r15)
movq %r9, 0x20(%r15)
xorl %eax, %eax
cmpq 0x38(%rsp), %r11
setne %al
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq