// File: /workspace/github_c_makefile_star2_O1/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
movq %rsi, %r13
movq %rdi, %r15
xorl %r12d, %r12d
movq %rsi, (%rsp)
testq %r15, %r15
je 0x13ed9
movslq 0x1c(%r15), %rbp
cmpl $0x1, 0x2e6ae(%rip)     # 0x421f4
jne 0x13bed
cmpl $0x1, 0x24(%r15)
jne 0x13c2a
cmpb $0x1, 0x2e82a(%rip)     # 0x42388
jne 0x13c80
cmpl $0x0, 0x2e63d(%rip)     # 0x421a8
jle 0x13ec5
movl $0x1b, %ebx
xorl %r14d, %r14d
movq 0x2fb80(%rip), %rax     # 0x43700
movsbl (%rax,%r14), %edi
callq 0x16d36
movq 0x2fa27(%rip), %rcx     # 0x435b8
movq (%rcx), %rcx
movq (%rcx,%rbp,8), %rcx
movl %eax, (%rcx,%r14,4)
movq 0x2fb55(%rip), %rax     # 0x436f8
movsbl (%rax,%r14), %edi
callq 0x16d36
movq 0x2fa04(%rip), %rcx     # 0x435b8
movq 0x8(%rcx), %rdx
movq (%rdx,%rbp,8), %rdx
movl %eax, (%rdx,%r14,4)
movq (%rcx), %rax
movq (%rax,%rbp,8), %rax
movl (%rax,%r14,4), %eax
movq 0x2f9ee(%rip), %rcx     # 0x435c0
movl %eax, (%rcx,%rbx,4)
incq %r14
movslq 0x2e5c9(%rip), %rax     # 0x421a8
addq $0x22, %rbx
cmpq %rax, %r14
jl 0x13b79
jmp 0x13ec5
movslq 0x2e5b4(%rip), %rax     # 0x421a8
testq %rax, %rax
jle 0x13ec5
movq 0x2f9b4(%rip), %rcx     # 0x435b8
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 0x13c15
jmp 0x13ec5
movslq 0x2e577(%rip), %rax     # 0x421a8
testq %rax, %rax
jle 0x13ec5
movq 0x10(%r15), %rcx
movslq 0x1c(%rcx), %rsi
movq 0x2f96f(%rip), %rcx     # 0x435b8
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 0x13c63
jmp 0x13ec5
cmpb $0x0, 0x2e745(%rip)     # 0x423cc
je 0x13dee
movq %r15, 0x8(%rsp)
movl $0x4, %edi
movl $0x8, %esi
callq 0x21a0
testq %rax, %rax
je 0x13ee8
movq %rax, %r15
leaq 0x304cc(%rip), %rax     # 0x44180
movq (%rax), %rdi
movq %r13, %rsi
callq 0x16d83
movl %eax, %ecx
leal 0xf(%rcx), %edx
testl %eax, %eax
cmovnsl %eax, %edx
movl %edx, %esi
sarl $0x4, %esi
andl $-0x10, %edx
subl %edx, %eax
negl %edx
addl %edx, %ecx
addl $0x3, %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
movl %ecx, %r13d
sarl $0x2, %r13d
andl $-0x4, %ecx
subl %ecx, %eax
movq 0x2f8ce(%rip), %rcx     # 0x435c0
movl %esi, 0x6c(%rcx)
movq 0x2f8bc(%rip), %rbx     # 0x435b8
movq 0x8(%rbx), %rdx
movq (%rdx,%rbp,8), %rdx
movl %esi, (%rdx)
movq (%rbx), %rdi
movq (%rdi,%rbp,8), %rdi
movl %esi, (%rdi)
movl %r13d, 0xf4(%rcx)
movl %r13d, 0x4(%rdx)
movl %r13d, 0x4(%rdi)
movl %eax, 0x17c(%rcx)
movl %eax, 0x8(%rdx)
movl %eax, 0x8(%rdi)
movslq 0x2e477(%rip), %rcx     # 0x421a8
movq %rcx, 0x10(%rsp)
cmpq $0x4, %rcx
jl 0x13dd8
movl $0x3, %r14d
movl %r13d, %ecx
movl %eax, %r13d
shll $0x4, %ecx
leal (%rcx,%r13,4), %eax
cltq
shlq $0x3, %rax
leaq 0x30420(%rip), %rcx     # 0x44180
addq (%rcx), %rax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
addsd (%rax,%rcx,8), %xmm0
incq %rcx
cmpq $0x4, %rcx
jne 0x13d69
xorl %ecx, %ecx
movsd (%rax,%rcx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%r15,%rcx,8)
incq %rcx
cmpq $0x4, %rcx
jne 0x13d79
movq %r15, %rdi
movq (%rsp), %rsi
callq 0x16d83
movq 0x2f81c(%rip), %rcx     # 0x435c0
movq %r14, %rdx
shlq $0x7, %rdx
leaq (%rdx,%r14,8), %rdx
movl %eax, 0x6c(%rcx,%rdx)
movq 0x8(%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
movl %eax, (%rcx,%r14,4)
movq (%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
movl %eax, (%rcx,%r14,4)
incq %r14
cmpq 0x10(%rsp), %r14
jne 0x13d46
movq %r15, %rdi
callq 0x2030
movq (%rsp), %r13
movq 0x8(%rsp), %r15
jmp 0x13ec5
movslq 0x2e3b3(%rip), %rsi     # 0x421a8
testq %rsi, %rsi
jle 0x13ec5
movq 0x2f7b3(%rip), %rdi     # 0x435b8
movq 0x2f7b4(%rip), %r8      # 0x435c0
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 0x201bc(%rip), %xmm0    # 0x34028
leaq 0x2e72d(%rip), %rdx     # 0x425a0
xorl %eax, %eax
movsd (%rdx), %xmm1
ucomisd %xmm0, %xmm1
jae 0x13e8e
incq %rax
addq $0x8, %rdx
cmpq $0x4, %rax
jne 0x13e75
jmp 0x13eb5
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 0x13e13
movq %rcx, (%r13)
movq (%r15), %rdi
movq %r13, %rsi
callq 0x13b17
movq 0x8(%r15), %r15
jmp 0x13b32
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x5035