// File: /workspace/github_cpp_makefile_star2_O3/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 $0x118, %rsp            # imm = 0x118
movq %rdi, %rbp
movslq 0xcc(%rsi), %r13
movq %rsi, 0x20(%rsp)
movl 0xc8(%rsi), %eax
movq %rax, 0x18(%rsp)
callq 0x4f1c
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x88(%rax), %rsi
movq 0x90(%rax), %rdx
addq %rsi, %rdx
leaq 0x90(%rsp), %r15
movq %r15, %rdi
callq 0x5cca
leaq 0xd0(%rsp), %rdi
movq %r15, %rsi
callq 0xd5b0
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xce06
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4250
leaq 0x40(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0xd8(%rsp), %rsi
movq 0xe0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x5cca
leaq 0x8(%rbp), %r12
leaq 0x30(%rsp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x4300
movq (%r15), %rdi
cmpq %rbx, %rdi
je 0xce55
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4250
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%rbp), %rsi
movq 0x10(%rbp), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0x5cca
leaq 0x70(%rsp), %rsi
movq 0x20(%rsp), %rdi
callq 0xc190
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0xce9f
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r13, %rsi
callq 0xd364
movq 0x38(%rbp), %rax
leaq 0xb0(%rsp), %r15
movaps (%r15), %xmm0
movq 0x10(%r15), %rcx
movq %rcx, 0x38(%rbp)
movups 0x28(%rbp), %xmm1
movups %xmm0, 0x28(%rbp)
leaq 0x30(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
callq 0xd3e2
movq %r15, %rdi
callq 0xd3e2
movq %r13, 0x68(%rsp)
testl %r13d, %r13d
jle 0xd051
xorps %xmm0, %xmm0
cvtsi2ssl 0x18(%rsp), %xmm0
movss %xmm0, 0x2c(%rsp)
movq 0x10(%rsp), %r13
movslq %r13d, %rax
movq %rax, 0x60(%rsp)
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %r14d, %r14d
leaq 0x30(%rsp), %rbx
movq %rbp, 0x58(%rsp)
movl $0x0, 0xb0(%rsp)
movq %rbx, %rdi
movq 0x60(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0xc848
cmpl $0x0, 0x18(%rsp)
jle 0xcfe4
xorl %r15d, %r15d
cmpl $0x0, 0x10(%rsp)
setle %al
movq 0x20(%rsp), %rcx
movq 0x38(%rcx), %rcx
movq %r15, %rbp
shlq $0x5, %rbp
movq (%rcx,%rbp), %rcx
cmpb $0x2d, (%rcx,%r14)
sete %cl
orb %al, %cl
jne 0xcfda
xorl %ebx, %ebx
movq (%r12), %rax
movsbl (%rax,%rbx), %esi
movq 0x20(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax,%rbp), %rax
movsbl (%rax,%r14), %edx
leaq 0xd0(%rsp), %rdi
callq 0xde40
movq 0x30(%rsp), %rax
addss (%rax,%rbx,4), %xmm0
movss %xmm0, (%rax,%rbx,4)
incq %rbx
cmpq %rbx, %r13
jne 0xcf9c
incq %r15
cmpq 0x18(%rsp), %r15
jne 0xcf72
cmpl $0x0, 0x10(%rsp)
movss 0x2c(%rsp), %xmm1
jle 0xd00e
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 0xcff8
leaq (%r14,%r14,2), %rdi
shlq $0x3, %rdi
movq 0x58(%rsp), %rbp
addq 0x28(%rbp), %rdi
leaq 0x30(%rsp), %rbx
movq %rbx, %rsi
callq 0xd436
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xd043
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
incq %r14
cmpq 0x68(%rsp), %r14
jne 0xcf43
leaq 0xd0(%rsp), %rdi
callq 0xdd3e
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd0b4
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0xd0d3
movq 0x80(%rsp), %rsi
incq %rsi
jmp 0xd0ce
jmp 0xd0b4
jmp 0xd0b4
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xd0e0
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4250
jmp 0xd0e0
jmp 0xd0b9
movq %rax, %rbx
jmp 0xd0d3
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xd0d3
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
leaq 0xd0(%rsp), %rdi
callq 0xdd3e
movq %rbx, %rdi
callq 0x4440