// File: /workspace/github_c_makefile_star2_O2/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 0x22b4b
leaq 0x93047(%rip), %rbp     # 0xb5b90
jmp 0x22b52
leaq 0x92e3e(%rip), %rbp     # 0xb5990
movq (%rbx), %r14
movq %r14, %rdi
callq 0x1d6a7
testq %rax, %rax
je 0x22be8
movq %rax, %r15
movq %rbp, 0x10(%rsp)
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x21578
movzbl (%r15), %eax
testl %eax, %eax
je 0x22c94
movl %r13d, 0x4(%rsp)
cmpl $0x3e, %eax
jne 0x22bef
pushq $0xa
popq %rsi
movq %r15, %rdi
callq 0x6270
leaq 0x1(%rax), %rbp
testq %rax, %rax
cmoveq %rax, %rbp
incq %r15
movq %r15, %rdi
callq 0x1d6a7
movq %rax, %r13
movq %rax, %rdi
callq 0x1e761
movq %rax, %r15
cmpq %rbp, %rax
setb %al
cmpq %rbp, %r13
setb %cl
testb %cl, %al
jne 0x22bda
leaq 0x5cf33(%rip), %rdi     # 0x7fb06
xorl %eax, %eax
callq 0x223fb
testq %r15, %r15
je 0x22be3
movb $0x0, (%r15)
movq %rbp, %r15
jmp 0x22bf6
xorl %ebp, %ebp
jmp 0x22c94
leaq 0x64787(%rip), %r13     # 0x8737d
movq %r13, %rdi
callq 0x1c306
movq %rax, %r13
testq %r15, %r15
je 0x22c6c
testl %r12d, %r12d
pushq $0x58
popq %rax
pushq $0x6e
popq %rcx
cmovel %eax, %ecx
xorl %r12d, %r12d
movzbl %cl, %eax
movl %eax, (%rsp)
movq %r13, 0x8(%rsp)
movzbl (%r15), %ebp
testl %ebp, %ebp
je 0x22c65
cmpl $0x3e, %ebp
je 0x22c65
movsbq %bpl, %r13
incq %r15
callq 0x6790
movq (%rax), %rax
testb $0x4, 0x1(%rax,%r13,2)
je 0x22c20
cmpl $0x0, 0x4(%rsp)
je 0x22c5c
movq 0x10(%rsp), %rax
movzbl (%rax,%r13), %ebp
testb %bpl, %bpl
cmovel (%rsp), %ebp
movb %bpl, (%r14,%r12)
incq %r12
jmp 0x22c20
movq 0x8(%rsp), %r13
jmp 0x22c72
xorl %r12d, %r12d
xorl %r15d, %r15d
movl %r12d, %eax
movb $0x0, (%r14,%rax)
pushq $0x28
popq %rdi
callq 0x28bb0
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