// File: /workspace/github_c_makefile_star2_O0/ToniWestbrook[P]paladin/uniprot.c
// Function: renderUniprotEntries
void renderUniprotEntries(UniprotList * passList, int passType, FILE * passStream) {
	int entryIdx, occurTotal;
	float occurPercent, avgQuality;
    char commonFields[] = "%d\t%.5f\t%.5f\t%d\t%s\n";

	// Count total occurrences for percentages
	for (entryIdx = 0, occurTotal = 0 ; entryIdx < passList->entryCount ; entryIdx++) {
		occurTotal += passList->entries[entryIdx].numOccurrence;
	}

	// Render fields
	for (entryIdx = 0 ; entryIdx < passList->entryCount ; entryIdx++) {
		occurPercent = (float) passList->entries[entryIdx].numOccurrence / (float) occurTotal * 100;
		avgQuality = (float) passList->entries[entryIdx].totalQuality / (float) passList->entries[entryIdx].numOccurrence;

		switch(passType) {
		    case UNIPROT_LIST_FULL:
		    	fprintf(passStream, commonFields, passList->entries[entryIdx].numOccurrence, occurPercent, avgQuality, passList->entries[entryIdx].maxQuality,  passList->entries[entryIdx].id);
		    	break;
		    case UNIPROT_LIST_GENES:
			    fprintf(passStream, commonFields, passList->entries[entryIdx].numOccurrence, occurPercent, avgQuality, passList->entries[entryIdx].maxQuality, passList->entries[entryIdx].gene);
			    break;
		    case UNIPROT_LIST_ORGANISM:
			    fprintf(passStream, commonFields, passList->entries[entryIdx].numOccurrence, occurPercent, avgQuality, passList->entries[entryIdx].maxQuality, passList->entries[entryIdx].organism);
			    break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq 0x2cc76(%rip), %rax     # 0x397c0
movq %rax, -0x40(%rbp)
movq 0x2cc73(%rip), %rax     # 0x397c8
movq %rax, -0x38(%rbp)
movl 0x2cc71(%rip), %eax     # 0x397d0
movl %eax, -0x30(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xcba2
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xcb70
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xcd6c
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
cvtsi2ssl 0x18(%rax,%rcx,8), %xmm0
cvtsi2ssl -0x20(%rbp), %xmm1
divss %xmm1, %xmm0
movss 0x2c56d(%rip), %xmm1    # 0x3914c
mulss %xmm1, %xmm0
movss %xmm0, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
cvtsi2ssl 0x1c(%rax,%rcx,8), %xmm0
cvtsi2ssl 0x18(%rax,%rcx,8), %xmm1
divss %xmm1, %xmm0
movss %xmm0, -0x28(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x44(%rbp)
testl %eax, %eax
je 0xcc33
jmp 0xcc18
movl -0x44(%rbp), %eax
subl $0x1, %eax
je 0xcc98
jmp 0xcc22
movl -0x44(%rbp), %eax
subl $0x2, %eax
je 0xccfb
jmp 0xcd5c
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
movss -0x24(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x28(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %r8
imulq $0x28, %r8, %r8
addq %r8, %rax
movq (%rax), %r8
movb $0x2, %al
callq 0x34e0
jmp 0xcd5c
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
movss -0x24(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x28(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %r8
imulq $0x28, %r8, %r8
addq %r8, %rax
movq 0x8(%rax), %r8
movb $0x2, %al
callq 0x34e0
jmp 0xcd5c
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
movss -0x24(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x28(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %r8
imulq $0x28, %r8, %r8
addq %r8, %rax
movq 0x10(%rax), %r8
movb $0x2, %al
callq 0x34e0
jmp 0xcd5e
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xcba9
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)