// File: /workspace/github_c_makefile_star2_O1/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, %r13
movq %r8, 0x18(%rsp)
movq %rcx, %rbp
movl %edx, (%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
movl 0x88(%rsp), %r15d
movl 0x80(%rsp), %r14d
leal (%r15,%r15), %r12d
leal (,%r15,4), %eax
movslq %eax, %rdi
callq 0x2dc95
movq %rax, %rbx
movq %r12, 0x30(%rsp)
movslq %r12d, %r12
addq %rax, %r12
testl %r14d, %r14d
movq %rbp, 0x10(%rsp)
jle 0x19772
movq 0x78(%rsp), %rax
movq 0x18(%rbp), %r14
movq 0x28(%rbp), %rbp
subl %r14d, %r13d
subl %ebp, %eax
cmpl %r15d, %r13d
cmovgel %r15d, %r13d
cmpl %r15d, %eax
cmovgel %r15d, %eax
jmp 0x197a5
movq 0x70(%rsp), %rcx
movq 0x10(%rbp), %r14
movq 0x20(%rbp), %rbp
movl %r14d, %r13d
subl 0x18(%rsp), %r13d
movl %ebp, %eax
subl %ecx, %eax
cmpl %r15d, %r13d
cmovgel %r15d, %r13d
cmpl %r15d, %eax
cmovgel %r15d, %eax
movslq %r13d, %rcx
subq %rcx, %r14
movslq %eax, %rcx
subq %rcx, %rbp
leaq 0x4(%rsp), %r10
leaq 0x8(%rsp), %r11
xorl %r15d, %r15d
xorl %edi, %edi
movq 0x28(%rsp), %rsi
movl (%rsp), %edx
movq %r14, %rcx
movl %r13d, %r8d
movq %rbp, %r9
pushq %r10
pushq %r11
pushq %r12
pushq %rbx
leaq 0x2c(%rsp), %r10
pushq %r10
pushq 0x58(%rsp)
movl 0xb0(%rsp), %r13d
pushq %r13
pushq %rax
callq 0x18e1c
addq $0x40, %rsp
testl %eax, %eax
je 0x1982e
testl %r13d, %r13d
jg 0x19811
movslq 0x8(%rsp), %r14
notq %r14
movq 0x10(%rsp), %rax
addq 0x10(%rax), %r14
movslq 0x4(%rsp), %rbp
notq %rbp
addq 0x20(%rax), %rbp
movl 0xc(%rsp), %edi
movq %rbx, %rsi
movq %r12, %rdx
movq 0x20(%rsp), %rcx
movq %r14, %r8
movq %rbp, %r9
callq 0x27fea
movq %rax, %r15
movq %rbx, %rdi
callq 0x2dd41
movq %r15, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq