// File: /workspace/github_c_makefile_star2_O3/dapogon[P]cellcoal/src/cellcoal.c
// Function: SimulateFiniteDNA
void SimulateFiniteDNA (TreeNode *p, int genome, long int *seed)
    {
    int     i, j;
		
	if (doJC == YES)
		{
		beta = 4./3;
		}
	else if (doHKY == YES)
        {
		freqR = freq[A] + freq[G];
		freqY = freq[C] + freq[T];
		freqAG = freq[A] * freq[G];
		freqCT = freq[C] * freq[T];
		kappa = (titv*freqR*freqY)/(freqAG+freqCT);
		beta = 0.5 / (freqR*freqY + kappa*(freqAG+freqCT));
		}
    else if (doGTR == YES || doGTnR == YES)
		{
		for (i=0; i<4; i++)
			for (j=0; j<4; j++)
				Qij[i*4+j] = Mij[i][j] / Mij[2][3] * freq[j];
		mr=0;
		for (i=0; i<4; i++)
			{
			Qij[i*4+i]=0;
			Qij[i*4+i]=-(Qij[i*4]+Qij[i*4+1]+Qij[i*4+2]+Qij[i*4+3]);
			mr-=freq[i]*Qij[i*4+i];
			}
		EigenREV(Root, Cijk);
		}
		
    for (i=0; i<numAltModelSites; i++)
        SimulateFiniteDNAforSite (p, genome, AltModelSites[i], seed);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
cmpb $0x1, 0x1eea9(%rip)     # 0x36350
jne 0x174bf
movabsq $0x3ff5555555555555, %rax # imm = 0x3FF5555555555555
movq %rax, 0x20326(%rip)     # 0x377e0
jmp 0x1762e
cmpb $0x1, 0x1ee8e(%rip)     # 0x36354
jne 0x1754d
movapd 0x1ed3c(%rip), %xmm0    # 0x36210
movapd 0x1ed44(%rip), %xmm1    # 0x36220
movapd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x202fc(%rip)    # 0x377e8
movapd %xmm0, %xmm3
mulpd %xmm1, %xmm3
movsd 0x1ed34(%rip), %xmm4    # 0x36230
mulsd %xmm2, %xmm4
shufpd $0x1, %xmm3, %xmm0      # xmm0 = xmm0[1],xmm3[0]
movhlps %xmm1, %xmm3            # xmm3 = xmm1[1],xmm3[1]
addpd %xmm0, %xmm3
movlpd %xmm3, 0x202dc(%rip)    # 0x377f0
mulsd %xmm3, %xmm4
mulsd %xmm3, %xmm2
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
divsd %xmm3, %xmm4
movsd %xmm4, 0x202cc(%rip)    # 0x377f8
mulsd %xmm3, %xmm4
addsd %xmm2, %xmm4
movsd 0xbbdc(%rip), %xmm0     # 0x23118
divsd %xmm4, %xmm0
movsd %xmm0, 0x20298(%rip)    # 0x377e0
jmp 0x1762e
cmpb $0x0, 0x1ee04(%rip)     # 0x36358
jne 0x17563
testb $0x1, 0x1edff(%rip)     # 0x3635c
je 0x1762e
leaq 0x1ecd6(%rip), %rcx     # 0x36240
movupd 0x1ed26(%rip), %xmm0    # 0x36298
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
leaq 0x20b73(%rip), %rdx     # 0x380f0
xorl %esi, %esi
leaq 0x1ec8a(%rip), %rax     # 0x36210
xorl %edi, %edi
movapd (%rcx,%rdi), %xmm1
divpd %xmm0, %xmm1
mulpd (%rdi,%rax), %xmm1
movapd %xmm1, (%rdx,%rdi)
addq $0x10, %rdi
cmpq $0x20, %rdi
jne 0x17588
incq %rsi
addq $0x20, %rcx
addq $0x20, %rdx
cmpq $0x4, %rsi
jne 0x17586
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
leaq 0x20b2d(%rip), %rdx     # 0x380f0
movapd 0xba75(%rip), %xmm1     # 0x23040
xorl %esi, %esi
movq $0x0, (%rdx,%rcx)
movsd (%rdx,%rsi,4), %xmm2
addsd 0x8(%rdx,%rsi,4), %xmm2
addsd 0x10(%rdx,%rsi,4), %xmm2
addsd 0x18(%rdx,%rsi,4), %xmm2
movapd %xmm2, %xmm3
xorpd %xmm1, %xmm3
movlpd %xmm3, (%rdx,%rcx)
mulsd (%rsi,%rax), %xmm2
addsd %xmm2, %xmm0
addq $0x8, %rsi
addq $0x28, %rcx
cmpq $0x20, %rsi
jne 0x175cd
leaq 0x20ac9(%rip), %rax     # 0x380e0
movsd %xmm0, (%rax)
leaq 0x201de(%rip), %rdi     # 0x37800
leaq 0x201f7(%rip), %rsi     # 0x37820
callq 0x1a530
cmpl $0x0, 0x2016f(%rip)     # 0x377a4
jle 0x17661
xorl %r15d, %r15d
movq 0x1ff9f(%rip), %rax     # 0x375e0
movl (%rax,%r15,4), %edx
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rcx
callq 0x17f98
incq %r15
movslq 0x20148(%rip), %rax     # 0x377a4
cmpq %rax, %r15
jl 0x1763a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq