// File: /workspace/github_c_makefile_star2_O2/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 $0x88, %rsp
movq %r9, %r14
movq %r8, %rbx
movq %rcx, %r15
movl %edx, 0x44(%rsp)
movl %esi, %ebp
movq %rdi, 0x60(%rsp)
movq 0xe8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x58(%rsp)
movl $0x400, %edi            # imm = 0x400
callq 0x21bcc
movq %rax, %r12
movq %rax, 0x80(%rsp)
movl $0x400, %edi            # imm = 0x400
callq 0x21bcc
movq %rax, 0x38(%rsp)
movq %rax, 0x78(%rsp)
testq %r14, %r14
je 0x111f6
movq %rbx, %r13
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x2447a
movq %rax, 0x18(%rsp)
jmp 0x11202
movq %rbx, %r13
movq $0x0, 0x18(%rsp)
pushq $0x18
popq %rdi
callq 0x28bb0
movq %rax, %rcx
movl %ebp, 0x10(%rax)
movq 0xc0(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, 0x14(%rcx)
cmpl $0x0, 0xc8(%rsp)
setne %al
addb %al, %al
addb $0x2b, %al
movb %al, 0xf(%rsp)
cmpl $0x0, 0xd0(%rsp)
setne %al
addb %al, %al
addb $0x2b, %al
movb %al, 0xe(%rsp)
movq %rcx, 0x50(%rsp)
addq $0x8, %rcx
movq %rcx, 0x48(%rsp)
xorl %eax, %eax
movq %r15, %rbx
movq %r13, 0x20(%rsp)
movq %r12, 0x68(%rsp)
testq %rbx, %rbx
je 0x11522
movq %rax, 0x10(%rsp)
movq %rbx, 0x28(%rsp)
movq 0x8(%rbx), %r15
testq %r15, %r15
je 0x112c3
movq 0x20(%r15), %rdi
movq %r13, %rsi
movq 0x18(%rsp), %r14
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x13107
movl %eax, %ebp
movq 0x28(%rbx), %rdi
movq %r13, %rsi
movq %r14, %rdx
pushq $0x1
popq %rcx
callq 0x13107
movl 0x10(%r15), %ecx
subl 0x18(%rbx), %ecx
subl %eax, %ebp
je 0x112b6
testl %ecx, %ecx
jne 0x112c3
cmpl $0x8, %ebp
ja 0x112c3
movq %r15, %rbx
cmpl $0x9, %ecx
jb 0x11274
andl $0x0, 0x14(%r12)
movq 0x8(%r12), %rax
xorl %ecx, %ecx
movb %cl, (%rax)
movq 0x38(%rsp), %rbx
andl $0x0, 0x14(%rbx)
movq 0x8(%rbx), %rax
movb %cl, (%rax)
movq 0x28(%rsp), %r14
movq %r15, 0x30(%rsp)
movq 0x10(%rsp), %rax
cmpq %r15, %r14
je 0x113f7
movq 0x10(%r14), %rsi
movl 0x18(%r14), %edx
subl %esi, %edx
movq %r12, %rdi
callq 0x21cc8
movq 0x20(%r14), %rsi
movl 0x28(%r14), %edx
subl %esi, %edx
movq %rbx, %rdi
callq 0x21cc8
movq 0x8(%r14), %rax
cmpq %r15, %rax
je 0x113eb
leaq 0x18(%r14), %rcx
leaq 0x28(%r14), %r15
movl 0x10(%rax), %ebx
movq %rcx, 0x70(%rsp)
subl (%rcx), %ebx
movq 0x20(%rax), %rdi
movq %r13, %rsi
movq %r13, %r12
movq 0x18(%rsp), %r13
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x13107
movl %eax, %ebp
movq %r15, 0x10(%rsp)
movq (%r15), %rdi
movq %r12, %rsi
movq %r13, %rdx
pushq $0x1
popq %rcx
callq 0x13107
subl %eax, %ebp
cmpl %ebx, %ebp
movl %ebx, %r13d
cmovgl %ebp, %r13d
testl %ebx, %ebx
js 0x11380
testl %ebp, %ebp
jns 0x113a3
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0xc0(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x6bf03(%rip), %rdi     # 0x7d29f
xorl %eax, %eax
callq 0x223fb
cmpl %ebx, %ebp
movq 0x70(%rsp), %rax
cmovgq 0x10(%rsp), %rax
movq 0x68(%rsp), %r12
movq %r12, %rdi
movq 0x38(%rsp), %rbx
cmovgq %rbx, %rdi
movq %rbx, %rbp
cmovgq %r12, %rbp
movq (%rax), %rsi
movl %r13d, %edx
callq 0x21cc8
movq %rbp, %rdi
pushq $0x2d
popq %rsi
movl %r13d, %edx
callq 0x21d7e
movq 0x20(%rsp), %r13
movq 0x30(%rsp), %r15
movq %r14, %rax
movq 0x8(%r14), %r14
jmp 0x112f0
movq %rax, 0x10(%rsp)
movl 0x14(%rbx), %eax
cmpl 0x14(%r12), %eax
jne 0x11568
pushq $0x58
popq %rdi
callq 0x28bb0
movq %rax, %rbp
movq 0xc0(%rsp), %rbx
movq 0x8(%rbx), %rdi
callq 0x1c306
movq %rax, 0x8(%rbp)
movq 0x28(%rsp), %rcx
movl 0x10(%rcx), %eax
movq %rcx, %r15
movl 0x10(%rbx), %ecx
subl %ecx, %eax
movl %eax, 0x10(%rbp)
movq 0x10(%rsp), %r14
movl 0x18(%r14), %eax
subl %ecx, %eax
movl %eax, 0x14(%rbp)
movb 0xf(%rsp), %al
movb %al, 0x18(%rbp)
movq 0x60(%rsp), %rdi
callq 0x1c306
movq %rax, 0x20(%rbp)
movq 0x20(%r15), %rdi
movq 0x20(%rsp), %r13
movq %r13, %rsi
movq 0x18(%rsp), %r15
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x13107
movl 0x44(%rsp), %ebx
addl %ebx, %eax
movl %eax, 0x28(%rbp)
movq 0x28(%r14), %rdi
movq %r13, %rsi
movq %r15, %rdx
pushq $0x1
popq %rcx
callq 0x13107
addl %ebx, %eax
movl %eax, 0x2c(%rbp)
movb 0xe(%rsp), %al
movb %al, 0x30(%rbp)
movq 0x38(%rsp), %rbx
movl 0x14(%rbx), %eax
movl %eax, 0x38(%rbp)
movq 0x8(%r12), %rdi
callq 0x1c306
movq %rax, 0x40(%rbp)
movq 0x8(%rbx), %rdi
callq 0x1c306
movq %rax, 0x48(%rbp)
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rdi
movq %r15, %rsi
callq 0x13157
movl %eax, 0x50(%rbp)
movq 0xe8(%rsp), %rax
cmpl $0x0, 0x3c(%rax)
je 0x114f4
movq %rbp, %rdi
callq 0x16da8
jmp 0x114fc
movq %rbp, %rdi
callq 0x16d80
movq 0x30(%rsp), %rbx
movl %eax, 0x34(%rbp)
movq 0x48(%rsp), %rcx
movq (%rcx), %rax
movq %rax, (%rbp)
movq %rbp, (%rcx)
movq 0x20(%rsp), %r13
movq 0x10(%rsp), %rax
jmp 0x11261
movq 0x48(%rsp), %rdi
callq 0x1c567
leaq 0x80(%rsp), %rdi
callq 0x21c07
leaq 0x78(%rsp), %rdi
callq 0x21c07
movq 0x58(%rsp), %rcx
movq (%rcx), %rax
movq 0x50(%rsp), %rdx
movq %rax, (%rdx)
movq %rdx, (%rcx)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6bd4e(%rip), %rdi     # 0x7d2bd
leaq 0x6bd66(%rip), %rsi     # 0x7d2dc
leaq 0x6bd70(%rip), %rcx     # 0x7d2ed
movl $0x128, %edx            # imm = 0x128
callq 0x6460