// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/fa.c
// Function: faReadMixedNext
boolean faReadMixedNext(FILE *f, boolean preserveCase, char *defaultName, 
    boolean mustStartWithComment, char **retCommentLine, struct dnaSeq **retSeq)
/* Read next sequence from .fa file. Return sequence in retSeq.  
 * If retCommentLine is non-null return the '>' line in retCommentLine.
 * The whole thing returns FALSE at end of file. 
 * Contains parameter to preserve mixed case. */
{
char lineBuf[1024];
int lineSize;
char *words[1];
int c;
off_t offset = ftello(f);
size_t dnaSize = 0;
DNA *dna, *sequence;
char *name = defaultName;

if (name == NULL)
    name = "";
dnaUtilOpen();
if (retCommentLine != NULL)
    *retCommentLine = NULL;
*retSeq = NULL;

/* Skip first lines until it starts with '>' */
for (;;)
    {
    if(fgets(lineBuf, sizeof(lineBuf), f) == NULL)
        {
        if (ferror(f))
            errnoAbort("read of fasta file failed");
        return FALSE;
        }
    lineSize = strlen(lineBuf);
    if (lineBuf[0] == '>')
        {
	if (retCommentLine != NULL)
            *retCommentLine = cloneString(lineBuf);
        offset = ftello(f);
        chopByWhite(lineBuf, words, ArraySize(words));
        name = words[0]+1;
        break;
        }
    else if (!mustStartWithComment)
        {
        if (fseeko(f, offset, SEEK_SET) < 0)
            errnoAbort("fseek on fasta file failed");
        break;
        }
    else
        offset += lineSize;
    }
/* Count up DNA. */
for (;;)
    {
    c = fgetc(f);
    if (c == EOF || c == '>')
        break;
    if (isalpha(c))
        {
        ++dnaSize;
        }
    }

if (dnaSize == 0)
    {
    warn("Invalid fasta format: sequence size == 0 for element %s",name);
    }

/* Allocate DNA and fill it up from file. */
dna = sequence = needHugeMem(dnaSize+1);
if (fseeko(f, offset, SEEK_SET) < 0)
    errnoAbort("fseek on fasta file failed");
for (;;)
    {
    c = fgetc(f);
    if (c == EOF || c == '>')
        break;
    if (isalpha(c))
        {
        /* check for non-DNA char */
        if (ntChars[c] == 0)
            {
            *dna++ = preserveCase ? 'N' : 'n';
            }
        else
            {
            *dna++ = preserveCase ? c : ntChars[c];
            }
        }
    }
if (c == '>')
    ungetc(c, f);
*dna = 0;

*retSeq = newDnaSeq(sequence, dnaSize, name);
if (ferror(f))
    errnoAbort("read of fasta file failed");    
return TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6b80
movq %rax, -0x460(%rbp)
movq $0x0, -0x468(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x480(%rbp)
cmpq $0x0, -0x480(%rbp)
jne 0x3654f
leaq 0xaeebe(%rip), %rax     # 0xe5406
movq %rax, -0x480(%rbp)
movb $0x0, %al
callq 0x34580
cmpq $0x0, -0x30(%rbp)
je 0x36568
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
leaq -0x440(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x400, %esi            # imm = 0x400
callq 0x6c00
cmpq $0x0, %rax
jne 0x365b6
movq -0x10(%rbp), %rdi
callq 0x6e10
cmpl $0x0, %eax
je 0x365aa
leaq 0xa4327(%rip), %rdi     # 0xda8ca
movb $0x0, %al
callq 0x35ee0
movl $0x0, -0x4(%rbp)
jmp 0x36879
leaq -0x440(%rbp), %rdi
callq 0x62c0
movl %eax, -0x444(%rbp)
movsbl -0x440(%rbp), %eax
cmpl $0x3e, %eax
jne 0x3662d
cmpq $0x0, -0x30(%rbp)
je 0x365f1
leaq -0x440(%rbp), %rdi
callq 0x2a450
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x6b80
movq %rax, -0x460(%rbp)
leaq -0x440(%rbp), %rdi
leaq -0x450(%rbp), %rsi
movl $0x1, %edx
callq 0x2e900
movq -0x450(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x480(%rbp)
jmp 0x36676
cmpl $0x0, -0x24(%rbp)
jne 0x3665a
movq -0x10(%rbp), %rdi
movq -0x460(%rbp), %rsi
xorl %edx, %edx
callq 0x6c90
cmpl $0x0, %eax
jge 0x36658
leaq 0xa4293(%rip), %rdi     # 0xda8e4
movb $0x0, %al
callq 0x35ee0
jmp 0x36676
movslq -0x444(%rbp), %rax
addq -0x460(%rbp), %rax
movq %rax, -0x460(%rbp)
jmp 0x36671
jmp 0x36573
jmp 0x36678
movq -0x10(%rbp), %rdi
callq 0x6bf0
movl %eax, -0x454(%rbp)
cmpl $-0x1, -0x454(%rbp)
je 0x36699
cmpl $0x3e, -0x454(%rbp)
jne 0x3669b
jmp 0x366cc
callq 0x6780
movq (%rax), %rax
movslq -0x454(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x366ca
movq -0x468(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x468(%rbp)
jmp 0x36678
cmpq $0x0, -0x468(%rbp)
jne 0x366eb
movq -0x480(%rbp), %rsi
leaq 0xa421b(%rip), %rdi     # 0xda8ff
movb $0x0, %al
callq 0x358e0
movq -0x468(%rbp), %rdi
addq $0x1, %rdi
callq 0x40af0
movq %rax, -0x478(%rbp)
movq %rax, -0x470(%rbp)
movq -0x10(%rbp), %rdi
movq -0x460(%rbp), %rsi
xorl %edx, %edx
callq 0x6c90
cmpl $0x0, %eax
jge 0x3672e
leaq 0xa41bd(%rip), %rdi     # 0xda8e4
movb $0x0, %al
callq 0x35ee0
jmp 0x36730
movq -0x10(%rbp), %rdi
callq 0x6bf0
movl %eax, -0x454(%rbp)
cmpl $-0x1, -0x454(%rbp)
je 0x36751
cmpl $0x3e, -0x454(%rbp)
jne 0x36756
jmp 0x3680e
callq 0x6780
movq (%rax), %rax
movslq -0x454(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x36809
movslq -0x454(%rbp), %rcx
leaq 0xd162b(%rip), %rax     # 0x107db0
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x367bc
movl -0x14(%rbp), %edx
movl $0x6e, %eax
movl $0x4e, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, %cl
movq -0x470(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x470(%rbp)
movb %cl, (%rax)
jmp 0x36807
cmpl $0x0, -0x14(%rbp)
je 0x367d0
movl -0x454(%rbp), %eax
movl %eax, -0x484(%rbp)
jmp 0x367e8
movslq -0x454(%rbp), %rcx
leaq 0xd15d2(%rip), %rax     # 0x107db0
movsbl (%rax,%rcx), %eax
movl %eax, -0x484(%rbp)
movl -0x484(%rbp), %eax
movb %al, %cl
movq -0x470(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x470(%rbp)
movb %cl, (%rax)
jmp 0x36809
jmp 0x36730
cmpl $0x3e, -0x454(%rbp)
jne 0x36826
movl -0x454(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x6150
movq -0x470(%rbp), %rax
movb $0x0, (%rax)
movq -0x478(%rbp), %rdi
movq -0x468(%rbp), %rax
movl %eax, %esi
movq -0x480(%rbp), %rdx
callq 0x326c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x6e10
cmpl $0x0, %eax
je 0x36872
leaq 0xa405f(%rip), %rdi     # 0xda8ca
movb $0x0, %al
callq 0x35ee0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
nopw %cs:(%rax,%rax)