// File: /workspace/github_c_makefile_star2_O3/zpole[P]IICV/vl/hog.c
// Function: vl_hog_render
void
vl_hog_render (VlHog const * self,
               float * image,
               float const * descriptor,
               vl_size width,
               vl_size height)
{
  vl_index x, y, k, cx, cy ;
  vl_size hogStride = width * height ;

  assert(self) ;
  assert(image) ;
  assert(descriptor) ;
  assert(width > 0) ;
  assert(height > 0) ;

  for (y = 0 ; y < (signed)height ; ++y) {
    for (x = 0 ; x < (signed)width ; ++x) {
      float minWeight = 0 ;
      float maxWeight = 0 ;

      for (k = 0 ; k < (signed)self->numOrientations ; ++k) {
        float weight ;
        float const * glyph = self->glyphs + k * (self->glyphSize*self->glyphSize) ;
        float * glyphImage = image + self->glyphSize * x + y * width * (self->glyphSize*self->glyphSize) ;

        switch (self->variant) {
          case VlHogVariantUoctti:
            weight =
            descriptor[k * hogStride] +
            descriptor[(k + self->numOrientations) * hogStride] +
            descriptor[(k + 2 * self->numOrientations) * hogStride] ;
            break ;
          case VlHogVariantDalalTriggs:
            weight =
            descriptor[k * hogStride] +
            descriptor[(k + self->numOrientations) * hogStride] +
            descriptor[(k + 2 * self->numOrientations) * hogStride] +
            descriptor[(k + 3 * self->numOrientations) * hogStride] ;
            break ;
          default:
            abort() ;
        }
        maxWeight = VL_MAX(weight, maxWeight) ;
        minWeight = VL_MIN(weight, minWeight);

        for (cy = 0 ; cy < (signed)self->glyphSize ; ++cy) {
          for (cx = 0 ; cx < (signed)self->glyphSize ; ++cx) {
            *glyphImage++ += weight * (*glyph++) ;
          }
          glyphImage += (width - 1) * self->glyphSize  ;
        }
      } /* next orientation */

      {
        float * glyphImage = image + self->glyphSize * x + y * width * (self->glyphSize*self->glyphSize) ;
        for (cy = 0 ; cy < (signed)self->glyphSize ; ++cy) {
          for (cx = 0 ; cx < (signed)self->glyphSize ; ++cx) {
            float value = *glyphImage ;
            *glyphImage++ = VL_MAX(minWeight, VL_MIN(maxWeight, value)) ;
          }
          glyphImage += (width - 1) * self->glyphSize  ;
        }
      }

      ++ descriptor ;
    } /* next column of cells (x) */
  } /* next row of cells (y) */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, (%rsp)
movq %rsi, 0x30(%rsp)
movslq %r8d, %rax
movq %rax, 0x38(%rsp)
testq %rax, %rax
jle 0x155fa
movq (%rsp), %rcx
imulq %rcx, %r8
movslq %ecx, %rax
movq %rax, 0x8(%rsp)
leaq (,%rcx,4), %rax
leaq -0x4(,%rcx,4), %rcx
movq %rcx, 0x28(%rsp)
movl $0x4, %ecx
subq %rax, %rcx
movq %rcx, 0x20(%rsp)
xorl %eax, %eax
movq %rdi, 0x48(%rsp)
cmpq $0x0, 0x8(%rsp)
movq %rax, 0x40(%rsp)
jle 0x155e7
movq 0x10(%rdi), %rcx
movq 0x30(%rdi), %rsi
movslq %ecx, %r12
imulq (%rsp), %rax
leaq (%rcx,%rcx), %r9
movq %r9, 0x68(%rsp)
movq %rcx, 0x70(%rsp)
leaq (%rcx,%rcx,2), %rcx
movq %rcx, 0x58(%rsp)
movslq %esi, %r10
movq %rsi, %rcx
imulq %rsi, %rcx
movq %rcx, 0x60(%rsp)
imulq %rcx, %rax
movq 0x30(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rax
imulq %rsi, %rax
movq 0x20(%rsp), %rcx
movq %rsi, 0x18(%rsp)
imulq %rsi, %rcx
xorl %ebx, %ebx
testq %r12, %r12
movq %rbx, 0x50(%rsp)
jle 0x15579
movl (%rdi), %r9d
cmpl $0x1, %r9d
ja 0x15609
movq 0x28(%rdi), %r11
movq 0x18(%rsp), %rsi
imulq %rbx, %rsi
movq 0x10(%rsp), %rdi
leaq (%rdi,%rsi,4), %rbp
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
xorl %esi, %esi
movq %rsi, %rdi
imulq %r8, %rdi
movq 0x70(%rsp), %rbx
addq %rsi, %rbx
imulq %r8, %rbx
movq 0x68(%rsp), %r14
addq %rsi, %r14
movss (%rdx,%rdi,4), %xmm0
addss (%rdx,%rbx,4), %xmm0
imulq %r8, %r14
addss (%rdx,%r14,4), %xmm0
cmpl $0x1, %r9d
je 0x15509
movq 0x58(%rsp), %rdi
addq %rsi, %rdi
imulq %r8, %rdi
addss (%rdx,%rdi,4), %xmm0
testq %r10, %r10
jle 0x1555a
movq 0x60(%rsp), %rdi
imulq %rsi, %rdi
leaq (%r11,%rdi,4), %rbx
movq %rbp, %rdi
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %r13d, %r13d
movss (%rbx,%r13,4), %xmm3
mulss %xmm0, %xmm3
addss (%rdi,%r13,4), %xmm3
movss %xmm3, (%rdi,%r13,4)
incq %r13
addq $-0x4, %r14
cmpq %r13, %r10
jne 0x15527
addq %rax, %rdi
subq %r14, %rdi
incq %r15
subq %r14, %rbx
cmpq %r10, %r15
jne 0x15521
movaps %xmm0, %xmm3
maxss %xmm1, %xmm3
minss %xmm2, %xmm0
incq %rsi
movaps %xmm3, %xmm1
movaps %xmm0, %xmm2
cmpq %r12, %rsi
jne 0x154c3
jmp 0x1557f
xorps %xmm0, %xmm0
xorps %xmm3, %xmm3
testq %r10, %r10
movq 0x50(%rsp), %rbx
jle 0x155d0
movq 0x18(%rsp), %rsi
imulq %rbx, %rsi
movq 0x10(%rsp), %rdi
leaq (%rdi,%rsi,4), %rsi
xorl %edi, %edi
movq %rcx, %r9
xorl %r11d, %r11d
movaps %xmm3, %xmm1
minss (%rsi,%r11,4), %xmm1
movaps %xmm0, %xmm2
maxss %xmm1, %xmm2
movss %xmm2, (%rsi,%r11,4)
incq %r11
addq $-0x4, %r9
cmpq %r11, %r10
jne 0x155a3
subq %r9, %rsi
incq %rdi
cmpq %r10, %rdi
jne 0x1559d
addq $0x4, %rdx
incq %rbx
cmpq 0x8(%rsp), %rbx
movq 0x48(%rsp), %rdi
jne 0x1548a
movq 0x40(%rsp), %rax
incq %rax
cmpq 0x38(%rsp), %rax
jne 0x15418
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x90b0