// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/supStitch.c
// Function: ssFindBestBig
static void ssFindBestBig(struct ffAli *ffList, bioSeq *qSeq, bioSeq *tSeq,
	enum ffStringency stringency, boolean isProt, struct trans3 *t3List,
	struct ffAli **retBestAli, int *retScore, struct ffAli **retLeftovers)
/* Go set up things to call chainBlocks to find best way to string together
 * blocks in alignment. */
{
struct cBlock *boxList = NULL, *box, *prevBox;
struct ffAli *ff, *farRight = NULL;
struct lm *lm = lmInit(0);
int boxSize;
DNA *firstH = tSeq->dna;
struct chain *chainList, *chain, *bestChain;
int tMin = BIGNUM, tMax = -BIGNUM;


/* Make up box list for chainer. */
for (ff = ffList; ff != NULL; ff = ff->right)
    {
    lmAllocVar(lm, box);
    boxSize = ff->nEnd - ff->nStart;
    box->qStart = ff->nStart - qSeq->dna;
    box->qEnd = box->qStart + boxSize;
    if (t3List)
        {
	trans3Offsets(t3List, ff->hStart, ff->hEnd, &box->tStart, &box->tEnd);
	}
    else
        {
	box->tStart = ff->hStart - firstH;
	box->tEnd = box->tStart + boxSize;
	}
    box->data = ff;
    box->score = bioScoreMatch(isProt, ff->nStart, ff->hStart, boxSize);
    if (tMin > box->tStart) tMin = box->tStart;
    if (tMax < box->tEnd) tMax = box->tEnd;
    slAddHead(&boxList, box);
    }

/* Adjust boxes so that tMin is always 0. */
for (box = boxList; box != NULL; box = box->next)
    {
    box->tStart -= tMin;
    box->tEnd -= tMin;
    }
tMax -= tMin;

ssStringency = stringency;
ssIsProt = isProt;
chainList = chainBlocks(qSeq->name, qSeq->size, '+', "tSeq", tMax, &boxList,
	ssConnectCost, ssGapCost, NULL, NULL);

/* Fixup crossovers on best (first) chain. */
bestChain = chainList;
prevBox = bestChain->blockList;
for (box = prevBox->next; box != NULL; box = box->next)
    {
    int overlap = findOverlap(prevBox, box);
    if (overlap > 0)
        {
	struct ffAli *left = prevBox->data;
	struct ffAli *right = box->data;
	int crossover = findCrossover(left, right, overlap, isProt);
        int remain = overlap - crossover;
	left->nEnd -= remain;
	left->hEnd -= remain;
	right->nStart += crossover;
	right->hStart += crossover;
	}
    prevBox = box;
    }

/* Copy stuff from first chain to bestAli. */
farRight = NULL;
for (box = chainList->blockList; box != NULL; box = box->next)
    {
    ff = box->data;
    ff->left = farRight;
    farRight = ff;
    }
*retBestAli = ffMakeRightLinks(farRight);

/* Copy stuff from other chains to leftovers. */
farRight = NULL;
for (chain = chainList->next; chain != NULL; chain = chain->next)
    {
    for (box = chain->blockList; box != NULL; box = box->next)
        {
        ff = box->data;
	ff->left = farRight;
	farRight = ff;
	}
    }
*retLeftovers = ffMakeRightLinks(farRight);

*retScore = bestChain->score;
for (chain = chainList; chain != NULL; chain = chain->next)
    chain->blockList = NULL;	/* Don't want to free this, it's local. */
chainFreeList(&chainList);
lmCleanup(&lm);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x50(%rbp)
xorl %edi, %edi
callq 0x3dc20
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
movl $0x3fffffff, -0x84(%rbp) # imm = 0x3FFFFFFF
movl $0xc0000001, -0x88(%rbp) # imm = 0xC0000001
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x19492
movq -0x58(%rbp), %rdi
movl $0x28, %esi
callq 0x3de60
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x5c(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %ecx
addl -0x5c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x14(%rax)
cmpq $0x0, -0x28(%rbp)
je 0x193e3
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rdx
movq -0x38(%rbp), %rcx
addq $0x8, %rcx
movq -0x38(%rbp), %r8
addq $0xc, %r8
callq 0x18930
jmp 0x1940c
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x68(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
addl -0x5c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x48(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movl -0x20(%rbp), %edi
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rdx
movl -0x5c(%rbp), %ecx
callq 0x197b0
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0x84(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jle 0x19458
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x84(%rbp)
movl -0x88(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x19474
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x88(%rbp)
movq -0x38(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x18f00
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x19351
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x194d2
movl -0x84(%rbp), %edx
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
movl -0x84(%rbp), %edx
movq -0x38(%rbp), %rax
movl 0xc(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0xc(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x1949a
movl -0x84(%rbp), %ecx
movl -0x88(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x88(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, 0xedef1(%rip)     # 0x1073e0
movl -0x20(%rbp), %eax
movl %eax, 0xedeec(%rip)     # 0x1073e4
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %esi
movl -0x88(%rbp), %r8d
movl $0x2b, %edx
leaq 0xbeebc(%rip), %rcx     # 0xd83d6
leaq -0x30(%rbp), %r9
leaq 0x2fb(%rip), %r10       # 0x19820
leaq 0x474(%rip), %rax       # 0x199a0
xorl %r11d, %r11d
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
callq 0x293b0
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x1967d
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x199f0
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
jle 0x19665
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movl -0x8c(%rbp), %edx
movl -0x20(%rbp), %ecx
callq 0x19a40
movl %eax, -0xa4(%rbp)
movl -0x8c(%rbp), %eax
subl -0xa4(%rbp), %eax
movl %eax, -0xa8(%rbp)
movl -0xa8(%rbp), %edx
movq -0x98(%rbp), %rax
movq 0x18(%rax), %rcx
movslq %edx, %rsi
xorl %edx, %edx
subq %rsi, %rdx
addq %rdx, %rcx
movq %rcx, 0x18(%rax)
movl -0xa8(%rbp), %edx
movq -0x98(%rbp), %rax
movq 0x28(%rax), %rcx
movslq %edx, %rsi
xorl %edx, %edx
subq %rsi, %rdx
addq %rdx, %rcx
movq %rcx, 0x28(%rax)
movl -0xa4(%rbp), %edx
movq -0xa0(%rbp), %rax
movq 0x10(%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movl -0xa4(%rbp), %edx
movq -0xa0(%rbp), %rax
movq 0x20(%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x19572
movq $0x0, -0x50(%rbp)
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x196c4
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x19691
movq -0x50(%rbp), %rdi
callq 0x37bc0
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movq $0x0, -0x50(%rbp)
movq -0x70(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x1973f
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x19730
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x196fd
jmp 0x19732
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x196ea
movq -0x50(%rbp), %rdi
callq 0x37bc0
movq %rax, %rcx
movq 0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x80(%rbp), %rax
cvttsd2si 0x10(%rax), %ecx
movq 0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x19789
movq -0x78(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x19769
leaq -0x70(%rbp), %rdi
callq 0x27d10
leaq -0x58(%rbp), %rdi
callq 0x3dd90
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)