// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/omnivariaterule.c
// Function: find_best_hybrid_condition_crossvalidation
Decisionconditionptr find_best_hybrid_condition_crossvalidation(Instanceptr* growset, int positive, Ripper_parameterptr param)
{
 /*!Last Changed 30.01.2004 added denom == 0 condition*/
 /*!Last Changed 22.01.2004*/
 int hybridspace = get_parameter_i("hybridspace");
 Decisionconditionptr result, condition;
 char **files, st[READLINELENGTH] = "-", pst[READLINELENGTH], buffer[READLINELENGTH];
 Instanceptr train = NULL, test = NULL, traindata, testdata;
 int bestmodel = 0, error, trainsize, testsize, *models, dummy, dummy2, i, j, k, datasize, testtype;
 FILE* errorfiles[3];
 files = safemalloc(hybridspace * sizeof(char *), "find_best_hybrid_ldt_split_crossvalidation", 6); 
 strcpy(buffer, get_parameter_s("tempdirectory"));
 strcat(buffer, "/univariate.txt");
 files[0] = strcopy(files[0], buffer);
 strcpy(buffer, get_parameter_s("tempdirectory"));
 strcat(buffer, "/linear.txt");
 files[1] = strcopy(files[1], buffer);
 if (hybridspace == 3)
  {
   strcpy(buffer, get_parameter_s("tempdirectory"));
   strcat(buffer, "/quadratic.txt");
   files[2] = strcopy(files[2], buffer);
  }
 for (i = 0; i < hybridspace; i++)
  {
   errorfiles[i] = fopen(files[i], "w");
   if (!errorfiles[i])
     return NULL;
  }
 for (i = 0; i < 5; i++)
  {
   divide_instancelist(growset, &train, &test, 2);
   trainsize = data_size(train);
   testsize = data_size(test);
   if (trainsize <= 1 || testsize <= 1)
    {
     *growset = restore_instancelist(*growset, train);
     merge_instancelist(growset, test); 
     bestmodel = 1;
     break;
    }
   for (j = 0; j < 2; j++)
    {
     if (j == 0)
      {
       traindata = train;
       testdata = test;
       datasize = testsize;
      }
     else
      {
       traindata = test;
       testdata = train;
       datasize = trainsize;
      }
     for (k = 0; k < hybridspace; k++)
      {
       switch (k)
        {
         case MODEL_UNI:condition = find_best_condition_for_realized_features(traindata, positive);
                        break;
         case MODEL_LIN:condition = find_best_multivariate_condition(&traindata, positive, MULTIVARIATE_LINEAR, param);
                        break;
         case MODEL_QUA:condition = find_best_multivariate_condition(&traindata, positive, MULTIVARIATE_QUADRATIC, param);
                        break;
        }
       error = return_error_and_free_condition(condition, testdata, positive);
       set_precision(pst, NULL, "\n");
       fprintf(errorfiles[k], pst, error / (datasize + 0.0));
      }
    }
   *growset = restore_instancelist(*growset, testdata);
   merge_instancelist(growset, traindata); 
   train = NULL;
   test = NULL;
  }
 for (i = 0; i < hybridspace; i++)
   fclose(errorfiles[i]);
 if (bestmodel)
  {
   free_2d((void**)files, hybridspace);
   result = find_best_condition_for_realized_features(*growset, positive);
   if (result)
     result->datasize = trainsize + testsize;
   return result;
  }
 testtype = get_parameter_l("testtype");
 if (in_list(testtype, 9, FTEST, PAIREDT5X2, COMBINEDT5X2, PERMUTATIONTEST, PAIREDPERMUTATIONTEST, SIGNTEST, RANKSUMTEST, SIGNEDRANKTEST, NOTEST))
   models = multiple_comparison(files, hybridspace, testtype, st, &dummy, &dummy2, param->correctiontype);
 else
   models = multiple_comparison(files, hybridspace, FTEST, st, &dummy, &dummy2, param->correctiontype);
 switch (models[0])
  {
   case 1:result = find_best_condition_for_realized_features(*growset, positive);
          break;
   case 2:result = find_best_multivariate_condition(growset, positive, MULTIVARIATE_LINEAR, param);
          break;
   case 3:result = find_best_multivariate_condition(growset, positive, MULTIVARIATE_QUADRATIC, param);
          break;
  }
 safe_free(models);
 free_2d((void**)files, hybridspace);
 if (result)
  {
   result->conditiontype = HYBRID_CONDITION;
   result->datasize = trainsize + testsize;
  }
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x16e460, %rsp         # imm = 0x16E460
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
leaq 0x700f3(%rip), %rdi     # 0xe57d0
callq 0x78f10
movl %eax, -0x24(%rbp)
leaq -0x7a160(%rbp), %rdi
xorl %esi, %esi
movl $0x7a120, %edx          # imm = 0x7A120
callq 0x4050
movb $0x2d, -0x7a160(%rbp)
movq $0x0, -0x16e3a8(%rbp)
movq $0x0, -0x16e3b0(%rbp)
movl $0x0, -0x16e3c4(%rbp)
movslq -0x24(%rbp), %rdi
shlq $0x3, %rdi
leaq 0x71d1b(%rip), %rsi     # 0xe7449
movl $0x6, %edx
callq 0x52d70
movq %rax, -0x40(%rbp)
leaq -0x16e3a0(%rbp), %rax
movq %rax, -0x16e420(%rbp)
leaq 0x7182b(%rip), %rdi     # 0xe6f7c
callq 0x79190
movq -0x16e420(%rbp), %rdi
movq %rax, %rsi
callq 0x4220
leaq -0x16e3a0(%rbp), %rdi
leaq 0x71d01(%rip), %rsi     # 0xe7474
callq 0x41a0
movq -0x40(%rbp), %rax
movq (%rax), %rdi
leaq -0x16e3a0(%rbp), %rsi
callq 0x54ba0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
leaq -0x16e3a0(%rbp), %rax
movq %rax, -0x16e418(%rbp)
leaq 0x717d2(%rip), %rdi     # 0xe6f7c
callq 0x79190
movq -0x16e418(%rbp), %rdi
movq %rax, %rsi
callq 0x4220
leaq -0x16e3a0(%rbp), %rdi
leaq 0x71cb8(%rip), %rsi     # 0xe7484
callq 0x41a0
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x16e3a0(%rbp), %rsi
callq 0x54ba0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpl $0x3, -0x24(%rbp)
jne 0x75851
leaq -0x16e3a0(%rbp), %rax
movq %rax, -0x16e428(%rbp)
leaq 0x71771(%rip), %rdi     # 0xe6f7c
callq 0x79190
movq -0x16e428(%rbp), %rdi
movq %rax, %rsi
callq 0x4220
leaq -0x16e3a0(%rbp), %rdi
leaq 0x71c63(%rip), %rsi     # 0xe7490
callq 0x41a0
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x16e3a0(%rbp), %rsi
callq 0x54ba0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x16e3e4(%rbp)
movl -0x16e3e4(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x758c5
movq -0x40(%rbp), %rax
movslq -0x16e3e4(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x72942(%rip), %rsi     # 0xe81be
callq 0x40c0
movq %rax, %rcx
movslq -0x16e3e4(%rbp), %rax
movq %rcx, -0x16e410(%rbp,%rax,8)
movslq -0x16e3e4(%rbp), %rax
cmpq $0x0, -0x16e410(%rbp,%rax,8)
jne 0x758b2
movq $0x0, -0x8(%rbp)
jmp 0x75d77
jmp 0x758b4
movl -0x16e3e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e3e4(%rbp)
jmp 0x7585b
movl $0x0, -0x16e3e4(%rbp)
cmpl $0x5, -0x16e3e4(%rbp)
jge 0x75b59
movq -0x10(%rbp), %rdi
leaq -0x16e3a8(%rbp), %rsi
leaq -0x16e3b0(%rbp), %rdx
movl $0x2, %ecx
callq 0x45f60
movq -0x16e3a8(%rbp), %rdi
callq 0x449f0
movl %eax, -0x16e3cc(%rbp)
movq -0x16e3b0(%rbp), %rdi
callq 0x449f0
movl %eax, -0x16e3d0(%rbp)
cmpl $0x1, -0x16e3cc(%rbp)
jle 0x7592e
cmpl $0x1, -0x16e3d0(%rbp)
jg 0x7596a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x16e3a8(%rbp), %rsi
callq 0x464e0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x16e3b0(%rbp), %rsi
callq 0x44f40
movl $0x1, -0x16e3c4(%rbp)
jmp 0x75b59
movl $0x0, -0x16e3e8(%rbp)
cmpl $0x2, -0x16e3e8(%rbp)
jge 0x75b02
cmpl $0x0, -0x16e3e8(%rbp)
jne 0x759b4
movq -0x16e3a8(%rbp), %rax
movq %rax, -0x16e3b8(%rbp)
movq -0x16e3b0(%rbp), %rax
movq %rax, -0x16e3c0(%rbp)
movl -0x16e3d0(%rbp), %eax
movl %eax, -0x16e3f0(%rbp)
jmp 0x759dc
movq -0x16e3b0(%rbp), %rax
movq %rax, -0x16e3b8(%rbp)
movq -0x16e3a8(%rbp), %rax
movq %rax, -0x16e3c0(%rbp)
movl -0x16e3cc(%rbp), %eax
movl %eax, -0x16e3f0(%rbp)
movl $0x0, -0x16e3ec(%rbp)
movl -0x16e3ec(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x75aec
movl -0x16e3ec(%rbp), %eax
movl %eax, -0x16e42c(%rbp)
testl %eax, %eax
je 0x75a21
jmp 0x75a07
movl -0x16e42c(%rbp), %eax
subl $0x1, %eax
je 0x75a36
jmp 0x75a14
movl -0x16e42c(%rbp), %eax
subl $0x2, %eax
je 0x75a54
jmp 0x75a70
movq -0x16e3b8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0xda380
movq %rax, -0x38(%rbp)
jmp 0x75a70
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rcx
leaq -0x16e3b8(%rbp), %rdi
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
callq 0x6d880
movq %rax, -0x38(%rbp)
jmp 0x75a70
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rcx
leaq -0x16e3b8(%rbp), %rdi
movl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
callq 0x6d880
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x16e3c0(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0xae4c0
movl %eax, -0x16e3c8(%rbp)
leaq -0xf4280(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0x702a0(%rip), %rdx     # 0xe5d3b
callq 0x53310
movslq -0x16e3ec(%rbp), %rax
movq -0x16e410(%rbp,%rax,8), %rdi
leaq -0xf4280(%rbp), %rsi
cvtsi2sdl -0x16e3c8(%rbp), %xmm0
cvtsi2sdl -0x16e3f0(%rbp), %xmm1
xorps %xmm2, %xmm2
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movb $0x1, %al
callq 0x4280
movl -0x16e3ec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e3ec(%rbp)
jmp 0x759e6
jmp 0x75aee
movl -0x16e3e8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e3e8(%rbp)
jmp 0x75974
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x16e3c0(%rbp), %rsi
callq 0x464e0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x16e3b8(%rbp), %rsi
callq 0x44f40
movq $0x0, -0x16e3a8(%rbp)
movq $0x0, -0x16e3b0(%rbp)
movl -0x16e3e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e3e4(%rbp)
jmp 0x758cf
movl $0x0, -0x16e3e4(%rbp)
movl -0x16e3e4(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x75b93
movslq -0x16e3e4(%rbp), %rax
movq -0x16e410(%rbp,%rax,8), %rdi
callq 0x4250
movl -0x16e3e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e3e4(%rbp)
jmp 0x75b63
cmpl $0x0, -0x16e3c4(%rbp)
je 0x75be2
movq -0x40(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x52e20
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x14(%rbp), %esi
callq 0xda380
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x75bd5
movl -0x16e3cc(%rbp), %ecx
addl -0x16e3d0(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x75d77
leaq 0x713d8(%rip), %rdi     # 0xe6fc1
callq 0x792b0
movl %eax, -0x16e3f4(%rbp)
movl -0x16e3f4(%rbp), %edi
movl $0x9, %esi
movl $0x3, %edx
movl $0xa, %ecx
movl $0xc, %r8d
movl $0xf, %r9d
movl $0x10, (%rsp)
movl $0xe, 0x8(%rsp)
movl $0x6, 0x10(%rsp)
movl $0x7, 0x18(%rsp)
movl $0x13, 0x20(%rsp)
movb $0x0, %al
callq 0x53e40
cmpl $0x0, %eax
je 0x75c82
movq -0x40(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x16e3f4(%rbp), %edx
leaq -0x7a160(%rbp), %rcx
movq -0x20(%rbp), %rax
movl 0x3c(%rax), %eax
leaq -0x16e3dc(%rbp), %r8
leaq -0x16e3e0(%rbp), %r9
movl %eax, (%rsp)
callq 0xc3c40
movq %rax, -0x16e3d8(%rbp)
jmp 0x75cb9
movq -0x40(%rbp), %rdi
movl -0x24(%rbp), %esi
leaq -0x7a160(%rbp), %rcx
movq -0x20(%rbp), %rax
movl 0x3c(%rax), %eax
movl $0x3, %edx
leaq -0x16e3dc(%rbp), %r8
leaq -0x16e3e0(%rbp), %r9
movl %eax, (%rsp)
callq 0xc3c40
movq %rax, -0x16e3d8(%rbp)
movq -0x16e3d8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x16e430(%rbp)
subl $0x1, %eax
je 0x75ce9
jmp 0x75ccf
movl -0x16e430(%rbp), %eax
subl $0x2, %eax
je 0x75cfe
jmp 0x75cdc
movl -0x16e430(%rbp), %eax
subl $0x3, %eax
je 0x75d19
jmp 0x75d32
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x14(%rbp), %esi
callq 0xda380
movq %rax, -0x30(%rbp)
jmp 0x75d32
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rcx
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
callq 0x6d880
movq %rax, -0x30(%rbp)
jmp 0x75d32
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rcx
movl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
callq 0x6d880
movq %rax, -0x30(%rbp)
movq -0x16e3d8(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x52e20
cmpq $0x0, -0x30(%rbp)
je 0x75d6f
movq -0x30(%rbp), %rax
movl $0x2, 0x40(%rax)
movl -0x16e3cc(%rbp), %ecx
addl -0x16e3d0(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x16e460, %rsp         # imm = 0x16E460
popq %rbp
retq
nopw %cs:(%rax,%rax)