// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/mathop_sse2.c
// Function: vl_distance_mahalanobis_sq_sse2_d
VL_EXPORT T
VL_XCAT(_vl_distance_mahalanobis_sq_sse2_, 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 - VSIZE + 1 ;
  T acc ;
  VTYPE vacc = VSTZ() ;
  vl_bool dataAligned = VALIGNED(X) & VALIGNED(MU) & VALIGNED(S);

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

      VTYPE delta = VSUB(a, b) ;
      VTYPE delta2 = VMUL(delta, delta) ;
      VTYPE delta2div = VMUL(delta2,c);

      vacc = VADD(vacc, delta2div) ;

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

      VTYPE a = VLDU(X) ;
      VTYPE b = VLDU(MU) ;
      VTYPE c = VLDU(S) ;

      VTYPE delta = VSUB(a, b) ;
      VTYPE delta2 = VMUL(delta, delta) ;
      VTYPE delta2div = VMUL(delta2,c);

      vacc = VADD(vacc, delta2div) ;

      X  += VSIZE ;
      MU += VSIZE ;
      S  += VSIZE ;
    }
  }

  acc = VL_XCAT(_vl_vhsum_sse2_, 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:
subq $0x278, %rsp            # imm = 0x278
movq %rdi, 0x138(%rsp)
movq %rsi, 0x130(%rsp)
movq %rdx, 0x128(%rsp)
movq %rcx, 0x120(%rsp)
movq 0x130(%rsp), %rax
movq 0x138(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, 0x118(%rsp)
movq 0x118(%rsp), %rax
addq $-0x8, %rax
movq %rax, 0x110(%rsp)
xorps %xmm0, %xmm0
movapd %xmm0, 0x140(%rsp)
movapd 0x140(%rsp), %xmm0
movapd %xmm0, 0xf0(%rsp)
movq 0x130(%rsp), %rax
andq $0xf, %rax
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movq 0x128(%rsp), %rcx
andq $0xf, %rcx
cmpq $0x0, %rcx
setne %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
andl %ecx, %eax
movq 0x120(%rsp), %rcx
andq $0xf, %rcx
cmpq $0x0, %rcx
setne %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
andl %ecx, %eax
movl %eax, 0xec(%rsp)
cmpl $0x0, 0xec(%rsp)
je 0x3f949
jmp 0x3f7b2
movq 0x130(%rsp), %rax
cmpq 0x110(%rsp), %rax
jae 0x3f944
movq 0x130(%rsp), %rax
movapd (%rax), %xmm0
movapd %xmm0, 0xd0(%rsp)
movq 0x128(%rsp), %rax
movapd (%rax), %xmm0
movapd %xmm0, 0xc0(%rsp)
movq 0x120(%rsp), %rax
movapd (%rax), %xmm0
movapd %xmm0, 0xb0(%rsp)
movapd 0xd0(%rsp), %xmm1
movapd 0xc0(%rsp), %xmm0
movapd %xmm1, 0x260(%rsp)
movapd %xmm0, 0x250(%rsp)
movapd 0x260(%rsp), %xmm0
subpd 0x250(%rsp), %xmm0
movapd %xmm0, 0xa0(%rsp)
movapd 0xa0(%rsp), %xmm1
movapd 0xa0(%rsp), %xmm0
movapd %xmm1, 0x1c0(%rsp)
movapd %xmm0, 0x1b0(%rsp)
movapd 0x1c0(%rsp), %xmm0
mulpd 0x1b0(%rsp), %xmm0
movapd %xmm0, 0x90(%rsp)
movapd 0x90(%rsp), %xmm1
movapd 0xb0(%rsp), %xmm0
movapd %xmm1, 0x1a0(%rsp)
movapd %xmm0, 0x190(%rsp)
movapd 0x1a0(%rsp), %xmm0
mulpd 0x190(%rsp), %xmm0
movapd %xmm0, 0x80(%rsp)
movapd 0xf0(%rsp), %xmm1
movapd 0x80(%rsp), %xmm0
movapd %xmm1, 0x200(%rsp)
movapd %xmm0, 0x1f0(%rsp)
movapd 0x200(%rsp), %xmm0
addpd 0x1f0(%rsp), %xmm0
movapd %xmm0, 0xf0(%rsp)
movq 0x130(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x130(%rsp)
movq 0x128(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x128(%rsp)
movq 0x120(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x120(%rsp)
jmp 0x3f7b2
jmp 0x3fae8
jmp 0x3f94b
movq 0x130(%rsp), %rax
cmpq 0x110(%rsp), %rax
jae 0x3fae6
movq 0x130(%rsp), %rax
movq %rax, 0x228(%rsp)
movq 0x228(%rsp), %rax
movupd (%rax), %xmm0
movapd %xmm0, 0x70(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0x220(%rsp)
movq 0x220(%rsp), %rax
movupd (%rax), %xmm0
movapd %xmm0, 0x60(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0x218(%rsp)
movq 0x218(%rsp), %rax
movupd (%rax), %xmm0
movapd %xmm0, 0x50(%rsp)
movapd 0x70(%rsp), %xmm1
movapd 0x60(%rsp), %xmm0
movapd %xmm1, 0x240(%rsp)
movapd %xmm0, 0x230(%rsp)
movapd 0x240(%rsp), %xmm0
subpd 0x230(%rsp), %xmm0
movapd %xmm0, 0x40(%rsp)
movapd 0x40(%rsp), %xmm1
movapd 0x40(%rsp), %xmm0
movapd %xmm1, 0x180(%rsp)
movapd %xmm0, 0x170(%rsp)
movapd 0x180(%rsp), %xmm0
mulpd 0x170(%rsp), %xmm0
movapd %xmm0, 0x30(%rsp)
movapd 0x30(%rsp), %xmm1
movapd 0x50(%rsp), %xmm0
movapd %xmm1, 0x160(%rsp)
movapd %xmm0, 0x150(%rsp)
movapd 0x160(%rsp), %xmm0
mulpd 0x150(%rsp), %xmm0
movapd %xmm0, 0x20(%rsp)
movapd 0xf0(%rsp), %xmm1
movapd 0x20(%rsp), %xmm0
movapd %xmm1, 0x1e0(%rsp)
movapd %xmm0, 0x1d0(%rsp)
movapd 0x1e0(%rsp), %xmm0
addpd 0x1d0(%rsp), %xmm0
movapd %xmm0, 0xf0(%rsp)
movq 0x130(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x130(%rsp)
movq 0x128(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x128(%rsp)
movq 0x120(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x120(%rsp)
jmp 0x3f94b
jmp 0x3fae8
movapd 0xf0(%rsp), %xmm0
callq 0x3f280
movsd %xmm0, 0x108(%rsp)
movq 0x130(%rsp), %rax
cmpq 0x118(%rsp), %rax
jae 0x3fbb8
movq 0x130(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x130(%rsp)
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x128(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x128(%rsp)
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x120(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x120(%rsp)
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x18(%rsp), %xmm0
subsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd (%rsp), %xmm0
mulsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm2
movsd 0x108(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x108(%rsp)
jmp 0x3faff
movsd 0x108(%rsp), %xmm0
addq $0x278, %rsp            # imm = 0x278
retq
nopl (%rax)