// File: /workspace/github_c_makefile_star2_O0/sc932[P]ALE/src/ALEhelpers.c
// Function: writeToOutput
void writeToOutput(assemblyT *theAssembly, int fullOut, FILE *out){
    int i, j;
    printf("Set minLogLike to: %0.1f\n", getMinLogLike());
    //printf("Writing statistics to output file.\n");
    fprintf(out, "# ALE_score: %lf\n", theAssembly->totalScore);
    fprintf(out, "# numContigs: %d\n", theAssembly->numContigs);
    fprintf(out, "# totalAssemLen: %ld\n", theAssembly->totalAssemLen);
    fprintf(out, "# placeAvg: %lf\n", theAssembly->placeAvgSum/theAssembly->placeAvgNorm);
    fprintf(out, "# insertAvg: %lf\n", theAssembly->insertAvgSum/theAssembly->insertAvgNorm);
    fprintf(out, "# kmerAvg: %lf\n", theAssembly->kmerAvgSum/theAssembly->kmerAvgNorm);
    fprintf(out, "# depthScoreAvg: %lf\n", theAssembly->depthScoreAvgSum/theAssembly->depthScoreAvgNorm);
    fprintf(out, "# depthAvg: %lf\n", theAssembly->depthAvgSum/theAssembly->depthAvgNorm);
    fprintf(out, "# totalReads: %ld\n", theAssembly->totalReads);
    fprintf(out, "# totalMappedReads: %ld\n", theAssembly->totalMappedReads);
    fprintf(out, "# totalUnmappedReads: %ld\n", theAssembly->totalUnmappedReads);
    fprintf(out, "# totalPlacedReads: %ld\n", theAssembly->totalPlacedReads);
    fprintf(out, "# readAvgLen: %lf\n", theAssembly->avgReadSize);
    fprintf(out, "# avgReadOverlap: %lf\n", theAssembly->overlapAvgSum/theAssembly->overlapAvgNorm);
    
    if(fullOut == 1){
        for(i = 0; i < theAssembly->numContigs; i++){
            contig_t *contig = theAssembly->contigs[i];
            fprintf(out, "# Reference: %s %i %lf\n# contig position depth ln(depthLike) ln(placeLike) ln(insertLike) ln(kmerLike)\n", contig->name, contig->seqLen, getContigAvgDepth(contig));
            for(j = 0; j < contig->seqLen; j++){
                fprintf(out, "%d %d %0.3f %0.3f %0.3f %0.3f %0.3f\n", i, j, contig->depth[j], contig->depthLogLikelihood[j], contig->matchLogLikelihood[j], contig->insertLogLikelihood[j], contig->kmerLogLikelihood[j]);
            }
        }
    }
    printf("Total ALE Score: %lf\n", theAssembly->totalScore);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
callq 0xbdf0
leaq 0x1cd63(%rip), %rdi     # 0x2b0d2
movb $0x1, %al
callq 0x3200
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0x10(%rax), %xmm0
leaq 0x236c1(%rip), %rsi     # 0x31a4b
movb $0x1, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %edx
leaq 0x236bb(%rip), %rsi     # 0x31a5d
movb $0x0, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x236b3(%rip), %rsi     # 0x31a6f
movb $0x0, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0x28(%rax), %xmm0
movq -0x8(%rbp), %rax
divsd 0x30(%rax), %xmm0
leaq 0x236a5(%rip), %rsi     # 0x31a85
movb $0x1, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0x38(%rax), %xmm0
movq -0x8(%rbp), %rax
divsd 0x40(%rax), %xmm0
leaq 0x23692(%rip), %rsi     # 0x31a96
movb $0x1, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x8(%rbp), %rax
divsd 0x20(%rax), %xmm0
leaq 0x23680(%rip), %rsi     # 0x31aa8
movb $0x1, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0x48(%rax), %xmm0
movq -0x8(%rbp), %rax
divsd 0x50(%rax), %xmm0
leaq 0x2366c(%rip), %rsi     # 0x31ab8
movb $0x1, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0x58(%rax), %xmm0
movq -0x8(%rbp), %rax
divsd 0x60(%rax), %xmm0
leaq 0x2365e(%rip), %rsi     # 0x31ace
movb $0x1, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdx
leaq 0x23655(%rip), %rsi     # 0x31adf
movb $0x0, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rdx
leaq 0x2364b(%rip), %rsi     # 0x31af2
movb $0x0, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdx
leaq 0x23647(%rip), %rsi     # 0x31b0b
movb $0x0, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdx
leaq 0x23645(%rip), %rsi     # 0x31b26
movb $0x0, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0x98(%rax), %xmm0
leaq 0x23640(%rip), %rsi     # 0x31b3f
movb $0x1, %al
callq 0x3350
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movsd 0x68(%rax), %xmm0
movq -0x8(%rbp), %rax
divsd 0x70(%rax), %xmm0
leaq 0x2362f(%rip), %rsi     # 0x31b52
movb $0x1, %al
callq 0x3350
cmpl $0x1, -0xc(%rbp)
jne 0xe658
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xe656
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
callq 0xdd10
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rdx
movl -0x2c(%rbp), %ecx
leaq 0x235d0(%rip), %rsi     # 0x31b69
movb $0x1, %al
callq 0x3350
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xe646
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x20(%rbp), %rsi
movss (%rax,%rsi,4), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x20(%rbp), %rsi
movss (%rax,%rsi,4), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x20(%rbp), %rsi
movss (%rax,%rsi,4), %xmm2
cvtss2sd %xmm2, %xmm2
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x20(%rbp), %rsi
movss (%rax,%rsi,4), %xmm3
cvtss2sd %xmm3, %xmm3
movq -0x28(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x20(%rbp), %rsi
movss (%rax,%rsi,4), %xmm4
cvtss2sd %xmm4, %xmm4
leaq 0x235a0(%rip), %rsi     # 0x31bd1
movb $0x5, %al
callq 0x3350
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xe5a7
jmp 0xe648
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xe53b
jmp 0xe658
movq -0x8(%rbp), %rax
movsd 0x10(%rax), %xmm0
leaq 0x2358e(%rip), %rdi     # 0x31bf6
movb $0x1, %al
callq 0x3200
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)