// File: /workspace/github_c_makefile_star2_O1/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 %rbx
cmpl %ecx, %esi
jae 0x1ce524
testq %r8, %r8
je 0x1ce542
movl %esi, %eax
imulq %r8, %rax
decq %r8
jmp 0x1ce586
addl %ecx, %ecx
testq %r8, %r8
je 0x1ce55b
subl %esi, %ecx
imulq %r8, %rcx
movq %rdx, %rsi
notq %rsi
addq %rcx, %rsi
decq %r8
jmp 0x1ce5f0
testq %r9, %r9
je 0x1ce70c
testl %esi, %esi
je 0x1ce57b
leal -0x1(%rsi), %eax
movq (%r9,%rax,8), %rax
incq %rax
jmp 0x1ce57d
testq %r9, %r9
je 0x1ce711
notl %esi
addl %esi, %ecx
movl %ecx, %eax
movq (%r9,%rax,8), %rsi
je 0x1ce5e7
decl %ecx
movq (%r9,%rcx,8), %r8
notq %r8
jmp 0x1ce5ea
xorl %eax, %eax
movl %esi, %ecx
movq (%r9,%rcx,8), %r8
subq %rax, %r8
subq %rdx, %r8
jbe 0x1ce629
addq %rdx, %rax
movl %eax, %ecx
andl $0x1f, %ecx
movq %rax, %rsi
shrq $0x5, %rsi
cmpl $0x1c, %ecx
ja 0x1ce5b4
movq (%rdi,%rsi,8), %rdx
addl %eax, %eax
andb $0x3e, %al
movb $0x38, %cl
subb %al, %cl
shrq %cl, %rdx
jmp 0x1ce5c6
addl %ecx, %ecx
addb $-0x38, %cl
movq (%rdi,%rsi,8), %rdx
movq 0x8(%rdi,%rsi,8), %rax
shldq %cl, %rax, %rdx
cmpq $0x3, %r8
ja 0x1ce6fd
movb $0x4, %al
subb %r8b, %al
leal (%rax,%rax), %ecx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
shll %cl, %esi
andb %sil, %dl
jmp 0x1ce6ff
xorl %r8d, %r8d
addq %rsi, %r8
subq %rdx, %rsi
subq %rdx, %r8
jbe 0x1ce629
cmpq $0x4, %r8
movl $0x4, %eax
cmovbq %r8, %rax
subq %rax, %rsi
movl %esi, %eax
andl $0x1f, %eax
movq %rsi, %r9
shrq $0x5, %r9
cmpl $0x1c, %eax
ja 0x1ce632
movq (%rdi,%r9,8), %r11
leal (%rsi,%rsi), %edx
andb $0x3e, %dl
movb $0x38, %cl
subb %dl, %cl
shrq %cl, %r11
jmp 0x1ce645
movb $0x4, %al
xorl %edx, %edx
jmp 0x1ce6ff
leal (%rax,%rax), %ecx
addb $-0x38, %cl
movq (%rdi,%r9,8), %r11
movq 0x8(%rdi,%r9,8), %rdx
shldq %cl, %rdx, %r11
cmpl $0x1c, %eax
ja 0x1ce65d
movq (%rdi,%r9,8), %r10
leal (%rsi,%rsi), %edx
andb $0x3e, %dl
movb $0x38, %cl
subb %dl, %cl
shrq %cl, %r10
jmp 0x1ce670
leal (%rax,%rax), %ecx
addb $-0x38, %cl
movq (%rdi,%r9,8), %r10
movq 0x8(%rdi,%r9,8), %rdx
shldq %cl, %rdx, %r10
shrb $0x6, %r11b
shlb $0x6, %r10b
cmpl $0x1c, %eax
ja 0x1ce690
movq (%rdi,%r9,8), %rdx
leal (%rsi,%rsi), %ebx
andb $0x3e, %bl
movb $0x38, %cl
subb %bl, %cl
shrq %cl, %rdx
jmp 0x1ce6a3
leal (%rax,%rax), %ecx
addb $-0x38, %cl
movq (%rdi,%r9,8), %rdx
movq 0x8(%rdi,%r9,8), %rbx
shldq %cl, %rbx, %rdx
orb %r11b, %r10b
shrb $0x2, %dl
andb $0xc, %dl
cmpl $0x1c, %eax
ja 0x1ce6c5
movq (%rdi,%r9,8), %r11
addl %esi, %esi
andb $0x3e, %sil
movb $0x38, %cl
subb %sil, %cl
shrq %cl, %r11
jmp 0x1ce6d8
addl %eax, %eax
addb $-0x38, %al
movq (%rdi,%r9,8), %r11
movq 0x8(%rdi,%r9,8), %rsi
movl %eax, %ecx
shldq %cl, %rsi, %r11
shlb $0x2, %r11b
andb $0x30, %r11b
orb %r11b, %dl
orb %r10b, %dl
notb %dl
cmpq $0x3, %r8
ja 0x1ce6fd
movb $0x4, %al
subb %r8b, %al
leal (%rax,%rax), %ecx
movzbl %dl, %edx
shll %cl, %edx
jmp 0x1ce6ff
xorl %eax, %eax
movzbl %al, %ecx
shll $0x8, %ecx
movzbl %dl, %eax
orl %ecx, %eax
popq %rbx
retq
callq 0x6b3eb
callq 0x6b3b2