// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/mathop_avx.c
// Function: vl_weighted_sigma_avx_d
VL_EXPORT void
VL_XCAT(_vl_weighted_sigma_avx_, 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 - VSIZEavx + 1 ;

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

  VTYPEavx w = VLD1avx (&W) ;

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

      VTYPEavx delta = VSUBavx(a, b) ;
      VTYPEavx delta2 = VMULavx(delta, delta) ;
      VTYPEavx delta2w = VMULavx(delta2, w) ;
      VTYPEavx sigmaStore = VADDavx(s,delta2w);

      *(VTYPEavx *)S = sigmaStore;

      X += VSIZEavx ;
      Y += VSIZEavx ;
      S += VSIZEavx ;
    }
  } else {
    while (X < X_vec_end) {
      VTYPEavx a = VLDUavx(X) ;
      VTYPEavx b = VLDUavx(Y) ;
      VTYPEavx s = VLDUavx(S) ;

      VTYPEavx delta = VSUBavx(a, b) ;
      VTYPEavx delta2 = VMULavx(delta, delta) ;
      VTYPEavx delta2w = VMULavx(delta2, w) ;
      VTYPEavx sigmaStore = VADDavx(s,delta2w);

      VST2Uavx(S,sigmaStore);

      X += VSIZEavx ;
      Y += VSIZEavx ;
      S += VSIZEavx ;
    }
  }

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $-0x20, %rsp
subq $0x4e0, %rsp            # imm = 0x4E0
movq %rdi, 0x238(%rsp)
movq %rsi, 0x230(%rsp)
movq %rdx, 0x228(%rsp)
movq %rcx, 0x220(%rsp)
vmovsd %xmm0, 0x218(%rsp)
movq 0x228(%rsp), %rax
movq 0x238(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, 0x210(%rsp)
movq 0x210(%rsp), %rax
addq $-0x18, %rax
movq %rax, 0x208(%rsp)
movl 0x228(%rsp), %eax
movl 0x220(%rsp), %ecx
orl %ecx, %eax
testb $0x1f, %al
sete %al
movzbl %al, %eax
movq 0x230(%rsp), %rcx
testb $0x1f, %cl
sete %cl
movzbl %cl, %ecx
andl %ecx, %eax
movl %eax, 0x204(%rsp)
leaq 0x218(%rsp), %rax
movq %rax, 0x498(%rsp)
movq 0x498(%rsp), %rax
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x490(%rsp)
vbroadcastsd 0x490(%rsp), %ymm0
vmovapd %ymm0, 0x460(%rsp)
vmovapd 0x460(%rsp), %ymm0
vmovapd %ymm0, 0x1e0(%rsp)
cmpl $0x0, 0x204(%rsp)
je 0x3d990
jmp 0x3d7e4
movq 0x228(%rsp), %rax
cmpq 0x208(%rsp), %rax
jae 0x3d98b
movq 0x228(%rsp), %rax
vmovapd (%rax), %ymm0
vmovapd %ymm0, 0x1c0(%rsp)
movq 0x220(%rsp), %rax
vmovapd (%rax), %ymm0
vmovapd %ymm0, 0x1a0(%rsp)
movq 0x230(%rsp), %rax
vmovapd (%rax), %ymm0
vmovapd %ymm0, 0x180(%rsp)
vmovapd 0x1c0(%rsp), %ymm1
vmovapd 0x1a0(%rsp), %ymm0
vmovapd %ymm1, 0x2a0(%rsp)
vmovapd %ymm0, 0x280(%rsp)
vmovapd 0x2a0(%rsp), %ymm0
vsubpd 0x280(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x160(%rsp)
vmovapd 0x160(%rsp), %ymm1
vmovapd 0x160(%rsp), %ymm0
vmovapd %ymm1, 0x3a0(%rsp)
vmovapd %ymm0, 0x380(%rsp)
vmovapd 0x3a0(%rsp), %ymm0
vmulpd 0x380(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x140(%rsp)
vmovapd 0x140(%rsp), %ymm1
vmovapd 0x1e0(%rsp), %ymm0
vmovapd %ymm1, 0x360(%rsp)
vmovapd %ymm0, 0x340(%rsp)
vmovapd 0x360(%rsp), %ymm0
vmulpd 0x340(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x120(%rsp)
vmovapd 0x180(%rsp), %ymm1
vmovapd 0x120(%rsp), %ymm0
vmovapd %ymm1, 0x420(%rsp)
vmovapd %ymm0, 0x400(%rsp)
vmovapd 0x420(%rsp), %ymm0
vaddpd 0x400(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x100(%rsp)
vmovapd 0x100(%rsp), %ymm0
movq 0x230(%rsp), %rax
vmovapd %ymm0, (%rax)
movq 0x228(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x228(%rsp)
movq 0x220(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x220(%rsp)
movq 0x230(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x230(%rsp)
jmp 0x3d7e4
jmp 0x3db7b
jmp 0x3d992
movq 0x228(%rsp), %rax
cmpq 0x208(%rsp), %rax
jae 0x3db79
movq 0x228(%rsp), %rax
movq %rax, 0x458(%rsp)
movq 0x458(%rsp), %rax
vmovupd (%rax), %ymm0
vmovapd %ymm0, 0xe0(%rsp)
movq 0x220(%rsp), %rax
movq %rax, 0x450(%rsp)
movq 0x450(%rsp), %rax
vmovupd (%rax), %ymm0
vmovapd %ymm0, 0xc0(%rsp)
movq 0x230(%rsp), %rax
movq %rax, 0x448(%rsp)
movq 0x448(%rsp), %rax
vmovupd (%rax), %ymm0
vmovapd %ymm0, 0xa0(%rsp)
vmovapd 0xe0(%rsp), %ymm1
vmovapd 0xc0(%rsp), %ymm0
vmovapd %ymm1, 0x260(%rsp)
vmovapd %ymm0, 0x240(%rsp)
vmovapd 0x260(%rsp), %ymm0
vsubpd 0x240(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x80(%rsp)
vmovapd 0x80(%rsp), %ymm1
vmovapd 0x80(%rsp), %ymm0
vmovapd %ymm1, 0x320(%rsp)
vmovapd %ymm0, 0x300(%rsp)
vmovapd 0x320(%rsp), %ymm0
vmulpd 0x300(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x60(%rsp)
vmovapd 0x60(%rsp), %ymm1
vmovapd 0x1e0(%rsp), %ymm0
vmovapd %ymm1, 0x2e0(%rsp)
vmovapd %ymm0, 0x2c0(%rsp)
vmovapd 0x2e0(%rsp), %ymm0
vmulpd 0x2c0(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x40(%rsp)
vmovapd 0xa0(%rsp), %ymm1
vmovapd 0x40(%rsp), %ymm0
vmovapd %ymm1, 0x3e0(%rsp)
vmovapd %ymm0, 0x3c0(%rsp)
vmovapd 0x3e0(%rsp), %ymm0
vaddpd 0x3c0(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x20(%rsp)
movq 0x230(%rsp), %rax
vmovapd 0x20(%rsp), %ymm0
movq %rax, 0x4c8(%rsp)
vmovapd %ymm0, 0x4a0(%rsp)
vmovapd 0x4a0(%rsp), %ymm0
movq 0x4c8(%rsp), %rax
vmovupd %ymm0, (%rax)
movq 0x228(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x228(%rsp)
movq 0x220(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x220(%rsp)
movq 0x230(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x230(%rsp)
jmp 0x3d992
jmp 0x3db7b
jmp 0x3db7d
movq 0x228(%rsp), %rax
cmpq 0x210(%rsp), %rax
jae 0x3dc2d
movq 0x228(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x228(%rsp)
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x18(%rsp)
movq 0x220(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x220(%rsp)
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x10(%rsp)
vmovsd 0x18(%rsp), %xmm0
vsubsd 0x10(%rsp), %xmm0, %xmm0
vmovsd %xmm0, 0x8(%rsp)
vmovsd 0x8(%rsp), %xmm0
vmulsd 0x8(%rsp), %xmm0, %xmm0
vmovsd 0x218(%rsp), %xmm2
movq 0x230(%rsp), %rax
vmovsd (%rax), %xmm1
vmulsd %xmm2, %xmm0, %xmm0
vaddsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, (%rax)
movq 0x230(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x230(%rsp)
jmp 0x3db7d
movq %rbp, %rsp
popq %rbp
vzeroupper
retq
nopw %cs:(%rax,%rax)