// File: /workspace/github_c_makefile_star2_O3/DVaronos[P]AnLogProject1/logistic.c
// Function: TestData
void TestData(void* args){
	TestStruct* argument=(TestStruct*)args;
	double p;
	int j,ismatch;
	NList* N=argument->nodes[argument->who];
	NList* Nother;
	HVector* F=N->vector;
	HVector* S;
	HVector* Con;
	for(j=(argument->start) ; j < (argument->end) ; j++){
		Nother=argument->nodes[j];
		S=Nother->vector;	//Apothikevo to vector
		p=Newpred((argument->model->weight_array),(argument->model->b),F,S,1000);	//Vrisko to predict
		if((p<(argument->threshold)) || (p>(1-(argument->threshold)))){ //Ean einai isxhrh h pithanothta
			if(p<(argument->threshold)){
				ismatch=0;
			}else{
				ismatch=1;
			}
		 		if(SearchDiffList(N->clique,Nother->clique) == 0){	//an den uparxei  susxethsh metaksi twn camerwn
					pthread_mutex_lock(&(argument->Sheduler->lock)); //Klidwnei to mutex
					if( N->clique==NULL){	//Ean h klika den iparxei arxikopieite
						N->clique=CreateCList();
						InsertCList(N->clique,N->camera,N);
					}
					if(Nother->clique==NULL){//Ean h klika den iparxei arxikopieite
						Nother->clique=CreateCList();
						InsertCList(Nother->clique,Nother->camera,Nother);
					}
					if(ismatch){ //Ean match ==1 ta proionta teriazoun
						Nother->clique=AppendCList(N->clique,Nother->clique);
				  }else{ //Ean match==0 ta proionta den teriazoun
				    Diff(N->clique,Nother->clique);
				  }

					//Vriskoume to concatenation kai to isagoume sto input
					Con=VectorConcat(F,S,(argument->model->array_size)/2);

					argument->input->Cons=realloc(argument->input->Cons, (argument->input->size+1)*sizeof(HVector*));
	 				argument->input->Cons[argument->input->size] = Con;

					argument->input->matches=realloc(argument->input->matches, (argument->input->size+1)*sizeof(int));
	 				argument->input->matches[argument->input->size] = ismatch;
					argument->input->size++;
					pthread_mutex_unlock(&(argument->Sheduler->lock)); //Klidoma tou mutex

				}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movslq (%rdi), %r14
cmpl 0x4(%rdi), %r14d
jge 0x2fb8
movq %rdi, %rbx
movq 0x30(%rdi), %rax
movslq 0x8(%rdi), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
movq 0x18(%rbx), %rax
movq 0x30(%rbx), %rcx
movq (%rcx,%r14,8), %r13
movq 0x18(%r13), %r12
movq (%rax), %rdi
movsd 0x8(%rax), %xmm0
movq -0x50(%rbp), %rsi
movq %r12, %rdx
movl $0x3e8, %ecx            # imm = 0x3E8
callq 0x2965
movapd %xmm0, %xmm1
movsd 0x10(%rbx), %xmm2
ucomisd %xmm0, %xmm2
ja 0x2e6d
movsd 0x33b1(%rip), %xmm0     # 0x6210
subsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
jbe 0x2fa8
ucomisd %xmm1, %xmm2
setbe %r15b
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%r13), %rsi
movsd %xmm1, -0x48(%rbp)
movsd %xmm2, -0x40(%rbp)
callq 0x359c
testl %eax, %eax
jne 0x2fa8
movb %r15b, -0x29(%rbp)
movq 0x38(%rbx), %rdi
addq $0x18, %rdi
callq 0x1290
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x2ece
xorl %eax, %eax
callq 0x309c
movq -0x38(%rbp), %rdx
movq %rax, 0x10(%rdx)
movq (%rdx), %rsi
movq %rax, %rdi
callq 0x30c1
cmpq $0x0, 0x10(%r13)
movl $0x0, %r15d
movsd -0x48(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
jne 0x2f09
xorl %eax, %eax
callq 0x309c
movq %rax, 0x10(%r13)
movq (%r13), %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0x30c1
movsd -0x40(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
ucomisd %xmm0, %xmm1
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%r13), %rsi
jbe 0x2f22
callq 0x32a6
jmp 0x2f2b
callq 0x33b0
movq %rax, 0x10(%r13)
movb -0x29(%rbp), %al
movb %al, %r15b
movq 0x18(%rbx), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
shrl $0x1f, %edx
addl %eax, %edx
sarl %edx
movq -0x50(%rbp), %rdi
movq %r12, %rsi
callq 0x1f1e
movq %rax, %r12
movq 0x28(%rbx), %rax
movq (%rax), %rdi
movslq 0x10(%rax), %rax
leaq 0x8(,%rax,8), %rsi
callq 0x11c0
movq 0x28(%rbx), %rcx
movq %rax, (%rcx)
movslq 0x10(%rcx), %rdx
movq %r12, (%rax,%rdx,8)
movq 0x8(%rcx), %rdi
leaq 0x4(,%rdx,4), %rsi
callq 0x11c0
movq 0x28(%rbx), %rcx
movq %rax, 0x8(%rcx)
movslq 0x10(%rcx), %rdx
movl %r15d, (%rax,%rdx,4)
incl 0x10(%rcx)
movq 0x38(%rbx), %rdi
addq $0x18, %rdi
callq 0x1190
incq %r14
movslq 0x4(%rbx), %rax
cmpq %rax, %r14
jl 0x2e1f
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq