// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/sfx-bentsedg.c
// Function: bentsedgresources_new
static GtBentsedgresources *bentsedgresources_new(
                                   GtSuffixsortspace *suffixsortspace,
                                   const GtEncseq *encseq,
                                   GtReadmode readmode,
                                   unsigned int prefixlength,
                                   const GtBcktab *bcktab,
                                   unsigned int sortmaxdepth,
                                   const Sfxstrategy *sfxstrategy,
                                   bool withlcps)
{
  GtBentsedgresources *bsr = (GtBentsedgresources *) gt_malloc(sizeof *bsr);

  bsr->encseq = encseq;
  bsr->readmode = readmode;
  bsr->totallength = gt_encseq_total_length(encseq);
  bsr->sfxstrategy = sfxstrategy;
  bsr->sssp = suffixsortspace;
  bsr->rsi = NULL;
  bsr->fwd = GT_ISDIRREVERSE(bsr->readmode) ? false : true;
  bsr->complement = GT_ISDIRCOMPLEMENT(bsr->readmode) ? true : false;
  bsr->tableoflcpvalues = NULL;
  bsr->prefixlength = prefixlength;
  bsr->esr1 = gt_encseq_create_reader_with_readmode(encseq, readmode, 0);
  bsr->esr2 = gt_encseq_create_reader_with_readmode(encseq, readmode, 0);
  bsr->radixsortminwidth = gt_radixsort_str_minwidth();
  bsr->radixsortmaxwidth = 0;
  if (gt_encseq_accesstype_get(bsr->encseq) == GT_ACCESS_TYPE_EQUALLENGTH)
  {
    bsr->twobitencoding = gt_encseq_twobitencoding_export(bsr->encseq);
  } else
  {
    bsr->twobitencoding = NULL;
  }
  if (sortmaxdepth > 0)
  {
    if (sortmaxdepth > prefixlength)
    {
      bsr->srs_maxremain = sortmaxdepth - (GtUword) prefixlength;
    } else
    {
      bsr->srs_maxremain = 0;
    }
  } else
  {
    GtUword longestnsp = gt_encseq_lengthoflongestnonspecial(encseq);
    if (longestnsp > (GtUword) prefixlength)
    {
      bsr->srs_maxremain = longestnsp - prefixlength;
    } else
    {
      bsr->srs_maxremain = 0;
    }
  }
  bsr->shortreadsort_maxwidth
    = gt_shortreadsort_maxwidth(false,
                                bsr->srs_maxremain,
                                gt_size_of_sort_workspace (sfxstrategy));
  GT_INITARRAY(&bsr->mkvauxstack,GtMKVstack);
  bsr->countingsortinfo = NULL;
  bsr->medianinfospace = NULL;
  bsr->blindtrie = NULL;
  bsr->equalwithprevious = NULL;
  bsr->srsw = NULL;
  if (!sfxstrategy->cmpcharbychar)
  {
    int idx;
    const bool withmediumsizelcps = (sortmaxdepth > 0 && !withlcps)
                                    ? true : false;
    if (sortmaxdepth == 0 ||
        gt_encseq_has_twobitencoding_stoppos_support(encseq))
    {
      bsr->srsw = gt_shortreadsort_new(0,bsr->srs_maxremain,readmode,false,
                                       withmediumsizelcps);
    }
    for (idx = 0; idx < GT_UNITSIN2BITENC; idx++)
    {
      bsr->leftlcpdist[idx] = bsr->rightlcpdist[idx] = 0;
    }
    bsr->countingsortinfo = gt_malloc(sizeof (*bsr->countingsortinfo) *
                                      sfxstrategy->maxcountingsort);
    if (sfxstrategy->maxwidthrealmedian >= MINMEDIANOF9WIDTH)
    {
      bsr->medianinfospace = gt_malloc(sizeof (*bsr->medianinfospace) *
                                       sfxstrategy->maxwidthrealmedian);
    } else
    {
      bsr->medianinfospace = NULL;
    }
  }
  bsr->blindtrie = gt_blindtrie_new(bsr->sssp,
                                    sfxstrategy->maxbltriesort,
                                    0, /* the nodenumberincrement */
                                    encseq,
                                    sfxstrategy->cmpcharbychar,
                                    bsr->esr1,
                                    bsr->esr2,
                                    readmode);
  if (sortmaxdepth > 0 && bsr->sfxstrategy->maxinsertionsort >= 2UL)
  {
    GtUword idx;

    bsr->equalwithprevious = gt_malloc(sizeof (*bsr->equalwithprevious) *
                                       bsr->sfxstrategy->maxinsertionsort);
    for (idx=0; idx < bsr->sfxstrategy->maxinsertionsort; idx++)
    {
      bsr->equalwithprevious[idx] = false;
    }
  }
  bsr->sortmaxdepth = sortmaxdepth;
  bsr->processunsortedsuffixrange = NULL;
  bsr->processunsortedsuffixrangeinfo = NULL;
  bsr->countinsertionsort = 0;
  bsr->counttqsort = 0;
  bsr->countcountingsort = 0;
  bsr->countbltriesort = 0;
  bsr->countshortreadsort = 0;
  bsr->countradixsort = 0;
  if (bcktab != NULL &&
      sfxstrategy->withradixsort &&
      gt_encseq_accesstype_get(encseq) == GT_ACCESS_TYPE_EQUALLENGTH &&
      readmode == GT_READMODE_FORWARD)
  {
    bsr->rsi = gt_radixsort_str_new(bsr->twobitencoding,
                                    gt_encseq_is_mirrored(encseq)
                                      ? GT_DIV2(bsr->totallength - 1)
                                      : bsr->totallength,
                                    1 + gt_encseq_equallength(encseq),
                                    gt_bcktab_nonspecialsmaxsize(bcktab));
    bsr->radixsortmaxwidth = gt_radixsort_str_maxwidth(bsr->rsi);
  }
  return bsr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, 0xc(%rsp)
movq %r8, 0x10(%rsp)
movl %ecx, %r14d
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %r13
movq 0x50(%rsp), %rbp
leaq 0x1d2652(%rip), %rsi    # 0x3b5720
movl $0x2f8, %edi            # imm = 0x2F8
movl $0x549, %edx            # imm = 0x549
callq 0x104226
movq %rax, %rbx
movq %r15, (%rax)
movl %r12d, 0x18(%rax)
movq %r15, %rdi
callq 0xe7b9c
movq %rax, 0xb0(%rbx)
movq %rbp, 0x40(%rbx)
movq %r13, 0x48(%rbx)
xorl %r13d, %r13d
movq %r13, 0x2f0(%rbx)
movl 0x18(%rbx), %eax
movl %eax, %ecx
andl $-0x3, %ecx
cmpl $0x1, %ecx
setne 0x1c(%rbx)
andl $-0x2, %eax
cmpl $0x2, %eax
sete 0x1d(%rbx)
movq %r13, 0x38(%rbx)
movl %r14d, 0x64(%rbx)
movq %r15, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0xe91b2
movq %rax, 0x8(%rbx)
movq %r15, %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0xe91b2
movq %rax, 0x10(%rbx)
callq 0x3208fe
movq %rax, 0xa0(%rbx)
movq %r13, 0xa8(%rbx)
movq (%rbx), %rdi
callq 0xf64f6
cmpl $0x2, %eax
jne 0x1e3176
movq (%rbx), %rdi
callq 0xed62d
movq %rax, %r13
movq %r13, 0x2e8(%rbx)
movl 0xc(%rsp), %eax
testl %eax, %eax
je 0x1e3195
cmpl %r14d, %eax
jbe 0x1e31ac
movl %eax, %r13d
movl %r14d, %eax
subq %rax, %r13
jmp 0x1e31af
movq %r15, %rdi
callq 0xec6d1
movl %r14d, %ecx
xorl %r13d, %r13d
subq %rcx, %rax
cmovaeq %rax, %r13
jmp 0x1e31af
xorl %r13d, %r13d
movq %r13, 0x98(%rbx)
movq 0x50(%rsp), %rbp
movq %rbp, %rdi
callq 0x1e2ee0
xorl %r14d, %r14d
xorl %edi, %edi
movq %r13, %rsi
movq %rax, %rdx
callq 0x1f51f1
movq %rax, 0xb8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbx)
movq %r14, 0x30(%rbx)
movups %xmm0, 0x2c0(%rbx)
movups %xmm0, 0x2d0(%rbx)
movq %r14, 0x2e0(%rbx)
movb $0x1, %al
cmpb $0x0, 0x2c(%rbp)
movq 0x10(%rsp), %r13
jne 0x1e32ca
cmpl $0x0, 0xc(%rsp)
setne %r14b
je 0x1e3222
movq %r15, %rdi
callq 0xe9378
testb %al, %al
je 0x1e3249
movb 0x58(%rsp), %al
xorb $0x1, %al
andb %al, %r14b
movq 0x98(%rbx), %rsi
movzbl %r14b, %r8d
xorl %edi, %edi
movl %r12d, %edx
xorl %ecx, %ecx
callq 0x1f5256
movq %rax, 0x2e0(%rbx)
movq %rbx, %rdi
addq $0xc0, %rdi
xorl %r14d, %r14d
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x173a0
xorps %xmm0, %xmm0
movups %xmm0, 0x1c0(%rbx,%r14,8)
addq $0x2, %r14
cmpq $0x20, %r14
jne 0x1e3265
movq 0x50(%rsp), %rbp
movq 0x18(%rbp), %rdi
shlq $0x4, %rdi
leaq 0x1d2494(%rip), %rsi    # 0x3b5720
movl $0x58e, %edx            # imm = 0x58E
callq 0x104226
movq %rax, 0x2d8(%rbx)
movq (%rbp), %rdi
cmpq $0x1f, %rdi
jb 0x1e32be
shlq $0x5, %rdi
leaq 0x1d246e(%rip), %rsi    # 0x3b5720
movl $0x592, %edx            # imm = 0x592
callq 0x104226
jmp 0x1e32c0
xorl %eax, %eax
movq %rax, 0x2d0(%rbx)
movb 0x2c(%rbp), %al
movq 0x48(%rbx), %rdi
movq 0x10(%rbp), %rsi
movq 0x8(%rbx), %r9
movzbl %al, %r8d
andl $0x1, %r8d
xorl %edx, %edx
movq %r15, %rcx
pushq %r12
pushq 0x10(%rbx)
callq 0x1e5fec
addq $0x10, %rsp
movq %rax, 0x2c8(%rbx)
movl 0xc(%rsp), %esi
testl %esi, %esi
je 0x1e3345
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rdi
cmpq $0x2, %rdi
jb 0x1e3345
leaq 0x1d240b(%rip), %rsi    # 0x3b5720
movl $0x5a5, %edx            # imm = 0x5A5
callq 0x104226
movl 0xc(%rsp), %esi
movq %rax, 0x2c0(%rbx)
movq 0x40(%rbx), %rcx
movq 0x8(%rcx), %rdx
testq %rdx, %rdx
je 0x1e3345
movq %rax, %rdi
xorl %esi, %esi
callq 0x173a0
movl 0xc(%rsp), %esi
movl %esi, 0x60(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x68(%rbx)
movups %xmm0, 0x78(%rbx)
movups %xmm0, 0x88(%rbx)
testq %r13, %r13
je 0x1e33d7
cmpb $0x1, 0x37(%rbp)
jne 0x1e33d7
movq %r15, %rdi
callq 0xf64f6
xorl $0x2, %eax
orl %eax, %r12d
jne 0x1e33d7
movq 0x2e8(%rbx), %r14
movq %r15, %rdi
callq 0xf6567
movq 0xb0(%rbx), %rcx
leaq -0x1(%rcx), %r12
shrq %r12
testb %al, %al
cmoveq %rcx, %r12
movq %r15, %rdi
callq 0xf64f9
leaq 0x1(%rax), %r15
movq %r13, %rdi
callq 0x18c04c
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rax, %rcx
callq 0x3206f8
movq %rax, 0x2f0(%rbx)
movq %rax, %rdi
callq 0x320904
movq %rax, 0xa8(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq