// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/ft-eoplist.c
// Function: gt_eoplist_reader_next_cigar
bool gt_eoplist_reader_next_cigar(GtCigarOp *cigar_op,
                                  GtEoplistReader *eoplist_reader,
                                  bool distinguish_mismatch_match)
{
  if (eoplist_reader->currenteop == NULL ||
      eoplist_reader->currenteop == eoplist_reader->endeoplist)
  {
    return false;
  }
  gt_assert(eoplist_reader->difference == 1 ||
            eoplist_reader->difference == -1);
  cigar_op->eoptype = GtUndefinedOp;
  cigar_op->iteration = 0;
  while (true)
  {
    if (cigar_op->iteration > 0)
    {
      switch (*eoplist_reader->currenteop)
      {
        case FT_EOPCODE_DELETION:
          gt_assert(cigar_op->eoptype != GtUndefinedOp);
          if (cigar_op->eoptype == GtDeletionOp)
          {
            cigar_op->iteration++; /* Add another consecutive deletion */
            eoplist_reader->currenteop += eoplist_reader->difference;
            break;
          }
          return true;
        case FT_EOPCODE_INSERTION:
          gt_assert(cigar_op->eoptype != GtUndefinedOp);
          if (cigar_op->eoptype == GtInsertionOp)
          {
            cigar_op->iteration++; /* Add another consecutive insertion */
            eoplist_reader->currenteop += eoplist_reader->difference;
            break;
          }
          return true;
       case FT_EOPCODE_MISMATCH:
          gt_assert(cigar_op->eoptype != GtUndefinedOp);
          if (distinguish_mismatch_match)
          {
            if (cigar_op->eoptype == GtMismatchOp)
            {
              cigar_op->iteration++; /* Add another consecutive mismatch */
              eoplist_reader->currenteop += eoplist_reader->difference;
              break;
            }
            return true;
          }
          if (cigar_op->eoptype == GtMatchOp)
          {
            cigar_op->iteration++; /* Add another consecutive match */
            eoplist_reader->currenteop += eoplist_reader->difference;
            break;
          }
          return true;
       default:
          if (cigar_op->eoptype == GtMatchOp)
          {
            gt_assert(*eoplist_reader->currenteop < FT_EOPCODE_MAXMATCHES);
            cigar_op->iteration += (1UL + *eoplist_reader->currenteop);
            eoplist_reader->currenteop += eoplist_reader->difference;
          } else
          {
            return true;
          }
      }
    } else
    {
      switch (*eoplist_reader->currenteop)
      {
        case FT_EOPCODE_DELETION:
          cigar_op->eoptype = GtDeletionOp;
          cigar_op->iteration = 1UL;
          break;
        case FT_EOPCODE_INSERTION:
          cigar_op->eoptype = GtInsertionOp;
          cigar_op->iteration = 1UL;
          break;
        case FT_EOPCODE_MISMATCH:
          cigar_op->eoptype
            = distinguish_mismatch_match ? GtMismatchOp : GtMatchOp;
          cigar_op->iteration = 1UL;
          break;
        default:
          cigar_op->eoptype = GtMatchOp;
          cigar_op->iteration = (1UL + *eoplist_reader->currenteop);
          break;
      }
      eoplist_reader->currenteop += eoplist_reader->difference;
    }
    if (eoplist_reader->currenteop == eoplist_reader->endeoplist)
    {
      return true;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rsi), %rax
testq %rax, %rax
je 0x2b7dfd
movq 0x8(%rsi), %rcx
cmpq %rcx, %rax
je 0x2b7dfd
movslq 0x10(%rsi), %r8
cmpq $-0x1, %r8
je 0x2b7cd2
cmpl $0x1, %r8d
jne 0x2b7eb2
movl $0x4, (%rdi)
andq $0x0, 0x8(%rdi)
movzbl %dl, %r9d
xorl $0x3, %r9d
pushq $0x4
popq %r15
xorl %r14d, %r14d
pushq $0x1
popq %r11
pushq $0x3
popq %rbp
movl %r15d, %r12d
movl %r15d, %r13d
movl %r15d, %ebx
movzbl (%rax), %r10d
testq %r14, %r14
je 0x2b7d2e
cmpq $0xfd, %r10
je 0x2b7d6f
cmpl $0xff, %r10d
je 0x2b7d60
cmpl $0xfe, %r10d
jne 0x2b7d89
testl %r12d, %r12d
jne 0x2b7e44
incq %r14
jmp 0x2b7d53
cmpq $0xfd, %r10
je 0x2b7daf
cmpl $0xff, %r10d
je 0x2b7d97
cmpl $0xfe, %r10d
jne 0x2b7dc4
andl $0x0, (%rdi)
xorl %r15d, %r15d
pushq $0x1
popq %r14
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ebx, %ebx
jmp 0x2b7de6
cmpl $0x1, %r13d
jne 0x2b7e0e
incq %r14
jmp 0x2b7da7
cmpl $0x4, %ebx
je 0x2b7e7a
testb %dl, %dl
je 0x2b7ddc
cmpl $0x2, %ebx
jne 0x2b7df9
incq %r14
pushq $0x2
popq %rbx
jmp 0x2b7de6
cmpl $0x3, %r15d
jne 0x2b7df9
addq %r10, %r14
incq %r14
jmp 0x2b7dd1
movl $0x1, (%rdi)
pushq $0x1
popq %r14
movl %r11d, %r15d
movl %r11d, %r12d
movl %r11d, %r13d
movl %r11d, %ebx
jmp 0x2b7de6
movl %r9d, (%rdi)
pushq $0x1
popq %r14
movl %r9d, %r15d
movl %r9d, %r12d
movl %r9d, %r13d
movl %r9d, %ebx
jmp 0x2b7de6
movl $0x3, (%rdi)
movzbl (%rax), %r14d
incq %r14
movl %ebp, %r15d
movl %ebp, %r12d
movl %ebp, %r13d
jmp 0x2b7de4
cmpl $0x3, %ebx
jne 0x2b7df9
incq %r14
movl %ebp, %ebx
movq %r14, 0x8(%rdi)
addq %r8, %rax
movq %rax, (%rsi)
cmpq %rcx, %rax
jne 0x2b7cfc
movb $0x1, %al
jmp 0x2b7dff
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
cmpl $0x4, %r13d
jne 0x2b7dff
movq 0x18014b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2d1ec(%rip), %rsi     # 0x2e5013
leaq 0xcb3f4(%rip), %rdx     # 0x383222
leaq 0xcb3d0(%rip), %rcx     # 0x383205
leaq 0xcb194(%rip), %r8      # 0x382fd0
movl $0x188, %r9d            # imm = 0x188
jmp 0x2b7ea6
movb $0x1, %al
cmpl $0x4, %r12d
jne 0x2b7dff
movq 0x180115(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2d1b6(%rip), %rsi     # 0x2e5013
leaq 0xcb3be(%rip), %rdx     # 0x383222
leaq 0xcb39a(%rip), %rcx     # 0x383205
leaq 0xcb15e(%rip), %r8      # 0x382fd0
movl $0x17f, %r9d            # imm = 0x17F
jmp 0x2b7ea6
movq 0x1800e7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2d188(%rip), %rsi     # 0x2e5013
leaq 0xcb390(%rip), %rdx     # 0x383222
leaq 0xcb36c(%rip), %rcx     # 0x383205
leaq 0xcb130(%rip), %r8      # 0x382fd0
movl $0x191, %r9d            # imm = 0x191
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x1800af(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2d150(%rip), %rsi     # 0x2e5013
leaq 0xcb2f7(%rip), %rdx     # 0x3831c1
leaq 0xcb334(%rip), %rcx     # 0x383205
leaq 0xcb0f8(%rip), %r8      # 0x382fd0
movl $0x175, %r9d            # imm = 0x175
jmp 0x2b7ea6