// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/jkOwnLib/gfOut.c
// Function: saveAxtBundle
static void saveAxtBundle(char *chromName, int chromSize, int chromOffset,
	struct ffAli *ali, 
	struct dnaSeq *tSeq, struct hash *t3Hash, struct dnaSeq *qSeq, 
	boolean qIsRc, boolean tIsRc, 
	enum ffStringency stringency, int minMatch, struct gfOutput *out)
/* Save alignment to axtBundle. */
{
struct axtData *ad = out->data;
struct ffAli *sAli, *eAli, *ff, *rt, *eFf = NULL;
struct axt *axt;
struct dyString *q = newDyString(1024), *t = newDyString(1024);
struct axtBundle *gab;
struct trans3 *t3List = NULL;

if (t3Hash != NULL)
    t3List = hashMustFindVal(t3Hash, tSeq->name);
AllocVar(gab);
gab->tSize = chromSize;
gab->qSize = qSeq->size;
for (sAli = ali; sAli != NULL; sAli = eAli)
    {
    eAli = ffNextBreak(sAli, 8, tSeq, t3List);
    dyStringClear(q);
    dyStringClear(t);
    for (ff = sAli; ff != eAli; ff = ff->right)
        {
	dyStringAppendN(q, ff->nStart, ff->nEnd - ff->nStart);
	dyStringAppendN(t, ff->hStart, ff->hEnd - ff->hStart);
	rt = ff->right;
	if (rt != eAli)
	    {
	    int nGap = rt->nStart - ff->nEnd;
	    int nhStart = trans3GenoPos(rt->hStart, tSeq, t3List, FALSE) 
	    	+ chromOffset;
	    int ohEnd = trans3GenoPos(ff->hEnd, tSeq, t3List, TRUE) 
	    	+ chromOffset;
	    int hGap = nhStart - ohEnd;
	    int gap = max(nGap, hGap);
	    if (nGap < 0 || hGap < 0)
		{
	        errAbort("Negative gap size in %s vs %s", tSeq->name, qSeq->name);
		}
	    if (nGap == gap)
	        {
		dyStringAppendN(q, ff->nEnd, gap);
		dyStringAppendMultiC(t, '-', gap);
		}
	    else
	        {
		dyStringAppendN(t, ff->hEnd, gap);
		dyStringAppendMultiC(q, '-', gap);
		}
	    }
	eFf = ff;	/* Keep track of last block in bunch */
	}
    assert(t->stringSize == q->stringSize);
    AllocVar(axt);
    axt->qName = cloneString(qSeq->name);
    axt->qStart = sAli->nStart - qSeq->dna;
    axt->qEnd = eFf->nEnd - qSeq->dna;
    axt->qStrand = (qIsRc ? '-' : '+');
    axt->tName = cloneString(chromName);
    axt->tStart = trans3GenoPos(sAli->hStart, tSeq, t3List, FALSE) + chromOffset;
    axt->tEnd = trans3GenoPos(eFf->hEnd, tSeq, t3List, TRUE) + chromOffset;
    axt->tStrand = (tIsRc ? '-' : '+');
    axt->symCount = t->stringSize;
    axt->qSym = cloneString(q->string);
    axt->tSym = cloneString(t->string);
    axt->frame = trans3Frame(sAli->hStart, t3List);
    if (out->qIsProt)
	axt->score = axtScoreProteinDefault(axt);
    else 
	axt->score = axtScoreDnaDefault(axt);
    slAddHead(&gab->axtList, axt);
    }
slReverse(&gab->axtList);
dyStringFree(&q);
dyStringFree(&t);
slAddHead(&ad->bundleList, gab);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %r12
movq %r8, %rbx
movq %rcx, %r15
movl %edx, 0x2c(%rsp)
movl %esi, %ebp
movq %rdi, 0x40(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x38(%rsp)
movl $0x400, %edi            # imm = 0x400
callq 0x261d0
movq %rax, 0x10(%rsp)
movl $0x400, %edi            # imm = 0x400
callq 0x261d0
movq %rax, 0x8(%rsp)
testq %r12, %r12
je 0x13c7c
movq 0x8(%rbx), %rsi
movq %r12, %rdi
callq 0x28fdd
movq %rax, 0x20(%rsp)
jmp 0x13c85
movq $0x0, 0x20(%rsp)
movl $0x18, %edi
callq 0x2dc95
movq %rax, %rcx
movl %ebp, 0x10(%rax)
movq 0x80(%rsp), %rax
movl 0x18(%rax), %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x14(%rcx)
testq %r15, %r15
je 0x13f82
cmpl $0x0, 0x88(%rsp)
setne %al
addb %al, %al
addb $0x2b, %al
movb %al, 0x7(%rsp)
cmpl $0x0, 0x90(%rsp)
setne %al
addb %al, %al
addb $0x2b, %al
movb %al, 0x6(%rsp)
xorl %r14d, %r14d
movq %r15, 0x18(%rsp)
movq %r15, %r12
movq 0x8(%r12), %r15
testq %r15, %r15
je 0x13d37
movq 0x20(%r15), %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %r13
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x15f1c
movl %eax, %ebp
movq 0x28(%r12), %rdi
movq %rbx, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0x15f1c
movl 0x10(%r15), %ecx
subl 0x18(%r12), %ecx
subl %eax, %ebp
je 0x13d2a
testl %ecx, %ecx
jne 0x13d37
cmpl $0x8, %ebp
ja 0x13d37
movq %r15, %r12
cmpl $0x9, %ecx
jb 0x13ce2
movq 0x10(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, 0x14(%rax)
movq 0x8(%rax), %rax
movb %cl, (%rax)
movq 0x8(%rsp), %rax
movl %ecx, 0x14(%rax)
movq 0x8(%rax), %rax
movb %cl, (%rax)
cmpq %r15, 0x18(%rsp)
je 0x13e54
movq 0x18(%rsp), %rax
movq %rax, %r14
movq 0x10(%rsp), %rdi
movq 0x10(%rax), %rsi
movl 0x18(%rax), %edx
subl %esi, %edx
callq 0x262da
movq 0x8(%rsp), %rdi
movq 0x20(%r14), %rsi
movl 0x28(%r14), %edx
subl %esi, %edx
callq 0x262da
movq 0x8(%r14), %rax
cmpq %r15, %rax
je 0x13e47
movl 0x10(%rax), %ebp
subl 0x18(%r14), %ebp
movq 0x20(%rax), %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %r13
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x15f1c
movl %eax, %r12d
movq 0x28(%r14), %rdi
movq %rbx, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0x15f1c
subl %eax, %r12d
cmpl %ebp, %r12d
movl %ebp, %r13d
cmovgl %r12d, %r13d
testl %ebp, %ebp
js 0x13de6
testl %r12d, %r12d
jns 0x13e04
movq 0x8(%rbx), %rsi
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x7a4c2(%rip), %rdi     # 0x8e2bf
xorl %eax, %eax
callq 0x26b6f
cmpl %ebp, %r12d
jle 0x13e21
movq 0x8(%rsp), %rdi
movq 0x28(%r14), %rsi
movl %r13d, %edx
callq 0x262da
leaq 0x10(%rsp), %rax
jmp 0x13e37
movq 0x10(%rsp), %rdi
movq 0x18(%r14), %rsi
movl %r13d, %edx
callq 0x262da
leaq 0x8(%rsp), %rax
movq (%rax), %rdi
movl $0x2d, %esi
movl %r13d, %edx
callq 0x263b3
movq 0x8(%r14), %rax
cmpq %r15, %rax
jne 0x13d65
movq 0x8(%rsp), %rax
movl 0x14(%rax), %eax
movq 0x10(%rsp), %rcx
cmpl 0x14(%rcx), %eax
jne 0x13fc4
movl $0x58, %edi
callq 0x2dc95
movq %rax, %rbp
movq 0x80(%rsp), %r12
movq 0x8(%r12), %rdi
callq 0x1f9f6
movq %rax, 0x8(%rbp)
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %eax
movq %rcx, %r13
movl 0x10(%r12), %ecx
subl %ecx, %eax
movl %eax, 0x10(%rbp)
movl 0x18(%r14), %eax
subl %ecx, %eax
movl %eax, 0x14(%rbp)
movb 0x7(%rsp), %al
movb %al, 0x18(%rbp)
movq 0x40(%rsp), %rdi
callq 0x1f9f6
movq %rax, 0x20(%rbp)
movq 0x20(%r13), %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %r13
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x15f1c
movl 0x2c(%rsp), %r12d
addl %r12d, %eax
movl %eax, 0x28(%rbp)
movq 0x28(%r14), %rdi
movq %rbx, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0x15f1c
addl %r12d, %eax
movl %eax, 0x2c(%rbp)
movb 0x6(%rsp), %al
movb %al, 0x30(%rbp)
movq 0x8(%rsp), %rax
movl 0x14(%rax), %eax
movl %eax, 0x38(%rbp)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x1f9f6
movq %rax, 0x40(%rbp)
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x1f9f6
movq %rax, 0x48(%rbp)
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
movq %r13, %rsi
callq 0x15f6a
movl %eax, 0x50(%rbp)
movq 0xa8(%rsp), %rax
cmpl $0x0, 0x3c(%rax)
je 0x13f5d
movq %rbp, %rdi
callq 0x19fd0
jmp 0x13f65
movq %rbp, %rdi
callq 0x19f9e
movl %eax, 0x34(%rbp)
movq 0x30(%rsp), %rcx
movq 0x8(%rcx), %rax
movq %rax, (%rbp)
movq %rbp, 0x8(%rcx)
testq %r15, %r15
jne 0x13cda
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
addq $0x8, %rdi
callq 0x1fcb3
leaq 0x10(%rsp), %rdi
callq 0x2620d
leaq 0x8(%rsp), %rdi
callq 0x2620d
movq 0x38(%rsp), %rcx
movq (%rcx), %rax
movq %rax, (%rbx)
movq %rbx, (%rcx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7a312(%rip), %rdi     # 0x8e2dd
leaq 0x7a32a(%rip), %rsi     # 0x8e2fc
leaq 0x7a334(%rip), %rcx     # 0x8e30d
movl $0x128, %edx            # imm = 0x128
callq 0x6460