// File: /workspace/github_c_makefile_star2_O3/jiqingxiaoxi[P]RPA/RPA.c
// Function: check_common_probe
int check_common_probe(struct Primer *F,struct Primer *R,struct ExoProbe *Probe,int *result,int common_num)
{
        int i,*temp;
        struct Node *c_F,*c_R,*c_Probe,*b_R,*b_Probe;

	temp=(int *)malloc(common_num*sizeof(int));
	for(i=0;i<common_num;i++)
		temp[i]=0;
//plus
	b_R=R->common;
	b_Probe=Probe->common;
        for(c_F=F->common;c_F;c_F=c_F->next)
        {
                if(c_F->plus!=1)
                        continue;
                if(result[c_F->gi]==0)
                        continue;
		if(temp[c_F->gi])
			continue;
                for(c_R=b_R;c_R;c_R=c_R->next)
                {
			if(c_R->gi<c_F->gi)
                        {
                                b_R=c_R->next;
                                continue;
                        }
                        if(c_R->gi>c_F->gi)
                                break;
                        if(c_R->minus!=1)
                                continue;
                        if(c_R->pos+R->len-c_F->pos<100)
                        {
                                b_R=c_R->next;
                                continue;
                        }
                        if(c_R->pos+R->len-c_F->pos>200)
				break;
                        for(c_Probe=b_Probe;c_Probe;c_Probe=c_Probe->next)
                        {
                                if(c_Probe->gi<c_F->gi)
				{
					b_Probe=c_Probe->next;
                                        continue;
				}
				if(c_Probe->gi>c_F->gi)
					break;
				if(c_Probe->pos<=c_F->pos)
				{
					b_Probe=c_Probe->next;
					continue;
				}
				if(c_Probe->pos>c_R->pos)
					break;
				if(c_Probe->plus==1)
				{
					if(c_F->pos+F->len-c_Probe->pos>27)
						continue;
					if(c_Probe->pos+Probe->len>c_R->pos)
						continue;
				}
				else
				{
					if(c_F->pos+F->len>c_Probe->pos)
						continue;
					if(c_Probe->pos+Probe->len>c_R->pos+R->len)
						continue;
					if(c_Probe->pos+Probe->len-c_R->pos>27)
						continue;
				}
				temp[c_F->gi]=1;
				break;
                        }
			if(temp[c_F->gi]==1)
				break;
                }
        }
//minus
	b_R=R->common;
	b_Probe=Probe->common;
        for(c_F=F->common;c_F;c_F=c_F->next)
        {
                if(c_F->minus!=1)
                        continue;
                if(result[c_F->gi]==0)
                        continue;  
		if(temp[c_F->gi])
			continue;
                for(c_R=b_R;c_R;c_R=c_R->next)
                {
			if(c_R->gi<c_F->gi)
			{
				b_R=c_R->next;
				continue;
			}
			if(c_R->gi>c_F->gi)
				break;
			if(c_F->pos+F->len-c_R->pos<100)
                                break;
                        if(c_F->pos+F->len-c_R->pos>200)
                        {
                                b_R=c_R->next;
                                continue;
                        }
                        if(c_R->plus!=1)
                                continue;
                        for(c_Probe=b_Probe;c_Probe;c_Probe=c_Probe->next)
                        {
				if(c_Probe->gi<c_F->gi)
				{
					b_Probe=c_Probe->next;
					continue;
				}
				if(c_Probe->gi>c_F->gi)
					break;
				if(c_Probe->pos-c_F->pos<-200)
				{
					b_Probe=c_Probe->next;
					continue;
				}
				if(c_Probe->pos<c_R->pos)
					continue;

				if(c_Probe->pos>c_F->pos)
					break;
				if(c_Probe->plus==1)
                                {
                                        if(c_R->pos+R->len-c_Probe->pos>27)
                                                continue;
                                        if(c_Probe->pos+Probe->len>c_F->pos)
                                                continue;
                                }
                                else
                                {
                                        if(c_R->pos+R->len>c_Probe->pos)
                                                continue;
                                        if(c_Probe->pos+Probe->len>c_F->pos+F->len)
                                                continue;
                                        if(c_Probe->pos+Probe->len-c_F->pos>27)
                                                continue;
                                }
				temp[c_F->gi]=1;
				break;
                        }
			if(temp[c_F->gi]==1)
				break;
                }
        }
        for(i=0;i<common_num;i++)
        {
                if(result[i]&&temp[i]==0)
			return 0;
        }
        return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %r15d
movq %rcx, -0x30(%rbp)
movq %rdx, -0x50(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdi, -0x58(%rbp)
movslq %r8d, %rbx
leaq (,%rbx,4), %rdi
callq 0x11a0
movq %rax, %r14
movl %r15d, -0x5c(%rbp)
movl %r15d, %r15d
testl %ebx, %ebx
jle 0xc9a9
leaq (,%r15,4), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x1100
movq %r15, -0x68(%rbp)
movq %r14, -0x48(%rbp)
movq -0x58(%rbp), %rax
movq 0x30(%rax), %rax
testq %rax, %rax
movq -0x30(%rbp), %rbx
movq -0x40(%rbp), %r14
je 0xcc70
movq 0x30(%r14), %r15
movq -0x50(%rbp), %rcx
movq 0x20(%rcx), %r13
movq %rax, %rsi
movq %r13, %r11
movq %r15, %rdi
cmpl $0x1, 0x8(%rsi)
jne 0xcb1b
movslq 0x4(%rsi), %r9
cmpl $0x0, (%rbx,%r9,4)
je 0xcb1b
movq -0x48(%rbp), %rcx
cmpl $0x0, (%rcx,%r9,4)
jne 0xcb1b
testq %rdi, %rdi
je 0xcb1b
movq %rdi, %r10
cmpl %r9d, 0x4(%r10)
jge 0xca22
movq 0x10(%r10), %rdi
jmp 0xcb0e
jg 0xcb1b
cmpl $0x1, 0xc(%r10)
jne 0xcb0e
movl (%r10), %ecx
movl 0x4(%r14), %r12d
movl %ecx, -0x34(%rbp)
addl %ecx, %r12d
movl (%rsi), %ecx
movl %r12d, %r8d
subl %ecx, %r8d
cmpl $0x64, %r8d
jl 0xca19
cmpl $0xc8, %r8d
ja 0xcb1b
testq %r11, %r11
je 0xcb0b
movq %r11, %r8
movl 0x4(%r8), %ebx
cmpl %r9d, %ebx
jl 0xcabd
cmpl %r9d, %ebx
jg 0xcb01
movl (%r8), %ebx
movl %ecx, %r14d
subl %ebx, %r14d
jge 0xcabd
cmpl -0x34(%rbp), %ebx
jg 0xcb01
movq %rax, %rdx
movq %rdi, %rax
movq %r13, %rdi
movq %r15, %r13
cmpl $0x1, 0x8(%r8)
movq -0x58(%rbp), %r15
movl 0x4(%r15), %r15d
jne 0xcac3
addl %r15d, %r14d
cmpl $0x1b, %r14d
jg 0xcacb
movq -0x50(%rbp), %r14
addl 0x4(%r14), %ebx
cmpl -0x34(%rbp), %ebx
movq %r13, %r15
jmp 0xcae9
movq 0x10(%r8), %r11
jmp 0xcaf4
addl %ecx, %r15d
cmpl %ebx, %r15d
jle 0xcad3
movq %r13, %r15
movq %rdi, %r13
jmp 0xcaee
movq -0x50(%rbp), %r14
addl 0x4(%r14), %ebx
cmpl %r12d, %ebx
movq %r13, %r15
jg 0xcace
subl -0x34(%rbp), %ebx
cmpl $0x1b, %ebx
movq %rdi, %r13
jle 0xcb2d
movq %rax, %rdi
movq %rdx, %rax
movq 0x10(%r8), %r8
testq %r8, %r8
jne 0xca67
movq -0x30(%rbp), %rbx
movq -0x40(%rbp), %r14
jmp 0xcb0e
xorl %r11d, %r11d
movq 0x10(%r10), %r10
testq %r10, %r10
jne 0xca13
movq 0x10(%rsi), %rsi
testq %rsi, %rsi
jne 0xc9df
jmp 0xcc67
movq -0x48(%rbp), %rcx
movl $0x1, (%rcx,%r9,4)
movq -0x30(%rbp), %rbx
movq -0x40(%rbp), %r14
movq %rax, %rdi
movq %rdx, %rax
jmp 0xcb1b
cmpl $0x1, 0xc(%rax)
jne 0xcc63
movslq 0x4(%rax), %rsi
cmpl $0x0, (%rbx,%rsi,4)
je 0xcc63
movq -0x48(%rbp), %rcx
cmpl $0x0, (%rcx,%rsi,4)
jne 0xcc63
testq %r15, %r15
je 0xcc63
movq %r15, %rdi
cmpl %esi, 0x4(%rdi)
jl 0xcbae
jg 0xcc63
movl (%rax), %r8d
movq -0x58(%rbp), %rcx
movl 0x4(%rcx), %r9d
addl %r8d, %r9d
movl (%rdi), %r10d
movl %r9d, %ecx
subl %r10d, %ecx
cmpl $0x64, %ecx
jl 0xcc63
cmpl $0xc8, %ecx
jbe 0xcbc0
movq 0x10(%rdi), %r15
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
jne 0xcb7b
jmp 0xcc63
cmpl $0x1, 0x8(%rdi)
jne 0xcbb2
testq %r13, %r13
je 0xcc50
movq %r13, %r11
cmpl %esi, 0x4(%r11)
jl 0xcbea
jg 0xcbb2
movl (%r11), %edx
movl %edx, %ecx
subl %r8d, %ecx
cmpl $0xffffff38, %ecx       # imm = 0xFFFFFF38
jge 0xcbf9
movq 0x10(%r11), %r13
movq 0x10(%r11), %r11
testq %r11, %r11
jne 0xcbd2
jmp 0xcbb2
movl %r10d, %ecx
subl %edx, %ecx
jg 0xcbee
cmpl %r8d, %edx
jg 0xcbb2
cmpl $0x1, 0x8(%r11)
movl 0x4(%r14), %ebx
jne 0xcc29
addl %ebx, %ecx
cmpl $0x1b, %ecx
jg 0xcc30
movq -0x50(%rbp), %rcx
addl 0x4(%rcx), %edx
cmpl %r8d, %edx
movq -0x30(%rbp), %rbx
jg 0xcbee
jmp 0xcc58
addl %r10d, %ebx
cmpl %edx, %ebx
jle 0xcc36
movq -0x30(%rbp), %rbx
jmp 0xcbee
movq -0x50(%rbp), %rcx
addl 0x4(%rcx), %edx
cmpl %r9d, %edx
movq -0x30(%rbp), %rbx
jg 0xcbee
subl %r8d, %edx
cmpl $0x1b, %edx
jg 0xcbee
jmp 0xcc58
xorl %r13d, %r13d
jmp 0xcbb2
movq -0x48(%rbp), %rcx
movl $0x1, (%rcx,%rsi,4)
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xcb49
movl $0x1, %eax
cmpl $0x0, -0x5c(%rbp)
jle 0xcc9d
xorl %ecx, %ecx
movq -0x48(%rbp), %rdx
movq -0x68(%rbp), %rsi
cmpl $0x0, (%rbx,%rcx,4)
je 0xcc91
cmpl $0x0, (%rdx,%rcx,4)
je 0xcc9b
incq %rcx
cmpq %rcx, %rsi
jne 0xcc85
jmp 0xcc9d
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq