// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/mlp.c
// Function: allocate_weights
matrixptr allocate_weights(Mlpparameters P, INITIALIZATION_TYPE inittype, int initvalue)
{
 /*!Last Changed 09.02.2004 Oya*/
 /*if inittype is 0 then assign random values, then init value is useless*/
 /*else if inittype is 1 assign initvalue*/
 /*else no initialization*/
 matrixptr weights;
 int i; /*allocations*/
 weights = (matrixptr) safemalloc ((P.layernum + 1) * sizeof(matrix), "allocate_weights", 3);
 for (i = 0; i < P.layernum; i++)
  {
   if (i == 0)
     weights[i] = matrix_alloc(P.hidden[i], P.dimnum + 1);
   else
     weights[i] = matrix_alloc(P.hidden[i], P.hidden[i - 1] + 1);
  }
 if (P.layernum == 0)
   weights[P.layernum] = matrix_alloc(P.classnum, P.dimnum + 1);
 else
   weights[P.layernum] = matrix_alloc(P.classnum, P.hidden[P.layernum - 1] + 1);
 for (i = 0; i <= P.layernum; i++)
   if (inittype == RANDOM)
     assignTwoDimRandomWeights(&weights[i], P.randrange);
   else 
     if (inittype == INITIAL_VALUE)
       initialize_matrix(&weights[i], initvalue); 
 return weights;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl 0x54(%rax), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x4, %rdi
leaq 0x839a6(%rip), %rsi     # 0xe6eb3
movl $0x3, %edx
callq 0x52d70
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x60(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x54(%rcx), %eax
jge 0x635e4
cmpl $0x0, -0x14(%rbp)
jne 0x63582
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq %rcx, -0x68(%rbp)
movslq -0x14(%rbp), %rcx
movl 0x48(%rax,%rcx,4), %edi
movl 0x4(%rax), %esi
addl $0x1, %esi
callq 0x57fc0
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x28(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x28(%rbp), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x8(%rax)
jmp 0x635d4
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq %rcx, -0x70(%rbp)
movslq -0x14(%rbp), %rcx
movl 0x48(%rax,%rcx,4), %edi
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x48(%rax,%rcx,4), %esi
addl $0x1, %esi
callq 0x57fc0
movq %rax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
jmp 0x635d6
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x63522
movq -0x60(%rbp), %rax
cmpl $0x0, 0x54(%rax)
jne 0x63632
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0x54(%rax), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq %rcx, -0x78(%rbp)
movl (%rax), %edi
movl 0x4(%rax), %esi
addl $0x1, %esi
callq 0x57fc0
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq %rdx, -0x40(%rbp)
movq -0x48(%rbp), %rcx
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq %rcx, 0x8(%rax)
jmp 0x6367e
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0x54(%rax), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq %rcx, -0x80(%rbp)
movl (%rax), %edi
movl 0x54(%rax), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x48(%rax,%rcx,4), %esi
addl $0x1, %esi
callq 0x57fc0
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, -0x58(%rbp)
movq %rdx, -0x50(%rbp)
movq -0x58(%rbp), %rcx
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x0, -0x14(%rbp)
movq -0x60(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x54(%rcx), %eax
jg 0x636e4
cmpl $0x0, -0x4(%rbp)
jne 0x636b6
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rdi
movsd 0x28(%rax), %xmm0
callq 0x5a7e0
jmp 0x636d7
cmpl $0x1, -0x4(%rbp)
jne 0x636d5
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
cvtsi2sdl -0x8(%rbp), %xmm0
callq 0x5a610
jmp 0x636d7
jmp 0x636d9
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x63685
movq -0x10(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)