// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/svm.c
// Function: vl_svm_sdca_train
void _vl_svm_sdca_train (VlSvm *self)
{
  double * norm2 ;
  vl_index * permutation ;
  vl_uindex i, t  ;
  double inner, delta, multiplier, p ;

  double startTime = vl_get_cpu_time () ;
  VlRand * rand = vl_get_rand() ;

  norm2 = (double*) vl_calloc(self->numData, sizeof(double));
  permutation = vl_calloc(self->numData, sizeof(vl_index)) ;

  {
    double * buffer = vl_calloc(self->dimension, sizeof(double)) ;
    for (i = 0 ; i < (unsigned)self->numData; i++) {
      double n2 ;
      permutation [i] = i ;
      memset(buffer, 0, self->dimension * sizeof(double)) ;
      self->accumulateFn (self->data, i, buffer, 1) ;
      n2 = self->innerProductFn (self->data, i, buffer) ;
      n2 += self->biasMultiplier * self->biasMultiplier ;
      norm2[i] = n2 / (self->lambda * self->numData) ;
    }
    vl_free(buffer) ;
  }

  for (t = 0 ; 1 ; ++t) {

    if (t % self->numData == 0) {
      /* once a new epoch is reached (all data have been visited),
       change permutation */
      vl_rand_permute_indexes(rand, permutation, self->numData) ;
    }

    /* pick a sample and compute update */
    i = permutation[t % self->numData] ;
    p = (self->weights) ? self->weights[i] : 1.0 ;
    if (p > 0) {
      inner = self->innerProductFn(self->data, i, self->model) ;
      inner += self->bias * self->biasMultiplier ;
      delta = p * self->dcaUpdateFn(self->alpha[i] / p, inner, p * norm2[i], self->labels[i]) ;
    } else {
      delta = 0 ;
    }

    /* apply update */
    if (delta != 0) {
      self->alpha[i] += delta ;
      multiplier = delta / (self->numData * self->lambda) ;
      self->accumulateFn(self->data,i,self->model,multiplier) ;
      self->bias += self->biasMultiplier * multiplier;
    }

    /* call diagnostic occasionally */
    if ((t + 1) % self->diagnosticFrequency == 0 || t + 1 == self->maxNumIterations) {
      _vl_svm_update_statistics (self) ;
      self->statistics.elapsedTime = vl_get_cpu_time() - startTime ;
      self->statistics.iteration = t ;
      self->statistics.epoch = t / self->numData ;

      self->statistics.status = VlSvmStatusTraining ;
      if (self->statistics.dualityGap < self->epsilon) {
        self->statistics.status = VlSvmStatusConverged ;
      }
      else if (t + 1 == self->maxNumIterations) {
        self->statistics.status = VlSvmStatusMaxNumIterationsReached ;
      }

      if (self->diagnosticFn) {
        self->diagnosticFn(self, self->diagnosticFnData) ;
      }

      if (self->statistics.status != VlSvmStatusTraining) {
        break ;
      }
    }
  } /* next iteration */

  vl_free (norm2) ;
  vl_free (permutation) ;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
callq 0x93b0
movsd %xmm0, 0x38(%rsp)
callq 0x9a20
movq %rax, 0x30(%rsp)
movq 0x80(%rsp), %rax
movq 0x38(%rax), %rdi
movl $0x8, %esi
callq 0x9a70
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rax
movq 0x38(%rax), %rdi
movl $0x8, %esi
callq 0x9a70
movq %rax, 0x70(%rsp)
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdi
movl $0x8, %esi
callq 0x9a70
movq %rax, 0x28(%rsp)
movq $0x0, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq 0x80(%rsp), %rcx
movq 0x38(%rcx), %rcx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x56665
movq 0x68(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rcx, (%rax,%rcx,8)
movq 0x28(%rsp), %rdi
movq 0x80(%rsp), %rax
movq 0x8(%rax), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x9480
movq 0x80(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x98(%rax), %rax
movq 0x68(%rsp), %rsi
movq 0x28(%rsp), %rdx
movsd 0x2b1f(%rip), %xmm0     # 0x590d8
callq *%rax
movq 0x80(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x90(%rax), %rax
movq 0x68(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq *%rax
movsd %xmm0, 0x20(%rsp)
movq 0x80(%rsp), %rax
movsd 0x20(%rax), %xmm0
movsd 0x20(%rsp), %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x20(%rsp), %xmm0
movq 0x80(%rsp), %rax
movsd 0x28(%rax), %xmm1
movq 0x38(%rax), %xmm2
movaps 0x2b40(%rip), %xmm3     # 0x59160
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movapd 0x2b44(%rip), %xmm3     # 0x59170
subpd %xmm3, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq 0x78(%rsp), %rax
movq 0x68(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
jmp 0x5654e
movq 0x28(%rsp), %rdi
callq 0x9620
movq $0x0, 0x60(%rsp)
movb $0x1, %al
testb $0x1, %al
jne 0x56683
jmp 0x56a87
movq 0x60(%rsp), %rax
movq 0x80(%rsp), %rcx
xorl %edx, %edx
divq 0x38(%rcx)
cmpq $0x0, %rdx
jne 0x566b7
movq 0x30(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0x80(%rsp), %rax
movq 0x38(%rax), %rdx
callq 0x9360
movq 0x70(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x60(%rsp), %rax
movq 0x80(%rsp), %rcx
xorl %edx, %edx
divq 0x38(%rcx)
movq 0x18(%rsp), %rax
movq (%rax,%rdx,8), %rax
movq %rax, 0x68(%rsp)
movq 0x80(%rsp), %rax
cmpq $0x0, 0x48(%rax)
je 0x5670f
movq 0x80(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x68(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x10(%rsp)
jmp 0x5671f
movsd 0x29c1(%rip), %xmm0     # 0x590d8
movsd %xmm0, 0x10(%rsp)
jmp 0x5671f
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x40(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x56822
movq 0x80(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x80(%rsp), %rcx
movq 0x30(%rcx), %rdi
movq 0x68(%rsp), %rsi
movq 0x80(%rsp), %rcx
movq 0x10(%rcx), %rdx
callq *%rax
movsd %xmm0, 0x58(%rsp)
movq 0x80(%rsp), %rax
movsd 0x18(%rax), %xmm0
movq 0x80(%rsp), %rax
movsd 0x20(%rax), %xmm2
movsd 0x58(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x80(%rsp), %rax
movq 0x88(%rax), %rax
movq 0x80(%rsp), %rcx
movq 0x120(%rcx), %rcx
movq 0x68(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm0
divsd 0x40(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movsd 0x40(%rsp), %xmm2
movq 0x78(%rsp), %rcx
movq 0x68(%rsp), %rdx
mulsd (%rcx,%rdx,8), %xmm2
movq 0x80(%rsp), %rcx
movq 0x40(%rcx), %rcx
movq 0x68(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm3
callq *%rax
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
jmp 0x5682b
xorps %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x50(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x56841
jp 0x56841
jmp 0x56916
movsd 0x50(%rsp), %xmm1
movq 0x80(%rsp), %rax
movq 0x120(%rax), %rax
movq 0x68(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd 0x50(%rsp), %xmm0
movq 0x80(%rsp), %rax
movq 0x38(%rax), %xmm1
movaps 0x28dd(%rip), %xmm2     # 0x59160
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x28e1(%rip), %xmm2     # 0x59170
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
movq 0x80(%rsp), %rax
mulsd 0x28(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x48(%rsp)
movq 0x80(%rsp), %rax
movq 0x98(%rax), %rax
movq 0x80(%rsp), %rcx
movq 0x30(%rcx), %rdi
movq 0x68(%rsp), %rsi
movq 0x80(%rsp), %rcx
movq 0x10(%rcx), %rdx
movsd 0x48(%rsp), %xmm0
callq *%rax
movq 0x80(%rsp), %rax
movsd 0x20(%rax), %xmm0
movsd 0x48(%rsp), %xmm2
movq 0x80(%rsp), %rax
movsd 0x18(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rax)
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq 0x80(%rsp), %rcx
xorl %edx, %edx
divq 0x68(%rcx)
cmpq $0x0, %rdx
je 0x56951
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq 0x80(%rsp), %rcx
cmpq 0xa8(%rcx), %rax
jne 0x56a72
movq 0x80(%rsp), %rdi
callq 0x56050
callq 0x93b0
subsd 0x38(%rsp), %xmm0
movq 0x80(%rsp), %rax
movsd %xmm0, 0x108(%rax)
movq 0x60(%rsp), %rcx
movq 0x80(%rsp), %rax
movq %rcx, 0xc0(%rax)
movq 0x60(%rsp), %rax
movq 0x80(%rsp), %rcx
xorl %edx, %edx
divq 0x38(%rcx)
movq %rax, %rcx
movq 0x80(%rsp), %rax
movq %rcx, 0xc8(%rax)
movq 0x80(%rsp), %rax
movl $0x1, 0xb8(%rax)
movq 0x80(%rsp), %rax
movsd 0xf8(%rax), %xmm1
movq 0x80(%rsp), %rax
movsd 0xb0(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x569fe
movq 0x80(%rsp), %rax
movl $0x2, 0xb8(%rax)
jmp 0x56a2c
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq 0x80(%rsp), %rcx
cmpq 0xa8(%rcx), %rax
jne 0x56a2a
movq 0x80(%rsp), %rax
movl $0x3, 0xb8(%rax)
jmp 0x56a2c
movq 0x80(%rsp), %rax
cmpq $0x0, 0x58(%rax)
je 0x56a5d
movq 0x80(%rsp), %rax
movq 0x58(%rax), %rax
movq 0x80(%rsp), %rdi
movq 0x80(%rsp), %rcx
movq 0x60(%rcx), %rsi
callq *%rax
movq 0x80(%rsp), %rax
cmpl $0x1, 0xb8(%rax)
je 0x56a70
jmp 0x56a87
jmp 0x56a72
jmp 0x56a74
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x56678
movq 0x78(%rsp), %rdi
callq 0x9620
movq 0x70(%rsp), %rdi
callq 0x9620
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)