// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/sfx-bentsedg.c
// Function: gt_threaded_stream_sortallbuckets
void gt_threaded_stream_sortallbuckets(GtSuffixsortspace *suffixsortspace,
                       const GtEncseq *encseq,
                       GtReadmode readmode,
                       const GtBcktab *bcktab,
                       GtCodetype mincode,
                       GtCodetype maxcode,
                       GtUword sumofwidth,
                       unsigned int numofchars,
                       unsigned int prefixlength,
                       unsigned int sortmaxdepth,
                       const Sfxstrategy *sfxstrategy,
                       GtProcessunsortedsuffixrange processunsortedsuffixrange,
                       void *processunsortedsuffixrangeinfo,
                       GtLogger *logger)
{
  GtBentsedgIterator *bs_it;
  GtBentsedgSynchronizer *bs_sync;
  unsigned int tp;
  bool haserr = false;
  GtBentsedg_stream_thread_info *th_tab;
  GtSuffixsortspace **sssp_tab;

  gt_assert(gt_jobs > 1U);
  th_tab = gt_malloc(sizeof *th_tab * gt_jobs);
  sssp_tab = gt_malloc(sizeof *sssp_tab * gt_jobs);
  bs_it = gt_BentsedgIterator_new(mincode,maxcode,sumofwidth,numofchars,bcktab);
  bs_sync = gt_bendsedgSynchronizer_new();
  for (tp = 0; !haserr && tp < gt_jobs; tp++)
  {
    th_tab[tp].thread_num = tp;
    th_tab[tp].prefixlength = prefixlength;
    if (tp == 0)
    {
      sssp_tab[tp] = suffixsortspace;
    } else
    {
      sssp_tab[tp] = gt_suffixsortspace_clone(suffixsortspace,tp,logger);
    }
    th_tab[tp].bsr = bentsedgresources_new(sssp_tab[tp],
                                           encseq,
                                           readmode,
                                           prefixlength,
                                           bcktab,
                                           sortmaxdepth,
                                           sfxstrategy,
                                           false);
    th_tab[tp].bsr->processunsortedsuffixrange
      = processunsortedsuffixrange;
    th_tab[tp].bsr->processunsortedsuffixrangeinfo
      = processunsortedsuffixrangeinfo;
    th_tab[tp].bs_it = bs_it;
    th_tab[tp].bs_sync = bs_sync;
    th_tab[tp].thread
      = gt_thread_new (gt_bentsedg_stream_thread_caller,th_tab + tp,NULL);
    if (th_tab[tp].thread == NULL)
    {
      haserr = true;
    }
  }
  for (tp = 0; tp < gt_jobs; tp++)
  {
    if (!haserr)
    {
      gt_thread_join(th_tab[tp].thread);
    }
    gt_thread_delete(th_tab[tp].thread);
  }
  for (tp = 0; tp < gt_jobs; tp++)
  {
    bentsedgresources_delete(th_tab[tp].bsr, logger);
  }
  gt_suffixsortspace_delete_cloned(sssp_tab,gt_jobs);
  gt_BentsedgIterator_delete(bs_it);
  gt_bendsedgSynchronizer_delete(bs_sync);
  gt_free(sssp_tab);
  gt_free(th_tab);
  gt_assert(!haserr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, 0x14(%rsp)
movq %rsi, 0x30(%rsp)
leaq 0x2d68a0(%rip), %r12    # 0x4c4e18
movl (%r12), %eax
cmpq $0x1, %rax
jbe 0x1ee8d5
movq %r9, %r13
movq %r8, %r15
movq %rcx, %rbx
movq %rdi, %r14
shlq $0x3, %rax
leaq (%rax,%rax,4), %rdi
leaq 0x1d079f(%rip), %rbp    # 0x3bed40
movq %rbp, %rsi
movl $0x7d9, %edx            # imm = 0x7D9
callq 0x1092b2
movq %rax, 0x18(%rsp)
movl (%r12), %edi
shlq $0x3, %rdi
movq %rbp, %rsi
movl $0x7da, %edx            # imm = 0x7DA
callq 0x1092b2
movq %rax, 0x8(%rsp)
movl $0x40, %edi
movq %rbp, %rsi
movl $0x6f4, %edx            # imm = 0x6F4
callq 0x1092b2
movq %rax, %r12
movq %r15, 0x18(%rax)
movq %r15, 0x20(%rax)
movq %r13, 0x28(%rax)
movq 0x70(%rsp), %rax
movq %rax, (%r12)
movl 0x78(%rsp), %ecx
xorl %ebp, %ebp
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movl %edx, 0x30(%r12)
movq %rbx, %r13
movq %rbx, 0x10(%r12)
movq %rbp, 0x8(%r12)
callq 0x12260a
movq %r12, 0x28(%rsp)
movq %rax, 0x38(%r12)
movl $0x18, %edi
leaq 0x1d070e(%rip), %r15    # 0x3bed40
movq %r15, %rsi
movl $0x770, %edx            # imm = 0x770
callq 0x1092b2
movq %rax, %rbx
leaq 0x2d67cf(%rip), %rax    # 0x4c4e18
movl (%rax), %r12d
movl $0x18, %edi
movq %r15, %rsi
movl $0x72a, %edx            # imm = 0x72A
callq 0x1092b2
movq %rax, %r15
leaq (,%r12,8), %rdi
leaq 0x1d06d0(%rip), %rsi    # 0x3bed40
movl $0x72c, %edx            # imm = 0x72C
callq 0x1092b2
movq %rax, 0x10(%r15)
movq %r12, (%r15)
movq %rbp, 0x8(%r15)
movq %r15, (%rbx)
movq %rbp, 0x8(%rbx)
callq 0x12260a
movq %rbx, 0x20(%rsp)
movq %rax, 0x10(%rbx)
leaq 0x2d6777(%rip), %rax    # 0x4c4e18
cmpl $0x0, (%rax)
je 0x1ee782
movl 0x80(%rsp), %ebx
xorl %r12d, %r12d
movq 0x18(%rsp), %r15
xorl %ebp, %ebp
movl %r12d, 0xc(%r15)
movl %ebx, 0x8(%r15)
movq %r14, %rdi
testq %r12, %r12
je 0x1ee6e1
movq %r14, %rdi
movl %r12d, %esi
movq 0xa8(%rsp), %rdx
callq 0x205e01
movq %rax, %rdi
movq 0x8(%rsp), %rax
movq %rdi, (%rax,%r12,8)
movq 0x30(%rsp), %rsi
movl 0x14(%rsp), %edx
movl %ebx, %ecx
movq %r13, %r8
movl 0x88(%rsp), %r9d
pushq $0x0
pushq 0x98(%rsp)
callq 0x1ec92e
addq $0x10, %rsp
movq %rax, (%r15)
movq 0x98(%rsp), %rcx
movq %rcx, 0x50(%rax)
movq 0xa0(%rsp), %rcx
movq %rcx, 0x58(%rax)
movq 0x28(%rsp), %rax
movq %rax, 0x10(%r15)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%r15)
leaq 0x1a3(%rip), %rdi       # 0x1ee8e9
movq %r15, %rsi
xorl %edx, %edx
callq 0x122488
movq %rax, 0x20(%r15)
movl $0x1, %ecx
testq %rax, %rax
je 0x1ee762
movzbl %bpl, %ecx
movl %ecx, %ebp
testb $0x1, %cl
jne 0x1ee782
incq %r12
leaq 0x2d66a5(%rip), %rax    # 0x4c4e18
movl (%rax), %eax
addq $0x28, %r15
cmpq %rax, %r12
jb 0x1ee6bb
leaq 0x2d668f(%rip), %r12    # 0x4c4e18
cmpl $0x0, (%r12)
movq 0x18(%rsp), %r13
je 0x1ee7c5
movq %r13, %rbx
addq $0x20, %rbx
xorl %r14d, %r14d
testb $0x1, %bpl
jne 0x1ee7ad
movq (%rbx), %rdi
callq 0x122527
movq (%rbx), %rdi
callq 0x12268d
incq %r14
movl (%r12), %eax
addq $0x28, %rbx
cmpq %rax, %r14
jb 0x1ee79f
movl (%r12), %esi
testl %esi, %esi
je 0x1ee7f5
xorl %ebx, %ebx
movq %r13, %r14
movq 0xa8(%rsp), %r15
movq (%r14), %rdi
movq %r15, %rsi
callq 0x1ee329
incq %rbx
movl (%r12), %esi
addq $0x28, %r14
cmpq %rsi, %rbx
jb 0x1ee7da
movq 0x8(%rsp), %rdi
callq 0x206290
movq 0x28(%rsp), %rbx
movq 0x28(%rbx), %rax
subq 0x20(%rbx), %rax
incq %rax
cmpq %rax, 0x8(%rbx)
jne 0x1ee8da
movq 0x38(%rbx), %rdi
callq 0x122635
leaq 0x1d0517(%rip), %rsi    # 0x3bed40
movq %rbx, %rdi
movl $0x719, %edx            # imm = 0x719
callq 0x109670
movq 0x20(%rsp), %r12
movq (%r12), %rdi
callq 0x1ee546
testb %al, %al
je 0x1ee8df
movq 0x10(%r12), %rdi
callq 0x122635
movq (%r12), %rbx
testq %rbx, %rbx
je 0x1ee887
movq 0x10(%rbx), %rdi
leaq 0x1d04d6(%rip), %r14    # 0x3bed40
movq %r14, %rsi
movl $0x762, %edx            # imm = 0x762
callq 0x109670
movq %rbx, %rdi
movq %r14, %rsi
movl $0x763, %edx            # imm = 0x763
callq 0x109670
leaq 0x1d04b2(%rip), %rbx    # 0x3bed40
movq %r12, %rdi
movq %rbx, %rsi
movl $0x796, %edx            # imm = 0x796
callq 0x109670
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl $0x80c, %edx            # imm = 0x80C
callq 0x109670
movq %r13, %rdi
movq %rbx, %rsi
movl $0x80d, %edx            # imm = 0x80D
callq 0x109670
testb $0x1, %bpl
jne 0x1ee8e4
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x77704
callq 0x7773d
callq 0x77776
callq 0x777af