// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/model.c
// Function: mlp_model_selection_crossvalidation
Mlpnetwork mlp_model_selection_crossvalidation(Instanceptr* data, Instanceptr validation, double alpha, int maxhidden, int problemtype)
{
	/*!Last Changed 26.06.2005*/
	int i, j, hiddennodes[1] = {1}, dummy, *models, dummy2;
	char **files, st[READLINELENGTH] = "-", pst[READLINELENGTH];
	FILE* mlpfile;
	Mlpparameters mlpparams;
	Instanceptr traindata, testdata;
	matrix train, test, cv, whole;
	Mlpnetwork neuralnetwork, best;
	double error;
	files = safemalloc(maxhidden * sizeof(char *), "mlp_model_selection_crossvalidation", 9);
 if (current_dataset->classno == 0)
	  mlpparams = prepare_Mlpparameters(*data, validation, 1, alpha, 1, hiddennodes, 0, 0.0, 0.0, 0, REGRESSION);
 else
   mlpparams = prepare_Mlpparameters(*data, validation, 1, alpha, 1, hiddennodes, 0, 0.0, 0.0, 0, CLASSIFICATION);
	cv = instancelist_to_matrix(validation, problemtype, -1, MULTIVARIATE_LINEAR);
	for (i = 1; i <= maxhidden; i++)
	 {
			mlpparams.hidden[0] = i;
		 files[i - 1] = safemalloc(500 * sizeof(char), "mlp_model_selection_crossvalidation", 15);
			sprintf(files[i - 1], "%s/%d.txt", get_parameter_s("tempdirectory"), i);
			mlpfile = fopen(files[i - 1], "w");
   if (!mlpfile)
     return best;
			for (j = 0; j < 5; j++)
			 {
				 divide_instancelist(data, &traindata, &testdata, 2);
	    train = instancelist_to_matrix(traindata, problemtype, -1, MULTIVARIATE_LINEAR);
	    test = instancelist_to_matrix(testdata, problemtype, -1, MULTIVARIATE_LINEAR);
					neuralnetwork = mlp_network_train_general(train, cv, &mlpparams);
					error = test_mlp_network(neuralnetwork, test);
					free_mlpnnetwork(&neuralnetwork);
			  set_precision(pst, NULL, "\n");
     fprintf(mlpfile, pst, error);
					neuralnetwork = mlp_network_train_general(test, cv, &mlpparams);
					error = test_mlp_network(neuralnetwork, train);
					free_mlpnnetwork(&neuralnetwork);
			  set_precision(pst, NULL, "\n");
     fprintf(mlpfile, pst, error);
					matrix_free(train);
					matrix_free(test);
					*data = traindata;
					merge_instancelist(data, testdata);
			 }
			fclose(mlpfile);
	 }
 models = multiple_comparison(files, maxhidden, PAIREDT5X2, st, &dummy, &dummy2, 1);
	whole = instancelist_to_matrix(*data, problemtype, -1, MULTIVARIATE_LINEAR); 
	mlpparams.hidden[0] = models[0];
	best = mlp_network_train_general(whole, cv, &mlpparams);
	matrix_free(cv);
	matrix_free(whole);
	free_2d((void **)files, maxhidden);
	safe_free(models);
	return best;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf4810, %rsp          # imm = 0xF4810
movq %rdi, -0xf4750(%rbp)
movq %rdi, -0xf4748(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl 0x806e5(%rip), %eax     # 0xe7168
movl %eax, -0x2c(%rbp)
leaq -0x7a170(%rbp), %rdi
xorl %esi, %esi
movl $0x7a120, %edx          # imm = 0x7A120
callq 0x4050
movb $0x2d, -0x7a170(%rbp)
movslq -0x1c(%rbp), %rdi
shlq $0x3, %rdi
leaq 0x8049f(%rip), %rsi     # 0xe6f4e
movl $0x9, %edx
callq 0x52d70
movq %rax, -0x48(%rbp)
leaq 0x9ed7c(%rip), %rax     # 0x105840
movq (%rax), %rax
cmpl $0x0, 0x10(%rax)
jne 0x66b2f
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
movsd -0x18(%rbp), %xmm0
leaq -0x2c(%rbp), %r9
leaq -0xf44a8(%rbp), %rdi
movl $0x1, %r8d
xorl %eax, %eax
xorps %xmm2, %xmm2
movl %r8d, %ecx
movl $0x0, (%rsp)
movaps %xmm2, %xmm1
movl $0x0, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
callq 0x61f60
leaq -0xf4328(%rbp), %rdi
leaq -0xf44a8(%rbp), %rsi
movl $0x90, %edx
callq 0x42b0
jmp 0x66b8f
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
movsd -0x18(%rbp), %xmm0
leaq -0x2c(%rbp), %r9
leaq -0xf4538(%rbp), %rdi
movl $0x1, %r8d
xorl %eax, %eax
xorps %xmm2, %xmm2
movl %r8d, %ecx
movl $0x0, (%rsp)
movaps %xmm2, %xmm1
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x61f60
leaq -0xf4328(%rbp), %rdi
leaq -0xf4538(%rbp), %rsi
movl $0x90, %edx
callq 0x42b0
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x44720
movq %rax, -0xf4548(%rbp)
movq %rdx, -0xf4540(%rbp)
movq -0xf4548(%rbp), %rax
movq %rax, -0xf4368(%rbp)
movq -0xf4540(%rbp), %rax
movq %rax, -0xf4360(%rbp)
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x66f46
movl -0x24(%rbp), %eax
movl %eax, -0xf42e0(%rbp)
movl $0x1f4, %edi            # imm = 0x1F4
leaq 0x80357(%rip), %rsi     # 0xe6f4e
movl $0xf, %edx
callq 0x52d70
movq %rax, %rdx
movq -0x48(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xf4758(%rbp)
leaq 0x80348(%rip), %rdi     # 0xe6f7c
callq 0x79190
movq -0xf4758(%rbp), %rdi
movq %rax, %rdx
movl -0x24(%rbp), %ecx
leaq 0x80325(%rip), %rsi     # 0xe6f72
movb $0x0, %al
callq 0x4170
movq -0x48(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x81552(%rip), %rsi     # 0xe81be
callq 0x40c0
movq %rax, -0xf4298(%rbp)
cmpq $0x0, -0xf4298(%rbp)
jne 0x66c87
jmp 0x67042
movl $0x0, -0x28(%rbp)
cmpl $0x5, -0x28(%rbp)
jge 0x66f2c
movq -0x8(%rbp), %rdi
leaq -0xf4330(%rbp), %rsi
leaq -0xf4338(%rbp), %rdx
movl $0x2, %ecx
callq 0x45f60
movq -0xf4330(%rbp), %rdi
movl -0x20(%rbp), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x44720
movq %rax, -0xf4558(%rbp)
movq %rdx, -0xf4550(%rbp)
movq -0xf4558(%rbp), %rax
movq %rax, -0xf4348(%rbp)
movq -0xf4550(%rbp), %rax
movq %rax, -0xf4340(%rbp)
movq -0xf4338(%rbp), %rdi
movl -0x20(%rbp), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x44720
movq %rax, -0xf4568(%rbp)
movq %rdx, -0xf4560(%rbp)
movq -0xf4568(%rbp), %rax
movq %rax, -0xf4358(%rbp)
movq -0xf4560(%rbp), %rax
movq %rax, -0xf4350(%rbp)
movq -0xf4348(%rbp), %rsi
movq -0xf4340(%rbp), %rdx
movq -0xf4368(%rbp), %rcx
movq -0xf4360(%rbp), %r8
leaq -0xf4600(%rbp), %rdi
leaq -0xf4328(%rbp), %r9
callq 0x61660
leaq -0xf4410(%rbp), %rdi
leaq -0xf4600(%rbp), %rsi
movl $0x98, %edx
callq 0x42b0
movq -0xf4358(%rbp), %rax
movq %rax, -0xf4770(%rbp)
movq -0xf4350(%rbp), %rax
movq %rax, -0xf4778(%rbp)
movq %rsp, %rdi
movl $0x13, %ecx
leaq -0xf4410(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0xf4778(%rbp), %rsi
movq -0xf4770(%rbp), %rdi
callq 0x61da0
movsd %xmm0, -0xf4418(%rbp)
leaq -0xf4410(%rbp), %rdi
callq 0x63ab0
leaq -0xf4290(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0x7ef53(%rip), %rdx     # 0xe5d3b
callq 0x53310
movq -0xf4298(%rbp), %rdi
leaq -0xf4290(%rbp), %rsi
movsd -0xf4418(%rbp), %xmm0
movb $0x1, %al
callq 0x4280
movq -0xf4358(%rbp), %rsi
movq -0xf4350(%rbp), %rdx
movq -0xf4368(%rbp), %rcx
movq -0xf4360(%rbp), %r8
leaq -0xf4698(%rbp), %rdi
leaq -0xf4328(%rbp), %r9
callq 0x61660
leaq -0xf4410(%rbp), %rdi
leaq -0xf4698(%rbp), %rsi
movl $0x98, %edx
callq 0x42b0
movq -0xf4348(%rbp), %rax
movq %rax, -0xf4760(%rbp)
movq -0xf4340(%rbp), %rax
movq %rax, -0xf4768(%rbp)
movq %rsp, %rdi
movl $0x13, %ecx
leaq -0xf4410(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0xf4768(%rbp), %rsi
movq -0xf4760(%rbp), %rdi
callq 0x61da0
movsd %xmm0, -0xf4418(%rbp)
leaq -0xf4410(%rbp), %rdi
callq 0x63ab0
leaq -0xf4290(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0x7ee83(%rip), %rdx     # 0xe5d3b
callq 0x53310
movq -0xf4298(%rbp), %rdi
leaq -0xf4290(%rbp), %rsi
movsd -0xf4418(%rbp), %xmm0
movb $0x1, %al
callq 0x4280
movq -0xf4348(%rbp), %rdi
movq -0xf4340(%rbp), %rsi
callq 0x59ea0
movq -0xf4358(%rbp), %rdi
movq -0xf4350(%rbp), %rsi
callq 0x59ea0
movq -0xf4330(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0xf4338(%rbp), %rsi
callq 0x44f40
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x66c8e
movq -0xf4298(%rbp), %rdi
callq 0x4250
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x66bd6
movq -0x48(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x7a170(%rbp), %rcx
movl $0xa, %edx
leaq -0x30(%rbp), %r8
leaq -0x3c(%rbp), %r9
movl $0x1, (%rsp)
callq 0xc3c40
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
callq 0x44720
movq %rax, -0xf46a8(%rbp)
movq %rdx, -0xf46a0(%rbp)
movq -0xf46a8(%rbp), %rax
movq %rax, -0xf4378(%rbp)
movq -0xf46a0(%rbp), %rax
movq %rax, -0xf4370(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xf42e0(%rbp)
movq -0xf4378(%rbp), %rsi
movq -0xf4370(%rbp), %rdx
movq -0xf4368(%rbp), %rcx
movq -0xf4360(%rbp), %r8
leaq -0xf4740(%rbp), %rdi
leaq -0xf4328(%rbp), %r9
callq 0x61660
movq -0xf4750(%rbp), %rdi
leaq -0xf4740(%rbp), %rsi
movl $0x98, %edx
callq 0x42b0
movq -0xf4368(%rbp), %rdi
movq -0xf4360(%rbp), %rsi
callq 0x59ea0
movq -0xf4378(%rbp), %rdi
movq -0xf4370(%rbp), %rsi
callq 0x59ea0
movq -0x48(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x52e20
movq -0x38(%rbp), %rdi
callq 0x52e80
movq -0xf4748(%rbp), %rax
addq $0xf4810, %rsp          # imm = 0xF4810
popq %rbp
retq
nopw %cs:(%rax,%rax)