// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x81088
movq %rbx, %rdi
callq 0x3566a
testb %al, %al
jne 0x813ca
movq %rbx, 0x18(%rsp)
movq 0x8(%r14), %r13
leaq 0x40(%r13), %rax
movq %rax, 0x20(%rsp)
xorl %ebp, %ebp
xorps %xmm0, %xmm0
movq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
cmpb $0x1, 0x1b(%r14)
jne 0x81116
movq 0x10(%r13), %rax
testq %rax, %rax
je 0x810c7
movl (%r13), %ecx
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
movl (%r13), %esi
callq 0x3d3e2
movq %rax, %rdi
leaq 0x6cb4c(%rip), %rsi     # 0xedc3e
callq 0x756a8
xorps %xmm0, %xmm0
movq %rax, 0x28(%r13)
movq 0x20(%rsp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x8(%rsp)
xorl %ebp, %ebp
jmp 0x81257
movq 0x8(%r14), %r15
cmpb $0x1, 0x19(%r15)
jne 0x8112d
movb $0x0, 0x19(%r15)
movzbl 0x78(%r15), %ebx
jmp 0x81178
movq 0x48(%r15), %rax
cmpq 0x40(%r15), %rax
jb 0x81162
movq 0x28(%r13), %rdi
leaq 0x79(%r15), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x75a89
cltq
movq %rax, 0x40(%r15)
testl %eax, %eax
je 0x81269
movq $0x0, 0x48(%r15)
xorps %xmm0, %xmm0
movq 0x48(%r15), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%r15)
movzbl 0x79(%r15,%rax), %ebx
movb %bl, 0x78(%r15)
cmpl $-0x1, %ebx
je 0x811b9
incq %rbp
cmpb $0x1, 0x18(%r14)
jne 0x8120d
cmpl $0xa, %ebx
jne 0x81199
incq 0x8(%r13)
movb $0x0, 0x18(%r14)
movq 0x20(%r13), %rdi
testq %rdi, %rdi
je 0x81257
cmpl $0xa, %ebx
jne 0x81247
callq 0xa44e6
jmp 0x81254
movq 0x28(%r13), %rdi
callq 0x75b7c
movq $0x0, 0x28(%r13)
movq 0x10(%r13), %rax
testq %rax, %rax
je 0x811e9
movl (%r13), %ecx
shlq $0x4, %rcx
addq %rbp, (%rax,%rcx)
movq 0x8(%rsp), %rdx
addq %rdx, 0x8(%rax,%rcx)
movl (%r13), %ebx
movq 0x70(%r13), %rdi
callq 0x3d560
decq %rax
cmpq %rbx, %rax
je 0x81381
incl (%r13)
movb $0x1, 0x1b(%r14)
jmp 0x81254
cmpl $0xa, %ebx
jne 0x81216
incq 0x8(%r13)
callq 0xb6e0
movq (%rax), %rax
movslq %ebx, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x81254
cmpl $0x3e, %ebx
xorps %xmm0, %xmm0
jne 0x81276
cmpb $0x1, 0x1a(%r14)
jne 0x812d8
movw $0x0, 0x19(%r14)
jmp 0x81356
cmpl $0xd, %ebx
je 0x81257
movsbl %bl, %esi
callq 0xa4434
xorps %xmm0, %xmm0
cmpq $0x1fff, %r12           # imm = 0x1FFF
jbe 0x810ab
jmp 0x81360
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
jmp 0x81178
movq 0x8(%r14), %r15
movq 0x6080(%r15), %rcx
movl %ebx, %eax
testq %rcx, %rcx
je 0x81314
movzbl %bl, %eax
movzbl (%rcx,%rax), %eax
cmpq $0xfd, %rax
jne 0x812e6
movzbl %bl, %eax
movl %eax, 0x14(%rsp)
movq 0x70(%r15), %rdi
movl (%r15), %esi
callq 0x3d3e2
movq 0x8(%r15), %r8
xorl %ebx, %ebx
movq 0x18(%rsp), %rdi
leaq 0x720a4(%rip), %rsi     # 0xf3364
movl 0x14(%rsp), %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3559f
xorps %xmm0, %xmm0
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x8132c
cmpb $0x1, 0x19(%r14)
jne 0x81341
movb $0x0, 0x19(%r14)
jmp 0x81346
leaq 0x60(%r15), %rcx
movq 0x60(%r15), %rdx
cmpb $-0x3, %al
ja 0x8130e
testq %rdx, %rdx
je 0x812fe
movq $0x0, (%rcx)
movq 0x38(%r15), %rcx
testq %rcx, %rcx
je 0x81314
leaq (%rcx,%rax,8), %rcx
movq (%rcx), %rdx
incq %rdx
movq %rdx, (%rcx)
movb %al, 0x2079(%r15,%r12)
movb %bl, 0x4079(%r15,%r12)
incq 0x68(%r15)
xorl %eax, %eax
movb $0x1, %bl
testb %bl, %bl
je 0x813bb
incq %r12
incq 0x8(%rsp)
jmp 0x81257
incq 0x8(%rsp)
movb $-0x1, 0x2079(%r13,%r12)
incq %r12
incq 0x60(%r13)
movb $0x1, 0x18(%r14)
jmp 0x81257
movq 0x10(%r13), %rax
testq %rax, %rax
je 0x81386
movl (%r13), %ecx
shlq $0x4, %rcx
addq %rbp, (%rax,%rcx)
movq 0x8(%rsp), %rdx
addq %rdx, 0x8(%rax,%rcx)
jmp 0x81386
movb $0x1, 0x18(%r13)
cmpb $0x1, 0x1a(%r14)
jne 0x813b5
movq 0x70(%r13), %rdi
xorl %esi, %esi
callq 0x3d3e2
leaq 0x720c6(%rip), %rsi     # 0xf3465
movq 0x18(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3559f
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x813bb
movq %r12, 0x58(%r13)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1e04b