// File: /workspace/github_cpp_makefile_star2_O3/gcollet[P]MstatX/src/msa.cpp
// Function: Msa::Msa(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Msa :: Msa(string fname)
{
	/* Open file */
	if (Options::Get().verbose){
		cout << "Read Multiple Alignment in " << fname << "\n";
	}
	ifstream file(fname.c_str());
	if (!file.good()){
	  cerr << "Cannot open file " << fname << "\n";
		exit(0);
	}

	
	/* Read file */
	string s, tmp_seq;
	while (file.good() && (int) mali_seq.size() < Options::Get().nb_seq){
		getline(file,s);
		if (s[0] == '>'){
			if (mali_name.size() != 0){
			  mali_seq.push_back(tmp_seq);	
			}
			if ((int) mali_seq.size() < Options::Get().nb_seq){
  			mali_name.push_back(s.substr(1, s.find_first_of(' ') - 1));
			}
			tmp_seq.clear();
		} else {
			tmp_seq = tmp_seq + s;
		}
	}
	if ((int) mali_seq.size() < Options::Get().nb_seq){
	  mali_seq.push_back(tmp_seq);
	}
	
	nseq = (int) mali_name.size();
	ncol = (int) mali_seq[0].size();
	cout << "\nMultiple alignment : nb seq = "<<nseq<<", nb col = "<<ncol<<"\n";
	
	/* Change all mali.seq in upper case*/
	for (int i(0); i < nseq; ++i){
		for(int j(0); j < ncol; ++j){
			mali_seq[i][j] = toupper(mali_seq[i][j]);
		}
	}
	
	/* Analyse the multiple alignment */
	defineAlphabet();
	countGap();
	countFreq();
	countType();
	countEntropy();
	
	
	/* Print if verbose mode */
	if (Options::Get().verbose){
		cout << "\nAlphabet :\n";
	  for(int i(0); i < (int) alphabet.size(); ++i){
			cout << alphabet[i] << ";";
		}
		cout << "\n";
		cout << "\nMultiple Alignment :\n";
	  for(int i(0); i <nseq; ++i){
			cout << mali_seq[i] << "\n";
		}
		cout << "\nAA Frequencies :\n";
		for (int i(0); i < (int) aa_freq.size(); ++i){
			cout << aa_freq[i] << ";";
		}
		cout << "\n";
		cout << "\nGap counts :\n";
		for (int i(0); i < (int) gap_counts.size(); ++i){
			cout << gap_counts[i] << ";";
		}
		cout << "\n";
		cout << "\nAA Entropy :\n";
		for (int i(0); i < (int) entropy.size(); ++i){
			if (gap_counts[i] < nseq/10){
		  	cout << entropy[i] << ";";
			} else {
				cout << "-12.0;";
			}
		}
		cout << "\n";
		cout << "\nAA Types :\n";
		for (int i(0); i < (int) nb_type.size(); ++i){
				cout << nb_type[i] << ";";
		}
		cout << "\n";
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
movq %r15, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
addq $0x20, %rdi
leaq 0x38(%rbx), %rbp
movl $0xa8, %edx
movq %rdi, 0x18(%rsp)
xorl %esi, %esi
callq 0x4140
callq 0x4f1c
cmpb $0x1, 0xec(%rax)
jne 0xb114
movq 0xaee4(%rip), %rdi      # 0x15fc0
leaq 0x556d(%rip), %rsi      # 0x10650
movl $0x1b, %edx
callq 0x42a0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0xaec5(%rip), %rdi      # 0x15fc0
callq 0x42a0
leaq 0x541d(%rip), %rsi      # 0x10524
movl $0x1, %edx
movq %rax, %rdi
callq 0x42a0
movq (%r14), %rsi
leaq 0x80(%rsp), %r12
movq %r12, %rdi
movl $0x8, %edx
callq 0x4480
movq %rbp, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rcx
cmpl $0x0, 0xa0(%rsp,%rcx)
jne 0xb7e6
leaq 0x70(%rsp), %rdx
movq %rdx, -0x10(%rdx)
xorl %ecx, %ecx
movq %rcx, -0x8(%rdx)
movb %cl, (%rdx)
leaq 0x50(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq %rcx, -0x8(%rdx)
movb %cl, (%rdx)
movq -0x18(%rax), %rax
cmpl $0x0, 0xa0(%rsp,%rax)
jne 0xb2cb
leaq 0x60(%rsp), %r13
leaq 0x20(%rsp), %rbp
movq 0x38(%rbx), %r14
movq 0x40(%rbx), %r15
callq 0x4f1c
subq %r14, %r15
shrq $0x5, %r15
cmpl %r15d, 0xe8(%rax)
jle 0xb2cb
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4220
movsbl %al, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x4490
movq 0x60(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0xb277
movq 0x28(%rbx), %rax
cmpq 0x20(%rbx), %rax
je 0xb1fb
movq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xc724
movq 0x38(%rbx), %r14
movq 0x40(%rbx), %r15
callq 0x4f1c
subq %r14, %r15
shrq $0x5, %r15
cmpl %r15d, 0xe8(%rax)
jle 0xb264
movq %r13, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x4330
leaq -0x1(%rax), %rcx
movl $0x1, %edx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4270
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0xa47a
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xb264
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4250
movq $0x0, 0x48(%rsp)
movq 0x40(%rsp), %rax
movb $0x0, (%rax)
jmp 0xb2b1
movq %rbp, %rdi
leaq 0x40(%rsp), %r14
movq %r14, %rsi
movq %r13, %rdx
callq 0xc761
movq %r14, %rdi
movq %rbp, %rsi
callq 0x4300
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xb2b1
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xa0(%rsp,%rax)
je 0xb18c
movq 0x38(%rbx), %r15
movq 0x40(%rbx), %r14
movq 0x8(%rsp), %rbp
callq 0x4f1c
subq %r15, %r14
shrq $0x5, %r14
cmpl %r14d, 0xe8(%rax)
jle 0xb2fa
leaq 0x40(%rsp), %rsi
movq %rbp, %rdi
callq 0xc724
movq 0x28(%rbx), %rax
movq 0x38(%rbx), %rcx
subq 0x20(%rbx), %rax
shrq $0x5, %rax
movl %eax, 0xc8(%rbx)
movl 0x8(%rcx), %eax
movl %eax, 0xcc(%rbx)
movq 0xaca0(%rip), %rdi      # 0x15fc0
leaq 0x5345(%rip), %rsi      # 0x1066c
movl $0x1f, %edx
callq 0x42a0
movl 0xc8(%rbx), %esi
movq 0xac82(%rip), %rdi      # 0x15fc0
callq 0x4420
movq %rax, %r14
leaq 0x533f(%rip), %rsi      # 0x1068c
movl $0xb, %edx
movq %rax, %rdi
callq 0x42a0
movl 0xcc(%rbx), %esi
movq %r14, %rdi
callq 0x4420
leaq 0x51b5(%rip), %rsi      # 0x10524
movl $0x1, %edx
movq %rax, %rdi
callq 0x42a0
movl 0xc8(%rbx), %ecx
testl %ecx, %ecx
jle 0xb3d5
movl 0xcc(%rbx), %eax
xorl %r14d, %r14d
testl %eax, %eax
jle 0xb3ca
movq %r14, %r15
shlq $0x5, %r15
xorl %r12d, %r12d
movq 0x38(%rbx), %rax
movq (%rax,%r15), %r13
movsbl (%r13,%r12), %edi
callq 0x44a0
movb %al, (%r13,%r12)
incq %r12
movslq 0xcc(%rbx), %rax
cmpq %rax, %r12
jl 0xb39d
movl 0xc8(%rbx), %ecx
incq %r14
movslq %ecx, %rdx
cmpq %rdx, %r14
jl 0xb38f
movq %rbx, %rdi
callq 0xb978
movq %rbx, %rdi
callq 0xba10
movq %rbx, %rdi
callq 0xbab8
movq %rbx, %rdi
callq 0xbc8a
movq %rbx, %rdi
callq 0xbdda
callq 0x4f1c
cmpb $0x1, 0xec(%rax)
jne 0xb78f
movq 0xabaa(%rip), %rdi      # 0x15fc0
leaq 0x527b(%rip), %rsi      # 0x10698
movl $0xc, %edx
callq 0x42a0
cmpl $0x0, 0x8(%rbx)
jle 0xb47a
xorl %r15d, %r15d
movq 0xab89(%rip), %r14      # 0x15fc0
leaq 0x20(%rsp), %r12
leaq 0x52af(%rip), %r13      # 0x106f2
movq (%rbx), %rax
movb (%rax,%r15), %al
movb %al, 0x20(%rsp)
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x42a0
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x42a0
incq %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jl 0xb443
movq 0xab3f(%rip), %rdi      # 0x15fc0
leaq 0x509c(%rip), %rsi      # 0x10524
movl $0x1, %edx
callq 0x42a0
movq 0xab27(%rip), %rdi      # 0x15fc0
leaq 0x5205(%rip), %rsi      # 0x106a5
movl $0x16, %edx
callq 0x42a0
cmpl $0x0, 0xc8(%rbx)
jle 0xb502
movl $0x8, %r15d
xorl %r13d, %r13d
movq 0xaafd(%rip), %r14      # 0x15fc0
leaq 0x505a(%rip), %r12      # 0x10524
movq (%rbp), %rax
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
movq %r14, %rdi
callq 0x42a0
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x42a0
incq %r13
movslq 0xc8(%rbx), %rax
addq $0x20, %r15
cmpq %rax, %r13
jl 0xb4ca
movq 0xaab7(%rip), %rdi      # 0x15fc0
leaq 0x51ac(%rip), %rsi      # 0x106bc
movl $0x12, %edx
callq 0x42a0
movq 0x80(%rbx), %rax
movq 0x88(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
jle 0xb585
xorl %r15d, %r15d
movq 0xaa83(%rip), %r14      # 0x15fc0
leaq 0x51ae(%rip), %r12      # 0x106f2
xorps %xmm0, %xmm0
cvtss2sd (%rax,%r15,4), %xmm0
movq %r14, %rdi
callq 0x43c0
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x42a0
incq %r15
movq 0x80(%rbx), %rax
movq 0x88(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r15
jl 0xb544
movq 0xaa34(%rip), %rdi      # 0x15fc0
leaq 0x4f91(%rip), %rsi      # 0x10524
movl $0x1, %edx
callq 0x42a0
movq 0xaa1c(%rip), %rdi      # 0x15fc0
leaq 0x5124(%rip), %rsi      # 0x106cf
movl $0xe, %edx
callq 0x42a0
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
jle 0xb60f
xorl %r15d, %r15d
movq 0xa9ee(%rip), %r14      # 0x15fc0
leaq 0x5119(%rip), %r12      # 0x106f2
movl (%rax,%r15,4), %esi
movq %r14, %rdi
callq 0x4420
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x42a0
incq %r15
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r15
jl 0xb5d9
movq 0xa9aa(%rip), %rdi      # 0x15fc0
leaq 0x4f07(%rip), %rsi      # 0x10524
movl $0x1, %edx
callq 0x42a0
movq 0xa992(%rip), %r14      # 0x15fc0
leaq 0x50a9(%rip), %rsi      # 0x106de
movl $0xe, %edx
movq %r14, %rdi
callq 0x42a0
movq 0x98(%rbx), %rcx
movq 0xa0(%rbx), %rax
subq %rcx, %rax
shrq $0x2, %rax
testl %eax, %eax
jle 0xb6e1
xorl %r15d, %r15d
leaq 0x5084(%rip), %r12      # 0x106ed
leaq 0x5082(%rip), %r13      # 0x106f2
movq 0x68(%rbx), %rdi
movslq 0xc8(%rbx), %rax
imulq $0x66666667, %rax, %r8  # imm = 0x66666667
movq %r8, %rax
shrq $0x3f, %rax
sarq $0x22, %r8
addl %eax, %r8d
movl $0x6, %edx
movq %r14, %rax
movq %r12, %rsi
cmpl %r8d, (%rdi,%r15,4)
jge 0xb6ba
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%r15,4), %xmm0
movq %r14, %rdi
callq 0x43c0
movl $0x1, %edx
movq %r13, %rsi
movq %rax, %rdi
callq 0x42a0
incq %r15
movq 0x98(%rbx), %rcx
movq 0xa0(%rbx), %rax
subq %rcx, %rax
shrq $0x2, %rax
cltq
cmpq %rax, %r15
jl 0xb670
movq 0xa8d8(%rip), %rdi      # 0x15fc0
leaq 0x4e35(%rip), %rsi      # 0x10524
movl $0x1, %edx
callq 0x42a0
movq 0xa8c0(%rip), %rdi      # 0x15fc0
leaq 0x4fed(%rip), %rsi      # 0x106f4
movl $0xc, %edx
callq 0x42a0
movq 0xb0(%rbx), %rax
movq 0xb8(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
jle 0xb777
xorl %r15d, %r15d
movq 0xa88c(%rip), %r14      # 0x15fc0
leaq 0x4fb7(%rip), %r12      # 0x106f2
movl (%rax,%r15,4), %esi
movq %r14, %rdi
callq 0x4420
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x42a0
incq %r15
movq 0xb0(%rbx), %rax
movq 0xb8(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r15
jl 0xb73b
movq 0xa842(%rip), %rdi      # 0x15fc0
leaq 0x4d9f(%rip), %rsi      # 0x10524
movl $0x1, %edx
callq 0x42a0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xb7ab
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xb7c7
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4250
leaq 0x80(%rsp), %rdi
callq 0x4080
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa7fb(%rip), %rdi      # 0x15fe8
leaq 0x482c(%rip), %rsi      # 0x10020
movl $0x11, %edx
callq 0x42a0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0xa7dc(%rip), %rdi      # 0x15fe8
callq 0x42a0
leaq 0x4d0c(%rip), %rsi      # 0x10524
movq %rax, %rdi
callq 0x4230
xorl %edi, %edi
callq 0x42e0
movq %rax, %r12
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %rbp
jmp 0xb8be
jmp 0xb868
movq %rax, %r12
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xb96d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4250
jmp 0xb96d
jmp 0xb96a
movq %rax, %r12
jmp 0xb8cb
jmp 0xb96a
jmp 0xb87e
jmp 0xb87e
jmp 0xb87e
jmp 0xb87e
jmp 0xb87e
jmp 0xb87e
movq %rax, %r12
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
movq 0x10(%rsp), %r15
je 0xb8a2
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xb8be
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4250
leaq 0x80(%rsp), %rdi
callq 0x4080
movq 0xb0(%rbx), %rdi
testq %rdi, %rdi
je 0xb8e6
movq 0xc0(%rbx), %rsi
subq %rdi, %rsi
callq 0x4250
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0xb901
movq 0xa8(%rbx), %rsi
subq %rdi, %rsi
callq 0x4250
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0xb91c
movq 0x90(%rbx), %rsi
subq %rdi, %rsi
callq 0x4250
leaq 0x50(%rbx), %r14
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0xb935
movq 0x78(%rbx), %rsi
subq %rdi, %rsi
callq 0x4250
movq %r14, %rdi
callq 0x5074
movq %rbp, %rdi
callq 0x5074
movq 0x18(%rsp), %rdi
callq 0x5074
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0xb962
movq (%r15), %rsi
incq %rsi
callq 0x4250
movq %r12, %rdi
callq 0x4440
movq %rax, %r12
movq 0x8(%rsp), %rbp
jmp 0xb881
nop