// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xd0, %rsp
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movl $0x1388, -0x30(%rbp)    # imm = 0x1388
movl $0x1194, -0x34(%rbp)    # imm = 0x1194
movl $0xfa, -0x38(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x60(%rbp), %rdi
movl $0x28, %edx
callq 0x6570
xorl %edi, %edi
callq 0x3dc20
movq %rax, -0x68(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movl $0x8, %edi
movl $0x1, %esi
callq 0x398a0
movq %rax, -0xa0(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x146c4
movq $0x0, -0xb0(%rbp)
cmpl $0x0, -0x6c(%rbp)
jne 0x14568
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x30(%rbp), %eax
jg 0x14568
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x145a4
movl -0x34(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
addl -0x6c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jl 0x14596
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
subl -0x6c(%rbp), %eax
movl %eax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x74(%rbp)
jmp 0x145a2
movl -0x6c(%rbp), %eax
addl -0x34(%rbp), %eax
subl -0x38(%rbp), %eax
movl %eax, -0x74(%rbp)
jmp 0x145a4
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x6c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x50(%rbp), %rax
movslq -0x70(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movb (%rax), %al
movb %al, -0x75(%rbp)
movq -0x80(%rbp), %rax
movb $0x0, (%rax)
cmpl $0x0, 0x18(%rbp)
je 0x14610
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl -0x6c(%rbp), %ecx
movq -0x68(%rbp), %r8
movl -0x18(%rbp), %r9d
movl -0x14(%rbp), %eax
leaq -0x60(%rbp), %rsi
movl %eax, (%rsp)
callq 0x1bc40
movq %rax, -0x88(%rbp)
jmp 0x14692
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl -0x6c(%rbp), %ecx
movq -0x68(%rbp), %r8
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %r9
callq 0xea60
movq %rax, -0xa8(%rbp)
cmpl $0x0, 0x10(%rbp)
je 0x14656
movq -0x10(%rbp), %rdi
movq -0xa8(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x147b0
movq %rax, -0x88(%rbp)
jmp 0x14686
movq -0xa8(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %ecx
leaq -0x60(%rbp), %rdx
leaq -0xb0(%rbp), %r8
callq 0x148e0
movq %rax, -0x88(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x117e0
leaq -0xa8(%rbp), %rdi
callq 0xe5f0
movq -0xa0(%rbp), %rsi
movq -0x8(%rbp), %rcx
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0x14a30
movb -0x75(%rbp), %cl
movq -0x80(%rbp), %rax
movb %cl, (%rax)
movl -0x74(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x1452c
movq -0x90(%rbp), %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
je 0x1477b
movq -0x98(%rbp), %rdi
movl -0x18(%rbp), %edx
movl 0xf1704(%rip), %ecx     # 0x105df4
movl $0x1, %esi
callq 0x18b80
cmpl $0x0, 0x10(%rbp)
jne 0x14712
cmpl $0x0, 0x18(%rbp)
jne 0x14712
movq -0x98(%rbp), %rdi
callq 0x14b40
movq -0x98(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x98(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x18(%rax), %esi
movq -0x98(%rbp), %rcx
movl -0x14(%rbp), %r9d
movl -0x18(%rbp), %r10d
movq -0x28(%rbp), %rax
xorl %edx, %edx
xorl %r8d, %r8d
movl $0x0, (%rsp)
movl $0x1, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x121d0
movq -0x98(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x98(%rbp)
jmp 0x146d2
leaq -0x90(%rbp), %rdi
callq 0x183e0
leaq -0xa0(%rbp), %rdi
callq 0x3a080
leaq -0x68(%rbp), %rdi
callq 0x3dd90
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)