// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/sequence_buffer_fastq.c
// Function: gt_sequence_buffer_fastq_advance
static int gt_sequence_buffer_fastq_advance(GtSequenceBuffer *sb, GtError *err)
{
  GtUword currentoutpos = 0, currentfileadd = 0, currentfileread = 0,
                seqlen = 0, desclen, cnt, newfilenum;
  GtSequenceBufferMembers *pvt;
  GtSequenceBufferFastQ *sbfq;
  const GtUchar *seq;
  char *desc;
  int had_err = 0;
  gt_error_check(err);

  sbfq = gt_sequence_buffer_fastq_cast(sb);
  pvt = sb->pvt;

  if (!sbfq->seqit) {
    sbfq->seqit = (GtSeqIteratorFastQ*)
                         gt_seq_iterator_fastq_new(sbfq->sequences, err);
    if (!sbfq->seqit) return -1;
  }

  /* did the last buffer end with a sequence boundary?
     if so, we need to provide an additional separator! */
  if (sbfq->carryseparator) {
    pvt->outbuf[currentoutpos++] = (GtUchar) GT_SEPARATOR;
    currentfileread++;
    pvt->lastspeciallength++;
    currentfileadd++;
    sbfq->carryseparator = false;
  }

  if (gt_str_length(sbfq->overflowbuffer) > 0) {
    /* we still have surplus sequence from the last line, process that first */
    const char *overflowedstring;
    char cc;
    overflowedstring = gt_str_get(sbfq->overflowbuffer);
    while (!had_err && currentoutpos < (GtUword) OUTBUFSIZE
             &&(cc = *(overflowedstring)) != '\0')
    {
      if ((had_err = process_char(sb, currentoutpos, cc, err)))
          return had_err;
      currentoutpos++;
      currentfileadd++;
      currentfileread++;
      overflowedstring++;
    }
    /* still sequence left in overflowbuffer? */
    if (*(overflowedstring) != '\0') {
      gt_str_set(sbfq->overflowbuffer, overflowedstring);
    } else {
      pvt->outbuf[currentoutpos++] = (GtUchar) GT_SEPARATOR;
      currentfileread++;
      pvt->lastspeciallength++;
      gt_str_reset(sbfq->overflowbuffer);
      gt_assert(gt_str_length(sbfq->overflowbuffer) == 0);
    }
  }

  /* we need more than one round to deal with the overflowed sequence */
  if (gt_str_length(sbfq->overflowbuffer) > 0) {
    pvt->nextfree = GT_MIN(currentoutpos, OUTBUFSIZE);
    return had_err;
  }

  gt_assert(gt_str_length(sbfq->overflowbuffer) == 0);
  /* iterate over sequences */
  while (true) {
    had_err = gt_seq_iterator_next((GtSeqIterator*) sbfq->seqit, &seq, &seqlen,
                                  &desc, err);
    newfilenum = gt_seq_iterator_fastq_get_file_index(sbfq->seqit);

    /* update current file info */
    if (pvt->filenum != newfilenum) {
      if (pvt->filelengthtab) {
        pvt->filelengthtab[pvt->filenum].length += (uint64_t) currentfileread;
        pvt->filelengthtab[pvt->filenum].effectivelength += (uint64_t)
                                                               currentfileadd;
      }
      currentfileread = currentfileadd = 0;
      pvt->filenum = newfilenum;
    }

    /* error check! */
    if (had_err < 0) {
      return had_err;
    }

    /* end of iterator reached */
    if (had_err == 0) {
      pvt->complete = true;
      /* remove last separator */
      pvt->outbuf[--currentoutpos] = (GtUchar) '\0';
      currentfileadd--;
      break;
    }

    /* copy sequence */
    for (cnt=0;cnt<seqlen;cnt++) {
      if (currentoutpos >= (GtUword) OUTBUFSIZE) {
        gt_str_append_char(sbfq->overflowbuffer, seq[cnt]);
      } else {
        if ((had_err = process_char(sb, currentoutpos, seq[cnt], err)))
          return had_err;
        currentoutpos++;
        currentfileadd++;
        currentfileread++;
      }
    }

    /* place separator after sequence (or defer) */
    if (gt_str_length(sbfq->overflowbuffer) == 0) {
      if (currentoutpos >= (GtUword) OUTBUFSIZE)
        sbfq->carryseparator = true;
      else {
        pvt->outbuf[currentoutpos++] = (GtUchar) GT_SEPARATOR;
        pvt->lastspeciallength++;
        currentfileadd++;
      }
    }

    desclen = strlen(desc)+1;
    currentfileread += desclen; /* XXX: we cannot know whether the desc was */
    pvt->counter += desclen;    /*      repeated before the qualities line  */

    /* enqueue description */
    if (pvt->descptr) {
      int i;
      for (i = 0; i < strlen(desc); i++) {
        gt_desc_buffer_append_char(pvt->descptr, desc[i]);
      }
      gt_desc_buffer_finish(pvt->descptr);
    }

    /* if buffer is full, return it */
    if (currentoutpos >= (GtUword) OUTBUFSIZE) {
      pvt->nextfree = GT_MIN(currentoutpos, OUTBUFSIZE);
      had_err = 0;
      break;
    }
  }

  /* update information about read characters */
  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 had_err;
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xa8(%rsp)
movq %rsi, 0xa0(%rsp)
movq $0x0, 0x98(%rsp)
movq $0x0, 0x90(%rsp)
movq $0x0, 0x88(%rsp)
movq $0x0, 0x80(%rsp)
movl $0x0, 0x44(%rsp)
cmpq $0x0, 0xa0(%rsp)
je 0x9fa45
movq 0xa0(%rsp), %rdi
callq 0xc270
testb $0x1, %al
jne 0x9fa0d
jmp 0x9fa45
movq 0x1145c4(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xbe648(%rip), %rsi     # 0x15e066
leaq 0xbec23(%rip), %rdx     # 0x15e648
leaq 0xd1c42(%rip), %rcx     # 0x17166e
leaq 0xd1c5c(%rip), %r8      # 0x17168f
movl $0x33, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x9fa47
callq 0x9f990
movq %rax, %rdi
movq 0xa8(%rsp), %rsi
callq 0x9b9e0
movq %rax, 0x58(%rsp)
movq 0xa8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x58(%rsp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x9fabe
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0xa0(%rsp), %rsi
callq 0xe42a0
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x58(%rsp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x9fabc
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0xa01c4
jmp 0x9fabe
movq 0x58(%rsp), %rax
testb $0x1, 0x20(%rax)
je 0x9fb2f
movq 0x60(%rsp), %rax
movq 0x98(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x98(%rsp)
movb $-0x1, 0x2079(%rax,%rcx)
movq 0x88(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x88(%rsp)
movq 0x60(%rsp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
movq 0x58(%rsp), %rax
movb $0x0, 0x20(%rax)
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x19a00
cmpq $0x0, %rax
jbe 0x9fcfa
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x19940
movq %rax, 0x38(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x44(%rsp)
movb %al, 0x2f(%rsp)
jne 0x9fb93
xorl %eax, %eax
cmpq $0x2000, 0x98(%rsp) # imm = 0x2000
movb %al, 0x2f(%rsp)
jae 0x9fb93
movq 0x38(%rsp), %rax
movb (%rax), %al
movb %al, 0x37(%rsp)
movsbl %al, %eax
cmpl $0x0, %eax
setne %al
movb %al, 0x2f(%rsp)
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x9fba0
jmp 0x9fc2c
movq 0xa8(%rsp), %rdi
movq 0x98(%rsp), %rsi
movb 0x37(%rsp), %al
movq 0xa0(%rsp), %rcx
movzbl %al, %edx
callq 0xa0390
movl %eax, 0x44(%rsp)
cmpl $0x0, %eax
je 0x9fbdd
movl 0x44(%rsp), %eax
movl %eax, 0xb4(%rsp)
jmp 0xa01c4
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x98(%rsp)
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
movq 0x88(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x88(%rsp)
movq 0x38(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0x9fb5a
movq 0x38(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x9fc51
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x38(%rsp), %rsi
callq 0x190b0
jmp 0x9fcf8
movq 0x60(%rsp), %rax
movq 0x98(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x98(%rsp)
movb $-0x1, 0x2079(%rax,%rcx)
movq 0x88(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x88(%rsp)
movq 0x60(%rsp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x19b70
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x19a00
cmpq $0x0, %rax
je 0x9fcf4
movq 0x114315(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xbe399(%rip), %rsi     # 0x15e066
leaq 0xd19dc(%rip), %rdx     # 0x1716b0
leaq 0xd1993(%rip), %rcx     # 0x17166e
leaq 0xd19ad(%rip), %r8      # 0x17168f
movl $0x5f, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x9fcf6
jmp 0x9fcf8
jmp 0x9fcfa
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x19a00
cmpq $0x0, %rax
jbe 0x9fd55
cmpq $0x2000, 0x98(%rsp) # imm = 0x2000
jae 0x9fd2b
movq 0x98(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x9fd37
movl $0x2000, %eax           # imm = 0x2000
movq %rax, 0x20(%rsp)
jmp 0x9fd37
movq 0x20(%rsp), %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x58(%rax)
movl 0x44(%rsp), %eax
movl %eax, 0xb4(%rsp)
jmp 0xa01c4
jmp 0x9fd57
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x19a00
cmpq $0x0, %rax
je 0x9fda3
movq 0x114266(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xbe2ea(%rip), %rsi     # 0x15e066
leaq 0xd192d(%rip), %rdx     # 0x1716b0
leaq 0xd18e4(%rip), %rcx     # 0x17166e
leaq 0xd18fe(%rip), %r8      # 0x17168f
movl $0x69, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x9fda5
jmp 0x9fda7
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0xa0(%rsp), %r8
leaq 0x50(%rsp), %rsi
leaq 0x80(%rsp), %rdx
leaq 0x48(%rsp), %rcx
callq 0xe3680
movl %eax, 0x44(%rsp)
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0xe3870
movq %rax, 0x68(%rsp)
movq 0x60(%rsp), %rax
movl (%rax), %eax
cmpq 0x68(%rsp), %rax
je 0x9fe72
movq 0x60(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x9fe4c
movq 0x88(%rsp), %rcx
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x60(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x90(%rsp), %rcx
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x60(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq $0x0, 0x90(%rsp)
movq $0x0, 0x88(%rsp)
movq 0x68(%rsp), %rax
movl %eax, %ecx
movq 0x60(%rsp), %rax
movl %ecx, (%rax)
cmpl $0x0, 0x44(%rsp)
jge 0x9fe89
movl 0x44(%rsp), %eax
movl %eax, 0xb4(%rsp)
jmp 0xa01c4
cmpl $0x0, 0x44(%rsp)
jne 0x9fed6
movq 0x60(%rsp), %rax
movb $0x1, 0x18(%rax)
movq 0x60(%rsp), %rax
movq 0x98(%rsp), %rcx
movq %rcx, %rdx
addq $-0x1, %rdx
movq %rdx, 0x98(%rsp)
movb $0x0, 0x2078(%rax,%rcx)
movq 0x90(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x90(%rsp)
jmp 0xa012a
movq $0x0, 0x70(%rsp)
movq 0x70(%rsp), %rax
cmpq 0x80(%rsp), %rax
jae 0x9ffb8
cmpq $0x2000, 0x98(%rsp) # imm = 0x2000
jb 0x9ff21
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x50(%rsp), %rax
movq 0x70(%rsp), %rcx
movsbl (%rax,%rcx), %esi
callq 0x194d0
jmp 0x9ffa3
movq 0xa8(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq 0x50(%rsp), %rax
movq 0x70(%rsp), %rcx
movb (%rax,%rcx), %al
movq 0xa0(%rsp), %rcx
movzbl %al, %edx
callq 0xa0390
movl %eax, 0x44(%rsp)
cmpl $0x0, %eax
je 0x9ff67
movl 0x44(%rsp), %eax
movl %eax, 0xb4(%rsp)
jmp 0xa01c4
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x98(%rsp)
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
movq 0x88(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x88(%rsp)
jmp 0x9ffa5
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x9fedf
movq 0x58(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0x19a00
cmpq $0x0, %rax
jne 0xa0030
cmpq $0x2000, 0x98(%rsp) # imm = 0x2000
jb 0x9ffe5
movq 0x58(%rsp), %rax
movb $0x1, 0x20(%rax)
jmp 0xa002e
movq 0x60(%rsp), %rax
movq 0x98(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x98(%rsp)
movb $-0x1, 0x2079(%rax,%rcx)
movq 0x60(%rsp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
jmp 0xa0030
movq 0x48(%rsp), %rdi
callq 0xb240
addq $0x1, %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
addq 0x88(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x78(%rsp), %rcx
movq 0x60(%rsp), %rax
addq 0x68(%rax), %rcx
movq %rcx, 0x68(%rax)
movq 0x60(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0xa00d6
movl $0x0, 0x30(%rsp)
movslq 0x30(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rdi
callq 0xb240
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0xa00c8
movq 0x60(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x48(%rsp), %rax
movslq 0x30(%rsp), %rcx
movsbl (%rax,%rcx), %esi
callq 0xe0630
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0xa007e
movq 0x60(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xe0800
cmpq $0x2000, 0x98(%rsp) # imm = 0x2000
jb 0xa0125
cmpq $0x2000, 0x98(%rsp) # imm = 0x2000
jae 0xa0101
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0xa010d
movl $0x2000, %eax           # imm = 0x2000
movq %rax, 0x10(%rsp)
jmp 0xa010d
movq 0x10(%rsp), %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x58(%rax)
movl $0x0, 0x44(%rsp)
jmp 0xa012a
jmp 0x9fda7
movq 0x60(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0xa0182
movq 0x88(%rsp), %rcx
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x60(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x90(%rsp), %rcx
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x60(%rsp), %rdx
movl (%rdx), %edx
shlq $0x4, %rdx
addq %rdx, %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
cmpq $0x2000, 0x98(%rsp) # imm = 0x2000
jae 0xa019f
movq 0x98(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0xa01ab
movl $0x2000, %eax           # imm = 0x2000
movq %rax, 0x8(%rsp)
jmp 0xa01ab
movq 0x8(%rsp), %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x58(%rax)
movl 0x44(%rsp), %eax
movl %eax, 0xb4(%rsp)
movl 0xb4(%rsp), %eax
addq $0xb8, %rsp
retq
nopw %cs:(%rax,%rax)