// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/sfx-diffcov.c
// Function: gt_differencecover_new
GtDifferencecover *gt_differencecover_new(unsigned int vparam,
                                          const GtEncseq *encseq,
                                          GtReadmode readmode,
                                          unsigned int outerprefixlength,
                                          GtLogger *logger)
{
  unsigned int offset = 0, v = 1U;
  GtDifferencecover *dcov;
  bool found = false;

  dcov = gt_malloc(sizeof (*dcov));
  dcov->requiredspace = sizeof (*dcov);
  dcov->numofchars = gt_alphabet_num_of_chars(gt_encseq_alphabet(encseq));
  dcov->totallength = gt_encseq_total_length(encseq);
  dcov->logger = logger;
  dcov->samplesize_upperbound = 0;
  dcov->rmq = NULL;
  for (dcov->logmod = 0;
       dcov->logmod < (unsigned int) (sizeof (differencecoversizes)/
                                      sizeof (differencecoversizes[0]));
       dcov->logmod++)
  {
    if (v == vparam)
    {
      dcov->size = differencecoversizes[dcov->logmod];
      dcov->samplesize_upperbound
        = (GtUword) (GT_DIVV(dcov->totallength) + 1) * dcov->size;
      dcov->diffvalues = differencecovertab + offset;
      if (dcov->samplesize_upperbound <= GT_DIFFERENCECOVER_MAX_SAMPLESIZE)
      {
        found = true;
        break;
      }
    }
    offset += differencecoversizes[dcov->logmod];
    v = GT_MULT2(v);
  }
  if (!found)
  {
    gt_free(dcov);
    return NULL;
  }
  if (outerprefixlength == 0)
  {
    dcov->prefixlength = 0;
  } else
  {
    dcov->prefixlength
      = gt_recommendedprefixlength(dcov->numofchars,
                                   dcov->samplesize_upperbound,
                                   GT_RECOMMENDED_MULTIPLIER_DEFAULT,
                                   true);
    if (outerprefixlength > 0 && dcov->prefixlength > outerprefixlength)
    {
      dcov->prefixlength = outerprefixlength;
    }
    gt_assert(dcov->prefixlength > 0);
  }
  dcov->vparam = 1U << (dcov->logmod);
  dcov->vmodmask = dcov->vparam-1;
#ifdef WITHcomputehvalue
  dcov->hvalue = dc_computehvalue(dcov,totallength);
#endif
  dcov->encseq = encseq;
  dcov->readmode = readmode;
  dcov->bcktab = NULL;
  dcov->sortedsample = NULL;
  dcov->filltable = NULL;
  dcov->multimappower = NULL;
  dc_fillcoverrank(dcov);
  dcov->diff2pos = NULL; /* this is later initialized */
  dcov->allocateditvinfo = 0;
  dcov->itvinfo = NULL;
  dcov->currentdepth = 0;
  dcov->firstwithnewdepth.defined = false;
  dcov->firstwithnewdepth.depth = 0;
  dcov->firstwithnewdepth.totalwidth = 0;
  dcov->firstwithnewdepth.count = 0;
  dcov->firstwithnewdepth.blisbl = 0;
  dcov->firstwithnewdepth.width = 0;
  dcov->firstwithnewdepth.maxwidth = 0;
  dcov->currentqueuesize = 0;
  dcov->maxqueuesize = 0;
  dcov->inversesuftab = NULL;
  dcov->samplelcpvalues = NULL;
  dcov->firstgenerationtotalwidth = 0;
  dcov->firstgenerationcount = 0;
  GT_INITARRAY(&dcov->firstgeneration,GtDcPairsuffixptr);
  return dcov;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r13
movl %ecx, %r15d
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r12d
leaq 0x1ce3b0(%rip), %rsi    # 0x3bff50
movl $0x158, %edi            # imm = 0x158
movl $0x1aa, %edx            # imm = 0x1AA
callq 0x1092b2
movq %rax, %rbx
movq $0x158, 0x40(%rax)      # imm = 0x158
movq %r14, %rdi
callq 0xf02da
movq %rax, %rdi
callq 0xd3713
movl %eax, 0x14(%rbx)
movq %r14, %rdi
callq 0xec1d8
movq %rax, 0x48(%rbx)
movq %r13, 0x140(%rbx)
xorl %ecx, %ecx
movq %rcx, 0x80(%rbx)
movq %rcx, 0x150(%rbx)
movl $0x1, %edx
leaq 0x1ce344(%rip), %rdi    # 0x3bff40
leaq 0x2d3a1d(%rip), %r8     # 0x4c5620
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
xorl %r10d, %r10d
cmpl %r12d, %edx
jne 0x1f1c3e
movzbl (%rcx,%rdi), %r11d
movq %rax, %rsi
shrq %cl, %rsi
movl %r11d, 0x8(%rbx)
incq %rsi
imulq %r11, %rsi
movq %rsi, 0x80(%rbx)
movl %r10d, %r11d
leaq (%r8,%r11,2), %r11
movq %r11, 0x30(%rbx)
cmpq %r9, %rsi
jb 0x1f1c72
movzbl (%rcx,%rdi), %esi
addl %esi, %r10d
addl %edx, %edx
incq %rcx
cmpq $0x10, %rcx
jne 0x1f1c0c
movl $0x10, 0x4(%rbx)
leaq 0x1ce2f2(%rip), %rsi    # 0x3bff50
movq %rbx, %rdi
movl $0x1c7, %edx            # imm = 0x1C7
callq 0x109670
xorl %ebx, %ebx
jmp 0x1f1e0f
movl %ecx, 0x4(%rbx)
testl %r15d, %r15d
je 0x1f1ca3
movl 0x14(%rbx), %edi
movsd 0x168a8b(%rip), %xmm0   # 0x35a710
movl $0x1, %edx
callq 0x1ec4ec
cmpl %r15d, %eax
cmovbl %eax, %r15d
movl %r15d, 0x18(%rbx)
testl %eax, %eax
jne 0x1f1caa
callq 0x78c73
movl $0x0, 0x18(%rbx)
movb 0x4(%rbx), %cl
movl $0x1, %edi
shlq %cl, %rdi
movl %edi, (%rbx)
leal -0x1(%rdi), %eax
movl %eax, 0xc(%rbx)
movq %r14, 0x60(%rbx)
movl %ebp, 0x68(%rbx)
xorl %eax, %eax
movq %rax, 0x58(%rbx)
movq %rax, 0x148(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x88(%rbx)
movq 0x48(%rbx), %r12
shrq %cl, %r12
shlq $0x3, %rdi
leaq 0x1ce263(%rip), %r14    # 0x3bff50
movq %r14, %rsi
movl $0x14d, %edx            # imm = 0x14D
callq 0x1092b2
movq %rax, 0x20(%rbx)
movl (%rbx), %eax
leal -0x1(%rax), %ecx
shrl $0x6, %ecx
cmpl $0x40, %eax
leal 0x8(,%rcx,8), %eax
movl $0x8, %r15d
cmovael %eax, %r15d
xorl %edi, %edi
movq %r15, %rsi
movq %r14, %rdx
movl $0x14e, %ecx            # imm = 0x14E
callq 0x1094e6
movq %rax, 0x28(%rbx)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x173a0
movl (%rbx), %eax
movl 0x8(%rbx), %ebp
leaq (,%rax,8), %rdx
addq %rdx, 0x40(%rbx)
cmpl $0xff, %ebp
ja 0x1f1e21
testl %eax, %eax
je 0x1f1d6c
movq 0x20(%rbx), %rdi
movl $0xff, %esi
callq 0x173a0
testl %ebp, %ebp
je 0x1f1db9
incq %r12
movq 0x30(%rbx), %rax
movq 0x20(%rbx), %rdx
movq 0x28(%rbx), %rsi
movb $0x1, %r9b
xorl %edi, %edi
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
leal -0x1(%r9), %ecx
movzbl %cl, %ecx
movzwl (%rax,%rcx,2), %ecx
movq %rdi, (%rdx,%rcx,8)
movq %r8, %r10
shrq %cl, %r10
shrl $0x6, %ecx
orq %r10, (%rsi,%rcx,8)
movzbl %r9b, %ecx
leal 0x1(%rcx), %r9d
addq %r12, %rdi
cmpl %ecx, %ebp
ja 0x1f1d8e
xorl %eax, %eax
movq %rax, 0x38(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rbx)
movups %xmm0, 0xa8(%rbx)
movq %rax, 0xb8(%rbx)
movups %xmm0, 0xc8(%rbx)
movups %xmm0, 0xd8(%rbx)
movups %xmm0, 0xe8(%rbx)
movb $0x0, 0xf8(%rbx)
movups %xmm0, 0x108(%rbx)
movups %xmm0, 0x118(%rbx)
movups %xmm0, 0x128(%rbx)
movq %rax, 0x138(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x78cac