// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/maf.c
// Function: mafSubsetE
struct mafAli *mafSubsetE(struct mafAli *maf, char *componentSource,
	int newStart, int newEnd, bool getInitialDashes)
/* Extract subset of maf that intersects a given range
 * in a component sequence.  The newStart and newEnd
 * are given in the forward strand coordinates of the
 * component sequence.  The componentSource is typically
 * something like 'mm3.chr1'.  This will return NULL
 * if maf does not intersect range.  The score field
 * in the returned maf will not be filled in (since
 * we don't know which scoring scheme to use). */
{
struct mafComp *mcMaster = mafFindComponent(maf, componentSource);
struct mafAli *subset;
struct mafComp *mc, *subMc;
char *s, *e;
int textStart, textSize;

/* Reverse complement input range if necessary. */
if (mcMaster->strand == '-')
    reverseIntRange(&newStart, &newEnd, mcMaster->srcSize);

/* Check if any real intersection and return NULL if not. */
if (newStart >= newEnd)
    return NULL;
if (newStart >= mcMaster->start + mcMaster->size)
    return NULL;
if (newEnd <= mcMaster->start)
    return NULL;

/* Clip to bounds of actual data. */
if (newStart < mcMaster->start)
    newStart = mcMaster->start;
if (newEnd > mcMaster->start + mcMaster->size)
    newEnd = mcMaster->start + mcMaster->size;

/* Translate position in master sequence to position in
 * multiple alignment. */
s = skipIgnoringDash(mcMaster->text, newStart - mcMaster->start, TRUE);
e = skipIgnoringDash(s, newEnd - newStart, TRUE);
textStart = s - mcMaster->text;
textSize = e - s;

if (getInitialDashes && (newStart == mcMaster->start))
    {
    textStart = 0;
    textSize += s - mcMaster->text;
    }

/* Allocate subset structure and fill it in */
AllocVar(subset);
subset->textSize = textSize;
for (mc = maf->components; mc != NULL; mc = mc->next)
    {
    AllocVar(subMc);
    subMc->src = cloneString(mc->src);
    subMc->srcSize = mc->srcSize;
    subMc->strand = mc->strand;
    if (mc->size != 0)
        {
        subMc->start = mc->start + countNonDash(mc->text, textStart);
        subMc->size = countNonDash(mc->text+textStart, textSize);
        subMc->text = cloneStringZ(mc->text + textStart, textSize);
        if (mc->quality != NULL)
            subMc->quality = cloneStringZ(mc->quality + textStart, textSize);
        }
    else
	{
        /* empty row annotation */
        subMc->size = 0;
        subMc->start = mc->start;
	}

    subMc->leftStatus = mc->leftStatus;
    subMc->leftLen = mc->leftLen;
    subMc->rightStatus = mc->rightStatus;
    subMc->rightLen = mc->rightLen;

    slAddHead(&subset->components, subMc);
    }
slReverse(&subset->components);
return subset;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %r8b, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3f670
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movsbl 0x14(%rax), %eax
cmpl $0x2d, %eax
jne 0x3fade
movq -0x30(%rbp), %rax
movl 0x10(%rax), %edx
leaq -0x1c(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x33350
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jl 0x3faf3
movq $0x0, -0x8(%rbp)
jmp 0x3fd94
movl -0x1c(%rbp), %eax
movq -0x30(%rbp), %rcx
movl 0x18(%rcx), %ecx
movq -0x30(%rbp), %rdx
addl 0x1c(%rdx), %ecx
cmpl %ecx, %eax
jl 0x3fb15
movq $0x0, -0x8(%rbp)
jmp 0x3fd94
movl -0x20(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jg 0x3fb2e
movq $0x0, -0x8(%rbp)
jmp 0x3fd94
movl -0x1c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x3fb44
movq -0x30(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
movq -0x30(%rbp), %rcx
movl 0x18(%rcx), %ecx
movq -0x30(%rbp), %rdx
addl 0x1c(%rdx), %ecx
cmpl %ecx, %eax
jle 0x3fb6a
movq -0x30(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x30(%rbp), %rcx
addl 0x1c(%rcx), %eax
movl %eax, -0x20(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdi
movl -0x1c(%rbp), %esi
movq -0x30(%rbp), %rax
subl 0x18(%rax), %esi
movl $0x1, %edx
callq 0x336a0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movl -0x20(%rbp), %esi
subl -0x1c(%rbp), %esi
movl $0x1, %edx
callq 0x336a0
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x20(%rcx), %rcx
subq %rcx, %rax
movl %eax, -0x5c(%rbp)
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x60(%rbp)
movsbl -0x21(%rbp), %eax
cmpl $0x0, %eax
je 0x3fbf7
movl -0x1c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jne 0x3fbf7
movl $0x0, -0x5c(%rbp)
movq -0x50(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
subq %rax, %rcx
movslq -0x60(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x60(%rbp)
movl $0x28, %edi
callq 0x40c50
movq %rax, -0x38(%rbp)
movl -0x60(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x3fd7f
movl $0x40, %edi
callq 0x40c50
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x40(%rbp), %rax
movb 0x14(%rax), %cl
movq -0x48(%rbp), %rax
movb %cl, 0x14(%rax)
movq -0x40(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x3fd0d
movq -0x40(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdi
movl -0x5c(%rbp), %esi
callq 0x33710
movl -0x64(%rbp), %ecx
addl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0x5c(%rbp), %rax
addq %rax, %rdi
movl -0x60(%rbp), %esi
callq 0x33710
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0x5c(%rbp), %rax
addq %rax, %rdi
movl -0x60(%rbp), %esi
callq 0x2a3a0
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x3fd0b
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x5c(%rbp), %rax
addq %rax, %rdi
movl -0x60(%rbp), %esi
callq 0x2a3a0
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x3fd26
movq -0x48(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x40(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x40(%rbp), %rax
movb 0x30(%rax), %cl
movq -0x48(%rbp), %rax
movb %cl, 0x30(%rax)
movq -0x40(%rbp), %rax
movl 0x34(%rax), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x40(%rbp), %rax
movb 0x38(%rax), %cl
movq -0x48(%rbp), %rax
movb %cl, 0x38(%rax)
movq -0x40(%rbp), %rax
movl 0x3c(%rax), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x38(%rbp), %rdi
addq $0x10, %rdi
movq -0x48(%rbp), %rsi
callq 0x3eb80
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x3fc1b
movq -0x38(%rbp), %rdi
addq $0x10, %rdi
callq 0x2aad0
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nop