// File: /workspace/github_c_makefile_star2_O3/annoroad[P]fqtools_plus/fqtools.c
// Function: process
local void process(void){
	prepare();
	if (g.Nthread > 1){
		parallel_filter_main();
	}else{
		single_filter_main();
	}

	//判断read1 和 read2是否都读完？------------------------------
	if (g.single_or_pair){
		if (g.read1Count != g.read2Count){
			fprintf(stderr, "read1 num not equal read2 num\n");
			exit(-1);
		}
	}


	//gzip--------------------------------------------------------
	char s1[strlen(g.outfq1)+100];
	char s2[strlen(g.outfq1)+100];
	char s3[strlen(g.rawcutfq1)+100];
	char s4[strlen(g.rawcutfq2)+100];
	sprintf(s1,"%s %s",g.speedy_gzip,g.outfq1);
	if(g.single_or_pair) sprintf(s2,"%s %s",g.speedy_gzip,g.outfq2);
	if (g.QUOTA > 0 && g.QUOTA < LONG_MAX){
		sprintf(s3,"%s %s",g.speedy_gzip,g.rawcutfq1);
		if(g.single_or_pair) sprintf(s4,"%s %s",g.speedy_gzip,g.rawcutfq2);
	}
	char* shell1[]={"sh","-c",s1,NULL};
	char* shell2[]={"sh","-c",s2,NULL};
	char* shell3[]={"sh","-c",s3,NULL};
	char* shell4[]={"sh","-c",s4,NULL};

	pid_t jobs[4]={0,0,0,0};

	int n=0;
	pid_t curjob;
	curjob = fork();
	if(curjob==0){
		execv("/bin/sh",shell1);
	}
	jobs[n] = curjob;
	n++;

	if (g.single_or_pair){
		curjob = fork();
		if(curjob==0){
			execv("/bin/sh",shell2);	
		}
		jobs[n] = curjob;
		n++;
	}

	if (g.QUOTA > 0 && g.QUOTA < LONG_MAX){
		curjob = fork();
		if(curjob==0){
			execv("/bin/sh",shell3);
		}
		jobs[n] = curjob;
		n++;
		if (g.single_or_pair){
			curjob = fork();
			if(curjob==0){
				execv("/bin/sh",shell4);
			}
			jobs[n] = curjob;
			n++;
		}
	}
		
	n--;

	while(n > -1){
		curjob = waitpid(jobs[n],NULL,0);
		if (curjob == jobs[n]){
			n--;
		}else{
			fprintf(stderr, "%d is wrong! return %d\n",jobs[0],curjob);
			exit(-1);
		}
	} 

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x478, %rsp            # imm = 0x478
xorps %xmm0, %xmm0
movups %xmm0, 0x5949(%rip)     # 0xb280
movq 0x5902(%rip), %rdi      # 0xb240
leaq 0x2312(%rip), %rsi      # 0x7c57
callq 0x2210
movq %rax, 0x592f(%rip)      # 0xb280
cmpb $0x0, 0x5870(%rip)      # 0xb1c8
je 0x5974
movq 0x58e7(%rip), %rdi      # 0xb248
leaq 0x22ef(%rip), %rsi      # 0x7c57
callq 0x2210
movq %rax, 0x5914(%rip)      # 0xb288
xorps %xmm0, %xmm0
movups %xmm0, 0x5912(%rip)     # 0xb290
movq 0x58cb(%rip), %rdi      # 0xb250
leaq 0x18b5(%rip), %rsi      # 0x7241
callq 0x2260
movq %rax, 0x58f8(%rip)      # 0xb290
testq %rax, %rax
je 0x5de9
cmpb $0x0, 0x5820(%rip)      # 0xb1c8
je 0x59cd
movq 0x58a7(%rip), %rdi      # 0xb258
leaq 0x1889(%rip), %rsi      # 0x7241
callq 0x2260
movq %rax, 0x58d4(%rip)      # 0xb298
testq %rax, %rax
je 0x5e11
movq 0x58ac(%rip), %rdi      # 0xb280
leaq -0x4a0(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2080
testq %rax, %rax
je 0x5e0a
movq 0x588b(%rip), %rdi      # 0xb280
leaq -0x4a0(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2080
testq %rax, %rax
je 0x5e0a
leaq -0x4a0(%rbp), %rdi
callq 0x20c0
movl 0x57af(%rip), %edx      # 0xb1d0
movl %edx, %esi
notl %esi
addl %eax, %esi
movl 0x579f(%rip), %ecx      # 0xb1cc
testl %ecx, %ecx
sete %dil
cmpl %ecx, %esi
setl %r8b
orb %dil, %r8b
cmpb $0x1, %r8b
jne 0x5a4a
movl %esi, 0x5784(%rip)      # 0xb1cc
movl %esi, %ecx
leal (%rcx,%rdx), %esi
movslq %esi, %rsi
cmpq %rsi, %rax
jb 0x5dee
movabsq $0x7ffffffffffffffe, %rdx # imm = 0x7FFFFFFFFFFFFFFE
movq 0x576e(%rip), %rax      # 0xb1d8
testq %rax, %rax
je 0x5af5
movzbl 0x574e(%rip), %edx      # 0xb1c8
testl %edx, %edx
je 0x5a85
cmpl $0x1, %edx
jne 0x5a94
addl %ecx, %ecx
movslq %ecx, %rcx
cqto
idivq %rcx
movq %rax, 0x5744(%rip)      # 0xb1d8
movb $0x1, 0x5769(%rip)      # 0xb204
xorps %xmm0, %xmm0
movups %xmm0, 0x57fb(%rip)     # 0xb2a0
movq 0x57b4(%rip), %rdi      # 0xb260
leaq 0x178e(%rip), %rsi      # 0x7241
callq 0x2260
movq %rax, 0x57e1(%rip)      # 0xb2a0
testq %rax, %rax
je 0x5e16
cmpb $0x0, 0x56f9(%rip)      # 0xb1c8
je 0x5b11
movq 0x5790(%rip), %rdi      # 0xb268
leaq 0x1762(%rip), %rsi      # 0x7241
callq 0x2260
movq %rax, 0x57bd(%rip)      # 0xb2a8
testq %rax, %rax
jne 0x5b11
callq 0x24e3
leaq 0x1(%rdx), %rax
movq %rax, 0x56d8(%rip)      # 0xb1d8
movb $0x0, 0x56fd(%rip)      # 0xb204
xorps %xmm0, %xmm0
movups %xmm0, 0x578f(%rip)     # 0xb2a0
xorps %xmm0, %xmm0
cvtsi2ssl 0x56b0(%rip), %xmm0 # 0xb1cc
movups 0x56c5(%rip), %xmm1     # 0xb1e8
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
mulps %xmm1, %xmm0
movups %xmm0, 0x56b7(%rip)     # 0xb1e8
movq 0x5748(%rip), %rdi      # 0xb280
xorl %esi, %esi
xorl %edx, %edx
callq 0x20d0
cmpl $0x2, 0x56b8(%rip)      # 0xb200
jl 0x5b51
callq 0x2c63
jmp 0x5b56
callq 0x362f
cmpb $0x0, 0x566b(%rip)      # 0xb1c8
je 0x5b73
movq 0x56a2(%rip), %rax      # 0xb208
cmpq 0x56a3(%rip), %rax      # 0xb210
jne 0x5e1b
movq 0x56d6(%rip), %r13      # 0xb250
movq %r13, %rdi
callq 0x20c0
movq %rsp, %rbx
addq $0x73, %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
movq 0x56bd(%rip), %rdi      # 0xb260
callq 0x20c0
movq %rsp, %r15
addq $0x73, %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movq 0x56a8(%rip), %rdi      # 0xb268
callq 0x20c0
movq %rsp, %r12
addq $0x73, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movq 0x56d3(%rip), %rdx      # 0xb2b0
leaq 0x204d(%rip), %rsi      # 0x7c31
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x22a0
cmpb $0x0, 0x55d0(%rip)      # 0xb1c8
je 0x5c19
movq 0x56af(%rip), %rdx      # 0xb2b0
movq 0x5650(%rip), %rcx      # 0xb258
leaq 0x2022(%rip), %rsi      # 0x7c31
movq %r14, %rdi
xorl %eax, %eax
callq 0x22a0
movq 0x55b8(%rip), %rax      # 0xb1d8
decq %rax
movabsq $0x7ffffffffffffffe, %r13 # imm = 0x7FFFFFFFFFFFFFFE
cmpq %r13, %rax
jae 0x5c79
movq 0x5677(%rip), %rdx      # 0xb2b0
movq 0x5620(%rip), %rcx      # 0xb260
leaq 0x1fea(%rip), %rsi      # 0x7c31
movq %r15, %rdi
xorl %eax, %eax
callq 0x22a0
cmpb $0x0, 0x5570(%rip)      # 0xb1c8
je 0x5c79
movq 0x564f(%rip), %rdx      # 0xb2b0
movq 0x5600(%rip), %rcx      # 0xb268
leaq 0x1fc2(%rip), %rsi      # 0x7c31
movq %r12, %rdi
xorl %eax, %eax
callq 0x22a0
leaq 0x1fbc(%rip), %rax      # 0x7c3c
movq %rax, -0x4a0(%rbp)
leaq 0x1449(%rip), %rcx      # 0x70d7
movq %rcx, -0x498(%rbp)
movq %rbx, -0x490(%rbp)
xorl %edx, %edx
movq %rdx, -0x488(%rbp)
movq %rax, -0xa0(%rbp)
movq %rcx, -0x98(%rbp)
movq %r14, -0x90(%rbp)
movq %rdx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
movq %rcx, -0x78(%rbp)
movq %r15, -0x70(%rbp)
movq %rdx, -0x68(%rbp)
movq %rax, -0x60(%rbp)
movq %rcx, -0x58(%rbp)
movq %r12, -0x50(%rbp)
movq %rdx, -0x48(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
callq 0x2330
movl %eax, %ebx
testl %eax, %eax
jne 0x5d06
leaq 0x1f3d(%rip), %rdi      # 0x7c37
leaq -0x4a0(%rbp), %rsi
callq 0x2320
movl %ebx, -0x40(%rbp)
cmpb $0x0, 0x54b8(%rip)      # 0xb1c8
je 0x5d3d
callq 0x2330
movl %eax, %r14d
testl %eax, %eax
jne 0x5d31
leaq 0x1f12(%rip), %rdi      # 0x7c37
leaq -0xa0(%rbp), %rsi
callq 0x2320
movl %r14d, -0x3c(%rbp)
movl $0x2, %r15d
jmp 0x5d43
movl $0x1, %r15d
movq 0x548e(%rip), %rax      # 0xb1d8
decq %rax
cmpq %r13, %rax
jae 0x5db0
callq 0x2330
movl %eax, %r14d
testl %eax, %eax
jne 0x5d6e
leaq 0x1ed2(%rip), %rdi      # 0x7c37
leaq -0x80(%rbp), %rsi
callq 0x2320
movl %r15d, %eax
movl %r14d, -0x40(%rbp,%rax,4)
leal 0x1(%r15), %r12d
cmpb $0x0, 0x5447(%rip)      # 0xb1c8
je 0x5dad
callq 0x2330
movl %eax, %r14d
testl %eax, %eax
jne 0x5d9f
leaq 0x1ea1(%rip), %rdi      # 0x7c37
leaq -0x60(%rbp), %rsi
callq 0x2320
movl %r12d, %eax
movl %r14d, -0x40(%rbp,%rax,4)
addl $0x2, %r15d
jmp 0x5db0
movl %r12d, %r15d
movl %r15d, %r15d
testq %r15, %r15
jle 0x5dda
movl -0x44(%rbp,%r15,4), %r14d
decq %r15
movl %r14d, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2230
cmpl %r14d, %eax
je 0x5db3
movl %ebx, %edi
movl %eax, %esi
callq 0x2556
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x257b
movq 0x5203(%rip), %rsi      # 0xaff8
movq (%rsi), %rdi
leal -0x1(%rax), %r8d
leaq 0x1e68(%rip), %rsi      # 0x7c6b
xorl %eax, %eax
callq 0x2160
xorl %edi, %edi
callq 0x22b0
callq 0x24bc
callq 0x250a
callq 0x2531