// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/mathop_avx.c
// Function: vl_distance_mahalanobis_sq_avx_d
VL_EXPORT T
VL_XCAT(_vl_distance_mahalanobis_sq_avx_, SFX)
(vl_size dimension, T const * X, T const * MU, T const * S)
{
  T const * X_end = X + dimension ;
  T const * X_vec_end = X_end - VSIZEavx + 1 ;
  T acc ;
  VTYPEavx vacc = VSTZavx() ;
  vl_bool dataAligned = VALIGNEDavx(X) & VALIGNEDavx(MU) & VALIGNEDavx(S);

  if (dataAligned) {
    while (X < X_vec_end) {
      VTYPEavx a = *(VTYPEavx*)X ;
      VTYPEavx b = *(VTYPEavx*)MU ;
      VTYPEavx c = *(VTYPEavx*)S ;

      VTYPEavx delta = VSUBavx(a, b) ;
      VTYPEavx delta2 = VMULavx(delta, delta) ;
      VTYPEavx delta2div = VMULavx(delta2,c);

      vacc = VADDavx(vacc, delta2div) ;

      X  += VSIZEavx ;
      MU += VSIZEavx ;
      S  += VSIZEavx ;
    }
  } else {
    while (X < X_vec_end) {

      VTYPEavx a = VLDUavx(X) ;
      VTYPEavx b = VLDUavx(MU) ;
      VTYPEavx c = VLDUavx(S) ;

      VTYPEavx delta = VSUBavx(a, b) ;
      VTYPEavx delta2 = VMULavx(delta, delta) ;
      VTYPEavx delta2div = VMULavx(delta2,c);

      vacc = VADDavx(vacc, delta2div) ;

      X  += VSIZEavx ;
      MU += VSIZEavx ;
      S  += VSIZEavx ;
    }
  }

  acc = VL_XCAT(_vl_vhsum_avx_, SFX)(vacc) ;

  while (X < X_end) {
    T a = *X++ ;
    T b = *MU++ ;
    T c = *S++ ;
    T delta = a - b ;
    acc += (delta * delta) * c;
  }

  return acc ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $-0x20, %rsp
subq $0x480, %rsp            # imm = 0x480
movq %rdi, 0x218(%rsp)
movq %rsi, 0x210(%rsp)
movq %rdx, 0x208(%rsp)
movq %rcx, 0x200(%rsp)
movq 0x210(%rsp), %rax
movq 0x218(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, 0x1f8(%rsp)
movq 0x1f8(%rsp), %rax
addq $-0x18, %rax
movq %rax, 0x1f0(%rsp)
vxorps %xmm0, %xmm0, %xmm0
vmovapd %ymm0, 0x220(%rsp)
vmovapd 0x220(%rsp), %ymm0
vmovapd %ymm0, 0x1c0(%rsp)
movq 0x210(%rsp), %rax
andq $0x1f, %rax
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movq 0x208(%rsp), %rcx
andq $0x1f, %rcx
cmpq $0x0, %rcx
setne %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
andl %ecx, %eax
movq 0x200(%rsp), %rcx
andq $0x1f, %rcx
cmpq $0x0, %rcx
setne %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
andl %ecx, %eax
movl %eax, 0x1bc(%rsp)
cmpl $0x0, 0x1bc(%rsp)
je 0x3d0c2
jmp 0x3cf2b
movq 0x210(%rsp), %rax
cmpq 0x1f0(%rsp), %rax
jae 0x3d0bd
movq 0x210(%rsp), %rax
vmovapd (%rax), %ymm0
vmovapd %ymm0, 0x180(%rsp)
movq 0x208(%rsp), %rax
vmovapd (%rax), %ymm0
vmovapd %ymm0, 0x160(%rsp)
movq 0x200(%rsp), %rax
vmovapd (%rax), %ymm0
vmovapd %ymm0, 0x140(%rsp)
vmovapd 0x180(%rsp), %ymm1
vmovapd 0x160(%rsp), %ymm0
vmovapd %ymm1, 0x2a0(%rsp)
vmovapd %ymm0, 0x280(%rsp)
vmovapd 0x2a0(%rsp), %ymm0
vsubpd 0x280(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x120(%rsp)
vmovapd 0x120(%rsp), %ymm1
vmovapd 0x120(%rsp), %ymm0
vmovapd %ymm1, 0x3a0(%rsp)
vmovapd %ymm0, 0x380(%rsp)
vmovapd 0x3a0(%rsp), %ymm0
vmulpd 0x380(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x100(%rsp)
vmovapd 0x100(%rsp), %ymm1
vmovapd 0x140(%rsp), %ymm0
vmovapd %ymm1, 0x360(%rsp)
vmovapd %ymm0, 0x340(%rsp)
vmovapd 0x360(%rsp), %ymm0
vmulpd 0x340(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0xe0(%rsp)
vmovapd 0x1c0(%rsp), %ymm1
vmovapd 0xe0(%rsp), %ymm0
vmovapd %ymm1, 0x420(%rsp)
vmovapd %ymm0, 0x400(%rsp)
vmovapd 0x420(%rsp), %ymm0
vaddpd 0x400(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x1c0(%rsp)
movq 0x210(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x210(%rsp)
movq 0x208(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x208(%rsp)
movq 0x200(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x200(%rsp)
jmp 0x3cf2b
jmp 0x3d273
jmp 0x3d0c4
movq 0x210(%rsp), %rax
cmpq 0x1f0(%rsp), %rax
jae 0x3d271
movq 0x210(%rsp), %rax
movq %rax, 0x468(%rsp)
movq 0x468(%rsp), %rax
vmovupd (%rax), %ymm0
vmovapd %ymm0, 0xc0(%rsp)
movq 0x208(%rsp), %rax
movq %rax, 0x460(%rsp)
movq 0x460(%rsp), %rax
vmovupd (%rax), %ymm0
vmovapd %ymm0, 0xa0(%rsp)
movq 0x200(%rsp), %rax
movq %rax, 0x458(%rsp)
movq 0x458(%rsp), %rax
vmovupd (%rax), %ymm0
vmovapd %ymm0, 0x80(%rsp)
vmovapd 0xc0(%rsp), %ymm1
vmovapd 0xa0(%rsp), %ymm0
vmovapd %ymm1, 0x260(%rsp)
vmovapd %ymm0, 0x240(%rsp)
vmovapd 0x260(%rsp), %ymm0
vsubpd 0x240(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x60(%rsp)
vmovapd 0x60(%rsp), %ymm1
vmovapd 0x60(%rsp), %ymm0
vmovapd %ymm1, 0x320(%rsp)
vmovapd %ymm0, 0x300(%rsp)
vmovapd 0x320(%rsp), %ymm0
vmulpd 0x300(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x40(%rsp)
vmovapd 0x40(%rsp), %ymm1
vmovapd 0x80(%rsp), %ymm0
vmovapd %ymm1, 0x2e0(%rsp)
vmovapd %ymm0, 0x2c0(%rsp)
vmovapd 0x2e0(%rsp), %ymm0
vmulpd 0x2c0(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x20(%rsp)
vmovapd 0x1c0(%rsp), %ymm1
vmovapd 0x20(%rsp), %ymm0
vmovapd %ymm1, 0x3e0(%rsp)
vmovapd %ymm0, 0x3c0(%rsp)
vmovapd 0x3e0(%rsp), %ymm0
vaddpd 0x3c0(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x1c0(%rsp)
movq 0x210(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x210(%rsp)
movq 0x208(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x208(%rsp)
movq 0x200(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x200(%rsp)
jmp 0x3d0c4
jmp 0x3d273
vmovapd 0x1c0(%rsp), %ymm0
callq 0x3cd60
vmovsd %xmm0, 0x1e8(%rsp)
movq 0x210(%rsp), %rax
cmpq 0x1f8(%rsp), %rax
jae 0x3d343
movq 0x210(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x210(%rsp)
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x18(%rsp)
movq 0x208(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x208(%rsp)
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x10(%rsp)
movq 0x200(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x200(%rsp)
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x8(%rsp)
vmovsd 0x18(%rsp), %xmm0
vsubsd 0x10(%rsp), %xmm0, %xmm0
vmovsd %xmm0, (%rsp)
vmovsd (%rsp), %xmm0
vmulsd (%rsp), %xmm0, %xmm0
vmovsd 0x8(%rsp), %xmm2
vmovsd 0x1e8(%rsp), %xmm1
vmulsd %xmm2, %xmm0, %xmm0
vaddsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, 0x1e8(%rsp)
jmp 0x3d28a
vmovsd 0x1e8(%rsp), %xmm0
movq %rbp, %rsp
popq %rbp
vzeroupper
retq
nopw %cs:(%rax,%rax)