// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/jkOwnLib/bandExt.c
// Function: bandExtFf
struct ffAli *bandExtFf(
	struct lm *lm,	/* Local memory pool, NULL to use global allocation for ff */
	struct axtScoreScheme *ss, 	/* Scoring scheme to use. */
	int maxInsert,			/* Maximum number of inserts to allow. */
	struct ffAli *origFf,		/* Alignment block to extend. */
	char *nStart, char *nEnd,	/* Bounds of region to extend through */
	char *hStart, char *hEnd,	/* Bounds of region to extend through */
	int dir,			/* +1 to extend end, -1 to extend start */
	int maxExt)			/* Maximum length of extension. */
/* Extend a gapless alignment in one direction.  Returns extending
 * ffAlis, not linked into origFf, or NULL if no extension possible. */
{
int symAlloc = 2*maxExt;
char *symBuf = needMem(4*maxExt);
char *nBuf = symBuf;
char *hBuf = symBuf + symAlloc;
char *ns, *hs;
int symCount, nExt, hExt;
int nSize, hSize;
struct ffAli *ffList = NULL;
boolean gotExt;

if (dir > 0)
    {
    nSize = nEnd - origFf->nEnd;
    hSize = hEnd - origFf->hEnd;
    if (nSize > maxExt) nSize = maxExt;
    if (hSize > maxExt) hSize = maxExt;
    ns = origFf->nEnd;
    hs = origFf->hEnd;
    }
else
    {
    nSize = origFf->nStart - nStart;
    hSize = origFf->hStart - hStart;
    if (nSize > maxExt) nSize = maxExt;
    if (hSize > maxExt) hSize = maxExt;
    ns = origFf->nStart - nSize;
    hs = origFf->hStart - hSize;
    }

gotExt = bandExt(FALSE, ss, maxInsert, ns, nSize, hs, hSize, dir,
	symAlloc, &symCount, nBuf, hBuf, &nExt, &hExt);
if (gotExt)
    {
    char *nExtStart, *hExtStart;
    if (dir > 0)
	{
	nExtStart = ns;
	hExtStart = hs;
	}
    else
	{
	nExtStart = origFf->nStart - nExt - 1;
	hExtStart = origFf->hStart - hExt - 1;
	}
    ffList = ffAliFromSym(symCount, nBuf, hBuf, lm,  nExtStart, hExtStart);
    }
freeMem(symBuf);
return ffList;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %rbx
movq %r8, 0x10(%rsp)
movq %rcx, 0x20(%rsp)
movl %edx, 0x18(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, %r14
movl 0x88(%rsp), %r13d
movl 0x80(%rsp), %ebp
leal (,%r13,2), %r12d
leal (,%r13,4), %eax
movslq %eax, %rdi
callq 0x2dff4
movq %rax, %r15
movq %r12, 0x30(%rsp)
movslq %r12d, %r12
addq %rax, %r12
testl %ebp, %ebp
jle 0x199b9
movq %r14, 0x10(%rsp)
movq 0x78(%rsp), %rax
movq 0x20(%rsp), %rcx
movq 0x18(%rcx), %rbp
movq 0x28(%rcx), %r14
subl %ebp, %ebx
subl %r14d, %eax
cmpl %r13d, %ebx
cmovgel %r13d, %ebx
cmpl %r13d, %eax
cmovgel %r13d, %eax
leaq 0x4(%rsp), %r10
leaq 0x8(%rsp), %r11
xorl %r13d, %r13d
xorl %edi, %edi
movq 0x28(%rsp), %rsi
movl 0x18(%rsp), %edx
movq %rbp, %rcx
movl %ebx, %r8d
movq %r14, %r9
pushq %r10
pushq %r11
pushq %r12
pushq %r15
leaq 0x2c(%rsp), %r10
pushq %r10
pushq 0x58(%rsp)
movl 0xb0(%rsp), %r10d
pushq %r10
pushq %rax
callq 0x18fb8
addq $0x40, %rsp
testl %eax, %eax
jne 0x19a68
jmp 0x19a85
movq %r14, %rbp
movq 0x70(%rsp), %rax
movq 0x20(%rsp), %rdx
movq 0x10(%rdx), %rcx
movq 0x20(%rdx), %r9
movl %ecx, %edx
subl 0x10(%rsp), %edx
movl %r9d, %esi
subl %eax, %esi
cmpl %r13d, %edx
cmovgel %r13d, %edx
cmpl %r13d, %esi
cmovgel %r13d, %esi
movslq %edx, %r8
subq %r8, %rcx
movslq %esi, %rax
subq %rax, %r9
leaq 0x4(%rsp), %r10
leaq 0x8(%rsp), %r11
leaq 0xc(%rsp), %r14
xorl %r13d, %r13d
xorl %edi, %edi
movq 0x28(%rsp), %rsi
movl 0x18(%rsp), %edx
pushq %r10
pushq %r11
movq %r12, 0x28(%rsp)
pushq %r12
movq %r15, %rbx
pushq %r15
pushq %r14
pushq 0x58(%rsp)
movl 0xb0(%rsp), %r10d
pushq %r10
pushq %rax
callq 0x18fb8
addq $0x40, %rsp
testl %eax, %eax
je 0x19a9f
movq %rbp, 0x10(%rsp)
movslq 0x8(%rsp), %rbp
notq %rbp
movq 0x20(%rsp), %rax
addq 0x10(%rax), %rbp
movslq 0x4(%rsp), %r14
notq %r14
addq 0x20(%rax), %r14
movq %rbx, %r15
movq 0x18(%rsp), %r12
movl 0xc(%rsp), %edi
movq %r15, %rsi
movq %r12, %rdx
movq 0x10(%rsp), %rcx
movq %rbp, %r8
movq %r14, %r9
callq 0x2832c
movq %rax, %r13
movq %r15, %rdi
callq 0x2e0a0
movq %r13, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %r15
jmp 0x19a85