// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/karlin_altschul_stat.c
// Function: gt_karlin_altschul_stat_new
GtKarlinAltschulStat *gt_karlin_altschul_stat_new(unsigned int numofchars,
                                                  const GtScoreHandler
                                                        *scorehandler)
{
  GtKarlinAltschulStat *ka = gt_malloc(sizeof *ka);

  gt_assert(ka != NULL);
  ka->searchspace_store = NULL;
  ka->num_of_query_seqs = 0;
  ka->different_lengths = 0;
  ka->lambda = 0;
  ka->K = 0;
  ka->logK = 0;
  ka->H = 0;
  ka->log2 = log(2);
  ka->actual_length_db = GT_UWORD_MAX;
  ka->num_of_db_seqs = GT_UWORD_MAX;
  gt_assert(gt_scorehandler_get_gap_opening(scorehandler) == 0);
  ka->matchscore = gt_scorehandler_get_matchscore(scorehandler);
  ka->mismatchscore = gt_scorehandler_get_mismatchscore(scorehandler);
  ka->gapscore = gt_scorehandler_get_gapscore(scorehandler);
  /* only implemented for linear scores */
  if (numofchars == 0)
  { /* gapped alignment */
    gt_karlin_altschul_stat_get_gapped_params(ka);
  } else
  {
    /* New ScoringFrequency */
    ScoringFrequency *sf
      = gt_karlin_altschul_stat_scoring_frequency(numofchars,scorehandler);
    gt_assert(sf != NULL);

    /* karlin altschul parameters for ungapped alignments */
    ka->lambda = gt_karlin_altschul_stat_calculate_ungapped_lambda(sf);
    ka->H = gt_karlin_altschul_stat_calculate_H(sf, ka->lambda);
    ka->K = gt_karlin_altschul_stat_calculate_ungapped_K(sf, ka->lambda, ka->H);
    ka->logK = log(ka->K);
    gt_assert(ka->H != 0.0);
    ka->alpha_div_lambda = 1/ka->H;
    ka->beta = 0;
    gt_free(sf->sprob);
    gt_free(sf);
  }
  return ka;
}

// Assembly:
subq $0x28, %rsp
movl %edi, 0x24(%rsp)
movq %rsi, 0x18(%rsp)
movl $0x78, %edi
leaq 0x31dc77(%rip), %rsi    # 0x57b890
movl $0x1fb, %edx            # imm = 0x1FB
callq 0xe80f0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x25dc68
movq 0x3de369(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2b83d2(%rip), %rsi    # 0x516013
leaq 0x31dc69(%rip), %rdx    # 0x57b8b1
leaq 0x31dc6d(%rip), %rcx    # 0x57b8bc
leaq 0x31dc3a(%rip), %r8     # 0x57b890
movl $0x1fd, %r9d            # imm = 0x1FD
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x25dc6a
movq 0x10(%rsp), %rax
movq $0x0, 0x70(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x60(%rax)
movq 0x10(%rsp), %rax
movq $0x0, 0x68(%rax)
movq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
movq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rax)
movq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x18(%rax)
movsd 0x2bb094(%rip), %xmm0   # 0x518d60
callq 0x195c0
movq 0x10(%rsp), %rax
movsd %xmm0, 0x30(%rax)
movq 0x10(%rsp), %rax
movq $-0x1, 0x50(%rax)
movq 0x10(%rsp), %rax
movq $-0x1, 0x58(%rax)
movq 0x18(%rsp), %rdi
callq 0x1d1180
cmpq $0x0, %rax
je 0x25dd3d
movq 0x3de294(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2b82fd(%rip), %rsi    # 0x516013
leaq 0x31dbbb(%rip), %rdx    # 0x57b8d8
leaq 0x31db98(%rip), %rcx    # 0x57b8bc
leaq 0x31db65(%rip), %r8     # 0x57b890
movl $0x208, %r9d            # imm = 0x208
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x25dd3f
movq 0x18(%rsp), %rdi
callq 0x1d1220
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x18(%rsp), %rdi
callq 0x1d1270
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x40(%rax)
movq 0x18(%rsp), %rdi
callq 0x1d11d0
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x48(%rax)
cmpl $0x0, 0x24(%rsp)
jne 0x25dd97
movq 0x10(%rsp), %rdi
callq 0x25df10
jmp 0x25df03
movl 0x24(%rsp), %edi
movq 0x18(%rsp), %rsi
callq 0x25e030
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x25ddea
movq 0x3de1e7(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2b8250(%rip), %rsi    # 0x516013
leaq 0x31db41(%rip), %rdx    # 0x57b90b
leaq 0x31daeb(%rip), %rcx    # 0x57b8bc
leaq 0x31dab8(%rip), %r8     # 0x57b890
movl $0x215, %r9d            # imm = 0x215
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x25ddec
movq 0x8(%rsp), %rdi
callq 0x25e480
movq 0x10(%rsp), %rax
movsd %xmm0, (%rax)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rax
movsd (%rax), %xmm0
callq 0x25e760
movq 0x10(%rsp), %rax
movsd %xmm0, 0x18(%rax)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rax
movsd (%rax), %xmm0
movq 0x10(%rsp), %rax
movsd 0x18(%rax), %xmm1
callq 0x25e930
movq 0x10(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq 0x10(%rsp), %rax
movsd 0x8(%rax), %xmm0
callq 0x195c0
movq 0x10(%rsp), %rax
movsd %xmm0, 0x10(%rax)
movq 0x10(%rsp), %rax
movsd 0x18(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x25dea9
jp 0x25dea9
movq 0x3de128(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2b8191(%rip), %rsi    # 0x516013
leaq 0x31da8d(%rip), %rdx    # 0x57b916
leaq 0x31da2c(%rip), %rcx    # 0x57b8bc
leaq 0x31d9f9(%rip), %r8     # 0x57b890
movl $0x21c, %r9d            # imm = 0x21C
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x25deab
movq 0x10(%rsp), %rax
movsd 0x2b9388(%rip), %xmm0   # 0x517240
divsd 0x18(%rax), %xmm0
movq 0x10(%rsp), %rax
movsd %xmm0, 0x20(%rax)
movq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x28(%rax)
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x31d9ad(%rip), %rsi    # 0x57b890
movl $0x21f, %edx            # imm = 0x21F
callq 0xe88c0
movq 0x8(%rsp), %rdi
leaq 0x31d997(%rip), %rsi    # 0x57b890
movl $0x220, %edx            # imm = 0x220
callq 0xe88c0
movq 0x10(%rsp), %rax
addq $0x28, %rsp
retq
nopl (%rax)