// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/misc/wgsim.c
// Function: seq_read_fasta
int seq_read_fasta(FILE *fp, seq_t *seq, char *locus, char *comment)
{
	int c, l, max;
	char *p;
	
	c = 0;
	while (!feof(fp) && fgetc(fp) != '>');
	if (feof(fp)) return -1;
	p = locus;
	while (!feof(fp) && (c = fgetc(fp)) != ' ' && c != '\t' && c != '\n')
		if (c != '\r') *p++ = c;
	*p = '\0';
	if (comment) {
		p = comment;
		if (c != '\n') {
			while (!feof(fp) && ((c = fgetc(fp)) == ' ' || c == '\t'));
			if (c != '\n') {
				*p++ = c;
				while (!feof(fp) && (c = fgetc(fp)) != '\n')
					if (c != '\r') *p++ = c;
			}
		}
		*p = '\0';
	} else if (c != '\n') while (!feof(fp) && fgetc(fp) != '\n');
	l = 0; max = seq->m;
	while (!feof(fp) && (c = fgetc(fp)) != '>') {
		if (isalpha(c) || c == '-' || c == '.') {
			if (l + 1 >= max) {
				max += SEQ_BLOCK_SIZE;
				seq->s = (unsigned char*)realloc(seq->s, sizeof(char) * max);
			}
			seq->s[l++] = (unsigned char)c;
		}
	}
	if (c == '>') ungetc(c,fp);
	seq->s[l] = 0;
	seq->m = max; seq->l = l;
	return l;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movq %r14, %rdi
callq 0x1130
testl %eax, %eax
jne 0x27e1
movq %r14, %rdi
callq 0x10e0
cmpl $0x3e, %eax
jne 0x27c8
movq %r14, %rdi
callq 0x1130
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x29a8
movq %r14, %rdi
callq 0x1130
testl %eax, %eax
je 0x282d
movb $0x0, (%r12)
xorl %r13d, %r13d
testq %r15, %r15
jne 0x2860
jmp 0x289b
cmpl $0x20, %r13d
je 0x2846
movb %r13b, (%r12)
incq %r12
movq %r14, %rdi
callq 0x1130
testl %eax, %eax
jne 0x2846
movq %r14, %rdi
callq 0x10e0
movl %eax, %r13d
cmpl $0xd, %eax
je 0x2821
leal -0x9(%r13), %eax
cmpl $0x2, %eax
jae 0x2814
movb $0x0, (%r12)
movl $0xa, %r12d
testq %r15, %r15
je 0x2895
cmpl $0xa, %r13d
je 0x28f1
movq %r14, %rdi
callq 0x1130
movl %r13d, %r12d
testl %eax, %eax
jne 0x28cd
jmp 0x287d
movq %r14, %rdi
callq 0x1130
testl %eax, %eax
jne 0x28b9
movq %r14, %rdi
callq 0x10e0
movl %eax, %r12d
cmpl $0x9, %eax
je 0x2871
cmpl $0x20, %r12d
je 0x2871
jmp 0x28c7
cmpl $0xa, %r13d
je 0x28f5
movq %r14, %rdi
callq 0x1130
testl %eax, %eax
jne 0x28b4
movq %r14, %rdi
callq 0x10e0
cmpl $0xa, %eax
jne 0x289b
movl %r13d, %r12d
jmp 0x28f5
cmpl $0xa, %r12d
jne 0x28cd
movl $0xa, %r12d
jmp 0x28f1
cmpl $0xa, %r12d
je 0x28f1
movb %r12b, (%r15)
incq %r15
movq %r14, %rdi
callq 0x1130
testl %eax, %eax
jne 0x28f1
movq %r14, %rdi
callq 0x10e0
movl %eax, %r12d
cmpl $0xd, %eax
jne 0x28c7
jmp 0x28d3
movb $0x0, (%r15)
movl 0x4(%rbx), %r15d
movq %r14, %rdi
callq 0x1130
xorl %ebp, %ebp
testl %eax, %eax
jne 0x297e
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x10e0
cmpl $0x3e, %eax
je 0x2987
movl %eax, %r12d
callq 0x11d0
leal -0x2d(%r12), %ecx
cmpl $0x2, %ecx
jb 0x293f
movq (%rax), %rax
movslq %r12d, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
jne 0x293f
movl %r13d, %ebp
jmp 0x296f
leal 0x1(%r13), %ebp
movq 0x8(%rbx), %rax
cmpl %r15d, %ebp
jl 0x2968
movslq 0x37b5(%rip), %rcx      # 0x6108
movslq %r15d, %r15
addq %rcx, %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x1170
movq %rax, 0x8(%rbx)
movslq %r13d, %rcx
movb %r12b, (%rax,%rcx)
movq %r14, %rdi
callq 0x1130
movl %ebp, %r13d
testl %eax, %eax
je 0x290a
movl %ebp, %r13d
cmpl $0x3e, %r12d
jne 0x2997
movl $0x3e, %edi
movq %r14, %rsi
callq 0x1160
movl %r13d, %ebp
movq 0x8(%rbx), %rax
movslq %ebp, %rcx
movb $0x0, (%rax,%rcx)
movl %r15d, 0x4(%rbx)
movl %ecx, (%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq