// File: /workspace/github_c_makefile_star2_O1/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, 0x2b193(%rip)     # 0x42350
jne 0x171d5
movabsq $0x3ff5555555555555, %rax # imm = 0x3FF5555555555555
movq %rax, 0x2c610(%rip)     # 0x437e0
jmp 0x17353
cmpb $0x1, 0x2b178(%rip)     # 0x42354
jne 0x1726f
movsd 0x2b026(%rip), %xmm0    # 0x42210
movsd 0x2b02e(%rip), %xmm1    # 0x42220
movapd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x2c5e6(%rip)    # 0x437e8
movsd 0x2b00e(%rip), %xmm3    # 0x42218
movsd 0x2b016(%rip), %xmm4    # 0x42228
movapd %xmm3, %xmm5
addsd %xmm4, %xmm5
movsd %xmm5, 0x2c5ce(%rip)    # 0x437f0
mulsd %xmm1, %xmm0
mulsd %xmm4, %xmm3
addsd %xmm0, %xmm3
movsd 0x2affa(%rip), %xmm0    # 0x42230
mulsd %xmm2, %xmm0
mulsd %xmm5, %xmm0
divsd %xmm3, %xmm0
movsd %xmm0, 0x2c5ae(%rip)    # 0x437f8
mulsd %xmm3, %xmm0
mulsd %xmm2, %xmm5
addsd %xmm0, %xmm5
movsd 0x1cdc2(%rip), %xmm0    # 0x34020
divsd %xmm5, %xmm0
movsd %xmm0, 0x2c576(%rip)    # 0x437e0
jmp 0x17353
cmpb $0x0, 0x2b0e2(%rip)     # 0x42358
jne 0x17285
testb $0x1, 0x2b0dd(%rip)     # 0x4235c
je 0x17353
leaq 0x2afb4(%rip), %rcx     # 0x42240
leaq 0x2ce5d(%rip), %rdx     # 0x440f0
movsd 0x2affd(%rip), %xmm0    # 0x42298
xorl %esi, %esi
leaq 0x2af6c(%rip), %rax     # 0x42210
xorl %edi, %edi
movsd (%rcx,%rdi), %xmm1
divsd %xmm0, %xmm1
mulsd (%rdi,%rax), %xmm1
movsd %xmm1, (%rdx,%rdi)
addq $0x8, %rdi
cmpq $0x20, %rdi
jne 0x172a6
incq %rsi
addq $0x20, %rcx
addq $0x20, %rdx
cmpq $0x4, %rsi
jne 0x172a4
leaq 0x2ce05(%rip), %rcx     # 0x440e0
movq $0x0, (%rcx)
xorpd %xmm0, %xmm0
xorl %edx, %edx
leaq 0x2ce01(%rip), %rsi     # 0x440f0
movapd 0x1cdc9(%rip), %xmm1    # 0x340c0
xorl %edi, %edi
movq $0x0, (%rsi,%rdx)
movsd (%rsi,%rdi,4), %xmm2
addsd 0x8(%rsi,%rdi,4), %xmm2
addsd 0x10(%rsi,%rdi,4), %xmm2
addsd 0x18(%rsi,%rdi,4), %xmm2
movapd %xmm2, %xmm3
xorpd %xmm1, %xmm3
movlpd %xmm3, (%rsi,%rdx)
mulsd (%rdi,%rax), %xmm2
addsd %xmm2, %xmm0
addq $0x8, %rdi
addq $0x28, %rdx
cmpq $0x20, %rdi
jne 0x172f9
movsd %xmm0, (%rcx)
leaq 0x2c4b9(%rip), %rdi     # 0x43800
leaq 0x2c4d2(%rip), %rsi     # 0x43820
callq 0x1a21c
cmpl $0x0, 0x2c44a(%rip)     # 0x437a4
jle 0x17386
xorl %r15d, %r15d
movq 0x2c27a(%rip), %rax     # 0x435e0
movl (%rax,%r15,4), %edx
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rcx
callq 0x17c1c
incq %r15
movslq 0x2c423(%rip), %rax     # 0x437a4
cmpq %rax, %r15
jl 0x1735f
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq