// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/lib/fa.c
// Function: faMixedSpeedReadNext
boolean faMixedSpeedReadNext(struct lineFile *lf, DNA **retDna, int *retSize, char **retName,
                             DNA **faFastBuf, unsigned *faFastBufSize)
/* Read in DNA or Peptide FA record in mixed case.   Allow any upper or lower case
 * letter, or the dash character in. */
{
    char c;
    int bufIx = 0;
    char name[512];
    int lineSize, i;
    char *line;

    dnaUtilOpen();

    /* Read first line, make sure it starts with '>', and read first word
     * as name of sequence. */
    name[0] = 0;
    if (!lineFileNext(lf, &line, &lineSize))
    {
        if (retDna!=NULL) *retDna = NULL;
        if (retSize!=NULL) *retSize = 0;
        return FALSE;
    }
    if (line[0] == '>')
    {
        line = firstWordInLine(skipLeadingSpaces(line+1));
        if (line == NULL)
            errAbort("Expecting sequence name after '>' line %d of %s", lf->lineIx, lf->fileName);
        strncpy(name, line, sizeof(name));
        name[sizeof(name)-1] = '\0'; /* Just to make sure name is NULL terminated. */
    }
    else
    {
        errAbort("Expecting '>' line %d of %s", lf->lineIx, lf->fileName);
    }
    /* Read until next '>' */
    for (;;)
    {
        if (!lineFileNext(lf, &line, &lineSize))
            break;
        if (line[0] == '>')
        {
            lineFileReuse(lf);
            break;
        }
        if (bufIx + lineSize >= *faFastBufSize)
            expandFaFastBuf(bufIx, lineSize, faFastBuf, faFastBufSize);
        for (i=0; i<lineSize; ++i)
        {
            c = line[i];
            if (isalpha(c) || c == '-')
                (*faFastBuf)[bufIx++] = c;
        }
    }
    if (bufIx >= *faFastBufSize)
        expandFaFastBuf(bufIx, 0, faFastBuf, faFastBufSize);
    (*faFastBuf)[bufIx] = 0;
    if (retDna!=NULL) *retDna = *faFastBuf;
    if (retSize!=NULL) *retSize = bufIx;
    if (retName!=NULL) strcpy(*retName, name);
    if (bufIx == 0)
    {
        warn("Invalid fasta format: sequence size == 0 for element %s",name);
    }

    return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %r9, %r13
movq %r8, %r12
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbp
xorl %eax, %eax
callq 0x25b5c
movb $0x0, 0x30(%rsp)
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
movq %rbp, %rdi
callq 0x2a455
testl %eax, %eax
je 0x279ad
movq 0x10(%rsp), %rdi
cmpb $0x3e, (%rdi)
movq %rbx, 0x20(%rsp)
jne 0x279d0
incq %rdi
callq 0x21238
movq %rax, %rdi
callq 0x227e5
movq %rax, 0x10(%rsp)
testq %rax, %rax
jne 0x2798d
movl 0x28(%rbp), %esi
movq 0x8(%rbp), %rdx
leaq 0x69130(%rip), %rdi     # 0x90ab6
xorl %eax, %eax
callq 0x26b6f
movq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rbx
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
callq 0x6380
movb $0x0, 0x1ff(%rbx)
jmp 0x279e5
testq %r15, %r15
je 0x279b9
movq $0x0, (%r15)
xorl %ebx, %ebx
testq %r14, %r14
je 0x27b12
movl $0x0, (%r14)
jmp 0x27b12
movl 0x28(%rbp), %esi
movq 0x8(%rbp), %rdx
leaq 0x69108(%rip), %rdi     # 0x90ae6
xorl %eax, %eax
callq 0x26b6f
movq %r15, 0x18(%rsp)
movq %r14, 0x28(%rsp)
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
movq %rbp, %rdi
callq 0x2a455
xorl %r14d, %r14d
testl %eax, %eax
je 0x27a9f
leaq 0x10(%rsp), %rbx
leaq 0xc(%rsp), %r15
movq 0x10(%rsp), %rax
cmpb $0x3e, (%rax)
je 0x27a97
movl 0xc(%rsp), %esi
leal (%rsi,%r14), %eax
cmpl (%r13), %eax
jb 0x27a3c
movl %r14d, %edi
movq %r12, %rdx
movq %r13, %rcx
callq 0x27771
cmpl $0x0, 0xc(%rsp)
jle 0x27a83
callq 0x6790
xorl %ecx, %ecx
movq 0x10(%rsp), %rdx
movsbq (%rdx,%rcx), %rdx
cmpq $0x2d, %rdx
je 0x27a69
movq (%rax), %rsi
movzwl (%rsi,%rdx,2), %esi
andl $0x400, %esi            # imm = 0x400
je 0x27a76
movq (%r12), %rsi
movslq %r14d, %rdi
incl %r14d
movb %dl, (%rsi,%rdi)
incq %rcx
movslq 0xc(%rsp), %rdx
cmpq %rdx, %rcx
jl 0x27a4a
movq %rbp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2a455
testl %eax, %eax
jne 0x27a16
jmp 0x27a9f
movq %rbp, %rdi
callq 0x2a331
cmpl (%r13), %r14d
jb 0x27ab5
movl %r14d, %edi
xorl %esi, %esi
movq %r12, %rdx
movq %r13, %rcx
callq 0x27771
movq (%r12), %rax
movslq %r14d, %rcx
movb $0x0, (%rax,%rcx)
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rdx
je 0x27adb
movq (%r12), %rax
movq %rax, (%rsi)
testq %rcx, %rcx
je 0x27ae3
movl %r14d, (%rcx)
testq %rdx, %rdx
je 0x27af5
movq (%rdx), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6680
movl $0x1, %ebx
testl %r14d, %r14d
jne 0x27b12
leaq 0x68f4f(%rip), %rdi     # 0x90a55
leaq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x268ca
movl %ebx, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq