// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/core/sequence_buffer_embl.c
// Function: gt_sequence_buffer_embl_advance
static int gt_sequence_buffer_embl_advance(GtSequenceBuffer *sb, GtError *err)
{
  GtUword currentoutpos = 0, currentfileadd = 0, currentfileread = 0,
                linelen = 0;
  GtSequenceBufferMembers *pvt;
  GtSequenceBufferEMBL *sbe;
  GtEMBLParserLineCode lc = OTHER;
  const char *line = "";
  int had_err = 0;

  gt_error_check(err);

  sbe = gt_sequence_buffer_embl_cast(sb);
  pvt = sb->pvt;
  /* open first stream */
  if (!pvt->inputstream) {
    sbe->firstentryinfile = true;
    sbe->state = EMBL_UNDEFINED;
    pvt->linenum = (uint64_t) 0;
    pvt->inputstream = gt_file_xopen(gt_str_array_get(pvt->filenametab,
                                                  (GtUword) pvt->filenum),
                                         "rb");
    pvt->currentinpos = 0;
    pvt->currentfillpos = 0;
  }

  if (gt_str_length(sbe->overflowbuffer) > 0) {
    /* we still have surplus sequence from the last line, process that first */
    GtUword i, len;
    const char *overflowedstring;
    overflowedstring = gt_str_get_mem(sbe->overflowbuffer);
    len = gt_str_length(sbe->overflowbuffer);
    for (i=0;i<len;i++)
    {
      process_char(sb, currentoutpos, overflowedstring[i], err);
      currentoutpos++;
      currentfileadd++;
    }
    gt_str_reset(sbe->overflowbuffer);
    gt_assert(gt_str_length(sbe->overflowbuffer) == 0);
  }

  /* parse file line-by-line */
  while (true) {
    had_err = parse_next_line(sb, &lc, sbe->overflowbuffer, &line, &linelen,
                              &currentfileread, &currentfileadd, &currentoutpos,
                              err);

    if (had_err && had_err != EOF) {
      break;
    }
    if (currentoutpos >= (GtUword) OUTBUFSIZE) {
      if (pvt->filelengthtab) {
        pvt->filelengthtab[pvt->filenum].length
          += (uint64_t) currentfileread;
        pvt->filelengthtab[pvt->filenum].effectivelength
          += (uint64_t) currentfileadd;
      }
      pvt->nextfree = GT_MIN(currentoutpos, OUTBUFSIZE);
      return 0; /* buffer full, finished */
    }
    if (lc == TERMINATOR) {
      pvt->outbuf[currentoutpos++] = (GtUchar) GT_SEPARATOR;
      currentfileadd++;
      pvt->lastspeciallength++;
      sbe->state = EMBL_UNDEFINED;
      sbe->desc_spacer_was_set = false;
      if (!sbe->description_set && pvt->descptr)
          gt_desc_buffer_finish(pvt->descptr);
      sbe->description_set = false;
    }
    /* FSM transitions begin here */
    switch (sbe->state) {
      case EMBL_IN_DESCRIPTION:
        if (lc != DESCRIPTION) {
          /* save description */
          if (pvt->descptr) {
            gt_desc_buffer_finish(pvt->descptr);
          }
          sbe->description_set = true;
          /* gt_str_reset(sbe->headerbuffer); */
          sbe->state = EMBL_UNDEFINED;
        }
        break;
      case EMBL_IN_SEQUENCE:
        /* only a terminator may come after a sequence */
        if (lc != SEQUENCE) {
          gt_error_set(err, "unterminated sequence in line "GT_WU" of file %s",
                            (GtUword) pvt->linenum,
                            gt_str_array_get(pvt->filenametab,
                                                (GtUword) pvt->filenum));
          return -1;
        }
        break;
      case EMBL_UNDEFINED:
        switch (lc) {
          case DESCRIPTION:
            sbe->state = EMBL_IN_DESCRIPTION;
            if (pvt->descptr && gt_desc_buffer_length(pvt->descptr) > 0) {
              gt_desc_buffer_append_char(pvt->descptr, ' ');
            }
            break;
          case SEQUENCE:
            sbe->state = EMBL_IN_SEQUENCE;
            break;
          default:
            break;
        }
        break;
    }
    if (had_err == EOF) {
      /* save length table entries if needed */
      if (pvt->filelengthtab) {
        pvt->filelengthtab[pvt->filenum].length
          += (uint64_t) currentfileread;
        pvt->filelengthtab[pvt->filenum].effectivelength
          += (uint64_t) currentfileadd;
      }
      if (pvt->filenum+1 < gt_str_array_size(pvt->filenametab)) {
        pvt->filenum++;
        /* still files left, open next one */
        gt_file_delete(pvt->inputstream);
        sbe->state = EMBL_UNDEFINED;
        pvt->linenum = (uint64_t) 0;
        pvt->inputstream = gt_file_xopen(gt_str_array_get(pvt->filenametab,
                                                (GtUword) pvt->filenum),
                                            "rb");
        if (pvt->filelengthtab) {
          pvt->filelengthtab[pvt->filenum].length = 0;
          pvt->filelengthtab[pvt->filenum].effectivelength = 0;
        }
        pvt->currentinpos = 0;
        pvt->currentfillpos = 0;
        currentfileread = currentfileadd = 0;
      } else {
        /* all files exhausted */
        pvt->complete = true;
        /* remove last separator */
        gt_assert(pvt->outbuf[currentoutpos-1] == GT_SEPARATOR);
        pvt->outbuf[--currentoutpos] = (GtUchar) '\0';
        if (pvt->filelengthtab) {
          pvt->filelengthtab[pvt->filenum].effectivelength--;
        }
        had_err = 0;
        break;
      }
    }
  }
  pvt->nextfree = GT_MIN(currentoutpos, OUTBUFSIZE);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %rsi
testq %rbx, %rbx
movq %rdi, 0x10(%rsp)
je 0x80623
movq %rbx, %rdi
callq 0x34fea
movq 0x10(%rsp), %rsi
testb %al, %al
jne 0x80ed4
movq %rbx, 0x28(%rsp)
leaq 0xcf1b9(%rip), %rdi     # 0x14f7e8
movq %rsi, %rbx
callq 0x7f41e
movq %rax, %r14
movq 0x8(%rbx), %r12
cmpq $0x0, 0x28(%r12)
jne 0x80687
movb $0x1, 0x20(%r14)
movl $0x0, 0x28(%r14)
movq $0x0, 0x8(%r12)
movq 0x70(%r12), %rdi
movl (%r12), %esi
callq 0x3ca6f
leaq 0x6d585(%rip), %rsi     # 0xedbf6
movq %rax, %rdi
callq 0x75bec
movq %rax, 0x28(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%r12)
movq 0x18(%r14), %rdi
callq 0x3bb86
testq %rax, %rax
movq %r14, 0x18(%rsp)
je 0x80790
movq 0x18(%r14), %rdi
callq 0x3bb77
movq %rax, %r13
movq 0x18(%r14), %rdi
callq 0x3bb86
movq %rax, %rbp
testq %rax, %rax
movq 0x10(%rsp), %rdi
je 0x8076c
xorl %r14d, %r14d
movb (%r13,%r14), %al
movq 0x8(%rdi), %r15
movq 0x6080(%r15), %rdx
movl %eax, %ecx
testq %rdx, %rdx
je 0x8074c
movzbl %al, %ebx
movzbl (%rdx,%rbx), %ecx
cmpq $0xfd, %rcx
jne 0x8071d
movq 0x70(%r15), %rdi
movl (%r15), %esi
callq 0x3ca6f
movq 0x8(%r15), %r8
movq 0x28(%rsp), %rdi
leaq 0x72bf9(%rip), %rsi     # 0xf3303
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x34f1f
movq 0x10(%rsp), %rdi
jmp 0x80760
leaq 0x60(%r15), %rdx
movq 0x60(%r15), %rsi
cmpb $-0x3, %cl
ja 0x80746
testq %rsi, %rsi
je 0x80736
movq $0x0, (%rdx)
movq 0x38(%r15), %rdx
testq %rdx, %rdx
je 0x8074c
leaq (%rdx,%rcx,8), %rdx
movq (%rdx), %rsi
incq %rsi
movq %rsi, (%rdx)
movb %cl, 0x2079(%r15,%r14)
movb %al, 0x4079(%r15,%r14)
incq 0x68(%r15)
incq %r14
cmpq %r14, %rbp
jne 0x806c7
movq 0x18(%rsp), %rbx
movq 0x18(%rbx), %rdi
callq 0x3bbee
movq 0x18(%rbx), %rdi
callq 0x3bb86
testq %rax, %rax
movq %rbp, %r14
je 0x80793
callq 0x1df3a
xorl %r14d, %r14d
leaq 0x40(%r12), %rax
movq %rax, 0x50(%rsp)
xorl %r13d, %r13d
movq %r14, 0x30(%rsp)
movq 0x10(%rsp), %r8
movq %r12, 0x20(%rsp)
movq %r14, 0x38(%rsp)
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rbx
movq 0x8(%r8), %r14
incq 0x8(%r14)
cmpb $0x1, 0x19(%r14)
movq %rbx, 0x40(%rsp)
jne 0x807dc
movb $0x0, 0x19(%r14)
movb 0x78(%r14), %al
jmp 0x8081e
movq 0x48(%r14), %rax
cmpq 0x40(%r14), %rax
jb 0x8080d
movq 0x28(%r14), %rdi
leaq 0x79(%r14), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x75fcd
cltq
movq %rax, 0x40(%r14)
testl %eax, %eax
je 0x808e3
xorl %eax, %eax
movq 0x10(%rsp), %r8
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%r14)
movb 0x79(%r14,%rax), %al
movb %al, 0x78(%r14)
leaq 0x1(%r13), %r15
movl $0x5, %ebx
cmpb $0xa, %al
jne 0x80835
xorl %ebp, %ebp
movq %r15, %r13
jmp 0x80beb
movb %al, 0xe(%rsp)
movq 0x8(%r8), %r12
cmpb $0x1, 0x19(%r12)
jne 0x80852
movb $0x0, 0x19(%r12)
movb 0x78(%r12), %al
jmp 0x8089a
movq 0x48(%r12), %rax
cmpq 0x40(%r12), %rax
jb 0x80887
movq 0x28(%r14), %rdi
leaq 0x79(%r12), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x75fcd
cltq
movq %rax, 0x40(%r12)
testl %eax, %eax
je 0x80901
xorl %eax, %eax
movq 0x10(%rsp), %r8
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%r12)
movb 0x79(%r12,%rax), %al
movb %al, 0x78(%r12)
cmpb $0xa, %al
je 0x80e5e
leaq 0x2(%r13), %r12
movb %al, 0xf(%rsp)
cmpw $0x4544, 0xe(%rsp)      # imm = 0x4544
je 0x808df
cmpw $0x2020, 0xe(%rsp)      # imm = 0x2020
je 0x808f0
cmpw $0x5858, 0xe(%rsp)      # imm = 0x5858
je 0x808f7
cmpw $0x4449, 0xe(%rsp)      # imm = 0x4449
je 0x8090c
xorl %ebx, %ebx
cmpw $0x2f2f, 0xe(%rsp)      # imm = 0x2F2F
sete %bl
xorl $0x5, %ebx
jmp 0x80911
xorl %ebx, %ebx
jmp 0x80911
movb $0x1, %bpl
movl $0x5, %ebx
jmp 0x80be6
movl $0x2, %ebx
jmp 0x80911
movl $0x3, %ebx
jmp 0x809a9
movb $0x1, %bpl
movq %r15, %r13
jmp 0x80be1
movl $0x1, %ebx
addq $0x5, %r13
movq %r13, 0x48(%rsp)
movl $0x3, %ebp
movq 0x8(%r8), %r15
cmpb $0x1, 0x19(%r15)
jne 0x80935
movb $0x0, 0x19(%r15)
movb 0x78(%r15), %r13b
jmp 0x80977
movq 0x48(%r15), %rax
cmpq 0x40(%r15), %rax
jb 0x80966
movq 0x28(%r14), %rdi
leaq 0x79(%r15), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x75fcd
cltq
movq %rax, 0x40(%r15)
testl %eax, %eax
je 0x80bdb
xorl %eax, %eax
movq 0x10(%rsp), %r8
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%r15)
movb 0x79(%r15,%rax), %r13b
movb %r13b, 0x78(%r15)
cmpb $0xa, %r13b
je 0x809bf
callq 0xb6e0
movq (%rax), %rax
movzbl %r13b, %ecx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x80dac
incq %r12
decl %ebp
movq 0x10(%rsp), %r8
jne 0x8091f
movq 0x48(%rsp), %r12
movq 0x8(%r8), %r15
cmpb $0x1, 0x19(%r15)
jne 0x809c4
movb $0x0, 0x19(%r15)
movb 0x78(%r15), %r13b
jmp 0x80a06
incq %r12
jmp 0x80a1e
movq 0x48(%r15), %rax
cmpq 0x40(%r15), %rax
jb 0x809f5
movq 0x28(%r14), %rdi
leaq 0x79(%r15), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x75fcd
cltq
movq %rax, 0x40(%r15)
testl %eax, %eax
je 0x80bdb
xorl %eax, %eax
movq 0x10(%rsp), %r8
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%r15)
movb 0x79(%r15,%rax), %r13b
movb %r13b, 0x78(%r15)
incq %r12
cmpb $0xa, %r13b
jne 0x80a2d
movq 0x40(%rsp), %rdi
callq 0x3bb5d
movq 0x10(%rsp), %r8
xorl %ebp, %ebp
movq %r12, %r13
movq 0x20(%rsp), %r12
jmp 0x80beb
xorl %r15d, %r15d
testl %ebx, %ebx
je 0x80ab0
cmpl $0x1, %ebx
je 0x80a87
cmpl $0x2, %ebx
jne 0x80aea
leal 0x1(%r15), %ebp
movl $0x2, %ebx
cmpl $0x40, %r15d
jg 0x80aed
callq 0xb6e0
movq (%rax), %rax
movzbl %r13b, %edx
testb $0x20, 0x1(%rax,%rdx,2)
jne 0x80ae3
cmpq $0x2000, 0x38(%rsp)     # imm = 0x2000
jb 0x80b5a
movsbl %r13b, %esi
movq 0x40(%rsp), %rdi
callq 0x3b9df
jmp 0x80ae3
movl $0x5, %ebx
cmpb $0x3b, %r13b
je 0x80aea
movq 0x20(%r14), %rdi
movl $0x1, %ebx
testq %rdi, %rdi
je 0x80aea
movsbl %r13b, %esi
callq 0xa3c20
movq 0x10(%rsp), %r8
jmp 0x80aea
movq 0x20(%r14), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x80aea
cmpb $0x0, 0x24(%r8)
jne 0x80ad7
movl $0x20, %esi
movq %r8, %rbp
callq 0xa3c20
movb $0x1, 0x24(%rbp)
movq 0x20(%r14), %rdi
movsbl %r13b, %esi
callq 0xa3c20
movl %r15d, %ebp
movq 0x10(%rsp), %r8
jmp 0x80aed
movl %r15d, %ebp
movq 0x8(%r8), %r15
cmpb $0x1, 0x19(%r15)
jne 0x80b03
movb $0x0, 0x19(%r15)
movb 0x78(%r15), %r13b
jmp 0x80b45
movq 0x48(%r15), %rax
cmpq 0x40(%r15), %rax
jb 0x80b34
movq 0x28(%r14), %rdi
leaq 0x79(%r15), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x75fcd
cltq
movq %rax, 0x40(%r15)
testl %eax, %eax
je 0x80bdb
xorl %eax, %eax
movq 0x10(%rsp), %r8
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%r15)
movb 0x79(%r15,%rax), %r13b
movb %r13b, 0x78(%r15)
incq %r12
movl %ebp, %r15d
cmpb $0xa, %r13b
jne 0x80a30
jmp 0x80a0f
movq 0x10(%rsp), %r8
movq 0x8(%r8), %r15
movq 0x6080(%r15), %rcx
movl %r13d, %eax
testq %rcx, %rcx
je 0x80bb0
movzbl (%rcx,%rdx), %eax
cmpq $0xfd, %rax
je 0x80ea4
leaq 0x60(%r15), %rcx
movq 0x60(%r15), %rdx
cmpb $-0x3, %al
ja 0x80baa
testq %rdx, %rdx
je 0x80b9a
movq $0x0, (%rcx)
movq 0x38(%r15), %rcx
testq %rcx, %rcx
je 0x80bb0
leaq (%rcx,%rax,8), %rcx
movq (%rcx), %rdx
incq %rdx
movq %rdx, (%rcx)
movq 0x38(%rsp), %rcx
movb %al, 0x2079(%r15,%rcx)
movb %r13b, 0x4079(%r15,%rcx)
incq 0x68(%r15)
incq %rcx
movq %rcx, 0x38(%rsp)
incq 0x30(%rsp)
jmp 0x80aed
movb $0x1, %bpl
movq %r12, %r13
movq 0x20(%rsp), %r12
movq 0x10(%rsp), %r8
movq 0x38(%rsp), %r14
cmpq $0x2000, %r14           # imm = 0x2000
jae 0x80df2
cmpl $0x4, %ebx
jne 0x80c4d
movb $-0x1, 0x2079(%r12,%r14)
incq 0x60(%r12)
movq 0x18(%rsp), %rax
movl $0x0, 0x28(%rax)
movb $0x0, 0x24(%rax)
cmpb $0x0, 0x25(%rax)
jne 0x80c3a
movq 0x20(%r12), %rdi
testq %rdi, %rdi
je 0x80c3a
callq 0xa3cd2
movq 0x10(%rsp), %r8
incq %r14
incq 0x30(%rsp)
movq 0x18(%rsp), %rax
movb $0x0, 0x25(%rax)
jmp 0x80c52
movq 0x18(%rsp), %rax
movl 0x28(%rax), %eax
testl %eax, %eax
je 0x80c9f
cmpl $0x1, %eax
je 0x80c95
cmpl $0x2, %eax
jne 0x80cef
testl %ebx, %ebx
je 0x80cef
movq 0x20(%r12), %rdi
testq %rdi, %rdi
je 0x80c83
callq 0xa3cd2
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %rax
movb $0x1, 0x25(%rax)
movl $0x0, 0x28(%rax)
jmp 0x80cef
cmpl $0x2, %ebx
je 0x80cef
jmp 0x80e6e
cmpl $0x2, %ebx
je 0x80ce3
testl %ebx, %ebx
jne 0x80cef
movq 0x18(%rsp), %rax
movl $0x2, 0x28(%rax)
movq 0x20(%r12), %rdi
testq %rdi, %rdi
je 0x80cef
callq 0xa3d07
movq 0x10(%rsp), %r8
testq %rax, %rax
je 0x80cef
movq 0x20(%r12), %rdi
movl $0x20, %esi
callq 0xa3c20
movq 0x10(%rsp), %r8
jmp 0x80cef
movq 0x18(%rsp), %rax
movl $0x1, 0x28(%rax)
testb %bpl, %bpl
je 0x807af
movq 0x10(%r12), %rax
movl (%r12), %ebx
testq %rax, %rax
je 0x80d1b
movq %rbx, %rcx
shlq $0x4, %rcx
addq %r13, (%rax,%rcx)
movq 0x30(%rsp), %rdx
addq %rdx, 0x8(%rax,%rcx)
incl %ebx
movq 0x70(%r12), %rdi
callq 0x3cbed
cmpq %rbx, %rax
jbe 0x80e1f
incl (%r12)
movq 0x28(%r12), %rdi
callq 0x760c0
movq 0x18(%rsp), %rax
movl $0x0, 0x28(%rax)
movq $0x0, 0x8(%r12)
movq 0x70(%r12), %rdi
movl (%r12), %esi
callq 0x3ca6f
movq %rax, %rdi
leaq 0x6ce8b(%rip), %rsi     # 0xedbf6
callq 0x75bec
movq %rax, 0x28(%r12)
movq 0x10(%r12), %rax
testq %rax, %rax
xorps %xmm0, %xmm0
je 0x80d8e
movl (%r12), %ecx
shlq $0x4, %rcx
movups %xmm0, (%rax,%rcx)
movq 0x50(%rsp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x30(%rsp)
xorl %r13d, %r13d
movq 0x10(%rsp), %r8
jmp 0x807af
movq 0x8(%r14), %rdx
leaq 0x725a8(%rip), %rsi     # 0xf335f
movq 0x28(%rsp), %rdi
xorl %eax, %eax
callq 0x34f1f
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
movq 0x20(%rsp), %r12
movq 0x38(%rsp), %r14
movl $0x2000, %ecx           # imm = 0x2000
cmpq %rcx, %r14
cmovbq %r14, %rcx
movq %rcx, 0x58(%r12)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r12), %rax
testq %rax, %rax
je 0x80e12
movl (%r12), %ecx
shlq $0x4, %rcx
addq %r13, (%rax,%rcx)
movq 0x30(%rsp), %rdx
addq %rdx, 0x8(%rax,%rcx)
movq $0x2000, 0x58(%r12)     # imm = 0x2000
xorl %eax, %eax
jmp 0x80de3
movb $0x1, 0x18(%r12)
cmpb $-0x1, 0x2078(%r12,%r14)
jne 0x80ed9
decq %r14
movb $0x0, 0x2079(%r12,%r14)
movq 0x10(%r12), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x80dd2
movl (%r12), %edx
shlq $0x4, %rdx
decq 0x8(%rcx,%rdx)
jmp 0x80dd2
movq 0x8(%r14), %rdx
leaq 0x724c7(%rip), %rsi     # 0xf3330
jmp 0x80db7
movq 0x8(%r12), %rbx
movq 0x70(%r12), %rdi
movl (%r12), %esi
callq 0x3ca6f
leaq 0x72421(%rip), %rsi     # 0xf32a9
movq 0x28(%rsp), %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x34f1f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x80de3
movq 0x70(%r15), %rdi
movl (%r15), %esi
movq %rdx, %rbx
callq 0x3ca6f
movq 0x8(%r15), %r8
leaq 0x72445(%rip), %rsi     # 0xf3303
movq 0x28(%rsp), %rdi
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x34f1f
jmp 0x80dc3
callq 0x1df01
callq 0x1df73