// File: /workspace/github_c_makefile_star2_O3/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 $0x88, %rsp
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r15d
callq 0x445c
movl %ebp, %edi
testl %eax, %eax
je 0x61004
callq 0x7232d
jmp 0x61009
callq 0x8ad8
movq %rax, 0x351018(%rip)    # 0x3b2028
movq 0x2d6e21(%rip), %rsi    # 0x337e38
movq %rsp, %r12
movq %r12, %rdi
callq 0x1247b
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x351016(%rip)   # 0x3b2050
movups %xmm1, 0x350fff(%rip)   # 0x3b2040
movups %xmm0, 0x350fe8(%rip)   # 0x3b2030
movq 0x2d6de9(%rip), %rsi    # 0x337e38
movq %rsp, %r12
movq %r12, %rdi
callq 0x127bd
movupd (%r12), %xmm0
movupd 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x35100c(%rip)   # 0x3b2080
movupd %xmm1, 0x350ff4(%rip)   # 0x3b2070
movupd %xmm0, 0x350fdc(%rip)   # 0x3b2060
movq 0x2d6dad(%rip), %r12    # 0x337e38
testq %r12, %r12
je 0x612fc
leal -0x7d0(%r15), %eax
cltq
leaq (%rax,%rax,4), %rax
leaq 0x73788(%rip), %rcx     # 0xd4830
leaq (%rcx,%rax,8), %rax
addq $0x8, %rax
movq %rax, 0x48(%rsp)
leal -0x3e8(%r15), %eax
cltq
leaq (%rax,%rax,4), %rax
leaq 0x730f7(%rip), %rcx     # 0xd41c0
leaq (%rcx,%rax,8), %rax
addq $0x8, %rax
movq %rax, 0x40(%rsp)
xorl %r13d, %r13d
movq 0x10(%r12), %rbp
movq $0x0, 0x10(%r12)
movl %r15d, %edi
callq 0x445c
testl %eax, %eax
je 0x6117a
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
movq 0x48(%rsp), %rax
callq *(%rax)
movq 0x80(%rsp), %rax
movq %rax, 0x30(%rsp)
movupd 0x50(%rsp), %xmm0
movupd 0x60(%rsp), %xmm1
movups 0x70(%rsp), %xmm2
movaps %xmm2, 0x20(%rsp)
movapd %xmm1, 0x10(%rsp)
movapd %xmm0, (%rsp)
movl %r15d, %edi
movl $0x2, %esi
movl $0x7d8, %edx            # imm = 0x7D8
movl $0x7d9, %ecx            # imm = 0x7D9
xorl %eax, %eax
callq 0x3aa8c
testl %eax, %eax
je 0x6126b
movsd 0x18(%rsp), %xmm0
movq 0x350ebd(%rip), %rax    # 0x3b2028
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
jmp 0x6126b
movq 0x350ea7(%rip), %rax    # 0x3b2028
movq 0x28(%rax), %rax
movq (%rax,%r13,8), %r8
movq %rsp, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
movq 0x40(%rsp), %rax
callq *(%rax)
movq 0x746cd(%rip), %rax     # 0xd5870
cmpl $0x2, 0x10(%rax)
jne 0x611dd
movl %r15d, %edi
movl $0x2, %esi
movl $0x3f9, %edx            # imm = 0x3F9
movl $0x3fa, %ecx            # imm = 0x3FA
xorl %eax, %eax
callq 0x3aa8c
testl %eax, %eax
je 0x611dd
movsd 0x10(%rsp), %xmm0
movq 0x350e55(%rip), %rax    # 0x3b2028
addsd 0x38(%rax), %xmm0
movsd %xmm0, 0x38(%rax)
cmpl $0x3e9, %r15d           # imm = 0x3E9
jne 0x6120a
movq 0x350e3b(%rip), %rax    # 0x3b2028
xorl %ecx, %ecx
movsd 0x20(%rsp,%rcx,8), %xmm0
addsd 0x40(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rax,%rcx,8)
incq %rcx
cmpq $0x3, %rcx
jne 0x611ef
leaq 0x49a93(%rip), %rdi     # 0xaaca4
callq 0x54bec
cmpl $0x1, %eax
jne 0x6126b
movq 0x7464e(%rip), %rax     # 0xd5870
cmpl $0x2, 0x10(%rax)
jne 0x6126b
movq 0x350df9(%rip), %rax    # 0x3b2028
movq 0x28(%rax), %rax
movq (%rax,%r13,8), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
leaq 0x49a62(%rip), %rdi     # 0xaacaa
callq 0x549ba
movsd 0x38(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x61263
movl $0x0, 0x8(%rsp)
jmp 0x6126b
movl $0x1, 0x8(%rsp)
movq %rbp, 0x10(%r12)
movl %r15d, %edi
callq 0x445c
movq %r12, %rdi
testl %eax, %eax
je 0x612ad
callq 0x2f35e
movsd (%rsp), %xmm1
movq 0x350d98(%rip), %rax    # 0x3b2028
movq (%rax), %rcx
movsd %xmm1, (%rcx,%r13,8)
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
addsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rax)
jmp 0x612eb
callq 0x2f33a
movq 0x350d6f(%rip), %rcx    # 0x3b2028
movq 0x10(%rcx), %rdx
cltq
incl (%rdx,%rax,4)
movslq 0x8(%rsp), %rdx
xorl %esi, %esi
cmpl %edx, %eax
jne 0x612db
movq 0x8(%rcx), %rsi
incl (%rsi,%rax,4)
incl (%rcx)
movl $0x1, %esi
movl %esi, 0x1c(%r12)
movq 0x18(%rcx), %rcx
movq (%rcx,%rax,8), %rax
incl (%rax,%rdx,4)
incq %r13
movq 0x10(%r12), %r12
testq %r12, %r12
jne 0x610d9
movq 0x350d2d(%rip), %rdi    # 0x3b2030
callq 0x3a180
movq 0x350d51(%rip), %rdi    # 0x3b2060
callq 0x3a180
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq