// File: /workspace/github_c_makefile_star2_O3/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, 0x38(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movl %edi, %ebp
movb 0x98(%rsp), %r14b
leaq 0x40dcc(%rip), %rsi     # 0x10291a
movl $0x3c0, %edi            # imm = 0x3C0
movl $0xffc, %edx            # imm = 0xFFC
callq 0x35862
movq %rax, %rbx
movl %ebp, (%rax)
xorl %eax, %eax
movq %rax, 0x330(%rbx)
movq %rax, 0x68(%rbx)
movl $0x6, 0x388(%rbx)
movl %ebp, %edi
callq 0xd3975
movb %al, 0x3a9(%rbx)
movl %ebp, 0xc(%rsp)
cmpl $0x2, %ebp
sete %cl
cmpq $0x1, %r13
sete %dl
orb %cl, %dl
je 0xc1bbf
leaq 0x4(%rbx), %rcx
movq %rcx, 0x28(%rsp)
movl $0x7, 0x4(%rbx)
leaq 0x2f0(%rbx), %r12
movb %r14b, 0x2f0(%rbx)
testb %al, %al
jne 0xc1bee
jmp 0xc1c23
leaq -0x1(%r13), %rsi
movq %r15, %rdi
callq 0xc427f
leaq 0x4(%rbx), %rcx
movq %rcx, 0x28(%rsp)
movl %eax, 0x4(%rbx)
leaq 0x2f0(%rbx), %r12
movb %r14b, 0x2f0(%rbx)
testb $0x1, 0x3a9(%rbx)
je 0xc1c0e
leaq 0x2b8(%rbx), %rdi
movq %r15, %rsi
movl 0xc(%rsp), %edx
movq 0x30(%rsp), %rcx
callq 0xc4301
movl 0x4(%rbx), %eax
cmpl $0x7, %eax
je 0xc1c23
leaq 0x240(%rbx), %rdi
leaq -0x1(%r13), %rcx
movq %r15, %rsi
movl %eax, %edx
callq 0xc4301
movq %r13, 0x10(%rsp)
movq 0xa8(%rsp), %r14
cmpb $0x1, (%r12)
jne 0xc1c54
movq 0x80(%rsp), %rcx
leaq 0x2f8(%rbx), %rdi
movl 0x388(%rbx), %edx
movq %r15, %rsi
callq 0xc4301
movq 0xb0(%rsp), %rbp
cmpq $0x0, 0x30(%rsp)
setne %al
setne 0x29(%rbx)
cmpq $0x2, 0x10(%rsp)
setae %cl
orb %al, %cl
movb %cl, 0x28(%rbx)
xorl %r12d, %r12d
movb %r12b, 0x2a(%rbx)
movq %r12, 0xf0(%rbx)
movq %r12, 0x1f8(%rbx)
movq %r12, 0x80(%rbx)
movq %r12, 0x390(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movq %r12, 0x20(%rbx)
movups %xmm0, 0x90(%rbx)
movups %xmm0, 0xa0(%rbx)
movq %r12, 0xb0(%rbx)
movups %xmm0, 0xd8(%rbx)
callq 0x3cff6
movq %rax, 0x398(%rbx)
movb %r12b, 0x3a8(%rbx)
movq %r12, 0x278(%rbx)
movq %r12, 0x3a0(%rbx)
movq %r12, 0x200(%rbx)
movl $0x0, 0x207(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x210(%rbx)
testq %r14, %r14
movq 0x38(%rsp), %r13
je 0xc1d17
leaq 0x1e8(%rbx), %rax
movups (%r14), %xmm0
movups %xmm0, (%rax)
jmp 0xc1d29
movb $0x0, 0x1e8(%rbx)
movq $0x0, 0x1f0(%rbx)
movq %rbp, 0x220(%rbx)
leaq 0x238(%rbx), %rsi
leaq 0x230(%rbx), %r12
movq %rbx, %rcx
addq $0x228, %rcx            # imm = 0x228
movzbl 0xb8(%rsp), %r8d
movq %rbp, %rdi
movq %r12, %rdx
callq 0xc2042
movq %r15, 0x30(%rbx)
movq %r15, 0x38(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rbx)
movq %rax, 0x48(%rbx)
movq %r13, 0x50(%rbx)
movq %r15, %r13
movq 0x40(%rsp), %r15
movq %r15, 0x58(%rbx)
movq %rbp, %rdi
callq 0xba7a2
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, %rdi
movq %r13, %rbp
cmpb $0x0, 0xa0(%rsp)
jne 0xc1df5
callq 0xba7e4
subq $0x8, %rsp
movl 0x14(%rsp), %edi
movq %rbp, %rsi
movq 0x18(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq %r15, %r8
movq 0x38(%rsp), %r9
pushq (%r12)
pushq %rax
pushq %r14
callq 0xc4aa1
addq $0x20, %rsp
movq %rax, %r13
movq %r13, 0x60(%rbx)
movl 0xc(%rsp), %r14d
movl %r14d, %edi
callq 0xd3904
movq %rax, 0x8(%rbx)
movq $0x0, 0x280(%rbx)
cmpl $0x2, %r14d
jae 0xc1e1f
xorl %ecx, %ecx
jmp 0xc1e38
leaq -0x1(%rbp), %rdx
shrq $0x5, %rdx
addq $0x2, %rdx
cmpq $0x20, %rbp
movl $0x2, %ecx
cmovaeq %rdx, %rcx
movq 0x10(%rsp), %r15
movq 0x28(%rsp), %r13
movq %rcx, 0x288(%rbx)
xorl %ecx, %ecx
movq %rcx, 0x290(%rbx)
movq %rcx, 0x2a0(%rbx)
movq %rcx, 0x330(%rbx)
movb $0x0, 0x298(%rbx)
movq %rcx, 0x2b0(%rbx)
movl (%rbx), %ecx
leal -0x4(%rcx), %edx
cmpl $0x2, %edx
ja 0xc1e89
xorps %xmm0, %xmm0
movups %xmm0, 0x2c8(%rbx)
movups %xmm0, 0x2b8(%rbx)
movl (%r13), %edx
addl $-0x4, %edx
cmpl $0x2, %edx
ja 0xc1ea6
xorps %xmm0, %xmm0
movups %xmm0, 0x250(%rbx)
movups %xmm0, 0x240(%rbx)
movq 0xc0(%rsp), %r12
movq $0x0, 0xf8(%rbx)
movl 0x2a8(%rbx), %edx
movl %edx, 0x170(%rbx)
movq 0x60(%rbx), %r8
leaq (,%r8,8), %rdx
movq %rdx, %xmm1
movq 0x1f5a2(%rip), %xmm2    # 0xe1480
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x1f5a6(%rip), %xmm3    # 0xe1490
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rbp, %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 0xc1f49
cmpb $0x0, 0x1e8(%rbx)
je 0xc1ff3
movq 0x1f0(%rbx), %rcx
leaq 0x44671(%rip), %rsi     # 0x1065a8
movq %r12, %rdi
movq %rax, %rdx
movb $0x1, %al
callq 0x3561d
jmp 0xc1fe1
movapd %xmm2, 0x10(%rsp)
leaq 0x44690(%rip), %rsi     # 0x1065e6
movq %r12, %rdi
movq %rax, %rdx
movq %r8, %rcx
movb $0x1, %al
callq 0x3561d
cmpq $0x2, 0x40(%rbx)
jb 0xc1fe1
movl (%r13), %edi
decq %r15
xorl %esi, %esi
xorl %edx, %edx
movq %rbp, %rcx
movq %r15, %r8
callq 0xc4b81
movq %rax, %r14
leaq (,%rax,8), %rax
movq %rax, %xmm0
punpckldq 0x1f4e5(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1f4ed(%rip), %xmm0    # 0xe1490
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 0xd3904
leaq 0x44655(%rip), %rsi     # 0x106620
movq %r12, %rdi
movq %rax, %rdx
movq %r14, %rcx
movapd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x3561d
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2ab93