// File: /workspace/github_c_makefile_star2_O3/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 %rax
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 0x3214e6
addq %rsi, %r10
cmpq %r8, %rsi
jbe 0x321434
leaq 0x2(,%r8,2), %rdx
cmpq %rdx, %r10
jae 0x3214e8
notq %r10
addq %r10, %rdx
cmpq $0x4, %r9
movl $0x4, %eax
cmovbq %r9, %rax
subq %rax, %rdx
cmpq %r8, %rdx
jae 0x3214ed
movl %edx, %ecx
andl $0x1f, %ecx
movq %rdx, %rsi
shrq $0x5, %rsi
cmpl $0x1c, %ecx
ja 0x32148a
movq (%rdi,%rsi,8), %rax
addl %edx, %edx
andb $0x3e, %dl
movb $0x38, %cl
subb %dl, %cl
shrq %cl, %rax
jmp 0x32149c
movl %r10d, %ecx
andl $0x1f, %ecx
movq %r10, %rdx
shrq $0x5, %rdx
cmpl $0x1c, %ecx
ja 0x32145b
movq (%rdi,%rdx,8), %rax
addl %r10d, %r10d
andb $0x3e, %r10b
movb $0x38, %cl
subb %r10b, %cl
shrq %cl, %rax
jmp 0x32146d
addl %ecx, %ecx
addb $-0x38, %cl
movq (%rdi,%rdx,8), %rax
movq 0x8(%rdi,%rdx,8), %rdx
shldq %cl, %rdx, %rax
cmpq $0x3, %r9
ja 0x3214db
movb $0x4, %dl
subb %r9b, %dl
leal (%rdx,%rdx), %ecx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
shll %cl, %esi
notb %sil
orb %sil, %al
jmp 0x3214dd
addl %ecx, %ecx
addb $-0x38, %cl
movq (%rdi,%rsi,8), %rax
movq 0x8(%rdi,%rsi,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, %r9
ja 0x3214db
movb $0x4, %dl
subb %r9b, %dl
movzbl %al, %esi
leal (%rdx,%rdx), %ecx
shll %cl, %esi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
notl %eax
orl %esi, %eax
jmp 0x3214dd
xorl %edx, %edx
movzbl %al, %eax
movzbl %dl, %ecx
leal (%rcx,%rax,4), %eax
popq %rcx
retq
callq 0x94506
callq 0x9453f
nop