// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/mathop_avx.c
// Function: vl_distance_l2_avx_d
VL_EXPORT T
VL_XCAT(_vl_distance_l2_avx_, SFX)
(vl_size dimension, T const * X, T const * Y)
{

  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(Y) ;

  if (dataAligned) {
    while (X < X_vec_end) {
      VTYPEavx a = *(VTYPEavx*)X ;
      VTYPEavx b = *(VTYPEavx*)Y ;
      VTYPEavx delta = VSUBavx(a, b) ;
      VTYPEavx delta2 = VMULavx(delta, delta) ;
      vacc = VADDavx(vacc, delta2) ;
      X += VSIZEavx ;
      Y += VSIZEavx ;
    }
  } else {
    while (X < X_vec_end) {
      VTYPEavx a = VLDUavx(X) ;
      VTYPEavx b = VLDUavx(Y) ;
      VTYPEavx delta = VSUBavx(a, b) ;
      VTYPEavx delta2 = VMULavx(delta, delta) ;
      vacc = VADDavx(vacc, delta2) ;
      X += VSIZEavx ;
      Y += VSIZEavx ;
    }
  }

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

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

  return acc ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $-0x20, %rsp
subq $0x360, %rsp            # imm = 0x360
movq %rdi, 0x198(%rsp)
movq %rsi, 0x190(%rsp)
movq %rdx, 0x188(%rsp)
movq 0x190(%rsp), %rax
movq 0x198(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, 0x180(%rsp)
movq 0x180(%rsp), %rax
addq $-0x18, %rax
movq %rax, 0x178(%rsp)
vxorps %xmm0, %xmm0, %xmm0
vmovapd %ymm0, 0x1a0(%rsp)
vmovapd 0x1a0(%rsp), %ymm0
vmovapd %ymm0, 0x140(%rsp)
movq 0x190(%rsp), %rax
andq $0x1f, %rax
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movq 0x188(%rsp), %rcx
andq $0x1f, %rcx
cmpq $0x0, %rcx
setne %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
andl %ecx, %eax
movl %eax, 0x13c(%rsp)
cmpl $0x0, 0x13c(%rsp)
je 0x3cb64
jmp 0x3ca35
movq 0x190(%rsp), %rax
cmpq 0x178(%rsp), %rax
jae 0x3cb5f
movq 0x190(%rsp), %rax
vmovapd (%rax), %ymm0
vmovapd %ymm0, 0x100(%rsp)
movq 0x188(%rsp), %rax
vmovapd (%rax), %ymm0
vmovapd %ymm0, 0xe0(%rsp)
vmovapd 0x100(%rsp), %ymm1
vmovapd 0xe0(%rsp), %ymm0
vmovapd %ymm1, 0x220(%rsp)
vmovapd %ymm0, 0x200(%rsp)
vmovapd 0x220(%rsp), %ymm0
vsubpd 0x200(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0xc0(%rsp)
vmovapd 0xc0(%rsp), %ymm1
vmovapd 0xc0(%rsp), %ymm0
vmovapd %ymm1, 0x2a0(%rsp)
vmovapd %ymm0, 0x280(%rsp)
vmovapd 0x2a0(%rsp), %ymm0
vmulpd 0x280(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0xa0(%rsp)
vmovapd 0x140(%rsp), %ymm1
vmovapd 0xa0(%rsp), %ymm0
vmovapd %ymm1, 0x320(%rsp)
vmovapd %ymm0, 0x300(%rsp)
vmovapd 0x320(%rsp), %ymm0
vaddpd 0x300(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x140(%rsp)
movq 0x190(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x190(%rsp)
movq 0x188(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x188(%rsp)
jmp 0x3ca35
jmp 0x3cc9d
jmp 0x3cb66
movq 0x190(%rsp), %rax
cmpq 0x178(%rsp), %rax
jae 0x3cc9b
movq 0x190(%rsp), %rax
movq %rax, 0x348(%rsp)
movq 0x348(%rsp), %rax
vmovupd (%rax), %ymm0
vmovapd %ymm0, 0x80(%rsp)
movq 0x188(%rsp), %rax
movq %rax, 0x340(%rsp)
movq 0x340(%rsp), %rax
vmovupd (%rax), %ymm0
vmovapd %ymm0, 0x60(%rsp)
vmovapd 0x80(%rsp), %ymm1
vmovapd 0x60(%rsp), %ymm0
vmovapd %ymm1, 0x1e0(%rsp)
vmovapd %ymm0, 0x1c0(%rsp)
vmovapd 0x1e0(%rsp), %ymm0
vsubpd 0x1c0(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x40(%rsp)
vmovapd 0x40(%rsp), %ymm1
vmovapd 0x40(%rsp), %ymm0
vmovapd %ymm1, 0x260(%rsp)
vmovapd %ymm0, 0x240(%rsp)
vmovapd 0x260(%rsp), %ymm0
vmulpd 0x240(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x20(%rsp)
vmovapd 0x140(%rsp), %ymm1
vmovapd 0x20(%rsp), %ymm0
vmovapd %ymm1, 0x2e0(%rsp)
vmovapd %ymm0, 0x2c0(%rsp)
vmovapd 0x2e0(%rsp), %ymm0
vaddpd 0x2c0(%rsp), %ymm0, %ymm0
vmovapd %ymm0, 0x140(%rsp)
movq 0x190(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x190(%rsp)
movq 0x188(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x188(%rsp)
jmp 0x3cb66
jmp 0x3cc9d
vmovapd 0x140(%rsp), %ymm0
callq 0x3cd60
vmovsd %xmm0, 0x170(%rsp)
movq 0x190(%rsp), %rax
cmpq 0x180(%rsp), %rax
jae 0x3cd45
movq 0x190(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x190(%rsp)
vmovsd (%rax), %xmm0
vmovsd %xmm0, 0x18(%rsp)
movq 0x188(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x188(%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
vmovsd 0x8(%rsp), %xmm2
vmovsd 0x170(%rsp), %xmm1
vmulsd %xmm2, %xmm0, %xmm0
vaddsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, 0x170(%rsp)
jmp 0x3ccb4
vmovsd 0x170(%rsp), %xmm0
movq %rbp, %rsp
popq %rbp
vzeroupper
retq
nopw %cs:(%rax,%rax)