// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/tools/gt_condenseq_blast.c
// Function: gt_condenseq_blast_calc_query_stats
static inline int
gt_condenseq_blast_calc_query_stats(GtCesBlastInfo *info,
                                    GtCondenseqBlastQInfo *qinfo)
{
  int had_err = 0;
  GtFastaReader *reader;

  qinfo->max = 0;
  qinfo->count = 0;
  qinfo->avg = 0;
  qinfo->raw_eval = 0.0;

  /* from NCBI BLAST tutorial:
     E = Kmne^{-lambdaS}
     calculates E-value for score S with natural scale parameters K for
     search space size and lambda for the scoring system
     E = mn2^-S'
     m being the subject (total) length, n the length of ONE query
     calculates E-value for bit-score S'
     */
  reader = gt_fasta_reader_rec_new(info->args->querypath);
  had_err = gt_fasta_reader_run(reader, NULL, NULL,
                                gt_condenseq_avg_helper,
                                qinfo,
                                info->err);
  if (!had_err) {
    GtUword S = info->args->bitscore;
    qinfo->avg /= qinfo->count;
    gt_log_log(GT_WU " queries, avg query size: " GT_WU,
               qinfo->count, qinfo->avg);
    qinfo->raw_eval = 1/pow(2.0, (double) S) * qinfo->avg;
    gt_logger_log(info->logger, "Raw E-value set to %.4e", qinfo->raw_eval);
    gt_assert(qinfo->avg != 0);
  }
  gt_fasta_reader_delete(reader);
  return had_err;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movl $0x0, 0x44(%rsp)
movq 0x48(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x48(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x48(%rsp), %rax
movq $0x0, (%rax)
movq 0x48(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x18(%rax)
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rax), %rdi
callq 0xdc9e0
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
movq 0x48(%rsp), %r8
movq 0x50(%rsp), %rax
movq 0x18(%rax), %r9
xorl %eax, %eax
movl %eax, %edx
leaq 0xb22(%rip), %rcx       # 0x25840
movq %rdx, %rsi
callq 0xdc550
movl %eax, 0x44(%rsp)
cmpl $0x0, 0x44(%rsp)
jne 0x24e68
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x30(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rcx
movq (%rcx), %rax
movq 0x10(%rcx), %rsi
xorl %edx, %edx
movl %edx, 0xc(%rsp)
divq %rsi
movq %rax, %rdx
movl 0xc(%rsp), %eax
movq %rdx, (%rcx)
movq 0x48(%rsp), %rcx
movq (%rcx), %rdx
movq 0x10(%rcx), %rsi
leaq 0x4f458a(%rip), %rdi    # 0x519303
callq 0xe7740
movq 0x30(%rsp), %xmm1
movaps 0x4f3ba5(%rip), %xmm0   # 0x518930
movaps %xmm0, 0x10(%rsp)
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x4f3ba4(%rip), %xmm0   # 0x518940
movaps %xmm0, 0x20(%rsp)
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movsd 0x4f3fa8(%rip), %xmm0   # 0x518d60
callq 0x19cb0
movaps 0x10(%rsp), %xmm3
movaps 0x20(%rsp), %xmm2
movaps %xmm0, %xmm1
movsd 0x4f246e(%rip), %xmm0   # 0x517240
divsd %xmm1, %xmm0
movq 0x48(%rsp), %rax
movq (%rax), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movq 0x48(%rsp), %rax
movsd %xmm0, 0x18(%rax)
movq 0x50(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x48(%rsp), %rax
movsd 0x18(%rax), %xmm0
leaq 0x4f450a(%rip), %rsi    # 0x519324
movb $0x1, %al
callq 0xe7cd0
movq 0x48(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x24e64
movq 0x61716d(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4f11d6(%rip), %rsi    # 0x516013
leaq 0x4f44f8(%rip), %rdx    # 0x51933c
leaq 0x4f4501(%rip), %rcx    # 0x51934c
leaq 0x4f3f26(%rip), %r8     # 0x518d78
movl $0x18a, %r9d            # imm = 0x18A
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x24e66
jmp 0x24e68
movq 0x38(%rsp), %rdi
callq 0xdc4c0
movl 0x44(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax,%rax)