// File: /workspace/github_c_makefile_star2_O2/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 $0x58, %rsp
movq %rsi, 0x10(%rsp)
movslq %r8d, %rsi
imulq %rcx, %r8
movslq %ecx, %rax
xorl %r9d, %r9d
testq %rax, %rax
cmovleq %r9, %rax
movq %rax, 0x40(%rsp)
leaq (,%rcx,4), %rax
testq %rsi, %rsi
cmovleq %r9, %rsi
movq %rsi, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
leaq -0x4(,%rcx,4), %rcx
movq %rcx, 0x50(%rsp)
pushq $0x4
popq %rcx
subq %rax, %rcx
movq %rcx, 0x30(%rsp)
xorl %eax, %eax
cmpq 0x28(%rsp), %rax
je 0x14022
movq %rax, %rcx
imulq 0x20(%rsp), %rcx
movq %rcx, 0x18(%rsp)
xorl %r15d, %r15d
movq %rax, 0x38(%rsp)
cmpq 0x40(%rsp), %r15
je 0x1401a
movq 0x10(%rdi), %r13
movslq %r13d, %rbp
leaq (,%r13,2), %rax
movq %rax, 0x8(%rsp)
testq %rbp, %rbp
movl $0x0, %ecx
cmovleq %rcx, %rbp
leaq (,%r13,2), %rax
addq %r13, %rax
movq %rax, 0x48(%rsp)
xorps %xmm0, %xmm0
xorl %r14d, %r14d
xorps %xmm1, %xmm1
cmpq %rbp, %r14
je 0x13f97
movq 0x30(%rdi), %r10
movq %r10, %rbx
imulq %r10, %rbx
movq %rbx, %r9
imulq %r14, %r9
shlq $0x2, %r9
addq 0x28(%rdi), %r9
movl (%rdi), %ecx
testl %ecx, %ecx
je 0x13ece
cmpl $0x1, %ecx
jne 0x14031
movq %r14, %rcx
imulq %r8, %rcx
movss (%rdx,%rcx,4), %xmm2
movq %r13, %rsi
movq 0x8(%rsp), %rcx
jmp 0x13ef1
movq %r14, %rcx
imulq %r8, %rcx
movss (%rdx,%rcx,4), %xmm2
leaq (%r14,%r13), %rcx
imulq %r8, %rcx
addss (%rdx,%rcx,4), %xmm2
movq 0x8(%rsp), %rsi
movq 0x48(%rsp), %rcx
movq %r10, %r11
movq %r15, %rax
imulq %r15, %r11
movq 0x10(%rsp), %r15
leaq (%r15,%r11,4), %r11
imulq 0x18(%rsp), %rbx
addq %r14, %rsi
imulq %r8, %rsi
addss (%rdx,%rsi,4), %xmm2
addq %r14, %rcx
imulq %r8, %rcx
addss (%rdx,%rcx,4), %xmm2
leaq (%r11,%rbx,4), %rbx
movslq %r10d, %rcx
testq %rcx, %rcx
movl $0x0, %r11d
cmovgq %rcx, %r11
imulq 0x50(%rsp), %r10
xorl %esi, %esi
cmpq %r11, %rsi
je 0x13f7b
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpq %r12, %rcx
je 0x13f6d
movss (%r9,%r12,4), %xmm3
mulss %xmm2, %xmm3
addss (%rbx,%r12,4), %xmm3
movss %xmm3, (%rbx,%r12,4)
incq %r12
addq $-0x4, %r15
jmp 0x13f49
addq %r10, %rbx
subq %r15, %rbx
incq %rsi
subq %r15, %r9
jmp 0x13f3e
movaps %xmm2, %xmm3
maxss %xmm1, %xmm3
minss %xmm0, %xmm2
incq %r14
movaps %xmm2, %xmm0
movaps %xmm3, %xmm1
movq %rax, %r15
jmp 0x13e86
movq 0x30(%rdi), %rax
movq %rax, %rcx
imulq %r15, %rcx
movq 0x10(%rsp), %rsi
leaq (%rsi,%rcx,4), %rcx
movq 0x18(%rsp), %rsi
imulq %rax, %rsi
imulq %rax, %rsi
leaq (%rcx,%rsi,4), %rcx
movslq %eax, %rsi
testq %rsi, %rsi
movl $0x0, %r9d
cmovgq %rsi, %r9
imulq 0x30(%rsp), %rax
xorl %r10d, %r10d
cmpq %r9, %r10
je 0x14009
movq %rax, %r11
xorl %ebx, %ebx
cmpq %rbx, %rsi
je 0x14001
movaps %xmm1, %xmm2
minss (%rcx,%rbx,4), %xmm2
movaps %xmm0, %xmm3
maxss %xmm2, %xmm3
movss %xmm3, (%rcx,%rbx,4)
incq %rbx
addq $-0x4, %r11
jmp 0x13fdf
subq %r11, %rcx
incq %r10
jmp 0x13fd5
addq $0x4, %rdx
incq %r15
movq 0x38(%rsp), %rax
jmp 0x13e42
incq %rax
jmp 0x13e21
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x90b0