// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/model.c
// Function: compare_mlp_model_selection_techniques
int compare_mlp_model_selection_techniques(char *datasetname, char* simulationdirectory, int maxhidden, int starthidden)
{
	/*!Last Changed 18.07.2005*/
	char** filenames, filename[500], tmpst[READLINELENGTH], varname[MAXLENGTH], varvalue[MAXLENGTH];
	int* model, dummy, dummy2, i, j, k, selectedmodels[MAX_MLP_SIMULATION_ALGORITHMS], tries[MAX_MLP_SIMULATION_ALGORITHMS], bestmodel, indexes[MAX_MLP_SIMULATION_ALGORITHMS], sum;
	Datasetptr d;
 d = search_dataset(Datasets, datasetname);
	if (d == NULL)
		 return -1;
	filenames = safemalloc((maxhidden + 1) * sizeof(char *), "compare_mlp_model_selection_techniques", 7);
 for (i = 0; i <= maxhidden; i++)
	 {
		 sprintf(filename, "%s/%s-%d.txt", simulationdirectory, d->name, i);
			filenames[i] = strcopy(filenames[i], filename);
	 }
	strcpy(tmpst, "-");
 model = multiple_comparison(filenames, maxhidden + 1, get_parameter_l("testtype"), tmpst, &dummy, &dummy2, get_parameter_l("correctiontype"));
	free_2d((void**)filenames, maxhidden + 1);
	for (i = 0; i < MAX_MLP_SIMULATION_ALGORITHMS; i++)
	 {
		 switch (i)
	   {
		   case MULTIMOST    :bestmodel = mlp_model_simulation_multitest(d, simulationdirectory, maxhidden, starthidden, &(tries[i]));
						                  break;
					case ONE_FORWARD  :bestmodel = mlp_model_simulation_one_forward(d, simulationdirectory, maxhidden, starthidden, &(tries[i]));
						                  break;
					case ONE_BACKWARD :bestmodel = mlp_model_simulation_one_backward(d, simulationdirectory, maxhidden, starthidden, &(tries[i]));
						                  break;
					case FORWARD_MOST :bestmodel = mlp_model_simulation_most(d, simulationdirectory, maxhidden, starthidden, &(tries[i]), FORWARD);
						                  break;
					case BACKWARD_MOST:bestmodel = mlp_model_simulation_most(d, simulationdirectory, maxhidden, starthidden, &(tries[i]), BACKWARD);
						                  break;
    }
			selectedmodels[i] = search_list(model, maxhidden + 1, bestmodel + 1);
	  sprintf(varname, "aout2[%d]", i + 1);
	  sprintf(varvalue, "%d", selectedmodels[i]);
   set_variable(varname, varvalue);
			indexes[i] = i;
	 }
	for (i = 0; i < MAX_MLP_SIMULATION_ALGORITHMS; i++)
		 for (j = i + 1; j < MAX_MLP_SIMULATION_ALGORITHMS; j++)
				 if (selectedmodels[i] > selectedmodels[j])
					 {
						 swap_int(&(selectedmodels[i]), &(selectedmodels[j]));
						 swap_int(&(indexes[i]), &(indexes[j]));
							swap_int(&(tries[i]), &(tries[j]));
					 }
					else
						 if (selectedmodels[i] == selectedmodels[j] && tries[i] > tries[j])
							 {
  						 swap_int(&(selectedmodels[i]), &(selectedmodels[j]));
	  					 swap_int(&(indexes[i]), &(indexes[j]));
  							swap_int(&(tries[i]), &(tries[j]));
							 }
 i = 0;
	while (i < MAX_MLP_SIMULATION_ALGORITHMS)
	 {
		 j = i;
			sum = j + 1;
		 while (j < MAX_MLP_SIMULATION_ALGORITHMS - 1 && selectedmodels[j] == selectedmodels[j + 1] && tries[j] == tries[j + 1])
			 {
				 j++;
				 sum = sum + j + 1;
			 }
			for (k = i; k <= j; k++)
			 {
	    sprintf(varname, "aout1[%d]", indexes[k] + 1);
	    sprintf(varvalue, "%.1f", sum / (j - i + 1.0));
     set_variable(varname, varvalue);
			 }
			i = j + 1;
	 }
	return model[0] - 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x16e630, %rsp         # imm = 0x16E630
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
leaq 0x9bb38(%rip), %rax     # 0x105848
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x1db80
movq %rax, -0x16e600(%rbp)
cmpq $0x0, -0x16e600(%rbp)
jne 0x69d39
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6a3eb
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0x7d3cd(%rip), %rsi     # 0xe711a
movl $0x7, %edx
callq 0x52d70
movq %rax, -0x28(%rbp)
movl $0x0, -0x16e594(%rbp)
movl -0x16e594(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x69dd9
leaq -0x220(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x16e600(%rbp), %rax
movq 0x8(%rax), %rcx
movl -0x16e594(%rbp), %r8d
leaq 0x7d2b8(%rip), %rsi     # 0xe704c
movb $0x0, %al
callq 0x4170
movq -0x28(%rbp), %rax
movslq -0x16e594(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x220(%rbp), %rsi
callq 0x54ba0
movq %rax, %rdx
movq -0x28(%rbp), %rax
movslq -0x16e594(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x16e594(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e594(%rbp)
jmp 0x69d65
leaq -0x7a340(%rbp), %rdi
leaq 0x7bd9b(%rip), %rsi     # 0xe5b82
callq 0x4220
movq -0x28(%rbp), %rax
movq %rax, -0x16e618(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e610(%rbp)
leaq 0x7d1b7(%rip), %rdi     # 0xe6fc1
callq 0x792b0
movl %eax, -0x16e60c(%rbp)
leaq -0x7a340(%rbp), %rax
movq %rax, -0x16e608(%rbp)
leaq 0x78883(%rip), %rdi     # 0xe26ad
callq 0x792b0
movq -0x16e618(%rbp), %rdi
movl -0x16e610(%rbp), %esi
movl -0x16e60c(%rbp), %edx
movq -0x16e608(%rbp), %rcx
leaq -0x16e58c(%rbp), %r8
leaq -0x16e590(%rbp), %r9
movl %eax, (%rsp)
callq 0xc3c40
movq %rax, -0x16e588(%rbp)
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %esi
addl $0x1, %esi
callq 0x52e20
movl $0x0, -0x16e594(%rbp)
cmpl $0x5, -0x16e594(%rbp)
jge 0x6a06d
movl -0x16e594(%rbp), %eax
movq %rax, -0x16e620(%rbp)
subq $0x4, %rax
ja 0x69fc6
movq -0x16e620(%rbp), %rax
leaq 0x7d067(%rip), %rcx     # 0xe6f18
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x16e600(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movslq -0x16e594(%rbp), %rax
leaq -0x16e5d0(%rbp), %r8
shlq $0x2, %rax
addq %rax, %r8
callq 0x68230
movl %eax, -0x16e5d4(%rbp)
jmp 0x69fc6
movq -0x16e600(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movslq -0x16e594(%rbp), %rax
leaq -0x16e5d0(%rbp), %r8
shlq $0x2, %rax
addq %rax, %r8
callq 0x69730
movl %eax, -0x16e5d4(%rbp)
jmp 0x69fc6
movq -0x16e600(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movslq -0x16e594(%rbp), %rax
leaq -0x16e5d0(%rbp), %r8
shlq $0x2, %rax
addq %rax, %r8
callq 0x69a00
movl %eax, -0x16e5d4(%rbp)
jmp 0x69fc6
movq -0x16e600(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movslq -0x16e594(%rbp), %rax
leaq -0x16e5d0(%rbp), %r8
shlq $0x2, %rax
addq %rax, %r8
xorl %r9d, %r9d
callq 0x691b0
movl %eax, -0x16e5d4(%rbp)
jmp 0x69fc6
movq -0x16e600(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movslq -0x16e594(%rbp), %rax
leaq -0x16e5d0(%rbp), %r8
shlq $0x2, %rax
addq %rax, %r8
movl $0x1, %r9d
callq 0x691b0
movl %eax, -0x16e5d4(%rbp)
movq -0x16e588(%rbp), %rdi
movl -0x1c(%rbp), %esi
addl $0x1, %esi
movl -0x16e5d4(%rbp), %edx
addl $0x1, %edx
callq 0x508f0
movl %eax, %ecx
movslq -0x16e594(%rbp), %rax
movl %ecx, -0x16e5b0(%rbp,%rax,4)
leaq -0xf4460(%rbp), %rdi
movl -0x16e594(%rbp), %edx
addl $0x1, %edx
leaq 0x7cf82(%rip), %rsi     # 0xe6f8a
movb $0x0, %al
callq 0x4170
leaq -0x16e580(%rbp), %rdi
movslq -0x16e594(%rbp), %rax
movl -0x16e5b0(%rbp,%rax,4), %edx
leaq 0x8323a(%rip), %rsi     # 0xed265
movb $0x0, %al
callq 0x4170
leaq -0xf4460(%rbp), %rdi
leaq -0x16e580(%rbp), %rsi
callq 0x493b0
movl -0x16e594(%rbp), %ecx
movslq -0x16e594(%rbp), %rax
movl %ecx, -0x16e5f0(%rbp,%rax,4)
movl -0x16e594(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e594(%rbp)
jmp 0x69e7f
movl $0x0, -0x16e594(%rbp)
cmpl $0x5, -0x16e594(%rbp)
jge 0x6a253
movl -0x16e594(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e598(%rbp)
cmpl $0x5, -0x16e598(%rbp)
jge 0x6a23d
movslq -0x16e594(%rbp), %rax
movl -0x16e5b0(%rbp,%rax,4), %eax
movslq -0x16e598(%rbp), %rcx
cmpl -0x16e5b0(%rbp,%rcx,4), %eax
jle 0x6a154
movslq -0x16e594(%rbp), %rax
leaq -0x16e5b0(%rbp), %rdi
shlq $0x2, %rax
addq %rax, %rdi
movslq -0x16e598(%rbp), %rax
leaq -0x16e5b0(%rbp), %rsi
shlq $0x2, %rax
addq %rax, %rsi
callq 0x533d0
movslq -0x16e594(%rbp), %rax
leaq -0x16e5f0(%rbp), %rdi
shlq $0x2, %rax
addq %rax, %rdi
movslq -0x16e598(%rbp), %rax
leaq -0x16e5f0(%rbp), %rsi
shlq $0x2, %rax
addq %rax, %rsi
callq 0x533d0
movslq -0x16e594(%rbp), %rax
leaq -0x16e5d0(%rbp), %rdi
shlq $0x2, %rax
addq %rax, %rdi
movslq -0x16e598(%rbp), %rax
leaq -0x16e5d0(%rbp), %rsi
shlq $0x2, %rax
addq %rax, %rsi
callq 0x533d0
jmp 0x6a227
movslq -0x16e594(%rbp), %rax
movl -0x16e5b0(%rbp,%rax,4), %eax
movslq -0x16e598(%rbp), %rcx
cmpl -0x16e5b0(%rbp,%rcx,4), %eax
jne 0x6a225
movslq -0x16e594(%rbp), %rax
movl -0x16e5d0(%rbp,%rax,4), %eax
movslq -0x16e598(%rbp), %rcx
cmpl -0x16e5d0(%rbp,%rcx,4), %eax
jle 0x6a225
movslq -0x16e594(%rbp), %rax
leaq -0x16e5b0(%rbp), %rdi
shlq $0x2, %rax
addq %rax, %rdi
movslq -0x16e598(%rbp), %rax
leaq -0x16e5b0(%rbp), %rsi
shlq $0x2, %rax
addq %rax, %rsi
callq 0x533d0
movslq -0x16e594(%rbp), %rax
leaq -0x16e5f0(%rbp), %rdi
shlq $0x2, %rax
addq %rax, %rdi
movslq -0x16e598(%rbp), %rax
leaq -0x16e5f0(%rbp), %rsi
shlq $0x2, %rax
addq %rax, %rsi
callq 0x533d0
movslq -0x16e594(%rbp), %rax
leaq -0x16e5d0(%rbp), %rdi
shlq $0x2, %rax
addq %rax, %rdi
movslq -0x16e598(%rbp), %rax
leaq -0x16e5d0(%rbp), %rsi
shlq $0x2, %rax
addq %rax, %rsi
callq 0x533d0
jmp 0x6a227
jmp 0x6a229
movl -0x16e598(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e598(%rbp)
jmp 0x6a093
jmp 0x6a23f
movl -0x16e594(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e594(%rbp)
jmp 0x6a077
movl $0x0, -0x16e594(%rbp)
cmpl $0x5, -0x16e594(%rbp)
jge 0x6a3dc
movl -0x16e594(%rbp), %eax
movl %eax, -0x16e598(%rbp)
movl -0x16e598(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e5f4(%rbp)
xorl %eax, %eax
cmpl $0x4, -0x16e598(%rbp)
movb %al, -0x16e621(%rbp)
jge 0x6a2eb
movslq -0x16e598(%rbp), %rax
movl -0x16e5b0(%rbp,%rax,4), %ecx
movl -0x16e598(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
xorl %eax, %eax
cmpl -0x16e5b0(%rbp,%rdx,4), %ecx
movb %al, -0x16e621(%rbp)
jne 0x6a2eb
movslq -0x16e598(%rbp), %rax
movl -0x16e5d0(%rbp,%rax,4), %eax
movl -0x16e598(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
cmpl -0x16e5d0(%rbp,%rcx,4), %eax
sete %al
movb %al, -0x16e621(%rbp)
movb -0x16e621(%rbp), %al
testb $0x1, %al
jne 0x6a2f7
jmp 0x6a320
movl -0x16e598(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e598(%rbp)
movl -0x16e5f4(%rbp), %eax
addl -0x16e598(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e5f4(%rbp)
jmp 0x6a285
movl -0x16e594(%rbp), %eax
movl %eax, -0x16e59c(%rbp)
movl -0x16e59c(%rbp), %eax
cmpl -0x16e598(%rbp), %eax
jg 0x6a3c8
leaq -0xf4460(%rbp), %rdi
movslq -0x16e59c(%rbp), %rax
movl -0x16e5f0(%rbp,%rax,4), %edx
addl $0x1, %edx
leaq 0x7be16(%rip), %rsi     # 0xe6173
movb $0x0, %al
callq 0x4170
leaq -0x16e580(%rbp), %rdi
cvtsi2sdl -0x16e5f4(%rbp), %xmm0
movl -0x16e598(%rbp), %eax
subl -0x16e594(%rbp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x77c8d(%rip), %xmm2    # 0xe2018
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
leaq 0x7a685(%rip), %rsi     # 0xe4a1f
movb $0x1, %al
callq 0x4170
leaq -0xf4460(%rbp), %rdi
leaq -0x16e580(%rbp), %rsi
callq 0x493b0
movl -0x16e59c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e59c(%rbp)
jmp 0x6a32c
movl -0x16e598(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16e594(%rbp)
jmp 0x6a25d
movq -0x16e588(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x16e630, %rsp         # imm = 0x16E630
popq %rbp
retq
nopw (%rax,%rax)