// File: /workspace/github_c_makefile_star2_O1/dapogon[P]cellcoal/src/cellcoal.c
// Function: SimulateFiniteDNAforSite
void SimulateFiniteDNAforSite (TreeNode *p, int genome, int site, long int *seed)
	{
    double	branchLength, Pij[4][4];
    int     cell, anccell, ancstate, newstate;
		
    if (p != NULL)
        {
		if (p->isHealthyRoot == NO)
			{
			cell = p->label;
			anccell = p->anc->label;
			ancstate = data[genome][anccell][site];
	
			if (doUserTree == YES)
				branchLength = p->branchLength;
			else
				{
				if (rateVarAmongSites == YES)
					branchLength = altModelMutationRate * p->length * allSites[site].rateMultiplier;
				else
					branchLength = altModelMutationRate * p->length;
				}
				
			FillSubstitutionMatrix (Pij, branchLength);
			newstate = data[genome][cell][site] = ChooseUniformState (Pij[ancstate], seed);
			
			if (newstate != ancstate)
				{
				if (genome == MATERNAL)
					allSites[site].numMutationsMaternal++;
				else if (genome == PATERNAL)
					allSites[site].numMutationsPaternal++;
				allSites[site].numMutations++;
				numMU++;
				}
			}
		SimulateFiniteDNAforSite (p->left,  genome, site, seed);
        SimulateFiniteDNAforSite (p->right, genome, site, seed);
        }
 	}

// Assembly:
testq %rdi, %rdi
je 0x17c7f
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
cmpl $0x0, 0x24(%rdi)
jne 0x18120
movq 0x10(%r15), %rax
movslq 0x1c(%rax), %rax
movq 0x2b962(%rip), %rcx     # 0x435b8
movl %r14d, %edx
movq %rdx, 0x58(%rsp)
movq (%rcx,%rdx,8), %rcx
movq (%rcx,%rax,8), %rax
movslq %ebp, %rsi
cmpb $0x1, 0x2a714(%rip)     # 0x42384
movq %rbx, 0x70(%rsp)
jne 0x17c80
movsd 0x40(%r15), %xmm1
jmp 0x17cb6
retq
movsd 0x2a910(%rip), %xmm0    # 0x42598
mulsd 0x30(%r15), %xmm0
cmpb $0x1, 0x2a6cb(%rip)     # 0x42360
jne 0x17cb2
movq 0x2b922(%rip), %rcx     # 0x435c0
movq %rsi, %rdx
shlq $0x7, %rdx
leaq (%rdx,%rsi,8), %rdx
mulsd 0x80(%rcx,%rdx), %xmm0
movapd %xmm0, %xmm1
movl %r14d, 0x40(%rsp)
movslq 0x1c(%r15), %rcx
movq %rcx, 0x48(%rsp)
movslq (%rax,%rsi,4), %rax
movq %rax, 0x50(%rsp)
movsd 0x1c3ab(%rip), %xmm0    # 0x34080
ucomisd %xmm1, %xmm0
movl %ebp, 0x44(%rsp)
movq %r15, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
jbe 0x17d2a
leaq 0x90(%rsp), %rax
xorl %ecx, %ecx
movsd 0x1c30d(%rip), %xmm0    # 0x34008
xorl %edx, %edx
movapd %xmm0, %xmm1
cmpq %rdx, %rcx
je 0x17d0a
xorpd %xmm1, %xmm1
movsd %xmm1, (%rax,%rdx,8)
incq %rdx
cmpq $0x4, %rdx
jne 0x17cfd
incq %rcx
addq $0x20, %rax
cmpq $0x4, %rcx
jne 0x17cfb
jmp 0x1808b
cmpb $0x1, 0x2a61f(%rip)     # 0x42350
jne 0x17da6
xorpd 0x1c385(%rip), %xmm1    # 0x340c0
movapd %xmm1, 0x20(%rsp)
leaq 0x90(%rsp), %rbx
xorl %r14d, %r14d
leaq 0x1c38d(%rip), %r15     # 0x340e0
xorl %r12d, %r12d
xorl %r13d, %r13d
cmpq %r12, %r14
sete %r13b
movsd 0x2ba78(%rip), %xmm0    # 0x437e0
mulsd 0x20(%rsp), %xmm0
callq 0x22d0
movsd 0x1c30d(%rip), %xmm1    # 0x34088
mulsd (%r15,%r13,8), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rbx,%r12,8)
incq %r12
cmpq $0x4, %r12
jne 0x17d56
incq %r14
addq $0x20, %rbx
cmpq $0x4, %r14
jne 0x17d53
jmp 0x1808b
movapd %xmm1, 0x20(%rsp)
cmpb $0x1, 0x2a5a1(%rip)     # 0x42354
jne 0x18066
leaq 0x90(%rsp), %r13
xorl %r12d, %r12d
leaq 0x2ba1d(%rip), %rbx     # 0x437e8
leaq 0x2ba1e(%rip), %rbp     # 0x437f0
movsd 0x1c26e(%rip), %xmm0    # 0x34048
movsd 0x1c226(%rip), %xmm1    # 0x34008
movq %r12, %rax
xorq $0x3, %rax
movq %rax, 0x88(%rsp)
movq %r12, %rax
xorq $0x2, %rax
movq %rax, 0x80(%rsp)
movq %r12, %rax
xorq $0x1, %rax
movq %rax, 0x78(%rsp)
leaq 0x2a3fd(%rip), %r15     # 0x42210
xorl %r14d, %r14d
testb $0x1, %r14b
movq %rbp, %rax
cmoveq %rbx, %rax
movsd (%rax), %xmm3
movsd 0x2b9cb(%rip), %xmm2    # 0x437f8
addsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
cmpq %r14, %r12
jne 0x17ef7
movsd (%r15), %xmm4
movsd %xmm4, 0x8(%rsp)
divsd %xmm3, %xmm1
addsd %xmm0, %xmm1
mulsd %xmm4, %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x2b979(%rip), %xmm0    # 0x437e0
movapd 0x1c251(%rip), %xmm1    # 0x340c0
xorpd %xmm1, %xmm0
mulsd 0x20(%rsp), %xmm0
movsd %xmm2, 0x38(%rsp)
movsd %xmm3, 0x10(%rsp)
callq 0x22d0
mulsd 0x18(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm1
movapd %xmm1, %xmm0
subsd (%r15), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x2b923(%rip), %xmm1    # 0x437e0
xorpd 0x1c1fb(%rip), %xmm1    # 0x340c0
mulsd 0x20(%rsp), %xmm1
movsd 0x38(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x22d0
movsd 0x1c126(%rip), %xmm1    # 0x34008
movapd %xmm0, %xmm2
mulsd 0x10(%rsp), %xmm2
addsd 0x8(%rsp), %xmm2
jmp 0x18033
movq %r14, %rax
xorq $0x2, %rax
orq %r12, %rax
jne 0x17fb5
movsd (%r15), %xmm4
movsd %xmm4, 0x8(%rsp)
divsd %xmm3, %xmm1
addsd %xmm0, %xmm1
mulsd %xmm4, %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x2b8b4(%rip), %xmm0    # 0x437e0
movapd 0x1c18c(%rip), %xmm1    # 0x340c0
xorpd %xmm1, %xmm0
mulsd 0x20(%rsp), %xmm0
movsd %xmm2, 0x38(%rsp)
movsd %xmm3, 0x10(%rsp)
callq 0x22d0
mulsd 0x18(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd (%r15), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x2b86c(%rip), %xmm1    # 0x437e0
xorpd 0x1c144(%rip), %xmm1    # 0x340c0
mulsd 0x20(%rsp), %xmm1
movsd 0x38(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x22d0
movsd 0x18(%rsp), %xmm2
movsd 0x1c069(%rip), %xmm1    # 0x34008
movsd 0x8(%rsp), %xmm3
divsd 0x10(%rsp), %xmm3
mulsd %xmm0, %xmm3
subsd %xmm3, %xmm2
jmp 0x18033
movq %r14, %rax
xorq $0x3, %rax
orq 0x78(%rsp), %rax
sete %cl
movq 0x80(%rsp), %rax
orq %r14, %rax
sete %al
movq %r14, %rdx
xorq $0x1, %rdx
orq 0x88(%rsp), %rdx
je 0x17f07
testb %cl, %cl
jne 0x17f07
testb %al, %al
jne 0x17f07
movsd (%r15), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x2b7d6(%rip), %xmm0    # 0x437e0
xorpd 0x1c0ae(%rip), %xmm0    # 0x340c0
mulsd 0x20(%rsp), %xmm0
callq 0x22d0
movsd 0x1bfe3(%rip), %xmm1    # 0x34008
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
mulsd 0x10(%rsp), %xmm2
movsd %xmm2, (%r13,%r14,8)
incq %r14
addq $0x8, %r15
cmpq $0x4, %r14
movsd 0x1bffb(%rip), %xmm0    # 0x34048
jne 0x17e16
incq %r12
addq $0x20, %r13
cmpq $0x4, %r12
jne 0x17de2
jmp 0x1808b
cmpb $0x0, 0x2a2eb(%rip)     # 0x42358
jne 0x18078
cmpb $0x1, 0x2a2e6(%rip)     # 0x4235c
jne 0x1808b
leaq 0x90(%rsp), %rdi
movapd 0x20(%rsp), %xmm0
callq 0x18152
movq 0x50(%rsp), %r14
movq %r14, %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rdi
addq $0x90, %rdi
movq 0x70(%rsp), %rbx
movq %rbx, %rsi
callq 0x16d83
movq 0x2b502(%rip), %rcx     # 0x435b8
movq 0x58(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x48(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x60(%rsp), %rdx
movl %eax, (%rcx,%rdx,4)
cmpl %r14d, %eax
movl 0x44(%rsp), %ebp
movl 0x40(%rsp), %r14d
movq 0x68(%rsp), %r15
je 0x18120
movq 0x2b4d6(%rip), %rax     # 0x435c0
movq %rdx, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rdx,8), %rcx
testl %r14d, %r14d
je 0x18100
incl 0x14(%rax,%rcx)
jmp 0x18104
incl 0x10(%rax,%rcx)
movq 0x2b4b5(%rip), %rax     # 0x435c0
movq %rdx, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rdx,8), %rcx
incl 0xc(%rax,%rcx)
incl 0x2b460(%rip)           # 0x43580
movq (%r15), %rdi
movl %r14d, %esi
movl %ebp, %edx
movq %rbx, %rcx
callq 0x17c1c
movq 0x8(%r15), %rdi
movl %r14d, %esi
movl %ebp, %edx
movq %rbx, %rcx
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17c1c