// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/seq_iterator_sequence_buffer.c
// Function: gt_seq_iterator_sequence_buffer_next
static int gt_seq_iterator_sequence_buffer_next(GtSeqIterator *si,
                                               const GtUchar **sequence,
                                               GtUword *len,
                                               char **desc,
                                               GtError *err)
{
  GtSeqIteratorSequenceBuffer *seqit;
  GtUchar charcode;
  int retval;
  bool haserr = false, foundseq = false;
  gt_assert(si);
  gt_assert(len && desc);

  seqit = gt_seq_iterator_sequence_buffer_cast(si);
  gt_assert((sequence && seqit->withsequence) || !seqit->withsequence);

  if (seqit->exhausted)
  {
    return 0;
  }
  while (true)
  {
    retval = gt_sequence_buffer_next(seqit->fb,&charcode,err);
    if (retval < 0)
    {
      haserr = true;
      break;
    }
    if (retval == 0)
    {
      seqit->exhausted = true;
      break;
    }
    if (seqit->currentread < seqit->maxread)
    {
      seqit->currentread++;
    }
    if (charcode == (GtUchar) GT_SEPARATOR)
    {
      if (seqit->sequencebuffer.nextfreeGtUchar == 0 && seqit->withsequence)
      {
        gt_error_set(err,"sequence "GT_LLU" is empty", seqit->unitnum);
        haserr = true;
        break;
      }
      *desc = (char*) gt_desc_buffer_get_next(seqit->descptr);
      *len = seqit->sequencebuffer.nextfreeGtUchar;
      if (seqit->withsequence)
      {
        /* make sure the outgoing sequence is '\0' terminated */
        seqit->sequencebuffer.spaceGtUchar
          [seqit->sequencebuffer.nextfreeGtUchar] = (GtUchar) '\0';
        *sequence = seqit->sequencebuffer.spaceGtUchar;
      }
      seqit->sequencebuffer.nextfreeGtUchar = 0;
      foundseq = true;
      seqit->unitnum++;
      break;
    }
    if (seqit->withsequence)
    {
      GT_STOREINARRAY(&seqit->sequencebuffer, GtUchar,
                   GT_MAX(1024UL, seqit->sequencebuffer.nextfreeGtUchar * 0.5),
                   charcode);
    } else
    {
      seqit->sequencebuffer.nextfreeGtUchar++;
    }
  }
  if (!haserr && seqit->sequencebuffer.nextfreeGtUchar > 0)
  {
    *desc = (char*) gt_desc_buffer_get_next(seqit->descptr);
    if (seqit->withsequence)
    {
      /* make sure the outgoing sequence is '\0' terminated */
      seqit->sequencebuffer.spaceGtUchar
        [seqit->sequencebuffer.nextfreeGtUchar] = (GtUchar) '\0';
      *sequence = seqit->sequencebuffer.spaceGtUchar;
    }
    *len = seqit->sequencebuffer.nextfreeGtUchar;
    foundseq = true;
    seqit->sequencebuffer.nextfreeGtUchar = 0;
  }
  if (haserr)
  {
    return -1;
  }
  if (foundseq)
  {
    return 1;
  }
  return 0;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movb $0x0, 0x17(%rsp)
movb $0x0, 0x16(%rsp)
cmpq $0x0, 0x48(%rsp)
jne 0x113537
movq 0x528a9a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x402b03(%rip), %rsi    # 0x516013
leaq 0x42edf3(%rip), %rdx    # 0x54230a
leaq 0x42f4f6(%rip), %rcx    # 0x542a14
leaq 0x42f493(%rip), %r8     # 0x5429b8
movl $0x6d, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x113539
jmp 0x11353b
cmpq $0x0, 0x38(%rsp)
je 0x11354b
cmpq $0x0, 0x30(%rsp)
jne 0x113583
movq 0x528a4e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x402ab7(%rip), %rsi    # 0x516013
leaq 0x42f06b(%rip), %rdx    # 0x5425ce
leaq 0x42f4aa(%rip), %rcx    # 0x542a14
leaq 0x42f447(%rip), %r8     # 0x5429b8
movl $0x6e, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x113585
callq 0x113370
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x111820
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x1135af
movq 0x20(%rsp), %rax
testb $0x1, 0x48(%rax)
jne 0x1135f2
movq 0x20(%rsp), %rax
testb $0x1, 0x48(%rax)
je 0x1135f2
movq 0x5289df(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x402a48(%rip), %rsi    # 0x516013
leaq 0x42f467(%rip), %rdx    # 0x542a39
leaq 0x42f43b(%rip), %rcx    # 0x542a14
leaq 0x42f3d8(%rip), %r8     # 0x5429b8
movl $0x71, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1135f4
movq 0x20(%rsp), %rax
testb $0x1, 0x49(%rax)
je 0x11360c
movl $0x0, 0x54(%rsp)
jmp 0x1139f0
jmp 0x11360e
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x28(%rsp), %rdx
leaq 0x1f(%rsp), %rsi
callq 0x1143d0
movl %eax, 0x18(%rsp)
cmpl $0x0, 0x18(%rsp)
jge 0x11363b
movb $0x1, 0x17(%rsp)
jmp 0x113945
cmpl $0x0, 0x18(%rsp)
jne 0x113650
movq 0x20(%rsp), %rax
movb $0x1, 0x49(%rax)
jmp 0x113945
movq 0x20(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x20(%rsp), %rcx
cmpq 0x58(%rcx), %rax
jae 0x113675
movq 0x20(%rsp), %rax
movq 0x50(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x50(%rax)
movzbl 0x1f(%rsp), %eax
cmpl $0xff, %eax
jne 0x113746
movq 0x20(%rsp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x1136c2
movq 0x20(%rsp), %rax
testb $0x1, 0x48(%rax)
je 0x1136c2
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rdx
leaq 0x42f3c2(%rip), %rsi    # 0x542a73
movb $0x0, %al
callq 0xd88c0
movb $0x1, 0x17(%rsp)
jmp 0x113945
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xa4380
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rax
movq 0x38(%rax), %rcx
movq 0x38(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rax
testb $0x1, 0x48(%rax)
je 0x11371e
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x38(%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rcx
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rax
movq $0x0, 0x38(%rax)
movb $0x1, 0x16(%rsp)
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x40(%rax)
jmp 0x113945
movq 0x20(%rsp), %rax
testb $0x1, 0x48(%rax)
je 0x11392f
jmp 0x113757
jmp 0x113759
movq 0x20(%rsp), %rax
movq 0x38(%rax), %rax
addq $0x0, %rax
movq 0x20(%rsp), %rcx
cmpq 0x30(%rcx), %rax
jb 0x1138bf
movq 0x20(%rsp), %rax
movq 0x38(%rax), %xmm1
movaps 0x4051aa(%rip), %xmm0   # 0x518930
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x4051ae(%rip), %xmm0   # 0x518940
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movsd 0x41375f(%rip), %xmm0   # 0x526f08
mulsd %xmm0, %xmm1
movsd 0x40d303(%rip), %xmm0   # 0x520ab8
ucomisd %xmm1, %xmm0
jbe 0x1137ca
movsd 0x40d2f5(%rip), %xmm0   # 0x520ab8
movsd %xmm0, (%rsp)
jmp 0x113807
movq 0x20(%rsp), %rax
movq 0x38(%rax), %xmm0
movaps 0x405155(%rip), %xmm1   # 0x518930
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x405159(%rip), %xmm1   # 0x518940
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x41370a(%rip), %xmm1   # 0x526f08
mulsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movsd (%rsp), %xmm0
movsd 0x40555c(%rip), %xmm2   # 0x518d70
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rcx
cvttsd2si %xmm0, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, 0x8(%rsp)
xorl %eax, %eax
cmpq 0x8(%rsp), %rax
jbe 0x113878
movq 0x528759(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4027c2(%rip), %rsi    # 0x516013
leaq 0x40594f(%rip), %rdx    # 0x5191a7
leaq 0x42f1b5(%rip), %rcx    # 0x542a14
leaq 0x42f152(%rip), %r8     # 0x5429b8
movl $0xa2, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x11387a
movq 0x8(%rsp), %rcx
movq 0x20(%rsp), %rax
addq 0x30(%rax), %rcx
movq %rcx, 0x30(%rax)
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x20(%rsp), %rax
movq 0x30(%rax), %rsi
shlq $0x0, %rsi
leaq 0x42f10f(%rip), %rdx    # 0x5429b8
movl $0xa2, %ecx
callq 0xe8540
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x28(%rax)
jmp 0x1138c1
movq 0x20(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x113905
movq 0x5286cc(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x402735(%rip), %rsi    # 0x516013
leaq 0x42f1a5(%rip), %rdx    # 0x542a8a
leaq 0x42f128(%rip), %rcx    # 0x542a14
leaq 0x42f0c5(%rip), %r8     # 0x5429b8
movl $0xa2, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x113907
jmp 0x113909
movb 0x1f(%rsp), %dl
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rsp), %rsi
movq 0x38(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x38(%rsi)
movb %dl, (%rax,%rcx)
jmp 0x113940
movq 0x20(%rsp), %rax
movq 0x38(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rax)
jmp 0x11360e
testb $0x1, 0x17(%rsp)
jne 0x1139c6
movq 0x20(%rsp), %rax
cmpq $0x0, 0x38(%rax)
jbe 0x1139c6
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xa4380
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rax
testb $0x1, 0x48(%rax)
je 0x1139a3
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x38(%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rcx
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rax
movq 0x38(%rax), %rcx
movq 0x38(%rsp), %rax
movq %rcx, (%rax)
movb $0x1, 0x16(%rsp)
movq 0x20(%rsp), %rax
movq $0x0, 0x38(%rax)
testb $0x1, 0x17(%rsp)
je 0x1139d7
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
jmp 0x1139f0
testb $0x1, 0x16(%rsp)
je 0x1139e8
movl $0x1, 0x54(%rsp)
jmp 0x1139f0
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax)