// File: /workspace/github_c_makefile_star2_O1/annoroad[P]fqtools_plus/fqtools.c
// Function: single_filter_main
void single_filter_main(void){
    new_pool(&in_pool, -1);
	struct job* job = new_job();
	job->in = get_space(&in_pool);
	in_pool.head = job->in;
	struct readclass* readclass = job->in->readclass;
	struct readline* read1 = readclass->read1;
	struct readline* read2 = readclass->read2;
	struct STAT* stat = readclass->stat;

	for(;;){
		if (!readn(job->in)) break;
		if (g.outraw){
			to_buffer_raw(readclass,job);
			fwrite(job->buffer1_raw,sizeof(char),job->l1_r,g.fpout1_raw);
			if (g.single_or_pair) fwrite(job->buffer2_raw,sizeof(char),job->l2_r,g.fpout2_raw);
		}

		if (g.single_or_pair){
			read1->seqlen = strlen(read1->reads[1])-1;
			read2->seqlen = strlen(read2->reads[1])-1;
			substr_((read1->reads)[0], read1->id);
			substr_((read2->reads)[0], read2->id);
			if (read1->seqlen < g.CUT || read2->seqlen < g.CUT) {
				continue;
			}
			raw_Q30(readclass);
			stat->raw_reads++;
			stat->raw_bases+= read1->seqlen + read2->seqlen;	
			cutseq(readclass);
			read1->seqlen = g.CUT;
			read2->seqlen = g.CUT;
			if (!checkadapter(readclass)){
				stat->adapter_reads++;
				continue;
			}
			quality_base_percent(readclass);
			if (read1->low >= g.LOW_QUALITY || read2->low >= g.LOW_QUALITY){
				stat->low_quality_reads++;
				continue;
			}
			if (read1->N >= g.highN || read2->N >= g.highN){
			    stat->ns_reads++;
				continue;
			}
			if (check_ployAT((read1->reads)[1], g.ployAT) || check_ployAT((read2->reads)[1], g.ployAT)){
			  	stat->ployAT_reads++;
			}
			if (read1->GC >= g.highGC || read2->GC >= g.highGC){
			   	stat->HighGC_reads++;
			}
			if (read1->highAT_sign || read2->highAT_sign){
			   	stat->HighAT_reads++;
			}
			stat->clean_Q30_bases += read1->Q30 + read2->Q30;
			stat->clean_reads++;
			report(readclass);
		}else{
			read1->seqlen = strlen(read1->reads[1])-1;
			substr_((read1->reads)[0], read1->id);
			if (read1->seqlen < g.CUT) {
				continue;
			}
			raw_Q30(readclass);
			stat->raw_reads++;
			stat->raw_bases+= read1->seqlen;
			cutseq(readclass);
			read1->seqlen = g.CUT;
			if (!checkadapter(readclass)){
				stat->adapter_reads++;
				continue;
			}
			quality_base_percent(readclass);
			if (read1->low >= g.LOW_QUALITY){
				stat->low_quality_reads++;
				continue;
			}
			if (read1->N >= g.highN){
			    stat->ns_reads++;
				continue;
			}

			if (check_ployAT((read1->reads)[1], g.ployAT)){
			  	stat->ployAT_reads++;
			}
			if (read1->GC >= g.highGC){
			   	stat->HighGC_reads++;
			}
			if (read1->highAT_sign){
			   	stat->HighAT_reads++;
			}
			stat->clean_Q30_bases += read1->Q30;
			stat->clean_reads++;
			report(readclass);

		}
		//-----------------------------------------------------
		to_buffer(readclass,job);
		fwrite(job->buffer1,sizeof(char),job->l1,g.fpout1);
		if (g.single_or_pair) fwrite(job->buffer2,sizeof(char),job->l2,g.fpout2);
		if (stat->clean_reads == g.QUOTA) break;
	}


	if (g.outraw){
		possess(job->calc);
		twist(job->calc,TO,1);	
	}

	gzclose(g.gzfp1);
    if (g.single_or_pair) gzclose(g.gzfp2);
    fclose(g.fpout1);
    if (g.single_or_pair) fclose(g.fpout2);
    if (g.outraw){
    	fclose(g.fpout1_raw);
	    if (g.single_or_pair) fclose(g.fpout2_raw);
    }

	if (job != NULL) free_job(job);
	merge_stat(&in_pool);
	free_pool(&in_pool);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorl %edi, %edi
callq 0x6200
movq %rax, 0x7c67(%rip)      # 0xb2c0
movq $0x0, 0x7c64(%rip) # 0xb2c8
movl $0xffffffff, 0x7c62(%rip) # imm = 0xFFFFFFFF
movb $0x1, 0x7c5f(%rip)      # 0xb2d4
callq 0x2ef7
movq %rax, %rbx
callq 0x2f37
movq %rax, 0x10(%rbx)
movq %rax, 0x7c3b(%rip)      # 0xb2c8
movq 0x8(%rax), %r14
movq (%r14), %r13
movq 0x8(%r14), %rbp
movq 0x10(%r14), %rax
movq %rax, (%rsp)
movq 0x10(%rbx), %rdi
callq 0x30c6
testl %eax, %eax
je 0x3a7b
movl $0x41d, %eax            # imm = 0x41D
leaq (%rax,%r13), %rcx
movq %rcx, 0x8(%rsp)
addq %rbp, %rax
movq %rax, 0x30(%rsp)
movl $0x101d, %r15d          # imm = 0x101D
leaq (%r15,%r13), %r12
addq %rbp, %r15
movq (%rsp), %rax
leaq 0x24(%rax), %rcx
movq %rcx, 0x18(%rsp)
leaq 0x2c(%rax), %rcx
movq %rcx, 0x10(%rsp)
addq $0x34, %rax
movq %rax, 0x28(%rsp)
cmpb $0x0, 0x7b02(%rip)      # 0xb1fc
je 0x3742
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3b2e
movq 0x50(%rbx), %rdi
movslq 0x58(%rbx), %rdx
movq 0x7b82(%rip), %rcx      # 0xb298
movl $0x1, %esi
callq 0x22b0
cmpb $0x0, 0x7a99(%rip)      # 0xb1c0
je 0x3742
movq 0x60(%rbx), %rdi
movslq 0x68(%rbx), %rdx
movq 0x7b68(%rip), %rcx      # 0xb2a0
movl $0x1, %esi
callq 0x22b0
cmpb $0x0, 0x7a77(%rip)      # 0xb1c0
je 0x38fa
movq 0x8(%rsp), %rdi
callq 0x20c0
decl %eax
movl %eax, (%r13)
movq 0x30(%rsp), %rdi
callq 0x20c0
decl %eax
movl %eax, (%rbp)
cmpb $0xa, 0x1d(%r13)
movq %r12, %rax
je 0x378b
movq %r12, %rax
movb -0xfff(%rax), %cl
movb %cl, (%rax)
incq %rax
cmpb $0xa, %cl
jne 0x377b
movb $0x0, (%rax)
cmpb $0xa, 0x1d(%rbp)
movq %r15, %rax
je 0x37aa
movq %r15, %rax
movb -0xfff(%rax), %cl
movb %cl, (%rax)
incq %rax
cmpb $0xa, %cl
jne 0x379a
movb $0x0, (%rax)
movl 0x7a11(%rip), %eax      # 0xb1c4
cmpl %eax, (%r13)
jl 0x3a6a
cmpl %eax, (%rbp)
jl 0x3a6a
movq %r14, %rdi
callq 0x3c14
movq (%rsp), %rdx
incl (%rdx)
movslq (%r13), %rax
movslq (%rbp), %rcx
addq %rax, %rcx
addq %rcx, 0x8(%rdx)
movq %r14, %rdi
callq 0x3c92
movl 0x79d3(%rip), %eax      # 0xb1c4
movl %eax, (%r13)
movl %eax, (%rbp)
movq %r14, %rdi
callq 0x3d76
movq 0x28(%rsp), %rcx
testb %al, %al
je 0x3a68
movq %r14, %rdi
callq 0x3e0f
xorps %xmm1, %xmm1
cvtsi2ssl 0x14(%r13), %xmm1
movss 0x79ba(%rip), %xmm0     # 0xb1e0
ucomiss %xmm0, %xmm1
movq 0x18(%rsp), %rcx
jae 0x3a68
xorps %xmm1, %xmm1
cvtsi2ssl 0x14(%rbp), %xmm1
ucomiss %xmm0, %xmm1
movq 0x18(%rsp), %rcx
jae 0x3a68
xorps %xmm1, %xmm1
cvtsi2ssl 0x18(%r13), %xmm1
movss 0x7989(%rip), %xmm0     # 0xb1e4
ucomiss %xmm0, %xmm1
movq 0x10(%rsp), %rcx
jae 0x3a68
xorps %xmm1, %xmm1
cvtsi2ssl 0x18(%rbp), %xmm1
ucomiss %xmm0, %xmm1
movq 0x10(%rsp), %rcx
jae 0x3a68
movl 0x796b(%rip), %esi      # 0xb1f0
movq 0x8(%rsp), %rdi
movl %esi, 0x24(%rsp)
callq 0x3ffa
testb %al, %al
jne 0x38a9
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x3ffa
testb %al, %al
je 0x38b0
movq (%rsp), %rax
incl 0x6c(%rax)
xorps %xmm1, %xmm1
cvtsi2ssl 0x10(%r13), %xmm1
movss 0x792b(%rip), %xmm0     # 0xb1ec
ucomiss %xmm0, %xmm1
jae 0x38d3
xorps %xmm1, %xmm1
cvtsi2ssl 0x10(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jb 0x38da
movq (%rsp), %rax
incl 0x64(%rax)
cmpb $0x0, 0x1c(%r13)
jne 0x38e7
cmpb $0x0, 0x1c(%rbp)
je 0x38ee
movq (%rsp), %rax
incl 0x5c(%rax)
movl 0x4(%rbp), %eax
addl 0x4(%r13), %eax
jmp 0x39fb
movq 0x8(%rsp), %rdi
callq 0x20c0
decl %eax
movl %eax, (%r13)
cmpb $0xa, 0x1d(%r13)
movq %r12, %rax
je 0x3927
movq %r12, %rax
movb -0xfff(%rax), %cl
movb %cl, (%rax)
incq %rax
cmpb $0xa, %cl
jne 0x3917
movb $0x0, (%rax)
movl (%r13), %eax
cmpl 0x7890(%rip), %eax      # 0xb1c4
jl 0x3a6a
movq %r14, %rdi
callq 0x3c14
movq (%rsp), %rcx
incl (%rcx)
movslq (%r13), %rax
addq %rax, 0x8(%rcx)
movq %r14, %rdi
callq 0x3c92
movl 0x7866(%rip), %eax      # 0xb1c4
movl %eax, (%r13)
movq %r14, %rdi
callq 0x3d76
movq 0x28(%rsp), %rcx
testb %al, %al
je 0x3a68
movq %r14, %rdi
callq 0x3e0f
xorps %xmm0, %xmm0
cvtsi2ssl 0x14(%r13), %xmm0
ucomiss 0x7851(%rip), %xmm0     # 0xb1e0
movq 0x18(%rsp), %rcx
jae 0x3a68
xorps %xmm0, %xmm0
cvtsi2ssl 0x18(%r13), %xmm0
ucomiss 0x783a(%rip), %xmm0     # 0xb1e4
movq 0x10(%rsp), %rcx
jae 0x3a68
movl 0x7835(%rip), %esi      # 0xb1f0
movq 0x8(%rsp), %rdi
callq 0x3ffa
testb %al, %al
je 0x39d0
movq (%rsp), %rax
incl 0x6c(%rax)
xorps %xmm0, %xmm0
cvtsi2ssl 0x10(%r13), %xmm0
ucomiss 0x780c(%rip), %xmm0     # 0xb1ec
jb 0x39e9
movq (%rsp), %rax
incl 0x64(%rax)
cmpb $0x0, 0x1c(%r13)
je 0x39f7
movq (%rsp), %rax
incl 0x5c(%rax)
movl 0x4(%r13), %eax
cltq
movq (%rsp), %rcx
addq %rax, 0x50(%rcx)
incl 0x10(%rcx)
movq %r14, %rdi
callq 0x407c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x428d
movq 0x30(%rbx), %rdi
movslq 0x38(%rbx), %rdx
movq 0x785e(%rip), %rcx      # 0xb288
movl $0x1, %esi
callq 0x22b0
cmpb $0x0, 0x7785(%rip)      # 0xb1c0
je 0x3a56
movq 0x40(%rbx), %rdi
movslq 0x48(%rbx), %rdx
movq 0x7844(%rip), %rcx      # 0xb290
movl $0x1, %esi
callq 0x22b0
movq (%rsp), %rax
movl 0x10(%rax), %eax
cmpq %rax, 0x776c(%rip)      # 0xb1d0
jne 0x3a6a
jmp 0x3a7b
incl (%rcx)
movq 0x10(%rbx), %rdi
callq 0x30c6
testl %eax, %eax
jne 0x36f3
cmpb $0x0, 0x777a(%rip)      # 0xb1fc
je 0x3a9d
movq 0x18(%rbx), %rdi
callq 0x6275
movq 0x18(%rbx), %rdi
movl $0x1, %edx
xorl %esi, %esi
callq 0x63a4
movq 0x77d4(%rip), %rdi      # 0xb278
callq 0x2030
cmpb $0x0, 0x7710(%rip)      # 0xb1c0
je 0x3abe
movq 0x77c7(%rip), %rdi      # 0xb280
callq 0x2030
movq 0x77c3(%rip), %rdi      # 0xb288
callq 0x20b0
cmpb $0x0, 0x76ef(%rip)      # 0xb1c0
je 0x3adf
movq 0x77b6(%rip), %rdi      # 0xb290
callq 0x20b0
cmpb $0x0, 0x7716(%rip)      # 0xb1fc
je 0x3b09
movq 0x77a9(%rip), %rdi      # 0xb298
callq 0x20b0
cmpb $0x0, 0x76c5(%rip)      # 0xb1c0
je 0x3b09
movq 0x779c(%rip), %rdi      # 0xb2a0
callq 0x20b0
testq %rbx, %rbx
je 0x3b16
movq %rbx, %rdi
callq 0x2a9e
callq 0x4355
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4598