// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/ft-eoplist.c
// Function: gt_eoplist_segments_entropy
double gt_eoplist_segments_entropy(const GtEoplist *eoplist,GtUword delta)
{
  GtEoplistReader *eoplist_reader = gt_eoplist_reader_new();
  GtEoplistSegment segment;
  const GtUword max_value = 2 * delta + 1;
  GtUword segment_count = 0, idx,
          *segment_dist = gt_calloc(max_value + 1,sizeof *segment_dist);
  double entropy = 0.0;

  gt_eoplist_reader_reset(eoplist_reader,eoplist,true);
  while (gt_eoplist_reader_next_segment(&segment,eoplist_reader,delta))
  {
    gt_assert(segment.aligned_v <= max_value);
    segment_dist[segment.aligned_v]++;
    segment_count++;
  }
  gt_eoplist_reader_delete(eoplist_reader);
  for (idx = 0; idx <= max_value; idx++)
  {
    if (segment_dist[idx] > 0)
    {
      double prob = (double) segment_dist[idx]/segment_count;
      entropy += prob * log2(prob);
    }
  }
  gt_free(segment_dist);
  return entropy == 0.0 ? 0.0 : -entropy;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
callq 0x4c1a20
movq %rax, 0x50(%rsp)
movq 0x58(%rsp), %rax
shlq %rax
addq $0x1, %rax
movq %rax, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x38(%rsp), %rdi
addq $0x1, %rdi
movl $0x8, %esi
leaq 0xf4de1(%rip), %rdx     # 0x5b8338
movl $0x20c, %ecx            # imm = 0x20C
callq 0xe83c0
movq %rax, 0x20(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
movl $0x1, %edx
callq 0x4c1b40
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
leaq 0x40(%rsp), %rdi
callq 0x4c3270
testb $0x1, %al
jne 0x4c359d
jmp 0x4c360e
jmp 0x4c359f
movq 0x48(%rsp), %rax
cmpq 0x38(%rsp), %rax
jbe 0x4c35e3
movq 0x1789ee(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x52a57(%rip), %rsi     # 0x516013
leaq 0xf5094(%rip), %rdx     # 0x5b8657
leaq 0xf50ac(%rip), %rcx     # 0x5b8676
leaq 0xf4d67(%rip), %r8      # 0x5b8338
movl $0x212, %r9d            # imm = 0x212
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x4c35e5
movq 0x20(%rsp), %rax
movq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x4c3583
movq 0x50(%rsp), %rdi
callq 0x4c2280
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x38(%rsp), %rax
ja 0x4c36e3
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jbe 0x4c36ce
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %xmm0
movaps 0x552d4(%rip), %xmm3    # 0x518930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x552d8(%rip), %xmm2    # 0x518940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x30(%rsp), %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
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x19d30
movaps %xmm0, %xmm2
movsd 0x8(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
jmp 0x4c36d0
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x4c3621
movq 0x20(%rsp), %rdi
leaq 0xf4c49(%rip), %rsi     # 0x5b8338
movl $0x21f, %edx            # imm = 0x21F
callq 0xe88c0
movsd 0x18(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4c3714
jp 0x4c3714
xorps %xmm0, %xmm0
movsd %xmm0, (%rsp)
jmp 0x4c3736
movsd 0x18(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, (%rsp)
movsd (%rsp), %xmm0
addq $0x68, %rsp
retq