// File: /workspace/github_c_makefile_star2_O1/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, %r9
movq %rdx, %r10
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
addq %r10, %rdx
decq %r9
movw $0x400, %ax             # imm = 0x400
subq %rdx, %r9
jbe 0x32b8b9
addq %rsi, %r10
cmpq %r8, %rsi
jbe 0x32b77b
leaq 0x2(,%r8,2), %rsi
cmpq %rsi, %r10
jae 0x32b8bb
notq %r10
addq %r10, %rsi
cmpq $0x4, %r9
movl $0x4, %eax
cmovbq %r9, %rax
subq %rax, %rsi
cmpq %r8, %rsi
jae 0x32b8c0
movl %esi, %eax
andl $0x1f, %eax
movq %rsi, %r8
shrq $0x5, %r8
cmpl $0x1c, %eax
ja 0x32b7d8
movq (%rdi,%r8,8), %r11
leal (%rsi,%rsi), %edx
andb $0x3e, %dl
movb $0x38, %cl
subb %dl, %cl
shrq %cl, %r11
jmp 0x32b7eb
movl %r10d, %ecx
andl $0x1f, %ecx
movq %r10, %rax
shrq $0x5, %rax
cmpl $0x1c, %ecx
ja 0x32b7a2
movq (%rdi,%rax,8), %rdx
addl %r10d, %r10d
andb $0x3e, %r10b
movb $0x38, %cl
subb %r10b, %cl
shrq %cl, %rdx
jmp 0x32b7b4
addl %ecx, %ecx
addb $-0x38, %cl
movq (%rdi,%rax,8), %rdx
movq 0x8(%rdi,%rax,8), %rax
shldq %cl, %rax, %rdx
cmpq $0x3, %r9
ja 0x32b8ae
movb $0x4, %al
subb %r9b, %al
leal (%rax,%rax), %ecx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
shll %cl, %esi
notb %sil
orb %sil, %dl
jmp 0x32b8b0
leal (%rax,%rax), %ecx
addb $-0x38, %cl
movq (%rdi,%r8,8), %r11
movq 0x8(%rdi,%r8,8), %rdx
shldq %cl, %rdx, %r11
cmpl $0x1c, %eax
ja 0x32b803
movq (%rdi,%r8,8), %r10
leal (%rsi,%rsi), %edx
andb $0x3e, %dl
movb $0x38, %cl
subb %dl, %cl
shrq %cl, %r10
jmp 0x32b816
leal (%rax,%rax), %ecx
addb $-0x38, %cl
movq (%rdi,%r8,8), %r10
movq 0x8(%rdi,%r8,8), %rdx
shldq %cl, %rdx, %r10
shrb $0x6, %r11b
shlb $0x6, %r10b
cmpl $0x1c, %eax
ja 0x32b836
movq (%rdi,%r8,8), %rdx
leal (%rsi,%rsi), %ebx
andb $0x3e, %bl
movb $0x38, %cl
subb %bl, %cl
shrq %cl, %rdx
jmp 0x32b849
leal (%rax,%rax), %ecx
addb $-0x38, %cl
movq (%rdi,%r8,8), %rdx
movq 0x8(%rdi,%r8,8), %rbx
shldq %cl, %rbx, %rdx
orb %r11b, %r10b
shrb $0x2, %dl
andb $0xc, %dl
cmpl $0x1c, %eax
ja 0x32b86b
movq (%rdi,%r8,8), %r11
addl %esi, %esi
andb $0x3e, %sil
movb $0x38, %cl
subb %sil, %cl
shrq %cl, %r11
jmp 0x32b87e
addl %eax, %eax
addb $-0x38, %al
movq (%rdi,%r8,8), %r11
movq 0x8(%rdi,%r8,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, %r9
ja 0x32b8ae
movb $0x4, %al
subb %r9b, %al
movzbl %dl, %esi
leal (%rax,%rax), %ecx
shll %cl, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
shll %cl, %edx
notl %edx
orl %esi, %edx
jmp 0x32b8b0
xorl %eax, %eax
movzbl %dl, %ecx
movzbl %al, %eax
leal (%rax,%rcx,4), %eax
popq %rbx
retq
callq 0x964c4
callq 0x964fd
nopl (%rax)