// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/classification.c
// Function: train_logistic
void* train_logistic(Instanceptr* trdata, Instanceptr *cvdata, void* parameters)
{
 /*!Last Changed 17.04.2005*/
 double** w, **deltaw, *y, diff, eta;
 Instanceptr tmp;
 int i, j, k, cno;
 Logistic_parameterptr param;
 param = (Logistic_parameterptr) parameters;
 w = two_dimensional_initialize(current_dataset->classno, current_dataset->multifeaturecount, 0.01);
 deltaw = (double**) safemalloc_2d(sizeof(double *), sizeof(double), current_dataset->classno, current_dataset->multifeaturecount, "logistic", 7);
 y = safemalloc(current_dataset->classno * sizeof(double), "logistic", 6);
 eta = param->learning_rate;
 for (k = 0; k < param->perceptron_run; k++)
  {
   for (i = 0; i < current_dataset->classno; i++)
     for (j = 0; j < current_dataset->multifeaturecount; j++)
       deltaw[i][j] = 0.0;
   tmp = *trdata;
   while (tmp)
    {
     for (i = 0; i < current_dataset->classno; i++)
      {
       y[i] = w[i][0];
       for (j = 0; j < current_dataset->multifeaturecount - 1; j++)
         y[i] += w[i][j + 1] * real_feature(tmp, j);
      }
     softmax(y, current_dataset->classno);
     for (i = 0; i < current_dataset->classno; i++)
      {
       cno = give_classno(tmp);
       if (cno == i)
         diff = 1.0 - y[i];
       else
         diff = 0.0 - y[i];
       deltaw[i][0] += diff;
       for (j = 0; j < current_dataset->multifeaturecount - 1; j++)
         deltaw[i][j + 1] += diff * real_feature(tmp, j);
      }
     tmp = tmp->next;
    }
   for (i = 0; i < current_dataset->classno; i++)
     for (j = 0; j < current_dataset->multifeaturecount; j++)
       w[i][j] += eta * deltaw[i][j];
   eta *= param->etadecrease;
  }
 free_2d((void**)deltaw, current_dataset->classno);
 safe_free(y);
 return w;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq 0xf4cfd(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x10(%rax), %edi
leaq 0xf4cf0(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %esi
movsd 0xd14bf(%rip), %xmm0    # 0xe2020
callq 0x7abb0
movq %rax, -0x20(%rbp)
leaq 0xf4ccf(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x10(%rax), %edx
leaq 0xf4cc2(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %ecx
movl $0x8, %esi
leaq 0xd20da(%rip), %r8      # 0xe2c6d
movl $0x7, %r9d
movq %rsi, %rdi
callq 0x53120
movq %rax, -0x28(%rbp)
leaq 0xf4c94(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq 0x10(%rax), %rdi
shlq $0x3, %rdi
leaq 0xd20af(%rip), %rsi     # 0xe2c6d
movl $0x6, %edx
callq 0x52d70
movq %rax, -0x30(%rbp)
movq -0x60(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x10efe
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
leaq 0xf4c3f(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x10c55
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
leaq 0xf4c26(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1c0(%rcx), %eax
jge 0x10c48
movq -0x28(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x50(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x10c10
jmp 0x10c4a
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x10bf7
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x10e51
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
leaq 0xf4bc4(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x10d2e
movq -0x20(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
leaq 0xf4b8a(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
movl 0x1c0(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x10d1e
movq -0x20(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x50(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x48(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0x42c40
movaps %xmm0, %xmm2
movsd -0x68(%rbp), %xmm0
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x10cac
jmp 0x10d20
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x10c72
movq -0x30(%rbp), %rdi
leaq 0xf4b07(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x10(%rax), %esi
callq 0x7ab00
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
leaq 0xf4aeb(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x10e40
movq -0x48(%rbp), %rdi
callq 0x43530
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jne 0x10d91
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsd 0xd1293(%rip), %xmm0    # 0xe2018
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0x10da6
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
xorps %xmm0, %xmm0
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movq -0x28(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
leaq 0xf4a70(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
movl 0x1c0(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x10e30
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x48(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0x42c40
movaps %xmm0, %xmm2
movsd -0x70(%rbp), %xmm0
movq -0x28(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl -0x50(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x10dc6
jmp 0x10e32
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x10d4b
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x10c60
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
leaq 0xf49de(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0x10edd
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
leaq 0xf49c5(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1c0(%rcx), %eax
jge 0x10ecd
movsd -0x40(%rbp), %xmm0
movq -0x28(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x50(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x20(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x50(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x10e71
jmp 0x10ecf
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x10e58
movq -0x60(%rbp), %rax
movsd 0x10(%rax), %xmm0
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x10be1
movq -0x28(%rbp), %rdi
leaq 0xf4937(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x10(%rax), %esi
callq 0x52e20
movq -0x30(%rbp), %rdi
callq 0x52e80
movq -0x20(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)