// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/process.c
// Function: test_algorithm
void test_algorithm(int algorithm, void* model, void* parameters, int testsize)
{
 /*!Last Changed 01.08.2007 added confusion_matrix*/
 /*!Last Changed 29.12.2005*/
 Instanceptr test, next;
 int i, testindex = 0, classno;
 double real;
 Prediction predicted;
 if (get_algorithm_type(algorithm) == CLASSIFICATION)
   result = performance_initialize(testsize);
 else
   result = performance_initialize_regression(testsize);
 testmean = find_mean(testdata);
 testvariance = find_variance(testdata);
 test = testdata;
 while (test)
  {
   next = test->next;
   test->next = NULL;
   if (get_algorithm_type(algorithm) == CLASSIFICATION)
    {
     predicted = classification_algorithms[algorithm - SELECTMAX].test_algorithm(test, model, parameters, ((Classificationresultptr) result)->posteriors[testindex]);
     if (current_dataset->classno == 2 && in_list(algorithm, 2, SVM, SIMPLEXSVM))
       ((Classificationresultptr) result)->hingeloss += predicted.hingeloss;
     if (algorithm == KNN)
       for (i = 0; i < 3; i++)
         ((Classificationresultptr) result)->knnloss[i] += predicted.knnloss[i];
     if (get_parameter_o("changedecisionthreshold") == ON && current_dataset->classno == 2)
      {
       if (((Classificationresultptr) result)->posteriors[testindex][0] > get_parameter_f("decisionthreshold"))
         predicted.classno = 0;
       else
         predicted.classno = 1;
      }
    }
   else
    {
     predicted = regression_algorithms[algorithm - ONEFEATURE].test_algorithm(test, model, parameters, NULL);
     if (in_list(algorithm, 2, SVMREG, SIMPLEXSVMREG))
       ((Regressionresultptr) result)->epsilonloss += predicted.epsilonloss;
    }
   test->next = next;
   if (get_algorithm_type(algorithm) == CLASSIFICATION)
    {
     classno = give_classno(test);
     ((Classificationresultptr) result)->class_counts[classno]++;
     if (classno == predicted.classno)
      {
       ((Classificationresultptr) result)->class_performance[classno]++;
       ((Classificationresultptr) result)->performance++;
       test->classified = YES;
      }
     else
      {
       test->classified = NO;
      }
     ((Classificationresultptr) result)->confusion_matrix[classno][predicted.classno]++;
    }
   else
    {
     real = give_regressionvalue(test);
     ((Regressionresultptr) result)->absoluteerrors[testindex] = predicted.regvalue;
     ((Regressionresultptr) result)->regressionperformance += (real - predicted.regvalue) * (real - predicted.regvalue);
    }
   testindex++;
   test = test->next;
  }
 safe_free(testmean.values);
 safe_free(testvariance.values);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %ecx, %ebp
movq %rdx, 0x8(%rsp)
movq %rsi, %r14
movl %edi, %r15d
callq 0x445c
movl %ebp, %edi
testl %eax, %eax
je 0x5875b
callq 0x6898b
jmp 0x58760
callq 0x8758
movq %rax, 0x3518c1(%rip)    # 0x3aa028
leaq 0x2d76ca(%rip), %rbx    # 0x32fe38
movq 0x2d76c3(%rip), %rsi    # 0x32fe38
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x116b6
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x3518b6(%rip)   # 0x3aa050
movups %xmm1, 0x35189f(%rip)   # 0x3aa040
movups %xmm0, 0x351888(%rip)   # 0x3aa030
movq 0x2d7689(%rip), %rsi    # 0x32fe38
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x1197e
movupd (%r12), %xmm0
movupd 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x3518aa(%rip)   # 0x3aa080
movupd %xmm1, 0x351892(%rip)   # 0x3aa070
movupd %xmm0, 0x35187a(%rip)   # 0x3aa060
leal -0x7d0(%r15), %eax
cltq
imulq $0x28, %rax, %rax
leaq 0x74036(%rip), %rcx     # 0xcc830
addq %rcx, %rax
addq $0x8, %rax
movq %rax, 0x58(%rsp)
leal -0x3e8(%r15), %eax
cltq
imulq $0x28, %rax, %rax
leaq 0x739a6(%rip), %rcx     # 0xcc1c0
addq %rcx, %rax
addq $0x8, %rax
movq %rax, 0x50(%rsp)
xorl %ebp, %ebp
movq (%rbx), %r12
testq %r12, %r12
je 0x58a54
movq 0x10(%r12), %r13
andq $0x0, 0x10(%r12)
movl %r15d, %edi
callq 0x445c
testl %eax, %eax
je 0x588d6
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
movq 0x8(%rsp), %rcx
xorl %r8d, %r8d
movq 0x58(%rsp), %rax
callq *(%rax)
movq 0x90(%rsp), %rax
movq %rax, 0x40(%rsp)
movupd 0x60(%rsp), %xmm0
movupd 0x70(%rsp), %xmm1
movups 0x80(%rsp), %xmm2
movaps %xmm2, 0x30(%rsp)
movapd %xmm1, 0x20(%rsp)
movapd %xmm0, 0x10(%rsp)
movl %r15d, %edi
pushq $0x2
popq %rsi
movl $0x7d8, %edx            # imm = 0x7D8
movl $0x7d9, %ecx            # imm = 0x7D9
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0x589c8
movsd 0x28(%rsp), %xmm0
movq 0x351761(%rip), %rax    # 0x3aa028
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
jmp 0x589c8
movq 0x35174b(%rip), %rax    # 0x3aa028
movq 0x28(%rax), %rax
movq (%rax,%rbp,8), %r8
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
movq 0x8(%rsp), %rcx
movq 0x50(%rsp), %rax
callq *(%rax)
movq 0x74f6d(%rip), %rax     # 0xcd870
cmpl $0x2, 0x10(%rax)
jne 0x5893b
movl %r15d, %edi
pushq $0x2
popq %rsi
movl $0x3f9, %edx            # imm = 0x3F9
movl $0x3fa, %ecx            # imm = 0x3FA
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0x5893b
movsd 0x20(%rsp), %xmm0
movq 0x3516f7(%rip), %rax    # 0x3aa028
addsd 0x38(%rax), %xmm0
movsd %xmm0, 0x38(%rax)
cmpl $0x3e9, %r15d           # imm = 0x3E9
jne 0x5896a
movq 0x3516dd(%rip), %rax    # 0x3aa028
xorl %ecx, %ecx
cmpq $0x3, %rcx
je 0x5896a
movsd 0x30(%rsp,%rcx,8), %xmm0
addsd 0x40(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rax,%rcx,8)
incq %rcx
jmp 0x5894d
leaq 0x42263(%rip), %rdi     # 0x9abd4
callq 0x4cff1
cmpl $0x1, %eax
jne 0x589c8
movq 0x74eee(%rip), %rax     # 0xcd870
cmpl $0x2, 0x10(%rax)
jne 0x589c8
movq 0x351699(%rip), %rax    # 0x3aa028
movq 0x28(%rax), %rax
movq (%rax,%rbp,8), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
leaq 0x42232(%rip), %rdi     # 0x9abda
callq 0x4cdcf
movsd 0x48(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x589c0
andl $0x0, 0x18(%rsp)
jmp 0x589c8
movl $0x1, 0x18(%rsp)
leaq 0x10(%r12), %rbx
movq %r13, (%rbx)
movl %r15d, %edi
callq 0x445c
testl %eax, %eax
je 0x58a0d
movq %r12, %rdi
callq 0x2b4a0
movsd 0x10(%rsp), %xmm1
movq 0x351637(%rip), %rax    # 0x3aa028
movq (%rax), %rcx
movsd %xmm1, (%rcx,%rbp,8)
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
addsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rax)
jmp 0x58a4c
movq %r12, %rdi
callq 0x2b47e
movq 0x35160c(%rip), %rcx    # 0x3aa028
movq 0x10(%rcx), %rdx
cltq
incl (%rdx,%rax,4)
movslq 0x18(%rsp), %rdx
xorl %esi, %esi
cmpl %edx, %eax
jne 0x58a3c
movq 0x8(%rcx), %rsi
incl (%rsi,%rax,4)
incl (%rcx)
pushq $0x1
popq %rsi
movl %esi, 0x1c(%r12)
movq 0x18(%rcx), %rcx
movq (%rcx,%rax,8), %rax
incl (%rax,%rdx,4)
incq %rbp
jmp 0x58828
movq 0x3515d5(%rip), %rdi    # 0x3aa030
callq 0x34ff7
movq 0x3515f9(%rip), %rdi    # 0x3aa060
callq 0x34ff7
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq