// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movl $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x9f171
movq 0x40(%rsp), %rdi
callq 0xc270
testb $0x1, %al
jne 0x9f139
jmp 0x9f171
movq 0x114e98(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xbef1c(%rip), %rsi     # 0x15e066
leaq 0xbf4f7(%rip), %rdx     # 0x15e648
leaq 0xd247e(%rip), %rcx     # 0x1715d6
leaq 0xd2498(%rip), %r8      # 0x1715f7
movl $0x30, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x9f173
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x2000, 0x30(%rsp)     # imm = 0x2000
jb 0x9f1ed
movq 0x18(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9f1e8
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
jmp 0x9f549
movq 0x10(%rsp), %rax
testb $0x1, 0x1b(%rax)
je 0x9f2d0
movq 0x18(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9f245
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rcx
movl (%rcx), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rcx
movl (%rcx), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movq 0x10(%rsp), %rax
movb $0x0, 0x1b(%rax)
movq 0x10(%rsp), %rax
movb $0x0, 0x18(%rax)
movq 0x10(%rsp), %rax
movb $0x1, 0x19(%rax)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x18(%rsp), %rax
movq $0x1, 0x8(%rax)
movq 0x18(%rsp), %rax
movq 0x70(%rax), %rdi
movq 0x18(%rsp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x1b320
movq %rax, %rdi
leaq 0xcbd0b(%rip), %rsi     # 0x16afab
callq 0x834c0
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0x48(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0x40(%rax)
jmp 0x9f544
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rsi
callq 0x9f730
movl %eax, 0x3c(%rsp)
cmpl $-0x1, 0x3c(%rsp)
jne 0x9f3b2
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x83f40
movq 0x18(%rsp), %rax
movq $0x0, 0x28(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9f35f
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rsp), %rax
movl (%rax), %eax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0x1b720
movq %rax, %rcx
movq 0x8(%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x9f398
movq 0x18(%rsp), %rax
movb $0x1, 0x18(%rax)
jmp 0x9f549
movq 0x18(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq 0x10(%rsp), %rax
movb $0x1, 0x1b(%rax)
jmp 0x9f542
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
testb $0x1, 0x18(%rax)
je 0x9f434
cmpl $0xa, 0x3c(%rsp)
jne 0x9f3ec
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rsp), %rax
movb $0x0, 0x18(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x9f42f
cmpl $0xa, 0x3c(%rsp)
jne 0x9f40f
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xe0800
jmp 0x9f42d
cmpl $0xd, 0x3c(%rsp)
je 0x9f42b
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
movl 0x3c(%rsp), %eax
movsbl %al, %esi
callq 0xe0630
jmp 0x9f42d
jmp 0x9f42f
jmp 0x9f540
cmpl $0xa, 0x3c(%rsp)
jne 0x9f44c
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
callq 0xb6b0
movq (%rax), %rax
movslq 0x3c(%rsp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x9f53e
cmpl $0x3e, 0x3c(%rsp)
jne 0x9f4ef
movq 0x10(%rsp), %rax
testb $0x1, 0x1a(%rax)
je 0x9f491
movq 0x10(%rsp), %rax
movb $0x0, 0x1a(%rax)
movq 0x10(%rsp), %rax
movb $0x0, 0x19(%rax)
jmp 0x9f4e4
movq 0x10(%rsp), %rax
testb $0x1, 0x19(%rax)
je 0x9f4a7
movq 0x10(%rsp), %rax
movb $0x0, 0x19(%rax)
jmp 0x9f4b5
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
movq 0x18(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x30(%rsp)
movb $-0x1, 0x2079(%rax,%rcx)
movq 0x18(%rsp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movq 0x10(%rsp), %rax
movb $0x1, 0x18(%rax)
jmp 0x9f53c
movq 0x48(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl 0x3c(%rsp), %eax
movq 0x40(%rsp), %rcx
movzbl %al, %edx
callq 0x9f810
movl %eax, 0x38(%rsp)
cmpl $0x0, %eax
je 0x9f520
movl 0x38(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x9f5a4
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x9f53e
jmp 0x9f540
jmp 0x9f542
jmp 0x9f544
jmp 0x9f18b
movq 0x10(%rsp), %rax
testb $0x1, 0x1a(%rax)
je 0x9f58e
movq 0x40(%rsp), %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rax
movq 0x70(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1b320
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0xd209b(%rip), %rsi     # 0x171618
movb $0x0, %al
callq 0xc0d0
movl $0xfffffffe, 0x54(%rsp) # imm = 0xFFFFFFFE
jmp 0x9f5a4
movq 0x30(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x58(%rax)
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax)