// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/gfBlatLib.c
// Function: jiggleSmallExons
static boolean jiggleSmallExons(struct ffAli *ali, struct dnaSeq *nSeq, struct dnaSeq *hSeq)
/* See if can jiggle small exons to match splice sites a little
 * better. */
{
struct ffAli *left, *mid, *right;
int orient;
boolean creeped = FALSE;

if (ffAliCount(ali) < 3)
    return FALSE;
orient = ffIntronOrientation(ali);
left = ali;
mid = left->right;
right = mid->right;
while (right != NULL)
    {
    int midSizeN = mid->nEnd - mid->nStart;
    if (midSizeN < 10 && mid->hStart - left->hEnd > 1 && right->hStart - mid->hEnd > 1)
        {
	DNA *spLeft, *spRight;	/* Splice sites on either side of exon. */
	DNA exonX[10+2+2];    /* Storage for exon with splice sites. */
	DNA *match;
	static int creeps[4][2] = { {2, 2}, {2, 1}, {1, 2}, {1, 1},};
	int creepIx, creepL, creepR;
	DNA *hs = mid->hStart, *he = mid->hEnd;
	DNA *hMin = left->hEnd,  *hMax = right->hStart;
	if (orient >= 0)
	    {
	    spLeft = "ag";
	    spRight = "gt";
	    }
	else
	    {
	    spLeft = "ac";
	    spRight = "ct";
	    }
        for (creepIx=0; creepIx<4; ++creepIx)
	    {
	    creepL = creeps[creepIx][0];
	    creepR = creeps[creepIx][1];
	    /* Check to see if we already match consensus, and if so just bail. */
	    if (hs[-1] == spLeft[1] && he[0] == spRight[0])
	        {
		if ((creepL == 1 || hs[-2] == spLeft[0]) 
			&& (creepR == 1 || he[1] == spRight[1]))
		    {
		    break;
		    }
		}
	    memcpy(exonX, spLeft + 2 - creepL, creepL);
	    memcpy(exonX + creepL, mid->nStart, midSizeN);
	    memcpy(exonX + creepL + midSizeN, spRight, creepR);
	    match = memMatch(exonX, midSizeN + creepR + creepL, hMin, hMax - hMin);
	    if (match != NULL)
	        {
		mid->hStart = match + creepL;
		mid->hEnd = mid->hStart + (he - hs);
		creeped = TRUE;
		break;
		}
	    }
	}
    left = mid;
    mid = right;
    right = right->right;
    }
if (creeped)
    ffSlideIntrons(ali);
return creeped;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x37d90
cmpl $0x3, %eax
jge 0x15778
movl $0x0, -0x4(%rbp)
jmp 0x15a34
movq -0x10(%rbp), %rdi
callq 0x37b20
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x15a1f
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x44(%rbp)
cmpl $0xa, -0x44(%rbp)
jge 0x159fe
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
movq 0x28(%rcx), %rcx
subq %rcx, %rax
cmpq $0x1, %rax
jle 0x159fe
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x28(%rcx), %rcx
subq %rcx, %rax
cmpq $0x1, %rax
jle 0x159fe
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xa0(%rbp)
cmpl $0x0, -0x3c(%rbp)
jl 0x15863
leaq 0xc4c8e(%rip), %rax     # 0xda4e0
movq %rax, -0x50(%rbp)
leaq 0xc4c87(%rip), %rax     # 0xda4e4
movq %rax, -0x58(%rbp)
jmp 0x15879
leaq 0xc4c6e(%rip), %rax     # 0xda4d8
movq %rax, -0x50(%rbp)
leaq 0xc4c4f(%rip), %rax     # 0xda4c4
movq %rax, -0x58(%rbp)
movl $0x0, -0x74(%rbp)
cmpl $0x4, -0x74(%rbp)
jge 0x159fc
movslq -0x74(%rbp), %rcx
leaq 0xf056b(%rip), %rax     # 0x105e00
movl (%rax,%rcx,8), %eax
movl %eax, -0x78(%rbp)
movslq -0x74(%rbp), %rcx
leaq 0xf055a(%rip), %rax     # 0x105e00
movl 0x4(%rax,%rcx,8), %eax
movl %eax, -0x7c(%rbp)
movq -0x88(%rbp), %rax
movsbl -0x1(%rax), %eax
movq -0x50(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0x15919
movq -0x90(%rbp), %rax
movsbl (%rax), %eax
movq -0x58(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x15919
cmpl $0x1, -0x78(%rbp)
je 0x158f5
movq -0x88(%rbp), %rax
movsbl -0x2(%rax), %eax
movq -0x50(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x15917
cmpl $0x1, -0x7c(%rbp)
je 0x15912
movq -0x90(%rbp), %rax
movsbl 0x1(%rax), %eax
movq -0x58(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0x15917
jmp 0x159fc
jmp 0x15919
leaq -0x66(%rbp), %rdi
movq -0x50(%rbp), %rsi
addq $0x2, %rsi
movslq -0x78(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rsi
movslq -0x78(%rbp), %rdx
callq 0x6570
leaq -0x66(%rbp), %rdi
movslq -0x78(%rbp), %rax
addq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
movslq -0x44(%rbp), %rdx
callq 0x6570
leaq -0x66(%rbp), %rdi
movslq -0x78(%rbp), %rax
addq %rax, %rdi
movslq -0x44(%rbp), %rax
addq %rax, %rdi
movq -0x58(%rbp), %rsi
movslq -0x7c(%rbp), %rdx
callq 0x6570
leaq -0x66(%rbp), %rdi
movl -0x44(%rbp), %esi
addl -0x7c(%rbp), %esi
addl -0x78(%rbp), %esi
movq -0x98(%rbp), %rdx
movq -0xa0(%rbp), %rax
movq -0x98(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
callq 0x2dba0
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
je 0x159ec
movq -0x70(%rbp), %rcx
movslq -0x78(%rbp), %rax
addq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rdx
subq %rdx, %rax
addq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x1, -0x40(%rbp)
jmp 0x159fc
jmp 0x159ee
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x15880
jmp 0x159fe
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x157a4
cmpl $0x0, -0x40(%rbp)
je 0x15a2e
movq -0x10(%rbp), %rdi
callq 0x1b3d0
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq