// File: /workspace/github_c_makefile_star2_O0/dapogon[P]cellcoal/src/cellcoal.c
// Function: SimulateCNLOHforSite
void SimulateCNLOHforSite (TreeNode *p, int genome, int site, long int *seed)
    {
    static double	cumCNLOHbranchLength, uniform;
    int             cell, anccell;
		
	if (p != NULL)
        {
        cell = p->label;
			
        if (p->isHealthyRoot == YES)
            {
            cumCNLOHbranchLength = 0;
            uniform = RandomUniform(seed) * totalTreeLength / mutationRate * CNLOHrate;;
            }
        else
            {
            anccell = p->anc->label;
            cumCNLOHbranchLength += p->branchLength / mutationRate * CNLOHrate;
				
             if ((cumCNLOHbranchLength < uniform) || /* => there will be no change at this branch */
                ((genome == MATERNAL) && (allSites[site].numCNLOHmaternal > 0)) ||
                ((genome == PATERNAL) && (allSites[site].numCNLOHpaternal > 0)))
                {
                data[genome][cell][site] = data[genome][anccell][site];
                }
			else /* => there will be a CN_LOH event */
                {
				if (genome == MATERNAL)
					{
					data[genome][cell][site] = data[PATERNAL][cell][site];
					allSites[site].numCNLOHmaternal++;
					}
				else
					{
					data[genome][cell][site] = data[MATERNAL][cell][site];
					allSites[site].numCNLOHpaternal++;
					}

                allSites[site].numCNLOH++;
                numCNLOH++;
                }
            }
            SimulateCNLOHforSite (p->left, genome, site, seed);
            SimulateCNLOHforSite (p->right, genome, site, seed);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1cef5
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x24(%rax)
jne 0x1cd0e
xorps %xmm0, %xmm0
movsd %xmm0, 0x33580(%rip)    # 0x50260
movq -0x18(%rbp), %rdi
callq 0xa500
mulsd 0x32a97(%rip), %xmm0    # 0x4f788
divsd 0x3150f(%rip), %xmm0    # 0x4e208
mulsd 0x32adf(%rip), %xmm0    # 0x4f7e0
movsd %xmm0, 0x3355f(%rip)    # 0x50268
jmp 0x1cec8
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movsd 0x40(%rax), %xmm0
divsd 0x314db(%rip), %xmm0    # 0x4e208
movsd 0x32aab(%rip), %xmm2    # 0x4f7e0
movsd 0x33523(%rip), %xmm1    # 0x50260
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x33513(%rip)    # 0x50260
movsd 0x3350b(%rip), %xmm1    # 0x50260
movsd 0x3350b(%rip), %xmm0    # 0x50268
ucomisd %xmm1, %xmm0
ja 0x1cda5
cmpl $0x0, -0xc(%rbp)
jne 0x1cd84
movq 0x32a38(%rip), %rax     # 0x4f7a8
movslq -0x10(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x28(%rax)
jg 0x1cda5
cmpl $0x1, -0xc(%rbp)
jne 0x1cde6
movq 0x32a17(%rip), %rax     # 0x4f7a8
movslq -0x10(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x2c(%rax)
jle 0x1cde6
movq 0x329f4(%rip), %rax     # 0x4f7a0
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x329d6(%rip), %rax     # 0x4f7a0
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1cec6
cmpl $0x0, -0xc(%rbp)
jne 0x1ce44
movq 0x329ad(%rip), %rax     # 0x4f7a0
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x32993(%rip), %rax     # 0x4f7a0
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x3297d(%rip), %rax     # 0x4f7a8
movslq -0x10(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
jmp 0x1ce99
movq 0x32955(%rip), %rax     # 0x4f7a0
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x3293c(%rip), %rax     # 0x4f7a0
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x10(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x32926(%rip), %rax     # 0x4f7a8
movslq -0x10(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movl 0x2c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2c(%rax)
movq 0x32908(%rip), %rax     # 0x4f7a8
movslq -0x10(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movl 0x24(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x24(%rax)
movl 0x3289f(%rip), %eax     # 0x4f75c
addl $0x1, %eax
movl %eax, 0x32896(%rip)     # 0x4f75c
jmp 0x1cec8
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movq -0x18(%rbp), %rcx
callq 0x1cca0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movq -0x18(%rbp), %rcx
callq 0x1cca0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)