// File: /workspace/github_c_makefile_star2_O2/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 $0xc8, %rsp
movl %r9d, 0x1c(%rsp)
movl %r8d, 0x24(%rsp)
movl %ecx, 0x20(%rsp)
movq %rdx, %r8
movq 0x10(%rdi), %rcx
pushq $0x1
popq %rdx
subl %r8d, %edx
leal 0x1(%r8), %eax
movl %eax, 0x6c(%rsp)
pushq $0x5
popq %r10
pushq $-0x1
popq %r11
movq %rcx, 0x60(%rsp)
movq %rcx, %rax
movq %rdi, 0x58(%rsp)
movq 0x20(%rdi), %rcx
movq %rdx, %rdi
leaq 0x1(%rax), %r12
leaq 0x1(%rcx), %r13
leal (%rdi,%rcx), %r15d
movq %rax, %r9
movq %rcx, %rbp
movq %rax, %rbx
subq %rsi, %rbx
jbe 0xa3b0
movq %rbp, %r14
subq %r8, %r14
jbe 0xa3b0
leaq -0x1(%r9), %rax
movb -0x1(%r9), %dl
leaq -0x1(%rbp), %rcx
decq %r12
decq %r13
decl %r15d
cmpb -0x1(%rbp), %dl
je 0x9fce
cmpl %r14d, %ebx
movl %r14d, %ecx
cmovll %ebx, %ecx
cmpl $0x5, %ecx
movl %r10d, %edx
cmovll %ecx, %edx
movl %r11d, %eax
testl %ecx, %ecx
jle 0xa076
movl %edx, %eax
movq %rdi, 0x30(%rsp)
movq %r9, 0x10(%rsp)
movq %rsi, %rcx
movq 0x10(%rsp), %rdi
subq %rax, %rdi
movq %rbp, %rsi
subq %rax, %rsi
movq %rdx, 0x28(%rsp)
movq 0x28(%rsp), %rdx
movq %r8, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
callq 0x21317
movq 0x28(%rsp), %rdx
movq 0x10(%rsp), %r9
pushq $-0x1
popq %r11
pushq $0x5
popq %r10
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %r8
leal -0x2(%rdx), %ecx
cmpl %ecx, %eax
jl 0xa091
movslq %edx, %rax
subq %rax, %rbp
subq %rax, %r9
movq %rbp, %rcx
movq %r9, %rax
jmp 0x9fc2
cmpl $0x0, 0x20(%rsp)
jle 0xa3b0
movq %rdi, 0x30(%rsp)
movq %rsi, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x10(%rsp)
pushq $0x38
popq %rdi
movq 0x100(%rsp), %rsi
callq 0x8e0c
movq 0x10(%rsp), %r9
movq 0x60(%rsp), %rcx
movq %rax, 0x80(%rsp)
movq 0x58(%rsp), %rax
movq %r9, 0x10(%rax)
movq %rbp, 0x20(%rax)
cmpq $0x3, %rbx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
jl 0xa3c2
decl 0x20(%rsp)
leal (%rbx,%r14), %r8d
movl 0x1c(%rsp), %eax
cmpl %eax, %r8d
cmovgel %eax, %r8d
movl 0x6c(%rsp), %esi
subl %ebp, %esi
movslq %r14d, %rax
movq %rax, 0x90(%rsp)
movslq %ebx, %rax
movq %rax, 0x88(%rsp)
testl %r8d, %r8d
movl $0x0, %eax
cmovlel %eax, %r8d
incl %r8d
movq %r8, 0x98(%rsp)
pushq $0x1
popq %rdi
testl %esi, %esi
movl $0x0, %ebx
cmovgl %esi, %ebx
movl $0x0, %eax
cmovsl %esi, %eax
cmpq 0x98(%rsp), %rdi
je 0xa3c2
movq %rbx, %rcx
shlq $0x20, %rcx
movq %rdx, %r8
subq %rcx, %r8
movq %r8, 0x50(%rsp)
addl %r15d, %eax
movslq %eax, %rcx
movq %rcx, 0x78(%rsp)
movq %rcx, %rax
shlq $0x20, %rax
subq %rax, %rdx
movq %rdx, 0x48(%rsp)
movq %r13, %rax
subq %rcx, %rax
movq %rax, 0xb0(%rsp)
testl %esi, %esi
movl $0x0, %r14d
movl %esi, 0x18(%rsp)
cmovgl %esi, %r14d
movq %rdi, 0xa0(%rsp)
callq 0x2d0c4
movq 0x48(%rsp), %r11
movq 0x78(%rsp), %r10
movq 0x50(%rsp), %rdi
movq 0x10(%rsp), %r9
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
addl 0x24(%rsp), %eax
cltq
movq %rax, %r8
negq %r8
movq 0x88(%rsp), %rcx
subq %rax, %rcx
movq %rcx, 0x28(%rsp)
movq 0x90(%rsp), %rcx
movq %rax, 0x70(%rsp)
subq %rax, %rcx
movq %rcx, 0xc0(%rsp)
movq %r8, %rax
subq %rbx, %rax
addq %r12, %rax
movq %rax, 0xa8(%rsp)
xorl %ebx, %ebx
movabsq $0x100000000, %rsi      # imm = 0x100000000
movq %r10, %rax
addq %rbx, %rax
js 0xa2db
cmpq 0x28(%rsp), %r14
jg 0xa2db
cmpq 0xc0(%rsp), %rax
jg 0xa2c7
movq %rdi, %rax
sarq $0x20, %rax
movb (%r9,%rax), %al
movq %r11, %rcx
sarq $0x20, %rcx
cmpb (%rbp,%rcx), %al
jne 0xa2c7
movq %rdi, 0x50(%rsp)
movq 0xa8(%rsp), %rax
leaq (%rax,%rbx), %rdi
movq 0xb0(%rsp), %rax
leaq (%rax,%r8), %rsi
movq 0x70(%rsp), %rdx
movq %r8, 0xb8(%rsp)
movq %r11, 0x48(%rsp)
callq 0x6710
movq 0x48(%rsp), %r11
movq 0x78(%rsp), %r10
movq 0x50(%rsp), %rdi
movq 0xb8(%rsp), %r8
movq 0x10(%rsp), %r9
movabsq $0x100000000, %rsi      # imm = 0x100000000
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
testl %eax, %eax
je 0xa2f6
incq %r14
decq %rbx
addq %rdx, %rdi
incq %r8
addq %rsi, %r11
jmp 0xa222
movq 0xa0(%rsp), %rdi
incq %rdi
movl 0x18(%rsp), %esi
incl %esi
movq 0x60(%rsp), %rcx
jmp 0xa13c
movl 0x18(%rsp), %edx
testl %edx, %edx
movl $0x0, %eax
cmovgl %edx, %eax
movl $0x0, %ecx
cmovnsl %ecx, %edx
movq 0x70(%rsp), %rsi
addq %rax, %rsi
movq %r12, %rcx
subq %rsi, %rcx
addq %rbx, %rcx
movq 0x80(%rsp), %r14
movq %rcx, 0x10(%r14)
subq %rax, %r12
addq %rbx, %r12
movq %r12, 0x18(%r14)
addl %edx, %r15d
movslq %r15d, %rax
subq %rax, %r13
addq %r13, %r8
movq %r8, 0x20(%r14)
subq %rbx, %r13
movq %r13, 0x28(%r14)
movq 0x58(%rsp), %rcx
movq %rcx, 0x8(%r14)
movq (%rcx), %rax
movq %rax, (%r14)
testq %rax, %rax
je 0xa362
movq %r14, 0x8(%rax)
movq %r14, (%rcx)
movq 0x100(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
movl 0x24(%rsp), %r8d
movl 0x1c(%rsp), %r9d
callq 0xa3dc
movq 0x10(%r14), %rax
movq %r14, %rdi
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
pushq $0x5
popq %r10
pushq $-0x1
popq %r11
jmp 0x9fb6
movq 0x58(%rsp), %rax
movq %r9, 0x10(%rax)
movq %rbp, 0x20(%rax)
movq 0x60(%rsp), %rcx
xorl %eax, %eax
cmpq %rcx, %r9
setne %al
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq