// File: /workspace/github_c_makefile_star2_O1/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, 0xb0(%rsp)
movq %r8, %r15
movl %ecx, %r14d
movq %rdx, 0x48(%rsp)
movq %rsi, %r12
movq %rdi, %r13
movl 0x148(%rsp), %eax
movl %eax, 0x40(%rsp)
movl 0x140(%rsp), %ebp
movq 0x20(%rdi), %rax
movq %rax, 0x100(%rsp)
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movaps %xmm1, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x2bea4
movq %rax, 0xa8(%rsp)
movq %rbx, 0x80(%rsp)
movq %rbx, 0x90(%rsp)
movl $0x8, %edi
movl $0x1, %esi
callq 0x29160
movq %rax, 0xa0(%rsp)
movl 0x18(%r13), %eax
testl %eax, %eax
movq %r14, 0x50(%rsp)
jle 0x12204
leaq 0xe0(%rsp), %rbx
xorl %ecx, %ecx
movq %r15, 0x70(%rsp)
movq %r12, 0x68(%rsp)
movq %r13, 0x60(%rsp)
testl %ecx, %ecx
sete %dl
cmpl $0x1389, %eax           # imm = 0x1389
setl %sil
testb %sil, %dl
je 0x11ee7
movl %eax, 0x30(%rsp)
movq 0x48(%rsp), %r10
jmp 0x11f0d
leal 0x1194(%rcx), %edx
cmpl %eax, %edx
movq 0x48(%rsp), %r10
jge 0x11f07
leal 0x109a(%rcx), %eax
movl %eax, 0x30(%rsp)
movl $0x1194, %eax           # imm = 0x1194
jmp 0x11f0d
movl %eax, 0x30(%rsp)
subl %ecx, %eax
movslq %ecx, %rdx
addq 0x10(%r13), %rdx
movq %rdx, 0xf0(%rsp)
movl %eax, 0xf8(%rsp)
movslq %eax, %rsi
movb (%rsi,%rdx), %al
movb %al, 0x18(%rsp)
movq %rdx, 0x38(%rsp)
movq %rsi, 0x78(%rsp)
movb $0x0, (%rsi,%rdx)
movq 0xa8(%rsp), %r8
cmpl $0x0, 0x148(%rsp)
je 0x11f75
subq $0x8, %rsp
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %r14d, %r9d
pushq %r10
callq 0x16d07
addq $0x10, %rsp
movq %rax, 0x80(%rsp)
jmp 0x121c1
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
leaq 0xdc(%rsp), %r9
callq 0xde09
movq %rax, %r14
movq %rax, 0xd0(%rsp)
testl %ebp, %ebp
je 0x1205a
movq $0x0, 0x10(%rsp)
testq %r14, %r14
leaq 0x10(%rsp), %r15
je 0x11fd9
movl 0xc(%r12), %edx
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq $0x1
pushq $0x0
callq 0x1088d
addq $0x10, %rsp
movq (%r14), %r14
testq %r14, %r14
jne 0x11fb1
movq %r15, %rdi
callq 0x1fcb3
movq %r15, %rdi
leaq -0x24c3(%rip), %rsi     # 0xfb28
callq 0x1fd04
movq 0x10(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0xfc3f
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x1216c
movq %rax, %r12
xorl %r15d, %r15d
movq 0x18(%r12), %r13
movl $0x48, %edi
callq 0x2dc95
movq %rax, %r14
movq %rbx, 0x10(%rax)
movq %r13, 0x18(%rax)
movq 0x28(%r12), %rdi
movq %rbx, %rsi
callq 0x10414
movq %rax, 0x8(%r14)
movl $0x0, 0x30(%r14)
movq %r15, (%r14)
movq (%r12), %r12
movq %r14, %r15
testq %r12, %r12
jne 0x12013
jmp 0x1216f
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq %rax, 0x10(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x113da
movq %rax, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
leaq -0x2559(%rip), %rsi     # 0xfb28
callq 0x1fd04
movq 0x10(%rsp), %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0xfc3f
movq %rax, 0x10(%rsp)
testq %rax, %rax
movq 0x50(%rsp), %r13
movq 0x48(%rsp), %rbp
je 0x1212d
movq %rax, %r14
movq 0x18(%r14), %r15
movl 0xf8(%rsp), %esi
movl 0x18(%r15), %edx
movq %r14, %rdi
xorl %ecx, %ecx
movl %ebp, %r8d
movl $0x1f4, %r9d            # imm = 0x1F4
callq 0x13130
movl $0x0, 0x20(%r14)
movl 0x18(%r15), %eax
movl %eax, 0x24(%r14)
movl $0x48, %edi
callq 0x2dc95
movq %rax, %r12
movq %rbx, 0x10(%rax)
movq %r15, 0x18(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x10138
movq %r12, %rdi
movl $0x1, %esi
movl %r13d, %edx
movl $0x10, %ecx
callq 0x14ecb
movq 0x20(%rsp), %rax
movq %rax, (%r12)
movq %r12, 0x20(%rsp)
movq (%r14), %r14
testq %r14, %r14
jne 0x120b0
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x1fcb3
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %r14, 0x20(%rsp)
testq %r14, %r14
je 0x12163
movq (%r14), %r14
movq %r15, %rdi
callq 0xfa88
jmp 0x1214c
movl 0x140(%rsp), %ebp
jmp 0x121a0
xorl %r14d, %r14d
movq 0x10(%rsp), %r15
movq %r15, 0x20(%rsp)
testq %r15, %r15
leaq 0x20(%rsp), %r12
je 0x12198
movq (%r15), %r15
movq %r12, %rdi
callq 0xfa88
movq %r15, 0x20(%rsp)
testq %r15, %r15
jne 0x12183
movq %r14, 0x80(%rsp)
movq 0x70(%rsp), %r15
movq 0x68(%rsp), %r12
movq 0x60(%rsp), %r13
leaq 0xd0(%rsp), %rdi
callq 0xdb1f
movq 0x50(%rsp), %r14
movq 0xa0(%rsp), %rsi
leaq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rdx
movq %r13, %rcx
callq 0x1252b
movq 0x38(%rsp), %rax
movq 0x78(%rsp), %rcx
movb 0x18(%rsp), %dl
movb %dl, (%rax,%rcx)
movl 0x18(%r13), %eax
movl 0x30(%rsp), %edx
movl %edx, %ecx
cmpl %eax, %edx
jl 0x11ec9
movq 0x90(%rsp), %rbx
testq %rbx, %rbx
je 0x124f2
orl %ebp, 0x40(%rsp)
movq %rbx, 0x98(%rsp)
movq %rbx, %rdi
movl $0x1, %esi
movl %r14d, %edx
movl $0x10, %ecx
callq 0x14ecb
cmpl $0x0, 0x40(%rsp)
je 0x12280
movq 0x98(%rsp), %rbx
movq 0x18(%rbx), %rax
movq 0x8(%rax), %rdi
movl 0x18(%rax), %esi
xorl %edx, %edx
movq %rbx, %rcx
xorl %r8d, %r8d
movq 0x48(%rsp), %r9
pushq 0xb0(%rsp)
pushq %r14
pushq $0x1
pushq $0x0
callq 0x1022f
addq $0x20, %rsp
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x12219
jmp 0x124f2
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x1223d
movq %rax, 0x58(%rsp)
movq 0x8(%rax), %rbx
movq %rbx, %rdi
callq 0x27fda
cmpl $0x3, %eax
jl 0x124e1
movq %rbx, %rdi
callq 0x27f02
movq 0x8(%rbx), %rdx
movq 0x8(%rdx), %rcx
testq %rcx, %rcx
je 0x124e1
testl %eax, %eax
setns %sil
leaq 0x7e37b(%rip), %rdi     # 0x9064c
leaq 0x7e394(%rip), %rax     # 0x9066c
cmovnsq %rax, %rdi
leaq 0x7e37f(%rip), %r8      # 0x90662
leaq 0x7e380(%rip), %rax     # 0x9066a
cmovnsq %rax, %r8
movq %r8, 0xc8(%rsp)
shlb $0x2, %sil
orb $0x63, %sil
movb %sil, 0x68(%rsp)
movq %rdi, 0x60(%rsp)
movb (%rdi), %al
movb %al, 0xf(%rsp)
movl $0x0, 0x44(%rsp)
movq %rbx, %rax
movq %rbx, 0xb8(%rsp)
movq %rdx, %rsi
movq %rcx, %rdx
movq 0x18(%rsi), %rdi
subq 0x10(%rsi), %rdi
movq %rdi, 0x30(%rsp)
cmpl $0x9, %edi
jg 0x124ad
movq 0x20(%rsi), %rcx
movq 0x28(%rax), %rdi
movq %rcx, 0x38(%rsp)
movq %rcx, %rax
movq %rdi, 0x78(%rsp)
subq %rdi, %rax
cmpq $0x2, %rax
jl 0x124ad
movq 0x20(%rdx), %rbp
movq 0x28(%rsi), %rcx
movq %rbp, %rax
movq %rcx, 0x88(%rsp)
subq %rcx, %rax
cmpq $0x2, %rax
jl 0x124ad
movq %rsi, 0x18(%rsp)
movq %rdx, 0xc0(%rsp)
movslq 0x30(%rsp), %rax
movq %rax, 0x70(%rsp)
subl 0x78(%rsp), %ebp
xorl %ebx, %ebx
leaq 0x7bcad(%rip), %rax     # 0x8e050
movslq (%rax,%rbx,8), %r12
movslq 0x4(%rax,%rbx,8), %r15
movb 0x68(%rsp), %al
movq 0x38(%rsp), %rcx
cmpb %al, -0x1(%rcx)
jne 0x123f3
movb 0xf(%rsp), %al
movq 0x88(%rsp), %rcx
cmpb %al, (%rcx)
jne 0x123f3
cmpl $0x1, %r12d
je 0x123db
movq 0x38(%rsp), %rax
cmpb $0x61, -0x2(%rax)
jne 0x123f3
cmpl $0x1, %r15d
je 0x1246e
movq 0x88(%rsp), %rax
cmpb $0x74, 0x1(%rax)
je 0x1246e
movq 0xc8(%rsp), %rsi
subq %r12, %rsi
leaq 0x20(%rsp), %rdi
movq %r12, %rdx
callq 0x6570
leaq (%rsp,%r12), %r13
addq $0x20, %r13
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rsi
movq %r13, %rdi
movq 0x70(%rsp), %r14
movq %r14, %rdx
callq 0x6570
addq %r14, %r13
movq %r13, %rdi
movq 0x60(%rsp), %rsi
movq %r15, %rdx
callq 0x6570
movq 0x30(%rsp), %rax
addl %r12d, %eax
leal (%r15,%rax), %esi
leaq 0x20(%rsp), %rdi
movq 0x78(%rsp), %rdx
movl %ebp, %ecx
callq 0x21bd6
testq %rax, %rax
jne 0x12475
incq %rbx
cmpq $0x4, %rbx
jne 0x1239c
movq 0x18(%rsp), %rsi
jmp 0x1249d
addq %r12, %rax
movq 0x18(%rsp), %rsi
movq %rax, 0x20(%rsi)
movq 0x88(%rsp), %rcx
subq 0x38(%rsp), %rcx
addq %rax, %rcx
movq %rcx, 0x28(%rsi)
movl $0x1, 0x44(%rsp)
movq 0xb8(%rsp), %rbx
movq 0xc0(%rsp), %rdx
movq 0x8(%rdx), %rcx
movq %rsi, %rax
testq %rcx, %rcx
jne 0x12321
cmpl $0x0, 0x44(%rsp)
je 0x124dc
movq %rbx, %rdi
callq 0x16520
movq %rbx, %rdi
movl $0x1, %esi
callq 0x161cb
movq %rax, %rbx
movq 0x50(%rsp), %r14
movq 0x58(%rsp), %rax
movq %rbx, 0x8(%rax)
movq (%rax), %rax
jmp 0x1228c
leaq 0x90(%rsp), %rdi
callq 0x14960
leaq 0xa0(%rsp), %rdi
callq 0x29565
leaq 0xa8(%rsp), %rdi
callq 0x2bf4b
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq