// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/svm.c
// Function: vl_svm_new_with_abstract_data
VlSvm *
vl_svm_new_with_abstract_data (VlSvmSolverType solver,
                               void * data,
                               vl_size dimension,
                               vl_size numData,
                               double const * labels,
                               double lambda)
{
  VlSvm * self = vl_calloc(1,sizeof(VlSvm)) ;

  assert(dimension >= 1) ;
  assert(numData >= 1) ;
  assert(labels) ;

  self->solver = solver ;

  self->dimension = dimension ;
  self->model = 0 ;
  self->bias = 0 ;
  self->biasMultiplier = 1.0 ;

  self->lambda = lambda ;
  self->data = data ;
  self->numData = numData ;
  self->labels = labels ;

  self->diagnosticFrequency = numData ;
  self->diagnosticFn = 0 ;
  self->diagnosticFnData = 0 ;

  self->lossFn = vl_svm_hinge_loss ;
  self->conjugateLossFn = vl_svm_hinge_conjugate_loss ;
  self->lossDerivativeFn = vl_svm_hinge_loss_derivative ;
  self->dcaUpdateFn = vl_svm_hinge_dca_update ;

  self->innerProductFn = 0 ;
  self->accumulateFn = 0 ;

  self->iteration = 0 ;
  self->maxNumIterations = VL_MAX((double)numData, vl_ceil_f(10.0 / lambda)) ;
  self->epsilon = 1e-2 ;

  /* SGD */
  self->biasLearningRate = 0.01 ;

  /* SDCA */
  self->alpha = 0 ;

  /* allocations */
  self->model = vl_calloc(dimension, sizeof(double)) ;
  if (self->model == NULL) goto err_alloc ;

  if (self->solver == VlSvmSolverSdca) {
    self->alpha = vl_calloc(self->numData, sizeof(double)) ;
    if (self->alpha == NULL) goto err_alloc ;
  }

  self->scores = vl_calloc(numData, sizeof(double)) ;
  if (self->scores == NULL) goto err_alloc ;

  return self ;

err_alloc:
  if (self->scores) {
    vl_free (self->scores) ;
    self->scores = 0 ;
  }
  if (self->model) {
    vl_free (self->model) ;
    self->model = 0 ;
  }
  if (self->alpha) {
    vl_free (self->alpha) ;
    self->alpha = 0 ;
  }
  return 0 ;
}

// Assembly:
subq $0x58, %rsp
movl %edi, 0x4c(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movsd %xmm0, 0x20(%rsp)
movl $0x1, %edi
movl $0x128, %esi            # imm = 0x128
callq 0x9a70
movq %rax, 0x18(%rsp)
movl 0x4c(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, (%rax)
movq 0x38(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0x18(%rax)
movq 0x18(%rsp), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x20(%rax)
movsd 0x20(%rsp), %xmm0
movq 0x18(%rsp), %rax
movsd %xmm0, 0x28(%rax)
movq 0x40(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x30(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x40(%rax)
movq 0x30(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x68(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0x58(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0x60(%rax)
movq 0x18(%rsp), %rax
movq 0xc466(%rip), %rcx      # 0x60e10
movq %rcx, 0x70(%rax)
movq 0x18(%rsp), %rax
movq 0xc576(%rip), %rcx      # 0x60f30
movq %rcx, 0x78(%rax)
movq 0x18(%rsp), %rax
movq 0xc60e(%rip), %rcx      # 0x60fd8
movq %rcx, 0x80(%rax)
movq 0x18(%rsp), %rax
movq 0xc50b(%rip), %rcx      # 0x60ee8
movq %rcx, 0x88(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0x90(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0x98(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0xa0(%rax)
movaps 0x4745(%rip), %xmm1     # 0x59160
movq 0x30(%rsp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x4743(%rip), %xmm1     # 0x59170
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x4666(%rip), %xmm0     # 0x590b0
divsd 0x20(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
callq 0x54f40
movsd 0x10(%rsp), %xmm0
cvtsi2sd %rax, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x54a9a
movaps 0x46ef(%rip), %xmm1     # 0x59160
movq 0x30(%rsp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x46ed(%rip), %xmm1     # 0x59170
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
jmp 0x54abc
movsd 0x460e(%rip), %xmm0     # 0x590b0
divsd 0x20(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
callq 0x54f40
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
movsd 0x4f26(%rip), %xmm2     # 0x599f0
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0xa8(%rax)
movq 0x18(%rsp), %rax
movsd 0x45a7(%rip), %xmm0     # 0x590a8
movsd %xmm0, 0xb0(%rax)
movq 0x18(%rsp), %rax
movsd 0x4592(%rip), %xmm0     # 0x590a8
movsd %xmm0, 0x118(%rax)
movq 0x18(%rsp), %rax
movq $0x0, 0x120(%rax)
movq 0x38(%rsp), %rdi
movl $0x8, %esi
callq 0x9a70
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x54b57
jmp 0x54bd4
movq 0x18(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x54b96
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rdi
movl $0x8, %esi
callq 0x9a70
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x120(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x120(%rax)
jne 0x54b94
jmp 0x54bd4
jmp 0x54b96
movq 0x30(%rsp), %rdi
movl $0x8, %esi
callq 0x9a70
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x110(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x110(%rax)
jne 0x54bc5
jmp 0x54bd4
movq 0x18(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x54c64
movq 0x18(%rsp), %rax
cmpq $0x0, 0x110(%rax)
je 0x54c04
movq 0x18(%rsp), %rax
movq 0x110(%rax), %rdi
callq 0x9620
movq 0x18(%rsp), %rax
movq $0x0, 0x110(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x54c2b
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x9620
movq 0x18(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x120(%rax)
je 0x54c5b
movq 0x18(%rsp), %rax
movq 0x120(%rax), %rdi
callq 0x9620
movq 0x18(%rsp), %rax
movq $0x0, 0x120(%rax)
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
nop