// File: /workspace/github_c_makefile_star2_O0/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
subq $0xf0, %rsp
callq 0x7b80
cmpl $0x1, 0x66c9(%rip)      # 0xd210
jle 0x6b50
callq 0x29c0
jmp 0x6b55
callq 0x3690
cmpb $0x0, 0x667c(%rip)      # 0xd1d8
je 0x6b92
movq 0x66b3(%rip), %rax      # 0xd218
cmpq 0x66b4(%rip), %rax      # 0xd220
je 0x6b90
movq 0x6483(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x4347(%rip), %rsi      # 0xaec6
movb $0x0, %al
callq 0x2150
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x22a0
jmp 0x6b92
movq 0x66c7(%rip), %rdi      # 0xd260
callq 0x20c0
movq %rax, %rdx
movq %rdx, %rax
addq $0x64, %rax
movq %rsp, %rcx
movq %rcx, -0x8(%rbp)
addq $0x73, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0xd8(%rbp)
movq %rcx, %rsp
movq %rax, -0x10(%rbp)
movq 0x668e(%rip), %rdi      # 0xd260
callq 0x20c0
movq %rax, %rdx
movq %rdx, %rax
addq $0x64, %rax
addq $0x73, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0xe8(%rbp)
movq %rcx, %rsp
movq %rax, -0x18(%rbp)
movq 0x666c(%rip), %rdi      # 0xd270
callq 0x20c0
movq %rax, %rdx
movq %rdx, %rax
addq $0x64, %rax
addq $0x73, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0xe0(%rbp)
movq %rcx, %rsp
movq %rax, -0x20(%rbp)
movq 0x6642(%rip), %rdi      # 0xd278
callq 0x20c0
movq -0xd8(%rbp), %rdi
movq %rax, %rdx
movq %rdx, %rax
addq $0x64, %rax
addq $0x73, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0xd0(%rbp)
movq %rcx, %rsp
movq %rax, -0x28(%rbp)
movq 0x6651(%rip), %rdx      # 0xd2c0
movq 0x65ea(%rip), %rcx      # 0xd260
leaq 0x4268(%rip), %rsi      # 0xaee5
movb $0x0, %al
callq 0x2290
cmpb $0x0, 0x654d(%rip)      # 0xd1d8
je 0x6cb0
movq -0xe8(%rbp), %rdi
movq 0x6625(%rip), %rdx      # 0xd2c0
movq 0x65c6(%rip), %rcx      # 0xd268
leaq 0x423c(%rip), %rsi      # 0xaee5
movb $0x0, %al
callq 0x2290
cmpq $0x0, 0x6530(%rip)      # 0xd1e8
jle 0x6d1e
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, 0x651d(%rip)      # 0xd1e8
jge 0x6d1e
movq -0xe0(%rbp), %rdi
movq 0x65e5(%rip), %rdx      # 0xd2c0
movq 0x658e(%rip), %rcx      # 0xd270
leaq 0x41fc(%rip), %rsi      # 0xaee5
movb $0x0, %al
callq 0x2290
cmpb $0x0, 0x64e1(%rip)      # 0xd1d8
je 0x6d1c
movq -0xd0(%rbp), %rdi
movq 0x65b9(%rip), %rdx      # 0xd2c0
movq 0x656a(%rip), %rcx      # 0xd278
leaq 0x41d0(%rip), %rsi      # 0xaee5
movb $0x0, %al
callq 0x2290
jmp 0x6d1e
movq -0xd0(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq -0xe8(%rbp), %rdx
movq -0xd8(%rbp), %rsi
leaq 0x41af(%rip), %rdi      # 0xaef0
movq %rdi, -0x50(%rbp)
leaq 0x363f(%rip), %rdi      # 0xa38b
movq %rdi, -0x48(%rbp)
movq %rsi, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
leaq 0x418d(%rip), %rsi      # 0xaef0
movq %rsi, -0x70(%rbp)
leaq 0x361d(%rip), %rsi      # 0xa38b
movq %rsi, -0x68(%rbp)
movq %rdx, -0x60(%rbp)
movq $0x0, -0x58(%rbp)
leaq 0x416b(%rip), %rdx      # 0xaef0
movq %rdx, -0x90(%rbp)
leaq 0x35f8(%rip), %rdx      # 0xa38b
movq %rdx, -0x88(%rbp)
movq %rcx, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
leaq 0x4143(%rip), %rcx      # 0xaef0
movq %rcx, -0xb0(%rbp)
leaq 0x35d0(%rip), %rcx      # 0xa38b
movq %rcx, -0xa8(%rbp)
movq %rax, -0xa0(%rbp)
movq $0x0, -0x98(%rbp)
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2110
movl $0x0, -0xc4(%rbp)
callq 0x2320
movl %eax, -0xc8(%rbp)
cmpl $0x0, -0xc8(%rbp)
jne 0x6e15
leaq -0x50(%rbp), %rsi
leaq 0x40db(%rip), %rdi      # 0xaeeb
callq 0x2310
movl -0xc8(%rbp), %ecx
movslq -0xc4(%rbp), %rax
movl %ecx, -0xc0(%rbp,%rax,4)
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
cmpb $0x0, 0x6399(%rip)      # 0xd1d8
je 0x6e88
callq 0x2320
movl %eax, -0xc8(%rbp)
cmpl $0x0, -0xc8(%rbp)
jne 0x6e65
leaq -0x70(%rbp), %rsi
leaq 0x408b(%rip), %rdi      # 0xaeeb
callq 0x2310
movl -0xc8(%rbp), %ecx
movslq -0xc4(%rbp), %rax
movl %ecx, -0xc0(%rbp,%rax,4)
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
cmpq $0x0, 0x6358(%rip)      # 0xd1e8
jle 0x6f4c
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, 0x6341(%rip)      # 0xd1e8
jge 0x6f4c
callq 0x2320
movl %eax, -0xc8(%rbp)
cmpl $0x0, -0xc8(%rbp)
jne 0x6ed4
leaq -0x90(%rbp), %rsi
leaq 0x401c(%rip), %rdi      # 0xaeeb
callq 0x2310
movl -0xc8(%rbp), %ecx
movslq -0xc4(%rbp), %rax
movl %ecx, -0xc0(%rbp,%rax,4)
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
cmpb $0x0, 0x62da(%rip)      # 0xd1d8
je 0x6f4a
callq 0x2320
movl %eax, -0xc8(%rbp)
cmpl $0x0, -0xc8(%rbp)
jne 0x6f27
leaq -0xb0(%rbp), %rsi
leaq 0x3fc9(%rip), %rdi      # 0xaeeb
callq 0x2310
movl -0xc8(%rbp), %ecx
movslq -0xc4(%rbp), %rax
movl %ecx, -0xc0(%rbp,%rax,4)
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x6f4c
movl -0xc4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc4(%rbp)
cmpl $-0x1, -0xc4(%rbp)
jle 0x6fda
movslq -0xc4(%rbp), %rax
movl -0xc0(%rbp,%rax,4), %edi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x2220
movl %eax, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movslq -0xc4(%rbp), %rcx
cmpl -0xc0(%rbp,%rcx,4), %eax
jne 0x6faa
movl -0xc4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x6fd8
movq 0x6047(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movl -0xc0(%rbp), %edx
movl -0xc8(%rbp), %ecx
leaq 0x3f2c(%rip), %rsi      # 0xaef3
movb $0x0, %al
callq 0x2150
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x22a0
jmp 0x6f5b
movq -0x8(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)