// File: /workspace/github_c_makefile_star2_O2/annoroad[P]fqtools_plus/fqtools.c
// Function: filter_pair
static void filter_pair(void){
	struct job* job;
	struct readclass* readclass;
	struct readline* read1=NULL;
	struct readline* read2=NULL;
	struct STAT* stat;
	for (;;){
		possess(compress_have);
		wait_for(compress_have,NOT_TO_BE,0);
		job = compress_head;
		//job != NULL
		if (job->seq == -1) break;
		if (job->next == NULL){
			compress_tail = &compress_head;
		}else{
			compress_head = job->next;
		}
		twist(compress_have,BY,-1);
		
		readclass = job->in->readclass;
		read1 = readclass->read1;
		if (g.single_or_pair) read2 = readclass->read2;
		stat = readclass->stat;
		//filter funtion---------------------------------------
		if (g.outraw){
			to_buffer_raw(readclass,job);
			push_job_raw(job);
		}

		if (!job->more) {
			push_job(job);
			continue;
		}

		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) {
				push_job(job);
				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++;
				push_job(job);
				continue;
			}
			quality_base_percent(readclass);
			if (read1->low >= g.LOW_QUALITY || read2->low >= g.LOW_QUALITY){
				stat->low_quality_reads++;
				push_job(job);
				continue;
			}
			if (read1->N >= g.highN || read2->N >= g.highN){
			    stat->ns_reads++;
			  	push_job(job);
				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) {
				push_job(job);
				continue;
			}
			raw_Q30(readclass);
			stat->raw_reads++;
			stat->raw_bases+= read1->seqlen;
			cutseq(readclass);
			read1->seqlen = g.CUT;
			if (!checkadapter(readclass)){
				stat->adapter_reads++;
				push_job(job);
				continue;
			}
			quality_base_percent(readclass);
			if (read1->low >= g.LOW_QUALITY){
				stat->low_quality_reads++;
				push_job(job);
				continue;
			}
			if (read1->N >= g.highN){
			    stat->ns_reads++;
			  	push_job(job);
				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);
		push_job(job);
	}
	release(compress_have);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq $0x0, 0x8(%rsp)
pushq $0x1
popq %r13
movq 0x754c(%rip), %rdi      # 0xa2e0
callq 0x5ccb
movq 0x7540(%rip), %rdi      # 0xa2e0
movl %r13d, %esi
xorl %edx, %edx
callq 0x5ea2
movq 0x7537(%rip), %r15      # 0xa2e8
cmpq $-0x1, (%r15)
je 0x313e
movq 0x20(%r15), %rax
testq %rax, %rax
je 0x2dcd
movq %rax, 0x751d(%rip)      # 0xa2e8
jmp 0x2ddb
leaq 0x7514(%rip), %rax      # 0xa2e8
movq %rax, 0x7525(%rip)      # 0xa300
movq 0x74fe(%rip), %rdi      # 0xa2e0
movl %r13d, %esi
pushq $-0x1
popq %rdx
callq 0x5e4d
movq 0x10(%r15), %rax
movq 0x8(%rax), %r12
movq (%r12), %r14
cmpb $0x0, 0x73c8(%rip)      # 0xa1c8
je 0x2e0c
movq 0x8(%r12), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%r12), %rbx
cmpb $0x0, 0x73ec(%rip)      # 0xa204
je 0x2e70
movq %r12, %rdi
movq %r15, %rsi
callq 0x35d8
movq 0x74c4(%rip), %rdi      # 0xa2f0
callq 0x5ccb
leaq 0x74c0(%rip), %rax      # 0xa2f8
movq (%rax), %rcx
testq %rcx, %rcx
je 0x2e51
movq (%rcx), %rdx
cmpq (%r15), %rdx
jg 0x2e51
addq $0x28, %rcx
movq %rcx, %rax
jmp 0x2e38
movq %rcx, 0x28(%r15)
movq %r15, (%rax)
movq 0x7491(%rip), %rdi      # 0xa2f0
movq 0x7492(%rip), %rax      # 0xa2f8
movq (%rax), %rdx
xorl %esi, %esi
callq 0x5e4d
movq %rbx, 0x10(%rsp)
cmpl $0x0, 0x8(%r15)
je 0x3131
movb 0x7342(%rip), %bl       # 0xa1c8
leaq 0x1d(%r14), %rbp
leaq 0x41d(%r14), %rdi
movq %rdi, 0x18(%rsp)
callq 0x20c0
decl %eax
movl %eax, (%r14)
testb %bl, %bl
je 0x3042
movq 0x8(%rsp), %rax
movq %r12, 0x30(%rsp)
movl %r13d, %r12d
movq %rax, %r13
addq $0x1d, %rax
movq %rax, 0x28(%rsp)
leaq 0x41d(%r13), %rdi
movq %rdi, 0x20(%rsp)
callq 0x20c0
decl %eax
movl %eax, (%r13)
movl $0x101d, %ebx           # imm = 0x101D
leaq (%r14,%rbx), %rsi
movq %rbp, %rdi
callq 0x36a6
leaq (%rbx,%r13), %rsi
movl %r12d, %r13d
movq 0x30(%rsp), %r12
movq 0x28(%rsp), %rdi
callq 0x36a6
movl 0x72c7(%rip), %eax      # 0xa1cc
cmpl %eax, (%r14)
jl 0x3131
movq 0x8(%rsp), %rcx
cmpl %eax, (%rcx)
jl 0x3131
movq %r12, %rdi
callq 0x36c0
movq %r14, %rbp
movq 0x10(%rsp), %r14
incl (%r14)
movslq (%rbp), %rax
movq 0x8(%rsp), %rbx
movslq (%rbx), %rcx
addq %rax, %rcx
addq %rcx, 0x8(%r14)
movq %r12, %rdi
callq 0x3737
movl 0x727d(%rip), %eax      # 0xa1cc
movl %eax, (%rbp)
movl %eax, (%rbx)
movq %r12, %rdi
callq 0x381b
testb %al, %al
je 0x311d
movq %r12, %rdi
callq 0x38b4
cvtsi2ssl 0x14(%rbp), %xmm1
movss 0x726f(%rip), %xmm0     # 0xa1e8
ucomiss %xmm0, %xmm1
jae 0x3112
movq 0x8(%rsp), %rax
cvtsi2ssl 0x14(%rax), %xmm1
ucomiss %xmm0, %xmm1
jae 0x3112
movq %rbp, %rbx
cvtsi2ssl 0x18(%rbp), %xmm1
movss 0x7247(%rip), %xmm0     # 0xa1ec
ucomiss %xmm0, %xmm1
jae 0x312d
movq 0x8(%rsp), %rax
cvtsi2ssl 0x18(%rax), %xmm1
ucomiss %xmm0, %xmm1
jae 0x312d
movl 0x7230(%rip), %r14d     # 0xa1f8
movq 0x18(%rsp), %rdi
movl %r14d, %esi
callq 0x3acc
testb %al, %al
jne 0x2fea
movq 0x20(%rsp), %rdi
movl %r14d, %esi
callq 0x3acc
testb %al, %al
je 0x2ff2
movq 0x10(%rsp), %rax
incl 0x6c(%rax)
movq %rbx, %rcx
cvtsi2ssl 0x10(%rbx), %xmm1
movss 0x71f2(%rip), %xmm0     # 0xa1f4
ucomiss %xmm0, %xmm1
movq 0x10(%rsp), %rbx
jae 0x301b
movq 0x8(%rsp), %rax
cvtsi2ssl 0x10(%rax), %xmm1
ucomiss %xmm0, %xmm1
jb 0x301e
incl 0x64(%rbx)
cmpb $0x0, 0x1c(%rcx)
jne 0x302f
movq 0x8(%rsp), %rax
cmpb $0x0, 0x1c(%rax)
je 0x3032
incl 0x5c(%rbx)
movq 0x8(%rsp), %rax
movl 0x4(%rax), %eax
addl 0x4(%rcx), %eax
jmp 0x30f4
leaq 0x101d(%r14), %rsi
movq %rbp, %rdi
callq 0x36a6
movl (%r14), %eax
cmpl 0x7172(%rip), %eax      # 0xa1cc
jl 0x3131
movq %r12, %rdi
callq 0x36c0
movq 0x10(%rsp), %rbx
incl (%rbx)
movslq (%r14), %rax
addq %rax, 0x8(%rbx)
movq %r12, %rdi
callq 0x3737
movl 0x7148(%rip), %eax      # 0xa1cc
movl %eax, (%r14)
movq %r12, %rdi
callq 0x381b
testb %al, %al
je 0x3118
movq %r12, %rdi
callq 0x38b4
cvtsi2ssl 0x14(%r14), %xmm0
ucomiss 0x713c(%rip), %xmm0     # 0xa1e8
jae 0x3123
cvtsi2ssl 0x18(%r14), %xmm0
ucomiss 0x7131(%rip), %xmm0     # 0xa1ec
jae 0x3128
movl 0x7135(%rip), %esi      # 0xa1f8
movq 0x18(%rsp), %rdi
callq 0x3acc
testb %al, %al
je 0x30d4
incl 0x6c(%rbx)
cvtsi2ssl 0x10(%r14), %xmm0
ucomiss 0x7113(%rip), %xmm0     # 0xa1f4
jb 0x30e6
incl 0x64(%rbx)
cmpb $0x0, 0x1c(%r14)
je 0x30f0
incl 0x5c(%rbx)
movl 0x4(%r14), %eax
cltq
addq %rax, 0x50(%rbx)
incl 0x10(%rbx)
movq %r12, %rdi
callq 0x3b20
movq %r12, %rdi
movq %r15, %rsi
callq 0x3cf6
jmp 0x3131
incl 0x24(%r14)
jmp 0x3131
incl 0x34(%rbx)
jmp 0x3131
incl 0x34(%r14)
jmp 0x3131
incl 0x24(%rbx)
jmp 0x3131
incl 0x2c(%rbx)
jmp 0x3131
incl 0x2c(%r14)
movq %r15, %rdi
callq 0x5bca
jmp 0x2d8d
movq 0x719b(%rip), %rdi      # 0xa2e0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5cfa