// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/model.c
// Function: generate_candidate_mlp_models
int* generate_candidate_mlp_models(Datasetptr d, int maxhidden, int bestmodel, int*modelcount, MODEL_SEARCH_DIRECTION_TYPE searchdirection)
{
	/*!Last Changed 29.10.2005*/
	/*!Last Changed 17.07.2005*/
	int numberofclasses, addmaxhidden = 0, *list;
	list = safemalloc(MAX_MODEL_SEARCH * sizeof(int), "generate_candidate_mlp_models", 2);
	*modelcount = 0;
	if (d->classno == 0)
		 numberofclasses = 1;
	else
		 numberofclasses = d->classno;
	search_and_add_into_list(list, modelcount, bestmodel);
	if (bestmodel == 0)
		{
			if (numberofclasses < maxhidden)
				{
					search_and_add_into_list(list, modelcount, numberofclasses);
					if (2 * numberofclasses < maxhidden)
						 search_and_add_into_list(list, modelcount, 2 * numberofclasses);
					else
							addmaxhidden = 1;
				}
			else
					addmaxhidden = 1;
			if ((numberofclasses + d->multifeaturecount) / 4 <= maxhidden)
				{
					search_and_add_into_list(list, modelcount, (numberofclasses + d->multifeaturecount) / 4);
					if ((numberofclasses + d->multifeaturecount) / 2 <= maxhidden)
							search_and_add_into_list(list, modelcount, (numberofclasses + d->multifeaturecount) / 2);
					else
							addmaxhidden = 1;
				}
			else
					addmaxhidden = 1;
		}
	else
		{
			if (bestmodel + 1 < maxhidden)
				{
					search_and_add_into_list(list, modelcount, bestmodel + 1);
					if (bestmodel * 1.5 < maxhidden)
							search_and_add_into_list(list, modelcount, (int) (bestmodel * 1.5));
					else
							addmaxhidden = 1;
				}
			else
					addmaxhidden = 1;
   if (bestmodel - 1 > 0)
					search_and_add_into_list(list, modelcount, bestmodel - 1);
			if (0.5 * bestmodel > 1)
					search_and_add_into_list(list, modelcount, (int) (0.5 * bestmodel));
		}
	if (addmaxhidden)
			search_and_add_into_list(list, modelcount, maxhidden);
	if (searchdirection == BACKWARD)
		 search_and_add_into_list(list, modelcount, 0);
	return list;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, 0x14(%rsp)
movq %rcx, %rbx
movl %edx, %r13d
movl %esi, %r15d
movq %rdi, %r12
leaq 0x61125(%rip), %rsi     # 0xaa4bf
movl $0x1c, %edi
movl $0x2, %edx
callq 0x3a0e1
movq %rax, %r14
movl $0x0, (%rbx)
movl 0x10(%r12), %ebp
cmpl $0x1, %ebp
adcl $0x0, %ebp
movq %rax, %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0x38494
testl %r13d, %r13d
je 0x49468
leal 0x1(%r13), %edx
movl $0x1, %ebp
cvtsi2sd %r13d, %xmm2
cmpl %r15d, %edx
movsd %xmm2, 0x8(%rsp)
jge 0x4942c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x38494
movsd 0x8(%rsp), %xmm2
movsd 0x5c9da(%rip), %xmm0    # 0xa5de0
mulsd %xmm2, %xmm0
cvtsi2sd %r15d, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4942c
cvttsd2si %xmm0, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x38494
movsd 0x8(%rsp), %xmm2
xorl %ebp, %ebp
cmpl $0x2, %r13d
jl 0x49449
decl %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0x38494
movsd 0x8(%rsp), %xmm2
mulsd 0x5c8c7(%rip), %xmm2    # 0xa5d18
ucomisd 0x5c0c7(%rip), %xmm2    # 0xa5520
jbe 0x494e4
movl %ebp, %r13d
cvttsd2si %xmm2, %edx
jmp 0x494d6
movl $0x1, %r13d
cmpl %r15d, %ebp
jge 0x4949a
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x38494
leal (,%rbp,2), %edx
cmpl %r15d, %edx
jge 0x4949a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x38494
xorl %r13d, %r13d
movl 0x1c0(%r12), %eax
leal (%rax,%rbp), %edx
addl $0x3, %edx
addl %ebp, %eax
cmovnsl %eax, %edx
sarl $0x2, %edx
cmpl %r15d, %edx
jg 0x494e8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x38494
addl 0x1c0(%r12), %ebp
movl %ebp, %edx
shrl $0x1f, %edx
addl %ebp, %edx
sarl %edx
cmpl %r15d, %edx
jg 0x494e8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x38494
movl %r13d, %ebp
testl %ebp, %ebp
je 0x494f6
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x38494
cmpl $0x1, 0x14(%rsp)
jne 0x4950a
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x38494
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq