// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq 0x40(%rsp), %rdi
addq $0xb8, %rdi
xorl %esi, %esi
movl $0x58, %edx
callq 0x9480
movq 0x40(%rsp), %rax
movsd 0x18(%rax), %xmm0
movq 0x40(%rsp), %rax
mulsd 0x18(%rax), %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0xd8(%rax)
movq $0x0, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x560fe
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq 0x40(%rsp), %rax
movsd 0xd8(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xd8(%rax)
movq 0x38(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x38(%rsp)
jmp 0x5609b
movq 0x40(%rsp), %rax
movsd 0x2f75(%rip), %xmm0     # 0x59080
mulsd 0x28(%rax), %xmm0
movq 0x40(%rsp), %rax
mulsd 0xd8(%rax), %xmm0
movsd %xmm0, 0xd8(%rax)
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x40(%rsp), %rcx
cmpq 0x38(%rcx), %rax
jae 0x56317
movq 0x40(%rsp), %rax
cmpq $0x0, 0x48(%rax)
je 0x56169
movq 0x40(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x30(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x18(%rsp)
jmp 0x56179
movsd 0x2f67(%rip), %xmm0     # 0x590d8
movsd %xmm0, 0x18(%rsp)
jmp 0x56179
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
ucomisd 0x20(%rsp), %xmm0
jb 0x56195
jmp 0x56304
movq 0x40(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x40(%rsp), %rcx
movq 0x30(%rcx), %rdi
movq 0x30(%rsp), %rsi
movq 0x40(%rsp), %rcx
movq 0x10(%rcx), %rdx
callq *%rax
movsd %xmm0, 0x28(%rsp)
movq 0x40(%rsp), %rax
movsd 0x18(%rax), %xmm0
movq 0x40(%rsp), %rax
movsd 0x20(%rax), %xmm2
movsd 0x28(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x28(%rsp), %xmm0
movq 0x40(%rsp), %rax
movq 0x110(%rax), %rax
movq 0x30(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq 0x70(%rax), %rax
movsd 0x28(%rsp), %xmm0
movq 0x40(%rsp), %rcx
movq 0x40(%rcx), %rcx
movq 0x30(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm1
callq *%rax
movaps %xmm0, %xmm2
movsd 0x10(%rsp), %xmm0
movq 0x40(%rsp), %rax
movsd 0xe0(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xe0(%rax)
movq 0x40(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x56302
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x40(%rsp), %rax
movq 0x78(%rax), %rax
movq 0x40(%rsp), %rcx
movq 0x120(%rcx), %rcx
movq 0x30(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
divsd 0x20(%rsp), %xmm0
movq 0x40(%rsp), %rcx
movq 0x40(%rcx), %rcx
movq 0x30(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm1
callq *%rax
movaps %xmm0, %xmm2
movsd 0x8(%rsp), %xmm0
movq 0x40(%rsp), %rax
movsd 0xf0(%rax), %xmm1
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xf0(%rax)
jmp 0x56304
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x5612e
movq 0x40(%rsp), %rax
movq 0x38(%rax), %xmm1
movaps 0x2e38(%rip), %xmm0     # 0x59160
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x2e3c(%rip), %xmm0     # 0x59170
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq 0x40(%rsp), %rax
movsd 0xe0(%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0xe0(%rax)
movq 0x40(%rsp), %rax
movsd 0xd8(%rax), %xmm0
movq 0x40(%rsp), %rax
addsd 0xe0(%rax), %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0xd0(%rax)
movq 0x40(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x5643b
movq 0x40(%rsp), %rax
movq 0x38(%rax), %xmm1
movaps 0x2dbe(%rip), %xmm0     # 0x59160
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x2dc2(%rip), %xmm0     # 0x59170
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq 0x40(%rsp), %rax
movsd 0xf0(%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0xf0(%rax)
movq 0x40(%rsp), %rax
movsd 0xd8(%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq 0x40(%rsp), %rax
addsd 0xf0(%rax), %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0xe8(%rax)
movq 0x40(%rsp), %rax
movsd 0xd0(%rax), %xmm0
movq 0x40(%rsp), %rax
subsd 0xe8(%rax), %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0xf8(%rax)
addq $0x48, %rsp
retq