// File: /workspace/github_c_makefile_star2_O1/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 0x272bc
leaq 0x9a8b6(%rip), %rbp     # 0xc1b70
jmp 0x272c3
leaq 0x9a6ad(%rip), %rbp     # 0xc1970
movq (%rbx), %r14
movq %r14, %rdi
callq 0x21238
testq %rax, %rax
je 0x2735b
movq %rax, %r15
movq %rbp, 0x10(%rsp)
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x25b5c
movzbl (%r15), %eax
testl %eax, %eax
je 0x2740d
movl %r13d, 0x4(%rsp)
cmpl $0x3e, %eax
jne 0x27362
movq %r15, %rdi
movl $0xa, %esi
callq 0x6270
leaq 0x1(%rax), %rbp
testq %rax, %rax
cmoveq %rax, %rbp
incq %r15
movq %r15, %rdi
callq 0x21238
movq %rax, %r13
movq %rax, %rdi
callq 0x225e2
movq %rax, %r15
cmpq %rbp, %rax
setb %al
cmpq %rbp, %r13
setb %cl
testb %cl, %al
jne 0x2734d
leaq 0x697d0(%rip), %rdi     # 0x90b16
xorl %eax, %eax
callq 0x26b6f
testq %r15, %r15
je 0x27356
movb $0x0, (%r15)
movq %rbp, %r15
jmp 0x27369
xorl %ebp, %ebp
jmp 0x2740d
leaq 0x70ff7(%rip), %r13     # 0x98360
movq %r13, %rdi
callq 0x1f9f6
movq %rax, %r13
testq %r15, %r15
je 0x273e3
testl %r12d, %r12d
movl $0x58, %eax
movl $0x6e, %ecx
cmovel %eax, %ecx
xorl %r12d, %r12d
movzbl %cl, %eax
movl %eax, (%rsp)
movq %r13, 0x8(%rsp)
movzbl (%r15), %ebp
testl %ebp, %ebp
je 0x273dc
cmpl $0x3e, %ebp
je 0x273dc
movsbq %bpl, %r13
incq %r15
callq 0x6790
movq (%rax), %rax
testb $0x4, 0x1(%rax,%r13,2)
je 0x27397
cmpl $0x0, 0x4(%rsp)
je 0x273d3
movq 0x10(%rsp), %rax
movzbl (%rax,%r13), %ebp
testb %bpl, %bpl
cmovel (%rsp), %ebp
movb %bpl, (%r14,%r12)
incq %r12
jmp 0x27397
movq 0x8(%rsp), %r13
jmp 0x273e9
xorl %r12d, %r12d
xorl %r15d, %r15d
movl %r12d, %eax
movb $0x0, (%r14,%rax)
movl $0x28, %edi
callq 0x2dc95
movq %rax, %rbp
movq %r13, 0x8(%rax)
movq %r14, 0x10(%rax)
movl %r12d, 0x18(%rax)
movq %r15, (%rbx)
movq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq