// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/gmm.c
// Function: vl_gmm_compute_init_sigma_f
static void
VL_XCAT(_vl_gmm_compute_init_sigma_, SFX)
(VlGMM * self,
 TYPE const * data,
 TYPE * initSigma,
 vl_size dimension,
 vl_size numData)
{
  vl_size dim;
  vl_uindex i;

  TYPE * dataMean ;

  memset(initSigma,0,sizeof(TYPE)*dimension) ;
  if (numData <= 1) return ;

  dataMean = vl_malloc(sizeof(TYPE)*dimension);
  memset(dataMean,0,sizeof(TYPE)*dimension) ;

  /* find mean of the whole dataset */
  for(dim = 0 ; dim < dimension ; dim++) {
    for(i = 0 ; i < numData ; i++) {
      dataMean[dim] += data[i*dimension + dim];
    }
    dataMean[dim] /= numData;
  }

  /* compute variance of the whole dataset */
  for(dim = 0; dim < dimension; dim++) {
    for(i = 0; i < numData; i++) {
      TYPE diff = (data[i*self->dimension + dim] - dataMean[dim]) ;
      initSigma[dim] += diff*diff ;
    }
    initSigma[dim] /= numData - 1 ;
  }

  vl_free(dataMean) ;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x30(%rsp)
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x9480
cmpq $0x1, 0x30(%rsp)
ja 0x1a78f
jmp 0x1a9a7
movq 0x38(%rsp), %rdi
shlq $0x2, %rdi
callq 0x9660
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq 0x38(%rsp), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x9480
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x1a892
movq $0x0, 0x20(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x30(%rsp), %rax
jae 0x1a823
movq 0x48(%rsp), %rax
movq 0x20(%rsp), %rcx
imulq 0x38(%rsp), %rcx
addq 0x28(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
addss (%rax,%rcx,4), %xmm0
movss %xmm0, (%rax,%rcx,4)
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x1a7d9
movq 0x30(%rsp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, 0xc(%rsp)
testq %rax, %rax
movss %xmm0, 0x10(%rsp)
js 0x1a861
movss 0xc(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
movss 0x10(%rsp), %xmm1
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
divss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x1a7c0
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x1a99d
movq $0x0, 0x20(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x30(%rsp), %rax
jae 0x1a92b
movq 0x48(%rsp), %rax
movq 0x20(%rsp), %rcx
movq 0x50(%rsp), %rdx
imulq 0x8(%rdx), %rcx
addq 0x28(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
subss (%rax,%rcx,4), %xmm0
movss %xmm0, 0x14(%rsp)
movss 0x14(%rsp), %xmm0
movss 0x14(%rsp), %xmm2
movq 0x40(%rsp), %rax
movq 0x28(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x1a8b4
movq 0x30(%rsp), %rax
decq %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, 0x4(%rsp)
testq %rax, %rax
movss %xmm0, 0x8(%rsp)
js 0x1a96c
movss 0x4(%rsp), %xmm0
movss %xmm0, 0x8(%rsp)
movss 0x8(%rsp), %xmm1
movq 0x40(%rsp), %rax
movq 0x28(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
divss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x1a89b
movq 0x18(%rsp), %rdi
callq 0x9620
addq $0x58, %rsp
retq
nopl (%rax)