// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x90, %rsp
movq 0x20(%rbp), %rax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0xc37f
movq -0x40(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x69(%rbp)
jae 0xc3b3
movq -0x48(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0x69(%rbp)
jae 0xc3b3
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
movq -0x48(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0xc3bc
jmp 0xc3d6
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xc37f
movq -0x40(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0xc3ea
movq -0x48(%rbp), %rax
cmpq -0x30(%rbp), %rax
jb 0xc41a
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0xc609
movl $0x5, -0x54(%rbp)
movq -0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x58(%rbp)
movq -0x30(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x5c(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x58(%rbp), %eax
jle 0xc44b
movl -0x58(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jle 0xc459
movl -0x5c(%rbp), %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
jle 0xc474
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x54(%rbp), %edx
callq 0x34030
movl %eax, -0x38(%rbp)
jmp 0xc47b
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
movl -0x38(%rbp), %eax
movl -0x54(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jl 0xc4af
movl -0x54(%rbp), %ecx
movq -0x48(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl -0x54(%rbp), %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
jmp 0xc604
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
jl 0xc5d5
movq 0x20(%rbp), %rsi
movl $0x38, %edi
callq 0x9c00
movq %rax, -0x68(%rbp)
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
cmpq $0x3, %rax
jl 0xc524
movq -0x68(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %r8
movl 0x10(%rbp), %r9d
movl 0x18(%rbp), %eax
movl %eax, (%rsp)
callq 0xc840
cmpl $0x0, %eax
jne 0xc53c
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0xc609
movq -0x10(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xc571
movq -0x68(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x68(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x68(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %r8
movl 0x10(%rbp), %r11d
movl 0x18(%rbp), %r10d
movq 0x20(%rbp), %rax
xorl %r9d, %r9d
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0xc020
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0xc602
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0xc609
jmp 0xc604
jmp 0xc37d
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)