// File: /workspace/github_c_makefile_star2_O1/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 0x5f477(%rip), %rsi     # 0xa741f
movl $0x1c, %edi
movl $0x2, %edx
callq 0x390f5
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 0x37984
testl %r13d, %r13d
je 0x48076
leal 0x1(%r13), %edx
movl $0x1, %ebp
cvtsi2sd %r13d, %xmm2
cmpl %r15d, %edx
movsd %xmm2, 0x8(%rsp)
jge 0x4803a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x37984
movsd 0x8(%rsp), %xmm2
movsd 0x5adcc(%rip), %xmm0    # 0xa2de0
mulsd %xmm2, %xmm0
cvtsi2sd %r15d, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4803a
cvttsd2si %xmm0, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x37984
movsd 0x8(%rsp), %xmm2
xorl %ebp, %ebp
cmpl $0x2, %r13d
jl 0x48057
decl %r13d
movq %r14, %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0x37984
movsd 0x8(%rsp), %xmm2
mulsd 0x5acb9(%rip), %xmm2    # 0xa2d18
ucomisd 0x5a4b9(%rip), %xmm2    # 0xa2520
jbe 0x48108
cvttsd2si %xmm2, %edx
jmp 0x480fd
movl $0x1, %r13d
movl $0x1, 0x8(%rsp)
cmpl %r15d, %ebp
jge 0x480bd
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x37984
leal (,%rbp,2), %edx
movl $0x1, 0x8(%rsp)
cmpl %r15d, %edx
jge 0x480bd
movq %r14, %rdi
movq %rbx, %rsi
callq 0x37984
movl $0x0, 0x8(%rsp)
movl 0x1c0(%r12), %eax
leal (%rax,%rbp), %edx
addl $0x3, %edx
addl %ebp, %eax
cmovnsl %eax, %edx
sarl $0x2, %edx
cmpl %r15d, %edx
jg 0x4810b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x37984
addl 0x1c0(%r12), %ebp
movl %ebp, %edx
shrl $0x1f, %edx
addl %ebp, %edx
sarl %edx
cmpl %r15d, %edx
movl 0x8(%rsp), %ebp
jg 0x4810b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x37984
movl %ebp, %r13d
testl %r13d, %r13d
je 0x4811e
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x37984
cmpl $0x1, 0x14(%rsp)
jne 0x48132
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x37984
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq