// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/covdet.c
// Function: vl_covdet_extract_patch_helper
vl_bool
vl_covdet_extract_patch_helper (VlCovDet * self,
                                double * sigma1,
                                double * sigma2,
                                float * patch,
                                vl_size resolution,
                                double extent,
                                double sigma,
                                double A_ [4],
                                double T_ [2],
                                double d1, double d2)
{
  vl_index o, s ;
  double factor ;
  double sigma_ ;
  float const * level ;
  vl_size width, height ;
  double step ;

  double A [4] = {A_[0], A_[1], A_[2], A_[3]} ;
  double T [2] = {T_[0], T_[1]} ;

  VlScaleSpaceGeometry geom = vl_scalespace_get_geometry(self->gss) ;
  VlScaleSpaceOctaveGeometry oct ;

  /* Starting from a pre-smoothed image at scale sigma_
     because of the mapping A the resulting smoothing in
     the warped patch is S, where

        sigma_^2 I = A S A',

        S = sigma_^2 inv(A) inv(A)' = sigma_^2 V D^-2 V',

        A = U D V'.

     Thus we rotate A by V to obtain an axis-aligned smoothing:

        A = U*D,

        S = sigma_^2 D^-2.

     Then we search the scale-space for the best sigma_ such
     that the target smoothing is approximated from below:

        max sigma_(o,s) :    simga_(o,s) factor <= sigma,
        factor = max{abs(D11), abs(D22)}.
   */


  /*
   Determine the best level (o,s) such that sigma_(o,s) factor <= sigma.
   This can be obtained by scanning octaves from smallest to largest
   and stopping when no level in the octave satisfies the relation.

   Given the range of octave availables, do the best you can.
   */

  factor = 1.0 / VL_MIN(d1, d2) ;

  for (o = geom.firstOctave + 1 ; o <= geom.lastOctave ; ++o) {
    s = vl_floor_d(vl_log2_d(sigma / (factor * geom.baseScale)) - o) ;
    s = VL_MAX(s, geom.octaveFirstSubdivision) ;
    s = VL_MIN(s, geom.octaveLastSubdivision) ;
    sigma_ = geom.baseScale * pow(2.0, o + (double)s / geom.octaveResolution) ;
    /*VL_PRINTF(".. %d D=%g %g; sigma_=%g factor*sigma_=%g\n", o, d1, d2, sigma_, factor* sigma_) ;*/
    if (factor * sigma_ > sigma) {
      o -- ;
      break ;
    }
  }
  o = VL_MIN(o, geom.lastOctave) ;
  s = vl_floor_d(vl_log2_d(sigma / (factor * geom.baseScale)) - o) ;
  s = VL_MAX(s, geom.octaveFirstSubdivision) ;
  s = VL_MIN(s, geom.octaveLastSubdivision) ;
  sigma_ = geom.baseScale * pow(2.0, o + (double)s / geom.octaveResolution) ;
  if (sigma1) *sigma1 = sigma_ / d1 ;
  if (sigma2) *sigma2 = sigma_ / d2 ;

  /*VL_PRINTF("%d %d %g %g %g %g\n", o, s, factor, sigma_, factor * sigma_, sigma) ;*/

  /*
   Now the scale space level to be used for this warping has been
   determined.

   If the patch is partially or completely out of the image boundary,
   create a padded copy of the required region first.
   */

  level = vl_scalespace_get_level(self->gss, o, s) ;
  oct = vl_scalespace_get_octave_geometry(self->gss, o) ;
  width = oct.width ;
  height = oct.height ;
  step = oct.step ;

  A[0] /= step ;
  A[1] /= step ;
  A[2] /= step ;
  A[3] /= step ;
  T[0] /= step ;
  T[1] /= step ;

  {
    /*
     Warp the patch domain [x0hat,y0hat,x1hat,y1hat] to the image domain/
     Obtain a box [x0,y0,x1,y1] enclosing that wrapped box, and then
     an integer vertexes version [x0i, y0i, x1i, y1i], making room
     for one pixel at the boundary to simplify bilinear interpolation
     later on.
     */
    vl_index x0i, y0i, x1i, y1i ;
    double x0 = +VL_INFINITY_D ;
    double x1 = -VL_INFINITY_D ;
    double y0 = +VL_INFINITY_D ;
    double y1 = -VL_INFINITY_D ;
    double boxx [4] = {extent, extent, -extent, -extent} ;
    double boxy [4] = {-extent, extent, extent, -extent} ;
    int i ;
    for (i = 0 ; i < 4 ; ++i) {
      double x = A[0] * boxx[i] + A[2] * boxy[i] + T[0] ;
      double y = A[1] * boxx[i] + A[3] * boxy[i] + T[1] ;
      x0 = VL_MIN(x0, x) ;
      x1 = VL_MAX(x1, x) ;
      y0 = VL_MIN(y0, y) ;
      y1 = VL_MAX(y1, y) ;
    }

    /* Leave one pixel border for bilinear interpolation. */
    x0i = floor(x0) - 1 ;
    y0i = floor(y0) - 1 ;
    x1i = ceil(x1) + 1 ;
    y1i = ceil(y1) + 1 ;

    /*
     If the box [x0i,y0i,x1i,y1i] is not fully contained in the
     image domain, then create a copy of this region by padding
     the image. The image is extended by continuity.
     */

    if (x0i < 0 || x1i > (signed)width-1 ||
        y0i < 0 || y1i > (signed)height-1) {
      vl_index xi, yi ;

      /* compute the amount of l,r,t,b padding needed to complete the patch */
      vl_index padx0 = VL_MAX(0, - x0i) ;
      vl_index pady0 = VL_MAX(0, - y0i) ;
      vl_index padx1 = VL_MAX(0, x1i - ((signed)width - 1)) ;
      vl_index pady1 = VL_MAX(0, y1i - ((signed)height - 1)) ;

      /* make enough room for the patch */
      vl_index patchWidth = x1i - x0i + 1 ;
      vl_index patchHeight = y1i - y0i + 1 ;
      vl_size patchBufferSize = patchWidth * patchHeight * sizeof(float) ;
      if (patchBufferSize > self->patchBufferSize) {
        int err = _vl_resize_buffer((void**)&self->patch, &self->patchBufferSize, patchBufferSize) ;
        if (err) return vl_set_last_error(VL_ERR_ALLOC, NULL) ;
      }

      if (pady0 < patchHeight - pady1) {
        /* start by filling the central horizontal band */
        for (yi = y0i + pady0 ; yi < y0i + patchHeight - pady1 ; ++ yi) {
          float *dst = self->patch + (yi - y0i) * patchWidth ;
          float const *src = level + yi * width + VL_MIN(VL_MAX(0, x0i),(signed)width-1) ;
          for (xi = x0i ; xi < x0i + padx0 ; ++xi) *dst++ = *src ;
          for ( ; xi < x0i + patchWidth - padx1 - 2 ; ++xi) *dst++ = *src++ ;
          for ( ; xi < x0i + patchWidth ; ++xi) *dst++ = *src ;
        }
        /* now extend the central band up and down */
        for (yi = 0 ; yi < pady0 ; ++yi) {
          memcpy(self->patch + yi * patchWidth,
                 self->patch + pady0 * patchWidth,
                 patchWidth * sizeof(float)) ;
        }
        for (yi = patchHeight - pady1 ; yi < patchHeight ; ++yi) {
          memcpy(self->patch + yi * patchWidth,
                 self->patch + (patchHeight - pady1 - 1) * patchWidth,
                 patchWidth * sizeof(float)) ;
        }
      } else {
        /* should be handled better! */
        memset(self->patch, 0, self->patchBufferSize) ;
      }
#if 0
      {
        char name [200] ;
        snprintf(name, 200, "/tmp/%20.0f-ext.pgm", 1e10*vl_get_cpu_time()) ;
        vl_pgm_write_f(name, patch, patchWidth, patchWidth) ;
      }
#endif

      level = self->patch ;
      width = patchWidth ;
      height = patchHeight ;
      T[0] -= x0i ;
      T[1] -= y0i ;
    }
  }

  /*
   Resample by using bilinear interpolation.
   */
  {
    float * pt = patch ;
    double yhat = -extent ;
    vl_index xxi ;
    vl_index yyi ;
    double stephat = extent / resolution ;

    for (yyi = 0 ; yyi < 2 * (signed)resolution + 1 ; ++yyi) {
      double xhat = -extent ;
      double rx = A[2] * yhat + T[0] ;
      double ry = A[3] * yhat + T[1] ;
      for (xxi = 0 ; xxi < 2 * (signed)resolution + 1 ; ++xxi) {
        double x = A[0] * xhat + rx ;
        double y = A[1] * xhat + ry ;
        vl_index xi = vl_floor_d(x) ;
        vl_index yi = vl_floor_d(y) ;
        double i00 = level[yi * width + xi] ;
        double i10 = level[yi * width + xi + 1] ;
        double i01 = level[(yi + 1) * width + xi] ;
        double i11 = level[(yi + 1) * width + xi + 1] ;
        double wx = x - xi ;
        double wy = y - yi ;

        assert(xi >= 0 && xi <= (signed)width - 1) ;
        assert(yi >= 0 && yi <= (signed)height - 1) ;

        *pt++ =
        (1.0 - wy) * ((1.0 - wx) * i00 + wx * i10) +
        wy * ((1.0 - wx) * i01 + wx * i11) ;

        xhat += stephat ;
      }
      yhat += stephat ;
    }
  }
#if 0
    {
      char name [200] ;
      snprintf(name, 200, "/tmp/%20.0f.pgm", 1e10*vl_get_cpu_time()) ;
      vl_pgm_write_f(name, patch, 2*resolution+1, 2*resolution+1) ;
    }
#endif
  return VL_ERR_OK ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movsd %xmm3, 0x30(%rsp)
movsd %xmm2, 0x28(%rsp)
movsd %xmm1, 0x40(%rsp)
movaps %xmm0, 0xa0(%rsp)
movq %r8, 0xb0(%rsp)
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r13
movq 0x1b0(%rsp), %rax
movups (%r9), %xmm0
movaps %xmm0, 0x80(%rsp)
movups 0x10(%r9), %xmm0
movaps %xmm0, 0x70(%rsp)
movups (%rax), %xmm0
movaps %xmm0, 0x60(%rsp)
movq %rdi, 0x8(%rsp)
movq (%rdi), %rsi
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
callq 0x9930
movsd 0x28(%rsp), %xmm0
minsd 0x30(%rsp), %xmm0
movsd 0x20858(%rip), %xmm2    # 0x2d238
divsd %xmm0, %xmm2
movq 0x10(%r14), %r14
movsd %xmm2, 0x50(%rsp)
movq 0x100(%rsp), %rbp
cmpq %rbp, %r14
jge 0xcad9
incq %r14
movsd 0x120(%rsp), %xmm1
mulsd %xmm2, %xmm1
movsd 0x40(%rsp), %xmm0
divsd %xmm1, %xmm0
callq 0x9080
cvtsi2sd %r14, %xmm1
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
cvtsi2sd %rcx, %xmm2
cmpneqpd %xmm0, %xmm2
xorpd %xmm3, %xmm3
cmpnlepd %xmm0, %xmm3
andpd %xmm2, %xmm3
movq %xmm3, %rax
addq %rcx, %rax
movq 0x110(%rsp), %rcx
cmpq %rcx, %rax
jg 0xca5b
movq %rcx, %rax
movq 0x118(%rsp), %rcx
cmpq %rcx, %rax
jl 0xca6b
movq %rcx, %rax
movsd 0x120(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
cvtsi2sd %rax, %xmm0
movsd 0x108(%rsp), %xmm2
unpcklps 0x206d1(%rip), %xmm2    # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x206d9(%rip), %xmm2    # 0x2d170
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
divsd %xmm3, %xmm0
addsd %xmm1, %xmm0
callq 0x9040
mulsd 0x10(%rsp), %xmm0
movsd 0x50(%rsp), %xmm2
mulsd %xmm2, %xmm0
ucomisd 0x40(%rsp), %xmm0
jbe 0xc9ee
movq 0x100(%rsp), %rbp
decq %r14
jmp 0xcadc
incq %r14
cmpq %rbp, %r14
cmovlq %r14, %rbp
mulsd 0x120(%rsp), %xmm2
movsd 0x40(%rsp), %xmm0
divsd %xmm2, %xmm0
callq 0x9080
cvtsi2sd %rbp, %xmm1
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
cvtsi2sd %rax, %xmm2
cmpneqpd %xmm0, %xmm2
xorpd %xmm3, %xmm3
cmpnlepd %xmm0, %xmm3
andpd %xmm2, %xmm3
movq %xmm3, %r14
addq %rax, %r14
movq 0x110(%rsp), %rax
movq 0x118(%rsp), %rcx
cmpq %rax, %r14
cmovleq %rax, %r14
cmpq %rcx, %r14
cmovgeq %rcx, %r14
cvtsi2sd %r14, %xmm0
movsd 0x108(%rsp), %xmm2
unpcklps 0x20605(%rip), %xmm2    # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
movsd 0x120(%rsp), %xmm3
movsd %xmm3, 0x40(%rsp)
subpd 0x205fe(%rip), %xmm2    # 0x2d170
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
divsd %xmm3, %xmm0
addsd %xmm1, %xmm0
callq 0x9040
mulsd 0x40(%rsp), %xmm0
testq %r13, %r13
je 0xcba6
movapd %xmm0, %xmm1
divsd 0x28(%rsp), %xmm1
movsd %xmm1, (%r13)
testq %r12, %r12
je 0xcbb7
divsd 0x30(%rsp), %xmm0
movsd %xmm0, (%r12)
movq 0x8(%rsp), %r13
movq (%r13), %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x9050
movq %rax, %r12
movq (%r13), %rsi
leaq 0x150(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rdx
callq 0x9630
movq (%r14), %rax
movq %rax, 0x98(%rsp)
movq 0x8(%r14), %r13
movsd 0x10(%r14), %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd 0x80(%rsp), %xmm2
divpd %xmm0, %xmm2
movapd 0x70(%rsp), %xmm3
divpd %xmm0, %xmm3
movapd 0x60(%rsp), %xmm4
divpd %xmm0, %xmm4
movdqa 0xa0(%rsp), %xmm1
movq %xmm1, (%r14)
movq %xmm1, 0x8(%r14)
movdqa 0x20465(%rip), %xmm5    # 0x2d0a0
pxor %xmm1, %xmm5
pshufd $0x44, %xmm5, %xmm0     # xmm0 = xmm5[0,1,0,1]
movdqa %xmm0, 0x10(%r14)
movq %xmm5, 0x130(%rsp)
movq %xmm1, 0x138(%rsp)
movq %xmm1, 0x140(%rsp)
movdqa %xmm5, 0x40(%rsp)
movq %xmm5, 0x148(%rsp)
movapd 0x20504(%rip), %xmm5    # 0x2d180
movapd 0x2050c(%rip), %xmm0    # 0x2d190
xorl %eax, %eax
cmpq $0x4, %rax
je 0xccc3
movsd 0x130(%rsp,%rax,8), %xmm6
unpcklpd %xmm6, %xmm6            # xmm6 = xmm6[0,0]
mulpd %xmm3, %xmm6
movsd 0x150(%rsp,%rax,8), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm2, %xmm1
addpd %xmm6, %xmm1
addpd %xmm4, %xmm1
minpd %xmm1, %xmm0
maxpd %xmm1, %xmm5
incq %rax
jmp 0xcc86
movapd %xmm4, 0x60(%rsp)
movapd %xmm3, 0x70(%rsp)
movapd %xmm2, 0x80(%rsp)
movabsq $-0x100000000, %r15     # imm = 0xFFFFFFFF00000000
movapd %xmm5, 0x10(%rsp)
movapd %xmm0, 0x30(%rsp)
callq 0x98f0
movapd %xmm0, 0x50(%rsp)
movapd 0x30(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
callq 0x98f0
movapd 0x50(%rsp), %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
addpd 0x20426(%rip), %xmm2    # 0x2d140
cvttsd2si %xmm2, %r14
movq %r14, %xmm1
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
cvttsd2si %xmm2, %rax
movq %rax, %xmm0
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movdqa %xmm1, 0xd0(%rsp)
movapd 0x10(%rsp), %xmm0
callq 0x9a40
movsd 0x204e6(%rip), %xmm1    # 0x2d238
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rbp
movapd 0x10(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
callq 0x9a40
movq %r15, %rdx
movq %r14, %r8
movsd 0x204bf(%rip), %xmm15   # 0x2d238
addsd %xmm15, %xmm0
cvttsd2si %xmm0, %rax
movq %rax, 0x10(%rsp)
movq 0x98(%rsp), %rax
decl %eax
movslq %eax, %r9
pshufd $0xee, 0xd0(%rsp), %xmm0 # xmm0 = mem[2,3,2,3]
testq %r14, %r14
js 0xcdcc
cmpq %r9, %rbp
jg 0xcdcc
movq %xmm0, %rax
testq %rax, %rax
js 0xcdcc
movq %r13, %rax
shlq $0x20, %rax
addq %rdx, %rax
sarq $0x20, %rax
cmpq 0x10(%rsp), %rax
jge 0xd14e
movq %r8, %rcx
negq %rcx
xorl %eax, %eax
testq %rcx, %rcx
cmovleq %rax, %rcx
movq %rcx, 0x30(%rsp)
movq %xmm0, %rcx
movq %rcx, %r15
negq %r15
testq %r15, %r15
cmovleq %rax, %r15
movq %r13, %rsi
movq %rbp, %r13
subq %r9, %r13
testq %r13, %r13
cmovleq %rax, %r13
shlq $0x20, %rsi
addq %rdx, %rsi
sarq $0x20, %rsi
movq 0x10(%rsp), %rdx
movq %rdx, %rdi
subq %rsi, %rdi
testq %rdi, %rdi
cmovleq %rax, %rdi
movq %rbp, %r14
subq %r8, %r14
incq %r14
movq %rcx, 0x50(%rsp)
subq %rcx, %rdx
movq %rdx, 0x28(%rsp)
leaq 0x1(%rdx), %rcx
movq %rcx, %rdx
imulq %r14, %rdx
shlq $0x2, %rdx
movq 0x8(%rsp), %rax
cmpq 0x70(%rax), %rdx
jbe 0xcec7
leaq 0x70(%rax), %rsi
movq %rdi, 0xb8(%rsp)
leaq 0x68(%rax), %rdi
movq %rcx, 0x90(%rsp)
movq %r8, 0xc8(%rsp)
movq %r9, 0xc0(%rsp)
callq 0xabf9
movq 0xb8(%rsp), %rdi
movq 0xc0(%rsp), %r9
movq 0xc8(%rsp), %r8
movq 0x90(%rsp), %rcx
movsd 0x20393(%rip), %xmm15   # 0x2d238
testl %eax, %eax
je 0xcec7
pushq $0x2
popq %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x9150
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subq %rdi, %rcx
cmpq %rcx, %r15
jge 0xd009
movq %rcx, 0x90(%rsp)
movq 0x10(%rsp), %rax
subq %rdi, %rax
incq %rax
movq %rax, 0x10(%rsp)
xorl %edi, %edi
testq %r8, %r8
cmovgq %r8, %rdi
movq 0x50(%rsp), %rax
addq %r15, %rax
cmpq %r9, %rdi
cmovgeq %r9, %rdi
leaq (%r12,%rdi,4), %rcx
movq 0x30(%rsp), %rsi
addq %r8, %rsi
notq %r13
addq %rbp, %r13
incq %rbp
cmpq %rsi, %r8
cmovgq %r8, %rsi
cmpq %r13, %rsi
movq %r13, %rdx
cmovgq %rsi, %rdx
movq %rsi, 0x30(%rsp)
subq %r8, %rsi
movq 0x98(%rsp), %r9
movq %r9, %r8
imulq %rax, %r8
shlq $0x2, %rdi
leaq (%rdi,%r8,4), %rdi
addq %r12, %rdi
movq %r9, %r12
leaq (,%r9,4), %r8
movapd 0xa0(%rsp), %xmm11
movapd 0x80(%rsp), %xmm12
movapd 0x70(%rsp), %xmm13
movapd 0x60(%rsp), %xmm14
cmpq 0x10(%rsp), %rax
jge 0xd074
movq %rax, %r9
subq 0x50(%rsp), %r9
imulq %r14, %r9
shlq $0x2, %r9
movq 0x8(%rsp), %r10
addq 0x68(%r10), %r9
movq %rax, %r10
imulq %r12, %r10
movq %rsi, %r11
subq $0x1, %r11
jb 0xcfbd
movd (%rcx,%r10,4), %xmm0
movd %xmm0, (%r9)
addq $0x4, %r9
jmp 0xcfa6
xorl %r10d, %r10d
movq 0x30(%rsp), %r11
cmpq %r13, %r11
jge 0xcfdf
movd (%rdi,%r10), %xmm0
movd %xmm0, (%r9,%r10)
incq %r11
addq $0x4, %r10
jmp 0xcfc5
addq %r10, %r9
movq %rdx, %r11
cmpq %rbp, %r11
jge 0xcffe
movd (%rdi,%r10), %xmm0
movd %xmm0, (%r9)
addq $0x4, %r9
incq %r11
jmp 0xcfe5
incq %rax
addq %r8, %rdi
jmp 0xcf78
movq 0x8(%rsp), %rbp
movq 0x68(%rbp), %rdi
movq 0x70(%rbp), %rdx
xorl %esi, %esi
callq 0x9420
movsd 0x20212(%rip), %xmm15   # 0x2d238
movapd 0xa0(%rsp), %xmm11
movapd 0x80(%rsp), %xmm12
movapd 0x70(%rsp), %xmm13
movapd 0x60(%rsp), %xmm14
movq 0x68(%rbp), %r12
movdqa 0xd0(%rsp), %xmm0
movq %xmm0, %rax
cvtsi2sd %rax, %xmm0
cvtsi2sdq 0x50(%rsp), %xmm1
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
subpd %xmm0, %xmm14
jmp 0xd178
movq %r14, %r13
imulq %r15, %r13
leaq (,%r14,4), %r12
xorl %ebp, %ebp
subq $0x1, %r15
jb 0xd0d3
movq 0x8(%rsp), %rax
movq 0x68(%rax), %rdi
leaq (%rdi,%r13,4), %rsi
addq %rbp, %rdi
movq %r12, %rdx
callq 0x95d0
movsd 0x2018c(%rip), %xmm15   # 0x2d238
movapd 0x60(%rsp), %xmm14
movapd 0x70(%rsp), %xmm13
movapd 0x80(%rsp), %xmm12
movapd 0xa0(%rsp), %xmm11
addq %r12, %rbp
jmp 0xd085
movq 0x90(%rsp), %r15
leaq -0x1(%r15), %rcx
imulq %r14, %rcx
movq %rcx, 0x10(%rsp)
movq %r15, %r13
imulq %r14, %r13
shlq $0x2, %r13
movq 0x8(%rsp), %rbp
cmpq 0x28(%rsp), %r15
jg 0xd048
movq 0x68(%rbp), %rdi
movq 0x10(%rsp), %rcx
leaq (%rdi,%rcx,4), %rsi
addq %r13, %rdi
movq %r12, %rdx
callq 0x95d0
movsd 0x20114(%rip), %xmm15   # 0x2d238
movapd 0x60(%rsp), %xmm14
movapd 0x70(%rsp), %xmm13
movapd 0x80(%rsp), %xmm12
movapd 0xa0(%rsp), %xmm11
incq %r15
addq %r12, %r13
jmp 0xd0f8
movq 0x98(%rsp), %r14
movapd 0xa0(%rsp), %xmm11
movapd 0x80(%rsp), %xmm12
movapd 0x70(%rsp), %xmm13
movapd 0x60(%rsp), %xmm14
movq 0xb0(%rsp), %rax
movq %rax, %xmm0
punpckldq 0x1ffd3(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1ffdb(%rip), %xmm0    # 0x2d170
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm11
leal 0x1(,%rax,2), %eax
movslq %eax, %rcx
xorl %eax, %eax
testq %rcx, %rcx
movl $0x0, %edx
cmovgq %rcx, %rdx
movapd 0x40(%rsp), %xmm0
xorl %esi, %esi
cmpq %rdx, %rsi
je 0xceb5
movapd %xmm0, %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
mulpd %xmm13, %xmm1
addpd %xmm14, %xmm1
movq %rcx, %rdi
movapd 0x40(%rsp), %xmm2
subq $0x1, %rdi
jb 0xd2ec
movapd %xmm2, %xmm3
unpcklpd %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
mulpd %xmm12, %xmm3
addpd %xmm1, %xmm3
cvttsd2si %xmm3, %r8
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
cvttsd2si %xmm4, %r9
movq %r8, %xmm6
movq %r9, %xmm5
punpcklqdq %xmm5, %xmm6    # xmm6 = xmm6[0],xmm5[0]
xorpd %xmm7, %xmm7
cvtsi2sd %r8, %xmm5
cvtsi2sd %r9, %xmm8
cmpnlepd %xmm3, %xmm7
unpcklpd %xmm8, %xmm5            # xmm5 = xmm5[0],xmm8[0]
cmpneqpd %xmm3, %xmm5
andpd %xmm7, %xmm5
paddq %xmm6, %xmm5
pshufd $0xee, %xmm5, %xmm6     # xmm6 = xmm5[2,3,2,3]
movq %xmm6, %r8
leaq 0x1(%r8), %r9
cvtsi2sd %r8, %xmm6
imulq %r14, %r8
movq %xmm5, %r10
addq %r10, %r8
cvtss2sd (%r12,%r8,4), %xmm5
cvtss2sd 0x4(%r12,%r8,4), %xmm7
imulq %r14, %r9
addq %r10, %r9
cvtss2sd (%r12,%r9,4), %xmm8
cvtss2sd 0x4(%r12,%r9,4), %xmm9
cvtsi2sd %r10, %xmm10
subsd %xmm10, %xmm3
subsd %xmm6, %xmm4
movapd %xmm15, %xmm6
subsd %xmm4, %xmm6
movapd %xmm15, %xmm10
subsd %xmm3, %xmm10
mulsd %xmm3, %xmm7
mulsd %xmm10, %xmm5
addsd %xmm7, %xmm5
mulsd %xmm6, %xmm5
mulsd %xmm9, %xmm3
mulsd %xmm8, %xmm10
addsd %xmm3, %xmm10
mulsd %xmm4, %xmm10
addsd %xmm5, %xmm10
cvtsd2ss %xmm10, %xmm3
movss %xmm3, (%rbx)
addq $0x4, %rbx
addsd %xmm11, %xmm2
jmp 0xd1ea
addsd %xmm11, %xmm0
incq %rsi
jmp 0xd1c6