// File: /workspace/github_c_makefile_star2_O2/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, (%rsp)
movl %esi, %ebp
movl %edi, %r14d
movl %esi, %edi
callq 0x445c
movl %r15d, %edi
testl %eax, %eax
je 0x584d3
callq 0x6898b
jmp 0x584d8
callq 0x8758
movq %rax, 0x351b49(%rip)    # 0x3aa028
leaq 0x2d7952(%rip), %r12    # 0x32fe38
movq 0x2d794b(%rip), %rsi    # 0x32fe38
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x116b6
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x351b44(%rip)   # 0x3aa050
movups %xmm1, 0x351b2d(%rip)   # 0x3aa040
movups %xmm0, 0x351b16(%rip)   # 0x3aa030
movq 0x2d7917(%rip), %rsi    # 0x32fe38
leaq 0x30(%rsp), %r13
movq %r13, %rdi
callq 0x1197e
movupd (%r13), %xmm0
movupd 0x10(%r13), %xmm1
movups 0x20(%r13), %xmm2
movups %xmm2, 0x351b3a(%rip)   # 0x3aa080
movupd %xmm1, 0x351b22(%rip)   # 0x3aa070
movupd %xmm0, 0x351b0a(%rip)   # 0x3aa060
leal -0xc8(%r14), %eax
cltq
imulq $0x18, %rax, %rax
leaq 0x74a96(%rip), %rcx     # 0xcd000
addq %rcx, %rax
addq $0x8, %rax
movq %rax, 0x28(%rsp)
addl $-0x64, %r14d
movslq %r14d, %rax
imulq $0x18, %rax, %rax
leaq 0x74a28(%rip), %rcx     # 0xccfb0
addq %rcx, %rax
addq $0x8, %rax
movq %rax, 0x20(%rsp)
xorl %r15d, %r15d
movq (%r12), %r13
testq %r13, %r13
je 0x58704
movq 0x10(%r13), %rbx
andq $0x0, 0x10(%r13)
movl %ebp, %edi
callq 0x445c
testl %eax, %eax
je 0x585eb
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
movq (%rsp), %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), %r14d
jmp 0x58679
movq 0x351a36(%rip), %rax    # 0x3aa028
movq 0x28(%rax), %rax
movq (%rax,%r15), %r9
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
movq (%rsp), %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), %r14d
leaq 0x425a8(%rip), %rdi     # 0x9abd4
callq 0x4cff1
cmpl $0x1, %eax
jne 0x58679
movq 0x75233(%rip), %rax     # 0xcd870
cmpl $0x2, 0x10(%rax)
jne 0x58679
movq 0x3519de(%rip), %rax    # 0x3aa028
movq 0x28(%rax), %rax
movq (%rax,%r15), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x42577(%rip), %rdi     # 0x9abda
callq 0x4cdcf
xorl %r14d, %r14d
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
setbe %r14b
leaq 0x10(%r13), %r12
movq %rbx, (%r12)
movl %ebp, %edi
callq 0x445c
testl %eax, %eax
je 0x586be
movq %r13, %rdi
callq 0x2b4a0
movq 0x35198d(%rip), %rax    # 0x3aa028
movq (%rax), %rcx
movsd 0x10(%rsp), %xmm1
movsd %xmm1, (%rcx,%r15)
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
addsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rax)
jmp 0x586fb
movq %r13, %rdi
callq 0x2b47e
movq 0x35195b(%rip), %rcx    # 0x3aa028
movq 0x10(%rcx), %rdx
cltq
incl (%rdx,%rax,4)
xorl %edx, %edx
cmpl %r14d, %eax
jne 0x586e9
movq 0x8(%rcx), %rdx
incl (%rdx,%rax,4)
incl (%rcx)
pushq $0x1
popq %rdx
movl %edx, 0x1c(%r13)
movq 0x18(%rcx), %rcx
movq (%rcx,%rax,8), %rax
movslq %r14d, %rcx
incl (%rax,%rcx,4)
addq $0x8, %r15
jmp 0x58597
movq 0x351925(%rip), %rdi    # 0x3aa030
callq 0x34ff7
movq 0x351949(%rip), %rdi    # 0x3aa060
callq 0x34ff7
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq