// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/svm.c
// Function: multiclass_probability
void multiclass_probability(int k, double **r, double *p)
{
 int t, j;
 int iter = 0, max_iter = 100;
 double **Q, *Qp, pQp, eps=0.005 / k, max_error, error, diff;
 Q = (double**)safemalloc_2d(sizeof(double*), sizeof(double), k, k, "multiclass_probability", 4);
 Qp = safemalloc(k * sizeof(double), "multiclass_proability", 5);
 for (t = 0; t < k; t++)
  {
   p[t] = 1.0 / k;  /* Valid if k = 1*/
   Q[t][t] = 0;
   for (j = 0; j < t; j++)
    {
     Q[t][t] += r[j][t] * r[j][t];
     Q[t][j] = Q[j][t];
    }
   for (j = t + 1; j < k; j++)
    {
     Q[t][t] += r[j][t] * r[j][t];
     Q[t][j] = -r[j][t] * r[t][j];
    }
  }
 for (iter = 0; iter < max_iter; iter++)
  {
   /* stopping condition, recalculate QP,pQP for numerical accuracy*/
   pQp = 0;
   for (t = 0; t < k; t++)
    {
     Qp[t] = 0;
     for (j = 0; j < k; j++)
       Qp[t] += Q[t][j] * p[j];
     pQp += p[t] * Qp[t];
    }
   max_error = 0;
   for (t = 0; t < k; t++)
    {
     error = fabs(Qp[t] - pQp);
     if (error > max_error)
       max_error = error;
    }
   if (max_error < eps) 
     break;
   for (t = 0; t < k; t++)
    {
     diff = (-Qp[t] + pQp) / Q[t][t];
     p[t] += diff;
     pQp = (pQp + diff * (diff * Q[t][t] + 2 * Qp[t])) / (1 + diff) / (1 + diff);
     for (j = 0; j < k; j++)
      {
       Qp[j] = (Qp[j] + diff * Q[t][j]) / (1 + diff);
       p[j] /= (1 + diff);
      }
    }
  }
 free_2d((void**)Q, k);
 safe_free(Qp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x64, -0x28(%rbp)
cvtsi2sdl -0x4(%rbp), %xmm1
movsd 0x249ea(%rip), %xmm0    # 0xedfe8
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x4(%rbp), %edx
movl -0x4(%rbp), %ecx
movl $0x8, %esi
leaq 0x24aad(%rip), %r8      # 0xee0c6
movl $0x4, %r9d
movq %rsi, %rdi
callq 0x53120
movq %rax, -0x30(%rbp)
movslq -0x4(%rbp), %rdi
shlq $0x3, %rdi
leaq 0x24aa3(%rip), %rsi     # 0xee0dd
movl $0x5, %edx
callq 0x52d70
movq %rax, -0x38(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xc97fd
cvtsi2sdl -0x4(%rbp), %xmm1
movsd 0x189b0(%rip), %xmm0    # 0xe2018
divsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xc9728
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xc9698
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xc97ed
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xc9731
jmp 0xc97ef
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc964f
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0xc9ac6
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xc98cb
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xc9891
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xc9842
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x40(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc981f
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xc9927
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
subsd -0x40(%rbp), %xmm0
movaps 0x19565(%rip), %xmm1    # 0xe2e60
pand %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
ucomisd -0x50(%rbp), %xmm0
jbe 0xc991a
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
jmp 0xc991c
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc98da
movsd -0x50(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xc993c
jmp 0xc9ac6
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xc9ab6
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
addsd -0x40(%rbp), %xmm0
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
divsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x60(%rbp), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd -0x40(%rbp), %xmm1
movsd -0x60(%rbp), %xmm0
movsd -0x60(%rbp), %xmm2
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm4
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd 0x192c3(%rip), %xmm3    # 0xe2ca0
mulsd (%rax,%rcx,8), %xmm3
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x1861e(%rip), %xmm1    # 0xe2018
addsd -0x60(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd 0x1860d(%rip), %xmm1    # 0xe2018
addsd -0x60(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xc9aa6
movq -0x38(%rbp), %rax
movslq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd -0x60(%rbp), %xmm0
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x185b9(%rip), %xmm1    # 0xe2018
addsd -0x60(%rbp), %xmm1
divsd %xmm1, %xmm0
movq -0x38(%rbp), %rax
movslq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x1859b(%rip), %xmm1    # 0xe2018
addsd -0x60(%rbp), %xmm1
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xc9a20
jmp 0xc9aa8
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc9943
jmp 0xc9ab8
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xc9804
movq -0x30(%rbp), %rdi
movl -0x4(%rbp), %esi
callq 0x52e20
movq -0x38(%rbp), %rdi
callq 0x52e80
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)