// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movl %edx, 0x14(%rsp)
movq %rsi, 0x20(%rsp)
leaq 0x2a51dd(%rip), %r13    # 0x438dc8
movl (%r13), %eax
cmpq $0x1, %rax
jbe 0x193f18
movq %r9, %rbx
movq %r8, %r15
movq %rcx, %r12
movq %rdi, %r14
imulq $0x28, %rax, %rdi
leaq 0x1c1f70(%rip), %rbp    # 0x355b80
movq %rbp, %rsi
movl $0x7d9, %edx            # imm = 0x7D9
callq 0x93160
movq %rax, 0x18(%rsp)
movl (%r13), %edi
shlq $0x3, %rdi
movq %rbp, %rsi
movl $0x7da, %edx            # imm = 0x7DA
callq 0x93160
movq %rax, 0x8(%rsp)
pushq $0x40
popq %rdi
movq %rbp, %rsi
movl $0x6f4, %edx            # imm = 0x6F4
callq 0x93160
movq %rax, %r13
movq %r15, 0x18(%rax)
movq %r15, 0x20(%rax)
movq %rbx, 0x28(%rax)
movq 0x60(%rsp), %rax
movq %rax, (%r13)
movl 0x68(%rsp), %ecx
xorl %ebx, %ebx
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movl %edx, 0x30(%r13)
movq %r12, %rbp
movq %r12, 0x10(%r13)
andq $0x0, 0x8(%r13)
callq 0xaf2c3
movq %rax, 0x38(%r13)
pushq $0x18
popq %rdi
leaq 0x1c1eeb(%rip), %rsi    # 0x355b80
movq %rsi, %r15
movl $0x770, %edx            # imm = 0x770
callq 0x93160
movq %rax, %r12
leaq 0x2a511c(%rip), %rax    # 0x438dc8
movl (%rax), %eax
movq %rax, (%rsp)
pushq $0x18
popq %rdi
movq %r15, %rsi
movl $0x72a, %edx            # imm = 0x72A
callq 0x93160
movq %rax, %r15
movq (%rsp), %rax
leaq (,%rax,8), %rdi
leaq 0x1c1ea8(%rip), %rsi    # 0x355b80
movl $0x72c, %edx            # imm = 0x72C
callq 0x93160
movq %rax, 0x10(%r15)
movq (%rsp), %rax
movq %rax, (%r15)
andq $0x0, 0x8(%r15)
movq %r15, (%r12)
andq $0x0, 0x8(%r12)
callq 0xaf2c3
movq %r12, (%rsp)
movq %rax, 0x10(%r12)
movq 0x18(%rsp), %r15
xorl %r12d, %r12d
leaq 0x2a50af(%rip), %rax    # 0x438dc8
movl (%rax), %esi
testb $0x1, %r12b
jne 0x193dd4
cmpq %rsi, %rbx
jae 0x193dd4
movl %ebx, 0xc(%r15)
movl 0x70(%rsp), %eax
movl %eax, 0x8(%r15)
movq %r14, %rdi
testq %rbx, %rbx
je 0x193d57
movq %r14, %rdi
movl %ebx, %esi
movq 0x98(%rsp), %rdx
callq 0x1af425
movq %rax, %rdi
movq 0x8(%rsp), %rax
movq %rdi, (%rax,%rbx,8)
movq 0x20(%rsp), %rsi
movl 0x14(%rsp), %edx
movl 0x70(%rsp), %ecx
movq %rbp, %r8
movl 0x78(%rsp), %r9d
pushq $0x0
pushq 0x88(%rsp)
callq 0x1920b1
popq %rcx
popq %rdx
movq %rax, (%r15)
movq 0x88(%rsp), %rcx
movq %rcx, 0x50(%rax)
movq 0x90(%rsp), %rcx
movq %rcx, 0x58(%rax)
movq %r13, 0x10(%r15)
movq (%rsp), %rax
movq %rax, 0x18(%r15)
leaq 0x22a(%rip), %rdi       # 0x193fdd
movq %r15, %rsi
xorl %edx, %edx
callq 0xaeee8
movq %rax, 0x20(%r15)
testq %rax, %rax
sete %r12b
incq %rbx
addq $0x28, %r15
jmp 0x193d12
movq 0x18(%rsp), %r15
movq %r15, %rbx
addq $0x20, %rbx
xorl %r14d, %r14d
leaq 0x2a4fde(%rip), %rbp    # 0x438dc8
movl %esi, %eax
cmpq %rax, %r14
jae 0x193e13
testb $0x1, %r12b
jne 0x193dff
movq (%rbx), %rdi
callq 0xaefdb
movq (%rbx), %rdi
callq 0xaf45e
incq %r14
movl (%rbp), %esi
addq $0x28, %rbx
jmp 0x193dea
xorl %ebx, %ebx
movq %r15, %r14
movl %esi, %eax
cmpq %rax, %rbx
jae 0x193e3b
movq (%r14), %rdi
movq 0x98(%rsp), %rsi
callq 0x193944
incq %rbx
movl (%rbp), %esi
addq $0x28, %r14
jmp 0x193e18
movq 0x8(%rsp), %rdi
callq 0x1afcf6
movq 0x28(%r13), %rax
subq 0x20(%r13), %rax
incq %rax
cmpq %rax, 0x8(%r13)
jne 0x193f49
movq 0x38(%r13), %rdi
callq 0xaf31b
leaq 0x1c1d16(%rip), %rsi    # 0x355b80
movq %r13, %rdi
movl $0x719, %edx            # imm = 0x719
callq 0x936f9
movq (%rsp), %r13
movq (%r13), %rdi
callq 0x193b86
testb %al, %al
je 0x193f77
movq 0x10(%r13), %rdi
callq 0xaf31b
movq (%r13), %rbx
testq %rbx, %rbx
je 0x193ec6
movq 0x10(%rbx), %rdi
leaq 0x1c1cd7(%rip), %r14    # 0x355b80
movq %r14, %rsi
movl $0x762, %edx            # imm = 0x762
callq 0x936f9
movq %rbx, %rdi
movq %r14, %rsi
movl $0x763, %edx            # imm = 0x763
callq 0x936f9
leaq 0x1c1cb3(%rip), %rbx    # 0x355b80
movq %r13, %rdi
movq %rbx, %rsi
movl $0x796, %edx            # imm = 0x796
callq 0x936f9
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl $0x80c, %edx            # imm = 0x80C
callq 0x936f9
movq %r15, %rdi
movq %rbx, %rsi
movl $0x80d, %edx            # imm = 0x80D
callq 0x936f9
testb $0x1, %r12b
jne 0x193fa5
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2a4049(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1510ea(%rip), %rsi    # 0x2e5013
leaq 0x1c1c69(%rip), %rdx    # 0x355b99
leaq 0x1c1c6f(%rip), %rcx    # 0x355ba6
leaq 0x1c1c42(%rip), %r8     # 0x355b80
movl $0x7d8, %r9d            # imm = 0x7D8
jmp 0x193fd1
movq 0x2a4018(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1510b9(%rip), %rsi    # 0x2e5013
leaq 0x1c217a(%rip), %rdx    # 0x3560db
leaq 0x1c21ae(%rip), %rcx    # 0x356116
leaq 0x1c1c11(%rip), %r8     # 0x355b80
movl $0x717, %r9d            # imm = 0x717
jmp 0x193fd1
movq 0x2a3fea(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x15108b(%rip), %rsi    # 0x2e5013
leaq 0x1c21a2(%rip), %rdx    # 0x356131
leaq 0x1c21c9(%rip), %rcx    # 0x35615f
leaq 0x1c1be3(%rip), %r8     # 0x355b80
movl $0x793, %r9d            # imm = 0x793
jmp 0x193fd1
movq 0x2a3fbc(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x15105d(%rip), %rsi    # 0x2e5013
leaq 0x1c1c0b(%rip), %rdx    # 0x355bc8
leaq 0x1c1be2(%rip), %rcx    # 0x355ba6
leaq 0x1c1bb5(%rip), %r8     # 0x355b80
movl $0x80e, %r9d            # imm = 0x80E
xorl %eax, %eax
callq 0x17a50
callq 0x17390