// File: /workspace/github_c_makefile_star2_O1/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
movl %r8d, %r12d
movq %rcx, -0x48(%rbp)
movq %rdx, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdi, %r15
movslq %r8d, %rbx
leaq (,%rbx,4), %rdi
callq 0x1190
movq %rax, %r14
movl %r12d, -0x4c(%rbp)
movl %r12d, %r12d
testl %ebx, %ebx
jle 0xcb47
leaq (,%r12,4), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x1100
movq %r12, -0x58(%rbp)
movq %r14, -0x30(%rbp)
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x20(%rcx), %r13
movq 0x30(%r15), %rdx
testq %rdx, %rdx
je 0xcc98
movq %r13, %rcx
movq %rax, %rdi
cmpl $0x1, 0x8(%rdx)
jne 0xcc8b
movslq 0x4(%rdx), %r8
movq -0x48(%rbp), %rsi
cmpl $0x0, (%rsi,%r8,4)
je 0xcc8b
movq -0x30(%rbp), %rsi
cmpl $0x0, (%rsi,%r8,4)
jne 0xcc8b
testq %rdi, %rdi
je 0xcc8b
movq %rdi, %r9
cmpl %r8d, 0x4(%r9)
jge 0xcbb9
movq 0x10(%r9), %rdi
jmp 0xcc7e
jg 0xcc8b
cmpl $0x1, 0xc(%r9)
jne 0xcc7e
movl (%r9), %r10d
movq -0x40(%rbp), %rsi
movl 0x4(%rsi), %r11d
addl %r10d, %r11d
movl (%rdx), %r14d
movl %r11d, %esi
subl %r14d, %esi
cmpl $0x64, %esi
jl 0xcbb0
cmpl $0xc8, %esi
jg 0xcc8b
testq %rcx, %rcx
je 0xcc73
movq %rcx, %rsi
movl 0x4(%rsi), %ebx
cmpl %r8d, %ebx
jl 0xcc36
cmpl %r8d, %ebx
jg 0xcc73
movl (%rsi), %ebx
movl %r14d, %r12d
subl %ebx, %r12d
jge 0xcc36
cmpl %r10d, %ebx
jg 0xcc73
cmpl $0x1, 0x8(%rsi)
jne 0xcc45
addl 0x4(%r15), %r12d
cmpl $0x1b, %r12d
jg 0xcc3a
movq -0x38(%rbp), %r12
addl 0x4(%r12), %ebx
cmpl %r10d, %ebx
jg 0xcc3a
jmp 0xcc67
movq 0x10(%rsi), %rcx
movq 0x10(%rsi), %rsi
testq %rsi, %rsi
jne 0xcbfa
jmp 0xcc73
movl 0x4(%r15), %r12d
addl %r14d, %r12d
cmpl %ebx, %r12d
jg 0xcc3a
movq -0x38(%rbp), %r12
addl 0x4(%r12), %ebx
cmpl %r11d, %ebx
jg 0xcc3a
subl %r10d, %ebx
cmpl $0x1b, %ebx
jg 0xcc3a
movq -0x30(%rbp), %rsi
movl $0x1, (%rsi,%r8,4)
movq -0x30(%rbp), %rsi
cmpl $0x1, (%rsi,%r8,4)
je 0xcc8b
movq 0x10(%r9), %r9
testq %r9, %r9
jne 0xcbaa
movq 0x10(%rdx), %rdx
testq %rdx, %rdx
jne 0xcb72
movq 0x30(%r15), %rdx
testq %rdx, %rdx
je 0xcdcf
movq -0x40(%rbp), %r14
cmpl $0x1, 0xc(%rdx)
jne 0xcdc2
movslq 0x4(%rdx), %rsi
movq -0x48(%rbp), %rcx
cmpl $0x0, (%rcx,%rsi,4)
je 0xcdc2
movq -0x30(%rbp), %rcx
cmpl $0x0, (%rcx,%rsi,4)
jne 0xcdc2
testq %rax, %rax
je 0xcdc2
movq %rax, %rdi
cmpl %esi, 0x4(%rdi)
jl 0xcd0e
jg 0xcdc2
movl (%rdx), %r8d
movl 0x4(%r15), %r9d
addl %r8d, %r9d
movl (%rdi), %r10d
movl %r9d, %ecx
subl %r10d, %ecx
cmpl $0x64, %ecx
jl 0xcdc2
cmpl $0xc8, %ecx
jle 0xcd20
movq 0x10(%rdi), %rax
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
jne 0xccdf
jmp 0xcdc2
cmpl $0x1, 0x8(%rdi)
jne 0xcd12
testq %r13, %r13
je 0xcdb4
movq %r13, %r11
movl 0x4(%r11), %ecx
cmpl %esi, %ecx
jl 0xcd4e
cmpl %esi, %ecx
jg 0xcdb4
movl (%r11), %ecx
movl %ecx, %ebx
subl %r8d, %ebx
cmpl $0xffffff38, %ebx       # imm = 0xFFFFFF38
jge 0xcd5d
movq 0x10(%r11), %r13
movq 0x10(%r11), %r11
testq %r11, %r11
jne 0xcd32
jmp 0xcdb4
movl %r10d, %ebx
subl %ecx, %ebx
jg 0xcd52
cmpl %r8d, %ecx
jg 0xcdb4
cmpl $0x1, 0x8(%r11)
jne 0xcd87
addl 0x4(%r14), %ebx
cmpl $0x1b, %ebx
jg 0xcd52
movq -0x38(%rbp), %rbx
addl 0x4(%rbx), %ecx
cmpl %r8d, %ecx
jg 0xcd52
jmp 0xcda9
movq -0x40(%rbp), %rbx
movl 0x4(%rbx), %ebx
addl %r10d, %ebx
cmpl %ecx, %ebx
jg 0xcd52
movq -0x38(%rbp), %rbx
addl 0x4(%rbx), %ecx
cmpl %r9d, %ecx
jg 0xcd52
subl %r8d, %ecx
cmpl $0x1b, %ecx
jg 0xcd52
movq -0x30(%rbp), %rcx
movl $0x1, (%rcx,%rsi,4)
movq -0x30(%rbp), %rcx
cmpl $0x1, (%rcx,%rsi,4)
jne 0xcd12
movq 0x10(%rdx), %rdx
testq %rdx, %rdx
jne 0xcca9
movl $0x1, %eax
cmpl $0x0, -0x4c(%rbp)
jle 0xce00
xorl %ecx, %ecx
movq -0x30(%rbp), %rsi
movq -0x58(%rbp), %rdi
movq -0x48(%rbp), %rdx
cmpl $0x0, (%rdx,%rcx,4)
je 0xcdf4
cmpl $0x0, (%rsi,%rcx,4)
je 0xcdfe
incq %rcx
cmpq %rcx, %rdi
jne 0xcde8
jmp 0xce00
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq