// File: /workspace/github_c_makefile_star2_O0/dapogon[P]cellcoal/src/cellcoal.c
// Function: CountAllelesInMLGenotypes
int CountAllelesInMLGenotypes(void)
	{
	int		numAltAllelesInCalls, i, j;
	int		countA, countC, countG, countT, countN, nSNVs;
	
	nSNVs = 0;
	
	for (j=0; j<numSites; j++)
		{
		countA = countC = countG = countT = countN = 0;
		for (i=0; i<numCells+1; i++)
			{
			if (cell[i].site[j].MLmatAllele == A)
				countA++;
			else if (cell[i].site[j].MLmatAllele == C)
				countC++;
			else if (cell[i].site[j].MLmatAllele == G)
				countG++;
			else if (cell[i].site[j].MLmatAllele == T)
				countT++;
			else
				countN++;

			if (cell[i].site[j].MLpatAllele == A)
				countA++;
			else if (cell[i].site[j].MLpatAllele == C)
				countC++;
			else if (cell[i].site[j].MLpatAllele == G)
				countG++;
			else if (cell[i].site[j].MLpatAllele == T)
				countT++;
			else
				countN++;
			}
		
		/* keep counts on ML genotypes */
		allSites[j].countA = countA;
		allSites[j].countC = countC;
		allSites[j].countG = countG;
		allSites[j].countT = countT;
		allSites[j].countN = countN;
		allSites[j].countACGT = countA + countC + countG + countT;
		allSites[j].countCellswithData = allSites[j].countACGT / 2.0;

		/* count number of alternate alleles in reads that appear in the ML genotypes */
		numAltAllelesInCalls = 0;
		if (countA > 0 && allSites[j].referenceAllele != A)
			numAltAllelesInCalls++;
		if (countC > 0 && allSites[j].referenceAllele != C)
			numAltAllelesInCalls++;
		if (countG > 0 && allSites[j].referenceAllele != G)
			numAltAllelesInCalls++;
		if (countT > 0 && allSites[j].referenceAllele != T)
			numAltAllelesInCalls++;
		
		/* find out whether this site is a SNV */
		if (numAltAllelesInCalls > 0)
			{
			allSites[j].isSNV = YES;
			SNVsites[nSNVs++] = j;
			}
		}
	return nSNVs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x0, -0x24(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x3cd91(%rip), %eax     # 0x4e1dc
jge 0x11833
movl $0x0, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl 0x3cd50(%rip), %ecx     # 0x4e1d4
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1164b
movq 0x3e382(%rip), %rax     # 0x4f818
movslq -0x8(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
cmpl $0x0, 0x48(%rax)
jne 0x114c3
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x11565
movq 0x3e34e(%rip), %rax     # 0x4f818
movslq -0x8(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
cmpl $0x1, 0x48(%rax)
jne 0x114f4
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x11563
movq 0x3e31d(%rip), %rax     # 0x4f818
movslq -0x8(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
cmpl $0x2, 0x48(%rax)
jne 0x11525
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x11561
movq 0x3e2ec(%rip), %rax     # 0x4f818
movslq -0x8(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
cmpl $0x3, 0x48(%rax)
jne 0x11556
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1155f
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x11561
jmp 0x11563
jmp 0x11565
movq 0x3e2ac(%rip), %rax     # 0x4f818
movslq -0x8(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4c(%rax)
jne 0x11599
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1163b
movq 0x3e278(%rip), %rax     # 0x4f818
movslq -0x8(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
cmpl $0x1, 0x4c(%rax)
jne 0x115ca
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x11639
movq 0x3e247(%rip), %rax     # 0x4f818
movslq -0x8(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
cmpl $0x2, 0x4c(%rax)
jne 0x115fb
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x11637
movq 0x3e216(%rip), %rax     # 0x4f818
movslq -0x8(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
cmpl $0x3, 0x4c(%rax)
jne 0x1162c
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x11635
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x11637
jmp 0x11639
jmp 0x1163b
jmp 0x1163d
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x1147b
movl -0x10(%rbp), %ecx
movq 0x3e153(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x38(%rax)
movl -0x14(%rbp), %ecx
movq 0x3e138(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x3c(%rax)
movl -0x18(%rbp), %ecx
movq 0x3e11d(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x40(%rax)
movl -0x1c(%rbp), %ecx
movq 0x3e102(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x44(%rax)
movl -0x20(%rbp), %ecx
movq 0x3e0e7(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x48(%rax)
movl -0x10(%rbp), %ecx
addl -0x14(%rbp), %ecx
addl -0x18(%rbp), %ecx
addl -0x1c(%rbp), %ecx
movq 0x3e0c3(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4c(%rax)
movq 0x3e0ab(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cvtsi2sdl 0x4c(%rax), %xmm0
movsd 0x2d930(%rip), %xmm1    # 0x3f048
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movq 0x3e081(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x64(%rax)
movl $0x0, -0x4(%rbp)
cmpl $0x0, -0x10(%rbp)
jle 0x11769
movq 0x3e05c(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x6c(%rax)
je 0x11769
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0x11793
movq 0x3e032(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, 0x6c(%rax)
je 0x11793
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x18(%rbp)
jle 0x117bd
movq 0x3e008(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, 0x6c(%rax)
je 0x117bd
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x117e7
movq 0x3dfde(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cmpl $0x3, 0x6c(%rax)
je 0x117e7
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jle 0x11823
movq 0x3dfb4(%rip), %rax     # 0x4f7a8
movslq -0xc(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movl $0x1, (%rax)
movl -0xc(%rbp), %edx
movq 0x3df9e(%rip), %rax     # 0x4f7b0
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x11825
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x11442
movl -0x24(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)