// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/classification.c
// Function: test_qdaclass
Prediction test_qdaclass(Instanceptr data, void* model, void* parameters, double* posterior)
{
 /*!Last Changed 05.08.2007*/
 Model_qdaclassptr m;
 double max, gi, denom = 0.0;
 int i;
 matrix x, tmp1, tmp2, tmp3, xtranspose;
 Prediction predicted;
 m = (Model_qdaclassptr) model;
 max = -LONG_MAX;
 predicted.classno = -1;
 x = instance_to_matrix(data);
 xtranspose = matrix_transpose(x);
 for (i = 0; i < current_dataset->classno; i++)
  {
   tmp1 = matrix_multiply(x, m->W[i]);
   tmp2 = matrix_multiply(tmp1, xtranspose);
   tmp3 = matrix_multiply(m->w[i], xtranspose);
   gi = tmp2.values[0][0] + tmp3.values[0][0] + m->w0[i];
   if (gi > max)
    {
     max = gi;
     predicted.classno = i;
    }
   posterior[i] = safeexp(gi - log(m->priors[i])) * m->priors[i];
   denom += posterior[i];
   matrix_free(tmp1);
   matrix_free(tmp2);
   matrix_free(tmp3);
  }
 for (i = 0; i < current_dataset->classno; i++)
  	posterior[i] = posterior[i] / denom;
 matrix_free(x);
 matrix_free(xtranspose);
 return predicted;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xf8(%rbp)
movq %rdi, %rax
movq %rax, -0xf0(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movsd 0xd4a9c(%rip), %xmm0    # 0xe2a60
movsd %xmm0, -0x30(%rbp)
movl $0xffffffff, 0x8(%rdi)  # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rdi
callq 0x43160
movq %rax, -0xa8(%rbp)
movq %rdx, -0xa0(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x59ed0
movq %rax, -0xb8(%rbp)
movq %rdx, -0xb0(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x90(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
leaq 0xf77fb(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0xe221
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq (%rax), %rdx
movq 0x8(%rax), %rcx
callq 0x59fe0
movq %rax, -0xc8(%rbp)
movq %rdx, -0xc0(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq -0x90(%rbp), %rcx
callq 0x59fe0
movq %rax, -0xd8(%rbp)
movq %rdx, -0xd0(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
movq -0x98(%rbp), %rdx
movq -0x90(%rbp), %rcx
callq 0x59fe0
movq %rax, -0xe8(%rbp)
movq %rdx, -0xe0(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x70(%rbp), %rax
movq (%rax), %rax
movsd (%rax), %xmm0
movq -0x80(%rbp), %rax
movq (%rax), %rax
addsd (%rax), %xmm0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0xe17d
movq -0xf8(%rbp), %rax
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x44(%rbp), %ecx
movl %ecx, 0x8(%rax)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x4120
movaps %xmm0, %xmm1
movsd -0x100(%rbp), %xmm0
subsd %xmm1, %xmm0
callq 0x52a40
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x44(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x59ea0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x59ea0
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x59ea0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xe03b
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
leaq 0xf760e(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x10(%rcx), %eax
jge 0xe264
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd -0x40(%rbp), %xmm0
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xe228
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x59ea0
movq -0x98(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x59ea0
movq -0xf0(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)