// File: /workspace/github_c_makefile_star2_O3/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, 0x28(%rsp)
leaq 0x2d50fa(%rip), %rbp    # 0x4b9e18
movl (%rbp), %eax
cmpq $0x1, %rax
jbe 0x1e5074
movq %r9, %r15
movq %r8, %r13
movq %rcx, %r12
movq %rdi, %r14
shlq $0x3, %rax
leaq (%rax,%rax,4), %rdi
leaq 0x1d09da(%rip), %rbx    # 0x3b5720
movq %rbx, %rsi
movl $0x7d9, %edx            # imm = 0x7D9
callq 0x104226
movq %rax, (%rsp)
movl (%rbp), %edi
shlq $0x3, %rdi
movq %rbx, %rsi
movl $0x7da, %edx            # imm = 0x7DA
callq 0x104226
movq %rax, 0x8(%rsp)
movl $0x40, %edi
movq %rbx, %rsi
movl $0x6f4, %edx            # imm = 0x6F4
callq 0x104226
movq %rax, %rbp
movq %r13, 0x18(%rax)
movq %r13, 0x20(%rax)
movq %r15, 0x28(%rax)
movq 0x70(%rsp), %rax
movq %rax, (%rbp)
movl 0x78(%rsp), %ecx
xorl %r15d, %r15d
movq %r13, %rax
xorl %edx, %edx
divq %rcx
movl %edx, 0x30(%rbp)
movq %r12, 0x30(%rsp)
movq %r12, 0x10(%rbp)
movq %r15, 0x8(%rbp)
callq 0x11c8ba
movq %rbp, 0x20(%rsp)
movq %rax, 0x38(%rbp)
movl $0x18, %edi
movq %rbx, %rsi
movl $0x770, %edx            # imm = 0x770
callq 0x104226
movq %rax, %rbp
leaq 0x2d5035(%rip), %rax    # 0x4b9e18
movl (%rax), %r12d
movl $0x18, %edi
movq %rbx, %rsi
movl $0x72a, %edx            # imm = 0x72A
callq 0x104226
movq %rax, %r13
leaq (,%r12,8), %rdi
movq %rbx, %rsi
movl $0x72c, %edx            # imm = 0x72C
callq 0x104226
movq %rax, 0x10(%r13)
movq %r12, (%r13)
movq %r15, 0x8(%r13)
movq %r13, (%rbp)
movq %r15, 0x8(%rbp)
callq 0x11c8ba
movq %rbp, 0x18(%rsp)
movq %rax, 0x10(%rbp)
leaq 0x2d4fdf(%rip), %rax    # 0x4b9e18
cmpl $0x0, (%rax)
je 0x1e4f81
movl 0x80(%rsp), %ebp
xorl %r15d, %r15d
movq (%rsp), %rbx
movl %r15d, 0xc(%rbx)
movl %ebp, 0x8(%rbx)
movq %r14, %rdi
testq %r15, %r15
je 0x1e4e75
movq %r14, %rdi
movl %r15d, %esi
movq 0xa8(%rsp), %rdx
callq 0x1fc703
movq %rax, %rdi
movq 0x8(%rsp), %rax
movq %rdi, (%rax,%r15,8)
movq 0x28(%rsp), %rsi
movl 0x14(%rsp), %edx
movl %ebp, %ecx
movq 0x30(%rsp), %r8
movl 0x88(%rsp), %r9d
pushq $0x0
pushq 0x98(%rsp)
callq 0x1e309e
addq $0x10, %rsp
movq %rax, (%rbx)
movq 0x98(%rsp), %rcx
movq %rcx, 0x50(%rax)
movq 0xa0(%rsp), %rcx
movq %rcx, 0x58(%rax)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x18(%rbx)
leaq 0x1ac(%rip), %rdi       # 0x1e5088
movq %rbx, %rsi
xorl %edx, %edx
callq 0x11c738
movq %rax, %r13
movq %rax, 0x20(%rbx)
leaq 0x2d4f24(%rip), %rax    # 0x4b9e18
movl (%rax), %eax
testq %r13, %r13
sete %r12b
je 0x1e4f0f
incq %r15
addq $0x28, %rbx
cmpq %rax, %r15
jb 0x1e4e50
testl %eax, %eax
je 0x1e4f86
movq (%rsp), %rbp
movq %rbp, %rbx
addq $0x20, %rbx
xorl %r14d, %r14d
leaq 0x2d4ef0(%rip), %r15    # 0x4b9e18
testq %r13, %r13
je 0x1e4f35
movq (%rbx), %rdi
callq 0x11c7d7
movq (%rbx), %rdi
callq 0x11c93d
incq %r14
movl (%r15), %eax
addq $0x28, %rbx
cmpq %rax, %r14
jb 0x1e4f28
testl %eax, %eax
je 0x1e506c
xorl %ebx, %ebx
movq %rbp, %r14
movq %r15, %r13
movq 0xa8(%rsp), %rbp
movq (%r14), %rdi
movq %rbp, %rsi
callq 0x1e4acf
incq %rbx
movl (%r13), %r15d
addq $0x28, %r14
cmpq %r15, %rbx
jb 0x1e4f64
jmp 0x1e4f89
xorl %r12d, %r12d
jmp 0x1e4f89
xorl %r15d, %r15d
movq (%rsp), %rbp
movq 0x8(%rsp), %rdi
movl %r15d, %esi
callq 0x1fcb92
movq 0x20(%rsp), %rbx
movq 0x28(%rbx), %rax
subq 0x20(%rbx), %rax
incq %rax
cmpq %rax, 0x8(%rbx)
jne 0x1e5079
movq 0x38(%rbx), %rdi
callq 0x11c8e5
leaq 0x1d075c(%rip), %rsi    # 0x3b5720
movq %rbx, %rdi
movl $0x719, %edx            # imm = 0x719
callq 0x1045eb
movq 0x18(%rsp), %r15
movq (%r15), %rdi
callq 0x1e4cec
testb %al, %al
je 0x1e507e
movq 0x10(%r15), %rdi
callq 0x11c8e5
movq (%r15), %rbx
testq %rbx, %rbx
je 0x1e501f
movq 0x10(%rbx), %rdi
leaq 0x1d071e(%rip), %r14    # 0x3b5720
movq %r14, %rsi
movl $0x762, %edx            # imm = 0x762
callq 0x1045eb
movq %rbx, %rdi
movq %r14, %rsi
movl $0x763, %edx            # imm = 0x763
callq 0x1045eb
leaq 0x1d06fa(%rip), %rbx    # 0x3b5720
movq %r15, %rdi
movq %rbx, %rsi
movl $0x796, %edx            # imm = 0x796
callq 0x1045eb
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl $0x80c, %edx            # imm = 0x80C
callq 0x1045eb
movq %rbp, %rdi
movq %rbx, %rsi
movl $0x80d, %edx            # imm = 0x80D
callq 0x1045eb
testb %r12b, %r12b
jne 0x1e5083
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
jmp 0x1e4f8d
callq 0x75a77
callq 0x75ab0
callq 0x75ae9
callq 0x75b22