// File: /workspace/github_c_makefile_star2_O3/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 0xc014f
movq %rdi, %r15
movq 0x38(%rdi), %r14
cmpq %rsi, %r14
jbe 0xc014f
movl %edx, %ebx
movl %edx, %eax
andl $-0x3, %eax
movq %rsi, %rcx
notq %rcx
addq %rcx, %r14
cmpl $0x1, %eax
cmovneq %rsi, %r14
movq 0x30(%r15), %rcx
cmpb $0x1, 0x3a8(%r15)
jne 0xbffec
cmpq %rcx, %r14
jbe 0xbffe4
movl $0x3, %eax
subl %ebx, %eax
leaq (%rcx,%rcx), %rdx
subq %r14, %rdx
movl %eax, %ebx
movq %rdx, %r14
jmp 0xbffec
movb $-0x1, %al
je 0xc0143
cmpq %rcx, %r14
jae 0xc0154
movq 0x280(%r15), %rax
testq %rax, %rax
je 0xc006f
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 0xc00a1
cmpb $0x1, 0x28(%r15)
jne 0xc0131
cmpl 0x170(%r15), %r12d
jne 0xc0131
cmpq $0x2, 0x40(%r15)
jb 0xc005c
movq %r15, %rdi
movq %r14, %rsi
callq *0x160(%r15)
movl %eax, %ecx
movb $-0x1, %al
testb %cl, %cl
jne 0xc0143
movq %r15, %rdi
movq %r14, %rsi
callq *0x140(%r15)
movl %eax, %ecx
movb $-0x2, %al
jmp 0xc00d1
movl (%r15), %eax
testl %eax, %eax
je 0xc00d7
cmpl $0x1, %eax
jne 0xc0159
andl $-0x2, %ebx
cmpl $0x2, %ebx
je 0xc015e
movq %r15, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xc01af
movl (%r15), %eax
cmpl $0x3, %eax
je 0xc00fb
cmpl $0x2, %eax
jne 0xc0163
cmpq $0x1, 0x40(%r15)
je 0xc0131
cmpl 0x170(%r15), %r12d
jne 0xc0131
movq %r15, %rdi
movq %r14, %rsi
callq 0xc0168
movl %eax, %ecx
movb $-0x1, %al
testb %cl, %cl
je 0xc0131
jmp 0xc0143
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 0xc0143
cmpb $0x1, 0x28(%r15)
jne 0xc0131
cmpl $0x1, %r12d
ja 0xc0131
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 0xc0131
cmpl $0x1, %r12d
sete %al
orb $-0x2, %al
jmp 0xc0143
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 0x29fec
callq 0x29f08
callq 0x29fb3
callq 0x29f7a
callq 0x29f41