// File: /workspace/github_c_makefile_star2_O3/zpole[P]IICV/vl/imopv.c
// Function: vl_imconvcol_vf
VL_EXPORT void
VL_XCAT(vl_imconvcol_v, SFX)
(T* dst, vl_size dst_stride,
 T const* src,
 vl_size src_width, vl_size src_height, vl_size src_stride,
 T const* filt, vl_index filt_begin, vl_index filt_end,
 int step, unsigned int flags)
{
  vl_index x = 0 ;
  vl_index y ;
  vl_index dheight = (src_height - 1) / step + 1 ;
  vl_bool transp = flags & VL_TRANSPOSE ;
  vl_bool zeropad = (flags & VL_PAD_MASK) == VL_PAD_BY_ZERO ;

  /* dispatch to accelerated version */
#ifndef VL_DISABLE_SSE2
  if (vl_cpu_has_sse2() && vl_get_simd_enabled()) {
    VL_XCAT3(_vl_imconvcol_v,SFX,_sse2)
    (dst,dst_stride,
     src,src_width,src_height,src_stride,
     filt,filt_begin,filt_end,
     step,flags) ;
    return ;
  }
#endif

  /* let filt point to the last sample of the filter */
  filt += filt_end - filt_begin ;

  while (x < (signed)src_width) {
    /* Calculate dest[x,y] = sum_p image[x,p] filt[y - p]
     * where supp(filt) = [filt_begin, filt_end] = [fb,fe].
     *
     * CHUNK_A: y - fe <= p < 0
     *          completes VL_MAX(fe - y, 0) samples
     * CHUNK_B: VL_MAX(y - fe, 0) <= p < VL_MIN(y - fb, height - 1)
     *          completes fe - VL_MAX(fb, height - y) + 1 samples
     * CHUNK_C: completes all samples
     */
    T const *filti ;
    vl_index stop ;

    for (y = 0 ; y < (signed)src_height ; y += step) {
      T acc = 0 ;
      T v = 0, c ;
      T const* srci ;

      filti = filt ;
      stop = filt_end - y ;
      srci = src + x - stop * src_stride ;

      if (stop > 0) {
        if (zeropad) {
          v = 0 ;
        } else {
          v = *(src + x) ;
        }
        while (filti > filt - stop) {
          c = *filti-- ;
          acc += v * c ;
          srci += src_stride ;
        }
      }

      stop = filt_end - VL_MAX(filt_begin, y - (signed)src_height + 1) + 1 ;
      while (filti > filt - stop) {
        v = *srci ;
        c = *filti-- ;
        acc += v * c ;
        srci += src_stride ;
      }

      if (zeropad) v = 0 ;

      stop = filt_end - filt_begin + 1 ;
      while (filti > filt - stop) {
        c = *filti-- ;
        acc += v * c ;
      }

      if (transp) {
        *dst = acc ; dst += 1 ;
      } else {
        *dst = acc ; dst += dst_stride ;
      }
    } /* next y */
    if (transp) {
      dst += 1 * dst_stride - dheight * 1 ;
    } else {
      dst += 1 * 1 - dheight * dst_stride ;
    }
    x += 1 ;
  } /* next x */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x10(%rsp)
movq %r8, %r15
movq %rcx, (%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdi, %r12
movl 0xb0(%rsp), %r14d
movq 0xa0(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x98(%rsp), %rbp
movq 0x90(%rsp), %rbx
leaq -0x1(%r8), %rax
movslq 0xa8(%rsp), %rcx
xorl %edx, %edx
movq %rcx, 0x20(%rsp)
divq %rcx
movq %rax, %r13
callq 0x9620
testl %eax, %eax
je 0x1869b
callq 0x9210
testl %eax, %eax
je 0x1869b
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq (%rsp), %rcx
movq %r15, %r8
movq 0x10(%rsp), %r9
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9a00
movslq (%rsp), %rax
movq %rax, 0x38(%rsp)
testq %rax, %rax
jle 0x18887
incq %r13
movq 0x28(%rsp), %rdi
movq %rdi, %rax
subq %rbp, %rax
leaq (%rbx,%rax,4), %r8
shlq $0x2, %rax
movq %rax, (%rsp)
movslq %r15d, %rsi
movq %rdi, %rax
notq %rax
movq 0x18(%rsp), %rdx
movq %rdx, %rcx
subq %r13, %rcx
imulq %rdx, %r13
movl $0x1, %edx
subq %r13, %rdx
testb $0x4, %r14b
cmovneq %rcx, %rdx
movq %rdx, 0x30(%rsp)
movq %r8, 0x50(%rsp)
leaq (%r8,%rax,4), %r8
movq %rdi, %rax
movq 0x10(%rsp), %rcx
imulq %rcx, %rax
shlq $0x2, %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
movq %rcx, %r10
imulq 0x20(%rsp), %r10
shlq $0x2, %r10
leaq (,%rcx,4), %r11
xorl %ecx, %ecx
testq %rsi, %rsi
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
jle 0x1885f
movq 0x8(%rsp), %rax
leaq (%rax,%rcx,4), %r9
xorl %edi, %edi
movq 0x28(%rsp), %rcx
subq %rdi, %rcx
testq %rcx, %rcx
jle 0x1879f
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
testb $0x3, %r14b
je 0x18768
movss (%r9), %xmm1
shlq $0x2, %rcx
movq 0x50(%rsp), %r15
subq %rcx, %r15
movq %rdx, %rax
movq (%rsp), %rcx
leaq (%rbx,%rcx), %r13
addq $-0x4, %r13
addq $-0x4, %rcx
movss 0x4(%r13), %xmm2
mulss %xmm1, %xmm2
addss %xmm2, %xmm0
addq %r11, %rax
cmpq %r15, %r13
ja 0x1877b
jmp 0x187b9
imulq 0x10(%rsp), %rcx
shlq $0x2, %rcx
movq %r9, %rax
subq %rcx, %rax
xorps %xmm0, %xmm0
movq (%rsp), %rcx
xorps %xmm1, %xmm1
movq %rdi, %r15
subq %rsi, %r15
incq %r15
cmpq %rbp, %r15
cmovleq %rbp, %r15
leaq (%r8,%r15,4), %r15
leaq (%rbx,%rcx), %r13
cmpq %r15, %r13
jbe 0x187f9
movss (%rax), %xmm1
leaq (%rbx,%rcx), %r13
addq $-0x4, %r13
addq $-0x4, %rcx
movss 0x4(%r13), %xmm2
mulss %xmm1, %xmm2
addss %xmm2, %xmm0
addq %r11, %rax
jmp 0x187d1
xorps %xmm2, %xmm2
testb $0x3, %r14b
je 0x18805
movaps %xmm1, %xmm2
cmpq $-0x3, %rcx
jl 0x18826
addq $0x4, %rcx
movss -0x4(%rbx,%rcx), %xmm1
mulss %xmm2, %xmm1
addss %xmm1, %xmm0
addq $-0x4, %rcx
testq %rcx, %rcx
jg 0x1880f
movq 0x18(%rsp), %rax
leaq (,%rax,4), %rax
testb $0x4, %r14b
movl $0x4, %ecx
cmovneq %rcx, %rax
addq %r12, %rax
movss %xmm0, (%r12)
addq 0x20(%rsp), %rdi
addq %r10, %rdx
movq %rax, %r12
cmpq %rsi, %rdi
jl 0x1874a
jmp 0x18862
movq %r12, %rax
movq 0x30(%rsp), %rcx
leaq (%rax,%rcx,4), %r12
movq 0x40(%rsp), %rcx
incq %rcx
movq 0x48(%rsp), %rdx
addq $0x4, %rdx
cmpq 0x38(%rsp), %rcx
jne 0x1872c
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq