// File: /workspace/github_c_makefile_star2_O2/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, %rbp
movq %rdi, %r13
movq %rsi, 0x8(%rsp)
testq %r13, %r13
je 0x10dff
movslq 0x1c(%r13), %r15
cmpl $0x1, 0x1f6ee(%rip)     # 0x301f4
jne 0x10b9f
cmpl $0x1, 0x24(%r13)
jne 0x10bdd
cmpb $0x1, 0x1f86a(%rip)     # 0x30388
jne 0x10c33
pushq $0x1b
popq %rbx
xorl %r14d, %r14d
movslq 0x1f677(%rip), %rax     # 0x301a8
cmpq %rax, %r14
jge 0x10dea
movq 0x20bbf(%rip), %rax     # 0x31700
movsbl (%rax,%r14), %edi
callq 0x1386a
movq 0x20a66(%rip), %rcx     # 0x315b8
movq (%rcx), %rcx
movq (%rcx,%r15,8), %rcx
movl %eax, (%rcx,%r14,4)
movq 0x20b94(%rip), %rax     # 0x316f8
movsbl (%rax,%r14), %edi
callq 0x1386a
movq 0x20a43(%rip), %rcx     # 0x315b8
movq 0x8(%rcx), %rdx
movq (%rdx,%r15,8), %rdx
movl %eax, (%rdx,%r14,4)
movq (%rcx), %rax
movq (%rax,%r15,8), %rax
movl (%rax,%r14,4), %eax
movq 0x20a2d(%rip), %rcx     # 0x315c0
movl %eax, (%rcx,%rbx,4)
incq %r14
addq $0x22, %rbx
jmp 0x10b2a
movl 0x1f603(%rip), %eax     # 0x301a8
movq 0x20a0c(%rip), %rcx     # 0x315b8
testl %eax, %eax
movl $0x0, %edx
cmovlel %edx, %eax
xorl %edx, %edx
cmpq %rdx, %rax
je 0x10dea
movq 0x8(%rcx), %rsi
movq (%rsi,%r15,8), %rsi
andl $0x0, (%rsi,%rdx,4)
movq (%rcx), %rsi
movq (%rsi,%r15,8), %rsi
andl $0x0, (%rsi,%rdx,4)
incq %rdx
jmp 0x10bb8
movq 0x10(%r13), %rax
movslq 0x1c(%rax), %rax
movl 0x1f5bd(%rip), %ecx     # 0x301a8
movq 0x209c6(%rip), %rdx     # 0x315b8
testl %ecx, %ecx
movl $0x0, %esi
cmovlel %esi, %ecx
xorl %esi, %esi
cmpq %rsi, %rcx
je 0x10dea
movq (%rdx), %rdi
movq (%rdi,%rax,8), %r8
movl (%r8,%rsi,4), %r8d
movq (%rdi,%r15,8), %rdi
movl %r8d, (%rdi,%rsi,4)
movq 0x8(%rdx), %rdi
movq (%rdi,%rax,8), %r8
movl (%r8,%rsi,4), %r8d
movq (%rdi,%r15,8), %rdi
movl %r8d, (%rdi,%rsi,4)
incq %rsi
jmp 0x10bfe
cmpb $0x0, 0x1f792(%rip)     # 0x303cc
je 0x10d61
movq %r13, 0x10(%rsp)
pushq $0x4
popq %rdi
pushq $0x8
popq %rsi
callq 0x21a0
testq %rax, %rax
je 0x10e0e
movq %rax, %r13
leaq 0x2151d(%rip), %rax     # 0x32180
movq (%rax), %rdi
movq %rbp, %rsi
callq 0x138c8
cltd
pushq $0x10
popq %rcx
idivl %ecx
movl %eax, %ecx
movsbl %dl, %eax
movb $0x4, %dl
idivb %dl
movsbl %ah, %ebx
movsbl %al, %edx
movq 0x20936(%rip), %rax     # 0x315c0
movl %ecx, 0x6c(%rax)
movq 0x20924(%rip), %rbp     # 0x315b8
movq 0x8(%rbp), %rsi
movq (%rsi,%r15,8), %rsi
movl %ecx, (%rsi)
movq (%rbp), %rdi
movq (%rdi,%r15,8), %rdi
movl %ecx, (%rdi)
movl %edx, 0xf4(%rax)
movl %edx, 0x4(%rsi)
movl %edx, 0x4(%rdi)
movl %ebx, 0x17c(%rax)
movl %ebx, 0x8(%rsi)
movl %ebx, 0x8(%rdi)
movslq 0x1f4e1(%rip), %r12     # 0x301a8
pushq $0x3
popq %r14
cmpq %r12, %r14
jge 0x10dd8
leaq 0x214a5(%rip), %rax     # 0x32180
movq (%rax), %rax
shll $0x4, %edx
leal (%rdx,%rbx,4), %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,8), %rax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x10d01
addsd (%rax,%rcx,8), %xmm0
incq %rcx
jmp 0x10cf1
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x10d1e
movsd (%rax,%rcx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%r13,%rcx,8)
incq %rcx
jmp 0x10d03
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x138c8
movl %ebx, %edx
movq 0x2088c(%rip), %rcx     # 0x315c0
imulq $0x88, %r14, %rsi
movl %eax, 0x6c(%rcx,%rsi)
movq 0x8(%rbp), %rcx
movq (%rcx,%r15,8), %rcx
movl %eax, (%rcx,%r14,4)
movq (%rbp), %rcx
movq (%rcx,%r15,8), %rcx
movl %eax, (%rcx,%r14,4)
incq %r14
movl %eax, %ebx
jmp 0x10ccb
movl 0x1f441(%rip), %ebx     # 0x301a8
movq 0x2084a(%rip), %r14     # 0x315b8
testl %ebx, %ebx
movl $0x0, %eax
cmovlel %eax, %ebx
xorl %r12d, %r12d
cmpq %rbx, %r12
je 0x10dea
movq %rbp, %rdi
callq 0x10279
leaq 0x1f811(%rip), %rcx     # 0x305a0
xorl %eax, %eax
cmpq $0x4, %rax
je 0x10dd3
movsd (%rcx), %xmm1
ucomisd %xmm0, %xmm1
jae 0x10daa
incq %rax
addq $0x8, %rcx
jmp 0x10d91
movq 0x8(%r14), %rcx
movq (%rcx,%r15,8), %rcx
movl %eax, (%rcx,%r12,4)
movq (%r14), %rcx
movq (%rcx,%r15,8), %rcx
movl %eax, (%rcx,%r12,4)
movq 0x207f8(%rip), %rcx     # 0x315c0
imulq $0x88, %r12, %rdx
movl %eax, 0x6c(%rcx,%rdx)
incq %r12
jmp 0x10d7b
movq %r13, %rdi
callq 0x2030
movq 0x8(%rsp), %rbp
movq 0x10(%rsp), %r13
movq (%r13), %rdi
movq %rbp, %rsi
callq 0x10ad9
movq 0x8(%r13), %r13
jmp 0x10af2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1f1e3(%rip), %rax     # 0x2fff8
movq (%rax), %rcx
leaq 0x1039b(%rip), %rdi     # 0x211ba
pushq $0x24
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
pushq $-0x1
popq %rdi
callq 0x22a0