// File: /workspace/github_c_makefile_star2_O3/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 0x61f0
movq %rax, 0x7c7d(%rip)      # 0xb2c8
movq $0x0, 0x7c7a(%rip) # 0xb2d0
movl $0xffffffff, 0x7c78(%rip) # imm = 0xFFFFFFFF
movb $0x1, 0x7c75(%rip)      # 0xb2dc
callq 0x2f07
movq %rax, %rbx
callq 0x2f47
movq %rax, 0x10(%rbx)
movq %rax, 0x7c51(%rip)      # 0xb2d0
movq 0x8(%rax), %r14
movq (%r14), %r13
movq 0x8(%r14), %rbp
movq 0x10(%r14), %r15
movq %rax, %rdi
callq 0x30b3
testl %eax, %eax
je 0x3a4d
movl $0x41d, %eax            # imm = 0x41D
leaq (%rax,%r13), %rcx
movq %rcx, (%rsp)
addq %rbp, %rax
movq %rax, 0x28(%rsp)
movl $0x101d, %eax           # imm = 0x101D
leaq (%rax,%r13), %r12
addq %rbp, %rax
movq %rax, 0x30(%rsp)
leaq 0x24(%r15), %rax
movq %rax, 0x10(%rsp)
leaq 0x2c(%r15), %rax
movq %rax, 0x8(%rsp)
leaq 0x34(%r15), %rax
movq %rax, 0x20(%rsp)
cmpb $0x0, 0x7b1e(%rip)      # 0xb204
je 0x3732
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3afd
movq 0x50(%rbx), %rdi
movslq 0x58(%rbx), %rdx
movq 0x7b9e(%rip), %rcx      # 0xb2a0
movl $0x1, %esi
callq 0x22c0
cmpb $0x0, 0x7ab5(%rip)      # 0xb1c8
je 0x38e0
movq 0x60(%rbx), %rdi
movslq 0x68(%rbx), %rdx
movq 0x7b80(%rip), %rcx      # 0xb2a8
movl $0x1, %esi
callq 0x22c0
cmpb $0x0, 0x7a8f(%rip)      # 0xb1c8
je 0x38e0
movq (%rsp), %rdi
callq 0x20c0
decl %eax
movl %eax, (%r13)
movq 0x28(%rsp), %rdi
callq 0x20c0
decl %eax
movl %eax, (%rbp)
cmpb $0xa, 0x1d(%r13)
movq %r12, %rax
je 0x377a
movq %r12, %rax
movb -0xfff(%rax), %cl
movb %cl, (%rax)
incq %rax
cmpb $0xa, %cl
jne 0x376a
movb $0x0, (%rax)
cmpb $0xa, 0x1d(%rbp)
movq 0x30(%rsp), %rax
je 0x379d
movq 0x30(%rsp), %rax
movb -0xfff(%rax), %cl
movb %cl, (%rax)
incq %rax
cmpb $0xa, %cl
jne 0x378d
movb $0x0, (%rax)
movl 0x7a26(%rip), %eax      # 0xb1cc
cmpl %eax, (%r13)
jl 0x3a3c
cmpl %eax, (%rbp)
jl 0x3a3c
movq %r14, %rdi
callq 0x3bcb
incl (%r15)
movslq (%r13), %rax
movslq (%rbp), %rcx
addq %rax, %rcx
addq %rcx, 0x8(%r15)
movq %r14, %rdi
callq 0x3c49
movl 0x79eb(%rip), %eax      # 0xb1cc
movl %eax, (%r13)
movl %eax, (%rbp)
movq %r14, %rdi
callq 0x3d2d
movq 0x20(%rsp), %rcx
testb %al, %al
je 0x3a3a
movq %r14, %rdi
callq 0x3dc6
xorps %xmm1, %xmm1
cvtsi2ssl 0x14(%r13), %xmm1
movss 0x79d2(%rip), %xmm0     # 0xb1e8
ucomiss %xmm0, %xmm1
movq 0x10(%rsp), %rcx
jae 0x3a3a
xorps %xmm1, %xmm1
cvtsi2ssl 0x14(%rbp), %xmm1
ucomiss %xmm0, %xmm1
movq 0x10(%rsp), %rcx
jae 0x3a3a
xorps %xmm1, %xmm1
cvtsi2ssl 0x18(%r13), %xmm1
movss 0x79a1(%rip), %xmm0     # 0xb1ec
ucomiss %xmm0, %xmm1
movq 0x8(%rsp), %rcx
jae 0x3a3a
xorps %xmm1, %xmm1
cvtsi2ssl 0x18(%rbp), %xmm1
ucomiss %xmm0, %xmm1
movq 0x8(%rsp), %rcx
jae 0x3a3a
movl 0x7983(%rip), %esi      # 0xb1f8
movq (%rsp), %rdi
movl %esi, 0x1c(%rsp)
callq 0x4013
testb %al, %al
jne 0x3898
movq 0x28(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x4013
testb %al, %al
je 0x389c
incl 0x6c(%r15)
xorps %xmm1, %xmm1
cvtsi2ssl 0x10(%r13), %xmm1
movss 0x7947(%rip), %xmm0     # 0xb1f4
ucomiss %xmm0, %xmm1
jae 0x38bf
xorps %xmm1, %xmm1
cvtsi2ssl 0x10(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jb 0x38c3
incl 0x64(%r15)
cmpb $0x0, 0x1c(%r13)
jne 0x38d0
cmpb $0x0, 0x1c(%rbp)
je 0x38d4
incl 0x5c(%r15)
movl 0x4(%rbp), %eax
addl 0x4(%r13), %eax
jmp 0x39d3
movq (%rsp), %rdi
callq 0x20c0
decl %eax
movl %eax, (%r13)
cmpb $0xa, 0x1d(%r13)
movq %r12, %rax
je 0x390c
movq %r12, %rax
movb -0xfff(%rax), %cl
movb %cl, (%rax)
incq %rax
cmpb $0xa, %cl
jne 0x38fc
movb $0x0, (%rax)
movl (%r13), %eax
cmpl 0x78b3(%rip), %eax      # 0xb1cc
jl 0x3a3c
movq %r14, %rdi
callq 0x3bcb
incl (%r15)
movslq (%r13), %rax
addq %rax, 0x8(%r15)
movq %r14, %rdi
callq 0x3c49
movl 0x788c(%rip), %eax      # 0xb1cc
movl %eax, (%r13)
movq %r14, %rdi
callq 0x3d2d
movq 0x20(%rsp), %rcx
testb %al, %al
je 0x3a3a
movq %r14, %rdi
callq 0x3dc6
xorps %xmm0, %xmm0
cvtsi2ssl 0x14(%r13), %xmm0
ucomiss 0x7877(%rip), %xmm0     # 0xb1e8
movq 0x10(%rsp), %rcx
jae 0x3a3a
xorps %xmm0, %xmm0
cvtsi2ssl 0x18(%r13), %xmm0
ucomiss 0x7860(%rip), %xmm0     # 0xb1ec
movq 0x8(%rsp), %rcx
jae 0x3a3a
movl 0x785b(%rip), %esi      # 0xb1f8
movq (%rsp), %rdi
callq 0x4013
testb %al, %al
je 0x39ae
incl 0x6c(%r15)
xorps %xmm0, %xmm0
cvtsi2ssl 0x10(%r13), %xmm0
ucomiss 0x7836(%rip), %xmm0     # 0xb1f4
jb 0x39c4
incl 0x64(%r15)
cmpb $0x0, 0x1c(%r13)
je 0x39cf
incl 0x5c(%r15)
movl 0x4(%r13), %eax
cltq
addq %rax, 0x50(%r15)
incl 0x10(%r15)
movq %r14, %rdi
callq 0x4074
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4281
movq 0x30(%rbx), %rdi
movslq 0x38(%rbx), %rdx
movq 0x7891(%rip), %rcx      # 0xb290
movl $0x1, %esi
callq 0x22c0
cmpb $0x0, 0x77b8(%rip)      # 0xb1c8
je 0x3a2b
movq 0x40(%rbx), %rdi
movslq 0x48(%rbx), %rdx
movq 0x7877(%rip), %rcx      # 0xb298
movl $0x1, %esi
callq 0x22c0
movl 0x10(%r15), %eax
cmpq %rax, 0x77a2(%rip)      # 0xb1d8
jne 0x3a3c
jmp 0x3a4d
incl (%rcx)
movq 0x10(%rbx), %rdi
callq 0x30b3
testl %eax, %eax
jne 0x36df
cmpb $0x0, 0x77b0(%rip)      # 0xb204
je 0x3a71
movq 0x18(%rbx), %r14
movq %r14, %rdi
callq 0x6265
movl $0x1, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x6394
movq 0x7808(%rip), %rdi      # 0xb280
callq 0x2030
cmpb $0x0, 0x7744(%rip)      # 0xb1c8
je 0x3a92
movq 0x77fb(%rip), %rdi      # 0xb288
callq 0x2030
movq 0x77f7(%rip), %rdi      # 0xb290
callq 0x20b0
cmpb $0x0, 0x7723(%rip)      # 0xb1c8
je 0x3ab3
movq 0x77ea(%rip), %rdi      # 0xb298
callq 0x20b0
cmpb $0x0, 0x774a(%rip)      # 0xb204
je 0x3add
movq 0x77dd(%rip), %rdi      # 0xb2a0
callq 0x20b0
cmpb $0x0, 0x76f9(%rip)      # 0xb1c8
je 0x3add
movq 0x77d0(%rip), %rdi      # 0xb2a8
callq 0x20b0
movq %rbx, %rdi
callq 0x2aae
callq 0x4345
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4588