// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/process.c
// Function: test_meta_algorithm
void test_meta_algorithm(int meta_algorithm, int algorithm, void** model, void* parameters, int testsize)
{
 Instanceptr test, next;
 int 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 = meta_classification_algorithms[meta_algorithm - ONE_VERSUS_ONE].test_algorithm(test, model, algorithm, parameters, ((Classificationresultptr) result)->posteriors[testindex]);
     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 = meta_regression_algorithms[meta_algorithm - BAGGING_REGRESSION].test_algorithm(test, model, algorithm, parameters, NULL);
   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 $0x68, %rsp
movl %r8d, %r15d
movq %rcx, 0x8(%rsp)
movq %rdx, %r14
movl %esi, %ebp
movl %edi, %r12d
movl %esi, %edi
callq 0x445c
movl %r15d, %edi
testl %eax, %eax
je 0x5f684
callq 0x70b61
jmp 0x5f689
callq 0x8aa8
movq %rax, 0x34f998(%rip)    # 0x3af028
movq 0x2d57a1(%rip), %rsi    # 0x334e38
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x12519
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups %xmm2, 0x34f997(%rip)   # 0x3af050
movups %xmm1, 0x34f980(%rip)   # 0x3af040
movups %xmm0, 0x34f969(%rip)   # 0x3af030
movq 0x2d576a(%rip), %rsi    # 0x334e38
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x1286d
movupd (%r15), %xmm0
movupd 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups %xmm2, 0x34f98e(%rip)   # 0x3af080
movupd %xmm1, 0x34f976(%rip)   # 0x3af070
movupd %xmm0, 0x34f95e(%rip)   # 0x3af060
movq 0x2d572f(%rip), %r15    # 0x334e38
testq %r15, %r15
je 0x5f8b5
leal -0xc8(%r12), %eax
cltq
leaq (%rax,%rax,2), %rax
leaq 0x728d9(%rip), %rcx     # 0xd2000
leaq (%rcx,%rax,8), %rax
addq $0x8, %rax
movq %rax, 0x28(%rsp)
addl $-0x64, %r12d
movslq %r12d, %rax
leaq (%rax,%rax,2), %rax
leaq 0x7286a(%rip), %rcx     # 0xd1fb0
leaq (%rcx,%rax,8), %rax
addq $0x8, %rax
movq %rax, 0x20(%rsp)
xorl %r12d, %r12d
movq 0x10(%r15), %r13
movq $0x0, 0x10(%r15)
movl %ebp, %edi
callq 0x445c
testl %eax, %eax
je 0x5f79e
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %ebp, %ecx
movq 0x8(%rsp), %r8
xorl %r9d, %r9d
movq 0x28(%rsp), %rax
callq *(%rax)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x38(%rsp), %ebx
jmp 0x5f828
movq 0x34f883(%rip), %rax    # 0x3af028
movq 0x28(%rax), %rax
movq (%rax,%r12), %r9
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %ebp, %ecx
movq 0x8(%rsp), %r8
movq 0x20(%rsp), %rax
callq *(%rax)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x38(%rsp), %ebx
leaq 0x48417(%rip), %rdi     # 0xa7bf4
callq 0x536e7
cmpl $0x1, %eax
jne 0x5f828
movq 0x73082(%rip), %rax     # 0xd2870
cmpl $0x2, 0x10(%rax)
jne 0x5f828
movq 0x34f82d(%rip), %rax    # 0x3af028
movq 0x28(%rax), %rax
movq (%rax,%r12), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x483e6(%rip), %rdi     # 0xa7bfa
callq 0x534b6
xorl %ebx, %ebx
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
setbe %bl
movq %r13, 0x10(%r15)
movl %ebp, %edi
callq 0x445c
movq %r15, %rdi
testl %eax, %eax
je 0x5f869
callq 0x2eaee
movq 0x34f7e2(%rip), %rax    # 0x3af028
movq (%rax), %rcx
movsd 0x10(%rsp), %xmm1
movsd %xmm1, (%rcx,%r12)
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
addsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rax)
jmp 0x5f8a4
callq 0x2eaca
movq 0x34f7b3(%rip), %rcx    # 0x3af028
movq 0x10(%rcx), %rdx
cltq
incl (%rdx,%rax,4)
xorl %edx, %edx
cmpl %ebx, %eax
jne 0x5f892
movq 0x8(%rcx), %rdx
incl (%rdx,%rax,4)
incl (%rcx)
movl $0x1, %edx
movl %edx, 0x1c(%r15)
movq 0x18(%rcx), %rcx
movq (%rcx,%rax,8), %rax
movslq %ebx, %rcx
incl (%rax,%rcx,4)
movq 0x10(%r15), %r15
addq $0x8, %r12
testq %r15, %r15
jne 0x5f756
movq 0x34f774(%rip), %rdi    # 0x3af030
callq 0x39194
movq 0x34f798(%rip), %rdi    # 0x3af060
callq 0x39194
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq