// File: /workspace/github_c_makefile_star2_O1/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 0x5f90a
callq 0x70b61
jmp 0x5f90f
callq 0x8aa8
movq %rax, 0x34f712(%rip)    # 0x3af028
movq 0x2d551b(%rip), %rsi    # 0x334e38
movq %rsp, %r12
movq %r12, %rdi
callq 0x12519
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x34f710(%rip)   # 0x3af050
movups %xmm1, 0x34f6f9(%rip)   # 0x3af040
movups %xmm0, 0x34f6e2(%rip)   # 0x3af030
movq 0x2d54e3(%rip), %rsi    # 0x334e38
movq %rsp, %r12
movq %r12, %rdi
callq 0x1286d
movupd (%r12), %xmm0
movupd 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x34f706(%rip)   # 0x3af080
movupd %xmm1, 0x34f6ee(%rip)   # 0x3af070
movupd %xmm0, 0x34f6d6(%rip)   # 0x3af060
movq 0x2d54a7(%rip), %r12    # 0x334e38
testq %r12, %r12
je 0x5fc02
leal -0x7d0(%r15), %eax
cltq
leaq (%rax,%rax,4), %rax
leaq 0x71e82(%rip), %rcx     # 0xd1830
leaq (%rcx,%rax,8), %rax
addq $0x8, %rax
movq %rax, 0x48(%rsp)
leal -0x3e8(%r15), %eax
cltq
leaq (%rax,%rax,4), %rax
leaq 0x717f1(%rip), %rcx     # 0xd11c0
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 0x5fa80
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 0x39a80
testl %eax, %eax
je 0x5fb71
movsd 0x18(%rsp), %xmm0
movq 0x34f5b7(%rip), %rax    # 0x3af028
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
jmp 0x5fb71
movq 0x34f5a1(%rip), %rax    # 0x3af028
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 0x72dc7(%rip), %rax     # 0xd2870
cmpl $0x2, 0x10(%rax)
jne 0x5fae3
movl %r15d, %edi
movl $0x2, %esi
movl $0x3f9, %edx            # imm = 0x3F9
movl $0x3fa, %ecx            # imm = 0x3FA
xorl %eax, %eax
callq 0x39a80
testl %eax, %eax
je 0x5fae3
movsd 0x10(%rsp), %xmm0
movq 0x34f54f(%rip), %rax    # 0x3af028
addsd 0x38(%rax), %xmm0
movsd %xmm0, 0x38(%rax)
cmpl $0x3e9, %r15d           # imm = 0x3E9
jne 0x5fb10
movq 0x34f535(%rip), %rax    # 0x3af028
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 0x5faf5
leaq 0x480dd(%rip), %rdi     # 0xa7bf4
callq 0x536e7
cmpl $0x1, %eax
jne 0x5fb71
movq 0x72d48(%rip), %rax     # 0xd2870
cmpl $0x2, 0x10(%rax)
jne 0x5fb71
movq 0x34f4f3(%rip), %rax    # 0x3af028
movq 0x28(%rax), %rax
movq (%rax,%r13,8), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
leaq 0x480ac(%rip), %rdi     # 0xa7bfa
callq 0x534b6
movsd 0x38(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x5fb69
movl $0x0, 0x8(%rsp)
jmp 0x5fb71
movl $0x1, 0x8(%rsp)
movq %rbp, 0x10(%r12)
movl %r15d, %edi
callq 0x445c
movq %r12, %rdi
testl %eax, %eax
je 0x5fbb3
callq 0x2eaee
movsd (%rsp), %xmm1
movq 0x34f492(%rip), %rax    # 0x3af028
movq (%rax), %rcx
movsd %xmm1, (%rcx,%r13,8)
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
addsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rax)
jmp 0x5fbf1
callq 0x2eaca
movq 0x34f469(%rip), %rcx    # 0x3af028
movq 0x10(%rcx), %rdx
cltq
incl (%rdx,%rax,4)
movslq 0x8(%rsp), %rdx
xorl %esi, %esi
cmpl %edx, %eax
jne 0x5fbe1
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 0x5f9df
movq 0x34f427(%rip), %rdi    # 0x3af030
callq 0x39194
movq 0x34f44b(%rip), %rdi    # 0x3af060
callq 0x39194
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq