// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/lib/fa.c
// Function: nextSeqFromMem
static bioSeq *nextSeqFromMem(char **pText, boolean isDna, boolean doFilter)
/* Convert fa in memory to bioSeq.  Update *pText to point to next
 * record.  Returns NULL when no more sequences left. */
{
char *name = "";
char *s, *d;
struct dnaSeq *seq;
int size = 0;
char c;
char *filter = (isDna ? ntChars : aaChars);
char *text = *pText;
char *p = skipLeadingSpaces(text);
if (p == NULL)
    return NULL;
dnaUtilOpen();
if (*p == '>')
    {
    char *end;
    s = strchr(p, '\n');
    if (s != NULL) ++s;
    name = skipLeadingSpaces(p+1);
    end = skipToSpaces(name);
    if (end >= s || name >= s)
        errAbort("No name in line starting with '>'");
    if (end != NULL)
        *end = 0;
    }
else
    {
    s = p; 
    if (s == NULL || s[0] == 0)
        return NULL;
    }
name = cloneString(name);
    
d = text;
if (s != NULL)
    {
    for (;;)
	{
	c = *s;
	if (c == 0 || c == '>')
	    break;
	++s;
	if (!isalpha(c))
	    continue;
	if (doFilter)
	    {
	    if ((c = filter[(int)c]) == 0) 
		{
		if (isDna)
		    c = 'n';
		else
		    c = 'X';
		}
	    }
	d[size++] = c;
	}
    }
d[size] = 0;

/* Put sequence into our little sequence structure. */
AllocVar(seq);
seq->name = name;
seq->dna = text;
seq->size = size;
*pText = s;
return seq;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r13d
movl %esi, %r12d
movq %rdi, %rbx
testl %esi, %esi
jne 0x275e4
leaq 0x9a58e(%rip), %rbp     # 0xc1b70
jmp 0x275eb
leaq 0x9a385(%rip), %rbp     # 0xc1970
movq (%rbx), %r14
movq %r14, %rdi
callq 0x215d4
testq %rax, %rax
je 0x2769c
movq %rax, %r15
movq %rbp, 0x8(%rsp)
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x25e47
movzbl (%r15), %eax
testl %eax, %eax
je 0x2773c
movl %r13d, 0x4(%rsp)
movq %rbx, 0x10(%rsp)
cmpl $0x3e, %eax
jne 0x276a3
movq %r15, %rdi
movl $0xa, %esi
callq 0x6270
movq %rax, %rbp
leaq 0x1(%rax), %rbx
testq %rax, %rax
cmoveq %rax, %rbx
incq %r15
movq %r15, %rdi
callq 0x215d4
movq %rax, %r15
movq %rax, %rdi
callq 0x22924
movq %rax, %r13
cmpq %rbx, %rax
setb %al
cmpq %rbx, %r15
setb %cl
testb %cl, %al
jne 0x2767d
leaq 0x69590(%rip), %rdi     # 0x90c06
xorl %eax, %eax
callq 0x26e94
testq %r13, %r13
je 0x27687
movb $0x0, (%r13)
movq %r15, %rdi
callq 0x1feba
movq %rax, %r13
testq %rbp, %rbp
je 0x2770d
movq %rbx, %r15
jmp 0x276b2
xorl %ebp, %ebp
jmp 0x2773c
leaq 0x70daa(%rip), %rdi     # 0x98454
callq 0x1feba
movq %rax, %r13
testl %r12d, %r12d
movl $0x58, %eax
movl $0x6e, %ecx
cmovel %eax, %ecx
xorl %r12d, %r12d
movzbl %cl, %eax
movl %eax, (%rsp)
movzbl (%r15), %ebx
testl %ebx, %ebx
je 0x27713
cmpl $0x3e, %ebx
je 0x27713
movsbq %bl, %rbp
incq %r15
callq 0x6790
movq (%rax), %rax
testb $0x4, 0x1(%rax,%rbp,2)
je 0x276cb
cmpl $0x0, 0x4(%rsp)
je 0x27704
movq 0x8(%rsp), %rax
movzbl (%rax,%rbp), %ebx
testb %bl, %bl
cmovel (%rsp), %ebx
movb %bl, (%r14,%r12)
incq %r12
jmp 0x276cb
xorl %r12d, %r12d
xorl %r15d, %r15d
movl %r12d, %eax
movb $0x0, (%r14,%rax)
movl $0x28, %edi
callq 0x2dff4
movq %rax, %rbp
movq %r13, 0x8(%rax)
movq %r14, 0x10(%rax)
movl %r12d, 0x18(%rax)
movq 0x10(%rsp), %rax
movq %r15, (%rax)
movq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq