// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/karlin_altschul_stat.c
// Function: gt_evalue_searchspace
GtUword gt_evalue_searchspace(const GtKarlinAltschulStat *ka,
                              GtUword query_idx_length)
{
  if (ka->searchspace_store != NULL)
  {
    return gt_searchspace_store_find(ka->searchspace_store,
                                     ka->different_lengths,
                                     query_idx_length);
  } else
  {
    GtUword actual_db_length,
            num_of_db_seqs,
            effective_db_length,
            effective_query_length,
            length_adjustment;
    double alpha_div_lambda, beta, K, logK;

    gt_assert(ka != NULL);
    alpha_div_lambda = gt_karlin_altschul_stat_get_alphadlambda(ka);

    beta = gt_karlin_altschul_stat_get_beta(ka);
    K = gt_karlin_altschul_stat_get_K(ka);
    logK = gt_karlin_altschul_stat_get_logK(ka);

    num_of_db_seqs = gt_karlin_altschul_get_num_of_db_seqs(ka);
    actual_db_length = gt_karlin_altschul_get_actual_length_db(ka);
    length_adjustment = gt_evalue_length_adjustment(query_idx_length,
                                                    actual_db_length,
                                                    num_of_db_seqs,
                                                    alpha_div_lambda,
                                                    beta,
                                                    K,
                                                    logK);

    effective_query_length = query_idx_length - length_adjustment;
    effective_db_length
      = actual_db_length - (num_of_db_seqs * length_adjustment);

    return effective_query_length * effective_db_length;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq 0x70(%rdi), %rax
testq %rax, %rax
je 0x165c24
movq 0x68(%rdi), %rcx
shlq $0x4, %rcx
addq %rax, %rcx
addq $-0x10, %rcx
cmpq %rcx, %rax
ja 0x165f55
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x5, %rsi
shlq $0x4, %rsi
leaq (%rax,%rsi), %rdx
cmpq %rbx, (%rax,%rsi)
jbe 0x165c10
addq $-0x10, %rdx
movq %rdx, %rcx
jmp 0x165be6
jae 0x165c1b
addq $0x10, %rdx
movq %rdx, %rax
jmp 0x165be6
movq 0x8(%rdx), %r14
jmp 0x165ec6
movq 0x58(%rdi), %r15
cmpq $-0x1, %r15
je 0x165fa7
movq 0x50(%rdi), %r14
cmpq $-0x1, %r14
je 0x165fd5
movq %r14, %rax
imulq %rbx, %rax
movq %rax, %xmm0
movq 0x181c8c(%rip), %xmm4   # 0x2e78e0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
movapd 0x181c90(%rip), %xmm5   # 0x2e78f0
subpd %xmm5, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
cmpq %r14, %rbx
movq %r14, %rax
cmovaq %rbx, %rax
movq %rax, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x8(%rdi), %xmm1
subsd %xmm1, %xmm3
xorpd %xmm1, %xmm1
ucomisd %xmm3, %xmm1
jbe 0x165cad
xorl %eax, %eax
jmp 0x165eb8
movsd 0x20(%rdi), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x28(%rdi), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x10(%rdi), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r15, %rax
imulq %rbx, %rax
addq %r14, %rax
movq %rax, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm6
unpckhpd %xmm0, %xmm6            # xmm6 = xmm6[1],xmm0[1]
addsd %xmm0, %xmm6
leaq (,%r15,4), %rax
movq %rax, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm3, %xmm3
movapd %xmm6, %xmm0
mulsd %xmm6, %xmm0
subsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x165d32
sqrtsd %xmm0, %xmm0
jmp 0x165d5d
movapd %xmm3, (%rsp)
movapd %xmm6, 0x10(%rsp)
callq 0x175b0
movapd 0x10(%rsp), %xmm6
movapd 0x181ba0(%rip), %xmm5   # 0x2e78f0
movq 0x181b88(%rip), %xmm4   # 0x2e78e0
movapd (%rsp), %xmm3
addsd %xmm6, %xmm0
divsd %xmm0, %xmm3
movq %rbx, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x60(%rsp)
movq %r14, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x50(%rsp)
movq %r15, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
xorpd 0x189c8c(%rip), %xmm1   # 0x2efa50
movapd %xmm1, 0x40(%rsp)
xorpd %xmm2, %xmm2
xorl %ebp, %ebp
xorpd %xmm1, %xmm1
cmpl $-0x14, %ebp
je 0x165e95
movapd %xmm1, 0x70(%rsp)
movapd %xmm3, (%rsp)
movapd 0x60(%rsp), %xmm1
subsd %xmm2, %xmm1
movapd 0x40(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd 0x50(%rsp), %xmm0
mulsd %xmm1, %xmm0
movapd %xmm2, 0x10(%rsp)
callq 0x175e0
movapd 0x10(%rsp), %xmm2
addsd 0x28(%rsp), %xmm0
mulsd 0x38(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
ucomisd %xmm2, %xmm0
jae 0x165e3b
movapd %xmm2, %xmm3
movapd 0x70(%rsp), %xmm1
jmp 0x165e66
movapd %xmm0, %xmm1
subsd %xmm2, %xmm1
movsd 0x1803dd(%rip), %xmm3   # 0x2e6228
ucomisd %xmm1, %xmm3
jae 0x165ed7
movapd (%rsp), %xmm3
ucomisd %xmm3, %xmm2
movapd %xmm2, %xmm1
jne 0x165e66
jnp 0x165e99
ucomisd %xmm1, %xmm0
jb 0x165e72
ucomisd %xmm0, %xmm3
jae 0x165e8a
movapd %xmm3, %xmm0
testl %ebp, %ebp
je 0x165e8a
movapd %xmm3, %xmm0
addsd %xmm1, %xmm0
mulsd 0x18ffce(%rip), %xmm0   # 0x2f5e58
decl %ebp
movapd %xmm0, %xmm2
jmp 0x165dd4
movapd %xmm1, %xmm2
cvttsd2si %xmm2, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
subsd 0x181e73(%rip), %xmm2   # 0x2e7d20
cvttsd2si %xmm2, %rax
andq %rdx, %rax
orq %rcx, %rax
subq %rax, %rbx
imulq %rax, %r15
subq %r15, %r14
imulq %rbx, %r14
movq %r14, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movapd %xmm2, %xmm0
callq 0x170f0
movapd %xmm0, %xmm2
movapd (%rsp), %xmm0
ucomisd %xmm2, %xmm0
jae 0x165ef6
movaps 0x10(%rsp), %xmm2
jmp 0x165e99
movapd 0x60(%rsp), %xmm1
subsd %xmm2, %xmm1
movapd 0x40(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd 0x50(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm2, (%rsp)
callq 0x175e0
movsd (%rsp), %xmm3
movsd 0x28(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
mulsd %xmm1, %xmm0
addsd 0x30(%rsp), %xmm0
ucomisd %xmm3, %xmm0
movaps 0x10(%rsp), %xmm2
jb 0x165e99
movapd %xmm3, %xmm2
jmp 0x165e99
movq 0x2d200c(%rip), %r15    # 0x437f68
movq (%r15), %rdi
leaq 0x1e3850(%rip), %rsi    # 0x3497b6
leaq 0x1e3868(%rip), %r14    # 0x3497d5
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x17a50
movq (%r15), %rdi
leaq 0x17f08f(%rip), %rsi    # 0x2e5013
leaq 0x1c0a61(%rip), %rdx    # 0x3269ec
leaq 0x1e338e(%rip), %r8     # 0x349320
movq %r14, %rcx
movl $0x313, %r9d            # imm = 0x313
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2d1fba(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17f05b(%rip), %rsi    # 0x2e5013
leaq 0x1e3851(%rip), %rdx    # 0x349810
leaq 0x1e387b(%rip), %rcx    # 0x349841
leaq 0x1e3353(%rip), %r8     # 0x349320
movl $0x27b, %r9d            # imm = 0x27B
jmp 0x165f9b
movq 0x2d1f8c(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17f02d(%rip), %rsi    # 0x2e5013
leaq 0x1e387a(%rip), %rdx    # 0x349867
leaq 0x1e38a6(%rip), %rcx    # 0x34989a
leaq 0x1e3325(%rip), %r8     # 0x349320
movl $0x274, %r9d            # imm = 0x274
jmp 0x165f9b