// File: /workspace/github_cpp_makefile_star2_O1/gcollet[P]MstatX/src/mvector.cpp
// Function: MVectStat::calculate(Msa&)
void
MVectStat :: calculate(Msa & msa)
{
	int L = msa.getNcol();
	int N = msa.getNseq();
	
	/* Get the scoring matrix */
	ScoringMatrix score_mat(Options::Get().matrix_fname);
	
	/* Remove the unknown symbol from msa (consider them as gaps)*/
	sm_alphabet = score_mat.getAlphabet();
	msa.fitToAlphabet(sm_alphabet);
	
	/* Calculate the mean vector for each column */
	int K = (int) sm_alphabet.size();
	means = vector<vector<float> >(L);
	
	for (int col(0); col < L; col++) {
		vector<float> mean_col(K, 0.0);
		for (int seq(0); seq < N; ++seq) {
			if (msa.getSymbol(seq,col) == '-'){
				continue;
			} else {
				for (int a(0); a < K; ++a) {
					mean_col[a] += score_mat.normScore(sm_alphabet[a],msa.getSymbol(seq,col));
				}
			}
		}
		for (int a(0); a < K; ++a) {
			mean_col[a] /= (float) N;
		}
		means[col] = mean_col;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbp
movslq 0xcc(%rsi), %r13
movq %rsi, 0x20(%rsp)
movl 0xc8(%rsi), %eax
movq %rax, 0x18(%rsp)
callq 0x4f1c
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x88(%rax), %rsi
movq 0x90(%rax), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %r15
movq %r15, %rdi
callq 0x5ccc
leaq 0xc0(%rsp), %rdi
movq %r15, %rsi
callq 0xd344
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0xcb92
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4250
leaq 0x40(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x5ccc
leaq 0x8(%rbp), %r12
leaq 0x30(%rsp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x4300
movq (%r15), %rdi
cmpq %rbx, %rdi
je 0xcbe1
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4250
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%rbp), %rsi
movq 0x10(%rbp), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0x5ccc
leaq 0x68(%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0xbfb4
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0xcc25
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r13, %rsi
callq 0xd100
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x28(%rbp), %rax
movups 0x30(%rbp), %xmm0
leaq 0xa8(%rsp), %r15
movq (%r15), %rcx
movq %rcx, 0x28(%rbp)
movq 0x8(%r15), %rcx
movq %rcx, 0x30(%rbp)
movq 0x10(%r15), %rcx
movq %rcx, 0x38(%rbp)
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rsi
movq %rax, (%rdi)
movups %xmm0, 0x8(%rdi)
movq %rcx, (%r15)
movq %rdx, 0x8(%r15)
movq %rsi, 0x10(%r15)
callq 0xd188
movq %r15, %rdi
callq 0xd188
movq %r13, 0x60(%rsp)
testl %r13d, %r13d
jle 0xcdf6
xorps %xmm0, %xmm0
cvtsi2ssl 0x18(%rsp), %xmm0
movss %xmm0, 0x2c(%rsp)
movq 0x10(%rsp), %r13
movslq %r13d, %rax
movq %rax, 0x58(%rsp)
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %r14d, %r14d
leaq 0x30(%rsp), %rbx
movq %rbp, 0x50(%rsp)
movl $0x0, 0xa8(%rsp)
movq %rbx, %rdi
movq 0x58(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0xc666
cmpl $0x0, 0x18(%rsp)
jle 0xcd89
xorl %ebx, %ebx
cmpl $0x0, 0x10(%rsp)
setle %al
movq 0x20(%rsp), %rcx
movq 0x38(%rcx), %rcx
movq %rbx, %rbp
shlq $0x5, %rbp
movq (%rcx,%rbp), %rcx
cmpb $0x2d, (%rcx,%r14)
sete %cl
orb %al, %cl
jne 0xcd7f
xorl %r15d, %r15d
movq (%r12), %rax
movsbl (%rax,%r15), %esi
movq 0x20(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%rbp), %rax
movsbl (%rax,%r14), %edx
leaq 0xc0(%rsp), %rdi
callq 0xdbde
movq 0x30(%rsp), %rax
addss (%rax,%r15,4), %xmm0
movss %xmm0, (%rax,%r15,4)
incq %r15
cmpq %r15, %r13
jne 0xcd3e
incq %rbx
cmpq 0x18(%rsp), %rbx
jne 0xcd13
cmpl $0x0, 0x10(%rsp)
movss 0x2c(%rsp), %xmm1
jle 0xcdb3
movq 0x30(%rsp), %rax
xorl %ecx, %ecx
movss (%rax,%rcx,4), %xmm0
divss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r13
jne 0xcd9d
leaq (%r14,%r14,2), %rdi
shlq $0x3, %rdi
movq 0x50(%rsp), %rbp
addq 0x28(%rbp), %rdi
leaq 0x30(%rsp), %rbx
movq %rbx, %rsi
callq 0xd1d6
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xcde8
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
incq %r14
cmpq 0x60(%rsp), %r14
jne 0xcce5
leaq 0xc0(%rsp), %rdi
callq 0xdadc
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xce56
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0xce75
movq 0x78(%rsp), %rsi
incq %rsi
jmp 0xce70
jmp 0xce56
jmp 0xce56
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0xce82
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x4250
jmp 0xce82
jmp 0xce5b
movq %rax, %rbx
jmp 0xce75
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xce75
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
leaq 0xc0(%rsp), %rdi
callq 0xdadc
movq %rbx, %rdi
callq 0x4440