// File: /workspace/github_cpp_makefile_star2_O1/melop[P]admixem/Population.cpp
// Function: Population::SummarizePhenotype(bool)
void Population::SummarizePhenotype(bool bSetPrevious) {
	vector< string > vPhenotypes;
	SimulConfig.pPhenotypeConfig->GetKeys(vPhenotypes);

	for(vector< string >::iterator it=vPhenotypes.begin(); it != vPhenotypes.end(); ++it) { // go over each key
		string sKey = *it;
		int nPop=0, nMale=0, nFemale=0;
		double nSum=0.0, nSumMale=0.0, nSumFemale=0.0;
		double nMean=0.0, nMeanMale=0.0, nMeanFemale=0.0;
		double nSqrDiffSum=0.0, nSqrDiffSumMale=0.0, nSqrDiffSumFemale=0.0;

		//go over males
		for(vector< Individual *>::iterator itInd = _mpMales.begin(); itInd !=_mpMales.end(); ++itInd ) {
			nPop++;
			nMale++;
			double nVal = (*itInd)->GetPhenotype(sKey);
			double nValSqr = nVal * nVal;
			nSum += nVal;
			nSumMale += nVal;
		}

				//go over females
		for(vector< Individual *>::iterator itInd = _mpFemales.begin(); itInd !=_mpFemales.end(); ++itInd ) {
			nPop++;
			nFemale++;
			double nVal = (*itInd)->GetPhenotype(sKey);
			double nValSqr = nVal * nVal;
			nSum += nVal;
			nSumFemale += nVal;
		}

		nMean = (nPop == 0)? 0.0:  nSum / nPop;
		nMeanMale = (nMale == 0)? 0.0: nSumMale / nMale;
		nMeanFemale = (nFemale == 0) ? 0.0:nSumFemale / nFemale;

		//go over males
		for(vector< Individual *>::iterator itInd = _mpMales.begin(); itInd !=_mpMales.end(); ++itInd ) {
			double nVal = (*itInd)->GetPhenotype(sKey);
			double nDiff = nVal - nMean;
			double nDiffMale = nVal - nMeanMale;
			nSqrDiffSum += nDiff * nDiff;
			nSqrDiffSumMale += nDiffMale * nDiffMale;
		}

				//go over females
		for(vector< Individual *>::iterator itInd = _mpFemales.begin(); itInd !=_mpFemales.end(); ++itInd ) {
			double nVal = (*itInd)->GetPhenotype(sKey);
			double nDiff = nVal - nMean;
			double nDiffFemale = nVal - nMeanFemale;
			nSqrDiffSum += nDiff * nDiff;
			nSqrDiffSumFemale += nDiffFemale * nDiffFemale;
		}

		/* Save the phenotype for the previous generation , used for oblique imprinting*/
		if (bSetPrevious) {
			this->_mpPrevGenSumPhenotype[sKey] = (_mpSumPhenotype.find(sKey) == _mpSumPhenotype.end())? pair< double, double> ( 0.0 , 0.0 ) : this->_mpSumPhenotype[sKey];
			this->_mpPrevGenSumPhenotypeMale[sKey] = (_mpSumPhenotypeMale.find(sKey) == _mpSumPhenotypeMale.end())? pair< double, double> ( 0.0 , 0.0 ) : this->_mpSumPhenotypeMale[sKey]; 
			this->_mpPrevGenSumPhenotypeFemale[sKey] = (_mpSumPhenotypeFemale.find(sKey) == _mpSumPhenotypeFemale.end())? pair< double, double> ( 0.0 , 0.0 ) : this->_mpSumPhenotypeFemale[sKey];  ; 
		}

		this->_mpSumPhenotype[sKey] = pair< double , double >( nMean  , sqrt((nPop==0)? 0.0:(nSqrDiffSum / nPop))); // mean, standard deviation
		this->_mpSumPhenotypeMale[sKey] = pair< double , double >( nMeanMale , sqrt((nMale==0)? 0.0:(nSqrDiffSumMale / nMale)) ); // mean, standard deviation
		this->_mpSumPhenotypeFemale[sKey] = pair< double , double >( nMeanFemale , sqrt((nFemale==0)? 0.0: (nSqrDiffSumFemale / nFemale)) ); // mean, standard deviation

	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movl %esi, 0x80(%rsp)
movq %rdi, %r14
xorpd %xmm0, %xmm0
leaq 0x120(%rsp), %rsi
movapd %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
leaq 0x1f700(%rip), %rax     # 0x49908
movq 0x10(%rax), %rdi
callq 0x1407e
movq 0x120(%rsp), %rcx
cmpq 0x128(%rsp), %rcx
je 0x2a95a
leaq 0xb8(%r14), %rax
movq %rax, 0x68(%rsp)
leaq 0xc0(%r14), %rax
movq %rax, 0x168(%rsp)
leaq 0x148(%r14), %rax
movq %rax, 0x160(%rsp)
leaq 0xe8(%r14), %rax
movq %rax, 0x60(%rsp)
leaq 0xf0(%r14), %rax
movq %rax, 0x158(%rsp)
leaq 0x178(%r14), %rax
movq %rax, 0x150(%rsp)
leaq 0x118(%r14), %rax
movq %rax, 0x58(%rsp)
leaq 0x120(%r14), %rax
movq %rax, 0x148(%rsp)
leaq 0x1a8(%r14), %rax
movq %rax, 0x140(%rsp)
leaq 0x38(%rsp), %r13
leaq 0x48(%rsp), %rax
movq %rax, 0x38(%rsp)
movq (%rcx), %rsi
movq %rcx, 0x170(%rsp)
movq 0x8(%rcx), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0xa916
movq 0x48(%r14), %r13
xorl %ebx, %ebx
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x18(%rsp)
movsd %xmm0, 0x8(%rsp)
movl $0x0, %r15d
cmpq 0x50(%r14), %r13
je 0x2a3ab
movsd %xmm0, 0x8(%rsp)
xorl %r15d, %r15d
movsd %xmm0, 0x18(%rsp)
movq (%r13), %rbp
leaq 0x110(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %r12
movq %r12, %rdi
callq 0xa916
movq %rbp, %rdi
movq %r12, %rsi
callq 0x258a8
movapd %xmm0, %xmm1
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x2a37a
movq 0x110(%rsp), %rsi
incq %rsi
movsd %xmm1, 0x28(%rsp)
callq 0x7390
movsd 0x28(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
addq $0x8, %r13
incl %r15d
cmpq 0x50(%r14), %r13
jne 0x2a309
movq 0x60(%r14), %r13
cmpq 0x68(%r14), %r13
je 0x2a46f
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
xorl %ebx, %ebx
movq (%r13), %rbp
leaq 0xf0(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0xe0(%rsp), %r12
movq %r12, %rdi
callq 0xa916
movq %rbp, %rdi
movq %r12, %rsi
callq 0x258a8
movapd %xmm0, %xmm1
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x2a436
movq 0xf0(%rsp), %rsi
incq %rsi
movsd %xmm1, 0x28(%rsp)
callq 0x7390
movsd 0x28(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
addq $0x8, %r13
decl %ebx
cmpq 0x68(%r14), %r13
jne 0x2a3c5
movl %r15d, %eax
subl %ebx, %eax
negl %ebx
jmp 0x2a472
movl %r15d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x98(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd %xmm0, 0x28(%rsp)
testl %eax, %eax
je 0x2a4ab
movsd 0x8(%rsp), %xmm0
divsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd %xmm0, 0x90(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x78(%rsp)
testl %r15d, %r15d
je 0x2a4e0
movsd 0x18(%rsp), %xmm0
divsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
movl %eax, 0x84(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0x88(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x70(%rsp)
testl %ebx, %ebx
je 0x2a51a
movsd 0x10(%rsp), %xmm0
divsd 0x88(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
movq 0x48(%r14), %r13
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
cmpq 0x50(%r14), %r13
je 0x2a5f5
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x30(%rsp)
movq (%r13), %rbp
leaq 0xd0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0xc0(%rsp), %r12
movq %r12, %rdi
callq 0xa916
movq %rbp, %rdi
movq %r12, %rsi
callq 0x258a8
movapd %xmm0, %xmm2
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x2a5af
movq 0xd0(%rsp), %rsi
incq %rsi
movsd %xmm2, 0x18(%rsp)
callq 0x7390
movsd 0x18(%rsp), %xmm2
movapd %xmm2, %xmm0
subsd 0x28(%rsp), %xmm0
subsd 0x78(%rsp), %xmm2
mulsd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
mulsd %xmm2, %xmm2
movsd 0x30(%rsp), %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0x30(%rsp)
addq $0x8, %r13
cmpq 0x50(%r14), %r13
jne 0x2a53e
movq 0x60(%r14), %r13
cmpq 0x68(%r14), %r13
je 0x2a6c6
xorpd %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
movq (%r13), %rbp
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
callq 0xa916
movq %rbp, %rdi
movq %r12, %rsi
callq 0x258a8
movapd %xmm0, %xmm2
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x2a67e
movq 0xb0(%rsp), %rsi
incq %rsi
movsd %xmm2, 0x10(%rsp)
callq 0x7390
movsd 0x10(%rsp), %xmm2
movapd %xmm2, %xmm0
subsd 0x28(%rsp), %xmm0
subsd 0x70(%rsp), %xmm2
mulsd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
mulsd %xmm2, %xmm2
movsd 0x18(%rsp), %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0x18(%rsp)
addq $0x8, %r13
cmpq 0x68(%r14), %r13
jne 0x2a60d
jmp 0x2a6d0
xorpd %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
cmpb $0x0, 0x80(%rsp)
leaq 0x38(%rsp), %r13
je 0x2a821
movq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0x276ee
cmpq 0x168(%rsp), %rax
je 0x2a718
movq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0x26b00
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rax), %xmm0
jmp 0x2a722
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x20(%rsp)
movq 0x160(%rsp), %rdi
movq %r13, %rsi
callq 0x26b00
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movq 0x60(%rsp), %rdi
movq %r13, %rsi
callq 0x276ee
cmpq 0x158(%rsp), %rax
je 0x2a782
movq 0x60(%rsp), %rdi
movq %r13, %rsi
callq 0x26b00
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rax), %xmm0
jmp 0x2a78c
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x20(%rsp)
movq 0x150(%rsp), %rdi
movq %r13, %rsi
callq 0x26b00
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movq 0x58(%rsp), %rdi
movq %r13, %rsi
callq 0x276ee
cmpq 0x148(%rsp), %rax
je 0x2a7ec
movq 0x58(%rsp), %rdi
movq %r13, %rsi
callq 0x26b00
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rax), %xmm0
jmp 0x2a7f6
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x20(%rsp)
movq 0x140(%rsp), %rdi
movq %r13, %rsi
callq 0x26b00
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
cmpl $0x0, 0x84(%rsp)
je 0x2a842
movsd 0x8(%rsp), %xmm0
divsd 0x98(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x2a84e
sqrtsd %xmm0, %xmm0
jmp 0x2a853
callq 0x7728
movsd %xmm0, 0x8(%rsp)
movq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0x26b00
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
testl %r15d, %r15d
je 0x2a897
movsd 0x30(%rsp), %xmm0
divsd 0x90(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x2a8a3
sqrtsd %xmm0, %xmm0
jmp 0x2a8a8
callq 0x7728
movsd %xmm0, 0x8(%rsp)
movq 0x60(%rsp), %rdi
movq %r13, %rsi
callq 0x26b00
movsd 0x78(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
testl %ebx, %ebx
je 0x2a8eb
movsd 0x18(%rsp), %xmm0
divsd 0x88(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x2a8f7
sqrtsd %xmm0, %xmm0
jmp 0x2a8fc
callq 0x7728
movsd %xmm0, 0x8(%rsp)
movq 0x58(%rsp), %rdi
movq %r13, %rsi
callq 0x26b00
movsd 0x70(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2a940
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x170(%rsp), %rcx
addq $0x20, %rcx
cmpq 0x128(%rsp), %rcx
jne 0x2a2aa
leaq 0x120(%rsp), %rdi
callq 0x1a61a
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a99c
jmp 0x2aa14
jmp 0x2aa14
jmp 0x2aa14
jmp 0x2aa14
jmp 0x2aa14
jmp 0x2aa14
jmp 0x2aa14
jmp 0x2aa14
jmp 0x2aa14
movq %rax, %rbx
jmp 0x2aa5d
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x2aa41
movq 0xb0(%rsp), %rsi
jmp 0x2aa39
jmp 0x2aa14
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x2aa41
movq 0xd0(%rsp), %rsi
jmp 0x2aa39
jmp 0x2aa14
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x2aa41
movq 0xf0(%rsp), %rsi
jmp 0x2aa39
jmp 0x2aa14
movq %rax, %rbx
jmp 0x2aa41
movq %rax, %rbx
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x2aa41
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x7390
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2aa5d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x7390
leaq 0x120(%rsp), %rdi
callq 0x1a61a
movq %rbx, %rdi
callq 0x76a0