// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/jkOwnLib/supStitch.c
// Function: ssFindBundles
struct ssBundle *ssFindBundles(struct patSpace *ps, struct dnaSeq *cSeq, 
	char *cName, enum ffStringency stringency, boolean avoidSelfSelf)
/* Find patSpace alignments.  This routine is used by psLayout but not blat. */
{
struct patClump *clumpList, *clump;
struct ssBundle *bundleList = NULL, *bun = NULL;
DNA *cdna = cSeq->dna;
int totalCdnaSize = cSeq->size;
DNA *endCdna = cdna+totalCdnaSize;
struct ssFfItem *ffl;
struct dnaSeq *lastSeq = NULL;
int maxSize = 700;
int preferredSize = 500;
int overlapSize = 250;

for (;;)
    {
    int cSize = endCdna - cdna;
    if (cSize > maxSize)
	cSize = preferredSize;
    clumpList = patSpaceFindOne(ps, cdna, cSize);
    for (clump = clumpList; clump != NULL; clump = clump->next)
	{
	struct ffAli *ff;
	struct dnaSeq *seq = clump->seq;
	DNA *tStart = seq->dna + clump->start;
	if (!avoidSelfSelf || !sameString(seq->name, cSeq->name))
	    {
	    ff = ffFind(cdna, cdna+cSize, tStart, tStart + clump->size, stringency);
	    if (ff != NULL)
		{
		if (lastSeq != seq)
		    {
		    lastSeq = seq;
		    if ((bun = findBundle(bundleList, seq)) == NULL)
			{
			AllocVar(bun);
			bun->qSeq = cSeq;
			bun->genoSeq = seq;
			bun->genoIx = clump->bacIx;
			bun->genoContigIx = clump->seqIx;
			slAddHead(&bundleList, bun);
			}
		    }
		AllocVar(ffl);
		ffl->ff = ff;
		slAddHead(&bun->ffList, ffl);
		}
	    }
	}
    cdna += cSize;
    if (cdna >= endCdna)
	break;
    cdna -= overlapSize;
    slFreeList(&clumpList);
    }
slReverse(&bundleList);
cdna = cSeq->dna;

for (bun = bundleList; bun != NULL; bun = bun->next)
    {
    ssStitch(bun, stringency, 20, 16);
    }
return bundleList;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x68(%rbp)
movl $0x2bc, -0x6c(%rbp)     # imm = 0x2BC
movl $0x1f4, -0x70(%rbp)     # imm = 0x1F4
movl $0xfa, -0x74(%rbp)
movq -0x58(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jle 0x18fcc
movl -0x70(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x78(%rbp), %edx
callq 0x1f540
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1914b
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
movslq 0x18(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x19046
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6a40
cmpl $0x0, %eax
je 0x19139
movq -0x48(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x78(%rbp), %rax
addq %rax, %rsi
movq -0x90(%rbp), %rdx
movq -0x90(%rbp), %rcx
movq -0x30(%rbp), %rax
movslq 0x1c(%rax), %rax
addq %rax, %rcx
movl -0x1c(%rbp), %r8d
callq 0xa600
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0x19137
movq -0x68(%rbp), %rax
cmpq -0x88(%rbp), %rax
je 0x1910c
movq -0x88(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x191e0
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x1910a
movl $0x48, %edi
callq 0x40c50
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x88(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x30(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x18f00
jmp 0x1910c
movl $0x10, %edi
callq 0x40c50
movq %rax, -0x60(%rbp)
movq -0x80(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rdi
addq $0x8, %rdi
movq -0x60(%rbp), %rsi
callq 0x18f00
jmp 0x19139
jmp 0x1913b
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x18fe8
movl -0x78(%rbp), %ecx
movq -0x48(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x58(%rbp), %rax
jb 0x19168
jmp 0x1918c
movl -0x74(%rbp), %ecx
movq -0x48(%rbp), %rax
movslq %ecx, %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x2ab30
jmp 0x18fb0
leaq -0x38(%rbp), %rdi
callq 0x2aad0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x191d3
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x14, %edx
movl $0x10, %ecx
callq 0x18b80
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x191a9
movq -0x38(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq