// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/rdj-contfinder.c
// Function: gt_contfinder_get_code
static inline GtContfinderKmercodeWithOverflow gt_contfinder_get_code(
    const GtTwobitencoding *twobitencoding, gt_contfinder_seqnum_t seqnum,
    const size_t depth, const gt_contfinder_seqnum_t firstrevcompl, size_t len,
    const size_t *seppos)
{
  GtContfinderKmercodeWithOverflow k;
  size_t remaining, seqstart;

  if (seqnum < firstrevcompl)
  {
    if (len != 0)
    {
      seqstart = seqnum * len;
    }
    else
    {
      gt_assert(seppos != NULL);
      seqstart = (seqnum > 0) ? seppos[seqnum - 1] + 1 : 0;
      len = seppos[seqnum] - seqstart + 1;
    }
    if (depth < len - 1)
    {
      k.code = gt_contfinder_code_at_position(twobitencoding, seqstart + depth);
      k.overflow = 0;
      remaining = len - 1 - depth;
      if (remaining < GT_CONTFINDER_KMERSIZE)
      {
        k.overflow = GT_CONTFINDER_KMERSIZE -
          (gt_contfinder_overflow_t)remaining;
        k.code &= (GT_CONTFINDER_KMERCODE_MAX - ((1 << (k.overflow << 1)) - 1));
      }
    }
    else
    {
      k.code = 0;
      k.overflow = GT_CONTFINDER_KMERSIZE;
    }
    return k;
  }
  else
  {
    size_t pos;
    if (len != 0)
    {
      pos = ((firstrevcompl << 1) - seqnum) * len - 1 - depth;
    }
    else
    {
      seqnum = (firstrevcompl << 1) - seqnum - 1;
      gt_assert(seppos != NULL);
      pos = seppos[seqnum] - depth;
      seqstart = (seqnum > 0) ? seppos[seqnum - 1] + 1 : 0;
      len = seppos[seqnum] - seqstart + 1;
    }
    if (depth < len - 1)
    {
      remaining = len - 1 - depth;
      pos -= (remaining > GT_CONTFINDER_KMERSIZE) ? GT_CONTFINDER_KMERSIZE :
        remaining;
      k.overflow = 0;
      k.code = GT_CONTFINDER_REVCOMPL(
          gt_contfinder_code_at_position(twobitencoding, pos));
      if (remaining < GT_CONTFINDER_KMERSIZE)
      {
        k.overflow = GT_CONTFINDER_KMERSIZE - remaining;
        k.code <<= (k.overflow << 1);
      }
    }
    else
    {
      k.code = 0;
      k.overflow = GT_CONTFINDER_KMERSIZE;
    }
    return k;
  }
}

// Assembly:
pushq %rax
cmpl %ecx, %esi
jae 0x1c537e
testq %r8, %r8
je 0x1c539c
movl %esi, %r10d
imulq %r8, %r10
decq %r8
jmp 0x1c53e1
addl %ecx, %ecx
testq %r8, %r8
je 0x1c53b5
subl %esi, %ecx
imulq %r8, %rcx
movq %rdx, %rsi
notq %rsi
addq %rcx, %rsi
decq %r8
jmp 0x1c5450
testq %r9, %r9
je 0x1c54e5
testl %esi, %esi
je 0x1c53d5
leal -0x1(%rsi), %eax
movq (%r9,%rax,8), %r10
incq %r10
jmp 0x1c53d8
testq %r9, %r9
je 0x1c54ea
notl %esi
addl %esi, %ecx
movl %ecx, %eax
movq (%r9,%rax,8), %rsi
je 0x1c5447
decl %ecx
movq (%r9,%rcx,8), %r8
notq %r8
jmp 0x1c544a
xorl %r10d, %r10d
movl %esi, %eax
movq (%r9,%rax,8), %r8
subq %r10, %r8
subq %rdx, %r8
jbe 0x1c548a
addq %rdx, %r10
movl %r10d, %ecx
andl $0x1f, %ecx
movq %r10, %rdx
shrq $0x5, %rdx
cmpl $0x1c, %ecx
ja 0x1c5414
movq (%rdi,%rdx,8), %rax
addl %r10d, %r10d
andb $0x3e, %r10b
movb $0x38, %cl
subb %r10b, %cl
shrq %cl, %rax
jmp 0x1c5426
addl %ecx, %ecx
addb $-0x38, %cl
movq (%rdi,%rdx,8), %rax
movq 0x8(%rdi,%rdx,8), %rdx
shldq %cl, %rdx, %rax
cmpq $0x3, %r8
ja 0x1c54d6
movb $0x4, %dl
subb %r8b, %dl
leal (%rdx,%rdx), %ecx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
shll %cl, %esi
andb %sil, %al
jmp 0x1c54d8
xorl %r8d, %r8d
addq %rsi, %r8
subq %rdx, %rsi
subq %rdx, %r8
jbe 0x1c548a
cmpq $0x4, %r8
movl $0x4, %eax
cmovbq %r8, %rax
subq %rax, %rsi
movl %esi, %ecx
andl $0x1f, %ecx
movq %rsi, %rdx
shrq $0x5, %rdx
cmpl $0x1c, %ecx
ja 0x1c5490
movq (%rdi,%rdx,8), %rax
addl %esi, %esi
andb $0x3e, %sil
movb $0x38, %cl
subb %sil, %cl
shrq %cl, %rax
jmp 0x1c54a2
movb $0x4, %dl
xorl %eax, %eax
jmp 0x1c54d8
addl %ecx, %ecx
addb $-0x38, %cl
movq (%rdi,%rdx,8), %rax
movq 0x8(%rdi,%rdx,8), %rdx
shldq %cl, %rdx, %rax
movl %eax, %ecx
shrb $0x6, %cl
movl %eax, %edx
shlb $0x6, %dl
orb %cl, %dl
movl %eax, %ecx
shrb $0x2, %cl
andb $0xc, %cl
orb %dl, %cl
shlb $0x2, %al
andb $0x30, %al
orb %cl, %al
notb %al
cmpq $0x3, %r8
ja 0x1c54d6
movb $0x4, %dl
subb %r8b, %dl
leal (%rdx,%rdx), %ecx
movzbl %al, %eax
shll %cl, %eax
jmp 0x1c54d8
xorl %edx, %edx
movzbl %dl, %ecx
shll $0x8, %ecx
movzbl %al, %eax
orl %ecx, %eax
popq %rcx
retq
callq 0x69b4a
callq 0x69b11