// File: /workspace/github_c_makefile_star2_O2/DVaronos[P]AnLogProject1/logistic.c
// Function: TestAndAdd
void TestAndAdd(Hash* H,Model* model,JobSheduler* Sheduler,Input** input,double threshold){
	Job* job;
	int i,sum,who=0,start=1,msize=10,curr=0;
	TestStruct** current=malloc(sizeof(TestStruct*)*msize);
	NList** nodes;
	MakeArrays(H,&sum,&nodes); //Ftiaxnw ena array me NList komvous gia kathe kamera pou den exei klika
	while(who<(sum-1)){ //Gia oles aftes is kameres
		if(curr<msize){	//Ean iparxei xoros sto array
	    current[curr]=malloc(sizeof(TestStruct)*Sheduler->num);
	  }else{//Allios resize to array kata 10
	    msize+=10;
	    current=realloc(current,msize*sizeof(TestStruct*));
	    current[curr]=malloc(sizeof(TestStruct)*Sheduler->num);
	  }
		for(i=0 ; i<Sheduler->num ; i++){	//Gia kathe thread ftiakse ena TestStruct kai arxikopieise to
			current[curr][i].who=who;
			current[curr][i].start=start;
			start+=1000;
			if(start>=(sum-1)) start=sum-1;
			current[curr][i].end=start;
			current[curr][i].model=model;
			current[curr][i].threshold=threshold;
			current[curr][i].input=*input;
			current[curr][i].hash=H;
			current[curr][i].Sheduler=Sheduler;
			current[curr][i].nodes=nodes;
			current[curr][i].sum=sum-1;
			job=JobCreate(TestData,(void*)(current[curr]+i)); //ftiakse ena job
			JSAddWork(Sheduler,job); //Dose to job sto Sheduler
			start++;
			if(start==sum){
				who++;
				if(who==sum-1) break;
				start=who+1;
			}
		}
		JSWaitalltasks(Sheduler); //perimene na teliosoun ta threads
		curr++;
	}
	for(int k=0 ; k<curr ; k++){
		free(current[k]);
	}
	free(current);
	free(nodes);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movsd %xmm0, -0x78(%rbp)
movq %rcx, -0x70(%rbp)
movq %rdx, %rbx
movq %rsi, -0x68(%rbp)
movq %rdi, %r14
pushq $0x50
popq %rdi
callq 0x11a0
movq %rax, %r13
leaq -0x8c(%rbp), %r15
leaq -0x58(%rbp), %rdx
movq %r14, -0x60(%rbp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x2b3b
movl (%r15), %eax
leal -0x1(%rax), %ecx
movl %ecx, -0x30(%rbp)
movq %rax, -0x40(%rbp)
addl $-0x2, %eax
movl %eax, -0x34(%rbp)
pushq $0xa
popq %rax
movl %eax, -0x2c(%rbp)
pushq $0x1
popq %r12
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %rbx, -0x48(%rbp)
cmpl -0x30(%rbp), %r15d
jge 0x2b06
movslq -0x2c(%rbp), %rax
cmpq %rax, %r14
jl 0x29d5
leal 0xa(%rax), %ecx
movl %ecx, -0x2c(%rbp)
leaq 0x50(,%rax,8), %rsi
movq %r13, %rdi
callq 0x11c0
movq %rax, %r13
movslq 0xa8(%rbx), %rbx
movq %rbx, %rdi
shlq $0x6, %rdi
callq 0x11a0
movq %r13, -0x50(%rbp)
movq %rax, (%r13,%r14,8)
movq -0x58(%rbp), %rax
movq %rax, -0x80(%rbp)
xorl %r13d, %r13d
xorl %ecx, %ecx
movslq %ebx, %rax
cmpq %rax, %rcx
jge 0x2ae2
movq %rcx, -0x88(%rbp)
movq -0x50(%rbp), %rdx
movq (%rdx,%r14,8), %rax
movl %r15d, 0x8(%rax,%r13)
movl %r12d, (%rax,%r13)
addl $0x3e8, %r12d           # imm = 0x3E8
movl -0x30(%rbp), %edi
cmpl %edi, %r12d
cmovgel %edi, %r12d
movl %r12d, 0x4(%rax,%r13)
movq -0x68(%rbp), %rcx
movq %rcx, 0x18(%rax,%r13)
movq (%rdx,%r14,8), %rax
movsd -0x78(%rbp), %xmm0
movsd %xmm0, 0x10(%rax,%r13)
movq -0x70(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, 0x28(%rax,%r13)
movq (%rdx,%r14,8), %rax
movq -0x60(%rbp), %rcx
movq %rcx, 0x20(%rax,%r13)
movq (%rdx,%r14,8), %rax
movq -0x48(%rbp), %rbx
movq %rbx, 0x38(%rax,%r13)
movq (%rdx,%r14,8), %rax
movq -0x80(%rbp), %rcx
movq %rcx, 0x30(%rax,%r13)
movq (%rdx,%r14,8), %rsi
movl %edi, 0xc(%rsi,%r13)
addq %r13, %rsi
leaq 0x13f(%rip), %rdi       # 0x2bd6
callq 0x4ce8
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4edd
incl %r12d
cmpl -0x40(%rbp), %r12d
jne 0x2ac3
leal 0x1(%r15), %eax
cmpl -0x34(%rbp), %r15d
je 0x2ae8
addl $0x2, %r15d
movl %r15d, %r12d
jmp 0x2ac6
movl %r15d, %eax
movq -0x88(%rbp), %rcx
incq %rcx
movl 0xa8(%rbx), %ebx
addq $0x40, %r13
movl %eax, %r15d
jmp 0x29fe
movq -0x48(%rbp), %rbx
jmp 0x2af2
movl %eax, %r15d
movq -0x40(%rbp), %rax
movl %eax, %r12d
movq %rbx, %rdi
callq 0x4f2e
incq %r14
movq -0x50(%rbp), %r13
jmp 0x29a9
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0x2b1c
movq (%r13,%rbx,8), %rdi
callq 0x1030
incq %rbx
jmp 0x2b08
movq %r13, %rdi
callq 0x1030
movq -0x58(%rbp), %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1030