// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/fuzzyFind.c
// Function: rightNextMatch
static boolean rightNextMatch(struct ffAli *ali, DNA *ns, DNA *ne, DNA *hs, DNA *he, 
    int gapPenalty, int maxSkip)
/* Scan to the right for something that matches the next bit of the needle
 * in the haystack. */
{
int haySize = he - hs;
int needleSize = ne - ns;
int diagSize = haySize + needleSize;
int matchSize;
int i;

/* We take care of bigger skips on the "tile" level. */
if (diagSize > maxSkip)
    diagSize = maxSkip;
/* Scan diagonally... */
/*
0 1 2 3
1 2 3 4
2 3 4 5
3 4 5 6
*/
for (i=1; i<=diagSize; ++i)
    {
    int hOff = i;
    int nOff = 0;
    int hDiff = hOff - haySize;
    matchSize = gapPenalty + digitsBaseTwo(i);
    if (hDiff > 0)
        {
        nOff += hDiff;
        hOff -= hDiff;
        }
    for (;hOff >= 0; --hOff, ++nOff)
        {
        int needleLeft = needleSize - nOff;
        int hayLeft = haySize - hOff;
        if (matchSize > needleLeft) break;
        if (matchSize > hayLeft) continue;
        if (ns[nOff] == hs[hOff] && memcmp(ns+nOff, hs+hOff, matchSize) == 0)
            {
            ali->nStart = ns + nOff;
            ali->nEnd = ns + nOff + matchSize;
            ali->hStart = hs + hOff;
            ali->hEnd = hs + hOff + matchSize;
            return TRUE;
            }
        }
    }
return FALSE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
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 -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl 0x10(%rbp), %eax
jle 0xc896
movl 0x10(%rbp), %eax
movl %eax, -0x40(%rbp)
movl $0x1, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x40(%rbp), %eax
jg 0xc9fa
movl -0x48(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x4c(%rbp), %eax
subl -0x38(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x60(%rbp)
movslq -0x48(%rbp), %rdi
callq 0x475f0
movl %eax, %ecx
movl -0x60(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x54(%rbp)
jle 0xc8f2
movl -0x54(%rbp), %eax
addl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x54(%rbp), %ecx
movl -0x4c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x4c(%rbp)
jmp 0xc8f4
cmpl $0x0, -0x4c(%rbp)
jl 0xc9ea
movl -0x3c(%rbp), %eax
subl -0x50(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x38(%rbp), %eax
subl -0x4c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x58(%rbp), %eax
jle 0xc91d
jmp 0xc9ea
movl -0x44(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jle 0xc92a
jmp 0xc9d3
movq -0x18(%rbp), %rax
movslq -0x50(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x28(%rbp), %rcx
movslq -0x4c(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0xc9d1
movq -0x18(%rbp), %rdi
movslq -0x50(%rbp), %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
movslq -0x4c(%rbp), %rax
addq %rax, %rsi
movslq -0x44(%rbp), %rdx
callq 0x62d0
cmpl $0x0, %eax
jne 0xc9d1
movq -0x18(%rbp), %rcx
movslq -0x50(%rbp), %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movslq -0x50(%rbp), %rax
addq %rax, %rcx
movslq -0x44(%rbp), %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rcx
movslq -0x4c(%rbp), %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rcx
movslq -0x4c(%rbp), %rax
addq %rax, %rcx
movslq -0x44(%rbp), %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x1, -0x4(%rbp)
jmp 0xca01
jmp 0xc9d3
movl -0x4c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xc8f4
jmp 0xc9ec
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xc89d
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)