// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/imopv.c
// Function: vl_imconvcoltri_f
VL_EXPORT void
VL_XCAT(vl_imconvcoltri_, SFX)
(T * dest, vl_size destStride,
 T const * image,
 vl_size imageWidth, vl_size imageHeight, vl_size imageStride,
 vl_size filterSize,
 vl_size step, unsigned int flags)
{
  vl_index x, y, dheight ;
  vl_bool transp = flags & VL_TRANSPOSE ;
  vl_bool zeropad = (flags & VL_PAD_MASK) == VL_PAD_BY_ZERO ;
  T scale = (T) (1.0 / ((double)filterSize * (double)filterSize)) ;
  T * buffer = vl_malloc (sizeof(T) * (imageHeight + filterSize)) ;
  buffer += filterSize ;

  if (imageHeight == 0) {
    return  ;
  }

  x = 0 ;
  dheight = (imageHeight - 1) / step + 1 ;

  while (x < (signed)imageWidth) {
    T const * imagei ;
    imagei = image + x + imageStride * (imageHeight - 1) ;

    /* We decompose the convolution by a triangluar signal as the convolution
     * by two rectangular signals. The rectangular convolutions are computed
     * quickly by computing the integral signals. Each rectangular convolution
     * introduces a delay, which is compensated by convolving each in opposite
     * directions.
     */

    /* integrate backward the column */
    buffer[imageHeight - 1] = *imagei ;
    for (y = (signed)imageHeight - 2 ; y >=  0 ; --y) {
      imagei -= imageStride ;
      buffer[y] = buffer[y + 1] + *imagei ;
    }
    if (zeropad) {
      for ( ; y >= - (signed)filterSize ; --y) {
        buffer[y] = buffer[y + 1] ;
      }
    } else {
      for ( ; y >= - (signed)filterSize ; --y) {
        buffer[y] = buffer[y + 1] + *imagei ;
      }
    }

    /* compute the filter forward */
    for (y = - (signed)filterSize ;
         y < (signed)imageHeight - (signed)filterSize ; ++y) {
      buffer[y] = buffer[y] - buffer[y + filterSize] ;
    }
    if (! zeropad) {
      for (y = (signed)imageHeight - (signed)filterSize ;
           y < (signed)imageHeight ;
           ++y) {
        buffer[y] = buffer[y] - buffer[imageHeight - 1]  *
        ((signed)imageHeight - (signed)filterSize - y) ;
      }
    }

    /* integrate forward the column */
    for (y = - (signed)filterSize + 1 ;
         y < (signed)imageHeight ; ++y) {
      buffer[y] += buffer[y - 1] ;
    }

    /* compute the filter backward */
    {
      vl_size stride = transp ? 1 : destStride ;
      dest += dheight * stride ;
      for (y = step * (dheight - 1) ; y >= 0 ; y -= step) {
        dest -= stride ;
        *dest = scale * (buffer[y] - buffer[y - (signed)filterSize]) ;
      }
      dest += transp ? destStride : 1 ;
    }
    x += 1 ;
  } /* next x */
  vl_free (buffer - filterSize) ;
}

// Assembly:
subq $0x88, %rsp
movl 0xa0(%rsp), %eax
movq 0x98(%rsp), %rax
movq 0x90(%rsp), %rax
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movq %rcx, 0x68(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x58(%rsp)
movl 0xa0(%rsp), %eax
andl $0x4, %eax
movl %eax, 0x3c(%rsp)
movl 0xa0(%rsp), %eax
testb $0x3, %al
sete %al
movzbl %al, %eax
movl %eax, 0x38(%rsp)
movaps 0x32fa9(%rip), %xmm1    # 0x59160
movq 0x90(%rsp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x32fa4(%rip), %xmm1    # 0x59170
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movaps %xmm0, %xmm1
mulsd %xmm0, %xmm1
movsd 0x32eee(%rip), %xmm0    # 0x590d8
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x34(%rsp)
movq 0x60(%rsp), %rdi
addq 0x90(%rsp), %rdi
shlq $0x2, %rdi
callq 0x9660
movq %rax, 0x28(%rsp)
movq 0x90(%rsp), %rax
shlq $0x2, %rax
addq 0x28(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x60(%rsp)
jne 0x26236
jmp 0x2669f
movq $0x0, 0x50(%rsp)
movq 0x60(%rsp), %rax
subq $0x1, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x98(%rsp)
addq $0x1, %rax
movq %rax, 0x40(%rsp)
movq 0x50(%rsp), %rax
movq 0x68(%rsp), %rcx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0x26684
movq 0x70(%rsp), %rax
movq 0x50(%rsp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq 0x58(%rsp), %rcx
movq 0x60(%rsp), %rdx
subq $0x1, %rdx
imulq %rdx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movss (%rax), %xmm0
movq 0x28(%rsp), %rax
movq 0x60(%rsp), %rcx
subq $0x1, %rcx
movss %xmm0, (%rax,%rcx,4)
movq 0x60(%rsp), %rax
subl $0x2, %eax
cltq
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jl 0x26328
movq 0x58(%rsp), %rdx
movq 0x20(%rsp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss 0x4(%rax,%rcx,4), %xmm0
movq 0x20(%rsp), %rax
addss (%rax), %xmm0
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq 0x48(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x262cd
cmpl $0x0, 0x38(%rsp)
je 0x2637d
jmp 0x26331
movq 0x48(%rsp), %rax
movq 0x90(%rsp), %rcx
movl %ecx, %edx
xorl %ecx, %ecx
subl %edx, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jl 0x2637b
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss 0x4(%rax,%rcx,4), %xmm0
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq 0x48(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x26331
jmp 0x263d4
jmp 0x2637f
movq 0x48(%rsp), %rax
movq 0x90(%rsp), %rcx
movl %ecx, %edx
xorl %ecx, %ecx
subl %edx, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jl 0x263d2
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss 0x4(%rax,%rcx,4), %xmm0
movq 0x20(%rsp), %rax
addss (%rax), %xmm0
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq 0x48(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x2637f
jmp 0x263d4
movq 0x90(%rsp), %rax
movl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
cltq
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x60(%rsp), %rcx
movq 0x90(%rsp), %rdx
subl %edx, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0x2644a
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
addq 0x90(%rsp), %rcx
subss (%rax,%rcx,4), %xmm0
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x263e9
cmpl $0x0, 0x38(%rsp)
jne 0x264f3
movq 0x60(%rsp), %rax
movq 0x90(%rsp), %rcx
subl %ecx, %eax
cltq
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x60(%rsp), %rcx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0x264f1
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
movq 0x28(%rsp), %rax
movq 0x60(%rsp), %rcx
subq $0x1, %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x60(%rsp), %rax
movq 0x90(%rsp), %rcx
subl %ecx, %eax
cltq
subq 0x48(%rsp), %rax
cvtsi2ss %rax, %xmm2
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x2646b
jmp 0x264f3
movq 0x90(%rsp), %rax
movl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
addl $0x1, %eax
cltq
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x60(%rsp), %rcx
movslq %ecx, %rcx
cmpq %rcx, %rax
jge 0x26554
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
subq $0x1, %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
addss (%rax,%rcx,4), %xmm0
movss %xmm0, (%rax,%rcx,4)
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x2650b
cmpl $0x0, 0x3c(%rsp)
je 0x26567
movl $0x1, %eax
movq %rax, 0x10(%rsp)
jmp 0x26571
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rax
imulq 0x18(%rsp), %rax
shlq $0x2, %rax
addq 0x80(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x98(%rsp), %rax
movq 0x40(%rsp), %rcx
subq $0x1, %rcx
imulq %rcx, %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jl 0x26639
movq 0x18(%rsp), %rdx
movq 0x80(%rsp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x80(%rsp)
movss 0x34(%rsp), %xmm0
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movss (%rax,%rcx,4), %xmm1
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
movq 0x90(%rsp), %rdx
movslq %edx, %rdx
subq %rdx, %rcx
subss (%rax,%rcx,4), %xmm1
mulss %xmm1, %xmm0
movq 0x80(%rsp), %rax
movss %xmm0, (%rax)
movq 0x98(%rsp), %rcx
movq 0x48(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x48(%rsp)
jmp 0x265b4
cmpl $0x0, 0x3c(%rsp)
je 0x2664c
movq 0x78(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x26658
movl $0x1, %eax
movq %rax, 0x8(%rsp)
jmp 0x26658
movq 0x8(%rsp), %rax
shlq $0x2, %rax
addq 0x80(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x2625d
movq 0x28(%rsp), %rdi
xorl %eax, %eax
subq 0x90(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x9620
addq $0x88, %rsp
retq
nopw (%rax,%rax)