// File: /workspace/github_c_makefile_star2_O0/DVaronos[P]AnLogProject1/logistic.c
// Function: Testing
void Testing(char* filename,Model* model,Hash* H){
  FILE* fptr = fopen(filename, "r");
  int tcount,match;
  char line[300];
  char* token=NULL;
  char* first;
  char* second;
  double p;
  double correct=0,sum=0;
  HVector* F;
  HVector* S;
  HVector* Con;
  while (fgets(line,sizeof(line),fptr)){//Diavazei to csv file grami grami
    token=strtok(line,",");
    if(!strcmp(token,"left_spec_id"))  continue;
    tcount=0;
    while(token!=NULL){//apothikefsi tou kathe stixoiou ths gramhs se metavlites
     tcount++;
     switch(tcount){
       case 1://ean tcount==1 tote to token isoute me to proto proion
         first=malloc(sizeof(char)*(strlen(token)+1));
         strcpy(first,token);
         break;
       case 2://ean tcount==2 tote to token isoute me to deftero proion
         second=malloc(sizeof(char)*(strlen(token)+1));
         strcpy(second,token);
         break;
       case 3://Ean tcount==3 tote to token einai 0 h 1 analoga to an teriazoun ta proionta
         match=atoi(token);
         break;
     }
     token=strtok(NULL,",");
   }
   F=GetCameraVector(first,H);
   S=GetCameraVector(second,H);
   Con=VectorConcat(F,S,(model->array_size)/2);
   p=Predict(&(model->weight_array),&(model->b),Con);
	 double cor;
   cor=1-p;
   sum++;
   if(cor>0.4){
     if(!match) correct++;
   }else{
     if(match)correct++;
   }
   free(first);
   free(second);
	 free(Con);
 }
 fclose(fptr);
 printf("Success rate is:%f\n",correct/sum);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x4f44(%rip), %rsi      # 0x8016
callq 0x11f0
movq %rax, -0x20(%rbp)
movq $0x0, -0x168(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x188(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x190(%rbp)
leaq -0x160(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x12c, %esi            # imm = 0x12C
callq 0x1100
cmpq $0x0, %rax
je 0x3359
leaq -0x160(%rbp), %rdi
leaq 0x51c4(%rip), %rsi      # 0x82ed
callq 0x1210
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rdi
leaq 0x4fdd(%rip), %rsi      # 0x8120
callq 0x1120
cmpl $0x0, %eax
jne 0x314f
jmp 0x30fc
movl $0x0, -0x24(%rbp)
cmpq $0x0, -0x168(%rbp)
je 0x3231
movl -0x24(%rbp), %eax
incl %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x1b4(%rbp)
subl $0x1, %eax
je 0x3196
jmp 0x317c
movl -0x1b4(%rbp), %eax
subl $0x2, %eax
je 0x31ce
jmp 0x3189
movl -0x1b4(%rbp), %eax
subl $0x3, %eax
je 0x3206
jmp 0x3215
movq -0x168(%rbp), %rdi
callq 0x10a0
movq %rax, %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x1190
movq %rax, -0x170(%rbp)
movq -0x170(%rbp), %rdi
movq -0x168(%rbp), %rsi
callq 0x1050
jmp 0x3215
movq -0x168(%rbp), %rdi
callq 0x10a0
movq %rax, %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x1190
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rdi
movq -0x168(%rbp), %rsi
callq 0x1050
jmp 0x3215
movq -0x168(%rbp), %rdi
callq 0x1230
movl %eax, -0x28(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x50cd(%rip), %rsi      # 0x82ed
callq 0x1210
movq %rax, -0x168(%rbp)
jmp 0x3156
movq -0x170(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2330
movq %rax, -0x198(%rbp)
movq -0x178(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2330
movq %rax, -0x1a0(%rbp)
movq -0x198(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %edx
callq 0x2450
movq %rax, -0x1a8(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
movq -0x1a8(%rbp), %rdx
callq 0x3030
movsd %xmm0, -0x180(%rbp)
movsd 0x4f7e(%rip), %xmm0     # 0x8230
subsd -0x180(%rbp), %xmm0
movsd %xmm0, -0x1b0(%rbp)
movsd 0x4f66(%rip), %xmm0     # 0x8230
addsd -0x190(%rbp), %xmm0
movsd %xmm0, -0x190(%rbp)
movsd -0x1b0(%rbp), %xmm0
movsd 0x4f4e(%rip), %xmm1     # 0x8238
ucomisd %xmm1, %xmm0
jbe 0x3310
cmpl $0x0, -0x28(%rbp)
jne 0x330e
movsd 0x4f32(%rip), %xmm0     # 0x8230
addsd -0x188(%rbp), %xmm0
movsd %xmm0, -0x188(%rbp)
jmp 0x3330
cmpl $0x0, -0x28(%rbp)
je 0x332e
movsd 0x4f12(%rip), %xmm0     # 0x8230
addsd -0x188(%rbp), %xmm0
movsd %xmm0, -0x188(%rbp)
jmp 0x3330
movq -0x170(%rbp), %rdi
callq 0x1030
movq -0x178(%rbp), %rdi
callq 0x1030
movq -0x1a8(%rbp), %rdi
callq 0x1030
jmp 0x30fc
movq -0x20(%rbp), %rdi
callq 0x1080
movsd -0x188(%rbp), %xmm0
divsd -0x190(%rbp), %xmm0
leaq 0x4eda(%rip), %rdi      # 0x8253
movb $0x1, %al
callq 0x10b0
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
nopl (%rax)