// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/idx-limdfs.c
// Function: genericindex_new
Genericindex *genericindex_new(const char *indexname,
                               bool withesa,
                               bool withencseq,
                               bool withdestab,
                               bool withssptab,
                               int userdefinedmaxdepth,
                               GtLogger *logger,
                               GtError *err)
{
  unsigned int demand = 0;
  bool haserr = false;
  Genericindex *genericindex;

  genericindex = gt_malloc(sizeof (*genericindex));
  if (withesa)
  {
    demand |= SARR_SUFTAB;
  }
  if (withencseq)
  {
    demand |= SARR_ESQTAB;
  }
  if (withdestab)
  {
    demand |= SARR_DESTAB;
  }
  if (withssptab)
  {
    demand |= SARR_SSPTAB;
  }
  genericindex->withesa = withesa;
  genericindex->suffixarray = gt_malloc(sizeof (*genericindex->suffixarray));
  if (gt_mapsuffixarray(genericindex->suffixarray,
                        demand,
                        indexname,
                        logger,
                        err) != 0)
  {
    haserr = true;
    genericindex->totallength = 0;
  } else
  {
    genericindex->totallength
      = gt_encseq_total_length(genericindex->suffixarray->encseq);
  }
  if (!haserr)
  {
    if (withesa && genericindex->suffixarray->readmode != GT_READMODE_FORWARD)
    {
      gt_error_set(err,"using option -esa you can only process index "
                       "in forward mode");
      haserr = true;
    } else
    {
      if (!withesa
            && genericindex->suffixarray->readmode != GT_READMODE_REVERSE)
      {
        gt_error_set(err,"with option -pck you can only process index "
                         "in reverse mode");
        haserr = true;
      }
    }
  }
  genericindex->packedindex = NULL;
  genericindex->mbtab = NULL;
  genericindex->maxdepth = 0;
  if (!haserr && !withesa)
  {
    genericindex->packedindex = gt_loadvoidBWTSeqForSA(indexname,true, err);
    if (genericindex->packedindex == NULL)
    {
      gt_assert(gt_error_is_set(err));
      haserr = true;
    }
  }
  if (!haserr && !withesa)
  {
    genericindex->mbtab = gt_bwtseq2mbtab(genericindex->packedindex);
    genericindex->maxdepth = gt_bwtseq2maxdepth(genericindex->packedindex);
    if (userdefinedmaxdepth >= 0 &&
        genericindex->maxdepth > (unsigned int) userdefinedmaxdepth)
    {
      genericindex->maxdepth = (unsigned int) userdefinedmaxdepth;
    }
  }
  if (haserr)
  {
    genericindex_delete(genericindex);
    return NULL;
  }
  return genericindex;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, 0x4(%rsp)
movl %r8d, %r15d
movl %ecx, %ebp
movl %edx, %r13d
movl %esi, %r14d
movq %rdi, %r12
leaq 0x1f5e41(%rip), %rsi    # 0x3b0cf4
movl $0x30, %edi
movl $0x59, %edx
callq 0x1092b2
movq %rax, %rbx
leal (%r13,%r14,2), %eax
leal 0x10(%r13,%r14,2), %ecx
testl %ebp, %ebp
cmovel %eax, %ecx
leal 0x80(%rcx), %ebp
testl %r15d, %r15d
movq 0x48(%rsp), %r15
cmovel %ecx, %ebp
movb %r14b, 0x18(%rbx)
movl $0x100, %edi            # imm = 0x100
leaq 0x1f5dff(%rip), %rsi    # 0x3b0cf4
movl $0x6b, %edx
callq 0x1092b2
movq %rax, (%rbx)
movq %rax, %rdi
movl %ebp, %esi
movq %r12, %rdx
movq 0x40(%rsp), %rcx
movq %r15, %r8
callq 0x1aab20
testl %eax, %eax
je 0x1baf22
movb $0x1, %bpl
xorl %eax, %eax
jmp 0x1baf2f
movq (%rbx), %rax
movq (%rax), %rdi
callq 0xec1d8
xorl %ebp, %ebp
movq %rax, 0x8(%rbx)
testb %bpl, %bpl
jne 0x1baf71
testb %r14b, %r14b
je 0x1baf54
movq (%rbx), %rax
cmpl $0x0, 0x48(%rax)
je 0x1baf4f
leaq 0x1f5e3d(%rip), %rsi    # 0x3b0d8a
jmp 0x1baf64
testb %r14b, %r14b
jne 0x1baf71
movq (%rbx), %rax
cmpl $0x1, 0x48(%rax)
je 0x1baf71
leaq 0x1f5e63(%rip), %rsi    # 0x3b0dc7
movq %r15, %rdi
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %bpl
xorl %eax, %eax
movq %rax, 0x10(%rbx)
movq %rax, 0x20(%rbx)
movl $0x0, 0x28(%rbx)
movl %ebp, %eax
orb %r14b, %al
jne 0x1bafb1
movq %r12, %rdi
movl $0x1, %esi
movq %r15, %rdx
callq 0x1a86aa
movq %rax, 0x10(%rbx)
testq %rax, %rax
jne 0x1bafb1
movq %r15, %rdi
callq 0x101a9a
movb $0x1, %bpl
testb %al, %al
je 0x1bb002
movl %ebp, %eax
orb %r14b, %al
jne 0x1bafe1
movq 0x10(%rbx), %rdi
callq 0x1a8812
movq %rax, 0x20(%rbx)
movq 0x10(%rbx), %rdi
callq 0x1a882d
movl 0x4(%rsp), %edx
cmpl %edx, %eax
movl %edx, %ecx
cmovbl %eax, %ecx
testl %edx, %edx
cmovsl %eax, %ecx
movl %ecx, 0x28(%rbx)
testb %bpl, %bpl
je 0x1baff0
movq %rbx, %rdi
callq 0x1bae24
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x66a9b