// File: /workspace/github_c_makefile_star2_O2/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, %ebp
movq %rsi, %r15
movq %rdi, %r13
movq 0x50(%rsp), %r12
leaq 0x1c3aa0(%rip), %rsi    # 0x355b80
movl $0x2f8, %edi            # imm = 0x2F8
movl $0x549, %edx            # imm = 0x549
callq 0x93160
movq %rax, %rbx
movq %r15, (%rax)
movl %ebp, 0x18(%rax)
movq %r15, %rdi
callq 0x7055e
movq %rax, 0xb0(%rbx)
movq %r12, 0x40(%rbx)
movq %r13, 0x48(%rbx)
andq $0x0, 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)
andq $0x0, 0x38(%rbx)
movl %r14d, 0x64(%rbx)
xorl %r13d, %r13d
movq %r15, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x72260
movq %rax, 0x8(%rbx)
movq %r15, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x72260
movq %rax, 0x10(%rbx)
callq 0x2c1b25
movq %rax, 0xa0(%rbx)
andq $0x0, 0xa8(%rbx)
movq (%rbx), %rdi
callq 0x81d17
cmpl $0x2, %eax
jne 0x192188
movq (%rbx), %rdi
callq 0x776db
movq %rax, %r13
movq %r13, 0x2e8(%rbx)
movl 0xc(%rsp), %r12d
testl %r12d, %r12d
je 0x1921a9
cmpl %r14d, %r12d
jbe 0x1921c0
movl %r12d, %r13d
movl %r14d, %eax
subq %rax, %r13
jmp 0x1921c3
movq %r15, %rdi
callq 0x762ce
movl %r14d, %ecx
xorl %r13d, %r13d
subq %rcx, %rax
cmovaeq %rax, %r13
jmp 0x1921c3
xorl %r13d, %r13d
movq %r13, 0x98(%rbx)
movq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x191f08
xorl %edi, %edi
movq %r13, %rsi
movq %rax, %rdx
callq 0x1a77e9
movq %rax, 0xb8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbx)
andq $0x0, 0x30(%rbx)
movups %xmm0, 0x2c0(%rbx)
andq $0x0, 0x2e0(%rbx)
movups %xmm0, 0x2d0(%rbx)
movb $0x1, %al
cmpb $0x0, 0x2c(%r14)
movq 0x10(%rsp), %r13
jne 0x1922d0
testl %r12d, %r12d
setne %r14b
je 0x192234
movq %r15, %rdi
callq 0x724c8
testb %al, %al
je 0x19225a
movb 0x58(%rsp), %al
xorb $0x1, %al
andb %al, %r14b
movq 0x98(%rbx), %rsi
movzbl %r14b, %r8d
xorl %edi, %edi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x1a784e
movq %rax, 0x2e0(%rbx)
movq $-0x100, %rax
movq 0x50(%rsp), %r14
testq %rax, %rax
je 0x192283
andq $0x0, 0x2c0(%rbx,%rax)
andq $0x0, 0x1c0(%rbx,%rax)
addq $0x8, %rax
jmp 0x192266
movq 0x18(%r14), %rdi
shlq $0x4, %rdi
leaq 0x1c38ee(%rip), %rsi    # 0x355b80
movl $0x58e, %edx            # imm = 0x58E
callq 0x93160
movq %rax, 0x2d8(%rbx)
movq (%r14), %rdi
cmpq $0x1f, %rdi
jb 0x1922c3
shlq $0x5, %rdi
leaq 0x1c38c9(%rip), %rsi    # 0x355b80
movl $0x592, %edx            # imm = 0x592
callq 0x93160
jmp 0x1922c5
xorl %eax, %eax
movq %rax, 0x2d0(%rbx)
movb 0x2c(%r14), %al
movq 0x48(%rbx), %rdi
movq 0x10(%r14), %rsi
movq 0x8(%rbx), %r9
movzbl %al, %r8d
andl $0x1, %r8d
xorl %edx, %edx
movq %r15, %rcx
pushq %rbp
pushq 0x10(%rbx)
callq 0x1950ec
popq %rcx
popq %rdx
movq %rax, 0x2c8(%rbx)
testl %r12d, %r12d
je 0x19233e
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rdi
cmpq $0x2, %rdi
jb 0x19233e
leaq 0x1c386b(%rip), %rsi    # 0x355b80
movl $0x5a5, %edx            # imm = 0x5A5
callq 0x93160
movq %rax, 0x2c0(%rbx)
movq 0x40(%rbx), %rcx
movq 0x8(%rcx), %rcx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x19233e
movb $0x0, (%rax,%rdx)
incq %rdx
jmp 0x192330
movl %r12d, 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 0x1923d1
cmpb $0x1, 0x37(%r14)
jne 0x1923d1
movq %r15, %rdi
callq 0x81d17
xorl $0x2, %eax
orl %eax, %ebp
jne 0x1923d1
movq 0x2e8(%rbx), %r14
movq %r15, %rdi
callq 0x81dea
movq 0xb0(%rbx), %rcx
leaq -0x1(%rcx), %r12
shrq %r12
testb %al, %al
cmoveq %rcx, %r12
movq %r15, %rdi
callq 0x81d1a
leaq 0x1(%rax), %r15
movq %r13, %rdi
callq 0x135699
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rax, %rcx
callq 0x2c1918
movq %rax, 0x2f0(%rbx)
movq %rax, %rdi
callq 0x2c1b2b
movq %rax, 0xa8(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq