// File: /workspace/github_c_makefile_star2_O2/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, %ebp
movl %esi, %r15d
movq %rdi, %r12
leaq 0x57eb9(%rip), %rsi     # 0x9a3ef
pushq $0x1c
popq %rdi
pushq $0x2
popq %rdx
callq 0x34f59
movq %rax, %r14
andl $0x0, (%rbx)
movl 0x10(%r12), %r13d
cmpl $0x1, %r13d
adcl $0x0, %r13d
movq %rax, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x33ae1
testl %ebp, %ebp
je 0x425fd
leal 0x1(%rbp), %edx
pushq $0x1
popq %r12
cvtsi2sd %ebp, %xmm2
cmpl %r15d, %edx
movsd %xmm2, 0x8(%rsp)
jge 0x425bf
movq %r14, %rdi
movq %rbx, %rsi
callq 0x33ae1
movsd 0x8(%rsp), %xmm2
movsd 0x53850(%rip), %xmm0    # 0x95de8
mulsd %xmm2, %xmm0
cvtsi2sd %r15d, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x425bf
cvttsd2si %xmm0, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x33ae1
movsd 0x8(%rsp), %xmm2
xorl %r12d, %r12d
cmpl $0x2, %ebp
jl 0x425d9
decl %ebp
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x33ae1
movsd 0x8(%rsp), %xmm2
movl %r15d, %ebp
mulsd 0x5373c(%rip), %xmm2    # 0x95d20
ucomisd 0x52f34(%rip), %xmm2    # 0x95520
jbe 0x42688
movl %r12d, 0x8(%rsp)
cvttsd2si %xmm2, %edx
jmp 0x42678
pushq $0x1
popq %rax
movl %eax, 0x8(%rsp)
cmpl %r15d, %r13d
jge 0x4263c
movq %r14, %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0x33ae1
leal (,%r13,2), %edx
movl %r15d, %ebp
cmpl %r15d, %edx
jge 0x4263f
movq %r14, %rdi
movq %rbx, %rsi
callq 0x33ae1
movl $0x0, 0x8(%rsp)
jmp 0x4263f
movl %r15d, %ebp
movl 0x1c0(%r12), %eax
addl %r13d, %eax
pushq $0x4
popq %rcx
cltd
idivl %ecx
cmpl %ebp, %eax
jg 0x4268d
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x33ae1
addl 0x1c0(%r12), %r13d
movl %r13d, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %edx
cmpl %ebp, %eax
jg 0x4268d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x33ae1
movl 0x8(%rsp), %r12d
testl %r12d, %r12d
je 0x4269a
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x33ae1
cmpl $0x1, 0x14(%rsp)
jne 0x426ae
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x33ae1
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq