// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/imopv.c
// Function: vl_imgradient_f
VL_EXPORT void
VL_XCAT(vl_imgradient_, SFX)
(T * xGradient, T * yGradient,
 vl_size gradWidthStride, vl_size gradHeightStride,
 T const * image,
 vl_size imageWidth, vl_size imageHeight,
 vl_size imageStride)
{
  /* Shortcuts */
  vl_index const xo = 1 ;
  vl_index const yo = imageStride ;
  vl_size const w = imageWidth;
  vl_size const h = imageHeight;

  T const *src, *end ;
  T *pgrad_x, *pgrad_y;
  vl_size y;

  src  = image ;
  pgrad_x = xGradient ;
  pgrad_y = yGradient ;

  /* first pixel of the first row */
  *pgrad_x = src[+xo] - src[0] ;
  pgrad_x += gradWidthStride;
  *pgrad_y = src[+yo] - src[0] ;
  pgrad_y += gradWidthStride;
  src++;

  /* middle pixels of the  first row */
  end = (src - 1) + w - 1 ;
  while (src < end) {
    *pgrad_x = 0.5 * (src[+xo] - src[-xo]) ;
    pgrad_x += gradWidthStride;
    *pgrad_y =        src[+yo] - src[0] ;
    pgrad_y += gradWidthStride;
    src++;
  }

  /* last pixel of the first row */
  *pgrad_x = src[0]   - src[-xo] ;
  pgrad_x += gradWidthStride;
  *pgrad_y = src[+yo] - src[0] ;
  pgrad_y += gradWidthStride;
  src++;

  xGradient += gradHeightStride;
  pgrad_x = xGradient;
  yGradient += gradHeightStride;
  pgrad_y = yGradient;
  image += yo;
  src = image;

  for (y = 1 ; y < h -1 ; ++y) {

    /* first pixel of the middle rows */
    *pgrad_x =        src[+xo] - src[0] ;
    pgrad_x += gradWidthStride;
    *pgrad_y = 0.5 * (src[+yo] - src[-yo]) ;
    pgrad_y += gradWidthStride;
    src++;

    /* middle pixels of the middle rows */
    end = (src - 1) + w - 1 ;
    while (src < end) {
      *pgrad_x = 0.5 * (src[+xo] - src[-xo]) ;
      pgrad_x += gradWidthStride;
      *pgrad_y = 0.5 * (src[+yo] - src[-yo]) ;
      pgrad_y += gradWidthStride;
      src++;
    }

    /* last pixel of the middle row */
    *pgrad_x =        src[0]   - src[-xo] ;
    pgrad_x += gradWidthStride;
    *pgrad_y = 0.5 * (src[+yo] - src[-yo]) ;
    pgrad_y += gradWidthStride;
    src++;

    xGradient += gradHeightStride;
    pgrad_x = xGradient;
    yGradient += gradHeightStride;
    pgrad_y = yGradient;
    image += yo;
    src = image;
  }

  /* first pixel of the last row */
  *pgrad_x = src[+xo] - src[0] ;
  pgrad_x += gradWidthStride;
  *pgrad_y = src[  0] - src[-yo] ;
  pgrad_y += gradWidthStride;
  src++;

  /* middle pixels of the last row */
  end = (src - 1) + w - 1 ;
  while (src < end) {
    *pgrad_x = 0.5 * (src[+xo] - src[-xo]) ;
    pgrad_x += gradWidthStride;
    *pgrad_y =        src[0]   - src[-yo] ;
    pgrad_y += gradWidthStride;
    src++;
  }

  /* last pixel of the last row */
  *pgrad_x = src[0]   - src[-xo] ;
  *pgrad_y = src[0]   - src[-yo] ;
}

// Assembly:
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rax
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq %rdx, -0x18(%rsp)
movq %rcx, -0x20(%rsp)
movq %r8, -0x28(%rsp)
movq %r9, -0x30(%rsp)
movq $0x1, -0x38(%rsp)
movq 0x10(%rsp), %rax
movq %rax, -0x40(%rsp)
movq -0x30(%rsp), %rax
movq %rax, -0x48(%rsp)
movq 0x8(%rsp), %rax
movq %rax, -0x50(%rsp)
movq -0x28(%rsp), %rax
movq %rax, -0x58(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x58(%rsp), %rax
movss 0x4(%rax), %xmm0
movq -0x58(%rsp), %rax
subss (%rax), %xmm0
movq -0x68(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x68(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x58(%rsp), %rax
movq -0x40(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x58(%rsp), %rax
subss (%rax), %xmm0
movq -0x70(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x70(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x58(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rsp)
movq -0x58(%rsp), %rax
addq $-0x4, %rax
movq -0x48(%rsp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
addq $-0x4, %rax
movq %rax, -0x60(%rsp)
movq -0x58(%rsp), %rax
cmpq -0x60(%rsp), %rax
jae 0x26bc7
movq -0x58(%rsp), %rax
movss 0x4(%rax), %xmm0
movq -0x58(%rsp), %rax
subss -0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x32524(%rip), %xmm0    # 0x59080
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x68(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x68(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x58(%rsp), %rax
movq -0x40(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x58(%rsp), %rax
subss (%rax), %xmm0
movq -0x70(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x70(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x58(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rsp)
jmp 0x26b2c
movq -0x58(%rsp), %rax
movss (%rax), %xmm0
movq -0x58(%rsp), %rax
subss -0x4(%rax), %xmm0
movq -0x68(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x68(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x58(%rsp), %rax
movq -0x40(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x58(%rsp), %rax
subss (%rax), %xmm0
movq -0x70(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x70(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x58(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rsp)
movq -0x20(%rsp), %rax
shlq $0x2, %rax
addq -0x8(%rsp), %rax
movq %rax, -0x8(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x20(%rsp), %rax
shlq $0x2, %rax
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x40(%rsp), %rax
shlq $0x2, %rax
addq -0x28(%rsp), %rax
movq %rax, -0x28(%rsp)
movq -0x28(%rsp), %rax
movq %rax, -0x58(%rsp)
movq $0x1, -0x78(%rsp)
movq -0x78(%rsp), %rax
movq -0x50(%rsp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x26f08
movq -0x58(%rsp), %rax
movss 0x4(%rax), %xmm0
movq -0x58(%rsp), %rax
subss (%rax), %xmm0
movq -0x68(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x68(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x58(%rsp), %rax
movq -0x40(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x58(%rsp), %rax
xorl %ecx, %ecx
subq -0x40(%rsp), %rcx
subss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x32376(%rip), %xmm0    # 0x59080
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x70(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x70(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x58(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rsp)
movq -0x58(%rsp), %rax
addq $-0x4, %rax
movq -0x48(%rsp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
addq $-0x4, %rax
movq %rax, -0x60(%rsp)
movq -0x58(%rsp), %rax
cmpq -0x60(%rsp), %rax
jae 0x26e11
movq -0x58(%rsp), %rax
movss 0x4(%rax), %xmm0
movq -0x58(%rsp), %rax
subss -0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x322f6(%rip), %xmm0    # 0x59080
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x68(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x68(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x58(%rsp), %rax
movq -0x40(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x58(%rsp), %rax
xorl %ecx, %ecx
subq -0x40(%rsp), %rcx
subss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x322a6(%rip), %xmm0    # 0x59080
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x70(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x70(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x58(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rsp)
jmp 0x26d5a
movq -0x58(%rsp), %rax
movss (%rax), %xmm0
movq -0x58(%rsp), %rax
subss -0x4(%rax), %xmm0
movq -0x68(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x68(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x58(%rsp), %rax
movq -0x40(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x58(%rsp), %rax
xorl %ecx, %ecx
subq -0x40(%rsp), %rcx
subss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x32214(%rip), %xmm0    # 0x59080
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x70(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x70(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x58(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rsp)
movq -0x20(%rsp), %rax
shlq $0x2, %rax
addq -0x8(%rsp), %rax
movq %rax, -0x8(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x20(%rsp), %rax
shlq $0x2, %rax
addq -0x10(%rsp), %rax
movq %rax, -0x10(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x40(%rsp), %rax
shlq $0x2, %rax
addq -0x28(%rsp), %rax
movq %rax, -0x28(%rsp)
movq -0x28(%rsp), %rax
movq %rax, -0x58(%rsp)
movq -0x78(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rsp)
jmp 0x26c98
movq -0x58(%rsp), %rax
movss 0x4(%rax), %xmm0
movq -0x58(%rsp), %rax
subss (%rax), %xmm0
movq -0x68(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x68(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x58(%rsp), %rax
movss (%rax), %xmm0
movq -0x58(%rsp), %rax
xorl %ecx, %ecx
subq -0x40(%rsp), %rcx
subss (%rax,%rcx,4), %xmm0
movq -0x70(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x70(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x58(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rsp)
movq -0x58(%rsp), %rax
addq $-0x4, %rax
movq -0x48(%rsp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
addq $-0x4, %rax
movq %rax, -0x60(%rsp)
movq -0x58(%rsp), %rax
cmpq -0x60(%rsp), %rax
jae 0x27036
movq -0x58(%rsp), %rax
movss 0x4(%rax), %xmm0
movq -0x58(%rsp), %rax
subss -0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x320b7(%rip), %xmm0    # 0x59080
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x68(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x68(%rsp), %rax
movq %rax, -0x68(%rsp)
movq -0x58(%rsp), %rax
movss (%rax), %xmm0
movq -0x58(%rsp), %rax
xorl %ecx, %ecx
subq -0x40(%rsp), %rcx
subss (%rax,%rcx,4), %xmm0
movq -0x70(%rsp), %rax
movss %xmm0, (%rax)
movq -0x18(%rsp), %rax
shlq $0x2, %rax
addq -0x70(%rsp), %rax
movq %rax, -0x70(%rsp)
movq -0x58(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rsp)
jmp 0x26f99
movq -0x58(%rsp), %rax
movss (%rax), %xmm0
movq -0x58(%rsp), %rax
subss -0x4(%rax), %xmm0
movq -0x68(%rsp), %rax
movss %xmm0, (%rax)
movq -0x58(%rsp), %rax
movss (%rax), %xmm0
movq -0x58(%rsp), %rax
xorl %ecx, %ecx
subq -0x40(%rsp), %rcx
subss (%rax,%rcx,4), %xmm0
movq -0x70(%rsp), %rax
movss %xmm0, (%rax)
retq
nopw %cs:(%rax,%rax)