// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/regressiontree.c
// Function: best_hybrid_regression_tree_split_aic_or_bic
int best_hybrid_regression_tree_split_aic_or_bic(Regressionnodeptr node, Regtree_parameterptr param)
{
	/*!Last Changed 27.03.2005*/
	int i, size = data_size(node->instances), d, bestmodel;
	double error, results[3];
 Instanceptr leftl, rightl, leftq, rightq, leftinstances, rightinstances;
 find_uni_and_multi_regression_splits(node, &leftl, &rightl, &leftq, &rightq);
	for (i = 0; i < 3; i++)
	 {
   leftinstances = rightinstances = NULL;
		 switch (i)
    {
		   case MODEL_UNI:divide_instancelist_according_to_split(&(node->instances), &leftinstances, &rightinstances, node->featureno, node->split);
						              d = 2;
						              break;
					case MODEL_LIN:divide_instancelist_according_centers(&(node->instances), &leftinstances, &rightinstances, leftl, rightl, NO);
						              d = current_dataset->multifeaturecount;
						              break;
					case MODEL_QUA:divide_instancelist_according_centers(&(node->instances), &leftinstances, &rightinstances, leftq, rightq, YES);
						              d = multifeaturecount_2d(current_dataset) + 1;
						              break;
    }
			error = (constant_or_linear_model_mse(leftinstances, leftinstances, param->leaftype) + constant_or_linear_model_mse(rightinstances, rightinstances, param->leaftype)) / size;
			if (param->modelselectionmethod == 1)
     results[i] = aic_squared_error(error, d, size);
			else
				 results[i] = bic_squared_error(error, d, size);
  	node->instances = restore_instancelist(node->instances, leftinstances);
	  merge_instancelist(&(node->instances), rightinstances);	
	 }
	bestmodel = find_min_in_list_double(results, 3);
	set_best_model_in_regression_tree(node, bestmodel, leftl, rightl, leftq, rightq);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rdi), %r15
movq 0x20(%rdi), %rdi
callq 0x30309
movl %eax, %ebp
leaq 0x68(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x60(%rsp), %r12
leaq 0x58(%rsp), %r13
movq %rbx, 0x38(%rsp)
movq %rbx, %rdi
movq %rsi, %rbx
movq %r12, %rcx
movq %r13, %r8
callq 0x781ea
movq (%r12), %rax
movq %rax, 0x30(%rsp)
movq (%r13), %rax
movq %rax, 0x28(%rsp)
movq (%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x50(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x40(%rsp)
xorl %r13d, %r13d
xorl %ebx, %ebx
movq %r13, 0x8(%rsp)
movq %r13, 0x10(%rsp)
cmpl $0x2, %ebx
je 0x7839b
cmpl $0x1, %ebx
jne 0x783d4
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r8
xorl %r9d, %r9d
callq 0x30a0d
leaq 0x5d4e1(%rip), %rax     # 0xd5870
movq (%rax), %rax
movl 0x1c0(%rax), %r12d
jmp 0x783f9
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %r8
movl $0x1, %r9d
callq 0x30a0d
leaq 0x5d4ac(%rip), %rax     # 0xd5870
movq (%rax), %rdi
callq 0x1372c
movl %eax, %r12d
incl %r12d
jmp 0x783f9
movq 0x38(%rsp), %rax
movl 0x68(%rax), %ecx
movsd 0x50(%rax), %xmm0
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x30ade
movl $0x2, %r12d
movq 0x10(%rsp), %rdi
movl (%r14), %edx
movq %rdi, %rsi
callq 0x77900
movsd %xmm0, 0x48(%rsp)
movq 0x8(%rsp), %rdi
movl (%r14), %edx
movq %rdi, %rsi
callq 0x77900
addsd 0x48(%rsp), %xmm0
divsd 0x40(%rsp), %xmm0
cmpl $0x1, 0x8(%r14)
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
movl %ebp, %edi
jne 0x78443
callq 0x47841
jmp 0x78448
callq 0x47c88
movsd %xmm0, 0x70(%rsp,%rbx,8)
movq (%r15), %rdi
movq 0x10(%rsp), %rsi
callq 0x31345
movq %rax, (%r15)
movq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x30648
incq %rbx
cmpq $0x3, %rbx
jne 0x78355
leaq 0x70(%rsp), %rdi
movl $0x3, %esi
callq 0x38250
movq 0x38(%rsp), %rdi
movl %eax, %esi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
movq 0x30(%rsp), %r8
movq 0x28(%rsp), %r9
callq 0x78254
movl $0x1, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq