// File: /workspace/github_cpp_makefile_star2_O3/gcollet[P]MstatX/src/msa.cpp
// Function: Msa::countEntropy()
void 
Msa :: countEntropy(){
	entropy = vector<float>(ncol,0.0);
 
  for(int col(0); col < ncol; ++col){
		vector<float> lfreq(alphabet.size(), 0.0);
		for(int row(0); row < nseq; ++row){
			lfreq[getAaPos(mali_seq[row][col])] += 1.0;
		}
		for (int i(0); i < (int) lfreq.size(); ++i){
		  lfreq[i] /= (float) nseq;
			if (lfreq[i] > 0.0){
				if (lfreq[i] == 1.0){
				  entropy[col] = 0.0;	
				} else {
				  entropy[col] -= lfreq[i] * log(lfreq[i]);	
				}
			}
		}
		entropy[col] /= log(alphabet.size()-1); /* -1 because gaps are in the alphabet */
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movslq 0xcc(%rdi), %rsi
leaq 0x8(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x10(%rsp), %r14
leaq 0x7(%rsp), %rcx
movq %r14, %rdi
callq 0xc848
movq 0x98(%rbx), %rdi
movq 0xa8(%rbx), %rsi
movaps (%r14), %xmm0
movups %xmm0, 0x98(%rbx)
movq 0x10(%r14), %rax
movq %rax, 0xa8(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
testq %rdi, %rdi
je 0xbe66
subq %rdi, %rsi
callq 0x4250
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xbe66
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
cmpl $0x0, 0xcc(%rbx)
jle 0xc01b
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
leaq 0x7(%rsp), %r12
movq 0x8(%rbx), %rsi
movl $0x0, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
movq %r12, %rcx
callq 0xc848
cmpl $0x0, 0xc8(%rbx)
jle 0xbeee
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x38(%rbx), %rax
movq (%rax,%rbp), %rax
movsbl (%rax,%r13), %esi
movq %rbx, %rdi
callq 0xc062
movslq %eax, %rcx
movq 0x10(%rsp), %rax
movss (%rax,%rcx,4), %xmm0
addss 0x4180(%rip), %xmm0     # 0x10054
movss %xmm0, (%rax,%rcx,4)
incq %r14
movslq 0xc8(%rbx), %rcx
addq $0x20, %rbp
cmpq %rcx, %r14
jl 0xbeaa
jmp 0xbef3
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x2, %rdx
testl %edx, %edx
movss 0x4148(%rip), %xmm1     # 0x10054
xorps %xmm2, %xmm2
jle 0xbfa3
xorl %ebp, %ebp
xorps %xmm3, %xmm3
cvtsi2ssl 0xc8(%rbx), %xmm3
movss (%rax,%rbp,4), %xmm0
divss %xmm3, %xmm0
movss %xmm0, (%rax,%rbp,4)
ucomiss %xmm2, %xmm0
jbe 0xbf8a
ucomiss %xmm1, %xmm0
jne 0xbf4d
jp 0xbf4d
movq 0x98(%rbx), %rdx
movl $0x0, (%rdx,%r13,4)
jmp 0xbf8a
movss %xmm0, 0xc(%rsp)
callq 0x44b0
xorps %xmm2, %xmm2
movq 0x98(%rbx), %rax
movss (%rax,%r13,4), %xmm1
mulss 0xc(%rsp), %xmm0
subss %xmm0, %xmm1
movss %xmm1, (%rax,%r13,4)
movss 0x40d4(%rip), %xmm1     # 0x10054
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
incq %rbp
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x2, %rdx
movslq %edx, %rdx
cmpq %rdx, %rbp
jl 0xbf17
movq 0x8(%rbx), %rax
decq %rax
movq %rax, %xmm1
punpckldq 0x4679(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x4681(%rip), %xmm1     # 0x10640
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
callq 0x41d0
movq 0x98(%rbx), %rax
xorps %xmm1, %xmm1
cvtss2sd (%rax,%r13,4), %xmm1
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, (%rax,%r13,4)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc008
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
incq %r13
movslq 0xcc(%rbx), %rax
cmpq %rax, %r13
jl 0xbe80
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq