// File: /workspace/github_c_makefile_star2_O3/annoroad[P]fqtools_plus/fqtools.c
// Function: outreport
local void outreport(unsigned int (*base)[5], unsigned int (*quality)[50],  const char* outfile){
	FILE* fp=fopen(outfile,"w");
	fprintf(fp,"#\tA\tT\tC\tG\tN");
	int m,n;
	long long total_base = (long long)allstat.clean_reads * g.CUT;
	unsigned int q30=0;
	unsigned int q20=0;
	unsigned int N=0;
	unsigned int GC=0;

	float GC_bias=0;
	float AT_bias=0;
	float cur_GC_bias=0;
	float cur_AT_bias=0;

	for (m=0;m<42;m++){
		fprintf(fp,"\t%d",m);
	}
	fprintf(fp,"\n");
	for (n=0;n<g.CUT;n++){
		GC += base[n][2] + base[n][3];
		N += base[n][4];
		fprintf(fp,"%d\t%u\t%u\t%u\t%u\t%u",n+1,base[n][0],base[n][1],base[n][2],base[n][3],base[n][4]);
		cur_AT_bias=1.0 * abs(base[n][0] - base[n][1])/allstat.clean_reads;
		cur_GC_bias=1.0 * abs(base[n][2] - base[n][3])/allstat.clean_reads;
		if (cur_AT_bias > AT_bias){
			AT_bias = cur_AT_bias;
		}
		if (cur_GC_bias > GC_bias){
			GC_bias = cur_GC_bias;
		}
		for (m=0;m<42;m++){
			fprintf(fp,"\t%d",quality[n][m]);
			if (m >= 20){
				q20 += quality[n][m];
			}
			if (m >= 30){
				q30 += quality[n][m];
			}
		}	
		fprintf(fp,"\n");
	}
	fprintf(fp, "#total_reads\t%d\n",allstat.clean_reads);
	fprintf(fp, "#total_base\t%lld\n", total_base);
	fprintf(fp, "#GC_bias(%%)\t%.3f\n",(float)100.0*GC_bias);
	fprintf(fp, "#AT_bias(%%)\t%.3f\n",(float)100.0*AT_bias);
	fprintf(fp, "#N_percent(%%)\t%.3f\n",(float)100.0*(long long)N/total_base);
	fprintf(fp, "#Q20(%%)\t%.3f\n",(float)100.0*(long long)q20/total_base);
	fprintf(fp, "#Q30(%%)\t%.3f\n",(float)100.0*(long long)q30/total_base);
	fprintf(fp, "#GC_percent(%%)\t%.3f\n",(float)100.0*(long long)GC/total_base);
	fclose(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r15
movq %rdi, %r12
leaq 0x1406(%rip), %rsi      # 0x7241
movq %rdx, %rdi
callq 0x2260
movq %rax, %rbx
leaq 0x2066(%rip), %rdi      # 0x7eb3
movl $0xb, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x22c0
movl 0x54b3(%rip), %eax      # 0xb318
movq %rax, 0x30(%rsp)
movslq 0x535b(%rip), %r13      # 0xb1cc
leaq 0x2047(%rip), %r14      # 0x7ebf
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2160
incl %ebp
cmpl $0x2a, %ebp
jne 0x5e7a
movl $0xa, %edi
movq %rbx, %rsi
callq 0x2110
cmpl $0x0, 0x5328(%rip)      # 0xb1cc
jle 0x6075
movq %r13, 0x28(%rsp)
pxor %xmm0, %xmm0
movdqa %xmm0, 0x10(%rsp)
leaq 0x1fff(%rip), %rbp      # 0x7ebf
xorl %edx, %edx
xorl %r13d, %r13d
xorl %r14d, %r14d
movdqa %xmm0, 0x50(%rsp)
movl %r14d, 0x24(%rsp)
leaq (%rdx,%rdx,4), %r14
movl 0x8(%r12,%r14,4), %r9d
movl 0xc(%r12,%r14,4), %r10d
addl %r9d, %r13d
movl 0x10(%r12,%r14,4), %r11d
incq %rdx
movl (%r12,%r14,4), %ecx
movl 0x4(%r12,%r14,4), %r8d
movq %rbx, %rdi
leaq 0x1fc4(%rip), %rsi      # 0x7ec3
movq %rdx, 0x48(%rsp)
xorl %eax, %eax
movq %r11, 0x38(%rsp)
pushq %r11
movq %r10, 0x48(%rsp)
pushq %r10
callq 0x2160
addq $0x10, %rsp
movl 0x53f5(%rip), %eax      # 0xb318
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movd (%r12,%r14,4), %xmm1
movd 0x8(%r12,%r14,4), %xmm2
punpckldq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movd 0x4(%r12,%r14,4), %xmm1
movd 0xc(%r12,%r14,4), %xmm3
punpckldq %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
psubd %xmm3, %xmm2
movdqa %xmm2, %xmm1
psrad $0x1f, %xmm1
pxor %xmm1, %xmm2
psubd %xmm1, %xmm2
cvtdq2pd %xmm2, %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm1
cvtpd2ps %xmm1, %xmm0
movapd %xmm0, (%rsp)
xorl %r14d, %r14d
movl (%r15,%r14,4), %edx
movq %rbx, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x2160
cmpq $0x14, %r14
jb 0x5fbe
movl (%r15,%r14,4), %eax
cmpq $0x1e, %r14
movl $0x0, %ecx
cmovael %eax, %ecx
movd %eax, %xmm0
movd %ecx, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movdqa 0x10(%rsp), %xmm0
paddd %xmm1, %xmm0
movdqa %xmm0, 0x10(%rsp)
incq %r14
cmpq $0x2a, %r14
jne 0x5f7b
addl 0x40(%rsp), %r13d
movl 0x24(%rsp), %r14d
addl 0x38(%rsp), %r14d
movaps (%rsp), %xmm0
maxps 0x50(%rsp), %xmm0
movaps %xmm0, (%rsp)
movl $0xa, %edi
movq %rbx, %rsi
callq 0x2110
movdqa (%rsp), %xmm1
movslq 0x51d0(%rip), %rax      # 0xb1cc
addq $0xc8, %r15
movdqa %xmm1, %xmm0
movq 0x48(%rsp), %rdx
cmpq %rax, %rdx
jl 0x5ec8
mulps 0x1014(%rip), %xmm1     # 0x7030
cvtps2pd %xmm1, %xmm0
movaps %xmm0, (%rsp)
movd %r14d, %xmm0
movd %r13d, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movaps 0x10(%rsp), %xmm2
shufps $0x24, %xmm1, %xmm2     # xmm2 = xmm2[0,1],xmm1[2,0]
movaps 0xfff(%rip), %xmm0      # 0x7040
andps %xmm2, %xmm0
orps 0x1005(%rip), %xmm0     # 0x7050
psrld $0x10, %xmm2
por 0x1008(%rip), %xmm2     # 0x7060
subps 0x1011(%rip), %xmm2     # 0x7070
addps %xmm0, %xmm2
mulps 0x1017(%rip), %xmm2     # 0x7080
movaps %xmm2, 0x10(%rsp)
movq 0x28(%rsp), %r13
jmp 0x6081
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
imulq 0x30(%rsp), %r13
movl 0x528b(%rip), %edx      # 0xb318
leaq 0x1e41(%rip), %rsi      # 0x7ed5
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2160
leaq 0x1e41(%rip), %rsi      # 0x7ee6
movq %rbx, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x2160
leaq 0x1e3f(%rip), %rsi      # 0x7ef8
movq %rbx, %rdi
movaps (%rsp), %xmm0
movb $0x1, %al
callq 0x2160
movaps (%rsp), %xmm0
movhlps %xmm0, %xmm0            # xmm0 = xmm0[1,1]
leaq 0x1e36(%rip), %rsi      # 0x7f0b
movq %rbx, %rdi
movb $0x1, %al
callq 0x2160
xorps %xmm1, %xmm1
cvtsi2ss %r13, %xmm1
movss %xmm1, (%rsp)
movaps 0x10(%rsp), %xmm0
movhlps %xmm0, %xmm0            # xmm0 = xmm0[1,1]
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1e1b(%rip), %rsi      # 0x7f1e
movq %rbx, %rdi
movb $0x1, %al
callq 0x2160
movaps 0x10(%rsp), %xmm0
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
divss (%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1e0d(%rip), %rsi      # 0x7f33
movq %rbx, %rdi
movb $0x1, %al
callq 0x2160
movaps 0x10(%rsp), %xmm0
divss (%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1dfd(%rip), %rsi      # 0x7f42
movq %rbx, %rdi
movb $0x1, %al
callq 0x2160
movaps 0x10(%rsp), %xmm0
shufps $0xff, %xmm0, %xmm0     # xmm0 = xmm0[3,3,3,3]
divss (%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1de9(%rip), %rsi      # 0x7f51
movq %rbx, %rdi
movb $0x1, %al
callq 0x2160
movq %rbx, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20b0