// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xc8, %rsp
movq %rdi, 0xb8(%rsp)
movq %rsi, 0xb0(%rsp)
movq $0x0, 0xa8(%rsp)
movq $0x0, 0xa0(%rsp)
movq $0x0, 0x98(%rsp)
movq $0x0, 0x90(%rsp)
movl $0x5, 0x7c(%rsp)
leaq 0xcdfcd(%rip), %rax     # 0x16bee3
movq %rax, 0x70(%rsp)
movl $0x0, 0x6c(%rsp)
cmpq $0x0, 0xb0(%rsp)
je 0x9df79
movq 0xb0(%rsp), %rdi
callq 0xc270
testb $0x1, %al
jne 0x9df41
jmp 0x9df79
movq 0x116090(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xc0114(%rip), %rsi     # 0x15e066
leaq 0xc06ef(%rip), %rdx     # 0x15e648
leaq 0xd34f5(%rip), %rcx     # 0x171455
leaq 0xd350e(%rip), %r8      # 0x171475
movl $0xc4, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x9df7b
callq 0x9deb0
movq %rax, %rdi
movq 0xb8(%rsp), %rsi
callq 0x9b9e0
movq %rax, 0x80(%rsp)
movq 0xb8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x9e045
movq 0x80(%rsp), %rax
movb $0x1, 0x20(%rax)
movq 0x80(%rsp), %rax
movl $0x0, 0x28(%rax)
movq 0x88(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x88(%rsp), %rax
movq 0x70(%rax), %rdi
movq 0x88(%rsp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x1b320
movq %rax, %rdi
leaq 0xccf9a(%rip), %rsi     # 0x16afab
callq 0x834c0
movq %rax, %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x88(%rsp), %rax
movq $0x0, 0x48(%rax)
movq 0x88(%rsp), %rax
movq $0x0, 0x40(%rax)
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x19a00
cmpq $0x0, %rax
jbe 0x9e16a
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x199b0
movq %rax, 0x50(%rsp)
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x19a00
movq %rax, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x60(%rsp), %rax
cmpq 0x58(%rsp), %rax
jae 0x9e106
movq 0xb8(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq 0x50(%rsp), %rax
movq 0x60(%rsp), %rcx
movb (%rax,%rcx), %al
movq 0xb0(%rsp), %rcx
movzbl %al, %edx
callq 0x9e980
movq 0xa8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa8(%rsp)
movq 0xa0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa0(%rsp)
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x9e095
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x19b70
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x19a00
cmpq $0x0, %rax
je 0x9e166
movq 0x115ea3(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xbff27(%rip), %rsi     # 0x15e066
leaq 0xd334f(%rip), %rdx     # 0x171495
leaq 0xd3308(%rip), %rcx     # 0x171455
leaq 0xd3321(%rip), %r8      # 0x171475
movl $0xe1, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x9e168
jmp 0x9e16a
jmp 0x9e16c
movq 0xb8(%rsp), %rdi
movq 0x80(%rsp), %rax
movq 0x18(%rax), %rdx
movq 0xb0(%rsp), %rax
leaq 0x7c(%rsp), %rsi
leaq 0x70(%rsp), %rcx
leaq 0x90(%rsp), %r8
leaq 0x98(%rsp), %r9
leaq 0xa0(%rsp), %r11
leaq 0xa8(%rsp), %r10
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x9eb00
movl %eax, 0x6c(%rsp)
cmpl $0x0, 0x6c(%rsp)
je 0x9e1dc
cmpl $-0x1, 0x6c(%rsp)
je 0x9e1dc
jmp 0x9e742
cmpq $0x2000, 0xa8(%rsp) # imm = 0x2000
jb 0x9e29f
movq 0x88(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9e255
movq 0x98(%rsp), %rcx
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x88(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0xa0(%rsp), %rcx
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x88(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
cmpq $0x2000, 0xa8(%rsp) # imm = 0x2000
jae 0x9e272
movq 0xa8(%rsp), %rax
movq %rax, 0x48(%rsp)
jmp 0x9e27e
movl $0x2000, %eax           # imm = 0x2000
movq %rax, 0x48(%rsp)
jmp 0x9e27e
movq 0x48(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x58(%rax)
movl $0x0, 0xc4(%rsp)
jmp 0x9e787
cmpl $0x4, 0x7c(%rsp)
jne 0x9e34e
movq 0x88(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0xa8(%rsp)
movb $-0x1, 0x2079(%rax,%rcx)
movq 0xa0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa0(%rsp)
movq 0x88(%rsp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movq 0x80(%rsp), %rax
movl $0x0, 0x28(%rax)
movq 0x80(%rsp), %rax
movb $0x0, 0x24(%rax)
movq 0x80(%rsp), %rax
testb $0x1, 0x25(%rax)
jne 0x9e342
movq 0x88(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x9e342
movq 0x88(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xe0800
movq 0x80(%rsp), %rax
movb $0x0, 0x25(%rax)
movq 0x80(%rsp), %rax
movl 0x28(%rax), %eax
movl %eax, 0x44(%rsp)
testl %eax, %eax
je 0x9e437
jmp 0x9e367
movl 0x44(%rsp), %eax
subl $0x1, %eax
je 0x9e3c8
jmp 0x9e372
movl 0x44(%rsp), %eax
subl $0x2, %eax
jne 0x9e4b2
jmp 0x9e381
cmpl $0x0, 0x7c(%rsp)
je 0x9e3c3
movq 0x88(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x9e3a8
movq 0x88(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xe0800
movq 0x80(%rsp), %rax
movb $0x1, 0x25(%rax)
movq 0x80(%rsp), %rax
movl $0x0, 0x28(%rax)
jmp 0x9e4b2
cmpl $0x2, 0x7c(%rsp)
je 0x9e435
movq 0xb0(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x88(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x88(%rsp), %rax
movq 0x70(%rax), %rdi
movq 0x88(%rsp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x1b320
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rdx
movq %rax, %rcx
leaq 0xd309f(%rip), %rsi     # 0x1714bd
movb $0x0, %al
callq 0xc0d0
movl $0xffffffff, 0xc4(%rsp) # imm = 0xFFFFFFFF
jmp 0x9e787
jmp 0x9e4b2
movl 0x7c(%rsp), %eax
movl %eax, 0x2c(%rsp)
testl %eax, %eax
je 0x9e450
jmp 0x9e445
movl 0x2c(%rsp), %eax
subl $0x2, %eax
je 0x9e49d
jmp 0x9e4ae
movq 0x80(%rsp), %rax
movl $0x2, 0x28(%rax)
movq 0x88(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x9e49b
movq 0x88(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xe08a0
cmpq $0x0, %rax
jbe 0x9e49b
movq 0x88(%rsp), %rax
movq 0x20(%rax), %rdi
movl $0x20, %esi
callq 0xe0630
jmp 0x9e4b0
movq 0x80(%rsp), %rax
movl $0x1, 0x28(%rax)
jmp 0x9e4b0
jmp 0x9e4b0
jmp 0x9e4b2
cmpl $-0x1, 0x6c(%rsp)
jne 0x9e73d
movq 0x88(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9e524
movq 0x98(%rsp), %rcx
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x88(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0xa0(%rsp), %rcx
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x88(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x88(%rsp), %rax
movl (%rax), %eax
addl $0x1, %eax
movl %eax, %eax
movq %rax, 0x20(%rsp)
movq 0x88(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0x1b720
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jae 0x9e669
movq 0x88(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq 0x88(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x83f40
movq 0x80(%rsp), %rax
movl $0x0, 0x28(%rax)
movq 0x88(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x88(%rsp), %rax
movq 0x70(%rax), %rdi
movq 0x88(%rsp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x1b320
movq %rax, %rdi
leaq 0xcc9eb(%rip), %rsi     # 0x16afab
callq 0x834c0
movq %rax, %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x88(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9e62c
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x88(%rsp), %rcx
movl (%rcx), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x88(%rsp), %rcx
movl (%rcx), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movq 0x88(%rsp), %rax
movq $0x0, 0x48(%rax)
movq 0x88(%rsp), %rax
movq $0x0, 0x40(%rax)
movq $0x0, 0xa0(%rsp)
movq $0x0, 0x98(%rsp)
jmp 0x9e73b
movq 0x88(%rsp), %rax
movb $0x1, 0x18(%rax)
movq 0x88(%rsp), %rax
movq 0xa8(%rsp), %rcx
subq $0x1, %rcx
movzbl 0x2079(%rax,%rcx), %eax
cmpl $0xff, %eax
je 0x9e6d0
movq 0x115939(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xbf9bd(%rip), %rsi     # 0x15e066
leaq 0xd2e3a(%rip), %rdx     # 0x1714ea
leaq 0xd2d9e(%rip), %rcx     # 0x171455
leaq 0xd2db7(%rip), %r8      # 0x171475
movl $0x144, %r9d            # imm = 0x144
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x9e6d2
movq 0x88(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq %rcx, %rdx
addq $-0x1, %rdx
movq %rdx, 0xa8(%rsp)
movb $0x0, 0x2078(%rax,%rcx)
movq 0x88(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9e731
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x88(%rsp), %rcx
movl (%rcx), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movl $0x0, 0x6c(%rsp)
jmp 0x9e742
jmp 0x9e73d
jmp 0x9e16c
cmpq $0x2000, 0xa8(%rsp) # imm = 0x2000
jae 0x9e75f
movq 0xa8(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x9e76b
movl $0x2000, %eax           # imm = 0x2000
movq %rax, 0x18(%rsp)
jmp 0x9e76b
movq 0x18(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x58(%rax)
movl 0x6c(%rsp), %eax
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
addq $0xc8, %rsp
retq
nopw %cs:(%rax,%rax)