// File: /workspace/github_c_makefile_star2_O2/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 0xa2199
movq %rdi, %r15
movq 0x38(%rdi), %r14
cmpq %rsi, %r14
jbe 0xa2199
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 0xa2036
cmpq %rcx, %r14
jbe 0xa202e
pushq $0x3
popq %rax
subl %ebx, %eax
leaq (%rcx,%rcx), %rdx
subq %r14, %rdx
movl %eax, %ebx
movq %rdx, %r14
jmp 0xa2036
movb $-0x1, %al
je 0xa218d
cmpq %rcx, %r14
jae 0xa21c7
movq 0x280(%r15), %rax
testq %rax, %rax
je 0xa20b9
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 0xa20eb
cmpb $0x1, 0x28(%r15)
jne 0xa217b
cmpl 0x170(%r15), %r12d
jne 0xa217b
cmpq $0x2, 0x40(%r15)
jb 0xa20a6
movq %r15, %rdi
movq %r14, %rsi
callq *0x160(%r15)
movl %eax, %ecx
movb $-0x1, %al
testb %cl, %cl
jne 0xa218d
movq %r15, %rdi
movq %r14, %rsi
callq *0x140(%r15)
movl %eax, %ecx
movb $-0x2, %al
jmp 0xa211b
movl (%r15), %eax
testl %eax, %eax
je 0xa2121
cmpl $0x1, %eax
jne 0xa21ff
andl $-0x2, %ebx
cmpl $0x2, %ebx
je 0xa222d
movq %r15, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xa2358
movl (%r15), %eax
cmpl $0x3, %eax
je 0xa2145
cmpl $0x2, %eax
jne 0xa225b
cmpq $0x1, 0x40(%r15)
je 0xa217b
cmpl 0x170(%r15), %r12d
jne 0xa217b
movq %r15, %rdi
movq %r14, %rsi
callq 0xa228c
movl %eax, %ecx
movb $-0x1, %al
testb %cl, %cl
je 0xa217b
jmp 0xa218d
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 0xa218d
cmpb $0x1, 0x28(%r15)
jne 0xa217b
cmpl $0x1, %r12d
ja 0xa217b
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 0xa217b
cmpl $0x1, %r12d
sete %al
orb $-0x2, %al
jmp 0xa218d
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
movq 0x8be18(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x27ebc(%rip), %rsi     # 0xca066
leaq 0x49a41(%rip), %rdx     # 0xebbf2
leaq 0x49a6d(%rip), %rcx     # 0xebc25
leaq 0x499db(%rip), %r8      # 0xebb9a
movl $0xfe, %r9d
jmp 0xa21f3
movq 0x8bdea(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x27e8e(%rip), %rsi     # 0xca066
leaq 0x4d9a2(%rip), %rdx     # 0xefb81
leaq 0x49a3f(%rip), %rcx     # 0xebc25
leaq 0x499ad(%rip), %r8      # 0xebb9a
movl $0x10d, %r9d            # imm = 0x10D
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0x8bdb2(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x27e56(%rip), %rsi     # 0xca066
leaq 0x49a6f(%rip), %rdx     # 0xebc86
leaq 0x49a07(%rip), %rcx     # 0xebc25
leaq 0x49975(%rip), %r8      # 0xebb9a
movl $0x145, %r9d            # imm = 0x145
jmp 0xa21f3
movq 0x8bd84(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x27e28(%rip), %rsi     # 0xca066
leaq 0x49a23(%rip), %rdx     # 0xebc68
leaq 0x499d9(%rip), %rcx     # 0xebc25
leaq 0x49947(%rip), %r8      # 0xebb9a
movl $0x13f, %r9d            # imm = 0x13F
jmp 0xa21f3
movq 0x8bd56(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x27dfa(%rip), %rsi     # 0xca066
leaq 0x499cd(%rip), %rdx     # 0xebc40
leaq 0x499ab(%rip), %rcx     # 0xebc25
leaq 0x49919(%rip), %r8      # 0xebb9a
movl $0x130, %r9d            # imm = 0x130
jmp 0xa21f3