// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/multivariaterule.c
// Function: find_best_multivariate_condition_lda
Decisionconditionptr find_best_multivariate_condition_lda(Instanceptr* growset, int positive, MULTIVARIATE_TYPE multivariate_type, double variance_explained)
{
 /*!Last Changed 21.09.2004 m number of features, n number of eigenvectors*/
 /*!Last Changed 02.02.2004 added safemalloc*/
 /*!Last Changed 09.01.2004*/
 int positivecount, negativecount, posover, negover, newdim, size = data_size(*growset), d = current_dataset->multifeaturecount - 1;
 Instanceptr positives = NULL, negatives = NULL;
 double it, itdot, gainover, gainunder;
 Decisionconditionptr result;
 result = empty_condition();
 result->featureindex = multivariate_type;
 result->conditiontype = MULTIVARIATE_CONDITION;
 divide_instancelist_one_vs_rest(growset, &positives, &negatives, positive);
 if (d < size)
  {
   if (!best_multivariate_split_lda_with_pca(positives, negatives, &(result->w), &(result->w0), multivariate_type, &newdim, variance_explained))
    {
     result->featureindex = -1;
     matrix_free(result->w);
     *growset = positives;
     merge_instancelist(growset, negatives);
     return result;
    }
  }
 else
  {
   if (!best_multivariate_split_lda_with_svd(positives, negatives, &(result->w), &(result->w0), multivariate_type, &newdim, variance_explained))
    {
     result->featureindex = -1;
     matrix_free(result->w);
     *growset = positives;
     merge_instancelist(growset, negatives);
     return result;
    }
  }
 result->freeparam = newdim;
 positivecount = data_size(positives);
 negativecount = data_size(negatives);
 it = information(positivecount, positivecount + negativecount);
 posover = count_multivariate_condition_over_threshold(positives, result);
 negover = count_multivariate_condition_over_threshold(negatives, result);
 if ((posover + negover) == positivecount + negativecount || (posover + negover) == 0)
  {
   result->featureindex = -1;
   matrix_free(result->w);
  }
 itdot = information(posover, posover + negover);
 gainover = posover * (it - itdot);
 itdot = information(positivecount - posover, positivecount - posover + negativecount - negover);
 gainunder = (positivecount - posover) * (it - itdot);
 if (gainover > gainunder)
   result->comparison = '>';
 else
   result->comparison = '<';
 *growset = positives;
 merge_instancelist(growset, negatives);
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x449f0
movl %eax, -0x38(%rbp)
leaq 0x97ee0(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, %al
callq 0xadea0
movq %rax, -0x78(%rbp)
movl -0x18(%rbp), %ecx
movq -0x78(%rbp), %rax
movl %ecx, (%rax)
movq -0x78(%rbp), %rax
movl $0x1, 0x40(%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %ecx
leaq -0x48(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x45b50
movl -0x3c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x6da2b
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq $0x20, %rdx
movq -0x78(%rbp), %rcx
addq $0x30, %rcx
movl -0x18(%rbp), %r8d
movsd -0x20(%rbp), %xmm0
leaq -0x34(%rbp), %r9
callq 0x6e550
cmpl $0x0, %eax
jne 0x6da29
movq -0x78(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x78(%rbp), %rax
movq 0x20(%rax), %rdi
movq 0x28(%rax), %rsi
callq 0x59ea0
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x44f40
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6dbc9
jmp 0x6da9c
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq $0x20, %rdx
movq -0x78(%rbp), %rcx
addq $0x30, %rcx
movl -0x18(%rbp), %r8d
movsd -0x20(%rbp), %xmm0
leaq -0x34(%rbp), %r9
callq 0x6eed0
cmpl $0x0, %eax
jne 0x6da9a
movq -0x78(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x78(%rbp), %rax
movq 0x20(%rax), %rdi
movq 0x28(%rax), %rsi
callq 0x59ea0
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x44f40
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6dbc9
jmp 0x6da9c
movl -0x34(%rbp), %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x48(%rbp), %rdi
callq 0x449f0
movl %eax, -0x24(%rbp)
movq -0x50(%rbp), %rdi
callq 0x449f0
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %edi
movl -0x24(%rbp), %esi
addl -0x28(%rbp), %esi
callq 0xae3a0
movsd %xmm0, -0x58(%rbp)
movq -0x48(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x6d3a0
movl %eax, -0x2c(%rbp)
movq -0x50(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x6d3a0
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
addl -0x30(%rbp), %eax
movl -0x24(%rbp), %ecx
addl -0x28(%rbp), %ecx
cmpl %ecx, %eax
je 0x6db0c
movl -0x2c(%rbp), %eax
addl -0x30(%rbp), %eax
cmpl $0x0, %eax
jne 0x6db27
movq -0x78(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x78(%rbp), %rax
movq 0x20(%rax), %rdi
movq 0x28(%rax), %rsi
callq 0x59ea0
movl -0x2c(%rbp), %edi
movl -0x2c(%rbp), %esi
addl -0x30(%rbp), %esi
callq 0xae3a0
movsd %xmm0, -0x60(%rbp)
cvtsi2sdl -0x2c(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
subsd -0x60(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0x24(%rbp), %edi
subl -0x2c(%rbp), %edi
movl -0x24(%rbp), %esi
subl -0x2c(%rbp), %esi
addl -0x28(%rbp), %esi
subl -0x30(%rbp), %esi
callq 0xae3a0
movsd %xmm0, -0x60(%rbp)
movl -0x24(%rbp), %eax
subl -0x2c(%rbp), %eax
cvtsi2sd %eax, %xmm0
movsd -0x58(%rbp), %xmm1
subsd -0x60(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x68(%rbp), %xmm0
ucomisd -0x70(%rbp), %xmm0
jbe 0x6dba1
movq -0x78(%rbp), %rax
movb $0x3e, 0x4(%rax)
jmp 0x6dba9
movq -0x78(%rbp), %rax
movb $0x3c, 0x4(%rax)
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x44f40
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)