// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movq 0x50(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x40(%rsp)
addq 0x48(%rsp), %rdx
movq %rdx, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x40(%rsp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jb 0x4d53c4
movw $0x400, 0x66(%rsp)      # imm = 0x400
jmp 0x4d5608
movb $0x0, 0x2f(%rsp)
movq 0x50(%rsp), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rax
subq $0x1, %rax
subq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x38(%rsp), %rax
ja 0x4d5443
movq 0x58(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x4d5ca0
movb %al, 0x2e(%rsp)
cmpq $0x4, 0x20(%rsp)
jae 0x4d543e
movl $0x4, %eax
subq 0x20(%rsp), %rax
movb %al, 0x2f(%rsp)
movzbl 0x2f(%rsp), %ecx
shll %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
subl $0x1, %ecx
movzbl 0x2e(%rsp), %eax
orl %ecx, %eax
movb %al, 0x2e(%rsp)
jmp 0x4d55f1
jmp 0x4d5445
movq 0x18(%rsp), %rax
movq 0x38(%rsp), %rcx
addq $0x1, %rcx
shlq %rcx
cmpq %rcx, %rax
jb 0x4d5493
movq 0x166b3e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x40ba7(%rip), %rsi     # 0x516013
leaq 0xe4b78(%rip), %rdx     # 0x5b9feb
leaq 0xe4b95(%rip), %rcx     # 0x5ba00f
leaq 0xe4a1c(%rip), %r8      # 0x5b9e9d
movl $0xda, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4d5495
movq 0x38(%rsp), %rax
addq $0x1, %rax
shlq %rax
subq 0x18(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x18(%rsp)
cmpq $0x4, 0x20(%rsp)
jbe 0x4d54c3
movl $0x4, %eax
movq %rax, 0x10(%rsp)
jmp 0x4d54cd
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x38(%rsp), %rax
jb 0x4d5523
movq 0x166aae(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x40b17(%rip), %rsi     # 0x516013
leaq 0xe4b26(%rip), %rdx     # 0x5ba029
leaq 0xe4b05(%rip), %rcx     # 0x5ba00f
leaq 0xe498c(%rip), %r8      # 0x5b9e9d
movl $0xdf, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4d5525
movq 0x58(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x4d5ca0
movzbl %al, %eax
andl $0xc0, %eax
sarl $0x6, %eax
movl %eax, 0x4(%rsp)
movq 0x58(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x4d5ca0
movb %al, %cl
movl 0x4(%rsp), %eax
movzbl %cl, %ecx
andl $0x3, %ecx
shll $0x6, %ecx
orl %ecx, %eax
movl %eax, 0xc(%rsp)
movq 0x58(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x4d5ca0
movzbl %al, %eax
andl $0x30, %eax
sarl $0x2, %eax
movl %eax, 0x8(%rsp)
movq 0x58(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x4d5ca0
movl 0x8(%rsp), %ecx
movb %al, %dl
movl 0xc(%rsp), %eax
movzbl %dl, %edx
andl $0xc, %edx
shll $0x2, %edx
orl %edx, %ecx
orl %ecx, %eax
xorl $0xff, %eax
movb %al, 0x2e(%rsp)
cmpq $0x4, 0x20(%rsp)
jae 0x4d55ef
movl $0x4, %eax
subq 0x20(%rsp), %rax
movb %al, 0x2f(%rsp)
movzbl 0x2e(%rsp), %eax
movzbl 0x2f(%rsp), %ecx
shll %ecx
shll %cl, %eax
movzbl 0x2f(%rsp), %ecx
shll %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
orl %ecx, %eax
movb %al, 0x2e(%rsp)
jmp 0x4d55f1
movzbl 0x2e(%rsp), %eax
movzwl %ax, %eax
shll $0x2, %eax
movzbl 0x2f(%rsp), %ecx
addl %ecx, %eax
movw %ax, 0x66(%rsp)
movw 0x66(%rsp), %ax
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)