// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %rsp
movq %rcx, 0x8(%rsp)
movq %rsi, 0x18(%rsp)
movslq %r8d, %rax
movq %rax, 0x30(%rsp)
testq %rax, %rax
jle 0x15657
movq %rdi, %r11
movq 0x8(%rsp), %rcx
imulq %rcx, %r8
movslq %ecx, %rax
movq %rax, 0x10(%rsp)
leaq (,%rcx,4), %rax
leaq -0x4(,%rcx,4), %rcx
movq %rcx, 0x38(%rsp)
movl $0x4, %ecx
subq %rax, %rcx
movq %rcx, 0x40(%rsp)
movq $0x0, (%rsp)
movq %rdi, 0x48(%rsp)
cmpq $0x0, 0x10(%rsp)
jle 0x15641
movq 0x10(%r11), %rcx
movslq %ecx, %r15
movq (%rsp), %rax
imulq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq (%rcx,%rcx), %rax
movq %rax, 0x28(%rsp)
movq %rcx, 0x60(%rsp)
leaq (%rcx,%rcx,2), %rax
movq %rax, 0x58(%rsp)
xorl %r14d, %r14d
testq %r15, %r15
movq %r14, 0x50(%rsp)
jle 0x155b7
movl (%r11), %ecx
cmpl $0x1, %ecx
ja 0x15666
movq 0x28(%r11), %rbx
movq 0x30(%r11), %r10
movq %r10, %r11
imulq %r10, %r11
movq %r10, %rax
imulq %r14, %rax
movq 0x18(%rsp), %rsi
leaq (%rsi,%rax,4), %rax
movq 0x20(%rsp), %rsi
imulq %r11, %rsi
leaq (%rax,%rsi,4), %rdi
movslq %r10d, %r12
imulq 0x38(%rsp), %r10
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
xorl %esi, %esi
movq %rsi, %rax
imulq %r8, %rax
movq 0x60(%rsp), %r9
addq %rsi, %r9
imulq %r8, %r9
movss (%rdx,%rax,4), %xmm0
addss (%rdx,%r9,4), %xmm0
cmpl $0x1, %ecx
jne 0x15528
movq 0x28(%rsp), %rax
jmp 0x1553e
movq 0x28(%rsp), %rax
addq %rsi, %rax
imulq %r8, %rax
addss (%rdx,%rax,4), %xmm0
movq 0x58(%rsp), %rax
addq %rsi, %rax
imulq %r8, %rax
addss (%rdx,%rax,4), %xmm0
testq %r12, %r12
jle 0x15598
movq %r11, %rax
imulq %rsi, %rax
leaq (%rbx,%rax,4), %rax
movq %rdi, %r9
xorl %ebp, %ebp
xorl %r14d, %r14d
xorl %r13d, %r13d
movss (%rax,%r13,4), %xmm3
mulss %xmm0, %xmm3
addss (%r9,%r13,4), %xmm3
movss %xmm3, (%r9,%r13,4)
incq %r13
addq $-0x4, %r14
cmpq %r13, %r12
jne 0x15565
addq %r10, %r9
subq %r14, %r9
incq %rbp
subq %r14, %rax
cmpq %r12, %rbp
jne 0x1555f
movaps %xmm0, %xmm3
maxss %xmm1, %xmm3
minss %xmm2, %xmm0
incq %rsi
movaps %xmm3, %xmm1
movaps %xmm0, %xmm2
cmpq %r15, %rsi
jne 0x154fe
jmp 0x155bd
xorps %xmm0, %xmm0
xorps %xmm3, %xmm3
movq 0x48(%rsp), %r11
movq 0x30(%r11), %rcx
movslq %ecx, %rsi
testq %rsi, %rsi
movq 0x50(%rsp), %r14
jle 0x1562f
movq %rcx, %rax
imulq %r14, %rax
movq 0x18(%rsp), %rdi
leaq (%rdi,%rax,4), %rax
movq 0x20(%rsp), %rdi
imulq %rcx, %rdi
imulq %rcx, %rdi
leaq (%rax,%rdi,4), %rax
imulq 0x40(%rsp), %rcx
xorl %edi, %edi
movq %rcx, %r9
xorl %r10d, %r10d
movaps %xmm3, %xmm1
minss (%rax,%r10,4), %xmm1
movaps %xmm0, %xmm2
maxss %xmm1, %xmm2
movss %xmm2, (%rax,%r10,4)
incq %r10
addq $-0x4, %r9
cmpq %r10, %rsi
jne 0x15602
subq %r9, %rax
incq %rdi
cmpq %rsi, %rdi
jne 0x155fc
addq $0x4, %rdx
incq %r14
cmpq 0x10(%rsp), %r14
jne 0x154a7
movq (%rsp), %rcx
incq %rcx
movq %rcx, (%rsp)
cmpq 0x30(%rsp), %rcx
jne 0x1546b
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x90b0