// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/core/sequence_buffer_fasta.c
// Function: gt_sequence_buffer_fasta_advance
static int gt_sequence_buffer_fasta_advance(GtSequenceBuffer *sb, GtError *err)
{
  int currentchar, ret = 0;
  GtUword currentoutpos = 0, currentfileadd = 0, currentfileread = 0;
  GtSequenceBufferMembers *pvt;
  GtSequenceBufferFasta *sbf;

  gt_error_check(err);

  sbf = (GtSequenceBufferFasta*) sb;
  pvt = sb->pvt;
  while (true)
  {
    if (currentoutpos >= (GtUword) OUTBUFSIZE)
    {
      if (pvt->filelengthtab != NULL)
      {
        pvt->filelengthtab[pvt->filenum].length
          += (uint64_t) currentfileread;
        pvt->filelengthtab[pvt->filenum].effectivelength
          += (uint64_t) currentfileadd;
      }
      break;
    }
    if (sbf->nextfile)
    {
      if (pvt->filelengthtab != NULL)
      {
        pvt->filelengthtab[pvt->filenum].length = 0;
        pvt->filelengthtab[pvt->filenum].effectivelength = 0;
      }
      sbf->nextfile = false;
      sbf->indesc = false;
      sbf->firstseqinfile = true;
      currentfileadd = 0;
      currentfileread = 0;
      pvt->linenum = (uint64_t) 1;
      pvt->inputstream = gt_file_xopen(gt_str_array_get(pvt->filenametab,
                                                  (GtUword) pvt->filenum),
                                       "rb");
      pvt->currentinpos = 0;
      pvt->currentfillpos = 0;
    } else
    {
      currentchar = inlinebuf_getchar(sb, pvt->inputstream);
      if (currentchar == EOF)
      {
        gt_file_delete(pvt->inputstream);
        pvt->inputstream = NULL;
        if (pvt->filelengthtab != NULL)
        {
          pvt->filelengthtab[pvt->filenum].length += currentfileread;
          pvt->filelengthtab[pvt->filenum].effectivelength += currentfileadd;
        }
        if ((GtUword) pvt->filenum == gt_str_array_size(pvt->filenametab)-1)
        {
          pvt->complete = true;
          break;
        }
        pvt->filenum++;
        sbf->nextfile = true;
      } else
      {
        currentfileread++;
        if (sbf->indesc)
        {
          if (currentchar == NEWLINESYMBOL)
          {
            pvt->linenum++;
            sbf->indesc = false;
          }
          if (pvt->descptr != NULL)
          {
            if (currentchar == NEWLINESYMBOL)
            {
              gt_desc_buffer_finish(pvt->descptr);
            } else
            {
              if (currentchar != CRSYMBOL)
                gt_desc_buffer_append_char(pvt->descptr, currentchar);
            }
          }
        } else
        {
          if (currentchar == NEWLINESYMBOL)
          {
            pvt->linenum++;
          }
          if (!isspace((int) currentchar))
          {
            if (currentchar == FASTASEPARATOR)
            {
              if (sbf->firstoverallseq)
              {
                sbf->firstoverallseq = false;
                sbf->firstseqinfile = false;
              } else
              {
                if (sbf->firstseqinfile)
                {
                  sbf->firstseqinfile = false;
                } else
                {
                  currentfileadd++;
                }
                pvt->outbuf[currentoutpos++] = (unsigned char) GT_SEPARATOR;
                pvt->lastspeciallength++;
              }
              sbf->indesc = true;
            } else
            {
              if ((ret = process_char(sb, currentoutpos,
                                      (unsigned char) currentchar, err)))
                return ret;
              currentoutpos++;
              currentfileadd++;
            }
          }
        }
      }
    }
  }
  if (sbf->firstoverallseq)
  {
    gt_error_set(err,"no sequences in multiple fasta file(s) %s ...",
              gt_str_array_get(pvt->filenametab,0));
    return -2;
  }
  pvt->nextfree = currentoutpos;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x80ff4
movq %rbx, %rdi
callq 0x34fea
testb %al, %al
jne 0x81302
movq %rbx, 0x8(%rsp)
movq 0x8(%r14), %r13
leaq 0x40(%r13), %rax
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
xorps %xmm0, %xmm0
movq $0x0, (%rsp)
xorl %ebp, %ebp
cmpb $0x1, 0x1b(%r14)
jne 0x81080
movq 0x10(%r13), %rax
movl (%r13), %esi
testq %rax, %rax
je 0x81035
movq %rsi, %rcx
shlq $0x4, %rcx
movups %xmm0, (%rax,%rcx)
movb $0x0, 0x1b(%r14)
movw $0x100, 0x18(%r14)      # imm = 0x100
movq $0x1, 0x8(%r13)
movq 0x70(%r13), %rdi
callq 0x3ca6f
movq %rax, %rdi
leaq 0x6cb9a(%rip), %rsi     # 0xedbf6
callq 0x75bec
xorps %xmm0, %xmm0
movq %rax, 0x28(%r13)
movq 0x10(%rsp), %rax
movups %xmm0, (%rax)
movq $0x0, (%rsp)
xorl %r15d, %r15d
jmp 0x81236
movq 0x8(%r14), %r12
cmpb $0x1, 0x19(%r12)
jne 0x81099
movb $0x0, 0x19(%r12)
movb 0x78(%r12), %bl
jmp 0x810df
movq 0x48(%r12), %rax
cmpq 0x40(%r12), %rax
jb 0x810cc
movq 0x28(%r13), %rdi
leaq 0x79(%r12), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x75fcd
cltq
movq %rax, 0x40(%r12)
testl %eax, %eax
je 0x811e3
xorl %eax, %eax
xorps %xmm0, %xmm0
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%r12)
movb 0x79(%r12,%rax), %bl
movb %bl, 0x78(%r12)
incq %r15
cmpb $0x1, 0x18(%r14)
jne 0x8110e
cmpb $0xa, %bl
jne 0x8114e
incq 0x8(%r13)
movb $0x0, 0x18(%r14)
movq 0x20(%r13), %rdi
testq %rdi, %rdi
je 0x81236
callq 0xa3cd2
jmp 0x81233
cmpb $0xa, %bl
jne 0x81117
incq 0x8(%r13)
callq 0xb6e0
movq (%rax), %rax
movzbl %bl, %r12d
testb $0x20, 0x1(%rax,%r12,2)
jne 0x81233
cmpb $0x3e, %bl
xorps %xmm0, %xmm0
jne 0x81171
cmpb $0x1, 0x1a(%r14)
jne 0x81245
movw $0x0, 0x19(%r14)
jmp 0x81267
movq 0x20(%r13), %rdi
testq %rdi, %rdi
je 0x81236
cmpb $0xd, %bl
je 0x81236
movsbl %bl, %esi
callq 0xa3c20
jmp 0x81233
movq %rbp, %rsi
movq 0x8(%r14), %rbp
movq 0x6080(%rbp), %rcx
movl %ebx, %eax
testq %rcx, %rcx
je 0x811c5
movzbl (%rcx,%r12), %eax
cmpq $0xfd, %rax
je 0x812d7
leaq 0x60(%rbp), %rcx
movq 0x60(%rbp), %rdx
cmpb $-0x3, %al
ja 0x811bf
testq %rdx, %rdx
je 0x811af
movq $0x0, (%rcx)
movq 0x38(%rbp), %rcx
testq %rcx, %rcx
je 0x811c5
leaq (%rcx,%rax,8), %rcx
movq (%rcx), %rdx
incq %rdx
movq %rdx, (%rcx)
movb %al, 0x2079(%rbp,%rsi)
movb %bl, 0x4079(%rbp,%rsi)
incq 0x68(%rbp)
movq %rsi, %rbp
incq %rbp
incq (%rsp)
jmp 0x81236
movq 0x28(%r13), %rdi
callq 0x760c0
movq $0x0, 0x28(%r13)
movq 0x10(%r13), %rax
movl (%r13), %ebx
testq %rax, %rax
je 0x81215
movq %rbx, %rcx
shlq $0x4, %rcx
addq %r15, (%rax,%rcx)
movq (%rsp), %rdx
addq %rdx, 0x8(%rax,%rcx)
movq 0x70(%r13), %rdi
callq 0x3cbed
decq %rax
cmpq %rbx, %rax
je 0x812d0
incl (%r13)
movb $0x1, 0x1b(%r14)
xorps %xmm0, %xmm0
cmpq $0x1fff, %rbp           # imm = 0x1FFF
jbe 0x81016
jmp 0x8126e
cmpb $0x1, 0x19(%r14)
jne 0x81253
movb $0x0, 0x19(%r14)
jmp 0x81257
incq (%rsp)
movb $-0x1, 0x2079(%r13,%rbp)
incq %rbp
incq 0x60(%r13)
movb $0x1, 0x18(%r14)
jmp 0x81236
movq 0x10(%r13), %rax
testq %rax, %rax
je 0x8128c
movl (%r13), %ecx
shlq $0x4, %rcx
addq %r15, (%rax,%rcx)
movq (%rsp), %rdx
addq %rdx, 0x8(%rax,%rcx)
cmpb $0x1, 0x1a(%r14)
jne 0x812bb
movq 0x70(%r13), %rdi
xorl %esi, %esi
callq 0x3ca6f
leaq 0x7215f(%rip), %rsi     # 0xf3404
movq 0x8(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x34f1f
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x812c1
movq %rbp, 0x58(%r13)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, 0x18(%r13)
jmp 0x8128c
movq 0x70(%rbp), %rdi
movl (%rbp), %esi
callq 0x3ca6f
movq 0x8(%rbp), %r8
leaq 0x72015(%rip), %rsi     # 0xf3303
movq 0x8(%rsp), %rdi
movl %r12d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x34f1f
jmp 0x812b4
callq 0x1dfe5