// File: /workspace/github_c_makefile_star2_O3/zpole[P]IICV/vl/covdet.c
// Function: vl_covdet_extract_laplacian_scales
void
vl_covdet_extract_laplacian_scales (VlCovDet * self)
{
  vl_index i, j  ;
  vl_bool dropFeaturesWithoutScale = VL_TRUE ;
  vl_size numFeatures = vl_covdet_get_num_features(self) ;
  memset(self->numFeaturesWithNumScales, 0,
         sizeof(self->numFeaturesWithNumScales)) ;

  for (i = 0 ; i < (signed)numFeatures ; ++i) {
    vl_size numScales ;
    VlCovDetFeature feature = self->features[i] ;
    VlCovDetFeatureLaplacianScale const * scales =
    vl_covdet_extract_laplacian_scales_for_frame(self, &numScales, feature.frame) ;

    self->numFeaturesWithNumScales[numScales] ++ ;

    if (numScales == 0 && dropFeaturesWithoutScale) {
      self->features[i].peakScore = 0 ;
    }

    for (j = 0 ; j < (signed)numScales ; ++j) {
      VlCovDetFeature * scaled ;

      if (j == 0) {
        scaled = & self->features[i] ;
      } else {
        vl_covdet_append_feature(self, &feature) ;
        scaled = & self->features[self->numFeatures -1] ;
      }

      scaled->laplacianScaleScore = scales[j].score ;
      scaled->frame.a11 *= scales[j].scale ;
      scaled->frame.a21 *= scales[j].scale ;
      scaled->frame.a12 *= scales[j].scale ;
      scaled->frame.a22 *= scales[j].scale ;
    }
  }
  if (dropFeaturesWithoutScale) {
    j = 0 ;
    for (i = 0 ; i < (signed)self->numFeatures ; ++i) {
      VlCovDetFeature feature = self->features[i] ;
      if (feature.peakScore) {
        self->features[j++] = feature ;
      }
    }
    self->numFeatures = j ;
  }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movq 0x58(%rdi), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, 0x12540(%rdi)
movupd %xmm0, 0x12550(%rdi)
movq $0x0, 0x12560(%rdi)
movslq %eax, %rcx
movq %rcx, 0x20(%rsp)
testq %rcx, %rcx
jle 0xd078
xorl %ebp, %ebp
movq 0x50(%rbx), %rax
leaq (,%rbp,4), %r14
addq %rbp, %r14
movq 0x20(%rax,%r14,8), %rcx
movq %rcx, 0x50(%rsp)
movups (%rax,%r14,8), %xmm0
movupd 0x10(%rax,%r14,8), %xmm1
movapd %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movapd 0x30(%rsp), %xmm0
movupd %xmm0, (%rsp)
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
callq 0x95c0
movq %rax, %r12
movq 0x28(%rsp), %rax
incq 0x12540(%rbx,%rax,8)
testq %rax, %rax
je 0xd059
movslq %eax, %r13
testq %r13, %r13
jle 0xd066
addq $0x8, %r12
shlq $0x3, %r14
xorl %r15d, %r15d
testq %r15, %r15
je 0xd00a
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0x94e0
movq 0x50(%rbx), %rax
movq 0x58(%rbx), %rcx
leaq (%rcx,%rcx,4), %rcx
leaq (%rax,%rcx,8), %rax
addq $-0x28, %rax
jmp 0xd011
movq 0x50(%rbx), %rax
addq %r14, %rax
xorps %xmm0, %xmm0
cvtsd2ss (%r12), %xmm0
movss %xmm0, 0x24(%rax)
cvtps2pd 0x10(%rax), %xmm0
cvtps2pd 0x8(%rax), %xmm1
movsd -0x8(%r12), %xmm2
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm2, %xmm1
mulpd %xmm0, %xmm2
cvtpd2ps %xmm2, %xmm0
cvtpd2ps %xmm1, %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movupd %xmm1, 0x8(%rax)
incq %r15
addq $0x10, %r12
cmpq %r15, %r13
jne 0xcfe2
jmp 0xd066
movq 0x50(%rbx), %rax
movl $0x0, 0x18(%rax,%r14,8)
incq %rbp
cmpq 0x20(%rsp), %rbp
jne 0xcf60
movq 0x58(%rbx), %rax
testl %eax, %eax
jle 0xd0e9
movl $0x1c, %ecx
xorl %edx, %edx
xorpd %xmm0, %xmm0
xorl %esi, %esi
movq 0x50(%rbx), %rdi
movss -0x4(%rdi,%rcx), %xmm1
ucomiss %xmm0, %xmm1
jne 0xd09a
jnp 0xd0d8
leaq (%rdi,%rcx), %rax
addq $-0x1c, %rax
leaq (%rsi,%rsi,4), %r8
incq %rsi
movupd (%rax), %xmm2
movq 0x10(%rax), %r9
movq %r9, 0x10(%rdi,%r8,8)
movupd %xmm2, (%rdi,%r8,8)
movss %xmm1, 0x18(%rdi,%r8,8)
movq 0x1c(%rax), %r9
movl 0x24(%rax), %eax
movl %eax, 0x24(%rdi,%r8,8)
movq %r9, 0x1c(%rdi,%r8,8)
movq 0x58(%rbx), %rax
incq %rdx
movslq %eax, %rdi
addq $0x28, %rcx
cmpq %rdi, %rdx
jl 0xd089
jmp 0xd0eb
xorl %esi, %esi
movq %rsi, 0x58(%rbx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq