// File: /workspace/github_c_makefile_star2_O1/zpole[P]IICV/vl/quickshift.c
// Function: vl_quickshift_process
VL_EXPORT
void vl_quickshift_process(VlQS * q)
{
  vl_qs_type const *I = q->image;
  int        *parents = q->parents;
  vl_qs_type *E = q->density;
  vl_qs_type *dists = q->dists;
  vl_qs_type *M = 0, *n = 0 ;
  vl_qs_type sigma = q->sigma ;
  vl_qs_type tau = q->tau;
  vl_qs_type tau2 = tau*tau;

  int K = q->channels, d;
  int N1 = q->height, N2 = q->width;
  int i1,i2, j1,j2, R, tR;

  d = 2 + K ; /* Total dimensions include spatial component (x,y) */

  if (q->medoid) { /* n and M are only used in mediod shift */
    M = (vl_qs_type *) vl_calloc(N1*N2*d, sizeof(vl_qs_type)) ;
    n = (vl_qs_type *) vl_calloc(N1*N2,   sizeof(vl_qs_type)) ;
  }

  R = (int) ceil (3 * sigma) ;
  tR = (int) ceil (tau) ;

  /* -----------------------------------------------------------------
   *                                                                 n
   * -------------------------------------------------------------- */

  /* If we are doing medoid shift, initialize n to the inner product of the
   * image with itself
   */
  if (n) {
    for (i2 = 0 ; i2 < N2 ; ++ i2) {
      for (i1 = 0 ; i1 < N1 ; ++ i1) {
        n [i1 + N1 * i2] = vl_quickshift_inner(I,N1,N2,K,
                                               i1,i2,
                                               i1,i2) ;
      }
    }
  }

  /* -----------------------------------------------------------------
   *                                                 E = - [oN'*F]', M
   * -------------------------------------------------------------- */

  /*
     D_ij = d(x_i,x_j)
     E_ij = exp(- .5 * D_ij / sigma^2) ;
     F_ij = - E_ij
     E_i  = sum_j E_ij
     M_di = sum_j X_j F_ij

     E is the parzen window estimate of the density
     0 = dissimilar to everything, windowsize = identical
  */

  for (i2 = 0 ; i2 < N2 ; ++ i2) {
    for (i1 = 0 ; i1 < N1 ; ++ i1) {

      int j1min = VL_MAX(i1 - R, 0   ) ;
      int j1max = VL_MIN(i1 + R, N1-1) ;
      int j2min = VL_MAX(i2 - R, 0   ) ;
      int j2max = VL_MIN(i2 + R, N2-1) ;

      /* For each pixel in the window compute the distance between it and the
       * source pixel */
      for (j2 = j2min ; j2 <= j2max ; ++ j2) {
        for (j1 = j1min ; j1 <= j1max ; ++ j1) {
          vl_qs_type Dij = vl_quickshift_distance(I,N1,N2,K, i1,i2, j1,j2) ;
          /* Make distance a similarity */
          vl_qs_type Fij = - exp(- Dij / (2*sigma*sigma)) ;

          /* E is E_i above */
          E [i1 + N1 * i2] -= Fij ;

          if (M) {
            /* Accumulate votes for the median */
            int k ;
            M [i1 + N1*i2 + (N1*N2) * 0] += j1 * Fij ;
            M [i1 + N1*i2 + (N1*N2) * 1] += j2 * Fij ;
            for (k = 0 ; k < K ; ++k) {
              M [i1 + N1*i2 + (N1*N2) * (k+2)] +=
                I [j1 + N1*j2 + (N1*N2) * k] * Fij ;
            }
          }

        } /* j1 */
      } /* j2 */

    }  /* i1 */
  } /* i2 */

  /* -----------------------------------------------------------------
   *                                               Find best neighbors
   * -------------------------------------------------------------- */

  if (q->medoid) {

    /*
       Qij = - nj Ei - 2 sum_k Gjk Mik
       n is I.^2
    */

    /* medoid shift */
    for (i2 = 0 ; i2 < N2 ; ++i2) {
      for (i1 = 0 ; i1 < N1 ; ++i1) {

        vl_qs_type sc_best = 0  ;
        /* j1/j2 best are the best indicies for each i */
        vl_qs_type j1_best = i1 ;
        vl_qs_type j2_best = i2 ;

        int j1min = VL_MAX(i1 - R, 0   ) ;
        int j1max = VL_MIN(i1 + R, N1-1) ;
        int j2min = VL_MAX(i2 - R, 0   ) ;
        int j2max = VL_MIN(i2 + R, N2-1) ;

        for (j2 = j2min ; j2 <= j2max ; ++ j2) {
          for (j1 = j1min ; j1 <= j1max ; ++ j1) {

            vl_qs_type Qij = - n [j1 + j2 * N1] * E [i1 + i2 * N1] ;
            int k ;

            Qij -= 2 * j1 * M [i1 + i2 * N1 + (N1*N2) * 0] ;
            Qij -= 2 * j2 * M [i1 + i2 * N1 + (N1*N2) * 1] ;
            for (k = 0 ; k < K ; ++k) {
              Qij -= 2 *
                I [j1 + j2 * N1 + (N1*N2) * k] *
                M [i1 + i2 * N1 + (N1*N2) * (k + 2)] ;
            }

            if (Qij > sc_best) {
              sc_best = Qij ;
              j1_best = j1 ;
              j2_best = j2 ;
            }
          }
        }

        /* parents_i is the linear index of j which is the best pair
         * dists_i is the score of the best match
         */
        parents [i1 + N1 * i2] = j1_best + N1 * j2_best ;
        dists[i1 + N1 * i2] = sc_best ;
      }
    }

  } else {

    /* Quickshift assigns each i to the closest j which has an increase in the
     * density (E). If there is no j s.t. Ej > Ei, then dists_i == inf (a root
     * node in one of the trees of merges).
     */
    for (i2 = 0 ; i2 < N2 ; ++i2) {
      for (i1 = 0 ; i1 < N1 ; ++i1) {

        vl_qs_type E0 = E [i1 + N1 * i2] ;
        vl_qs_type d_best = VL_QS_INF ;
        vl_qs_type j1_best = i1   ;
        vl_qs_type j2_best = i2   ;

        int j1min = VL_MAX(i1 - tR, 0   ) ;
        int j1max = VL_MIN(i1 + tR, N1-1) ;
        int j2min = VL_MAX(i2 - tR, 0   ) ;
        int j2max = VL_MIN(i2 + tR, N2-1) ;

        for (j2 = j2min ; j2 <= j2max ; ++ j2) {
          for (j1 = j1min ; j1 <= j1max ; ++ j1) {
            if (E [j1 + N1 * j2] > E0) {
              vl_qs_type Dij = vl_quickshift_distance(I,N1,N2,K, i1,i2, j1,j2) ;
              if (Dij <= tau2 && Dij < d_best) {
                d_best = Dij ;
                j1_best = j1 ;
                j2_best = j2 ;
              }
            }
          }
        }

        /* parents is the index of the best pair */
        /* dists_i is the minimal distance, inf implies no Ej > Ei within
         * distance tau from the point */
        parents [i1 + N1 * i2] = j1_best + N1 * j2_best ;
        dists[i1 + N1 * i2] = sqrt(d_best) ;
      }
    }
  }

  if (M) vl_free(M) ;
  if (n) vl_free(n) ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq (%rdi), %rax
movq %rax, 0xa0(%rsp)
movq 0x28(%rdi), %rax
movq %rax, 0x118(%rsp)
movq 0x38(%rdi), %rax
movq %rax, 0xb8(%rsp)
movq 0x30(%rdi), %rax
movq %rax, 0x110(%rsp)
movsd 0x18(%rdi), %xmm0
movsd %xmm0, (%rsp)
movsd 0x20(%rdi), %xmm0
movaps %xmm0, 0xc0(%rsp)
movl 0x10(%rdi), %eax
movl 0x8(%rdi), %r14d
movl 0xc(%rdi), %r12d
movq %rdi, 0x130(%rsp)
cmpl $0x0, 0x14(%rdi)
movq %rax, 0xb0(%rsp)
je 0x28bac
addl $0x2, %eax
movl %r14d, %ebx
imull %r12d, %ebx
imull %ebx, %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0x98f0
movq %rax, 0x80(%rsp)
movslq %ebx, %rdi
movl $0x8, %esi
callq 0x98f0
movq %rax, %r15
jmp 0x28bbb
xorl %r15d, %r15d
movq $0x0, 0x80(%rsp)
movsd 0xa64d(%rip), %xmm0     # 0x33210
mulsd (%rsp), %xmm0
callq 0x99c0
movsd %xmm0, 0x40(%rsp)
movapd 0xc0(%rsp), %xmm0
callq 0x99c0
movsd %xmm0, 0x128(%rsp)
testq %r15, %r15
setne %al
testl %r12d, %r12d
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x28c90
movl %r12d, %eax
imull %r14d, %eax
cltq
leaq (,%r14,8), %rcx
shlq $0x3, %rax
xorl %edx, %edx
movq 0xa0(%rsp), %rsi
testl %r14d, %r14d
jle 0x28c85
movq %rdx, %rdi
imulq %rdx, %rdi
movq %rdx, %r8
imulq %r14, %r8
movq %rsi, %r9
xorl %r10d, %r10d
movl %r10d, %r11d
imull %r10d, %r11d
addl %edi, %r11d
xorps %xmm0, %xmm0
cvtsi2sd %r11d, %xmm0
movq 0xb0(%rsp), %rbx
testl %ebx, %ebx
jle 0x28c6f
movq %r9, %r11
movsd (%r11), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
addq %rax, %r11
decq %rbx
jne 0x28c5a
leaq (%r10,%r8), %r11
movsd %xmm0, (%r15,%r11,8)
incq %r10
addq $0x8, %r9
cmpq %r14, %r10
jne 0x28c39
incq %rdx
addq %rcx, %rsi
cmpq %r12, %rdx
jne 0x28c20
movq %r15, 0x120(%rsp)
cvttsd2si 0x40(%rsp), %eax
movq %rax, 0x50(%rsp)
testl %r12d, %r12d
movq 0xb0(%rsp), %rdx
movq %r14, 0x88(%rsp)
movq %r12, 0xd8(%rsp)
movq 0x80(%rsp), %rax
jle 0x290a8
leal -0x1(%r14), %ecx
movl %ecx, 0xec(%rsp)
leal -0x1(%r12), %ecx
movl %ecx, 0xe4(%rsp)
movl %r14d, %esi
imull %r12d, %esi
movslq %esi, %r15
movsd (%rsp), %xmm1
movapd %xmm1, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0xa8(%rsp)
movq 0x50(%rsp), %rcx
negl %ecx
leaq (,%r14,8), %rdi
movq %rdi, 0x18(%rsp)
shlq $0x3, %r15
movq %rsi, %rdi
shlq $0x4, %rdi
addq %rax, %rdi
movq %rdi, 0x100(%rsp)
movq %rsi, 0x138(%rsp)
leaq (,%rsi,8), %rax
movq %rax, 0x70(%rsp)
movq $0x0, 0xf8(%rsp)
movq $0x0, 0x58(%rsp)
movl %ecx, 0xe0(%rsp)
movl %ecx, %esi
testl %esi, %esi
movl $0x0, %eax
movl %esi, 0xe8(%rsp)
cmovgl %esi, %eax
movq %rax, 0x108(%rsp)
testl %r14d, %r14d
jle 0x2906c
movq 0x18(%rsp), %rdi
imulq 0x108(%rsp), %rdi
movq 0x58(%rsp), %rsi
movl %esi, %r8d
movq 0x50(%rsp), %rax
subl %eax, %r8d
testl %r8d, %r8d
movl $0x0, %ecx
cmovlel %ecx, %r8d
movl %r8d, 0xf4(%rsp)
leal (%rsi,%rax), %ecx
movl 0xe4(%rsp), %eax
cmpl %eax, %ecx
cmovgel %eax, %ecx
imulq %r14, %rsi
movq %rsi, 0x148(%rsp)
movl %ecx, 0xf0(%rsp)
movslq %ecx, %rax
movq %rax, 0x28(%rsp)
movq 0xa0(%rsp), %rax
movq %rdi, 0x150(%rsp)
addq %rdi, %rax
movq %rax, 0x140(%rsp)
movq 0x100(%rsp), %r12
movq 0xf8(%rsp), %rbp
movq $0x0, 0x8(%rsp)
movl 0xe0(%rsp), %esi
testl %esi, %esi
movl $0x0, %eax
movl %esi, 0x4c(%rsp)
cmovgl %esi, %eax
movq %rax, 0x60(%rsp)
movl 0xf0(%rsp), %eax
cmpl %eax, 0xf4(%rsp)
jg 0x29040
movq 0x140(%rsp), %rax
movq 0x60(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
movq 0x150(%rsp), %rax
leaq (%rax,%rcx,8), %rax
movq %rax, 0x68(%rsp)
movq 0x50(%rsp), %rax
movq 0x8(%rsp), %rsi
leal (%rsi,%rax), %edi
movl 0xec(%rsp), %ecx
cmpl %ecx, %edi
cmovgel %ecx, %edi
movl %esi, %ecx
subl %eax, %ecx
testl %ecx, %ecx
movl $0x0, %eax
cmovlel %eax, %ecx
movl %ecx, 0x14(%rsp)
movq 0x148(%rsp), %rax
leaq (%rsi,%rax), %rcx
movq 0x138(%rsp), %rax
movq %rcx, (%rsp)
addq %rcx, %rax
movq %rax, 0x90(%rsp)
movl %edi, 0x30(%rsp)
movslq %edi, %rax
movq %rax, 0x78(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x20(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x30(%rsp), %eax
jg 0x29018
movq 0x20(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x98(%rsp)
subl 0x58(%rsp), %eax
imull %eax, %eax
movl %eax, 0x40(%rsp)
movq 0x38(%rsp), %r14
movq 0x68(%rsp), %r13
movq 0x60(%rsp), %rbx
movl %ebx, %eax
subl 0x8(%rsp), %eax
imull %eax, %eax
addl 0x40(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
testl %edx, %edx
jle 0x28f4d
movq 0xa0(%rsp), %rax
movq %rdx, %rcx
movsd (%rax,%rbp), %xmm1
subsd (%rax,%r13), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
addq %r15, %rax
decq %rcx
jne 0x28f32
xorpd 0xa17b(%rip), %xmm0     # 0x330d0
divsd 0xa8(%rsp), %xmm0
callq 0x9a60
movq 0xb8(%rsp), %rax
movq (%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rcx,8)
movq 0x80(%rsp), %rax
testq %rax, %rax
movq 0xb0(%rsp), %rdx
movq 0x70(%rsp), %rsi
je 0x28ffe
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
xorpd 0xa12a(%rip), %xmm0     # 0x330d0
mulsd %xmm0, %xmm1
movq (%rsp), %rcx
addsd (%rax,%rcx,8), %xmm1
movsd %xmm1, (%rax,%rcx,8)
movsd 0x98(%rsp), %xmm1
mulsd %xmm0, %xmm1
movq 0x90(%rsp), %rcx
addsd (%rax,%rcx,8), %xmm1
movsd %xmm1, (%rax,%rcx,8)
testl %edx, %edx
jle 0x28ffe
movq %rdx, %rax
xorl %ecx, %ecx
movsd (%r14,%rcx), %xmm1
mulsd %xmm0, %xmm1
addsd (%r12,%rcx), %xmm1
movsd %xmm1, (%r12,%rcx)
addq %rsi, %rcx
decq %rax
jne 0x28fe0
leaq 0x1(%rbx), %rax
addq $0x8, %r13
addq $0x8, %r14
cmpq 0x78(%rsp), %rbx
movq %rax, %rbx
jl 0x28f0f
movq 0x20(%rsp), %rsi
leaq 0x1(%rsi), %rax
movq 0x18(%rsp), %rcx
addq %rcx, 0x68(%rsp)
addq %rcx, 0x38(%rsp)
cmpq 0x28(%rsp), %rsi
movq %rax, 0x20(%rsp)
jl 0x28ed2
movq 0x8(%rsp), %rcx
incq %rcx
movl 0x4c(%rsp), %esi
incl %esi
addq $0x8, %rbp
addq $0x8, %r12
movq 0x88(%rsp), %r14
movq %rcx, 0x8(%rsp)
cmpq %r14, %rcx
jne 0x28e1d
movq 0x58(%rsp), %rcx
incq %rcx
movl 0xe8(%rsp), %esi
incl %esi
movq 0x18(%rsp), %rax
addq %rax, 0xf8(%rsp)
addq %rax, 0x100(%rsp)
movq 0xd8(%rsp), %r12
movq %rcx, 0x58(%rsp)
cmpq %r12, %rcx
jne 0x28d64
movq 0x130(%rsp), %rax
cmpl $0x0, 0x14(%rax)
je 0x29407
testl %r12d, %r12d
jle 0x29746
leal -0x1(%r12), %eax
movl %eax, 0x28(%rsp)
movl %r14d, %ecx
imull %r12d, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
leal -0x1(%r14), %eax
movl %eax, 0x68(%rsp)
movq 0x50(%rsp), %rax
negl %eax
movq %rcx, %rdx
shlq $0x4, %rdx
addq 0x80(%rsp), %rdx
movq %rdx, 0x18(%rsp)
leaq (,%r14,8), %rdx
movq %rdx, (%rsp)
movq %rcx, 0x38(%rsp)
leaq (,%rcx,8), %r9
movapd 0x9fb1(%rip), %xmm1     # 0x330d0
movsd 0xa0b1(%rip), %xmm2     # 0x331d8
movq $0x0, 0x30(%rsp)
movl %eax, 0x60(%rsp)
movl %eax, %edx
testl %edx, %edx
movl $0x0, %eax
movl %edx, 0x14(%rsp)
cmovgl %edx, %eax
movq %rax, 0xc0(%rsp)
testl %r14d, %r14d
jle 0x293d8
movq (%rsp), %rsi
imulq 0xc0(%rsp), %rsi
movq 0x30(%rsp), %rdx
cvtsi2sd %edx, %xmm3
movl %edx, %edi
movq 0x50(%rsp), %rax
subl %eax, %edi
testl %edi, %edi
movl $0x0, %ecx
cmovlel %ecx, %edi
movl %edi, 0x98(%rsp)
leal (%rdx,%rax), %ecx
movl 0x28(%rsp), %eax
cmpl %eax, %ecx
cmovgel %eax, %ecx
imulq %r14, %rdx
movq %rdx, 0x70(%rsp)
movl %ecx, 0x90(%rsp)
movslq %ecx, %rdi
addq 0xa0(%rsp), %rsi
movq %rsi, 0x20(%rsp)
movq 0x18(%rsp), %r15
xorl %esi, %esi
movl 0x60(%rsp), %eax
testl %eax, %eax
movl $0x0, %edx
movl %eax, 0xa8(%rsp)
cmovgl %eax, %edx
xorps %xmm4, %xmm4
cvtsi2sd %esi, %xmm4
xorpd %xmm6, %xmm6
movl 0x90(%rsp), %eax
cmpl %eax, 0x98(%rsp)
movq %rsi, 0x78(%rsp)
jle 0x291f7
movapd %xmm3, %xmm12
jmp 0x29383
movq 0x50(%rsp), %rax
leal (%rsi,%rax), %ebp
movl 0x68(%rsp), %ecx
cmpl %ecx, %ebp
cmovgel %ecx, %ebp
movq 0x20(%rsp), %rcx
movq %rdx, 0x40(%rsp)
leaq (%rcx,%rdx,8), %r10
movl %esi, %ebx
subl %eax, %ebx
testl %ebx, %ebx
movl $0x0, %eax
cmovlel %eax, %ebx
movq 0x70(%rsp), %rax
leaq (%rsi,%rax), %rdx
movq 0x38(%rsp), %rax
addq %rdx, %rax
movq %rax, 0x8(%rsp)
movslq %ebp, %r12
xorpd %xmm5, %xmm5
movq 0xc0(%rsp), %r11
movapd %xmm3, %xmm7
cmpl %ebp, %ebx
jle 0x2925f
movapd %xmm7, %xmm12
movapd %xmm5, %xmm6
jmp 0x29366
movq %r11, %r13
imulq 0x88(%rsp), %r13
movq 0xb8(%rsp), %rax
movsd (%rax,%rdx,8), %xmm8
leal (%r11,%r11), %eax
xorps %xmm9, %xmm9
cvtsi2sd %eax, %xmm9
movq 0x80(%rsp), %rax
movsd (%rax,%rdx,8), %xmm10
xorpd %xmm1, %xmm9
xorps %xmm11, %xmm11
cvtsi2sd %r11d, %xmm11
movq 0x8(%rsp), %rcx
mulsd (%rax,%rcx,8), %xmm9
movq %r10, %rsi
movq 0x40(%rsp), %r14
leaq (%r14,%r13), %rax
leal (%r14,%r14), %r8d
movq 0x120(%rsp), %rcx
movsd (%rcx,%rax,8), %xmm12
mulsd %xmm8, %xmm12
xorps %xmm6, %xmm6
cvtsi2sd %r8d, %xmm6
xorpd %xmm1, %xmm6
mulsd %xmm10, %xmm6
subsd %xmm12, %xmm6
addsd %xmm9, %xmm6
movq 0xb0(%rsp), %rax
testl %eax, %eax
jle 0x29318
xorl %r8d, %r8d
movsd (%rsi,%r8), %xmm12
mulsd %xmm2, %xmm12
mulsd (%r15,%r8), %xmm12
addsd %xmm12, %xmm6
addq %r9, %r8
decq %rax
jne 0x292fa
ucomisd %xmm5, %xmm6
jbe 0x29326
xorps %xmm4, %xmm4
cvtsi2sd %r14d, %xmm4
movapd %xmm5, %xmm12
cmpltsd %xmm6, %xmm12
movapd %xmm12, %xmm13
andpd %xmm11, %xmm13
andnpd %xmm7, %xmm12
orpd %xmm13, %xmm12
maxsd %xmm5, %xmm6
leaq 0x1(%r14), %rax
addq $0x8, %rsi
movapd %xmm6, %xmm5
movapd %xmm12, %xmm7
cmpq %r12, %r14
movq %rax, %r14
jl 0x292b5
leaq 0x1(%r11), %rax
addq (%rsp), %r10
movapd %xmm6, %xmm5
movapd %xmm12, %xmm7
cmpq %rdi, %r11
movq %rax, %r11
jl 0x2924d
mulsd %xmm0, %xmm12
addsd %xmm4, %xmm12
cvttsd2si %xmm12, %eax
movq 0x70(%rsp), %rcx
movq 0x78(%rsp), %rsi
addq %rsi, %rcx
movq 0x118(%rsp), %rdx
movl %eax, (%rdx,%rcx,4)
movq 0x110(%rsp), %rax
movsd %xmm6, (%rax,%rcx,8)
incq %rsi
movl 0xa8(%rsp), %eax
incl %eax
addq $0x8, %r15
movq 0x88(%rsp), %r14
cmpq %r14, %rsi
jne 0x291bc
movq 0x30(%rsp), %rcx
incq %rcx
movl 0x14(%rsp), %edx
incl %edx
movq (%rsp), %rax
addq %rax, 0x18(%rsp)
movq %rcx, 0x30(%rsp)
cmpq 0xd8(%rsp), %rcx
jne 0x29136
jmp 0x29746
testl %r12d, %r12d
jle 0x29746
movapd 0xc0(%rsp), %xmm0
mulsd %xmm0, %xmm0
movapd %xmm0, 0xc0(%rsp)
cvttsd2si 0x128(%rsp), %ecx
leal -0x1(%r14), %eax
movl %eax, 0x14(%rsp)
leal -0x1(%r12), %eax
movl %eax, 0x58(%rsp)
movl %r14d, %eax
imull %r12d, %eax
movslq %eax, %r15
cvtsi2sd %r14d, %xmm8
movq %rcx, 0x38(%rsp)
movl %ecx, %eax
negl %eax
leaq (,%r14,8), %rcx
movq %rcx, (%rsp)
shlq $0x3, %r15
movsd 0xa7a7(%rip), %xmm9     # 0x33c18
xorpd %xmm10, %xmm10
movq $0x0, 0x28(%rsp)
movq $0x0, 0x8(%rsp)
movl %eax, 0x4c(%rsp)
movl %eax, %edx
movsd %xmm8, 0x18(%rsp)
testl %edx, %edx
movl $0x0, %eax
movl %edx, 0x60(%rsp)
cmovgl %edx, %eax
movq %rax, 0x20(%rsp)
testl %r14d, %r14d
jle 0x29717
movq (%rsp), %rax
imulq 0x20(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x8(%rsp), %rdx
movq %rdx, %rax
imulq %r14, %rax
movq %rax, 0x70(%rsp)
xorps %xmm11, %xmm11
cvtsi2sd %edx, %xmm11
movl %edx, %esi
movq 0x38(%rsp), %rax
subl %eax, %esi
testl %esi, %esi
movl $0x0, %ecx
cmovlel %ecx, %esi
movl %esi, 0x98(%rsp)
leal (%rdx,%rax), %ecx
movl 0x58(%rsp), %eax
cmpl %eax, %ecx
cmovgel %eax, %ecx
movl %ecx, 0x90(%rsp)
movslq %ecx, %rax
movq %rax, 0x40(%rsp)
movq 0x28(%rsp), %rbx
xorl %r12d, %r12d
movl 0x4c(%rsp), %ecx
movsd %xmm11, 0x30(%rsp)
testl %ecx, %ecx
movl $0x0, %eax
movl %ecx, 0x78(%rsp)
cmovgl %ecx, %eax
movq 0x70(%rsp), %rcx
leaq (%r12,%rcx), %rsi
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
movl 0x90(%rsp), %ecx
cmpl %ecx, 0x98(%rsp)
movq %rsi, 0xa8(%rsp)
jle 0x29568
movapd %xmm9, %xmm0
movapd %xmm11, %xmm3
jmp 0x2969c
movq 0x68(%rsp), %rcx
leaq (%rcx,%rax,8), %rcx
movq 0xb8(%rsp), %rdx
movsd (%rdx,%rsi,8), %xmm2
movq 0x38(%rsp), %rdi
leal (%r12,%rdi), %edx
movl 0x14(%rsp), %esi
cmpl %esi, %edx
cmovgel %esi, %edx
movl %r12d, %esi
subl %edi, %esi
testl %esi, %esi
movl $0x0, %edi
cmovlel %edi, %esi
movslq %edx, %rdi
movq 0x20(%rsp), %r8
movapd %xmm11, %xmm3
movapd %xmm9, %xmm0
cmpl %edx, %esi
jg 0x29686
movq %r8, %r9
imulq 0x88(%rsp), %r9
xorps %xmm4, %xmm4
cvtsi2sd %r8d, %xmm4
movl %r8d, %r10d
subl 0x8(%rsp), %r10d
imull %r10d, %r10d
movq %rcx, %r11
movq %rax, %r14
leaq (%r14,%r9), %r13
movq 0xb8(%rsp), %rbp
movsd (%rbp,%r13,8), %xmm5
ucomisd %xmm2, %xmm5
jbe 0x29672
movl %r14d, %ebp
subl %r12d, %ebp
imull %ebp, %ebp
addl %r10d, %ebp
xorps %xmm5, %xmm5
cvtsi2sd %ebp, %xmm5
movq 0xb0(%rsp), %rbp
testl %ebp, %ebp
jle 0x2963d
movq 0xa0(%rsp), %r13
movsd (%r13,%rbx), %xmm6
subsd (%r13,%r11), %xmm6
mulsd %xmm6, %xmm6
addsd %xmm6, %xmm5
addq %r15, %r13
decq %rbp
jne 0x2961f
movapd %xmm5, %xmm6
cmpltpd %xmm0, %xmm6
movapd %xmm5, %xmm7
cmplepd 0xc0(%rsp), %xmm7
andpd %xmm6, %xmm7
movd %xmm7, %ebp
testb $0x1, %bpl
je 0x29672
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
movapd %xmm4, %xmm3
movapd %xmm5, %xmm0
leaq 0x1(%r14), %r13
addq $0x8, %r11
cmpq %rdi, %r14
movq %r13, %r14
jl 0x295df
leaq 0x1(%r8), %r9
addq (%rsp), %rcx
cmpq 0x40(%rsp), %r8
movq %r9, %r8
jl 0x295b1
mulsd %xmm8, %xmm3
addsd %xmm1, %xmm3
cvttsd2si %xmm3, %eax
movq 0x118(%rsp), %rcx
movq 0xa8(%rsp), %r13
movl %eax, (%rcx,%r13,4)
ucomisd %xmm10, %xmm0
movq 0x88(%rsp), %r14
jb 0x296d2
sqrtsd %xmm0, %xmm0
jmp 0x296f3
callq 0x9990
movsd 0x30(%rsp), %xmm11
xorpd %xmm10, %xmm10
movsd 0xa52c(%rip), %xmm9     # 0x33c18
movsd 0x18(%rsp), %xmm8
movl 0x78(%rsp), %ecx
movq 0x110(%rsp), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r12
incl %ecx
addq $0x8, %rbx
cmpq %r14, %r12
jne 0x29522
movq 0x8(%rsp), %rcx
incq %rcx
movl 0x60(%rsp), %edx
incl %edx
movq 0x28(%rsp), %rax
addq (%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rcx, 0x8(%rsp)
cmpq 0xd8(%rsp), %rcx
jne 0x29495
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x29758
callq 0x9580
movq 0x120(%rsp), %rdi
addq $0x158, %rsp            # imm = 0x158
testq %rdi, %rdi
je 0x2977b
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9580
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq