// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/mathop_sse2.c
// Function: vl_weighted_sigma_sse2_d
VL_EXPORT void
VL_XCAT(_vl_weighted_sigma_sse2_, SFX)
(vl_size dimension, T * S, T const * X, T const * Y, T const W)
{
  T const * X_end = X + dimension ;
  T const * X_vec_end = X_end - VSIZE + 1 ;

  vl_bool dataAligned = VALIGNED(X) & VALIGNED(Y) & VALIGNED(S);

  VTYPE w = VLD1 (&W) ;

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

      VTYPE delta = VSUB(a, b) ;
      VTYPE delta2 = VMUL(delta, delta) ;
      VTYPE delta2w = VMUL(delta2, w) ;
      VTYPE sigmaStore = VADD(s,delta2w);

      *(VTYPE *)S = sigmaStore;

      X += VSIZE ;
      Y += VSIZE ;
      S += VSIZE ;
    }
  } else {
    while (X < X_vec_end) {
      VTYPE a = VLDU(X) ;
      VTYPE b = VLDU(Y) ;
      VTYPE s = VLDU(S) ;

      VTYPE delta = VSUB(a, b) ;
      VTYPE delta2 = VMUL(delta, delta) ;
      VTYPE delta2w = VMUL(delta2, w) ;
      VTYPE sigmaStore = VADD(s,delta2w);

      VST2U(S,sigmaStore);

      X += VSIZE ;
      Y += VSIZE ;
      S += VSIZE ;
    }
  }


  while (X < X_end) {
    T a = *X++ ;
    T b = *Y++ ;
    T delta = a - b ;
    *S += ((delta * delta)*W) ;
    S++;
  }
}

// Assembly:
subq $0x228, %rsp            # imm = 0x228
movq %rdi, 0xc8(%rsp)
movq %rsi, 0xc0(%rsp)
movq %rdx, 0xb8(%rsp)
movq %rcx, 0xb0(%rsp)
movsd %xmm0, 0xa8(%rsp)
movq 0xb8(%rsp), %rax
movq 0xc8(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
addq $-0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xb8(%rsp), %eax
movl 0xb0(%rsp), %ecx
orl %ecx, %eax
testb $0xf, %al
sete %al
movzbl %al, %eax
movq 0xc0(%rsp), %rcx
testb $0xf, %cl
sete %cl
movzbl %cl, %ecx
andl %ecx, %eax
movl %eax, 0x94(%rsp)
leaq 0xa8(%rsp), %rax
movq %rax, 0x208(%rsp)
movq 0x208(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x200(%rsp)
movsd 0x200(%rsp), %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd %xmm0, 0x1f0(%rsp)
movapd 0x1f0(%rsp), %xmm0
movapd %xmm0, 0x80(%rsp)
cmpl $0x0, 0x94(%rsp)
je 0x417be
jmp 0x4163f
movq 0xb8(%rsp), %rax
cmpq 0x98(%rsp), %rax
jae 0x417b9
movq 0xb8(%rsp), %rax
movapd (%rax), %xmm0
movapd %xmm0, 0x70(%rsp)
movq 0xb0(%rsp), %rax
movapd (%rax), %xmm0
movapd %xmm0, 0x60(%rsp)
movq 0xc0(%rsp), %rax
movapd (%rax), %xmm0
movapd %xmm0, 0x50(%rsp)
movapd 0x70(%rsp), %xmm1
movapd 0x60(%rsp), %xmm0
movapd %xmm1, 0x1e0(%rsp)
movapd %xmm0, 0x1d0(%rsp)
movapd 0x1e0(%rsp), %xmm0
subpd 0x1d0(%rsp), %xmm0
movapd %xmm0, 0x40(%rsp)
movapd 0x40(%rsp), %xmm1
movapd 0x40(%rsp), %xmm0
movapd %xmm1, 0x140(%rsp)
movapd %xmm0, 0x130(%rsp)
movapd 0x140(%rsp), %xmm0
mulpd 0x130(%rsp), %xmm0
movapd %xmm0, 0x30(%rsp)
movapd 0x30(%rsp), %xmm1
movapd 0x80(%rsp), %xmm0
movapd %xmm1, 0x120(%rsp)
movapd %xmm0, 0x110(%rsp)
movapd 0x120(%rsp), %xmm0
mulpd 0x110(%rsp), %xmm0
movapd %xmm0, 0x20(%rsp)
movapd 0x50(%rsp), %xmm1
movapd 0x20(%rsp), %xmm0
movapd %xmm1, 0x180(%rsp)
movapd %xmm0, 0x170(%rsp)
movapd 0x180(%rsp), %xmm0
addpd 0x170(%rsp), %xmm0
movapd %xmm0, 0x10(%rsp)
movapd 0x10(%rsp), %xmm0
movq 0xc0(%rsp), %rax
movapd %xmm0, (%rax)
movq 0xb8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0xb8(%rsp)
movq 0xb0(%rsp), %rax
addq $0x10, %rax
movq %rax, 0xb0(%rsp)
movq 0xc0(%rsp), %rax
addq $0x10, %rax
movq %rax, 0xc0(%rsp)
jmp 0x4163f
jmp 0x4198c
jmp 0x417c0
movq 0xb8(%rsp), %rax
cmpq 0x98(%rsp), %rax
jae 0x4198a
movq 0xb8(%rsp), %rax
movq %rax, 0x1a8(%rsp)
movq 0x1a8(%rsp), %rax
movupd (%rax), %xmm0
movapd %xmm0, (%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x1a0(%rsp)
movq 0x1a0(%rsp), %rax
movupd (%rax), %xmm0
movapd %xmm0, -0x10(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x198(%rsp)
movq 0x198(%rsp), %rax
movupd (%rax), %xmm0
movapd %xmm0, -0x20(%rsp)
movapd (%rsp), %xmm1
movapd -0x10(%rsp), %xmm0
movapd %xmm1, 0x1c0(%rsp)
movapd %xmm0, 0x1b0(%rsp)
movapd 0x1c0(%rsp), %xmm0
subpd 0x1b0(%rsp), %xmm0
movapd %xmm0, -0x30(%rsp)
movapd -0x30(%rsp), %xmm1
movapd -0x30(%rsp), %xmm0
movapd %xmm1, 0x100(%rsp)
movapd %xmm0, 0xf0(%rsp)
movapd 0x100(%rsp), %xmm0
mulpd 0xf0(%rsp), %xmm0
movapd %xmm0, -0x40(%rsp)
movapd -0x40(%rsp), %xmm1
movapd 0x80(%rsp), %xmm0
movapd %xmm1, 0xe0(%rsp)
movapd %xmm0, 0xd0(%rsp)
movapd 0xe0(%rsp), %xmm0
mulpd 0xd0(%rsp), %xmm0
movapd %xmm0, -0x50(%rsp)
movapd -0x20(%rsp), %xmm1
movapd -0x50(%rsp), %xmm0
movapd %xmm1, 0x160(%rsp)
movapd %xmm0, 0x150(%rsp)
movapd 0x160(%rsp), %xmm0
addpd 0x150(%rsp), %xmm0
movapd %xmm0, -0x60(%rsp)
movq 0xc0(%rsp), %rax
movapd -0x60(%rsp), %xmm0
movq %rax, 0x220(%rsp)
movapd %xmm0, 0x210(%rsp)
movapd 0x210(%rsp), %xmm0
movq 0x220(%rsp), %rax
movupd %xmm0, (%rax)
movq 0xb8(%rsp), %rax
addq $0x10, %rax
movq %rax, 0xb8(%rsp)
movq 0xb0(%rsp), %rax
addq $0x10, %rax
movq %rax, 0xb0(%rsp)
movq 0xc0(%rsp), %rax
addq $0x10, %rax
movq %rax, 0xc0(%rsp)
jmp 0x417c0
jmp 0x4198c
jmp 0x4198e
movq 0xb8(%rsp), %rax
cmpq 0xa0(%rsp), %rax
jae 0x41a3e
movq 0xb8(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0xb8(%rsp)
movsd (%rax), %xmm0
movsd %xmm0, -0x68(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0xb0(%rsp)
movsd (%rax), %xmm0
movsd %xmm0, -0x70(%rsp)
movsd -0x68(%rsp), %xmm0
subsd -0x70(%rsp), %xmm0
movsd %xmm0, -0x78(%rsp)
movsd -0x78(%rsp), %xmm0
mulsd -0x78(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm2
movq 0xc0(%rsp), %rax
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq 0xc0(%rsp), %rax
addq $0x8, %rax
movq %rax, 0xc0(%rsp)
jmp 0x4198e
addq $0x228, %rsp            # imm = 0x228
retq
nopw %cs:(%rax,%rax)