// File: /workspace/github_c_makefile_star2_O1/zpole[P]IICV/vl/svm.c
// Function: vl_svm_update_statistics
void _vl_svm_update_statistics (VlSvm *self)
{
  vl_size i, k ;
  double inner, p ;

  memset(&self->statistics, 0, sizeof(VlSvmStatistics)) ;

  self->statistics.regularizer = self->bias * self->bias ;
  for (i = 0; i < self->dimension; i++) {
    self->statistics.regularizer += self->model[i] * self->model[i] ;
  }
  self->statistics.regularizer *= self->lambda * 0.5 ;

  for (k = 0; k < self->numData ; k++) {
    p = (self->weights) ? self->weights[k] : 1.0 ;
    if (p <= 0) continue ;
    inner = self->innerProductFn(self->data, k, self->model) ;
    inner += self->bias * self->biasMultiplier ;
    self->scores[k] = inner ;
    self->statistics.loss += p * self->lossFn(inner, self->labels[k]) ;
    if (self->solver == VlSvmSolverSdca) {

      self->statistics.dualLoss -= p * self->conjugateLossFn(- self->alpha[k] / p, self->labels[k]) ;
    }
  }

  self->statistics.loss /= self->numData ;
  self->statistics.objective = self->statistics.regularizer + self->statistics.loss ;

  if (self->solver == VlSvmSolverSdca) {
    self->statistics.dualLoss /= self->numData ;
    self->statistics.dualObjective = - self->statistics.regularizer + self->statistics.dualLoss ;
    self->statistics.dualityGap = self->statistics.objective - self->statistics.dualObjective ;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0xd8(%rdi)
movups %xmm0, 0xf8(%rdi)
movups %xmm0, 0xe8(%rdi)
movups %xmm0, 0xc8(%rdi)
movups %xmm0, 0xb8(%rdi)
movq $0x0, 0x108(%rdi)
movsd 0x18(%rdi), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, 0xd8(%rdi)
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x30f38
movq 0x10(%rbx), %rcx
movsd 0xd8(%rbx), %xmm0
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0xd8(%rbx)
incq %rdx
cmpq %rdx, %rax
jne 0x30f1b
movsd 0x28(%rbx), %xmm0
mulsd 0x228b(%rip), %xmm0     # 0x331d0
mulsd 0xd8(%rbx), %xmm0
movsd %xmm0, 0xd8(%rbx)
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x31035
xorl %r14d, %r14d
movq 0x48(%rbx), %rax
movsd 0x22ef(%rip), %xmm1     # 0x33260
testq %rax, %rax
je 0x30f7c
movsd (%rax,%r14,8), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jae 0x31025
movq 0x10(%rbx), %rdx
movq 0x30(%rbx), %rdi
movq %r14, %rsi
movsd %xmm1, (%rsp)
callq *0x90(%rbx)
movsd 0x18(%rbx), %xmm1
mulsd 0x20(%rbx), %xmm1
addsd %xmm1, %xmm0
movq 0x110(%rbx), %rax
movsd %xmm0, (%rax,%r14,8)
movq 0x40(%rbx), %rax
movsd (%rax,%r14,8), %xmm1
callq *0x70(%rbx)
movsd (%rsp), %xmm1
mulsd %xmm1, %xmm0
addsd 0xe0(%rbx), %xmm0
movsd %xmm0, 0xe0(%rbx)
cmpl $0x2, (%rbx)
jne 0x31025
movq 0x40(%rbx), %rax
movq 0x120(%rbx), %rcx
movsd (%rcx,%r14,8), %xmm0
xorpd 0x20d1(%rip), %xmm0     # 0x330d0
divsd %xmm1, %xmm0
movsd (%rax,%r14,8), %xmm1
callq *0x78(%rbx)
movsd 0xf0(%rbx), %xmm1
mulsd (%rsp), %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, 0xf0(%rbx)
incq %r14
movq 0x38(%rbx), %rax
cmpq %rax, %r14
jb 0x30f65
movq %rax, %xmm0
punpckldq 0x213e(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2146(%rip), %xmm0     # 0x33190
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0xe0(%rbx), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0xe0(%rbx)
movsd 0xd8(%rbx), %xmm2
addsd %xmm2, %xmm0
movsd %xmm0, 0xd0(%rbx)
cmpl $0x2, (%rbx)
jne 0x310af
movsd 0xf0(%rbx), %xmm3
divsd %xmm1, %xmm3
movsd %xmm3, 0xf0(%rbx)
subsd %xmm2, %xmm3
movsd %xmm3, 0xe8(%rbx)
subsd %xmm3, %xmm0
movsd %xmm0, 0xf8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq