// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x449f0
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x58(%rbp), %rcx
leaq -0x60(%rbp), %r8
callq 0xa83a0
movl $0x0, -0x14(%rbp)
cmpl $0x3, -0x14(%rbp)
jge 0xa870f
movq $0x0, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x74(%rbp)
testl %eax, %eax
je 0xa85b0
jmp 0xa8599
movl -0x74(%rbp), %eax
subl $0x1, %eax
je 0xa85de
jmp 0xa85a3
movl -0x74(%rbp), %eax
subl $0x2, %eax
je 0xa8613
jmp 0xa864b
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
movq -0x8(%rbp), %rax
movl 0x68(%rax), %ecx
movq -0x8(%rbp), %rax
movsd 0x50(%rax), %xmm0
leaq -0x68(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x456d0
movl $0x2, -0x1c(%rbp)
jmp 0xa864b
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
movq -0x48(%rbp), %rcx
movq -0x50(%rbp), %r8
leaq -0x68(%rbp), %rsi
leaq -0x70(%rbp), %rdx
xorl %r9d, %r9d
callq 0x45590
leaq 0x5d23b(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %eax
movl %eax, -0x1c(%rbp)
jmp 0xa864b
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
movq -0x58(%rbp), %rcx
movq -0x60(%rbp), %r8
leaq -0x68(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movl $0x1, %r9d
callq 0x45590
leaq 0x5d203(%rip), %rax     # 0x105840
movq (%rax), %rdi
callq 0x1b690
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x68(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x10(%rbp), %rax
movl (%rax), %edx
callq 0xa7830
movsd %xmm0, -0x80(%rbp)
movq -0x70(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x10(%rbp), %rax
movl (%rax), %edx
callq 0xa7830
movaps %xmm0, %xmm1
movsd -0x80(%rbp), %xmm0
addsd %xmm1, %xmm0
cvtsi2sdl -0x18(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0xa86b8
movsd -0x28(%rbp), %xmm0
cvtsi2sdl -0x1c(%rbp), %xmm1
movl -0x18(%rbp), %edi
callq 0x663e0
movslq -0x14(%rbp), %rax
movsd %xmm0, -0x40(%rbp,%rax,8)
jmp 0xa86d4
movsd -0x28(%rbp), %xmm0
cvtsi2sdl -0x1c(%rbp), %xmm1
movl -0x18(%rbp), %edi
callq 0x66950
movslq -0x14(%rbp), %rax
movsd %xmm0, -0x40(%rbp,%rax,8)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x68(%rbp), %rsi
callq 0x464e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
movq -0x70(%rbp), %rsi
callq 0x44f40
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xa8573
leaq -0x40(%rbp), %rdi
movl $0x3, %esi
callq 0x50490
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %esi
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %r8
movq -0x60(%rbp), %r9
callq 0xa8440
movl $0x1, %eax
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)