// File: /workspace/github_c_makefile_star2_O2/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, 0x28(%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, %rbx
movq %rdi, %rbp
xorl %eax, %eax
callq 0x21578
movb $0x0, 0x30(%rsp)
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
movq %rbp, %rdi
callq 0x256a7
testl %eax, %eax
je 0x231c9
movq %rbx, 0x20(%rsp)
movq 0x10(%rsp), %rdi
cmpb $0x3e, (%rdi)
jne 0x231ea
incq %rdi
callq 0x1d6a7
movq %rax, %rdi
callq 0x1e8ec
movq %rax, 0x10(%rsp)
testq %rax, %rax
jne 0x231ab
movl 0x28(%rbp), %esi
movq 0x8(%rbp), %rdx
leaq 0x5c907(%rip), %rdi     # 0x7faa6
xorl %eax, %eax
callq 0x223fb
movq 0x10(%rsp), %rax
leaq 0x30(%rsp), %rbx
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6380
movb $0x0, 0x1ff(%rbx)
jmp 0x231ff
testq %rbx, %rbx
je 0x231d2
andq $0x0, (%rbx)
xorl %ebx, %ebx
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x232fa
andl $0x0, (%rax)
jmp 0x232fa
movl 0x28(%rbp), %esi
movq 0x8(%rbp), %rdx
leaq 0x5c8de(%rip), %rdi     # 0x7fad6
xorl %eax, %eax
callq 0x223fb
xorl %r14d, %r14d
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x256a7
testl %eax, %eax
je 0x23289
movq 0x10(%rsp), %rax
cmpb $0x3e, (%rax)
je 0x23281
movl 0xc(%rsp), %esi
leal (%rsi,%r14), %eax
cmpl (%r13), %eax
jb 0x2323e
movl %r14d, %edi
movq %r12, %rdx
movq %r13, %rcx
callq 0x22f8d
xorl %ebx, %ebx
movslq 0xc(%rsp), %rax
cmpq %rax, %rbx
jge 0x23202
movq 0x10(%rsp), %rax
movsbq (%rax,%rbx), %r15
callq 0x6790
cmpq $0x2d, %r15
je 0x2326e
movq (%rax), %rax
movzwl (%rax,%r15,2), %eax
andl $0x400, %eax            # imm = 0x400
je 0x2327c
movq (%r12), %rax
movslq %r14d, %rcx
incl %r14d
movb %r15b, (%rax,%rcx)
incq %rbx
jmp 0x23240
movq %rbp, %rdi
callq 0x25590
cmpl (%r13), %r14d
jb 0x2329f
movl %r14d, %edi
xorl %esi, %esi
movq %r12, %rdx
movq %r13, %rcx
callq 0x22f8d
movq (%r12), %rax
movslq %r14d, %rcx
movb $0x0, (%rax,%rcx)
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x232bb
movq (%r12), %rax
movq %rax, (%rcx)
movq 0x18(%rsp), %rax
testq %rax, %rax
movq 0x28(%rsp), %rcx
je 0x232cd
movl %r14d, (%rax)
testq %rcx, %rcx
je 0x232df
movq (%rcx), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6680
pushq $0x1
popq %rbx
testl %r14d, %r14d
jne 0x232fa
leaq 0x5c757(%rip), %rdi     # 0x7fa45
leaq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x22186
movl %ebx, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq