// File: /workspace/github_c_makefile_star2_O3/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, 0x44(%rsp)
movl %r8d, 0x48(%rsp)
movq %rsi, %r13
movq 0x18(%rdi), %rbx
movq 0x28(%rdi), %r12
cmpq %rsi, %rbx
setb %al
cmpq %rdx, %r12
setb %sil
andb %al, %sil
cmpb $0x1, %sil
jne 0xc4e9
movl $0x1, %r10d
subl %edx, %r10d
movq %rdx, %r8
shlq $0x20, %r8
movl %r13d, %r9d
negl %r9d
leal -0x1(%r13), %r11d
movq %rbx, %rsi
movq %rbx, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
leal (%r10,%r12), %ebx
movq %r12, %rax
shlq $0x20, %rax
movq %r8, %rdi
subq %rax, %rdi
movq %rdi, 0x70(%rsp)
leal (%r9,%rsi), %r14d
movl %edx, %eax
subl %r12d, %eax
movq %rax, 0x30(%rsp)
movl %r13d, %ebp
subl %esi, %ebp
movl %r11d, %eax
subl %esi, %eax
movl %eax, 0x4c(%rsp)
movl %ebp, 0x20(%rsp)
xorl %r15d, %r15d
movq %r12, 0x68(%rsp)
movq %rsi, 0x28(%rsp)
movq %rsi, 0x60(%rsp)
movabsq $-0x100000000, %rdi     # imm = 0xFFFFFFFF00000000
movq 0x28(%rsp), %rsi
movb (%rsi,%r15), %al
cmpb (%r12,%r15), %al
jne 0xc158
addq %r15, %rsi
incq %rsi
leaq 0x1(%r15), %rax
cmpq %r13, %rsi
jae 0xc4f1
incq 0x68(%rsp)
leaq (%r15,%r12), %rsi
incq %rsi
incq 0x60(%rsp)
incl %ebx
addq %rdi, 0x70(%rsp)
addq $0x2, %r14
movq 0x30(%rsp), %r15
decl %r15d
movq %r15, 0x30(%rsp)
decl %ebp
decl 0x4c(%rsp)
movq %rax, %r15
cmpq %rdx, %rsi
jb 0xc0fa
jmp 0xc4f1
movl %r11d, 0x40(%rsp)
movq %r9, 0x78(%rsp)
movq %r8, 0x80(%rsp)
movq %r10, 0x88(%rsp)
movl 0x20(%rsp), %eax
subl %r15d, %eax
movq %rdx, 0x90(%rsp)
subl %r12d, %edx
movq %rdx, 0x58(%rsp)
subq %r15, %rdx
cmpl %edx, %eax
movq %rdx, 0xb8(%rsp)
cmovgel %edx, %eax
cmpl $0x5, %eax
movl $0x5, %edx
cmovll %eax, %edx
addq %r15, %r12
leaq (%rsi,%r15), %rdi
testl %eax, %eax
movq %r13, 0x98(%rsp)
movq %rdi, 0x50(%rsp)
jle 0xc1e0
movq %r12, %rsi
movl %edx, 0xc(%rsp)
movl 0xc(%rsp), %edx
movl %ecx, %r13d
callq 0x25b71
movl 0xc(%rsp), %edx
movl %r13d, %ecx
movq 0x98(%rsp), %r13
jmp 0xc1e5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl $-0x2, %edx
cmpl %edx, %eax
jge 0xc39e
testl %ecx, %ecx
jle 0xc537
movl %ecx, 0x3c(%rsp)
movq %r12, %rbp
movq %r13, %r12
subq 0x28(%rsp), %r12
subq %r15, %r12
movq 0x110(%rsp), %rax
movq (%rax), %rdi
movl $0x38, %esi
callq 0x2c325
movq %rax, 0xa0(%rsp)
movq 0x18(%rsp), %rax
movq 0x50(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq %rbp, 0xa8(%rsp)
movq %rbp, 0x28(%rax)
cmpq $0x3, %r12
movq 0x58(%rsp), %rcx
jl 0xc528
subl %r14d, %ecx
movl 0x44(%rsp), %eax
cmpl %eax, %ecx
cmovgel %eax, %ecx
testl %ecx, %ecx
jle 0xc528
decl 0x3c(%rsp)
sarq $0x20, 0x70(%rsp)
incl %ecx
movl 0x20(%rsp), %eax
subq %r15, %rax
movq %rax, 0xb0(%rsp)
movl $0x1, %r12d
movq %rcx, 0x58(%rsp)
testl %ebx, %ebx
movl $0x0, %r14d
cmovgl %ebx, %r14d
movq %r12, %rdi
callq 0x32789
movl %eax, %ebp
cmpq 0x70(%rsp), %r12
movq 0xb8(%rsp), %rax
movq %r12, 0xc0(%rsp)
cmovlel %r12d, %eax
testl %eax, %eax
js 0xc37e
addl 0x48(%rsp), %ebp
movq 0xb0(%rsp), %rax
subl %r14d, %eax
cmpl %eax, %ebp
jg 0xc37e
movl %ebx, %r13d
sarl $0x1f, %r13d
andl %ebx, %r13d
movq 0x30(%rsp), %rax
leal (%rax,%r13), %ecx
movq 0x68(%rsp), %rax
leaq (%rax,%rcx), %rdx
negl %r13d
movl 0x4c(%rsp), %eax
movl %eax, %esi
subl %r14d, %esi
addq 0x60(%rsp), %r14
movslq %ebp, %rax
movq %rax, 0x20(%rsp)
xorl %r12d, %r12d
movl %ebx, 0xc(%rsp)
movq %rdx, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
cmpl %r13d, %ebp
jg 0xc365
movb (%r14), %al
cmpb (%rdx,%r12), %al
jne 0xc365
leaq (%rdx,%r12), %rsi
movq %r14, %rdi
movq 0x20(%rsp), %rdx
movq %rcx, %rbx
callq 0x6710
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
movq %rbx, %rcx
movl 0xc(%rsp), %ebx
testl %eax, %eax
je 0xc3f6
leaq (%rcx,%r12), %rax
testl %eax, %eax
jle 0xc37e
leal (%rsi,%r12), %eax
decq %r12
incl %r13d
incq %r14
cmpl %eax, %ebp
jle 0xc324
movq 0xc0(%rsp), %r12
incq %r12
incl %ebx
movq 0x58(%rsp), %rcx
cmpq %rcx, %r12
jne 0xc28a
jmp 0xc528
movslq 0x30(%rsp), %rax
movslq %ebp, %rdx
cmpq %rdx, %rax
cmovlq %rax, %rdx
cmpq $0x5, %rdx
movl $0x5, %eax
cmovgeq %rax, %rdx
addq %rdx, %r12
movq 0x50(%rsp), %rsi
addq %rdx, %rsi
movq 0x18(%rsp), %r14
movq 0x90(%rsp), %rdx
movq 0x88(%rsp), %r10
movq 0x80(%rsp), %r8
movq 0x78(%rsp), %r9
movl 0x40(%rsp), %r11d
movq 0x10(%rsp), %rbx
jmp 0xc4d6
movq 0xa0(%rsp), %rax
movq %r14, 0x10(%rax)
movq %rax, %r14
testl %ebx, %ebx
movl $0x0, %eax
cmovgl %ebx, %eax
movl $0x0, %ecx
cmovnsl %ecx, %ebx
movq 0x60(%rsp), %rcx
movq 0x20(%rsp), %rsi
addq %rsi, %rcx
addq %rax, %rcx
subq %r12, %rcx
movq %rcx, 0x18(%r14)
movq 0x30(%rsp), %rcx
addl %ebx, %ecx
movq 0x68(%rsp), %rdx
leaq (%rdx,%r12), %rax
addq %rcx, %rax
movq %rax, 0x20(%r14)
addq %rsi, %rdx
addq %r12, %rdx
addq %rcx, %rdx
movq %rdx, 0x28(%r14)
movq 0x18(%rsp), %rcx
movq %rcx, (%r14)
movq 0x8(%rcx), %rax
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0xc46a
movq %r14, (%rax)
movq %r14, 0x8(%rcx)
movq 0x110(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movq 0x50(%rsp), %rsi
movq 0xa8(%rsp), %rdx
xorl %ecx, %ecx
movl 0x48(%rsp), %r8d
movl 0x44(%rsp), %r9d
callq 0xbb7f
movq 0x18(%r14), %rsi
movq 0x28(%r14), %r12
movq 0x10(%rsp), %rbx
movl 0x3c(%rsp), %ecx
movq 0x90(%rsp), %rdx
movq 0x98(%rsp), %r13
movq 0x88(%rsp), %r10
movq 0x80(%rsp), %r8
movq 0x78(%rsp), %r9
movl 0x40(%rsp), %r11d
cmpq %r13, %rsi
jae 0xc506
movq %r14, %rdi
cmpq %rdx, %r12
jb 0xc0a3
jmp 0xc506
movq %rdi, %r14
movq %rbx, %rsi
jmp 0xc506
addq %rax, %r12
movq 0x28(%rsp), %rsi
addq %rax, %rsi
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %rbx
movq %rsi, 0x18(%r14)
movq %r12, 0x28(%r14)
xorl %eax, %eax
cmpq %rsi, %rbx
setne %al
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rsp), %rsi
addq %r15, %rsi
movq 0x10(%rsp), %rbx
jmp 0xc50e
movq 0x18(%rsp), %r14
movq 0x50(%rsp), %rsi
jmp 0xc501
nop