// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/encseq.c
// Function: determineencseqkeyvalues
static GtEncseq *determineencseqkeyvalues(GtEncseqAccessType sat,
                                          GtUword totallength,
                                          GtUword numofsequences,
                                          GtUword numofdbfiles,
                                          GtUword lengthofdbfilenames,
                                          GtUword wildcardranges,
                                          GtUword exceptionranges,
                                          GtUword minseqlen,
                                          GtUword maxseqlen,
                                          bool oistab,
                                          bool no_esq_header,
                                          const Definedunsignedlong
                                             *equallength,
                                          GtAlphabet *alpha,
                                          bool customalphabet,
                                          GtLogger *logger)
{
  double spaceinbitsperchar;
  GtEncseq *encseq;

  encseq = gt_malloc(sizeof (*encseq));
  encseq->sat = sat;
  encseq->exceptions = NULL;
  encseq->indexname = NULL;
  encseq->oissat = GT_ACCESS_TYPE_UINT32TABLES;
  encseq->accesstype_via_utables = gt_encseq_access_type_isviautables(sat);
  if (sat == GT_ACCESS_TYPE_EQUALLENGTH || numofsequences == 1UL)
    encseq->satsep = GT_ACCESS_TYPE_UNDEFINED;
  else {
    encseq->satsep = determineoptimalsssptablerep(totallength,
                                                  numofsequences-1);
  }
  encseq->has_exceptiontable = oistab;
  if (encseq->accesstype_via_utables)
    initSWtable(&encseq->wildcardrangetable, totallength, sat, wildcardranges);
  if (encseq->satsep != GT_ACCESS_TYPE_UNDEFINED)
    initSWtable(&encseq->ssptab, totallength, encseq->satsep, numofsequences-1);
  if (encseq->has_exceptiontable) {
    initSWtable(&encseq->exceptiontable, totallength, encseq->oissat,
                exceptionranges);
  }
  encseq->has_wildcardranges = (wildcardranges > 0) ? true : false;
  encseq->has_specialranges
    = (wildcardranges > 0 || numofsequences > 1UL) ? true : false;
  encseq->has_ssptab = false;
  encseq->headerptr.filelengthtab = NULL;
  encseq->filenametab = NULL;
  encseq->mappedptr = NULL;
  encseq->ssptabmappedptr = NULL;
  encseq->oistabmappedptr = NULL;
  encseq->headerptr.satcharptr = NULL;
  encseq->headerptr.numofdbsequencesptr = NULL;
  encseq->headerptr.numofdbfilesptr = NULL;
  encseq->headerptr.lengthofdbfilenamesptr = NULL;
  encseq->headerptr.firstfilename = NULL;
  encseq->headerptr.specialcharinfoptr = NULL;
  encseq->headerptr.minseqlenptr = NULL;
  encseq->headerptr.maxseqlenptr = NULL;
  encseq->reference_count = 0;
  encseq->refcount_lock = gt_mutex_new();
  encseq->destab = NULL;
  encseq->hasmirror = false;
  encseq->hasallocateddestab = false;
  encseq->sdstab = NULL;
  encseq->hasallocatedsdstab = false;
  encseq->destablength = 0;
  encseq->fsptab = NULL;
  encseq->md5_tab = NULL;
  encseq->hasallocatedssptab = false;
  if (equallength == NULL) {
    encseq->equallength.defined = false;
    encseq->equallength.valueunsignedlong = 0;
  }
  else {
    encseq->equallength = *equallength;
  }
  encseq->alpha = alpha;
  alphabet_to_key_values(alpha, &encseq->alphatype, &encseq->lengthofalphadef,
                         &encseq->alphadef, customalphabet);
  encseq->totallength = totallength;
  encseq->logicaltotallength = totallength;
  encseq->numofdbsequences = numofsequences;
  encseq->logicalnumofdbsequences = numofsequences;
  encseq->numofdbfiles = numofdbfiles;
  encseq->lengthofdbfilenames = lengthofdbfilenames;
  encseq->numofchars = gt_alphabet_num_of_chars(alpha);
  encseq->minseqlen = minseqlen;
  encseq->maxseqlen = maxseqlen;
  if (no_esq_header)
    encseq->sizeofrep = totallength;
  else {
    uint64_t sizeofrep_uint64
      = gt_encseq_determine_size(sat,
                                 totallength,
                                 numofsequences,
                                 numofdbfiles,
                                 lengthofdbfilenames,
                                 wildcardranges,
                                 encseq->numofchars,
                                 gt_alphabet_bits_per_symbol(alpha),
                                 encseq->lengthofalphadef);
    encseq->sizeofrep = CALLCASTFUNC(uint64_t, unsigned_long, sizeofrep_uint64);
  }
  encseq->satname = gt_encseq_access_type_str(sat);
  encseq->twobitencoding = NULL;
  if (sat == GT_ACCESS_TYPE_DIRECTACCESS || sat == GT_ACCESS_TYPE_BYTECOMPRESS)
    encseq->unitsoftwobitencoding = 0;
  else
    encseq->unitsoftwobitencoding = gt_unitsoftwobitencoding(totallength);

  encseq->plainseq = NULL;
  encseq->bitpackarray = NULL;
  encseq->exceptions = NULL;
  encseq->hasplainseqptr = false;
  encseq->specialbits = NULL;
  setencsequtablesNULL(encseq->sat, &encseq->wildcardrangetable);
  setencsequtablesNULL(encseq->satsep, &encseq->ssptab);
  encseq->headerptr.characterdistribution = NULL;

  encseq->leastprobablecharacter = encseq->numofchars; /* undefined */

  spaceinbitsperchar = determine_spaceinbitsperchar(encseq->sizeofrep,
                                                    totallength);
  if (encseq->sat == GT_ACCESS_TYPE_EQUALLENGTH) {
    gt_assert(encseq->equallength.defined);
    gt_logger_log(logger,
                  "init character encoding (%s "GT_WU", "GT_WU" bytes, %.2f "
                  "bits/symbol)",
                  encseq->satname, encseq->equallength.valueunsignedlong,
                  encseq->sizeofrep, spaceinbitsperchar);
  }
  else {
    gt_logger_log(logger,
                  "init character encoding (%s, "GT_WU" bytes, %.2f "
                  "bits/symbol)",
                  encseq->satname, encseq->sizeofrep, spaceinbitsperchar);
    if (encseq->numofdbsequences > 1UL) {
      GtUword sizessptab = CALLCASTFUNC(uint64_t, unsigned_long,
                                     gt_encseq_sizeofSWtable(encseq->satsep,
                                              false,
                                              false,
                                              totallength,
                                              numofsequences-1));
      spaceinbitsperchar = determine_spaceinbitsperchar(sizessptab,
                                                        totallength);
      gt_logger_log(logger,
                    "init ssptab encoding (%s, "GT_WU" bytes, %.2f "
                    "bits/symbol)",
                    gt_encseq_access_type_str(encseq->satsep),
                    sizessptab,
                    spaceinbitsperchar);
    }
  }
  return encseq;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x30(%rsp)
movq %r8, 0x40(%rsp)
movq %rcx, 0x28(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movl %edi, %ebp
movb 0x98(%rsp), %r14b
leaq 0x47811(%rip), %rsi     # 0xebb9a
movl $0x3c0, %edi            # imm = 0x3C0
movl $0xffc, %edx            # imm = 0xFFC
callq 0xccb0
movq %rax, %rbx
movl %ebp, (%rax)
andq $0x0, 0x330(%rax)
andq $0x0, 0x68(%rax)
movl $0x6, 0x388(%rax)
movl %ebp, %edi
callq 0xb955c
movb %al, 0x3a9(%rbx)
cmpl $0x2, %ebp
sete %cl
cmpq $0x1, %r13
sete %dl
orb %cl, %dl
je 0xa43f6
leaq 0x4(%rbx), %rcx
movq %rcx, 0x20(%rsp)
movl $0x7, 0x4(%rbx)
leaq 0x2f0(%rbx), %r12
movb %r14b, 0x2f0(%rbx)
testb %al, %al
jne 0xa4425
jmp 0xa4458
leaq -0x1(%r13), %rsi
movq %r15, %rdi
callq 0xa7174
leaq 0x4(%rbx), %rcx
movq %rcx, 0x20(%rsp)
movl %eax, 0x4(%rbx)
leaq 0x2f0(%rbx), %r12
movb %r14b, 0x2f0(%rbx)
testb $0x1, 0x3a9(%rbx)
je 0xa4443
leaq 0x2b8(%rbx), %rdi
movq %r15, %rsi
movl %ebp, %edx
movq 0x30(%rsp), %rcx
callq 0xa7212
movl 0x4(%rbx), %eax
cmpl $0x7, %eax
je 0xa4458
leaq 0x240(%rbx), %rdi
leaq -0x1(%r13), %rcx
movq %r15, %rsi
movl %eax, %edx
callq 0xa7212
movq 0xa8(%rsp), %r14
cmpb $0x1, (%r12)
jne 0xa4484
movq 0x80(%rsp), %rcx
leaq 0x2f8(%rbx), %rdi
movl 0x388(%rbx), %edx
movq %r15, %rsi
callq 0xa7212
movq %r15, 0x8(%rsp)
cmpq $0x0, 0x30(%rsp)
setne %al
setne 0x29(%rbx)
movq %r13, 0x10(%rsp)
cmpq $0x2, %r13
setae %cl
orb %al, %cl
movb %cl, 0x28(%rbx)
xorl %r12d, %r12d
movb %r12b, 0x2a(%rbx)
andq $0x0, 0xf0(%rbx)
movq 0xb0(%rsp), %r15
andq $0x0, 0x1f8(%rbx)
andq $0x0, 0x80(%rbx)
andq $0x0, 0x390(%rbx)
andq $0x0, 0x20(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x90(%rbx)
movups %xmm0, 0xa0(%rbx)
andq $0x0, 0xb0(%rbx)
movups %xmm0, 0xd8(%rbx)
callq 0x15f7b
movq %rax, 0x398(%rbx)
movb %r12b, 0x3a8(%rbx)
andq $0x0, 0x278(%rbx)
andq $0x0, 0x3a0(%rbx)
andl $0x0, 0x207(%rbx)
andq $0x0, 0x200(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x210(%rbx)
testq %r14, %r14
movl %ebp, 0x3c(%rsp)
je 0xa4554
leaq 0x1e8(%rbx), %rax
movups (%r14), %xmm0
movups %xmm0, (%rax)
jmp 0xa4563
movb $0x0, 0x1e8(%rbx)
andq $0x0, 0x1f0(%rbx)
movq 0x28(%rsp), %r14
movq %r15, 0x220(%rbx)
leaq 0x238(%rbx), %rsi
leaq 0x230(%rbx), %r12
movq %rbx, %rcx
addq $0x228, %rcx            # imm = 0x228
movzbl 0xb8(%rsp), %r8d
movq %r15, %rdi
movq %r12, %rdx
callq 0xa48b6
movq 0x8(%rsp), %rbp
movq %rbp, 0x30(%rbx)
movq %rbp, 0x38(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rbx)
movq %rax, 0x48(%rbx)
movq %r14, 0x50(%rbx)
movq 0x40(%rsp), %r13
movq %r13, 0x58(%rbx)
movq %r15, %rdi
callq 0x9b59a
movl %eax, %r14d
movl %eax, 0x2a8(%rbx)
movq 0x88(%rsp), %rax
movq %rax, 0x3b0(%rbx)
movq 0x90(%rsp), %rax
movq %rax, 0x3b8(%rbx)
movq %rbp, %rax
cmpb $0x0, 0xa0(%rsp)
movl 0x3c(%rsp), %ebp
jne 0xa4637
movq %r15, %rdi
callq 0x9b6a8
subq $0x8, %rsp
movl %ebp, %edi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq %r13, %r8
movq 0x38(%rsp), %r9
pushq (%r12)
pushq %rax
pushq %r14
callq 0xa7cc2
addq $0x20, %rsp
movq %rax, 0x60(%rbx)
movl %ebp, %edi
callq 0xb948c
movq %rax, 0x8(%rbx)
andq $0x0, 0x280(%rbx)
cmpl $0x2, %ebp
jae 0xa4666
xorl %ecx, %ecx
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %r13
movq 0x8(%rsp), %r15
jmp 0xa468c
movq 0x8(%rsp), %r15
leaq -0x1(%r15), %rdx
shrq $0x5, %rdx
addq $0x2, %rdx
cmpq $0x20, %r15
pushq $0x2
popq %rcx
cmovaeq %rdx, %rcx
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %r13
movq %rcx, 0x288(%rbx)
andq $0x0, 0x290(%rbx)
andq $0x0, 0x2a0(%rbx)
andq $0x0, 0x330(%rbx)
movb $0x0, 0x298(%rbx)
andq $0x0, 0x2b0(%rbx)
movl (%rbx), %ecx
leal -0x4(%rcx), %edx
cmpl $0x2, %edx
ja 0xa46d5
xorps %xmm0, %xmm0
movups %xmm0, 0x2c8(%rbx)
movups %xmm0, 0x2b8(%rbx)
movl (%r13), %edx
addl $-0x4, %edx
cmpl $0x2, %edx
ja 0xa46f2
xorps %xmm0, %xmm0
movups %xmm0, 0x250(%rbx)
movups %xmm0, 0x240(%rbx)
movq 0xc0(%rsp), %r12
andq $0x0, 0xf8(%rbx)
movl 0x2a8(%rbx), %edx
movl %edx, 0x170(%rbx)
movq 0x60(%rbx), %r8
leaq (,%r8,8), %rdx
movq %rdx, %xmm1
movq 0x25d59(%rip), %xmm2    # 0xca480
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x25d5d(%rip), %xmm3    # 0xca490
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %r15, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
cmpl $0x2, %ecx
jne 0xa4792
cmpb $0x0, 0x1e8(%rbx)
je 0xa483c
movq 0x1f0(%rbx), %rcx
leaq 0x4b0a8(%rip), %rsi     # 0xef828
movq %r12, %rdi
movq %rax, %rdx
movb $0x1, %al
callq 0xc9c1
jmp 0xa482a
movapd %xmm2, 0x10(%rsp)
leaq 0x4b0c7(%rip), %rsi     # 0xef866
movq %r12, %rdi
movq %rax, %rdx
movq %r8, %rcx
movb $0x1, %al
callq 0xc9c1
cmpq $0x2, 0x40(%rbx)
jb 0xa482a
movl (%r13), %edi
decq %r14
xorl %esi, %esi
xorl %edx, %edx
movq %r15, %rcx
movq %r14, %r8
callq 0xa7df3
movq %rax, %r14
leaq (,%rax,8), %rax
movq %rax, %xmm0
punpckldq 0x25c9c(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x25ca4(%rip), %xmm0    # 0xca490
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x10(%rsp), %xmm1
movapd %xmm1, 0x10(%rsp)
movl (%r13), %edi
callq 0xb948c
leaq 0x4b08c(%rip), %rsi     # 0xef8a0
movq %r12, %rdi
movq %rax, %rdx
movq %r14, %rcx
movapd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0xc9c1
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x89775(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x25819(%rip), %rsi     # 0xca066
leaq 0x48a3a(%rip), %rdx     # 0xed28e
leaq 0x4afb4(%rip), %rcx     # 0xef80f
leaq 0x47338(%rip), %r8      # 0xebb9a
movl $0x1064, %r9d           # imm = 0x1064
xorl %eax, %eax
callq 0xb8c0
callq 0xb300