// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/core/encseq.c
// Function: gt_encseq_get_encoded_char
GtUchar gt_encseq_get_encoded_char(const GtEncseq *encseq,
                                   GtUword pos,
                                   GtReadmode readmode)
{
  gt_assert(encseq != NULL && pos < encseq->logicaltotallength);
  /* translate into forward coords */
  if (GT_ISDIRREVERSE(readmode)) {
    pos = GT_REVERSEPOS(encseq->logicaltotallength, pos);
  }
  /* handle virtual coordinates */
  if (encseq->hasmirror) {
    if (pos > encseq->totallength) {
      /* invert coordinates and readmode */
      gt_readmode_invert(readmode);
      pos = GT_REVERSEPOS(encseq->totallength, pos - encseq->totallength - 1);
    } else if (pos == encseq->totallength) {
      return (GtUchar) GT_SEPARATOR;
    }
  }
  gt_assert(pos < encseq->totallength);
  if (encseq->twobitencoding != NULL) {
    GtUword twobits;

    twobits = EXTRACTENCODEDCHAR(encseq->twobitencoding, pos);
    if (encseq->accesstype_via_utables) {
      if (!encseq->has_specialranges ||
          twobits != (GtUword) encseq->leastprobablecharacter) {
        return GT_ISDIRCOMPLEMENT(readmode)
                 ? GT_COMPLEMENTBASE((GtUchar) twobits)
                 : (GtUchar) twobits;
      }
      if (encseq->numofdbsequences > 1UL &&
          encseq->issinglepositionseparator(encseq, pos)) {
        return (GtUchar) GT_SEPARATOR;
      }
      if (encseq->issinglepositioninwildcardrange(encseq, pos))
        return (GtUchar) GT_WILDCARD;

      return GT_ISDIRCOMPLEMENT(readmode)
               ? GT_COMPLEMENTBASE((GtUchar) twobits)
               : (GtUchar) twobits;
    }
    else {
      if (encseq->sat == GT_ACCESS_TYPE_EQUALLENGTH) {
        if (encseq->numofdbsequences == 1UL ||
            twobits != (GtUword) encseq->leastprobablecharacter ||
            !issinglepositioninspecialrangeViaequallength(encseq, pos)) {
          return GT_ISDIRCOMPLEMENT(readmode)
                   ? GT_COMPLEMENTBASE((GtUchar) twobits)
                   : (GtUchar) twobits;
        }
        return (GtUchar) GT_SEPARATOR;
      }
      else {
        gt_assert(encseq->sat == GT_ACCESS_TYPE_BITACCESS);
        if (!encseq->has_specialranges ||
            twobits > (GtUword) GT_TWOBITS_FOR_SEPARATOR ||
            !GT_ISIBITSET(encseq->specialbits, pos)) {
          return GT_ISDIRCOMPLEMENT(readmode)
                   ? GT_COMPLEMENTBASE((GtUchar) twobits)
                   : (GtUchar) twobits;
        }
        return (twobits == (GtUword) GT_TWOBITS_FOR_SEPARATOR)
                   ? (GtUchar) GT_SEPARATOR
                   : (GtUchar) GT_WILDCARD;
      }
    }
  }
  if (encseq->sat == GT_ACCESS_TYPE_BYTECOMPRESS) {
    gt_assert(!GT_ISDIRCOMPLEMENT(readmode));
    return delivercharViabytecompress(encseq, pos);
  }
  else {
    GtUchar cc;

    gt_assert(encseq->sat == GT_ACCESS_TYPE_DIRECTACCESS);
    cc = encseq->plainseq[pos];
    return (GT_ISNOTSPECIAL(cc) && GT_ISDIRCOMPLEMENT(readmode))
           ? GT_COMPLEMENTBASE(cc)
           : cc;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xbf147
movq %rdi, %r15
movq 0x38(%rdi), %r14
cmpq %rsi, %r14
jbe 0xbf147
movl %edx, %ebx
movl %edx, %eax
andl $-0x3, %eax
movq %rsi, %rcx
notq %rcx
addq %rcx, %r14
cmpl $0x1, %eax
cmovneq %rsi, %r14
cmpb $0x1, 0x3a8(%r15)
jne 0xbefe3
movq 0x30(%r15), %rax
cmpq %rax, %r14
jbe 0xbefdb
movl $0x3, %ecx
subl %ebx, %ecx
addq %rax, %rax
subq %r14, %rax
movl %ecx, %ebx
movq %rax, %r14
jmp 0xbefe3
movb $-0x1, %al
je 0xbf13b
cmpq 0x30(%r15), %r14
jae 0xbf14c
movq 0x280(%r15), %rax
testq %rax, %rax
je 0xbf067
movq %r14, %rcx
shrq $0x5, %rcx
movq (%rax,%rcx,8), %r12
movl %r14d, %ecx
notl %ecx
addl %ecx, %ecx
shrq %cl, %r12
andl $0x3, %r12d
cmpb $0x1, 0x3a9(%r15)
jne 0xbf099
cmpb $0x1, 0x28(%r15)
jne 0xbf129
cmpl 0x170(%r15), %r12d
jne 0xbf129
cmpq $0x2, 0x40(%r15)
jb 0xbf054
movq %r15, %rdi
movq %r14, %rsi
callq *0x160(%r15)
movl %eax, %ecx
movb $-0x1, %al
testb %cl, %cl
jne 0xbf13b
movq %r15, %rdi
movq %r14, %rsi
callq *0x140(%r15)
movl %eax, %ecx
movb $-0x2, %al
jmp 0xbf0c9
movl (%r15), %eax
testl %eax, %eax
je 0xbf0cf
cmpl $0x1, %eax
jne 0xbf151
andl $-0x2, %ebx
cmpl $0x2, %ebx
je 0xbf156
movq %r15, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xbf1a7
movl (%r15), %eax
cmpl $0x3, %eax
je 0xbf0f3
cmpl $0x2, %eax
jne 0xbf15b
cmpq $0x1, 0x40(%r15)
je 0xbf129
cmpl 0x170(%r15), %r12d
jne 0xbf129
movq %r15, %rdi
movq %r14, %rsi
callq 0xbf160
movl %eax, %ecx
movb $-0x1, %al
testb %cl, %cl
je 0xbf129
jmp 0xbf13b
movq 0x290(%r15), %rax
movzbl (%rax,%r14), %ecx
andl $-0x2, %ebx
movb $0x3, %al
subb %cl, %al
cmpl $0x2, %ebx
movzbl %al, %eax
cmovnel %ecx, %eax
cmpb $-0x2, %cl
cmovael %ecx, %eax
jmp 0xbf13b
cmpb $0x1, 0x28(%r15)
jne 0xbf129
cmpl $0x1, %r12d
ja 0xbf129
movq 0x2b0(%r15), %rax
movq %r14, %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rax
movl %r14d, %ecx
shlq %cl, %rax
shrq $0x3f, %rax
je 0xbf129
cmpl $0x1, %r12d
sete %al
orb $-0x2, %al
jmp 0xbf13b
andl $-0x2, %ebx
movl %r12d, %eax
xorb $0x3, %al
cmpl $0x2, %ebx
movzbl %al, %eax
cmovnel %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x2a1e7
callq 0x2a103
callq 0x2a1ae
callq 0x2a175
callq 0x2a13c