// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %rcx, -0x50(%rbp)
movq %rdx, -0x30(%rbp)
movq %rsi, -0x48(%rbp)
movq %rdi, -0x58(%rbp)
movslq %r8d, %rbx
leaq (,%rbx,4), %rdi
callq 0x1190
movq %rbx, %rdx
movq %rax, %r12
xorl %ecx, %ecx
testl %edx, %edx
cmovlel %ecx, %edx
cmpq %rcx, %rdx
je 0xb719
andl $0x0, (%r12,%rcx,4)
incq %rcx
jmp 0xb70a
movq %rdx, -0x60(%rbp)
movq -0x48(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x58(%rbp), %rax
leaq 0x30(%rax), %rcx
movq %rcx, %rdi
movq %rsi, %r10
movq %rdx, %r9
movq %r12, -0x40(%rbp)
movq (%rdi), %rdi
testq %rdi, %rdi
je 0xb97b
cmpl $0x1, 0x8(%rdi)
jne 0xb76a
movslq 0x4(%rdi), %r11
movq -0x50(%rbp), %rax
cmpl $0x0, (%rax,%r11,4)
je 0xb76a
cmpl $0x0, (%r12,%r11,4)
je 0xb776
movq %r9, %r14
addq $0x10, %rdi
movq %r14, %r9
jmp 0xb742
movq %r10, -0x38(%rbp)
testq %r10, %r10
je 0xb858
movl 0x4(%r10), %eax
cmpl %r11d, %eax
jge 0xb799
movq 0x10(%r10), %rax
movq %rax, -0x38(%rbp)
jmp 0xb84f
cmpl %r11d, %eax
jg 0xb858
cmpl $0x1, 0xc(%r10)
jne 0xb84f
movl (%r10), %r15d
movq -0x48(%rbp), %rax
movl 0x4(%rax), %ebx
addl %r15d, %ebx
movl (%rdi), %r8d
movl %ebx, %eax
subl %r8d, %eax
cmpl $0x64, %eax
jl 0xb78c
cmpl $0xc8, %eax
ja 0xb858
movq %r9, %r14
testq %r9, %r9
je 0xb848
movl 0x4(%r9), %eax
cmpl %r11d, %eax
jl 0xb81e
cmpl %r11d, %eax
jg 0xb848
movl (%r9), %r12d
movl %r8d, %r13d
subl %r12d, %r13d
jge 0xb81e
cmpl %r15d, %r12d
jg 0xb848
cmpl $0x1, 0x8(%r9)
movq -0x58(%rbp), %rax
movl 0x4(%rax), %eax
jne 0xb828
addl %eax, %r13d
cmpl $0x1b, %r13d
jg 0xb822
movq -0x30(%rbp), %rax
addl 0x4(%rax), %r12d
cmpl %r15d, %r12d
jg 0xb822
jmp 0xb864
movq 0x10(%r9), %r14
movq 0x10(%r9), %r9
jmp 0xb7d5
addl %r8d, %eax
cmpl %r12d, %eax
jg 0xb822
movq -0x30(%rbp), %rax
addl 0x4(%rax), %r12d
cmpl %ebx, %r12d
jg 0xb822
subl %r15d, %r12d
cmpl $0x1b, %r12d
jg 0xb822
jmp 0xb864
movq %r14, %r9
movq -0x40(%rbp), %r12
movq 0x10(%r10), %r10
jmp 0xb77a
movq %r9, %r14
movq -0x38(%rbp), %r10
jmp 0xb76d
movq -0x40(%rbp), %r12
movl $0x1, (%r12,%r11,4)
jmp 0xb85b
cmpl $0x1, 0xc(%rcx)
jne 0xb88e
movslq 0x4(%rcx), %r8
movq -0x50(%rbp), %rax
cmpl $0x0, (%rax,%r8,4)
je 0xb88e
cmpl $0x0, (%r12,%r8,4)
je 0xb8a3
movq %rsi, %rdi
movq %rdx, %r9
addq $0x10, %rcx
movq %rdi, %rsi
movq %r9, %rdx
jmp 0xb97b
movq %rsi, %rdi
testq %rsi, %rsi
je 0xb891
movl 0x4(%rsi), %eax
cmpl %r8d, %eax
jl 0xb8db
cmpl %r8d, %eax
jg 0xb891
movl (%rcx), %r10d
movq -0x58(%rbp), %rax
movl 0x4(%rax), %r11d
addl %r10d, %r11d
movl (%rsi), %r14d
movl %r11d, %eax
subl %r14d, %eax
cmpl $0x64, %eax
jl 0xb891
cmpl $0xc8, %eax
jbe 0xb8e5
movq 0x10(%rsi), %rdi
movq 0x10(%rsi), %rsi
jmp 0xb8a6
cmpl $0x1, 0x8(%rsi)
jne 0xb8df
movq %rdx, %r9
testq %rdx, %rdx
je 0xb966
movl 0x4(%rdx), %eax
cmpl %r8d, %eax
jl 0xb90e
cmpl %r8d, %eax
jg 0xb966
movl (%rdx), %ebx
movl %ebx, %eax
subl %r10d, %eax
cmpl $0xffffff38, %eax       # imm = 0xFFFFFF38
jge 0xb918
movq 0x10(%rdx), %r9
movq 0x10(%rdx), %rdx
jmp 0xb8ee
movl %r14d, %eax
subl %ebx, %eax
jg 0xb912
cmpl %r10d, %ebx
jg 0xb966
cmpl $0x1, 0x8(%rdx)
movq -0x48(%rbp), %r15
movl 0x4(%r15), %r15d
jne 0xb948
addl %r15d, %eax
cmpl $0x1b, %eax
jg 0xb912
movq -0x30(%rbp), %rax
addl 0x4(%rax), %ebx
cmpl %r10d, %ebx
jg 0xb912
jmp 0xb96e
addl %r14d, %r15d
cmpl %ebx, %r15d
jg 0xb912
movq -0x30(%rbp), %rax
addl 0x4(%rax), %ebx
cmpl %r11d, %ebx
jg 0xb912
subl %r10d, %ebx
cmpl $0x1b, %ebx
jg 0xb912
jmp 0xb96e
movq %r9, %rdx
jmp 0xb8df
movl $0x1, (%r12,%r8,4)
jmp 0xb894
movq (%rcx), %rcx
testq %rcx, %rcx
jne 0xb872
xorl %edx, %edx
pushq $0x1
popq %rcx
movq -0x60(%rbp), %rsi
movq -0x50(%rbp), %rax
cmpq %rdx, %rsi
je 0xb9ad
cmpl $0x0, (%rax,%rdx,4)
je 0xb9a6
cmpl $0x0, (%r12,%rdx,4)
je 0xb9ab
incq %rdx
jmp 0xb994
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq