// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/jkOwnLib/fuzzyFind.c
// Function: expandRight
static boolean expandRight(struct ffAli *ali, DNA *needleStart, DNA *needleEnd,
                           DNA *hayStart, DNA *hayEnd, int numSkips, int gapPenalty, int maxSkip,
                           struct lm **ffMemPool)
/* Given a matched segment, try to expand it to the right. */
{
    int score;
    DNA *ne = ali->nEnd;
    DNA *he = ali->hEnd;
    DNA *oldNe = ne;

    for (;;)
    {
        /* Expand as far to the right as you can keeping perfect match */
        while (ne < needleEnd && he < hayEnd && *ne == *he)
        {
            ++he;
            ++ne;
        }

        /* Check to see if have come to the end. */
        if (ne >= needleEnd || he >= hayEnd)
        {
            ali->nEnd = ne;
            ali->hEnd = he;
            return oldNe != ne;
        }

        /* Find fuzzy score to the right. */
        {
            int windowSize = 5;
            int nSize = needleEnd-ne;
            int hSize = hayEnd - he;
            if (windowSize > nSize) windowSize = nSize;
            if (windowSize > hSize) windowSize = hSize;
            if (windowSize > 0)
                score = dnaScoreMatch(ne, he, windowSize);
            else
                score = -1;

            if (score >= windowSize-2)
            {
                he += windowSize;
                ne += windowSize;
            }
            else if (--numSkips >= 0)
            {
                struct ffAli *newAli = ffNeedMem(sizeof(*newAli), ffMemPool);
                ali->nEnd = ne;
                ali->hEnd = he;
                if (needleEnd - ne < 3 ||
                        !rightNextMatch(newAli, ne, needleEnd, he, hayEnd, gapPenalty, maxSkip))
                {
                    return oldNe != ne; /* We did our best... */
                }
                newAli->left = ali;
                newAli->right = ali->right;
                if (ali->right)
                    ali->right->left = newAli;
                ali->right = newAli;
                ali = newAli;
                expandLeft(ali, ne, needleEnd, he, hayEnd, 0, gapPenalty, maxSkip, ffMemPool);
                ne = ali->nEnd;
                he = ali->hEnd;
            }
            else
            {
                ali->nEnd = ne;
                ali->hEnd = he;
                return oldNe != ne;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r9d, 0x34(%rsp)
movl %r8d, 0x38(%rsp)
movl %ecx, %ebx
movq %rdx, %r13
movq %rsi, %rbp
movq 0x18(%rdi), %r12
movq %rdi, 0x20(%rsp)
movq 0x28(%rdi), %rsi
leal 0x1(%rdx), %eax
movl %eax, 0x58(%rsp)
movl $0x1, %eax
subl %r13d, %eax
movq %rax, 0x80(%rsp)
movq %r12, %rdi
cmpq %rbp, %rdi
setb %cl
cmpq %r13, %rsi
setb %al
andb %cl, %al
cmpb $0x1, %al
jne 0xc628
movb (%rdi), %cl
cmpb (%rsi), %cl
jne 0xc26c
incq %rdi
incq %rsi
cmpq %rbp, %rdi
setb %cl
cmpq %r13, %rsi
setb %al
andb %cl, %al
je 0xc628
movb (%rdi), %dl
incq %rdi
leaq 0x1(%rsi), %rcx
cmpb (%rsi), %dl
movq %rcx, %rsi
je 0xc23f
decq %rdi
decq %rcx
movq %rcx, %rsi
testb %al, %al
je 0xc628
movq %rbp, %r15
subq %rdi, %r15
movq %r13, %rax
subq %rsi, %rax
cmpl %eax, %r15d
movq %rax, 0x50(%rsp)
cmovll %r15d, %eax
cmpl $0x5, %eax
movl $0x5, %r14d
cmovll %eax, %r14d
testl %eax, %eax
movq %rdi, 0x28(%rsp)
movq %rsi, 0x10(%rsp)
jle 0xc2b1
movl %r14d, %edx
callq 0x25866
jmp 0xc2b6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leal -0x2(%r14), %ecx
cmpl %ecx, %eax
jge 0xc564
leal -0x1(%rbx), %ecx
testl %ebx, %ebx
jle 0xc57d
movl %ecx, 0x30(%rsp)
movq %rbp, 0x60(%rsp)
movq %r13, 0x40(%rsp)
movq %r12, 0x68(%rsp)
movq 0x110(%rsp), %rax
movq (%rax), %rdi
movl $0x38, %esi
callq 0x2bfa9
movq %rax, 0x70(%rsp)
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rcx
movq %rax, 0x18(%rcx)
movq 0x10(%rsp), %rax
movq %rax, 0x28(%rcx)
cmpq $0x3, %r15
jl 0xc537
movq 0x50(%rsp), %rax
leal (%rax,%r15), %ecx
movl 0x34(%rsp), %eax
cmpl %eax, %ecx
cmovgel %eax, %ecx
movq %rcx, 0x48(%rsp)
testl %ecx, %ecx
jle 0xc537
movslq %r15d, %rax
movq %rax, 0x98(%rsp)
movslq 0x50(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0x48(%rsp), %rax
incl %eax
movq %rax, 0x48(%rsp)
movl 0x58(%rsp), %eax
movq 0x10(%rsp), %rcx
subl %ecx, %eax
movq %rax, 0x90(%rsp)
movq 0x80(%rsp), %rax
leal (%rax,%rcx), %edx
movq 0x40(%rsp), %rax
subl %ecx, %eax
movq %rax, 0x88(%rsp)
movl $0x1, %ebx
testl %edx, %edx
movl $0x0, %r14d
movl %edx, 0x3c(%rsp)
cmovgl %edx, %r14d
movq %rbx, %rdi
callq 0x324a3
movl %eax, %esi
cmpq 0xa0(%rsp), %rbx
movq %rbx, 0xd0(%rsp)
movl %ebx, %eax
cmovgl 0x50(%rsp), %eax
testl %eax, %eax
js 0xc51b
movq %r14, %rdx
movl 0x3c(%rsp), %eax
movl %eax, %r10d
sarl $0x1f, %r10d
andl %eax, %r10d
movq 0x90(%rsp), %rax
leal (%rax,%r10), %r12d
movq 0x88(%rsp), %rax
leal (%rax,%r10), %r15d
addq 0x10(%rsp), %r15
negl %r10d
movq 0x28(%rsp), %rax
leaq (%rax,%r14), %r8
addl 0x38(%rsp), %esi
movslq %esi, %r9
movq 0x98(%rsp), %rbp
subq %r9, %rbp
movq %r9, 0x78(%rsp)
leaq (%r9,%r14), %rcx
addq %rax, %rcx
movq %rcx, 0xa8(%rsp)
xorl %r14d, %r14d
movq %rdx, 0xc8(%rsp)
movl %esi, 0x5c(%rsp)
movq %r10, 0xc0(%rsp)
movq %r8, 0xb8(%rsp)
leaq (%rdx,%r14), %rax
cmpq %rbp, %rax
jle 0xc459
movl $0x5, %r13d
jmp 0xc46a
leal (%r10,%r14), %eax
xorl %r13d, %r13d
cmpl %eax, %esi
jle 0xc48e
movl $0x7, %r13d
xorl %ebx, %ebx
testl %r13d, %r13d
je 0xc47b
cmpl $0x7, %r13d
jne 0xc50d
decl %r12d
decq %r15
incq %r14
testl %r12d, %r12d
jg 0xc448
jmp 0xc51b
movb (%r8,%r14), %al
movb $0x1, %bl
cmpb (%r15), %al
jne 0xc46c
leaq (%r8,%r14), %rdi
movq %rdi, 0xb0(%rsp)
movq %r15, %rsi
movq 0x78(%rsp), %rdx
callq 0x6710
movq 0xb8(%rsp), %r8
movq 0xc0(%rsp), %r10
movl 0x5c(%rsp), %esi
movq 0xc8(%rsp), %rdx
testl %eax, %eax
jne 0xc46c
movq 0x70(%rsp), %rcx
movq 0xb0(%rsp), %rax
movq %rax, 0x10(%rcx)
movq 0xa8(%rsp), %rax
addq %r14, %rax
movq %rax, 0x18(%rcx)
movq %r15, 0x20(%rcx)
movq 0x78(%rsp), %rax
addq %r15, %rax
movq %rax, 0x28(%rcx)
movl $0x1, %r13d
jmp 0xc46a
cmpl $0x5, %r13d
je 0xc51b
testb %bl, %bl
je 0xc5b1
movq 0xd0(%rsp), %rbx
incq %rbx
movl 0x3c(%rsp), %edx
incl %edx
cmpq 0x48(%rsp), %rbx
jne 0xc390
xorl %eax, %eax
movq 0x68(%rsp), %r12
movq 0x28(%rsp), %rdi
cmpq %rdi, %r12
setne %al
movl %eax, 0x1c(%rsp)
xorl %eax, %eax
movq 0x40(%rsp), %r13
movq 0x60(%rsp), %rbp
movq 0x10(%rsp), %rsi
movl 0x30(%rsp), %ecx
jmp 0xc5a2
movslq %r14d, %rax
movq 0x10(%rsp), %rsi
addq %rax, %rsi
movq 0x28(%rsp), %rdi
addq %rax, %rdi
movb $0x1, %al
movl %ebx, %ecx
jmp 0xc5a2
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movq %rdi, 0x18(%rax)
movq 0x10(%rsp), %rsi
movq %rsi, 0x28(%rax)
xorl %eax, %eax
cmpq %rdi, %r12
setne %al
movl %eax, 0x1c(%rsp)
xorl %eax, %eax
movl %ecx, %ebx
testb %al, %al
jne 0xc21d
jmp 0xc641
movq 0x20(%rsp), %rcx
movq 0x70(%rsp), %rbx
movq %rcx, (%rbx)
movq 0x8(%rcx), %rax
movq %rax, 0x8(%rbx)
movq 0x8(%rcx), %rax
testq %rax, %rax
je 0xc5d2
movq %rbx, (%rax)
movq 0x20(%rsp), %rax
movq %rbx, 0x8(%rax)
movq 0x110(%rsp), %rax
movq %rax, (%rsp)
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rdx
xorl %ecx, %ecx
movl 0x38(%rsp), %r8d
movl 0x34(%rsp), %r9d
callq 0xbcc9
movq 0x18(%rbx), %rdi
movq 0x28(%rbx), %rsi
movb $0x1, %al
movq %rbx, 0x20(%rsp)
movq 0x68(%rsp), %r12
movq 0x40(%rsp), %r13
movq 0x60(%rsp), %rbp
jmp 0xc55e
movq 0x20(%rsp), %rax
movq %rdi, 0x18(%rax)
movq %rsi, 0x28(%rax)
xorl %eax, %eax
cmpq %rdi, %r12
setne %al
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop