// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/encseq.c
// Function: gt_encseq_reader_next_decoded_char
char gt_encseq_reader_next_decoded_char(GtEncseqReader *esr)
{
  char cc = GT_UNDEF_CHAR;
  gt_assert(esr && esr->encseq && esr->encseq->alpha);
  if (!esr->encseq->has_exceptiontable) {
    /* no lossless support available, we need to do simple decoding */
    GtUchar mycc = gt_encseq_reader_next_encoded_char(esr);
    if (mycc != (GtUchar) GT_SEPARATOR)
      cc = gt_alphabet_decode(esr->encseq->alpha, mycc);
    else
      cc = (char) mycc;
    return cc;
  } else {
    GtUchar ccc;
    gt_assert(esr->encseq
              && esr->currentpos < esr->encseq->logicaltotallength);
    /* if we have mirroring enabled, we need to check whether we cross the
       boundary between real and virtual sequences, turn around if necessary */
    if (esr->encseq->hasmirror && esr->currentpos == esr->encseq->totallength) {
      if (!esr->startedonmiddle) {
        /* only turn around if we arrived from complementary side */
        gt_readmode_invert(esr->readmode);
        /* from now on, we can only go backwards on the original sequence! */
        gt_assert(GT_ISDIRREVERSE(esr->readmode));
      }
      /* go back */
      esr->currentpos--;
      if (esr->encseq->accesstype_via_utables) {
        /* prepare esr for directional change */
        if (esr->encseq->has_wildcardranges) {
          gt_assert(esr->wildcardrangestate != NULL);
          binpreparenextrangeGtEncseqReader(esr, SWtable_wildcardrange);
          advancerangeGtEncseqReader(esr, SWtable_wildcardrange);
        }
        if (esr->encseq->numofdbsequences > 1UL) {
          gt_assert(esr->ssptabstate != NULL);
          binpreparenextrangeGtEncseqReader(esr, SWtable_ssptab);
          advancerangeGtEncseqReader(esr, SWtable_ssptab);
        }
      }
      else {
        if (esr->encseq->sat == GT_ACCESS_TYPE_EQUALLENGTH) {
          esr->currentpos++;
          singlepositioninseparatorViaequallength_updatestate(esr);
          esr->currentpos--;
        }
      }
      return (char) GT_SEPARATOR;
    }
    gt_assert(esr && esr->currentpos < esr->encseq->totallength);

    ccc = esr->encseq->seqdeliverchar(esr);
    if (ccc != (GtUchar) GT_SEPARATOR) {
      GtUword mappos = GT_UNDEF_UWORD;
      if (esr->encseq->specialcharinfo.realexceptionranges > 0UL
            && esr->encseq->getexceptionmapping(esr->encseq,
                                                &mappos, esr->currentpos)) {
        /* if the character at this position is not the most frequent in
           its class, look up its exception */
        unsigned char subalphcode = (unsigned char)
                                bitpackarray_get_uint32(esr->encseq->exceptions,
                                                        (BitOffset) mappos);
        gt_assert(subalphcode < esr->encseq->maxsubalphasize);
        /* and map it back to the original character */
        cc = esr->encseq->allchars[esr->encseq->classstartpositions[(int) ccc]
                                     + subalphcode];
      } else {
        /* otherwise return most frequent character */
        cc = esr->encseq->maxchars[(int) ccc];
      }
      gt_assert(cc != GT_UNDEF_CHAR);
    } else {
      cc = (char) GT_SEPARATOR;
    }
    switch (esr->readmode) {
      case GT_READMODE_FORWARD:
        esr->currentpos++;
        return cc;
      case GT_READMODE_REVERSE:
        esr->currentpos--;
        return cc;
      case GT_READMODE_COMPL: /* only works with dna */
        esr->currentpos++;
        if (cc != (char) GT_SEPARATOR)
          (void) gt_complement(&cc, cc, NULL);
        return cc;
      case GT_READMODE_REVCOMPL: /* only works with dna */
        esr->currentpos--;
        if (cc != (char) GT_SEPARATOR)
          (void) gt_complement(&cc, cc, NULL);
        return cc;
      default:
        fprintf(stderr, "gt_encseq_next_encoded_char: "
                       "readmode %d not implemented\n", (int) esr->readmode);
        exit(GT_EXIT_PROGRAMMING_ERROR);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0xa364a
movq %rdi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0xa364a
cmpq $0x0, 0x220(%rax)
je 0xa364a
cmpb $0x0, 0x2f0(%rax)
je 0xa34cd
movq 0x10(%rbx), %rcx
cmpq 0x38(%rax), %rcx
jae 0xa3682
movq 0x30(%rax), %rdx
cmpq %rdx, %rcx
sete %sil
andb 0x3a8(%rax), %sil
cmpb $0x1, %sil
jne 0xa34f7
cmpb $0x0, 0x20(%rbx)
jne 0xa3458
movl 0x8(%rbx), %edx
pushq $0x3
popq %rsi
subl %edx, %esi
movl %esi, 0x8(%rbx)
testl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
jne 0xa36de
leaq -0x1(%rcx), %rdx
movq %rdx, 0x10(%rbx)
cmpb $0x1, 0x3a9(%rax)
jne 0xa357f
cmpb $0x1, 0x29(%rax)
jne 0xa3495
cmpq $0x0, 0x28(%rbx)
je 0xa370f
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa2bb3
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa32f8
movq (%rbx), %rax
movb $-0x1, %bpl
cmpq $0x2, 0x40(%rax)
jb 0xa363f
cmpq $0x0, 0x30(%rbx)
je 0xa3740
pushq $0x1
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
callq 0xa2bb3
movq %rbx, %rdi
movl %r14d, %esi
callq 0xa32f8
jmp 0xa363f
movq %rbx, %rdi
callq 0xa2941
cmpb $-0x1, %al
je 0xa363c
movq (%rbx), %rcx
movq 0x220(%rcx), %rdi
movzbl %al, %esi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x9bed8
cmpq %rdx, %rcx
jae 0xa36b0
movq %rbx, %rdi
callq *0x110(%rax)
cmpb $-0x1, %al
je 0xa35e3
movl %eax, %ebp
orq $-0x1, 0x8(%rsp)
movq (%rbx), %rdi
cmpq $0x0, 0x1e0(%rdi)
je 0xa3599
movq 0x10(%rbx), %rdx
leaq 0x8(%rsp), %rsi
callq *0x150(%rdi)
movq (%rbx), %rdi
testb %al, %al
je 0xa3599
movq 0x330(%rdi), %rdi
movq 0x8(%rsp), %rsi
callq 0xa258b
movzbl %al, %ecx
movq (%rbx), %rax
movzbl 0x360(%rax), %edx
cmpl %edx, %ecx
jae 0xa3791
movq 0x338(%rax), %rdx
movq 0x350(%rax), %rax
movzbl %bpl, %esi
movl %ecx, %ecx
addq (%rdx,%rsi,8), %rax
addq %rcx, %rax
jmp 0xa35a4
movb $-0x1, %bpl
cmpl $0x2, (%rax)
jne 0xa363f
movq %rcx, 0x10(%rbx)
movq %rbx, %rdi
callq 0xa3350
jmp 0xa360e
movzbl %bpl, %eax
addq 0x348(%rdi), %rax
movb (%rax), %bpl
movb %bpl, 0x7(%rsp)
cmpb $0x7f, %bpl
jne 0xa35eb
movq 0x8a9ff(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x26aa3(%rip), %rsi     # 0xca066
leaq 0x48999(%rip), %rdx     # 0xebf63
leaq 0x48944(%rip), %rcx     # 0xebf15
leaq 0x485c2(%rip), %r8      # 0xebb9a
movl $0x28a, %r9d            # imm = 0x28A
jmp 0xa3676
movb $-0x1, 0x7(%rsp)
movb $-0x1, %bpl
movl 0x8(%rbx), %edx
cmpq $0x3, %rdx
ja 0xa3771
leaq 0x483c1(%rip), %rax     # 0xeb9c0
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
incq 0x10(%rbx)
jmp 0xa363f
decq 0x10(%rbx)
jmp 0xa363f
incq 0x10(%rbx)
jmp 0xa361e
decq 0x10(%rbx)
cmpb $-0x1, %bpl
je 0xa363c
movsbl %bpl, %esi
leaq 0x7(%rsp), %rbx
movq %rbx, %rdi
xorl %edx, %edx
callq 0xa1140
movb (%rbx), %bpl
jmp 0xa363f
movb $-0x1, %bpl
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x8a967(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x26a0b(%rip), %rsi     # 0xca066
leaq 0x4888a(%rip), %rdx     # 0xebeec
leaq 0x488ac(%rip), %rcx     # 0xebf15
leaq 0x4852a(%rip), %r8      # 0xebb9a
movl $0x247, %r9d            # imm = 0x247
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0x8a92f(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x269d3(%rip), %rsi     # 0xca066
leaq 0x4874a(%rip), %rdx     # 0xebde4
leaq 0x48874(%rip), %rcx     # 0xebf15
leaq 0x484f2(%rip), %r8      # 0xebb9a
movl $0x253, %r9d            # imm = 0x253
jmp 0xa3676
movq 0x8a901(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x269a5(%rip), %rsi     # 0xca066
leaq 0x487b9(%rip), %rdx     # 0xebe81
leaq 0x48846(%rip), %rcx     # 0xebf15
leaq 0x484c4(%rip), %r8      # 0xebb9a
movl $0x275, %r9d            # imm = 0x275
jmp 0xa3676
movq 0x8a8d3(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x26977(%rip), %rsi     # 0xca066
leaq 0x4c324(%rip), %rdx     # 0xefa1a
leaq 0x48818(%rip), %rcx     # 0xebf15
leaq 0x48496(%rip), %r8      # 0xebb9a
movl $0x25b, %r9d            # imm = 0x25B
jmp 0xa3676
movq 0x8a8a2(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x26946(%rip), %rsi     # 0xca066
leaq 0x48721(%rip), %rdx     # 0xebe48
leaq 0x487e7(%rip), %rcx     # 0xebf15
leaq 0x48465(%rip), %r8      # 0xebb9a
movl $0x262, %r9d            # imm = 0x262
jmp 0xa3676
movq 0x8a871(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x26915(%rip), %rsi     # 0xca066
leaq 0x48710(%rip), %rdx     # 0xebe68
leaq 0x487b6(%rip), %rcx     # 0xebf15
leaq 0x48434(%rip), %r8      # 0xebb9a
movl $0x267, %r9d            # imm = 0x267
jmp 0xa3676
movq 0x8a840(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x487f5(%rip), %rsi     # 0xebf77
xorl %eax, %eax
callq 0xb8c0
pushq $0x2
popq %rdi
callq 0xb7b0
movq 0x8a820(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x268c4(%rip), %rsi     # 0xca066
leaq 0x4878f(%rip), %rdx     # 0xebf38
leaq 0x48765(%rip), %rcx     # 0xebf15
leaq 0x483e3(%rip), %r8      # 0xebb9a
movl $0x282, %r9d            # imm = 0x282
jmp 0xa3676