// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/process.c
// Function: run_supervised_algorithm
void run_supervised_algorithm(int meta_algorithm, int algorithm)
{
 /*!Last Changed 12.12.2005*/
 /*!Last Changed 31.10.2005*/
 /*!Last Changed 11.04.2005*/
 /*!Last Changed 10.04.2004 allow also regression algorithms to run*/
 /*!Last Changed 29.01.2004* if dataset is not active you can not run any algorithm on it*/
 int i, runstart, k, **partition, *classes, *classcounts;
 RUN_TYPE runtype;
 void* parameters;
 char* testfname;
 FILE* posfile = NULL;
 FILE* modelfile = NULL;
 FILE* testcodefile = NULL;
 FILE* confusionfile = NULL;
 if (!checkparams(paramcount, 3, m1006, m1048, m1049))
   return;
 totalrun = 0;
 current_dataset = search_dataset(Datasets, params[0]);
 if (!current_dataset)
  {
   printf(m1320);
   return;
  }
 mustrealize = must_realize(algorithm);
 if (current_dataset->storetype != STORE_KERNEL)
   mustnormalize = must_normalize(algorithm);
 else
  {
   read_kernel_of_dataset(current_dataset);
   mustnormalize = NO;
  }
 if (!check_supervised_algorithm_type(algorithm, current_dataset))  
   return;
 if (current_dataset->active == NO)
   return;
 if (strIcmp(params[1], "cv") == 0)
   if (get_parameter_f("testpercentage") > 0)
     runtype = CROSSVALIDATION_WITH_SEPARATE_TEST_SET;
   else
     runtype = CROSSVALIDATION;
 else
   if (strIcmp(params[1], "bootstrap") == 0)
     if (get_parameter_f("testpercentage") > 0)
       runtype = BOOTSTRAP;
     else
      {
       printf(m1414);
       return;
      }
   else
     if (paramcount == 4)
       runtype = TRAIN_TEST_SETS_GIVEN;
     else
       if (paramcount == 5)
         runtype = TRAIN_TEST_CV_SETS_GIVEN;
       else
        {
         printf(m1186);
         return;
        }
 parameters = prepare_supervised_algorithm_parameters(algorithm);
 if (get_parameter_o("printposterior"))
  {
   posfile = fopen(get_parameter_s("posteriorfilename"), "w");
   if (!posfile)
     return;
  }
 if (get_parameter_o("printconfusion"))
  {
   confusionfile = fopen(get_parameter_s("confusionfilename"), "w");
   if (!confusionfile)
     return;
  }
 if (get_parameter_o("savetestcode"))
  {
   testfname = test_code_file_name_with_extension(get_parameter_s("testcodefilename"), get_parameter_l("language"));
   testcodefile = fopen(testfname, "w");
   if (!testcodefile)
     return;
   safe_free(testfname);
  }
 if (get_parameter_o("savemodel"))
  {
   modelfile = fopen(get_parameter_s("modelfilename"), "w");
   if (!modelfile)
     return;
   switch (runtype){
     case                        CROSSVALIDATION:
     case CROSSVALIDATION_WITH_SEPARATE_TEST_SET:fprintf(modelfile, "%s %s %d\n", current_dataset->name, get_algorithm_name(algorithm), get_parameter_i("runcount") * get_parameter_i("runtofold"));
                                                 break;
     case                              BOOTSTRAP:fprintf(modelfile, "%s %s %d\n", current_dataset->name, get_algorithm_name(algorithm), get_parameter_i("runcount"));
                                                 break;
     case                  TRAIN_TEST_SETS_GIVEN:
     case               TRAIN_TEST_CV_SETS_GIVEN:fprintf(modelfile, "%s %s 1\n", current_dataset->name, get_algorithm_name(algorithm));
                                                 break;
   }
  }
 if (runtype == CROSSVALIDATION || runtype == CROSSVALIDATION_WITH_SEPARATE_TEST_SET)
  {
   runstart = atoi(params[2]);
   get_prior_information();
   mysrand(runstart);
   partition = safemalloc(get_parameter_i("runcount") * sizeof(int *), "run_supervised_algorithm", 34);
   classes = read_train_and_test_lines(&classcounts);
   for (i = 0; i < get_parameter_i("runcount"); i++)
     partition[i] = stratified_partition(classes, trainlinecount, current_dataset->classno, classcounts);
   for (i = 0; i < get_parameter_i("runcount"); i++)
     for (k = get_parameter_i("runfromfold"); k < get_parameter_i("runtofold"); k++)
      {
       #ifdef MPI
       if (get_parameter_o("parallel") && get_parameter_i("paralleltype") == 2 && get_parameter_i("proccount") > 1 && rank > 0)   
         get_fold_mpiclient(k, partition[i]);
       else
         get_fold(k, partition[i]);
       #else
       if (get_parameter_i("foldcount") != 1)
         get_fold(k, partition[i]);
       else
        {
         read_from_train_file(current_dataset, &traindata);
         read_from_train_file(current_dataset, &testdata);
        }
       #endif
       if (runtype == CROSSVALIDATION_WITH_SEPARATE_TEST_SET)
        {
         read_data_from_lines(testlines, testlinecount, &separateddata);
         handle_missing_values(traindata, separateddata);
        }
       single_run_supervised_algorithm(parameters, meta_algorithm, algorithm, runtype, posfile, modelfile, testcodefile, confusionfile);
       separateddata = NULL;
      }
   free_2d((void**)partition, get_parameter_i("runcount"));
   free_train_and_test_lines();
   if (current_dataset->classno > 0)
    {
     safe_free(classes);
     safe_free(classcounts);
    }
  }
 else
   if (runtype == BOOTSTRAP)
    {
     runstart = atoi(params[2]);
     get_prior_information();
     mysrand(runstart);
     classes = read_train_and_test_lines(&classcounts);
     for (i = 0; i < get_parameter_i("runcount"); i++)
      {
       bootstrap_sample_with_stratification(classes, classcounts);
       read_data_from_lines(testlines, testlinecount, &testdata);
       handle_missing_values(traindata, testdata);
       single_run_supervised_algorithm(parameters, meta_algorithm, algorithm, runtype, posfile, modelfile, testcodefile, confusionfile);
      }
     free_train_and_test_lines();
     if (current_dataset->classno > 0)
      {
       safe_free(classes);
       safe_free(classcounts);
      }
    }
   else
     if (runtype == TRAIN_TEST_SETS_GIVEN)
      {
       if (prepare_from_files(current_dataset, params[1], params[2], NULL))
        {
         mysrand(atoi(params[3]));
         single_run_supervised_algorithm(parameters, meta_algorithm, algorithm, runtype, posfile, modelfile, testcodefile, confusionfile);
        }
      }
     else
      {
       if (prepare_from_files(current_dataset, params[1], params[2], params[3]))
        {
         mysrand(atoi(params[4]));
         single_run_supervised_algorithm(parameters, meta_algorithm, algorithm, runtype, posfile, modelfile, testcodefile, confusionfile);
        }
      }
 free_supervised_algorithm_parameters(algorithm, parameters);
 if (get_parameter_o("printposterior"))
   fclose(posfile);
 if (get_parameter_o("savemodel"))
   fclose(modelfile);
 if (get_parameter_o("savetestcode"))
   fclose(testcodefile);
 if (get_parameter_o("printconfusion"))
   fclose(confusionfile);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %esi, %r15d
movl %edi, %r13d
movl 0x34ddde(%rip), %edi    # 0x3aefa0
leaq 0x4793f(%rip), %rdx     # 0xa8b08
leaq 0x479a8(%rip), %rcx     # 0xa8b78
leaq 0x479cb(%rip), %r8      # 0xa8ba2
movl $0x3, %esi
xorl %eax, %eax
callq 0x39b2e
testl %eax, %eax
je 0x619ec
movl $0x0, 0x34de2b(%rip)    # 0x3af020
movq 0x7167c(%rip), %rdi     # 0xd2878
movq 0x7132d(%rip), %rsi     # 0xd2530
callq 0x14f16
movq %rax, 0x71661(%rip)     # 0xd2870
testq %rax, %rax
je 0x6123b
movl %r15d, %edi
callq 0x4488
movl %eax, 0x34dd82(%rip)    # 0x3aefa4
movq 0x71647(%rip), %rdi     # 0xd2870
cmpl $0x3, 0x140713c(%rdi)
jne 0x61255
callq 0x16b10
xorl %eax, %eax
jmp 0x6125d
leaq 0x4a484(%rip), %rdi     # 0xab6c6
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4090
movl %r15d, %edi
callq 0x44c0
movl %eax, 0x2d3c0d(%rip)    # 0x334e70
movq 0x71606(%rip), %rsi     # 0xd2870
movl %r15d, %edi
callq 0x4569
testl %eax, %eax
je 0x619ec
movq 0x715ef(%rip), %rax     # 0xd2870
cmpl $0x0, (%rax)
je 0x619ec
movq 0x712a7(%rip), %rdi     # 0xd2538
leaq 0x4dade(%rip), %rsi     # 0xaed76
callq 0x3a318
testl %eax, %eax
je 0x612ea
movq 0x71290(%rip), %rdi     # 0xd2538
leaq 0x47917(%rip), %rsi     # 0xa8bc6
callq 0x3a318
testl %eax, %eax
je 0x6131d
movl 0x34dce2(%rip), %eax    # 0x3aefa0
cmpl $0x4, %eax
je 0x61359
cmpl $0x5, %eax
jne 0x614e9
movl $0x4, %eax
movq %rax, 0x38(%rsp)
xorl %r12d, %r12d
movl $0x0, 0x10(%rsp)
xorl %r14d, %r14d
jmp 0x6134f
leaq 0x47792(%rip), %rdi     # 0xa8a83
callq 0x534b6
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm0
setbe %r12b
seta %al
xorl %r14d, %r14d
movl $0x0, 0x18(%rsp)
movl %eax, 0x10(%rsp)
movq %rax, 0x38(%rsp)
jmp 0x61377
leaq 0x4775f(%rip), %rdi     # 0xa8a83
callq 0x534b6
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x61503
movl $0x2, %eax
movq %rax, 0x38(%rsp)
movb $0x1, %r14b
xorl %r12d, %r12d
movl $0x0, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
jmp 0x61377
movl $0x3, %eax
movq %rax, 0x38(%rsp)
movb $0x1, %al
movl %eax, 0x18(%rsp)
xorl %r12d, %r12d
movl $0x0, 0x10(%rsp)
xorl %r14d, %r14d
movl %r15d, %edi
callq 0x5b37
movq %rax, 0x28(%rsp)
leaq 0x47611(%rip), %rdi     # 0xa899c
callq 0x536e7
testl %eax, %eax
je 0x613be
leaq 0x47711(%rip), %rdi     # 0xa8aac
callq 0x5356b
leaq 0x474fa(%rip), %rsi     # 0xa88a1
movq %rax, %rdi
callq 0x40f0
movq %rax, 0x20(%rsp)
testq %rax, %rax
jne 0x613c7
jmp 0x619ec
movq $0x0, 0x20(%rsp)
leaq 0x475fb(%rip), %rdi     # 0xa89c9
callq 0x536e7
testl %eax, %eax
je 0x613ff
leaq 0x47806(%rip), %rdi     # 0xa8be4
callq 0x5356b
leaq 0x474b7(%rip), %rsi     # 0xa88a1
movq %rax, %rdi
callq 0x40f0
movq %rax, %rbp
testq %rax, %rax
jne 0x61401
jmp 0x619ec
xorl %ebp, %ebp
leaq 0x47603(%rip), %rdi     # 0xa8a0b
callq 0x536e7
testl %eax, %eax
je 0x61460
leaq 0x477de(%rip), %rdi     # 0xa8bf6
callq 0x5356b
movq %rax, %rbx
leaq 0x475f1(%rip), %rdi     # 0xa8a18
callq 0x535f7
movq %rbx, %rdi
movl %eax, %esi
callq 0x7b501
movq %rax, %rbx
leaq 0x47461(%rip), %rsi     # 0xa88a1
movq %rax, %rdi
callq 0x40f0
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x619ec
movq %rbx, %rdi
callq 0x39194
jmp 0x61469
movq $0x0, 0x30(%rsp)
leaq 0x47591(%rip), %rdi     # 0xa8a01
callq 0x536e7
testl %eax, %eax
je 0x614f5
leaq 0x47787(%rip), %rdi     # 0xa8c07
callq 0x5356b
leaq 0x47415(%rip), %rsi     # 0xa88a1
movq %rax, %rdi
callq 0x40f0
testq %rax, %rax
je 0x619ec
movq 0x38(%rsp), %rcx
cmpl $0x2, %ecx
movq %rax, 0x8(%rsp)
jb 0x6150f
leal -0x3(%rcx), %eax
cmpl $0x2, %eax
jae 0x6156d
movq 0x713b1(%rip), %rax     # 0xd2870
movq 0x8(%rax), %rbx
movl %r15d, %edi
callq 0x4530
leaq 0x4774d(%rip), %rsi     # 0xa8c1f
movq 0x8(%rsp), %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x42e0
jmp 0x615b6
leaq 0x4a1fe(%rip), %rdi     # 0xab6ee
jmp 0x61242
movq $0x0, 0x8(%rsp)
jmp 0x615b6
leaq 0x4a1f7(%rip), %rdi     # 0xab701
jmp 0x61242
movq 0x7135a(%rip), %rcx     # 0xd2870
movq 0x8(%rcx), %rcx
movq %rcx, 0x50(%rsp)
movl %r15d, %edi
movq %rax, %rbx
callq 0x4530
movq %rax, 0x48(%rsp)
leaq 0x46717(%rip), %rdi     # 0xa7c4d
callq 0x5341c
movq %rbp, (%rsp)
movl %eax, %ebp
leaq 0x47581(%rip), %rdi     # 0xa8ac9
callq 0x5341c
imull %eax, %ebp
leaq 0x476be(%rip), %rsi     # 0xa8c15
movq %rbx, %rdi
movq 0x50(%rsp), %rdx
movq 0x48(%rsp), %rcx
movl %ebp, %r8d
movq (%rsp), %rbp
jmp 0x615af
movq 0x712fc(%rip), %rax     # 0xd2870
movq 0x8(%rax), %rax
movq %rax, (%rsp)
movl %r15d, %edi
callq 0x4530
movq %rbp, %rbx
movq %rax, %rbp
leaq 0x466bc(%rip), %rdi     # 0xa7c4d
callq 0x5341c
leaq 0x47678(%rip), %rsi     # 0xa8c15
movq 0x8(%rsp), %rdi
movq (%rsp), %rdx
movq %rbp, %rcx
movq %rbx, %rbp
movl %eax, %r8d
xorl %eax, %eax
callq 0x42e0
orb 0x10(%rsp), %r12b
cmpb $0x1, %r12b
jne 0x617c6
movq %rbp, %rbx
movl %r15d, %r14d
movq 0x70f6e(%rip), %rdi     # 0xd2540
callq 0x4200
movl %eax, %ebp
callq 0x5cde7
movl %ebp, %edi
callq 0x39f5b
leaq 0x46661(%rip), %r15     # 0xa7c4d
movq %r15, %rdi
callq 0x5341c
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0x47626(%rip), %rsi     # 0xa8c28
movl $0x22, %edx
callq 0x390f5
movq %rax, (%rsp)
leaq 0x40(%rsp), %rdi
callq 0x5d87f
movq %rax, %r12
movq %r15, %rdi
callq 0x5341c
testl %eax, %eax
jle 0x6166a
movq 0x40(%rsp), %rbp
xorl %r15d, %r15d
movl 0x70ed9(%rip), %esi     # 0xd2510
movq 0x71232(%rip), %rax     # 0xd2870
movl 0x10(%rax), %edx
movq %r12, %rdi
movq %rbp, %rcx
callq 0x2f14d
movq (%rsp), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
leaq 0x465ef(%rip), %rdi     # 0xa7c4d
callq 0x5341c
cltq
cmpq %rax, %r15
jl 0x61631
movq %r12, 0x18(%rsp)
leaq 0x465d7(%rip), %rdi     # 0xa7c4d
callq 0x5341c
testl %eax, %eax
jle 0x6177a
xorl %r15d, %r15d
leaq 0x4743c(%rip), %r12     # 0xa8ac9
leaq 0x475ad(%rip), %rdi     # 0xa8c41
callq 0x5341c
movl %eax, %ebp
movq %r12, %rdi
callq 0x5341c
cmpl %eax, %ebp
jge 0x61760
leaq 0x4a46a(%rip), %rdi     # 0xabb1c
callq 0x5341c
cmpl $0x1, %eax
jne 0x616e4
movq 0x711ad(%rip), %rdi     # 0xd2870
leaq 0x2d3766(%rip), %rsi    # 0x334e30
callq 0x5c7af
movq 0x7119a(%rip), %rdi     # 0xd2870
leaq 0x2d375b(%rip), %rsi    # 0x334e38
callq 0x5c7af
jmp 0x616f3
movq (%rsp), %rax
movq (%rax,%r15,8), %rsi
movl %ebp, %edi
callq 0x5d07d
cmpb $0x0, 0x10(%rsp)
je 0x61726
movq 0x71157(%rip), %rdi     # 0xd2858
movl 0x70e05(%rip), %esi     # 0xd250c
leaq 0x2d373a(%rip), %rdx    # 0x334e48
callq 0x5dad7
movq 0x2d3716(%rip), %rdi    # 0x334e30
movq 0x2d3727(%rip), %rsi    # 0x334e48
callq 0x5bf00
movq 0x28(%rsp), %rdi
movl %r13d, %esi
movl %r14d, %edx
movq 0x38(%rsp), %rcx
movq 0x20(%rsp), %r8
movq 0x8(%rsp), %r9
pushq %rbx
pushq 0x38(%rsp)
callq 0x5fc2c
addq $0x10, %rsp
movq $0x0, 0x2d36ef(%rip) # 0x334e48
incl %ebp
jmp 0x6169b
incq %r15
leaq 0x464e3(%rip), %rdi     # 0xa7c4d
callq 0x5341c
cltq
cmpq %rax, %r15
jl 0x6168d
leaq 0x464cc(%rip), %rdi     # 0xa7c4d
callq 0x5341c
movq (%rsp), %rdi
movl %eax, %esi
callq 0x3915f
callq 0x60317
movq 0x710d3(%rip), %rax     # 0xd2870
cmpl $0x0, 0x10(%rax)
movl %r14d, %r15d
movq %rbx, %rbp
movq 0x28(%rsp), %r14
movq 0x20(%rsp), %rbx
movq 0x30(%rsp), %r12
jle 0x61971
movq 0x18(%rsp), %rdi
jmp 0x618ba
testb %r14b, %r14b
je 0x618ce
movq 0x70d6a(%rip), %rdi     # 0xd2540
callq 0x4200
movl %eax, %ebx
callq 0x5cde7
movl %ebx, %edi
callq 0x39f5b
leaq 0x40(%rsp), %rdi
callq 0x5d87f
movq %rax, 0x10(%rsp)
leaq 0x4644e(%rip), %rdi     # 0xa7c4d
callq 0x5341c
testl %eax, %eax
movq %rbp, (%rsp)
movq 0x30(%rsp), %r12
movq 0x8(%rsp), %rbx
jle 0x6188e
xorl %ebp, %ebp
movq 0x40(%rsp), %r14
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x5cf6b
movq 0x71027(%rip), %rdi     # 0xd2858
movl 0x70cd5(%rip), %esi     # 0xd250c
leaq 0x2d35fa(%rip), %rdx    # 0x334e38
callq 0x5dad7
movq 0x2d35e6(%rip), %rdi    # 0x334e30
movq 0x2d35e7(%rip), %rsi    # 0x334e38
callq 0x5bf00
movq 0x28(%rsp), %rdi
movl %r13d, %esi
movl %r15d, %edx
movl $0x2, %ecx
movq 0x20(%rsp), %r8
movq %rbx, %r9
pushq (%rsp)
pushq %r12
callq 0x5fc2c
addq $0x10, %rsp
incl %ebp
leaq 0x463c8(%rip), %rdi     # 0xa7c4d
callq 0x5341c
cmpl %eax, %ebp
jl 0x6181d
movq 0x10(%rsp), %r13
callq 0x60317
movq 0x70fd1(%rip), %rax     # 0xd2870
cmpl $0x0, 0x10(%rax)
movq (%rsp), %rbp
movq 0x28(%rsp), %r14
movq 0x20(%rsp), %rbx
jle 0x61971
movq %r13, %rdi
callq 0x39194
movq 0x40(%rsp), %rdi
callq 0x39194
jmp 0x61971
movq 0x70f9b(%rip), %rdi     # 0xd2870
movq 0x70c5c(%rip), %rsi     # 0xd2538
movq 0x70c5d(%rip), %rdx     # 0xd2540
cmpb $0x0, 0x18(%rsp)
movq 0x20(%rsp), %rbx
movq 0x30(%rsp), %r12
je 0x61927
xorl %ecx, %ecx
callq 0x5cc69
testl %eax, %eax
movq 0x28(%rsp), %r14
je 0x61971
movq 0x70c3d(%rip), %rdi     # 0xd2548
callq 0x4200
movl %eax, %edi
callq 0x39f5b
movq %r14, %rdi
movl %r13d, %esi
movl %r15d, %edx
movl $0x3, %ecx
jmp 0x6195d
movq 0x70c1a(%rip), %rcx     # 0xd2548
callq 0x5cc69
testl %eax, %eax
movq 0x28(%rsp), %r14
je 0x61971
movq 0x70c0d(%rip), %rdi     # 0xd2550
callq 0x4200
movl %eax, %edi
callq 0x39f5b
movq %r14, %rdi
movl %r13d, %esi
movl %r15d, %edx
movl $0x4, %ecx
movq %rbx, %r8
movq 0x8(%rsp), %r9
pushq %rbp
pushq %r12
callq 0x5fc2c
addq $0x10, %rsp
movl %r15d, %edi
movq %r14, %rsi
callq 0x4d19
leaq 0x47019(%rip), %rdi     # 0xa899c
callq 0x536e7
testl %eax, %eax
je 0x61994
movq %rbx, %rdi
callq 0x42a0
leaq 0x47066(%rip), %rdi     # 0xa8a01
callq 0x536e7
testl %eax, %eax
je 0x619ae
movq 0x8(%rsp), %rdi
callq 0x42a0
leaq 0x47056(%rip), %rdi     # 0xa8a0b
callq 0x536e7
testl %eax, %eax
je 0x619c6
movq %r12, %rdi
callq 0x42a0
leaq 0x46ffc(%rip), %rdi     # 0xa89c9
callq 0x536e7
testl %eax, %eax
je 0x619ec
movq %rbp, %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x42a0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq