// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/jkOwnLib/gfBlatLib.c
// Function: gfLongTransTransInMem
void gfLongTransTransInMem(struct dnaSeq *query, struct genoFind *gfs[3], 
   struct hash *t3Hash, boolean qIsRc, boolean tIsRc, boolean qIsRna,
   int minScore, struct gfOutput *out)
/* Chop up query into pieces, align each in translated space, and stitch back
 * together again as nucleotides. */
{
enum ffStringency stringency = (qIsRna ? ffCdna : ffLoose);
int maxSize = 1500;
int preferredSize = 1200;	/* PreferredSize - overlapSize might need to be multiple of 3. */
int overlapSize = 270;
struct dnaSeq subQuery = *query;
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)
    {
    /* 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;
    oneBunList = gfTransTransFindBundles(gfs, &subQuery, t3Hash, qIsRc, minScore, qIsRna);
    addToBigBundleList(&oneBunList, bunHash, &bigBunList, query);
    *endPos = saveEnd;
    }
for (bun = bigBunList; bun != NULL; bun = bun->next)
    {
    ssStitch(bun, ffCdna, minScore, ssAliCount);
    saveAlignments(bun->genoSeq->name, bun->genoSeq->size, 0, 
	bun, NULL, qIsRc, tIsRc, stringency, minScore, out);
    }
hashFree(&bunHash);
ssBundleFreeList(&bigBunList);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %r8, 0x50(%rsp)
movl %ecx, 0x38(%rsp)
movq %rdx, %r14
movq %rsi, 0x68(%rsp)
movq %rdi, %rbx
movl 0x150(%rsp), %r12d
xorl %eax, %eax
testl %r9d, %r9d
sete %al
leal 0x1(%rax,%rax), %ebp
movq 0x20(%rdi), %rax
movq %rax, 0xc0(%rsp)
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movaps %xmm1, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
xorl %eax, %eax
movq %rax, 0x48(%rsp)
movq %rax, 0x28(%rsp)
movl $0x8, %edi
movl $0x1, %esi
callq 0x29160
movq %rax, 0x40(%rsp)
movl 0x18(%rbx), %eax
testl %eax, %eax
jle 0x1296b
leaq 0xa0(%rsp), %rdi
leaq 0xd0(%rsp), %r13
xorl %ecx, %ecx
movq %rbp, 0x60(%rsp)
movq %r14, 0x88(%rsp)
movq %rbx, 0x58(%rsp)
testl %ecx, %ecx
sete %dl
cmpl $0x5dd, %eax            # imm = 0x5DD
setl %sil
testb %sil, %dl
je 0x126a7
movl %eax, 0x14(%rsp)
jmp 0x126c8
leal 0x4b0(%rcx), %edx
cmpl %eax, %edx
jge 0x126c2
leal 0x3a2(%rcx), %eax
movl %eax, 0x14(%rsp)
movl $0x4b0, %eax            # imm = 0x4B0
jmp 0x126c8
movl %eax, 0x14(%rsp)
subl %ecx, %eax
movslq %ecx, %rcx
addq 0x10(%rbx), %rcx
movq %rcx, 0xb0(%rsp)
movl %eax, 0xb8(%rsp)
movslq %eax, %rdx
movb (%rdx,%rcx), %al
movb %al, 0x7(%rsp)
movq %rcx, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movb $0x0, (%rdx,%rcx)
callq 0x15d78
movq %rax, 0x30(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x8(%rsp)
movq 0x68(%rsp), %r14
movq (%r14), %rax
movl 0xc(%rax), %eax
movl %eax, 0x3c(%rsp)
movq %rcx, 0x20(%rsp)
xorl %edi, %edi
callq 0x2bea4
movq %rax, 0x90(%rsp)
movq 0x30(%rsp), %rsi
addq $0x18, %rsi
movq %r14, %rdi
movq %r13, %rdx
movq %rax, %rcx
leaq 0x9c(%rsp), %r8
callq 0xee23
xorl %r14d, %r14d
leaq (%r14,%r14,2), %rax
leaq (%rsp,%rax,8), %rax
addq $0xd0, %rax
movq %rax, 0x80(%rsp)
xorl %r15d, %r15d
movq 0x80(%rsp), %rax
movq (%rax,%r15,8), %rbp
testq %rbp, %rbp
leaq 0x18(%rsp), %rbx
movl 0x3c(%rsp), %r12d
je 0x127eb
movq $0x0, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq 0x18(%rax,%r14,8), %rsi
movq %rbp, %rdi
movl %r12d, %edx
movl %r15d, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
pushq $0x0
pushq $0x1
callq 0x1088d
addq $0x10, %rsp
movq 0x18(%rsp), %r13
movq %r13, %rdi
movl %r14d, %esi
movl %r15d, %edx
movq 0x88(%rsp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x115f6
movq 0x8(%rsp), %rsi
movq %r13, %rdi
callq 0x1fc95
movq %rax, 0x8(%rsp)
movq (%rbp), %rbp
testq %rbp, %rbp
jne 0x12780
incq %r15
cmpq $0x3, %r15
jne 0x12765
incq %r14
cmpq $0x3, %r14
jne 0x1274c
leaq 0x8(%rsp), %rdi
leaq -0x2ce9(%rip), %rsi     # 0xfb28
callq 0x1fd04
movq 0x8(%rsp), %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0xfc3f
movq %rax, 0x8(%rsp)
testq %rax, %rax
movl 0x150(%rsp), %r12d
movq 0x60(%rsp), %rbp
leaq 0xa0(%rsp), %r13
je 0x12897
movq %rax, %rbx
movq 0x18(%rbx), %r15
movl $0x48, %edi
callq 0x2dc95
movq %rax, %r14
movq %r13, 0x10(%rax)
movq %r15, 0x18(%rax)
movq 0x28(%rbx), %rdi
movq %r13, %rsi
callq 0x10414
movq %rax, 0x8(%r14)
movq %r14, %rdi
movl %ebp, %esi
movl %r12d, %edx
movl $0x10, %ecx
callq 0x14ecb
movq 0x20(%rsp), %rax
movq %rax, (%r14)
movq %r14, 0x20(%rsp)
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x12847
leaq 0xd0(%rsp), %r13
movq %r13, %rbx
xorl %r14d, %r14d
xorl %r15d, %r15d
leaq (%rbx,%r15), %rdi
callq 0xdb1f
addq $0x8, %r15
cmpq $0x18, %r15
jne 0x128a8
incq %r14
addq $0x18, %rbx
cmpq $0x3, %r14
jne 0x128a5
movq 0x8(%rsp), %rbx
movq %rbx, 0x18(%rsp)
testq %rbx, %rbx
leaq 0x18(%rsp), %r14
je 0x128f1
movq (%rbx), %rbx
movq %r14, %rdi
callq 0xfa88
movq %rbx, 0x18(%rsp)
testq %rbx, %rbx
jne 0x128dc
movq $0x0, 0x8(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x15ddb
leaq 0x90(%rsp), %rdi
callq 0x2bf4b
leaq 0x20(%rsp), %rdi
callq 0x1fcb3
movq 0x20(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x40(%rsp), %rsi
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq 0x58(%rsp), %rbx
movq %rbx, %rcx
callq 0x1252b
movq 0x78(%rsp), %rax
movq 0x70(%rsp), %rcx
movb 0x7(%rsp), %dl
movb %dl, (%rax,%rcx)
movl 0x18(%rbx), %eax
movl 0x14(%rsp), %edx
movl %edx, %ecx
cmpl %eax, %edx
leaq 0xa0(%rsp), %rdi
jl 0x1268e
movq 0x28(%rsp), %rbx
testq %rbx, %rbx
movq 0x50(%rsp), %r15
movq %r12, %r13
movq %rbp, %r12
movl 0x38(%rsp), %ebp
je 0x129d0
movq 0x158(%rsp), %r14
movq %rbx, %rdi
movl $0x1, %esi
movl %r13d, %edx
movl $0x10, %ecx
callq 0x14ecb
movq 0x18(%rbx), %rax
movq 0x8(%rax), %rdi
movl 0x18(%rax), %esi
xorl %edx, %edx
movq %rbx, %rcx
xorl %r8d, %r8d
movl %ebp, %r9d
pushq %r14
pushq %r13
pushq %r12
pushq %r15
callq 0x1022f
addq $0x20, %rsp
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x1298c
leaq 0x40(%rsp), %rdi
callq 0x29565
leaq 0x28(%rsp), %rdi
callq 0x14960
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq