// File: /workspace/github_c_makefile_star2_O2/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, 0x1c6c5(%rip)     # 0x30350
jne 0x13ca3
movabsq $0x3ff5555555555555, %rax # imm = 0x3FF5555555555555
movq %rax, 0x1db42(%rip)     # 0x317e0
jmp 0x13e10
cmpb $0x1, 0x1c6aa(%rip)     # 0x30354
jne 0x13d31
movapd 0x1c558(%rip), %xmm0    # 0x30210
movapd 0x1c560(%rip), %xmm1    # 0x30220
movapd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x1db18(%rip)    # 0x317e8
movapd %xmm0, %xmm3
mulpd %xmm1, %xmm3
movsd 0x1c550(%rip), %xmm4    # 0x30230
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, 0x1daf8(%rip)    # 0x317f0
mulsd %xmm3, %xmm4
mulsd %xmm3, %xmm2
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
divsd %xmm3, %xmm4
movsd %xmm4, 0x1dae8(%rip)    # 0x317f8
mulsd %xmm3, %xmm4
addsd %xmm2, %xmm4
movsd 0xb3a8(%rip), %xmm0     # 0x1f0c8
divsd %xmm4, %xmm0
movsd %xmm0, 0x1dab4(%rip)    # 0x317e0
jmp 0x13e10
cmpb $0x0, 0x1c620(%rip)     # 0x30358
jne 0x13d47
testb $0x1, 0x1c61b(%rip)     # 0x3035c
je 0x13e10
leaq 0x1e3a2(%rip), %rcx     # 0x320f0
leaq 0x1c4eb(%rip), %rdx     # 0x30240
movsd 0x1c53b(%rip), %xmm0    # 0x30298
xorl %esi, %esi
leaq 0x1c4aa(%rip), %rax     # 0x30210
cmpq $0x4, %rsi
je 0x13d9a
xorl %edi, %edi
cmpq $0x20, %rdi
je 0x13d8d
movsd (%rdx,%rdi), %xmm1
divsd %xmm0, %xmm1
mulsd (%rdi,%rax), %xmm1
movsd %xmm1, (%rcx,%rdi)
addq $0x8, %rdi
jmp 0x13d6e
incq %rsi
addq $0x20, %rcx
addq $0x20, %rdx
jmp 0x13d66
xorpd %xmm0, %xmm0
leaq 0x1e34b(%rip), %rcx     # 0x320f0
xorl %edx, %edx
movapd 0xb2a1(%rip), %xmm1     # 0x1f050
movq %rcx, %rsi
cmpq $0x20, %rdx
je 0x13df2
andq $0x0, (%rsi)
movsd (%rcx,%rdx,4), %xmm2
addsd 0x8(%rcx,%rdx,4), %xmm2
addsd 0x10(%rcx,%rdx,4), %xmm2
addsd 0x18(%rcx,%rdx,4), %xmm2
movapd %xmm2, %xmm3
xorpd %xmm1, %xmm3
mulsd (%rdx,%rax), %xmm2
movlpd %xmm3, (%rsi)
addsd %xmm2, %xmm0
addq $0x8, %rdx
addq $0x28, %rsi
jmp 0x13db2
leaq 0x1e2e7(%rip), %rax     # 0x320e0
movsd %xmm0, (%rax)
leaq 0x1d9fc(%rip), %rdi     # 0x31800
leaq 0x1da15(%rip), %rsi     # 0x31820
callq 0x16a0c
xorl %r15d, %r15d
movslq 0x1d98a(%rip), %rax     # 0x317a4
cmpq %rax, %r15
jge 0x13e3c
movq 0x1d7ba(%rip), %rax     # 0x315e0
movl (%rax,%r15,4), %edx
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rcx
callq 0x145f1
incq %r15
jmp 0x13e13
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq