// File: /workspace/github_c_makefile_star2_O3/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, %r13d
movl %edi, %ebx
movl 0x34f735(%rip), %edi    # 0x3b1fa0
leaq 0x49362(%rip), %rdx     # 0xabbd4
leaq 0x493cb(%rip), %rcx     # 0xabc44
leaq 0x493ee(%rip), %r8      # 0xabc6e
movl $0x3, %esi
xorl %eax, %eax
callq 0x3ab3a
testl %eax, %eax
je 0x630a7
movl $0x0, 0x34f782(%rip)    # 0x3b2020
movq 0x72fd3(%rip), %rdi     # 0xd5878
movq 0x72c84(%rip), %rsi     # 0xd5530
callq 0x14fb7
movq %rax, 0x72fb8(%rip)     # 0xd5870
testq %rax, %rax
je 0x628e4
movl %r13d, %edi
callq 0x4488
movl %eax, 0x34f6d9(%rip)    # 0x3b1fa4
movq 0x72f9e(%rip), %rdi     # 0xd5870
cmpl $0x3, 0x140713c(%rdi)
jne 0x628fe
callq 0x16e3c
xorl %eax, %eax
jmp 0x62906
leaq 0x4bea7(%rip), %rdi     # 0xae792
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4090
movl %r13d, %edi
callq 0x44c0
movl %eax, 0x2d5564(%rip)    # 0x337e70
movq 0x72f5d(%rip), %rsi     # 0xd5870
movl %r13d, %edi
callq 0x4569
testl %eax, %eax
je 0x630a7
movq 0x72f46(%rip), %rax     # 0xd5870
cmpl $0x0, (%rax)
je 0x630a7
movq 0x72bfe(%rip), %rdi     # 0xd5538
leaq 0x4f4b5(%rip), %rsi     # 0xb1df6
callq 0x3b3a8
testl %eax, %eax
je 0x62993
movq 0x72be7(%rip), %rdi     # 0xd5538
leaq 0x4933a(%rip), %rsi     # 0xabc92
callq 0x3b3a8
testl %eax, %eax
je 0x629c6
movl 0x34f639(%rip), %eax    # 0x3b1fa0
cmpl $0x4, %eax
je 0x62a02
cmpl $0x5, %eax
jne 0x62b92
movl $0x4, %eax
movq %rax, 0x18(%rsp)
xorl %r12d, %r12d
movl $0x0, 0x10(%rsp)
xorl %r15d, %r15d
jmp 0x629f8
leaq 0x491b5(%rip), %rdi     # 0xabb4f
callq 0x549ba
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm0
setbe %r12b
seta %al
xorl %r15d, %r15d
movl $0x0, 0x28(%rsp)
movl %eax, 0x10(%rsp)
movq %rax, 0x18(%rsp)
jmp 0x62a20
leaq 0x49182(%rip), %rdi     # 0xabb4f
callq 0x549ba
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x62bac
movl $0x2, %eax
movq %rax, 0x18(%rsp)
movb $0x1, %r15b
xorl %r12d, %r12d
movl $0x0, 0x10(%rsp)
movl $0x0, 0x28(%rsp)
jmp 0x62a20
movl $0x3, %eax
movq %rax, 0x18(%rsp)
movb $0x1, %al
movl %eax, 0x28(%rsp)
xorl %r12d, %r12d
movl $0x0, 0x10(%rsp)
xorl %r15d, %r15d
movl %r13d, %edi
callq 0x5b37
movq %rax, 0x38(%rsp)
leaq 0x49034(%rip), %rdi     # 0xaba68
callq 0x54bec
testl %eax, %eax
je 0x62a67
leaq 0x49134(%rip), %rdi     # 0xabb78
callq 0x54a6f
leaq 0x48f1d(%rip), %rsi     # 0xab96d
movq %rax, %rdi
callq 0x40f0
movq %rax, 0x20(%rsp)
testq %rax, %rax
jne 0x62a70
jmp 0x630a7
movq $0x0, 0x20(%rsp)
leaq 0x4901e(%rip), %rdi     # 0xaba95
callq 0x54bec
testl %eax, %eax
je 0x62aa8
leaq 0x49229(%rip), %rdi     # 0xabcb0
callq 0x54a6f
leaq 0x48eda(%rip), %rsi     # 0xab96d
movq %rax, %rdi
callq 0x40f0
movq %rax, %rbp
testq %rax, %rax
jne 0x62aaa
jmp 0x630a7
xorl %ebp, %ebp
leaq 0x49026(%rip), %rdi     # 0xabad7
callq 0x54bec
testl %eax, %eax
je 0x62b09
leaq 0x49201(%rip), %rdi     # 0xabcc2
callq 0x54a6f
movq %rax, %r14
leaq 0x49014(%rip), %rdi     # 0xabae4
callq 0x54afc
movq %r14, %rdi
movl %eax, %esi
callq 0x7cdd1
movq %rax, %r14
leaq 0x48e84(%rip), %rsi     # 0xab96d
movq %rax, %rdi
callq 0x40f0
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x630a7
movq %r14, %rdi
callq 0x3a180
jmp 0x62b12
movq $0x0, 0x30(%rsp)
leaq 0x48fb4(%rip), %rdi     # 0xabacd
callq 0x54bec
testl %eax, %eax
je 0x62b9e
leaq 0x491aa(%rip), %rdi     # 0xabcd3
callq 0x54a6f
leaq 0x48e38(%rip), %rsi     # 0xab96d
movq %rax, %rdi
callq 0x40f0
testq %rax, %rax
je 0x630a7
movq 0x18(%rsp), %rcx
cmpl $0x2, %ecx
movq %rax, 0x8(%rsp)
jb 0x62bb8
leal -0x3(%rcx), %eax
cmpl $0x2, %eax
jae 0x62c16
movq 0x72d08(%rip), %rax     # 0xd5870
movq 0x8(%rax), %r14
movl %r13d, %edi
callq 0x4530
leaq 0x49170(%rip), %rsi     # 0xabceb
movq 0x8(%rsp), %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x42e0
jmp 0x62c5c
leaq 0x4bc21(%rip), %rdi     # 0xae7ba
jmp 0x628eb
movq $0x0, 0x8(%rsp)
jmp 0x62c5c
leaq 0x4bc1a(%rip), %rdi     # 0xae7cd
jmp 0x628eb
movq 0x72cb1(%rip), %rcx     # 0xd5870
movq 0x8(%rcx), %rcx
movq %rcx, 0x50(%rsp)
movl %r13d, %edi
movq %rax, %r14
callq 0x4530
movq %rax, 0x48(%rsp)
leaq 0x4811e(%rip), %rdi     # 0xaacfd
callq 0x54920
movq %rbp, (%rsp)
movl %eax, %ebp
leaq 0x48fa4(%rip), %rdi     # 0xabb95
callq 0x54920
imull %eax, %ebp
leaq 0x490e1(%rip), %rsi     # 0xabce1
movq %r14, %rdi
movq 0x50(%rsp), %rdx
movq 0x48(%rsp), %rcx
movl %ebp, %r8d
movq (%rsp), %rbp
jmp 0x62c55
movq 0x72c53(%rip), %rax     # 0xd5870
movq %rbp, (%rsp)
movq 0x8(%rax), %rbp
movl %r13d, %edi
callq 0x4530
movq %rax, %r14
leaq 0x480c6(%rip), %rdi     # 0xaacfd
callq 0x54920
leaq 0x4909e(%rip), %rsi     # 0xabce1
movq 0x8(%rsp), %rdi
movq %rbp, %rdx
movq (%rsp), %rbp
movq %r14, %rcx
movl %eax, %r8d
xorl %eax, %eax
callq 0x42e0
orb 0x10(%rsp), %r12b
cmpb $0x1, %r12b
jne 0x62e73
movq %rbp, %r12
movl %r13d, %r15d
movq 0x728c8(%rip), %rdi     # 0xd5540
callq 0x4200
movl %eax, %ebp
callq 0x5e2e1
movl %ebp, %edi
callq 0x3af63
leaq 0x4806b(%rip), %r13     # 0xaacfd
movq %r13, %rdi
callq 0x54920
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0x4904c(%rip), %rsi     # 0xabcf4
movl $0x22, %edx
callq 0x3a0e1
movq %rax, (%rsp)
leaq 0x40(%rsp), %rdi
callq 0x5ed85
movq %rax, %r14
movq %r13, %rdi
callq 0x54920
testl %eax, %eax
jle 0x62d10
movq 0x40(%rsp), %rbp
xorl %r13d, %r13d
movl 0x72833(%rip), %esi     # 0xd5510
movq 0x72b8c(%rip), %rax     # 0xd5870
movl 0x10(%rax), %edx
movq %r14, %rdi
movq %rbp, %rcx
callq 0x2f9b1
movq (%rsp), %rcx
movq %rax, (%rcx,%r13,8)
incq %r13
leaq 0x47ff9(%rip), %rdi     # 0xaacfd
callq 0x54920
cltq
cmpq %rax, %r13
jl 0x62cd7
movq %r14, 0x28(%rsp)
leaq 0x47fe1(%rip), %rdi     # 0xaacfd
callq 0x54920
testl %eax, %eax
jle 0x62e27
xorl %r13d, %r13d
leaq 0x48e62(%rip), %r14     # 0xabb95
leaq 0x48fd3(%rip), %rdi     # 0xabd0d
callq 0x54920
movl %eax, %ebp
movq %r14, %rdi
callq 0x54920
cmpl %eax, %ebp
jge 0x62e0d
leaq 0x4be90(%rip), %rdi     # 0xaebe8
callq 0x54920
cmpl $0x1, %eax
jne 0x62d8a
movq 0x72b07(%rip), %rdi     # 0xd5870
leaq 0x2d50c0(%rip), %rsi    # 0x337e30
callq 0x5dcbd
movq 0x72af4(%rip), %rdi     # 0xd5870
leaq 0x2d50b5(%rip), %rsi    # 0x337e38
callq 0x5dcbd
jmp 0x62d99
movq (%rsp), %rax
movq (%rax,%r13,8), %rsi
movl %ebp, %edi
callq 0x5e577
movq 0x18(%rsp), %rax
movl %eax, %ecx
cmpb $0x0, 0x10(%rsp)
je 0x62dd8
movq 0x72aaa(%rip), %rdi     # 0xd5858
movl 0x72758(%rip), %esi     # 0xd550c
leaq 0x2d508d(%rip), %rdx    # 0x337e48
callq 0x5efe0
movq 0x2d5069(%rip), %rdi    # 0x337e30
movq 0x2d507a(%rip), %rsi    # 0x337e48
callq 0x5d42c
movl $0x1, %ecx
movq 0x38(%rsp), %rdi
movl %ebx, %esi
movl %r15d, %edx
movq 0x20(%rsp), %r8
movq 0x8(%rsp), %r9
pushq %r12
pushq 0x38(%rsp)
callq 0x61326
addq $0x10, %rsp
movq $0x0, 0x2d5042(%rip) # 0x337e48
incl %ebp
jmp 0x62d41
incq %r13
leaq 0x47ee6(%rip), %rdi     # 0xaacfd
callq 0x54920
cltq
cmpq %rax, %r13
jl 0x62d33
leaq 0x47ecf(%rip), %rdi     # 0xaacfd
callq 0x54920
movq (%rsp), %rdi
movl %eax, %esi
callq 0x3a14b
callq 0x619ea
movq 0x72a26(%rip), %rax     # 0xd5870
cmpl $0x0, 0x10(%rax)
movl %r15d, %r13d
movq %r12, %rbp
movq 0x38(%rsp), %r14
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r12
jle 0x6302c
movq 0x28(%rsp), %rdi
jmp 0x62f6d
testb %r15b, %r15b
je 0x62f81
movq 0x726bd(%rip), %rdi     # 0xd5540
callq 0x4200
movl %ebx, 0x18(%rsp)
movl %eax, %ebx
callq 0x5e2e1
movl %ebx, %edi
callq 0x3af63
leaq 0x40(%rsp), %rdi
callq 0x5ed85
movq %rax, 0x10(%rsp)
leaq 0x47e4d(%rip), %rdi     # 0xaacfd
callq 0x54920
testl %eax, %eax
movq %rbp, (%rsp)
movq 0x38(%rsp), %r15
movq 0x30(%rsp), %r12
movq 0x8(%rsp), %rbx
jle 0x62f43
xorl %ebp, %ebp
movq 0x40(%rsp), %r14
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x5e465
movq 0x72971(%rip), %rdi     # 0xd5858
movl 0x7261f(%rip), %esi     # 0xd550c
leaq 0x2d4f44(%rip), %rdx    # 0x337e38
callq 0x5efe0
movq 0x2d4f30(%rip), %rdi    # 0x337e30
movq 0x2d4f31(%rip), %rsi    # 0x337e38
callq 0x5d42c
movq %r15, %rdi
movl 0x18(%rsp), %esi
movl %r13d, %edx
movl $0x2, %ecx
movq 0x20(%rsp), %r8
movq %rbx, %r9
pushq (%rsp)
pushq %r12
callq 0x61326
addq $0x10, %rsp
incl %ebp
leaq 0x47dc3(%rip), %rdi     # 0xaacfd
callq 0x54920
cmpl %eax, %ebp
jl 0x62ed3
movq 0x10(%rsp), %rbx
callq 0x619ea
movq 0x7291c(%rip), %rax     # 0xd5870
cmpl $0x0, 0x10(%rax)
movq (%rsp), %rbp
movq %r15, %r14
movq 0x20(%rsp), %r15
jle 0x6302c
movq %rbx, %rdi
callq 0x3a180
movq 0x40(%rsp), %rdi
callq 0x3a180
jmp 0x6302c
movq 0x728e8(%rip), %rdi     # 0xd5870
movq 0x725a9(%rip), %rsi     # 0xd5538
movq 0x725aa(%rip), %rdx     # 0xd5540
cmpb $0x0, 0x28(%rsp)
je 0x62fd9
xorl %ecx, %ecx
callq 0x5e163
testl %eax, %eax
movq 0x38(%rsp), %r14
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r12
je 0x6302c
movq 0x7258a(%rip), %rdi     # 0xd5548
callq 0x4200
movl %eax, %edi
callq 0x3af63
movq %r14, %rdi
movl %ebx, %esi
movl %r13d, %edx
movl $0x3, %ecx
jmp 0x63018
movq 0x72568(%rip), %rcx     # 0xd5548
callq 0x5e163
testl %eax, %eax
movq 0x38(%rsp), %r14
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r12
je 0x6302c
movq 0x72551(%rip), %rdi     # 0xd5550
callq 0x4200
movl %eax, %edi
callq 0x3af63
movq %r14, %rdi
movl %ebx, %esi
movl %r13d, %edx
movl $0x4, %ecx
movq %r15, %r8
movq 0x8(%rsp), %r9
pushq %rbp
pushq %r12
callq 0x61326
addq $0x10, %rsp
movl %r13d, %edi
movq %r14, %rsi
callq 0x4cff
leaq 0x48a2a(%rip), %rdi     # 0xaba68
callq 0x54bec
testl %eax, %eax
je 0x6304f
movq %r15, %rdi
callq 0x42a0
leaq 0x48a77(%rip), %rdi     # 0xabacd
callq 0x54bec
testl %eax, %eax
je 0x63069
movq 0x8(%rsp), %rdi
callq 0x42a0
leaq 0x48a67(%rip), %rdi     # 0xabad7
callq 0x54bec
testl %eax, %eax
je 0x63081
movq %r12, %rdi
callq 0x42a0
leaq 0x48a0d(%rip), %rdi     # 0xaba95
callq 0x54bec
testl %eax, %eax
je 0x630a7
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