// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/lib/axt.c
// Function: axtGetSubsetOnT
boolean axtGetSubsetOnT(struct axt *axt, struct axt *axtOut,
            int newStart, int newEnd, struct axtScoreScheme *ss,
            boolean includeEdgeGaps)
/* Return FALSE if axt is not in the new range.  Otherwise, set axtOut to
 * a subset that goes from newStart to newEnd in target coordinates. 
 * If includeEdgeGaps, don't trim target gaps before or after the range. */
{
if (axt == NULL)
    return FALSE;
if (newStart < axt->tStart)
    newStart = axt->tStart;
if (newEnd > axt->tEnd)
    newEnd = axt->tEnd;
if (includeEdgeGaps ? (newEnd < newStart) : (newEnd <= newStart)) 
    return FALSE;
if (newStart == axt->tStart && newEnd == axt->tEnd)
    {
    axt->score = axtScore(axt, ss);
    *axtOut = *axt;
    return TRUE;
    }
else
    {
    struct axt a = *axt;
    char *tSymStart = skipIgnoringDash(a.tSym, newStart - a.tStart, TRUE);
    char *tSymEnd = skipIgnoringDash(tSymStart, newEnd - newStart, FALSE);
    if (includeEdgeGaps)
    {
    while (tSymStart > a.tSym)
        if (*(--tSymStart) != '-')
        {
        tSymStart++;
        break;
        }
    while (tSymEnd < a.tSym + a.symCount)
        if (*(++tSymEnd) != '-')
        {
        tSymEnd--;
        break;
        }
    if (newEnd == newStart && tSymEnd > tSymStart)
        {
        if (*tSymStart != '-')
        tSymStart++;
        if (*(tSymEnd-1) != '-')
        tSymEnd--;
        }
    }
    int symCount = tSymEnd - tSymStart;
    char *qSymStart = a.qSym + (tSymStart - a.tSym);
    a.qStart += countNonDash(a.qSym, qSymStart - a.qSym);
    a.qEnd = a.qStart + countNonDash(qSymStart, symCount);
    a.tStart = newStart;
    a.tEnd = newEnd;
    a.symCount = symCount;
    a.qSym = qSymStart;
    a.tSym = tSymStart;
    a.score = axtScore(&a, ss);
    if ((a.qStart < a.qEnd && a.tStart < a.tEnd) ||
    (includeEdgeGaps && (a.qStart < a.qEnd || a.tStart < a.tEnd)))
    {
    *axtOut = a;
    return TRUE;
    }
    return FALSE;
    }
}

// Assembly:
xorl %eax, %eax
testq %rdi, %rdi
je 0x16fb6
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x28(%rdi), %esi
movl 0x2c(%rdi), %edi
cmpl %edx, %esi
movl %edx, %ebp
cmovgl %esi, %ebp
cmpl %ecx, %edi
movl %ecx, %r15d
cmovll %edi, %r15d
testl %r9d, %r9d
je 0x16e14
cmpl %ebp, %r15d
jge 0x16e1d
jmp 0x16fa8
cmpl %ebp, %r15d
jle 0x16fa8
cmpl %edx, %esi
setge %dl
cmpl %ecx, %edi
setle %al
andb %dl, %al
cmpb $0x1, %al
jne 0x16e49
movq %rbx, %rdi
movq %r8, %rsi
callq 0x16d6a
movl %eax, 0x34(%rbx)
pushq $0xb
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0x16f84
movq %r8, 0x18(%rsp)
pushq $0xb
popq %rcx
leaq 0x20(%rsp), %rax
movq %rax, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq 0x48(%rax), %r12
movl %ebp, %esi
subl 0x28(%rax), %esi
pushq $0x1
popq %rdx
movq %r12, %rdi
movl %r9d, 0x4(%rsp)
callq 0x20f29
movq %rax, %r13
movl %r15d, %esi
subl %ebp, %esi
movq %rax, %rdi
xorl %edx, %edx
callq 0x20f29
movq %rax, %rbx
cmpl $0x0, 0x4(%rsp)
movq %r14, 0x8(%rsp)
je 0x16ef0
movq %r13, %rax
cmpq %r12, %r13
jbe 0x16eab
leaq -0x1(%rax), %r13
cmpb $0x2d, -0x1(%rax)
je 0x16e99
movslq 0x58(%rsp), %rdx
addq %r12, %rdx
movq %rbx, %rcx
cmpq %rdx, %rbx
jae 0x16ec5
leaq 0x1(%rcx), %rbx
cmpb $0x2d, 0x1(%rcx)
je 0x16eb3
cmpl %ebp, %r15d
jne 0x16eea
cmpq %rax, %rcx
jbe 0x16eea
xorl %r13d, %r13d
cmpb $0x2d, (%rax)
setne %r13b
addq %rax, %r13
leaq -0x1(%rcx), %rbx
cmpb $0x2d, -0x1(%rcx)
cmoveq %rcx, %rbx
jmp 0x16ef0
movq %rax, %r13
movq %rcx, %rbx
subl %r13d, %ebx
leaq 0x20(%rsp), %rax
movq 0x40(%rax), %rdi
movq %r13, %rsi
subq %r12, %rsi
leaq (%rdi,%rsi), %r12
movq %r12, 0x10(%rsp)
callq 0x20f58
movl %eax, %r14d
leaq 0x20(%rsp), %rax
addl 0x10(%rax), %r14d
movl %r14d, 0x10(%rax)
movq %r12, %rdi
movl %ebx, %esi
callq 0x20f58
movl %eax, %r12d
addl %eax, %r14d
leaq 0x20(%rsp), %rdi
movl %r14d, 0x14(%rdi)
movl %ebp, 0x28(%rdi)
movl %r15d, 0x2c(%rdi)
movl %ebx, 0x38(%rdi)
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rdi)
movq %r13, 0x48(%rdi)
movq %rdi, %rbx
movq 0x18(%rsp), %rsi
callq 0x16d6a
movl %eax, 0x34(%rbx)
testl %r12d, %r12d
jle 0x16f8c
cmpl %ebp, %r15d
setg %al
cmpl $0x0, 0x4(%rsp)
setne %cl
orb %al, %cl
movq 0x8(%rsp), %rdi
je 0x16fa6
pushq $0xb
popq %rcx
leaq 0x20(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
pushq $0x1
popq %rax
jmp 0x16fa8
cmpl %ebp, %r15d
setg %al
cmpl $0x0, 0x4(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
movq 0x8(%rsp), %rdi
je 0x16f7c
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq