// File: /workspace/github_c_makefile_star2_O1/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 $0x58, %rsp
movq %r9, %r13
movq %r8, 0x8(%rsp)
movq %rcx, 0x48(%rsp)
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
movb 0xa8(%rsp), %r12b
leaq 0x41f85(%rip), %rsi     # 0x102a2a
movl $0x3c0, %edi            # imm = 0x3C0
movl $0xffc, %edx            # imm = 0xFFC
callq 0x35ee2
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 0xd2b4d
movb %al, 0x3a9(%rbx)
cmpl $0x2, %ebp
sete %al
movq %r14, 0x10(%rsp)
cmpq $0x1, %r14
sete %cl
orb %al, %cl
movl $0x7, %eax
jne 0xc0b09
movq 0x10(%rsp), %rax
leaq -0x1(%rax), %rsi
movq %r15, %rdi
callq 0xc323c
movl %eax, 0x4(%rbx)
movb %r12b, 0x2f0(%rbx)
cmpb $0x1, 0x3a9(%rbx)
jne 0xc0b30
leaq 0x2b8(%rbx), %rdi
movq %r15, %rsi
movl %ebp, %edx
movq %r13, %rcx
callq 0xc32be
movl 0x4(%rbx), %edx
cmpl $0x7, %edx
je 0xc0b50
leaq 0x240(%rbx), %rdi
movq 0x10(%rsp), %rax
leaq -0x1(%rax), %rcx
movq %r15, %rsi
callq 0xc32be
movq 0xb8(%rsp), %r12
cmpb $0x1, 0x2f0(%rbx)
jne 0xc0b7e
movq 0x90(%rsp), %rcx
leaq 0x2f8(%rbx), %rdi
movl 0x388(%rbx), %edx
movq %r15, %rsi
callq 0xc32be
movq %r15, 0x30(%rsp)
movq %r13, 0x50(%rsp)
testq %r13, %r13
setne %al
setne 0x29(%rbx)
cmpq $0x2, 0x10(%rsp)
setae %cl
orb %al, %cl
movb %cl, 0x28(%rbx)
xorl %r13d, %r13d
movb %r13b, 0x2a(%rbx)
movq %r13, 0xf0(%rbx)
movq %r13, 0x1f8(%rbx)
movq %r13, 0x80(%rbx)
movq %r13, 0x390(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movq %r13, 0x20(%rbx)
movups %xmm0, 0x90(%rbx)
movups %xmm0, 0xa0(%rbx)
movq %r13, 0xb0(%rbx)
movups %xmm0, 0xd8(%rbx)
callq 0x3d96a
movq %rax, 0x398(%rbx)
movb %r13b, 0x3a8(%rbx)
movq %r13, 0x278(%rbx)
movq %r13, 0x3a0(%rbx)
movq %r13, 0x200(%rbx)
movl $0x0, 0x207(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x210(%rbx)
testq %r12, %r12
movl %ebp, 0x2c(%rsp)
je 0xc0c40
leaq 0x1e8(%rbx), %rax
movups (%r12), %xmm0
movups %xmm0, (%rax)
jmp 0xc0c52
movb $0x0, 0x1e8(%rbx)
movq $0x0, 0x1f0(%rbx)
movq 0x8(%rsp), %r14
movq 0x48(%rsp), %r15
movq 0xc0(%rsp), %r12
movq %r12, 0x220(%rbx)
leaq 0x238(%rbx), %rsi
leaq 0x230(%rbx), %rdx
movq %rbx, %rcx
addq $0x228, %rcx            # imm = 0x228
movzbl 0xc8(%rsp), %r8d
movq %r12, %rdi
movq %rdx, 0x8(%rsp)
callq 0xc0f79
movq 0x30(%rsp), %rbp
movq %rbp, 0x30(%rbx)
movq %rbp, 0x38(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rbx)
movq %rax, 0x48(%rbx)
movq %r15, 0x50(%rbx)
movq %r14, 0x58(%rbx)
movq %r12, %rdi
callq 0xb96b7
movl %eax, %r13d
movl %eax, 0x2a8(%rbx)
movq 0x98(%rsp), %rax
movq %rax, 0x3b0(%rbx)
movq 0xa0(%rsp), %rax
movq %rax, 0x3b8(%rbx)
movq %rbp, %rax
cmpb $0x0, 0xb0(%rsp)
movl 0x2c(%rsp), %ebp
jne 0xc0d32
movq %r12, %rdi
callq 0xb96f9
subq $0x8, %rsp
movl %ebp, %edi
movq 0x38(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r15, %rcx
movq %r14, %r8
movq 0x58(%rsp), %r9
movq 0x10(%rsp), %r10
pushq (%r10)
pushq %rax
pushq %r13
callq 0xc3a59
addq $0x20, %rsp
movq %rax, 0x60(%rbx)
movl %ebp, %edi
callq 0xd2adc
movq %rax, 0x8(%rbx)
movq $0x0, 0x280(%rbx)
cmpl $0x2, %ebp
jae 0xc0d5a
xorl %eax, %eax
movq 0x30(%rsp), %r14
jmp 0xc0d78
movq 0x30(%rsp), %r14
leaq -0x1(%r14), %rcx
shrq $0x5, %rcx
addq $0x2, %rcx
cmpq $0x20, %r14
movl $0x2, %eax
cmovaeq %rcx, %rax
movq %rax, 0x288(%rbx)
xorl %eax, %eax
movq %rax, 0x290(%rbx)
movq %rax, 0x2a0(%rbx)
movq %rax, 0x330(%rbx)
movb $0x0, 0x298(%rbx)
movq %rax, 0x2b0(%rbx)
movl (%rbx), %eax
leal -0x4(%rax), %ecx
cmpl $0x2, %ecx
ja 0xc0dbf
xorps %xmm0, %xmm0
movups %xmm0, 0x2c8(%rbx)
movups %xmm0, 0x2b8(%rbx)
movl 0x4(%rbx), %ecx
addl $-0x4, %ecx
cmpl $0x2, %ecx
ja 0xc0ddb
xorps %xmm0, %xmm0
movups %xmm0, 0x250(%rbx)
movups %xmm0, 0x240(%rbx)
movq 0xd0(%rsp), %r12
movq $0x0, 0xf8(%rbx)
movl 0x2a8(%rbx), %ecx
movl %ecx, 0x170(%rbx)
movq 0x60(%rbx), %r8
leaq (,%r8,8), %rcx
movq %rcx, %xmm1
movq 0x2066d(%rip), %xmm2    # 0xe1480
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x20671(%rip), %xmm3    # 0xe1490
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %r14, %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, %eax
jne 0xc0e7f
cmpb $0x0, 0x1e8(%rbx)
je 0xc0f2a
movq 0x8(%rbx), %rdx
movq 0x1f0(%rbx), %rcx
leaq 0x4589d(%rip), %rsi     # 0x10670d
movq %r12, %rdi
movb $0x1, %al
callq 0x35c9e
jmp 0xc0f18
movapd %xmm2, 0x30(%rsp)
movq 0x8(%rbx), %rdx
leaq 0x458bb(%rip), %rsi     # 0x10674b
movq %r12, %rdi
movq %r8, %rcx
movb $0x1, %al
callq 0x35c9e
cmpq $0x2, 0x40(%rbx)
jb 0xc0f18
movl 0x4(%rbx), %edi
movq 0x10(%rsp), %r8
decq %r8
xorl %esi, %esi
xorl %edx, %edx
movq %r14, %rcx
callq 0xc3b39
movq %rax, %r14
leaq (,%rax,8), %rax
movq %rax, %xmm0
punpckldq 0x205ad(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x205b5(%rip), %xmm0    # 0xe1490
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x30(%rsp), %xmm1
movapd %xmm1, 0x10(%rsp)
movl 0x4(%rbx), %edi
callq 0xd2adc
leaq 0x45883(%rip), %rsi     # 0x106785
movq %r12, %rdi
movq %rax, %rdx
movq %r14, %rcx
movapd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x35c9e
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2adc7