// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/chainBlock.c
// Function: peelChains
static struct chain *peelChains(char *qName, int qSize, char qStrand,
	char *tName, int tSize, struct kdLeaf *leafList, FILE *details)
/* Peel off all chains from tree implied by
 * best predecessors. */
{
struct kdLeaf *leaf;
struct chain *chainList = NULL, *chain;
for (leaf = leafList; leaf != NULL; leaf = leaf->next)
    leaf->hit = FALSE;
for (leaf = leafList; leaf != NULL; leaf = leaf->next)
    {
    if (!leaf->hit)
        {
	struct kdLeaf *lf;
	AllocVar(chain);
	chain->qName = cloneString(qName);
	chain->qSize = qSize;
	chain->qStrand = qStrand;
	chain->tName = cloneString(tName);
	chain->tSize = tSize;
	chain->qEnd = leaf->cb->qEnd;
	chain->tEnd = leaf->cb->tEnd;
	if (details)
	    {
	    chain->score = leaf->totalScore;
	    chain->id = -1;
	    chainWriteHead(chain, details);
	    chain->score = 0;
	    chain->id = 0;
	    }
	slAddHead(&chainList, chain);
	for (lf = leaf; ; )
	    {
	    lf->hit = TRUE;
	    slAddHead(&chain->blockList, lf->cb);
	    chain->qStart = lf->cb->qStart;
	    chain->tStart = lf->cb->tStart;
	    if (details)
	        {
		struct cBlock *b = lf->cb;
		fprintf(details, "%d\t%f\t%d\t%d\t%d\n", b->score, lf->totalScore,
			b->tStart, b->qStart, b->qEnd - b->qStart);
		}
	    if (lf->bestPred == NULL)
	         break;
	    else
	        {
		if (details)
		    {
		    struct cBlock *b = lf->cb;
		    struct cBlock *a = lf->bestPred->leaf->cb;
		    fprintf(details, " gap %d\t%d\n", 
			b->tStart - a->tEnd, b->qStart - a->qEnd);
		    }
		}
	    lf = lf->bestPred->leaf;
	    if (lf->hit)
	        break;
	    }
	}
    }
slReverse(&chainList);
return chainList;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %dl, %al
movq 0x10(%rbp), %rdx
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movb %al, -0xd(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq %r9, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x29920
movq -0x30(%rbp), %rax
movb $0x0, 0x20(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x29904
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x29b44
movq -0x30(%rbp), %rax
cmpb $0x0, 0x20(%rax)
jne 0x29b32
movl $0x50, %edi
callq 0x40c50
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x30(%rax)
movl -0xc(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x38(%rax)
movb -0xd(%rbp), %cl
movq -0x40(%rbp), %rax
movb %cl, 0x3c(%rax)
movq -0x18(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x1c(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x14(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl 0xc(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x28(%rax)
cmpq $0x0, 0x10(%rbp)
je 0x29a01
movq -0x30(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x40(%rbp), %rax
movsd %xmm0, 0x10(%rax)
movq -0x40(%rbp), %rax
movl $0xffffffff, 0x48(%rax) # imm = 0xFFFFFFFF
movq -0x40(%rbp), %rdi
movq 0x10(%rbp), %rsi
callq 0x28230
movq -0x40(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rax)
movq -0x40(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x29570
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movb $0x1, 0x20(%rax)
movq -0x40(%rbp), %rdi
addq $0x8, %rdi
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x29570
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x8(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x24(%rax)
cmpq $0x0, 0x10(%rbp)
je 0x29aab
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq 0x10(%rbp), %rdi
movq -0x50(%rbp), %rax
movl 0x18(%rax), %edx
movq -0x48(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x50(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x50(%rbp), %rax
movl 0x10(%rax), %r8d
movq -0x50(%rbp), %rax
movl 0x14(%rax), %r9d
movq -0x50(%rbp), %rax
subl 0x10(%rax), %r9d
leaq 0xb0102(%rip), %rsi     # 0xd9ba6
movb $0x1, %al
callq 0x6a80
movq -0x48(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x29ab8
jmp 0x29b30
cmpq $0x0, 0x10(%rbp)
je 0x29b0d
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq 0x10(%rbp), %rdi
movq -0x58(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x60(%rbp), %rax
subl 0xc(%rax), %edx
movq -0x58(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x60(%rbp), %rax
subl 0x14(%rax), %ecx
leaq 0xb00b0(%rip), %rsi     # 0xd9bb6
movb $0x0, %al
callq 0x6a80
jmp 0x29b0f
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpb $0x0, 0x20(%rax)
je 0x29b2b
jmp 0x29b30
jmp 0x29a16
jmp 0x29b32
jmp 0x29b34
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x29928
leaq -0x38(%rbp), %rdi
callq 0x2aad0
movq -0x38(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)