// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/fuzzyFind.c
// Function: leftNextMatch
static boolean leftNextMatch(struct ffAli *ali, DNA *ns, DNA *ne, DNA *hs, DNA *he, 
    int gapPenalty, int maxSkip)
/* Scan to the left 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 (ne[-nOff-1] == he[-hOff-1] && memcmp(ne-nOff-matchSize, he-hOff-matchSize, matchSize) == 0)
            {
            ali->nStart = ne - nOff - matchSize;
            ali->nEnd = ne - nOff;
            ali->hStart = he - hOff - matchSize;
            ali->hEnd = he- hOff;
            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 0xc676
movl 0x10(%rbp), %eax
movl %eax, -0x40(%rbp)
movl $0x1, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x40(%rbp), %eax
jg 0xc82c
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 0xc6d2
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 0xc6d4
cmpl $0x0, -0x4c(%rbp)
jl 0xc81c
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 0xc6fd
jmp 0xc81c
movl -0x44(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jle 0xc70a
jmp 0xc805
movq -0x20(%rbp), %rax
xorl %ecx, %ecx
subl -0x50(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movq -0x30(%rbp), %rcx
xorl %edx, %edx
subl -0x4c(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0xc803
movq -0x20(%rbp), %rdi
movslq -0x50(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
movslq -0x44(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
movslq -0x4c(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rsi
movslq -0x44(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rsi
movslq -0x44(%rbp), %rdx
callq 0x62d0
cmpl $0x0, %eax
jne 0xc803
movq -0x20(%rbp), %rcx
movslq -0x50(%rbp), %rdx
xorl %eax, %eax
subq %rdx, %rax
addq %rax, %rcx
movslq -0x44(%rbp), %rdx
xorl %eax, %eax
subq %rdx, %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rcx
movslq -0x50(%rbp), %rdx
xorl %eax, %eax
subq %rdx, %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rcx
movslq -0x4c(%rbp), %rdx
xorl %eax, %eax
subq %rdx, %rax
addq %rax, %rcx
movslq -0x44(%rbp), %rdx
xorl %eax, %eax
subq %rdx, %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rcx
movslq -0x4c(%rbp), %rdx
xorl %eax, %eax
subq %rdx, %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x1, -0x4(%rbp)
jmp 0xc833
jmp 0xc805
movl -0x4c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xc6d4
jmp 0xc81e
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xc67d
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)