// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/supStitch.c
// Function: ssConnectCost
static int ssConnectCost(struct cBlock *a, struct cBlock *b, void *data)
/* Calculate connection cost - including gap score
 * and overlap adjustments if any. */
{
struct ffAli *aFf = a->data, *bFf = b->data;
int overlapAdjustment = 0;
int overlap = findOverlap(a, b);
int dq = b->qStart - a->qEnd;
int dt = b->tStart - a->tEnd;

if (overlap > 0)
    {
    int aSize = aFf->hEnd - aFf->hStart;
    int bSize = bFf->hEnd - bFf->hStart;
    if (overlap >= bSize || overlap >= aSize)
	{
	/* Give stiff overlap adjustment for case where
	 * one block completely enclosed in the other on
	 * either sequence. This will make it never happen. */
	overlapAdjustment = a->score + b->score;
	}
    else
        {
	/* More normal case - partial overlap on one or both strands. */
	int crossover = findCrossover(aFf, bFf, overlap, ssIsProt);
	int remain = overlap - crossover;
	overlapAdjustment =
	    bioScoreMatch(ssIsProt, aFf->nEnd - remain, aFf->hEnd - remain, 
	    	remain)
	  + bioScoreMatch(ssIsProt, bFf->nStart, bFf->hStart, 
	  	crossover);
	dq -= overlap;
	dt -= overlap;
	}
    }
return overlapAdjustment + ssGapCost(dq, dt, data);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x199f0
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x8(%rbp), %rcx
subl 0x14(%rcx), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
subl 0xc(%rcx), %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x30(%rbp)
jle 0x1997c
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x20(%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x28(%rbp), %rcx
movq 0x20(%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x40(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x198cb
movl -0x30(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jl 0x198e1
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x10(%rbp), %rcx
addl 0x18(%rcx), %eax
movl %eax, -0x2c(%rbp)
jmp 0x1997a
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x30(%rbp), %edx
movl 0xedaf2(%rip), %ecx     # 0x1073e4
callq 0x19a40
movl %eax, -0x44(%rbp)
movl -0x30(%rbp), %eax
subl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
movl 0xedadb(%rip), %edi     # 0x1073e4
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rsi
movslq -0x48(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rsi
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdx
movslq -0x48(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdx
movl -0x48(%rbp), %ecx
callq 0x197b0
movl %eax, -0x4c(%rbp)
movl 0xedaa2(%rip), %edi     # 0x1073e4
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rdx
movl -0x44(%rbp), %ecx
callq 0x197b0
movl %eax, %ecx
movl -0x4c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %ecx
movl -0x34(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %ecx
movl -0x38(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x38(%rbp)
jmp 0x1997c
movl -0x2c(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x34(%rbp), %edi
movl -0x38(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x199a0
movl %eax, %ecx
movl -0x50(%rbp), %eax
addl %ecx, %eax
addq $0x50, %rsp
popq %rbp
retq
nop