// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/core/encseq.c
// Function: gt_encseq_reader_next_encoded_char
GtUchar gt_encseq_reader_next_encoded_char(GtEncseqReader *esr)
{
  GtUchar cc;
  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 (GtUchar) GT_SEPARATOR;
  }
  gt_assert(esr && esr->currentpos < esr->encseq->totallength);

  switch (esr->readmode) {
    case GT_READMODE_FORWARD:
      cc = esr->encseq->seqdeliverchar(esr);
      esr->currentpos++;
      return cc;
    case GT_READMODE_REVERSE:
      cc = esr->encseq->seqdeliverchar(esr);
      esr->currentpos--;
      return cc;
    case GT_READMODE_COMPL: /* only works with dna */
      cc = esr->encseq->seqdeliverchar(esr);
      esr->currentpos++;
      return GT_ISSPECIAL(cc) ? cc : GT_COMPLEMENTBASE(cc);
    case GT_READMODE_REVCOMPL: /* only works with dna */
      cc = esr->encseq->seqdeliverchar(esr);
      esr->currentpos--;
      return GT_ISSPECIAL(cc) ? cc : GT_COMPLEMENTBASE(cc);
    default:
      fprintf(stderr, "gt_encseq_get_encoded_char: "
                     "readmode %d not implemented\n", (int) esr->readmode);
      exit(GT_EXIT_PROGRAMMING_ERROR);
  }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq (%rdi), %rax
testq %rax, %rax
je 0xc06ad
movq %rdi, %rbx
movq 0x10(%rdi), %rcx
cmpq 0x38(%rax), %rcx
jae 0xc06ad
movq 0x30(%rax), %rdx
cmpq %rdx, %rcx
sete %sil
andb 0x3a8(%rax), %sil
cmpb $0x1, %sil
jne 0xc061b
cmpb $0x0, 0x20(%rbx)
jne 0xc05a9
movl 0x8(%rbx), %edx
movl $0x3, %esi
subl %edx, %esi
movl %esi, 0x8(%rbx)
testl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
jne 0xc06b7
leaq -0x1(%rcx), %rdx
movq %rdx, 0x10(%rbx)
cmpb $0x1, 0x3a9(%rax)
jne 0xc0650
cmpb $0x1, 0x29(%rax)
jne 0xc05e6
cmpq $0x0, 0x28(%rbx)
je 0xc06bc
movq %rbx, %rdi
xorl %esi, %esi
callq 0xc06cb
movq %rbx, %rdi
xorl %esi, %esi
callq 0xc0ec5
movq (%rbx), %rax
movb $-0x1, %bpl
cmpq $0x2, 0x40(%rax)
jb 0xc0695
cmpq $0x0, 0x30(%rbx)
je 0xc06c1
movq %rbx, %rdi
movl $0x1, %esi
callq 0xc06cb
movq %rbx, %rdi
movl $0x1, %esi
callq 0xc0ec5
jmp 0xc0695
cmpq %rdx, %rcx
jae 0xc06b2
movl 0x8(%rbx), %edi
cmpq $0x3, %rdi
ja 0xc06c6
leaq 0x420f8(%rip), %rcx     # 0x102730
movslq (%rcx,%rdi,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movq %rbx, %rdi
callq *0x110(%rax)
incq 0x10(%rbx)
jmp 0xc0697
movb $-0x1, %bpl
cmpl $0x2, (%rax)
jne 0xc0695
movq %rcx, 0x10(%rbx)
movq %rbx, %rdi
callq 0xc0ef7
decq 0x10(%rbx)
jmp 0xc0695
movq %rbx, %rdi
callq *0x110(%rax)
incq 0x10(%rbx)
jmp 0xc0686
movq %rbx, %rdi
callq *0x110(%rax)
decq 0x10(%rbx)
movb $0x3, %cl
subb %al, %cl
cmpb $-0x2, %al
movzbl %al, %eax
movzbl %cl, %ebp
cmovael %eax, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
callq *0x110(%rax)
decq 0x10(%rbx)
jmp 0xc0697
callq 0x2a517
callq 0x2a410
callq 0x2a46c
callq 0x2a4de
callq 0x2a4a5
callq 0x2a449