// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/radixsort_str.c
// Function: gt_radixsort_str_get_code
static inline gt_radixsort_str_bucketnum_t gt_radixsort_str_get_code(
    const GtTwobitencoding *twobitencoding, GtUword suffixnum,
    GtUword depth, GtUword equallengthplus1,
    GtUword realtotallength)
{
  GtUword relpos = suffixnum % equallengthplus1 + depth;

  if (relpos >= equallengthplus1 - 1) /* suffix starts on separator position */
  {
    return GT_RADIXSORT_STR_SPECIAL_BUCKET;
  } else
  {
    uint8_t overflow = 0;
    gt_radixsort_str_kmercode_t code;
    GtUword remaining, pos = suffixnum + depth;

    remaining = equallengthplus1 - 1 - relpos;
    if (suffixnum <= realtotallength)
    {
      code = gt_radixsort_str_code_at_position(twobitencoding, pos);
      if (remaining < (GtUword) GT_RADIXSORT_STR_KMERSIZE)
      {
        overflow = GT_RADIXSORT_STR_KMERSIZE - remaining;
        code |= (1 << GT_MULT2(overflow)) - 1;
      }
    } else
    {
      gt_assert(pos < GT_MULT2(realtotallength + 1));
      pos = GT_MULT2(realtotallength + 1) - pos - 1;
      pos -= (remaining > (GtUword) GT_RADIXSORT_STR_KMERSIZE)
               ? (GtUword) GT_RADIXSORT_STR_KMERSIZE
               : remaining;
      gt_assert(pos < realtotallength);
      code = GT_RADIXSORT_STR_REVCOMPL(gt_radixsort_str_code_at_position(
                                       twobitencoding, pos));
      if (remaining < (GtUword) GT_RADIXSORT_STR_KMERSIZE)
      {
        overflow = GT_RADIXSORT_STR_KMERSIZE - remaining;
        code = (code << GT_MULT2(overflow)) | ((1 << GT_MULT2(overflow)) - 1);
      }
    }
    return GT_RADIXSORT_STR_BUCKETNUM(code, overflow);
  }
}

// Assembly:
pushq %rbx
movq %rcx, %rbx
movq %rdx, %rcx
movq %rsi, %rax
xorl %edx, %edx
divq %rbx
addq %rcx, %rdx
decq %rbx
movw $0x400, %ax             # imm = 0x400
subq %rdx, %rbx
jbe 0x2c2530
addq %rsi, %rcx
cmpq %r8, %rsi
jbe 0x2c2503
leaq 0x2(,%r8,2), %rsi
cmpq %rsi, %rcx
jae 0x2c2532
notq %rcx
addq %rcx, %rsi
cmpq $0x4, %rbx
pushq $0x4
popq %rax
cmovbq %rbx, %rax
subq %rax, %rsi
cmpq %r8, %rsi
jae 0x2c2560
callq 0x2c2695
movl %eax, %ecx
shrb $0x6, %cl
movl %eax, %edx
shlb $0x6, %dl
orb %cl, %dl
movl %eax, %ecx
shrb $0x2, %cl
andb $0xc, %cl
shlb $0x2, %al
andb $0x30, %al
orb %cl, %al
orb %dl, %al
notb %al
cmpq $0x3, %rbx
ja 0x2c2525
movb $0x4, %dl
subb %bl, %dl
movzbl %al, %esi
leal (%rdx,%rdx), %ecx
shll %cl, %esi
pushq $-0x1
popq %rax
shll %cl, %eax
notl %eax
orl %esi, %eax
jmp 0x2c2527
movq %rcx, %rsi
callq 0x2c2695
cmpq $0x3, %rbx
ja 0x2c2525
movb $0x4, %dl
subb %bl, %dl
leal (%rdx,%rdx), %ecx
pushq $-0x1
popq %rsi
shll %cl, %esi
notb %sil
orb %sil, %al
jmp 0x2c2527
xorl %edx, %edx
movzbl %al, %eax
movzbl %dl, %ecx
leal (%rcx,%rax,4), %eax
popq %rbx
retq
movq 0x175a2f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x22ad0(%rip), %rsi     # 0x2e5013
leaq 0xc253e(%rip), %rdx     # 0x384a88
leaq 0xc255b(%rip), %rcx     # 0x384aac
leaq 0xc23e2(%rip), %r8      # 0x38493a
movl $0xda, %r9d
jmp 0x2c258c
movq 0x175a01(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x22aa2(%rip), %rsi     # 0x2e5013
leaq 0xc254e(%rip), %rdx     # 0x384ac6
leaq 0xc252d(%rip), %rcx     # 0x384aac
leaq 0xc23b4(%rip), %r8      # 0x38493a
movl $0xdf, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390