// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/univariatetree.c
// Function: find_split_for_partition_without_outliers
double find_split_for_partition_without_outliers(Instanceptr instances, Partition p, int fno, int conditiontype, double variancerange)
{
 /*!Last Changed 30.12.2003*/
 int nl = 0, nr = 0;
 double ml, mr, sr, sl, llower, lupper, rlower, rupper;
 if (p.count == 0 || instances == NULL || fno < 0 || all_same_side(p))
   return ISELL;
 left_and_right_sum(instances, p, fno, &ml, &mr, &nl, &nr, conditiontype);
 if (nl > 0)
   ml /= nl;
 else
   return ISELL;
 if (nr > 0)
   mr /= nr;
 else
   return ISELL;
 left_and_right_variance(instances, p, fno, &sl, &sr, ml, mr, conditiontype);
 if (nl > 1)
   sl /= (nl-1);
 else
   sl = 0;
 if (nr > 1)
   sr /= (nr-1);
 else
   sr = 0;
 llower = ml - variancerange * sqrt(sl);
 lupper = ml + variancerange * sqrt(sl);
 rlower = mr - variancerange * sqrt(sr);
 rupper = mr + variancerange * sqrt(sr);
 left_and_right_sum_without_outliers(instances, p, fno, &ml, &mr, &nl, &nr, llower, lupper, rlower, rupper);
 if (nl > 0)
   ml /= nl;
 else
   return ISELL;
 if (nr > 0)
   mr /= nr;
 else
   return ISELL;
 left_and_right_variance_without_outliers(instances, p, fno, &sl, &sr, ml, mr, llower, lupper, rlower, rupper);
 if (nl > 1)
   sl /= (nl-1);
 else
   sl = 0;
 if (nr > 1)
   sr /= (nr-1);
 else
   sr = 0;
 return solve_for_ldt_second_order_equation(ml, mr, sl, sr, nl, nr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movapd %xmm0, 0x90(%rsp)
xorl %eax, %eax
movl %eax, 0x64(%rsp)
movl %eax, 0x2c(%rsp)
testl %esi, %esi
js 0x9eb88
movq %rdi, %r14
testq %rdi, %rdi
je 0x9eb88
cmpl $0x0, 0xf0(%rsp)
je 0x9eb88
movl %edx, %ebp
movl %esi, %ebx
leaq 0xe0(%rsp), %r13
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movupd (%r13), %xmm0
movupd %xmm0, (%rsp)
callq 0x543f9
testl %eax, %eax
je 0x9eba2
movsd 0x4160(%rip), %xmm0     # 0xa2cf0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movupd (%r13), %xmm0
movupd %xmm0, (%rsp)
movl %ebp, 0x18(%rsp)
leaq 0x58(%rsp), %rdx
leaq 0x50(%rsp), %rcx
leaq 0x64(%rsp), %r15
leaq 0x2c(%rsp), %r9
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %r8
callq 0x9e284
movl (%r15), %r12d
testl %r12d, %r12d
jle 0x9eb88
cvtsi2sd %r12d, %xmm1
movsd 0x58(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movl 0x2c(%rsp), %r15d
testl %r15d, %r15d
jle 0x9eb88
cvtsi2sd %r15d, %xmm2
movsd 0x50(%rsp), %xmm1
divsd %xmm2, %xmm1
movsd %xmm1, 0x50(%rsp)
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movupd (%r13), %xmm2
movupd %xmm2, (%rsp)
leaq 0x40(%rsp), %rdx
leaq 0x48(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
movsd %xmm0, 0x70(%rsp)
movsd %xmm1, 0x68(%rsp)
movl %ebp, %r8d
callq 0x9e6b0
xorpd %xmm0, %xmm0
xorpd %xmm2, %xmm2
cmpl $0x1, %r12d
je 0x9ec71
decl %r12d
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
movsd 0x40(%rsp), %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0x40(%rsp)
xorpd %xmm4, %xmm4
cmpl $0x1, %r15d
je 0x9ec96
decl %r15d
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
movsd 0x48(%rsp), %xmm4
divsd %xmm1, %xmm4
movsd %xmm4, 0x48(%rsp)
xorps %xmm1, %xmm1
sqrtsd %xmm2, %xmm1
ucomisd %xmm0, %xmm2
movapd %xmm1, %xmm3
movsd %xmm4, 0x38(%rsp)
jae 0x9ece4
movapd %xmm2, %xmm0
movsd %xmm1, 0x30(%rsp)
movsd %xmm2, 0x80(%rsp)
callq 0x4300
movsd 0x80(%rsp), %xmm2
movsd 0x38(%rsp), %xmm4
movsd 0x30(%rsp), %xmm1
movapd %xmm0, %xmm3
movapd 0x44e4(%rip), %xmm0     # 0xa31d0
xorpd 0x90(%rsp), %xmm0
movapd %xmm0, 0x80(%rsp)
xorpd %xmm6, %xmm6
ucomisd %xmm6, %xmm2
jae 0x9ed2b
movapd %xmm2, %xmm0
movsd %xmm3, 0x78(%rsp)
callq 0x4300
xorpd %xmm6, %xmm6
movsd 0x78(%rsp), %xmm3
movsd 0x38(%rsp), %xmm4
movapd %xmm0, %xmm1
movapd 0x90(%rsp), %xmm0
mulsd %xmm0, %xmm3
mulsd %xmm0, %xmm1
sqrtsd %xmm4, %xmm5
ucomisd %xmm6, %xmm4
movapd %xmm5, %xmm0
jae 0x9ed83
movapd %xmm4, %xmm0
movsd %xmm1, 0x30(%rsp)
movsd %xmm3, 0x78(%rsp)
movsd %xmm5, 0xa0(%rsp)
callq 0x4300
movsd 0xa0(%rsp), %xmm5
movsd 0x78(%rsp), %xmm3
movsd 0x38(%rsp), %xmm4
movsd 0x30(%rsp), %xmm1
movsd 0x70(%rsp), %xmm2
addsd %xmm2, %xmm1
subsd %xmm3, %xmm2
movapd 0x80(%rsp), %xmm3
mulsd %xmm0, %xmm3
addsd 0x68(%rsp), %xmm3
movapd %xmm3, 0x80(%rsp)
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm4
movsd %xmm2, 0x70(%rsp)
movsd %xmm1, 0x30(%rsp)
jae 0x9eddc
movapd %xmm4, %xmm0
callq 0x4300
movsd 0x30(%rsp), %xmm1
movsd 0x70(%rsp), %xmm2
movapd %xmm0, %xmm5
movapd 0x90(%rsp), %xmm3
mulsd %xmm5, %xmm3
addsd 0x68(%rsp), %xmm3
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movups (%r13), %xmm0
movups %xmm0, (%rsp)
leaq 0x58(%rsp), %rdx
leaq 0x50(%rsp), %rcx
leaq 0x64(%rsp), %r15
leaq 0x2c(%rsp), %r9
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %r8
movapd %xmm2, %xmm0
movaps 0x80(%rsp), %xmm2
movapd %xmm3, 0x90(%rsp)
callq 0x9e3df
movsd 0x70(%rsp), %xmm2
movl (%r15), %r15d
testl %r15d, %r15d
jle 0x9eb88
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
movsd 0x58(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movl 0x2c(%rsp), %r12d
testl %r12d, %r12d
jle 0x9eb88
xorps %xmm3, %xmm3
cvtsi2sd %r12d, %xmm3
movsd 0x50(%rsp), %xmm1
divsd %xmm3, %xmm1
movsd %xmm1, 0x50(%rsp)
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movups (%r13), %xmm3
movups %xmm3, (%rsp)
leaq 0x40(%rsp), %rdx
leaq 0x48(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
movsd %xmm0, 0x68(%rsp)
movsd %xmm1, 0x38(%rsp)
movsd 0x30(%rsp), %xmm3
movaps 0x80(%rsp), %xmm4
movaps 0x90(%rsp), %xmm5
callq 0x9e543
xorpd %xmm3, %xmm3
xorpd %xmm2, %xmm2
cmpl $0x1, %r15d
je 0x9eef2
leal -0x1(%r15), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x40(%rsp), %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, 0x40(%rsp)
cmpl $0x1, %r12d
je 0x9ef14
leal -0x1(%r12), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x48(%rsp), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, 0x48(%rsp)
movsd 0x68(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movl %r15d, %edi
movl %r12d, %esi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9e809