// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %rbp
xorl %eax, %eax
callq 0x25e47
movb $0x0, 0x30(%rsp)
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
movq %rbp, %rdi
callq 0x2a7a9
testl %eax, %eax
je 0x27cf4
movq %rbx, 0x18(%rsp)
movq 0x10(%rsp), %rdi
cmpb $0x3e, (%rdi)
jne 0x27d17
incq %rdi
callq 0x215d4
movq %rax, %rdi
callq 0x22b27
movq %rax, 0x10(%rsp)
testq %rax, %rax
jne 0x27cd6
movl 0x28(%rbp), %esi
movq 0x8(%rbp), %rdx
leaq 0x68edc(%rip), %rdi     # 0x90ba6
xorl %eax, %eax
callq 0x26e94
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 0x27d2c
testq %rbx, %rbx
je 0x27d00
movq $0x0, (%rbx)
xorl %ebx, %ebx
testq %r14, %r14
je 0x27e63
movl $0x0, (%r14)
jmp 0x27e63
movl 0x28(%rbp), %esi
movq 0x8(%rbp), %rdx
leaq 0x68eb1(%rip), %rdi     # 0x90bd6
xorl %eax, %eax
callq 0x26e94
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
movq %rbp, %rdi
callq 0x2a7a9
xorl %r14d, %r14d
testl %eax, %eax
je 0x27df0
leaq 0xc(%rsp), %r15
movq 0x10(%rsp), %rax
cmpb $0x3e, (%rax)
je 0x27de8
movl 0xc(%rsp), %ebx
leal (%rbx,%r14), %eax
cmpl (%r13), %eax
jb 0x27d88
movl %r14d, %edi
movl %ebx, %esi
movq %r12, %rdx
movq %r13, %rcx
callq 0x27ab5
movl 0xc(%rsp), %ebx
testl %ebx, %ebx
jle 0x27dce
callq 0x6790
xorl %ecx, %ecx
movq 0x10(%rsp), %rdx
movsbq (%rdx,%rcx), %rdx
cmpq $0x2d, %rdx
je 0x27db2
movq (%rax), %rsi
movzwl (%rsi,%rdx,2), %esi
andl $0x400, %esi            # imm = 0x400
je 0x27dc3
movq (%r12), %rsi
movslq %r14d, %rdi
incl %r14d
movb %dl, (%rsi,%rdi)
movl 0xc(%rsp), %ebx
incq %rcx
movslq %ebx, %rdx
cmpq %rdx, %rcx
jl 0x27d93
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x2a7a9
testl %eax, %eax
jne 0x27d58
jmp 0x27df0
movq %rbp, %rdi
callq 0x2a685
cmpl (%r13), %r14d
jb 0x27e06
movl %r14d, %edi
xorl %esi, %esi
movq %r12, %rdx
movq %r13, %rcx
callq 0x27ab5
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 0x27e2c
movq (%r12), %rax
movq %rax, (%rsi)
testq %rcx, %rcx
je 0x27e34
movl %r14d, (%rcx)
testq %rdx, %rdx
je 0x27e46
movq (%rdx), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6680
movl $0x1, %ebx
testl %r14d, %r14d
jne 0x27e63
leaq 0x68cee(%rip), %rdi     # 0x90b45
leaq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x26bea
movl %ebx, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq