// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/jkOwnLib/gfBlatLib.c
// Function: gfLongDnaInMem
void gfLongDnaInMem(struct dnaSeq *query, struct genoFind *gf, 
   boolean isRc, int minScore, Bits *qMaskBits, 
   struct gfOutput *out, boolean fastMap, boolean band)
/* Chop up query into pieces, align each, and stitch back
 * together again. */
{
int hitCount;
int maxSize = MAXSINGLEPIECESIZE;
int preferredSize = 4500;
int overlapSize = 250;
struct dnaSeq subQuery = *query;
struct lm *lm = lmInit(0);
int subOffset, subSize, nextOffset;
DNA saveEnd, *endPos;
struct ssBundle *oneBunList = NULL, *bigBunList = NULL, *bun;
struct hash *bunHash = newHash(8);

for (subOffset = 0; subOffset<query->size; subOffset = nextOffset)
    {
    struct gfClump *clumpList;
    struct gfRange *rangeList = NULL;

    /* Figure out size of this piece.  If query is
     * maxSize or less do it all.   Otherwise just
     * do prefered size, and set it up to overlap
     * with surrounding pieces by overlapSize.  */
    if (subOffset == 0 && query->size <= maxSize)
	nextOffset = subSize = query->size;
    else
        {
	subSize = preferredSize;
	if (subSize + subOffset >= query->size)
	    {
	    subSize = query->size - subOffset;
	    nextOffset = query->size;
	    }
	else
	    {
	    nextOffset = subOffset + preferredSize - overlapSize;
	    }
	}
    subQuery.dna = query->dna + subOffset;
    subQuery.size = subSize;
    endPos = &subQuery.dna[subSize];
    saveEnd = *endPos;
    *endPos = 0;
    if (band)
	{
	oneBunList = ffSeedExtInMem(gf, &subQuery, qMaskBits, subOffset, lm, minScore, isRc);
	}
    else
	{
	clumpList = gfFindClumpsWithQmask(gf, &subQuery, qMaskBits, subOffset, lm, &hitCount);
	if (fastMap)
	    {
	    oneBunList = fastMapClumpsToBundles(gf, clumpList, &subQuery);
	    }
	else
	    {
	    oneBunList = gfClumpsToBundles(clumpList, isRc, &subQuery, minScore, &rangeList);
	    gfRangeFreeList(&rangeList);
	    }
	gfClumpFreeList(&clumpList);
	}
    addToBigBundleList(&oneBunList, bunHash, &bigBunList, query);
    *endPos = saveEnd;
    }
#ifdef DEBUG
dumpBunList(bigBunList);
#endif /* DEBUG */
for (bun = bigBunList; bun != NULL; bun = bun->next)
    {
    ssStitch(bun, ffCdna, minScore, ssAliCount);
    if (!fastMap && !band)
	refineSmallExonsInBundle(bun);
    saveAlignments(bun->genoSeq->name, bun->genoSeq->size, 0, 
	bun, NULL, isRc, FALSE, ffCdna, minScore, out);
    }
ssBundleFreeList(&bigBunList);
freeHash(&bunHash);
lmCleanup(&lm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %r9, 0xd8(%rsp)
movq %r8, %r15
movl %ecx, %r13d
movq %rdx, 0x60(%rsp)
movq %rsi, %r12
movq %rdi, %rbp
movq 0x20(%rdi), %rax
movq %rax, 0xd0(%rsp)
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movaps %xmm1, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x2c220
movq %rax, %rbx
movq %rax, 0xf8(%rsp)
movq %r14, 0x90(%rsp)
movq %r14, 0x98(%rsp)
movl $0x8, %edi
movl $0x1, %esi
callq 0x294ea
movq %rax, 0xa8(%rsp)
movl 0x18(%rbp), %esi
testl %esi, %esi
jle 0x1261a
movq %r15, 0x78(%rsp)
movq %rax, 0x80(%rsp)
movl 0x148(%rsp), %ecx
movl %ecx, 0x58(%rsp)
leaq 0x10(%rsp), %r15
movq %r13, 0x40(%rsp)
movq %rbp, 0x50(%rsp)
movq %rbx, 0x70(%rsp)
movq %r12, 0x48(%rsp)
testl %r14d, %r14d
sete %cl
cmpl $0x1389, %esi           # imm = 0x1389
setl %dl
testb %dl, %cl
je 0x11f9a
movl %esi, 0x28(%rsp)
movq 0x60(%rsp), %r10
jmp 0x11fc7
leal 0x1194(%r14), %ecx
cmpl %esi, %ecx
movq 0x60(%rsp), %r10
jge 0x11fbc
leal 0x109a(%r14), %eax
movl %eax, 0x28(%rsp)
movl $0x1194, %esi           # imm = 0x1194
jmp 0x11fc7
movl %esi, 0x28(%rsp)
movl %esi, %eax
subl %r14d, %eax
movl %eax, %esi
movslq %r14d, %rax
addq 0x10(%rbp), %rax
movq %rax, 0xc0(%rsp)
movl %esi, 0xc8(%rsp)
movslq %esi, %rdx
movb (%rdx,%rax), %cl
movb %cl, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movq %rdx, 0x88(%rsp)
movb $0x0, (%rdx,%rax)
cmpl $0x0, 0x148(%rsp)
je 0x12042
subq $0x8, %rsp
movq %r12, %rdi
leaq 0xb8(%rsp), %rsi
movq 0x80(%rsp), %rdx
movl %r14d, %ecx
movq %rbx, %r8
movl %r13d, %r9d
pushq %r10
callq 0x16d70
addq $0x10, %rsp
movq %rax, 0x90(%rsp)
movq 0xa8(%rsp), %rsi
jmp 0x122dc
movq %r12, %rdi
leaq 0xb0(%rsp), %rsi
movq 0x78(%rsp), %rdx
movl %r14d, %ecx
movq %rbx, %r8
leaq 0x104(%rsp), %r9
callq 0xdedb
movq %rax, %r14
movq %rax, 0xf0(%rsp)
cmpl $0x0, 0x140(%rsp)
je 0x1217e
movq $0x0, 0x10(%rsp)
testq %r14, %r14
leaq 0xb0(%rsp), %rbx
je 0x120bc
movl 0xc(%r12), %edx
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq $0x1
pushq $0x0
callq 0x1098c
addq $0x10, %rsp
movq (%r14), %r14
testq %r14, %r14
jne 0x12094
movq %r15, %rdi
callq 0x20173
movq %r15, %rdi
leaq -0x2482(%rip), %rsi     # 0xfc4c
callq 0x201c4
movq 0x10(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0xfd63
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x122a6
movq %rax, %rbx
xorl %r14d, %r14d
leaq 0xb0(%rsp), %r15
movq %r14, %rbp
movq 0x18(%rbx), %r13
movl $0x48, %edi
callq 0x2dff4
movq %rax, %r14
movq %r15, 0x10(%rax)
movq %r13, 0x18(%rax)
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x10529
movq %rax, 0x8(%r14)
movl $0x0, 0x30(%r14)
movq %rbp, (%r14)
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x120fe
movq 0x10(%rsp), %rbx
movq %rbx, 0x30(%rsp)
testq %rbx, %rbx
je 0x122ab
movq 0x50(%rsp), %rbp
leaq 0x10(%rsp), %r15
leaq 0x30(%rsp), %r13
movq (%rbx), %rbx
movq %r13, %rdi
callq 0xfbac
movq %rbx, 0x30(%rsp)
testq %rbx, %rbx
jne 0x1215f
movq 0x40(%rsp), %r13
jmp 0x122ba
movq $0x0, 0x30(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x114a9
movq %rax, 0x10(%rsp)
movq %r15, %rdi
leaq -0x2554(%rip), %rsi     # 0xfc4c
callq 0x201c4
movq 0x10(%rsp), %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0xfd63
movq %rax, 0x10(%rsp)
testq %rax, %rax
movq 0x60(%rsp), %r12
je 0x12255
movq %rax, %r14
movq %r13, %r15
xorl %ebp, %ebp
movq 0x18(%r14), %r13
movl 0xc8(%rsp), %esi
movl 0x18(%r13), %edx
movq %r14, %rdi
xorl %ecx, %ecx
movl %r12d, %r8d
movl $0x1f4, %r9d            # imm = 0x1F4
callq 0x13240
movl $0x0, 0x20(%r14)
movl 0x18(%r13), %eax
movl %eax, 0x24(%r14)
movl $0x48, %edi
callq 0x2dff4
movq %rax, %rbx
leaq 0xb0(%rsp), %rax
movq %rax, 0x10(%rbx)
movq %r13, 0x18(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1025b
movq %rbx, %rdi
movl $0x1, %esi
movl %r15d, %edx
movl $0x10, %ecx
callq 0x14f5d
movq %rbp, (%rbx)
movq %rbx, 0x30(%rsp)
movq (%r14), %r14
movq %rbx, %rbp
testq %r14, %r14
jne 0x121cf
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x20173
movq 0x10(%rsp), %rbx
movq 0x30(%rsp), %rax
movq %rax, 0x90(%rsp)
movq %rbx, 0x30(%rsp)
testq %rbx, %rbx
je 0x1228b
movq (%rbx), %rbx
movq %r14, %rdi
callq 0xfbac
jmp 0x12274
movq 0x40(%rsp), %r13
movq 0x48(%rsp), %r12
movq 0x50(%rsp), %rbp
movq 0x70(%rsp), %rbx
leaq 0x10(%rsp), %r15
jmp 0x122c7
xorl %r14d, %r14d
jmp 0x122ba
movq 0x40(%rsp), %r13
movq 0x50(%rsp), %rbp
leaq 0x10(%rsp), %r15
movq %r14, 0x90(%rsp)
movq 0x70(%rsp), %rbx
leaq 0xf0(%rsp), %rdi
callq 0xdbe4
movq 0x80(%rsp), %rsi
movq 0x20(%rsp), %r14
leaq 0x90(%rsp), %rdi
movq %rsi, 0x80(%rsp)
leaq 0x98(%rsp), %rdx
movq %rbp, %rcx
callq 0x12653
movq 0x88(%rsp), %rax
movb 0x18(%rsp), %cl
movb %cl, (%r14,%rax)
movl 0x18(%rbp), %esi
movl 0x28(%rsp), %eax
movl %eax, %r14d
cmpl %esi, %eax
jl 0x11f7c
movq 0x98(%rsp), %rbx
testq %rbx, %rbx
je 0x1261a
movl 0x140(%rsp), %eax
orl %eax, 0x58(%rsp)
movq %rbx, %rdi
movl $0x1, %esi
movl %r13d, %edx
movl $0x10, %ecx
callq 0x14f5d
cmpl $0x0, 0x58(%rsp)
jne 0x125e0
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x125e0
movq %rbx, 0xa0(%rsp)
movq %rax, 0x68(%rsp)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x2831c
cmpl $0x3, %eax
jl 0x125cb
movq %r15, %rdi
callq 0x28248
movq 0x8(%r15), %rdx
movq 0x8(%rdx), %rcx
testq %rcx, %rcx
je 0x125cb
testl %eax, %eax
setns %sil
leaq 0x7e389(%rip), %rdi     # 0x9073d
leaq 0x7e3a2(%rip), %rax     # 0x9075d
cmovnsq %rax, %rdi
leaq 0x7e38d(%rip), %r8      # 0x90753
leaq 0x7e38e(%rip), %rax     # 0x9075b
cmovnsq %rax, %r8
movq %r8, 0x50(%rsp)
shlb $0x2, %sil
orb $0x63, %sil
movb %sil, 0x78(%rsp)
movq %rdi, 0x70(%rsp)
movb (%rdi), %al
movb %al, 0xf(%rsp)
movl $0x0, 0x5c(%rsp)
movq %r15, %rax
movq %r15, 0xe0(%rsp)
movq %rdx, %rsi
movq %rcx, %rdx
movq 0x18(%rsi), %rdi
subq 0x10(%rsi), %rdi
movq %rdi, 0x28(%rsp)
cmpl $0x9, %edi
jg 0x1258f
movq 0x20(%rsi), %rcx
movq 0x28(%rax), %rdi
movq %rcx, 0x20(%rsp)
movq %rcx, %rax
movq %rdi, 0x88(%rsp)
subq %rdi, %rax
cmpq $0x2, %rax
jl 0x1258f
movq 0x20(%rdx), %r14
movq 0x28(%rsi), %rcx
movq %r14, %rax
movq %rcx, 0x48(%rsp)
subq %rcx, %rax
cmpq $0x2, %rax
jl 0x1258f
movq %rsi, 0x18(%rsp)
movq %rdx, 0xe8(%rsp)
movslq 0x28(%rsp), %rax
movq %rax, 0x80(%rsp)
subl 0x88(%rsp), %r14d
xorl %ebx, %ebx
leaq 0x7bc06(%rip), %rax     # 0x8e090
movslq (%rax,%rbx,8), %r12
movslq 0x4(%rax,%rbx,8), %r15
movb 0x78(%rsp), %al
movq 0x20(%rsp), %rcx
cmpb %al, -0x1(%rcx)
jne 0x124d4
movb 0xf(%rsp), %al
movq 0x48(%rsp), %rcx
cmpb %al, (%rcx)
jne 0x124d4
cmpl $0x1, %r12d
je 0x124bf
movq 0x20(%rsp), %rax
cmpb $0x61, -0x2(%rax)
jne 0x124d4
cmpl $0x1, %r15d
je 0x12553
movq 0x48(%rsp), %rax
cmpb $0x74, 0x1(%rax)
je 0x12553
movq 0x50(%rsp), %rsi
subq %r12, %rsi
leaq 0x30(%rsp), %rdi
movq %r12, %rdx
callq 0x6570
leaq (%rsp,%r12), %r13
addq $0x30, %r13
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rsi
movq %r13, %rdi
movq 0x80(%rsp), %rbp
movq %rbp, %rdx
callq 0x6570
addq %rbp, %r13
movq %r13, %rdi
movq 0x70(%rsp), %rsi
movq %r15, %rdx
callq 0x6570
movq 0x28(%rsp), %rax
addl %r12d, %eax
leal (%r15,%rax), %esi
leaq 0x30(%rsp), %rdi
movq 0x88(%rsp), %rdx
movl %r14d, %ecx
callq 0x21f35
testq %rax, %rax
jne 0x1255a
incq %rbx
cmpq $0x4, %rbx
jne 0x12483
movq 0x18(%rsp), %rsi
jmp 0x1257f
addq %r12, %rax
movq 0x18(%rsp), %rsi
movq %rax, 0x20(%rsi)
movq 0x48(%rsp), %rcx
subq 0x20(%rsp), %rcx
addq %rax, %rcx
movq %rcx, 0x28(%rsi)
movl $0x1, 0x5c(%rsp)
movq 0xe0(%rsp), %r15
movq 0xe8(%rsp), %rdx
movq 0x8(%rdx), %rcx
movq %rsi, %rax
testq %rcx, %rcx
jne 0x12401
cmpl $0x0, 0x5c(%rsp)
je 0x125be
movq %r15, %rdi
callq 0x16552
movq %r15, %rdi
movl $0x1, %esi
callq 0x1620c
movq %rax, %r15
movq 0x40(%rsp), %r13
movq 0xa0(%rsp), %rbx
movq 0x68(%rsp), %rax
movq %r15, 0x8(%rax)
movq (%rax), %rax
testq %rax, %rax
jne 0x12374
movq 0x18(%rbx), %rax
movq 0x8(%rax), %rdi
movl 0x18(%rax), %esi
xorl %edx, %edx
movq %rbx, %rcx
xorl %r8d, %r8d
movq 0x60(%rsp), %r9
pushq 0xd8(%rsp)
pushq %r13
pushq $0x1
pushq $0x0
callq 0x10352
addq $0x20, %rsp
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x1233f
leaq 0x98(%rsp), %rdi
callq 0x14a0c
leaq 0xa8(%rsp), %rdi
callq 0x298bd
leaq 0xf8(%rsp), %rdi
callq 0x2c2c7
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq