// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/karlin_altschul_stat.c
// Function: gt_karlin_altschul_stat_new_gapped
GtKarlinAltschulStat *gt_karlin_altschul_stat_new_gapped(
                             GtUword total_length_db,
                             GtUword num_of_db_seqs,
                             GT_UNUSED const GtEncseq *query_encseq)
{
  const unsigned int gapped_alignment_flag = 0;
  GtScoreHandler *scorehandler = gt_scorehandler_new(1,-2,0,-2);
  GtKarlinAltschulStat *ka
    = gt_karlin_altschul_stat_new(gapped_alignment_flag,scorehandler);

  gt_scorehandler_delete(scorehandler);
  gt_assert(num_of_db_seqs > 0 &&
            ka->actual_length_db == GT_UWORD_MAX);
  ka->actual_length_db = total_length_db - (num_of_db_seqs - 1);
  ka->num_of_db_seqs = num_of_db_seqs;
  if (query_encseq != NULL)
  {
    GtUword *seq_length_tab = gt_all_sequence_lengths_get(query_encseq);
    GtUwordPair *store_under_construction;

    ka->num_of_query_seqs = gt_encseq_num_of_sequences(query_encseq);
    if (seq_length_tab == NULL) /* all are of the same length */
    {
      store_under_construction = gt_malloc(sizeof *ka->searchspace_store * 1);
      store_under_construction[0].a = gt_encseq_seqlength(query_encseq,0);
      store_under_construction[0].b
        = gt_evalue_searchspace(ka,store_under_construction[0].a);
      ka->different_lengths = 1;
    } else
    {
      GtUword ridx, widx;

      gt_radixsort_inplace_ulong(seq_length_tab,ka->num_of_query_seqs);
      gt_assert(ka->num_of_query_seqs > 0);
      for (ridx = 1, widx = 0; ridx < ka->num_of_query_seqs; ridx++)
      {
        if (seq_length_tab[ridx] != seq_length_tab[widx])
        {
          seq_length_tab[++widx] = seq_length_tab[ridx];
        }
      }
      ka->different_lengths = widx + 1;
      store_under_construction = gt_malloc(sizeof *ka->searchspace_store *
                                           ka->different_lengths);
      for (widx = 0; widx < ka->different_lengths; widx++)
      {
        store_under_construction[widx].a = seq_length_tab[widx];
        store_under_construction[widx].b
          = gt_evalue_searchspace(ka,store_under_construction[widx].a);
      }
      gt_free(seq_length_tab);
    }
    ka->searchspace_store = store_under_construction;
  }
  return ka;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r13
pushq $0x1
popq %r15
pushq $-0x2
popq %rcx
movq %r15, %rdi
movq %rcx, %rsi
xorl %edx, %edx
callq 0x1148f4
movq %rax, %rbp
xorl %edi, %edi
movq %rax, %rsi
callq 0x164cf6
movq %rax, %rbx
movq %rbp, %rdi
callq 0x114a03
testq %r14, %r14
je 0x165b58
cmpq $-0x1, 0x50(%rbx)
jne 0x165b58
subq %r14, %r13
incq %r13
movq %r13, 0x50(%rbx)
movq %r14, 0x58(%rbx)
testq %r12, %r12
je 0x165b46
movq %r12, %rdi
callq 0x73fa8
movq %rax, %r14
movq %r12, %rdi
callq 0x705a1
movq %rax, 0x60(%rbx)
testq %r14, %r14
je 0x165b07
movq %r14, %rdi
movq %rax, %rsi
callq 0xa07dd
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x165b90
xorl %edi, %edi
cmpq %rax, %r15
jae 0x165aa4
movq (%r14,%r15,8), %rcx
cmpq (%r14,%rdi,8), %rcx
je 0x165a9f
movq %rcx, 0x8(%r14,%rdi,8)
incq %rdi
movq 0x60(%rbx), %rax
incq %r15
jmp 0x165a84
incq %rdi
movq %rdi, 0x68(%rbx)
shlq $0x4, %rdi
leaq 0x1e386a(%rip), %rsi    # 0x349320
movl $0x250, %edx            # imm = 0x250
callq 0x93160
movq %rax, %r15
movq %rax, %r12
addq $0x8, %r12
xorl %r13d, %r13d
cmpq 0x68(%rbx), %r13
jae 0x165af1
movq (%r14,%r13,8), %rsi
movq %rsi, -0x8(%r12)
movq %rbx, %rdi
callq 0x165bbe
movq %rax, (%r12)
incq %r13
addq $0x10, %r12
jmp 0x165acd
leaq 0x1e3828(%rip), %rsi    # 0x349320
movq %r14, %rdi
movl $0x257, %edx            # imm = 0x257
callq 0x936f9
jmp 0x165b42
leaq 0x1e3812(%rip), %rsi    # 0x349320
pushq $0x10
popq %rdi
movl $0x23c, %edx            # imm = 0x23C
callq 0x93160
movq %rax, %r15
movq %r12, %rdi
xorl %esi, %esi
callq 0x75173
movq %rax, (%r15)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x165bbe
movq %rax, 0x8(%r15)
movq $0x1, 0x68(%rbx)
movq %r15, 0x70(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2d2409(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17f4aa(%rip), %rsi    # 0x2e5013
leaq 0x1e3838(%rip), %rdx    # 0x3493a8
leaq 0x1e386c(%rip), %rcx    # 0x3493e3
leaq 0x1e37a2(%rip), %r8     # 0x349320
movl $0x231, %r9d            # imm = 0x231
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2d23d1(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17f472(%rip), %rsi    # 0x2e5013
leaq 0x1e385e(%rip), %rdx    # 0x349406
leaq 0x1e3834(%rip), %rcx    # 0x3493e3
leaq 0x1e376a(%rip), %r8     # 0x349320
movl $0x246, %r9d            # imm = 0x246
jmp 0x165b84