// File: /workspace/github_c_makefile_star2_O3/dapogon[P]cellcoal/src/cellcoal.c
// Function: InitializeGenomes
void InitializeGenomes (TreeNode *p, long int *seed)
    {
    int     i, cell, anccell, site;
    double  ran;
		
    if (p != NULL)
        {
        cell = p->label;
        if (alphabet == DNA)
            {
            if (p->isHealthyRoot == YES)
                {
				if (doUserGenome == YES)
					{
					for (site=0; site<numSites; site++) /* initialize genome with the user provided sequences */
						{
						data[MATERNAL][cell][site] = WhichNucChar(maternalUserGenome[site]);
						data[PATERNAL][cell][site] = WhichNucChar(paternalUserGenome[site]);
						allSites[site].referenceAllele = data[MATERNAL][cell][site];   // then allSites[site].referenceAllele hosts the reference genome
						}
					}
  				else if (doGeneticSignatures == NO) /* initialize genome with mononucleotide frequencies */
					{
					for (site=0; site<numSites; site++)
						{
						ran = RandomUniform(seed);
						for (i=0; i<4; i++)
							{
							if (ran <= cumfreq[i])
								{
								allSites[site].referenceAllele = data[MATERNAL][cell][site] = data[PATERNAL][cell][site] = i;
								// then allSites[site].referenceAllele hosts the reference genome
								break;
								}
							}
						}
					}
				else /* initialize genome with trinucleotide frequencies */
					{
					SimulateTriNucFreqGenome (cell, seed);
					}
				}
            else
                {
                anccell = p->anc->label;
                for (site=0; site<numSites; site++)
                    {
                    data[MATERNAL][cell][site] = data[MATERNAL][anccell][site];
                    data[PATERNAL][cell][site] = data[PATERNAL][anccell][site];
                    }
                }
             }
        else /* binary alphabet */
            for (site=0; site<numSites; site++)
                data[MATERNAL][cell][site] = data[PATERNAL][cell][site] = 0;

        InitializeGenomes (p->left, seed);
        InitializeGenomes (p->right, seed);
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x14063
movq %rsi, %r13
movq %rdi, %r14
xorl %r12d, %r12d
movq %rsi, (%rsp)
movslq 0x1c(%r14), %rbp
cmpl $0x1, 0x2252c(%rip)     # 0x361f4
jne 0x13d6f
cmpl $0x1, 0x24(%r14)
jne 0x13dac
cmpb $0x1, 0x226a8(%rip)     # 0x36388
jne 0x13e02
cmpl $0x0, 0x224bb(%rip)     # 0x361a8
jle 0x1404b
movl $0x1b, %ebx
xorl %r15d, %r15d
movq 0x239fe(%rip), %rax     # 0x37700
movsbl (%rax,%r15), %edi
callq 0x16ff4
movq 0x238a5(%rip), %rcx     # 0x375b8
movq (%rcx), %rcx
movq (%rcx,%rbp,8), %rcx
movl %eax, (%rcx,%r15,4)
movq 0x239d3(%rip), %rax     # 0x376f8
movsbl (%rax,%r15), %edi
callq 0x16ff4
movq 0x23882(%rip), %rcx     # 0x375b8
movq 0x8(%rcx), %rdx
movq (%rdx,%rbp,8), %rdx
movl %eax, (%rdx,%r15,4)
movq (%rcx), %rax
movq (%rax,%rbp,8), %rax
movl (%rax,%r15,4), %eax
movq 0x2386c(%rip), %rcx     # 0x375c0
movl %eax, (%rcx,%rbx,4)
incq %r15
movslq 0x22447(%rip), %rax     # 0x361a8
addq $0x22, %rbx
cmpq %rax, %r15
jl 0x13cfb
jmp 0x1404b
movslq 0x22432(%rip), %rax     # 0x361a8
testq %rax, %rax
jle 0x1404b
movq 0x23832(%rip), %rcx     # 0x375b8
movq (%rcx), %rdx
movq 0x8(%rcx), %rcx
movq (%rcx,%rbp,8), %rcx
movq (%rdx,%rbp,8), %rdx
xorl %esi, %esi
movl %r12d, (%rcx,%rsi,4)
movl %r12d, (%rdx,%rsi,4)
incq %rsi
cmpq %rsi, %rax
jne 0x13d97
jmp 0x1404b
movslq 0x223f5(%rip), %rax     # 0x361a8
testq %rax, %rax
jle 0x1404b
movq 0x10(%r14), %rcx
movslq 0x1c(%rcx), %rsi
movq 0x237ed(%rip), %rcx     # 0x375b8
movq (%rcx), %rdx
movq 0x8(%rcx), %rdi
movq (%rdx,%rsi,8), %rcx
movq (%rdx,%rbp,8), %rdx
movq (%rdi,%rsi,8), %rsi
movq (%rdi,%rbp,8), %rdi
xorl %r8d, %r8d
movl (%rcx,%r8,4), %r9d
movl %r9d, (%rdx,%r8,4)
movl (%rsi,%r8,4), %r9d
movl %r9d, (%rdi,%r8,4)
incq %r8
cmpq %r8, %rax
jne 0x13de5
jmp 0x1404b
cmpb $0x0, 0x225c3(%rip)     # 0x363cc
je 0x13f74
movl $0x4, %edi
movl $0x8, %esi
callq 0x21a0
testq %rax, %rax
je 0x14072
movq %rax, %r15
leaq 0x2434f(%rip), %rax     # 0x38180
movq (%rax), %rdi
movq %r13, %rsi
callq 0x17041
leal 0xf(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
movl %ecx, %edx
sarl $0x4, %edx
andl $-0x10, %ecx
subl %ecx, %eax
movl %eax, %ecx
sarb $0x7, %cl
shrb $0x6, %cl
addb %al, %cl
movl %ecx, %esi
sarb $0x2, %sil
movsbl %sil, %r13d
andb $-0x4, %cl
subb %cl, %al
movsbl %al, %eax
movq 0x2374f(%rip), %rcx     # 0x375c0
movl %edx, 0x6c(%rcx)
movq 0x2373d(%rip), %rdi     # 0x375b8
movq 0x8(%rdi), %rsi
movq (%rsi,%rbp,8), %rsi
movl %edx, (%rsi)
movq %rdi, 0x10(%rsp)
movq (%rdi), %rdi
movq (%rdi,%rbp,8), %rdi
movl %edx, (%rdi)
movl %r13d, 0xf4(%rcx)
movl %r13d, 0x4(%rsi)
movl %r13d, 0x4(%rdi)
movl %eax, 0x17c(%rcx)
movl %eax, 0x8(%rsi)
movl %eax, 0x8(%rdi)
movslq 0x222f3(%rip), %rcx     # 0x361a8
movq %rcx, 0x8(%rsp)
cmpq $0x4, %rcx
jl 0x13f63
movl $0x3, %ebx
movl %r13d, %ecx
movl %eax, %r13d
shll $0x4, %ecx
leal (%rcx,%r13,4), %eax
cltq
shlq $0x3, %rax
leaq 0x2429d(%rip), %rcx     # 0x38180
addq (%rcx), %rax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
addsd (%rax,%rcx,8), %xmm0
incq %rcx
cmpq $0x4, %rcx
jne 0x13eec
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
xorl %ecx, %ecx
movupd (%rax,%rcx,8), %xmm1
divpd %xmm0, %xmm1
movupd %xmm1, (%r15,%rcx,8)
addq $0x2, %rcx
cmpq $0x4, %rcx
jne 0x13f00
movq %r15, %rdi
movq (%rsp), %rsi
callq 0x17041
movq 0x23694(%rip), %rcx     # 0x375c0
movq %rbx, %rdx
shlq $0x7, %rdx
leaq (%rdx,%rbx,8), %rdx
movl %eax, 0x6c(%rcx,%rdx)
movq 0x10(%rsp), %rdx
movq 0x8(%rdx), %rcx
movq (%rcx,%rbp,8), %rcx
movl %eax, (%rcx,%rbx,4)
movq (%rdx), %rcx
movq (%rcx,%rbp,8), %rcx
movl %eax, (%rcx,%rbx,4)
incq %rbx
cmpq 0x8(%rsp), %rbx
jne 0x13ec9
movq %r15, %rdi
callq 0x2030
movq (%rsp), %r13
jmp 0x1404b
movslq 0x2222d(%rip), %rsi     # 0x361a8
testq %rsi, %rsi
jle 0x1404b
movq 0x2362d(%rip), %rdi     # 0x375b8
movq 0x2362e(%rip), %r8      # 0x375c0
movq (%r13), %rcx
xorl %r9d, %r9d
movq %rcx, %rax
movabsq $0x41a705af1fe3fb79, %rdx # imm = 0x41A705AF1FE3FB79
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0xf, %rdx
addq %rax, %rdx
imulq $0x1f31d, %rdx, %rax    # imm = 0x1F31D
subq %rax, %rcx
imulq $0x41a7, %rcx, %rax     # imm = 0x41A7
imulq $-0xb14, %rdx, %rcx     # imm = 0xF4EC
leaq (%rcx,%rax), %rdx
testq %rdx, %rdx
leaq 0x7fffffff(%rcx,%rax), %rcx
cmovgq %rdx, %rcx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
divsd 0xf12e(%rip), %xmm0     # 0x23120
leaq 0x225a7(%rip), %rdx     # 0x365a0
xorl %eax, %eax
movsd (%rdx), %xmm1
ucomisd %xmm0, %xmm1
jae 0x14014
incq %rax
addq $0x8, %rdx
cmpq $0x4, %rax
jne 0x13ffb
jmp 0x1403b
movq 0x8(%rdi), %rdx
movq (%rdx,%rbp,8), %rdx
movl %eax, (%rdx,%r9,4)
movq (%rdi), %rdx
movq (%rdx,%rbp,8), %rdx
movl %eax, (%rdx,%r9,4)
movq %r9, %rdx
shlq $0x7, %rdx
leaq (%rdx,%r9,8), %rdx
movl %eax, 0x6c(%r8,%rdx)
incq %r9
cmpq %rsi, %r9
jne 0x13f99
movq %rcx, (%r13)
movq (%r14), %rdi
movq %r13, %rsi
callq 0x13c99
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0x13cbd
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x503e