// File: 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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movslq 0xcc(%rax), %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x25(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x7510
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rcx
leaq -0x20(%rbp), %rdi
leaq -0x24(%rbp), %rdx
callq 0x13880
jmp 0x1280d
movq -0x78(%rbp), %rdi
addq $0x98, %rdi
leaq -0x20(%rbp), %rsi
callq 0x13820
leaq -0x20(%rbp), %rdi
callq 0x4ea0
leaq -0x25(%rbp), %rdi
callq 0x5120
movl $0x0, -0x38(%rbp)
movq -0x78(%rbp), %rcx
movl -0x38(%rbp), %eax
cmpl 0xcc(%rcx), %eax
jge 0x12b2a
movq -0x78(%rbp), %rdi
callq 0x4260
movq %rax, -0x88(%rbp)
movl $0x0, -0x54(%rbp)
leaq -0x55(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x7510
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rcx
leaq -0x50(%rbp), %rdi
leaq -0x54(%rbp), %rdx
callq 0x13880
jmp 0x1288b
leaq -0x55(%rbp), %rdi
callq 0x5120
movl $0x0, -0x5c(%rbp)
movq -0x78(%rbp), %rcx
movl -0x5c(%rbp), %eax
cmpl 0xc8(%rcx), %eax
jge 0x12968
movq -0x78(%rbp), %rdi
addq $0x38, %rdi
movslq -0x5c(%rbp), %rsi
callq 0x74a0
movq %rax, %rdi
movslq -0x38(%rbp), %rsi
callq 0x46c0
movq %rax, -0x90(%rbp)
jmp 0x128d4
movq -0x90(%rbp), %rax
movq -0x78(%rbp), %rdi
movsbl (%rax), %esi
callq 0x12bb0
movslq %eax, %rsi
leaq -0x50(%rbp), %rdi
callq 0x5180
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x875d(%rip), %xmm1     # 0x1b060
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rax)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x1289b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x25(%rbp), %rdi
callq 0x5120
jmp 0x12b33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x55(%rbp), %rdi
callq 0x5120
jmp 0x12b33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x4ea0
jmp 0x12b33
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x94(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5160
movq %rax, %rcx
movl -0x94(%rbp), %eax
cmpl %ecx, %eax
jge 0x12ac5
movq -0x78(%rbp), %rax
cvtsi2ssl 0xc8(%rax), %xmm0
movss %xmm0, -0x98(%rbp)
movslq -0x60(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x5180
movss -0x98(%rbp), %xmm1
movss (%rax), %xmm0
divss %xmm1, %xmm0
movss %xmm0, (%rax)
movslq -0x60(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x5180
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x12ab5
movslq -0x60(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x5180
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x865a(%rip), %xmm1     # 0x1b060
ucomisd %xmm1, %xmm0
jne 0x12a2e
jp 0x12a2e
movq -0x78(%rbp), %rdi
addq $0x98, %rdi
movslq -0x38(%rbp), %rsi
callq 0x5180
xorps %xmm0, %xmm0
movss %xmm0, (%rax)
jmp 0x12ab3
movslq -0x60(%rbp), %rsi
leaq -0x50(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x5180
movq -0xa8(%rbp), %rdi
movss (%rax), %xmm0
movss %xmm0, -0xa0(%rbp)
movslq -0x60(%rbp), %rsi
callq 0x5180
movss (%rax), %xmm0
callq 0x13900
movss %xmm0, -0x9c(%rbp)
jmp 0x12a71
movq -0x78(%rbp), %rdi
addq $0x98, %rdi
movslq -0x38(%rbp), %rsi
callq 0x5180
movss -0xa0(%rbp), %xmm0
movss -0x9c(%rbp), %xmm2
movss (%rax), %xmm1
movd %xmm0, %ecx
xorl $0x80000000, %ecx       # imm = 0x80000000
movd %ecx, %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax)
jmp 0x12ab5
jmp 0x12ab7
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x1296f
movq -0x78(%rbp), %rdi
callq 0x4260
movq %rax, %rdi
decq %rdi
callq 0x13920
movsd %xmm0, -0xb0(%rbp)
jmp 0x12ae3
movq -0x78(%rbp), %rdi
addq $0x98, %rdi
movslq -0x38(%rbp), %rsi
callq 0x5180
movsd -0xb0(%rbp), %xmm1
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rax)
leaq -0x50(%rbp), %rdi
callq 0x4ea0
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1283a
addq $0xb0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x45e0
nopl (%rax)