// File: /workspace/github_c_makefile_star2_O1/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, -0x30(%rbp)
movq %rsi, -0x68(%rbp)
movq %rdi, %rbx
movl $0x50, %edi
callq 0x11a0
movq %rax, %r15
leaq -0x38(%rbp), %r12
leaq -0x58(%rbp), %rdx
movq %rbx, -0x60(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2d3e
xorl %r14d, %r14d
cmpl $0x2, (%r12)
jl 0x2d03
xorl %r14d, %r14d
movl $0x1, %r12d
movl $0xa, -0x34(%rbp)
xorl %ecx, %ecx
movq %rcx, %r13
movslq -0x34(%rbp), %rax
cmpq %rax, %r14
jl 0x2bad
leal 0xa(%rax), %ecx
movl %ecx, -0x34(%rbp)
leaq 0x50(,%rax,8), %rsi
movq %r15, %rdi
callq 0x11c0
movq %rax, %r15
movq -0x30(%rbp), %rax
movslq 0xa8(%rax), %rbx
movq %rbx, %rdi
shlq $0x6, %rdi
callq 0x11a0
movq %r15, -0x50(%rbp)
movq %r14, -0x48(%rbp)
movq %rax, (%r15,%r14,8)
testq %rbx, %rbx
jle 0x2cde
movl -0x38(%rbp), %eax
leal -0x1(%rax), %ecx
movl %ecx, -0x40(%rbp)
movq -0x58(%rbp), %rcx
movq %rcx, -0x80(%rbp)
movq %rax, -0x88(%rbp)
addl $-0x2, %eax
movl %eax, -0x3c(%rbp)
xorl %ebx, %ebx
xorl %r15d, %r15d
movq -0x30(%rbp), %rdi
movq %r13, %r14
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rsi
movq (%rdx,%rsi,8), %rax
movl %r14d, 0x8(%rax,%rbx)
movl %r12d, (%rax,%rbx)
addl $0x3e8, %r12d           # imm = 0x3E8
movl -0x40(%rbp), %r8d
cmpl %r8d, %r12d
cmovgel %r8d, %r12d
movl %r12d, 0x4(%rax,%rbx)
movq -0x68(%rbp), %rcx
movq %rcx, 0x18(%rax,%rbx)
movq (%rdx,%rsi,8), %rax
movsd -0x78(%rbp), %xmm0
movsd %xmm0, 0x10(%rax,%rbx)
movq -0x70(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, 0x28(%rax,%rbx)
movq (%rdx,%rsi,8), %rax
movq -0x60(%rbp), %rcx
movq %rcx, 0x20(%rax,%rbx)
movq (%rdx,%rsi,8), %rax
movq %rdi, 0x38(%rax,%rbx)
movq (%rdx,%rsi,8), %rax
movq -0x80(%rbp), %rcx
movq %rcx, 0x30(%rax,%rbx)
movq (%rdx,%rsi,8), %rsi
movl %r8d, 0xc(%rsi,%rbx)
addq %rbx, %rsi
movq %rdi, %r13
leaq 0x168(%rip), %rdi       # 0x2df4
callq 0x5434
movq %r13, %rdi
movq %rax, %rsi
callq 0x565c
incl %r12d
cmpl -0x88(%rbp), %r12d
jne 0x2cbe
leal 0x1(%r14), %r13d
cmpl -0x3c(%rbp), %r14d
je 0x2cde
addl $0x2, %r14d
movl %r14d, %r12d
movl %r13d, %r14d
jmp 0x2cc1
movl %r14d, %r13d
movq -0x30(%rbp), %rdi
incq %r15
movslq 0xa8(%rdi), %rax
addq $0x40, %rbx
cmpq %rax, %r15
jl 0x2c03
jmp 0x2ce2
movq -0x30(%rbp), %rdi
callq 0x56ad
movq -0x48(%rbp), %r14
incq %r14
movl -0x38(%rbp), %eax
decl %eax
movl %r13d, %ecx
cmpl %eax, %r13d
movq -0x50(%rbp), %r15
jl 0x2b88
testl %r14d, %r14d
je 0x2d1f
movl %r14d, %ebx
xorl %r14d, %r14d
movq (%r15,%r14,8), %rdi
callq 0x1030
incq %r14
cmpq %r14, %rbx
jne 0x2d0e
movq %r15, %rdi
callq 0x1030
movq -0x58(%rbp), %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1030