// File: /workspace/github_c_makefile_star2_O1/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 0xbf69d
movq %rdi, %rbx
movq 0x10(%rdi), %rcx
cmpq 0x38(%rax), %rcx
jae 0xbf69d
cmpb $0x1, 0x3a8(%rax)
jne 0xbf60a
cmpq 0x30(%rax), %rcx
jne 0xbf60a
cmpb $0x0, 0x20(%rbx)
jne 0xbf598
movl 0x8(%rbx), %edx
movl $0x3, %esi
subl %edx, %esi
movl %esi, 0x8(%rbx)
testl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
jne 0xbf6ac
leaq -0x1(%rcx), %rdx
movq %rdx, 0x10(%rbx)
cmpb $0x1, 0x3a9(%rax)
jne 0xbf683
cmpb $0x1, 0x29(%rax)
jne 0xbf5d2
cmpq $0x0, 0x28(%rbx)
je 0xbf6b1
movq %rbx, %rdi
xorl %esi, %esi
callq 0xbf6bb
movq %rbx, %rdi
xorl %esi, %esi
callq 0xbfe27
movq (%rbx), %rax
movb $-0x1, %bpl
cmpq $0x2, 0x40(%rax)
jb 0xbf66b
cmpq $0x0, 0x30(%rbx)
je 0xbf6b6
movq %rbx, %rdi
movl $0x1, %esi
callq 0xbf6bb
movq %rbx, %rdi
movl $0x1, %esi
callq 0xbfe27
jmp 0xbf66b
cmpq 0x30(%rax), %rcx
jae 0xbf6a2
movl 0x8(%rbx), %edi
cmpq $0x3, %rdi
ja 0xbf6a7
leaq 0x43198(%rip), %rcx     # 0x1027c0
movslq (%rcx,%rdi,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movq %rbx, %rdi
callq *0x110(%rax)
incq 0x10(%rbx)
jmp 0xbf67c
movq %rbx, %rdi
callq *0x110(%rax)
incq 0x10(%rbx)
jmp 0xbf65c
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
jmp 0xbf67c
movq %rbx, %rdi
callq *0x110(%rax)
decq 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movb $-0x1, %bpl
cmpl $0x2, (%rax)
jne 0xbf66b
movq %rcx, 0x10(%rbx)
movq %rbx, %rdi
callq 0xbfe59
decq 0x10(%rbx)
jmp 0xbf66b
callq 0x2a712
callq 0x2a60b
callq 0x2a644
callq 0x2a667
callq 0x2a6d9
callq 0x2a6a0