// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/sift.c
// Function: vl_sift_detect
VL_EXPORT
void
vl_sift_detect (VlSiftFilt * f)
{
  vl_sift_pix* dog   = f-> dog ;
  int          s_min = f-> s_min ;
  int          s_max = f-> s_max ;
  int          w     = f-> octave_width ;
  int          h     = f-> octave_height ;
  double       te    = f-> edge_thresh ;
  double       tp    = f-> peak_thresh ;

  int const    xo    = 1 ;      /* x-stride */
  int const    yo    = w ;      /* y-stride */
  int const    so    = w * h ;  /* s-stride */

  double       xper  = pow (2.0, f->o_cur) ;

  int x, y, s, i, ii, jj ;
  vl_sift_pix *pt, v ;
  VlSiftKeypoint *k ;

  /* clear current list */
  f-> nkeys = 0 ;

  /* compute difference of gaussian (DoG) */
  pt = f-> dog ;
  for (s = s_min ; s <= s_max - 1 ; ++s) {
    vl_sift_pix* src_a = vl_sift_get_octave (f, s    ) ;
    vl_sift_pix* src_b = vl_sift_get_octave (f, s + 1) ;
    vl_sift_pix* end_a = src_a + w * h ;
    while (src_a != end_a) {
      *pt++ = *src_b++ - *src_a++ ;
    }
  }

  /* -----------------------------------------------------------------
   *                                          Find local maxima of DoG
   * -------------------------------------------------------------- */

  /* start from dog [1,1,s_min+1] */
  pt  = dog + xo + yo + so ;

  for(s = s_min + 1 ; s <= s_max - 2 ; ++s) {
    for(y = 1 ; y < h - 1 ; ++y) {
      for(x = 1 ; x < w - 1 ; ++x) {
        v = *pt ;

#define CHECK_NEIGHBORS(CMP,SGN)                    \
        ( v CMP ## = SGN 0.8 * tp &&                \
          v CMP *(pt + xo) &&                       \
          v CMP *(pt - xo) &&                       \
          v CMP *(pt + so) &&                       \
          v CMP *(pt - so) &&                       \
          v CMP *(pt + yo) &&                       \
          v CMP *(pt - yo) &&                       \
                                                    \
          v CMP *(pt + yo + xo) &&                  \
          v CMP *(pt + yo - xo) &&                  \
          v CMP *(pt - yo + xo) &&                  \
          v CMP *(pt - yo - xo) &&                  \
                                                    \
          v CMP *(pt + xo      + so) &&             \
          v CMP *(pt - xo      + so) &&             \
          v CMP *(pt + yo      + so) &&             \
          v CMP *(pt - yo      + so) &&             \
          v CMP *(pt + yo + xo + so) &&             \
          v CMP *(pt + yo - xo + so) &&             \
          v CMP *(pt - yo + xo + so) &&             \
          v CMP *(pt - yo - xo + so) &&             \
                                                    \
          v CMP *(pt + xo      - so) &&             \
          v CMP *(pt - xo      - so) &&             \
          v CMP *(pt + yo      - so) &&             \
          v CMP *(pt - yo      - so) &&             \
          v CMP *(pt + yo + xo - so) &&             \
          v CMP *(pt + yo - xo - so) &&             \
          v CMP *(pt - yo + xo - so) &&             \
          v CMP *(pt - yo - xo - so) )

        if (CHECK_NEIGHBORS(>,+) ||
            CHECK_NEIGHBORS(<,-) ) {

          /* make room for more keypoints */
          if (f->nkeys >= f->keys_res) {
            f->keys_res += 500 ;
            if (f->keys) {
              f->keys = vl_realloc (f->keys,
                                    f->keys_res *
                                    sizeof(VlSiftKeypoint)) ;
            } else {
              f->keys = vl_malloc (f->keys_res *
                                   sizeof(VlSiftKeypoint)) ;
            }
          }

          k = f->keys + (f->nkeys ++) ;

          k-> ix = x ;
          k-> iy = y ;
          k-> is = s ;
        }
        pt += 1 ;
      }
      pt += 2 ;
    }
    pt += 2 * yo ;
  }

  /* -----------------------------------------------------------------
   *                                               Refine local maxima
   * -------------------------------------------------------------- */

  /* this pointer is used to write the keypoints back */
  k = f->keys ;

  for (i = 0 ; i < f->nkeys ; ++i) {

    int x = f-> keys [i] .ix ;
    int y = f-> keys [i] .iy ;
    int s = f-> keys [i]. is ;

    double Dx=0,Dy=0,Ds=0,Dxx=0,Dyy=0,Dss=0,Dxy=0,Dxs=0,Dys=0 ;
    double A [3*3], b [3] ;

    int dx = 0 ;
    int dy = 0 ;

    int iter, i, j ;

    for (iter = 0 ; iter < 5 ; ++iter) {

      x += dx ;
      y += dy ;

      pt = dog
        + xo * x
        + yo * y
        + so * (s - s_min) ;

      /** @brief Index GSS @internal */
#define at(dx,dy,ds) (*( pt + (dx)*xo + (dy)*yo + (ds)*so))

      /** @brief Index matrix A @internal */
#define Aat(i,j)     (A[(i)+(j)*3])

      /* compute the gradient */
      Dx = 0.5 * (at(+1,0,0) - at(-1,0,0)) ;
      Dy = 0.5 * (at(0,+1,0) - at(0,-1,0));
      Ds = 0.5 * (at(0,0,+1) - at(0,0,-1)) ;

      /* compute the Hessian */
      Dxx = (at(+1,0,0) + at(-1,0,0) - 2.0 * at(0,0,0)) ;
      Dyy = (at(0,+1,0) + at(0,-1,0) - 2.0 * at(0,0,0)) ;
      Dss = (at(0,0,+1) + at(0,0,-1) - 2.0 * at(0,0,0)) ;

      Dxy = 0.25 * ( at(+1,+1,0) + at(-1,-1,0) - at(-1,+1,0) - at(+1,-1,0) ) ;
      Dxs = 0.25 * ( at(+1,0,+1) + at(-1,0,-1) - at(-1,0,+1) - at(+1,0,-1) ) ;
      Dys = 0.25 * ( at(0,+1,+1) + at(0,-1,-1) - at(0,-1,+1) - at(0,+1,-1) ) ;

      /* solve linear system ....................................... */
      Aat(0,0) = Dxx ;
      Aat(1,1) = Dyy ;
      Aat(2,2) = Dss ;
      Aat(0,1) = Aat(1,0) = Dxy ;
      Aat(0,2) = Aat(2,0) = Dxs ;
      Aat(1,2) = Aat(2,1) = Dys ;

      b[0] = - Dx ;
      b[1] = - Dy ;
      b[2] = - Ds ;

      /* Gauss elimination */
      for(j = 0 ; j < 3 ; ++j) {
        double maxa    = 0 ;
        double maxabsa = 0 ;
        int    maxi    = -1 ;
        double tmp ;

        /* look for the maximally stable pivot */
        for (i = j ; i < 3 ; ++i) {
          double a    = Aat (i,j) ;
          double absa = vl_abs_d (a) ;
          if (absa > maxabsa) {
            maxa    = a ;
            maxabsa = absa ;
            maxi    = i ;
          }
        }

        /* if singular give up */
        if (maxabsa < 1e-10f) {
          b[0] = 0 ;
          b[1] = 0 ;
          b[2] = 0 ;
          break ;
        }

        i = maxi ;

        /* swap j-th row with i-th row and normalize j-th row */
        for(jj = j ; jj < 3 ; ++jj) {
          tmp = Aat(i,jj) ; Aat(i,jj) = Aat(j,jj) ; Aat(j,jj) = tmp ;
          Aat(j,jj) /= maxa ;
        }
        tmp = b[j] ; b[j] = b[i] ; b[i] = tmp ;
        b[j] /= maxa ;

        /* elimination */
        for (ii = j+1 ; ii < 3 ; ++ii) {
          double x = Aat(ii,j) ;
          for (jj = j ; jj < 3 ; ++jj) {
            Aat(ii,jj) -= x * Aat(j,jj) ;
          }
          b[ii] -= x * b[j] ;
        }
      }

      /* backward substitution */
      for (i = 2 ; i > 0 ; --i) {
        double x = b[i] ;
        for (ii = i-1 ; ii >= 0 ; --ii) {
          b[ii] -= x * Aat(ii,i) ;
        }
      }

      /* .......................................................... */
      /* If the translation of the keypoint is big, move the keypoint
       * and re-iterate the computation. Otherwise we are all set.
       */

      dx= ((b[0] >  0.6 && x < w - 2) ?  1 : 0)
        + ((b[0] < -0.6 && x > 1    ) ? -1 : 0) ;

      dy= ((b[1] >  0.6 && y < h - 2) ?  1 : 0)
        + ((b[1] < -0.6 && y > 1    ) ? -1 : 0) ;

      if (dx == 0 && dy == 0) break ;
    }

    /* check threshold and other conditions */
    {
      double val   = at(0,0,0)
        + 0.5 * (Dx * b[0] + Dy * b[1] + Ds * b[2]) ;
      double score = (Dxx+Dyy)*(Dxx+Dyy) / (Dxx*Dyy - Dxy*Dxy) ;
      double xn = x + b[0] ;
      double yn = y + b[1] ;
      double sn = s + b[2] ;

      vl_bool good =
        vl_abs_d (val)  > tp                  &&
        score           < (te+1)*(te+1)/te    &&
        score           >= 0                  &&
        vl_abs_d (b[0]) <  1.5                &&
        vl_abs_d (b[1]) <  1.5                &&
        vl_abs_d (b[2]) <  1.5                &&
        xn              >= 0                  &&
        xn              <= w - 1              &&
        yn              >= 0                  &&
        yn              <= h - 1              &&
        sn              >= s_min              &&
        sn              <= s_max ;

      if (good) {
        k-> o     = f->o_cur ;
        k-> ix    = x ;
        k-> iy    = y ;
        k-> is    = s ;
        k-> s     = sn ;
        k-> x     = xn * xper ;
        k-> y     = yn * xper ;
        k-> sigma = f->sigma0 * pow (2.0, sn/f->S) * xper ;
        ++ k ;
      }

    } /* done checking */
  } /* next keypoint to refine */

  /* update keypoint count */
  f-> nkeys = (int)(k - f->keys) ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
movq 0x50(%rdi), %rax
movq %rax, 0xa0(%rsp)
movl 0x34(%rdi), %r15d
movl 0x38(%rdi), %r12d
movslq 0x58(%rdi), %rax
movl 0x5c(%rdi), %ecx
movsd 0x90(%rdi), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x88(%rdi), %xmm0
movsd %xmm0, 0x70(%rsp)
movq %rcx, 0x50(%rsp)
movl %ecx, %ebp
movq %rax, 0x90(%rsp)
imull %eax, %ebp
movl 0x3c(%rdi), %edi
movsd 0x617f(%rip), %xmm0     # 0x2d238
callq 0x90c0
movapd %xmm0, %xmm10
andl $0x0, 0x80(%rbx)
movq 0x50(%rbx), %rax
movl %ebp, 0x4c(%rsp)
movslq %ebp, %rdx
leal 0x1(%r15), %ecx
movq %rdx, 0xc8(%rsp)
leaq (,%rdx,4), %r14
movq %r15, 0x78(%rsp)
movl %r15d, %esi
cmpl %r12d, %esi
jge 0x2714e
movl 0x58(%rbx), %r8d
movq 0x48(%rbx), %r9
movl 0x34(%rbx), %r10d
leal 0x1(%rsi), %edx
imull 0x5c(%rbx), %r8d
movl %ecx, %edi
subl %r10d, %edi
imull %r8d, %edi
movslq %edi, %rdi
leaq (%r9,%rdi,4), %rdi
subl %r10d, %esi
imull %r8d, %esi
movslq %esi, %rsi
leaq (%r9,%rsi,4), %r8
xorl %esi, %esi
cmpq %rsi, %r14
je 0x27145
movss (%rdi,%rsi), %xmm0
subss (%r8,%rsi), %xmm0
movss %xmm0, (%rax,%rsi)
addq $0x4, %rsi
jmp 0x2712a
incl %ecx
addq %rsi, %rax
movl %edx, %esi
jmp 0x270f1
movq %rbx, 0x10(%rsp)
movq 0x90(%rsp), %rcx
leaq (%r14,%rcx,4), %r8
movq 0xa0(%rsp), %rax
leaq (%rax,%r8), %rbp
addq $0x4, %rbp
movq %r12, 0x80(%rsp)
leal -0x2(%r12), %r9d
movq 0x50(%rsp), %rax
leal -0x1(%rax), %edi
leal -0x1(%rcx), %ebx
movsd 0x60a1(%rip), %xmm2     # 0x2d230
movsd 0x70(%rsp), %xmm9
mulsd %xmm9, %xmm2
movsd 0x7175(%rip), %xmm3     # 0x2e318
mulsd %xmm9, %xmm3
leaq (%rcx,%rcx), %r10
movq %r14, %r12
negq %r12
leaq (,%rcx,4), %r11
movq %r11, %rcx
negq %rcx
movq %r14, %rdx
subq %r11, %rdx
movq %rcx, %rsi
subq %r14, %rsi
movq %r11, %r15
subq %r14, %r15
movl $0x0, (%rsp)
movq 0x78(%rsp), %rax
movsd %xmm10, 0x98(%rsp)
movq %r15, 0x8(%rsp)
cmpl %r9d, %eax
jge 0x2760c
incl %eax
movl %eax, 0x18(%rsp)
pushq $0x1
popq %rax
movl %eax, %r13d
cmpl %edi, %r13d
jge 0x275fe
addq $0x8, %rbp
movl %eax, %r15d
cmpl %ebx, %r15d
jge 0x275f6
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
ucomisd %xmm2, %xmm1
jb 0x2733a
ucomiss -0x4(%rbp), %xmm0
jbe 0x2733a
ucomiss -0xc(%rbp), %xmm0
jbe 0x2733a
ucomiss -0x8(%rbp,%r14), %xmm0
jbe 0x2733a
ucomiss -0x8(%rbp,%r12), %xmm0
jbe 0x2733a
ucomiss -0x8(%rbp,%r11), %xmm0
jbe 0x2733a
ucomiss -0x8(%rbp,%rcx), %xmm0
jbe 0x2733a
ucomiss -0x4(%rbp,%r11), %xmm0
jbe 0x2733a
ucomiss -0xc(%rbp,%r11), %xmm0
jbe 0x2733a
ucomiss -0x4(%rbp,%rcx), %xmm0
jbe 0x2733a
ucomiss -0xc(%rbp,%rcx), %xmm0
jbe 0x2733a
ucomiss -0x4(%rbp,%r14), %xmm0
jbe 0x2733a
ucomiss -0xc(%rbp,%r14), %xmm0
jbe 0x2733a
ucomiss -0x8(%rbp,%r8), %xmm0
jbe 0x2733a
ucomiss -0x8(%rbp,%rdx), %xmm0
jbe 0x2733a
ucomiss -0x4(%rbp,%r8), %xmm0
jbe 0x2733a
ucomiss -0xc(%rbp,%r8), %xmm0
jbe 0x2733a
ucomiss -0x4(%rbp,%rdx), %xmm0
jbe 0x2733a
ucomiss -0xc(%rbp,%rdx), %xmm0
jbe 0x2733a
ucomiss -0x4(%rbp,%r12), %xmm0
jbe 0x2733a
ucomiss -0xc(%rbp,%r12), %xmm0
jbe 0x2733a
movq 0x8(%rsp), %rax
ucomiss -0x8(%rbp,%rax), %xmm0
pushq $0x1
popq %rax
jbe 0x2733a
ucomiss -0x8(%rbp,%rsi), %xmm0
jbe 0x2733a
movq 0x8(%rsp), %rax
ucomiss -0x4(%rbp,%rax), %xmm0
pushq $0x1
popq %rax
jbe 0x2733a
movq 0x8(%rsp), %rax
ucomiss -0xc(%rbp,%rax), %xmm0
pushq $0x1
popq %rax
jbe 0x2733a
ucomiss -0x4(%rbp,%rsi), %xmm0
jbe 0x2733a
ucomiss -0xc(%rbp,%rsi), %xmm0
ja 0x274e1
ucomisd %xmm1, %xmm3
jb 0x275ea
movss -0x4(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0xc(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x8(%rbp,%r14), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x8(%rbp,%r12), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x8(%rbp,%r11), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x8(%rbp,%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x4(%rbp,%r11), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0xc(%rbp,%r11), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x4(%rbp,%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0xc(%rbp,%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x4(%rbp,%r14), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0xc(%rbp,%r14), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x8(%rbp,%r8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x8(%rbp,%rdx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x4(%rbp,%r8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0xc(%rbp,%r8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x4(%rbp,%rdx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0xc(%rbp,%rdx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0x4(%rbp,%r12), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movss -0xc(%rbp,%r12), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movq 0x8(%rsp), %rax
movss -0x8(%rbp,%rax), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275e7
movss -0x8(%rbp,%rsi), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275e7
movq 0x8(%rsp), %rax
movss -0x4(%rbp,%rax), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275e7
movss -0xc(%rbp,%rax), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275e7
movss -0x4(%rbp,%rsi), %xmm1
ucomiss %xmm0, %xmm1
pushq $0x1
popq %rax
jbe 0x275ea
movss -0xc(%rbp,%rsi), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x275ea
movq %rsi, 0x68(%rsp)
movq %rdx, 0x38(%rsp)
movq 0x10(%rsp), %rdx
movslq 0x84(%rdx), %rsi
movq 0x78(%rdx), %rax
cmpl %esi, (%rsp)
movq %rcx, 0x88(%rsp)
jl 0x275ac
movq %r11, 0xa8(%rsp)
movq %r10, 0xb0(%rsp)
movsd %xmm3, 0xb8(%rsp)
movsd %xmm2, 0xc0(%rsp)
movl %r9d, 0x58(%rsp)
movq %r8, 0x60(%rsp)
movl %edi, (%rsp)
addq $0x1f4, %rsi            # imm = 0x1F4
movl %esi, 0x84(%rdx)
shlq $0x5, %rsi
testq %rax, %rax
je 0x2755b
movq %rax, %rdi
callq 0x9400
jmp 0x27563
movq %rsi, %rdi
callq 0x95e0
movq 0x10(%rsp), %rdx
movq %rax, 0x78(%rdx)
movsd 0x70(%rsp), %xmm9
movsd 0x98(%rsp), %xmm10
movl (%rsp), %edi
movq 0x60(%rsp), %r8
movl 0x58(%rsp), %r9d
movsd 0xc0(%rsp), %xmm2
movsd 0xb8(%rsp), %xmm3
movq 0xb0(%rsp), %r10
movq 0xa8(%rsp), %r11
movslq 0x80(%rdx), %rcx
leal 0x1(%rcx), %esi
movl %esi, (%rsp)
movl %esi, 0x80(%rdx)
shlq $0x5, %rcx
movl %r15d, 0x4(%rax,%rcx)
movl %r13d, 0x8(%rax,%rcx)
movl 0x18(%rsp), %edx
movl %edx, 0xc(%rax,%rcx)
movq 0x88(%rsp), %rcx
movq 0x38(%rsp), %rdx
movq 0x68(%rsp), %rsi
pushq $0x1
popq %rax
incl %r15d
addq $0x4, %rbp
jmp 0x27212
incl %r13d
jmp 0x27202
leaq (%rbp,%r10,4), %rbp
movl 0x18(%rsp), %eax
jmp 0x271ed
movq 0x10(%rsp), %rax
movq 0x78(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x90(%rsp), %rcx
movq %rcx, %rax
negq %rax
movq %rax, 0x8(%rsp)
movl 0x4c(%rsp), %eax
negl %eax
movslq %eax, %r14
leal -0x2(%rcx), %eax
movl %eax, 0x88(%rsp)
movq 0x50(%rsp), %rax
addl $-0x2, %eax
movq %rax, 0x50(%rsp)
movsd 0x5be2(%rip), %xmm11    # 0x2d238
movsd 0x40(%rsp), %xmm0
addsd %xmm0, %xmm11
mulsd %xmm11, %xmm11
cvtsi2sd %ebx, %xmm12
cvtsi2sd %edi, %xmm13
cvtsi2sdl 0x78(%rsp), %xmm14
cvtsi2sdl 0x80(%rsp), %xmm15
divsd %xmm0, %xmm11
xorl %edx, %edx
pushq $-0x1
popq %r13
movslq (%rsp), %rcx
movq 0x10(%rsp), %rax
movq 0x78(%rax), %rax
cmpq %rcx, %rdx
jge 0x27cfb
movq %rdx, 0x80(%rsp)
movq %rdx, %rcx
shlq $0x5, %rcx
movl 0x4(%rax,%rcx), %esi
movl 0x8(%rax,%rcx), %edx
movl 0xc(%rax,%rcx), %eax
movl %eax, 0x40(%rsp)
subl 0x78(%rsp), %eax
imull 0x4c(%rsp), %eax
cltq
movq %rax, 0x18(%rsp)
xorpd %xmm4, %xmm4
xorl %ecx, %ecx
xorl %r9d, %r9d
xorl %r8d, %r8d
xorpd %xmm3, %xmm3
xorpd %xmm1, %xmm1
cmpl $0x5, %r8d
je 0x27ad9
addl %ecx, %esi
addl %r9d, %edx
movslq %esi, %rax
movq 0xa0(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movl %edx, %ecx
movq 0x90(%rsp), %rdi
imull %edi, %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,4), %rax
movq 0x18(%rsp), %rcx
leaq (%rax,%rcx,4), %rbp
leaq (%rbp,%rdi,4), %rcx
movq 0x8(%rsp), %rax
leaq (%rbp,%rax,4), %r9
movq 0xc8(%rsp), %rax
movss (%rbp,%rax,4), %xmm6
movss (%rbp,%r14,4), %xmm4
cvtss2sd (%rbp), %xmm2
movss -0x4(%rbp), %xmm5
movss 0x4(%rbp), %xmm3
movss (%rbp,%rdi,4), %xmm0
unpcklps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
movss (%r9), %xmm0
unpcklps %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
movaps %xmm3, %xmm0
addps %xmm5, %xmm0
cvtps2pd %xmm0, %xmm1
movaps %xmm2, %xmm7
addsd %xmm2, %xmm7
movaps %xmm6, %xmm0
addss %xmm4, %xmm0
cvtss2sd %xmm0, %xmm0
subsd %xmm7, %xmm0
unpcklpd %xmm7, %xmm7            # xmm7 = xmm7[0,0]
subpd %xmm7, %xmm1
movss 0x4(%rbp,%rdi,4), %xmm7
addss -0x4(%r9), %xmm7
subss -0x4(%rbp,%rdi,4), %xmm7
movss 0x4(%r9), %xmm8
unpcklps %xmm7, %xmm6            # xmm6 = xmm6[0],xmm7[0],xmm6[1],xmm7[1]
movlhps %xmm6, %xmm3            # xmm3 = xmm3[0],xmm6[0]
unpcklps %xmm8, %xmm4            # xmm4 = xmm4[0],xmm8[0],xmm4[1],xmm8[1]
movlhps %xmm4, %xmm5            # xmm5 = xmm5[0],xmm4[0]
subps %xmm5, %xmm3
cvtps2pd %xmm3, %xmm4
movhlps %xmm3, %xmm3            # xmm3 = xmm3[1,1]
cvtps2pd %xmm3, %xmm3
mulpd 0x58ec(%rip), %xmm4     # 0x2d0b0
mulpd 0x58f4(%rip), %xmm3     # 0x2d0c0
movapd %xmm3, %xmm5
movsd %xmm1, %xmm5            # xmm5 = xmm1[0],xmm5[1]
movss 0x4(%rbp,%rax,4), %xmm6
movss (%rcx,%rax,4), %xmm7
unpcklps %xmm6, %xmm7            # xmm7 = xmm7[0],xmm6[0],xmm7[1],xmm6[1]
movss -0x4(%rbp,%r14,4), %xmm6
movss (%r9,%r14,4), %xmm8
unpcklps %xmm6, %xmm8            # xmm8 = xmm8[0],xmm6[0],xmm8[1],xmm6[1]
addps %xmm7, %xmm8
movss -0x4(%rbp,%rax,4), %xmm6
movss (%r9,%rax,4), %xmm7
unpcklps %xmm6, %xmm7            # xmm7 = xmm7[0],xmm6[0],xmm7[1],xmm6[1]
subps %xmm7, %xmm8
movss 0x4(%rbp,%r14,4), %xmm6
movss (%rcx,%r14,4), %xmm7
unpcklps %xmm6, %xmm7            # xmm7 = xmm7[0],xmm6[0],xmm7[1],xmm6[1]
subps %xmm7, %xmm8
movapd %xmm5, 0xd0(%rsp)
movsd %xmm0, 0x110(%rsp)
movapd %xmm3, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
cvtps2pd %xmm8, %xmm5
movapd 0x585c(%rip), %xmm7     # 0x2d0a0
movupd %xmm0, 0xe8(%rsp)
mulpd 0x587b(%rip), %xmm5     # 0x2d0d0
movhpd %xmm5, 0xe0(%rsp)
movupd %xmm5, 0xf8(%rsp)
movlpd %xmm5, 0x108(%rsp)
movapd %xmm4, %xmm0
xorpd %xmm7, %xmm0
movapd %xmm0, 0x20(%rsp)
movapd %xmm3, %xmm0
xorpd %xmm7, %xmm0
movlpd %xmm0, 0x30(%rsp)
leaq 0xd8(%rsp), %r9
leaq 0xd0(%rsp), %r15
movq %r15, %r10
pushq $0x48
popq %r11
xorl %eax, %eax
cmpq $0x3, %rax
je 0x27a09
leaq (%rax,%rax,2), %rcx
xorpd %xmm0, %xmm0
xorl %r12d, %r12d
xorpd %xmm5, %xmm5
movl %r13d, %ebx
leaq (%rax,%r12), %rdi
cmpq $0x3, %rdi
je 0x27914
movsd (%r15,%r12,8), %xmm6
movapd %xmm6, %xmm7
andpd 0x5803(%rip), %xmm7     # 0x2d0e0
leal (%rax,%r12), %edi
ucomisd %xmm5, %xmm7
movapd %xmm5, %xmm8
cmpltsd %xmm7, %xmm8
andpd %xmm8, %xmm6
andnpd %xmm0, %xmm8
orpd %xmm6, %xmm8
cmoval %edi, %ebx
maxsd %xmm5, %xmm7
incq %r12
movapd %xmm8, %xmm0
movapd %xmm7, %xmm5
jmp 0x278c1
movsd 0x6a04(%rip), %xmm6     # 0x2e320
ucomisd %xmm5, %xmm6
movapd 0x5778(%rip), %xmm7     # 0x2d0a0
ja 0x279f9
movslq %ebx, %rbx
leaq (%r10,%rbx,8), %r12
xorl %edi, %edi
cmpq %rdi, %r11
je 0x2795e
movsd (%r12,%rdi), %xmm5
movsd (%r15,%rdi), %xmm6
movsd %xmm6, (%r12,%rdi)
divsd %xmm0, %xmm5
movsd %xmm5, (%r15,%rdi)
addq $0x18, %rdi
jmp 0x27937
movsd 0x20(%rsp,%rax,8), %xmm5
movsd 0x20(%rsp,%rbx,8), %xmm6
movsd %xmm6, 0x20(%rsp,%rax,8)
movsd %xmm5, 0x20(%rsp,%rbx,8)
movsd 0x20(%rsp,%rax,8), %xmm5
divsd %xmm0, %xmm5
movsd %xmm5, 0x20(%rsp,%rax,8)
movq %r9, %rbx
movq %rax, %r12
cmpq $0x2, %r12
je 0x279e1
incq %r12
leaq (%r12,%rcx), %rdi
movsd 0xd0(%rsp,%rdi,8), %xmm0
xorpd %xmm7, %xmm0
xorl %edi, %edi
cmpq %rdi, %r11
je 0x279c7
movsd (%r15,%rdi), %xmm5
mulsd %xmm0, %xmm5
addsd (%rbx,%rdi), %xmm5
movsd %xmm5, (%rbx,%rdi)
addq $0x18, %rdi
jmp 0x279a8
mulsd 0x20(%rsp,%rax,8), %xmm0
addsd 0x20(%rsp,%r12,8), %xmm0
movsd %xmm0, 0x20(%rsp,%r12,8)
addq $0x8, %rbx
jmp 0x2798c
incq %rax
addq $0x20, %r15
addq $-0x18, %r11
addq $0x18, %r10
addq $0x20, %r9
jmp 0x278a5
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
pushq $0x2
popq %rcx
movq %rcx, %rax
subq $0x1, %rax
jb 0x27a52
leaq (%rcx,%rcx,2), %r9
movsd 0x20(%rsp,%rcx,8), %xmm0
xorpd %xmm7, %xmm0
testq %rcx, %rcx
jle 0x27a4d
decq %rcx
movl %ecx, %edi
leaq (%rdi,%r9), %r10
movsd 0xd0(%rsp,%r10,8), %xmm5
mulsd %xmm0, %xmm5
addsd 0x20(%rsp,%rdi,8), %xmm5
movsd %xmm5, 0x20(%rsp,%rdi,8)
jmp 0x27a23
movq %rax, %rcx
jmp 0x27a0f
movsd 0x20(%rsp), %xmm5
movsd 0x5750(%rip), %xmm0     # 0x2d1b0
ucomisd %xmm0, %xmm5
movsd 0x28(%rsp), %xmm6
seta %al
cmpl 0x88(%rsp), %esi
setl %cl
andb %al, %cl
movsd 0x5737(%rip), %xmm7     # 0x2d1b8
ucomisd %xmm5, %xmm7
movzbl %cl, %ecx
seta %al
cmpl $0x2, %esi
setge %dil
andb %al, %dil
movzbl %dil, %eax
subl %eax, %ecx
ucomisd %xmm0, %xmm6
seta %al
cmpl 0x50(%rsp), %edx
setl %dil
andb %al, %dil
movzbl %dil, %r9d
ucomisd %xmm6, %xmm7
seta %al
cmpl $0x2, %edx
setge %dil
andb %al, %dil
movzbl %dil, %eax
subl %eax, %r9d
incl %r8d
movl %r9d, %eax
orl %ecx, %eax
jne 0x276e5
jmp 0x27ae4
movsd 0x28(%rsp), %xmm6
cvtss2sd (%rbp), %xmm2
movapd %xmm4, %xmm0
unpckhpd %xmm4, %xmm0            # xmm0 = xmm0[1],xmm4[1]
mulsd %xmm6, %xmm0
mulsd %xmm5, %xmm4
addsd %xmm0, %xmm4
movsd 0x30(%rsp), %xmm0
movapd %xmm3, %xmm7
mulsd %xmm0, %xmm7
addsd %xmm4, %xmm7
mulsd 0x56ae(%rip), %xmm7     # 0x2d1c0
addsd %xmm2, %xmm7
andpd 0x55c2(%rip), %xmm7     # 0x2d0e0
ucomisd %xmm9, %xmm7
jbe 0x27ceb
movapd %xmm1, %xmm4
unpckhpd %xmm1, %xmm4            # xmm4 = xmm4[1],xmm1[1]
movapd %xmm1, %xmm2
addsd %xmm4, %xmm2
mulsd %xmm2, %xmm2
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
mulsd %xmm3, %xmm3
mulsd %xmm1, %xmm4
subsd %xmm3, %xmm4
divsd %xmm4, %xmm2
ucomisd %xmm2, %xmm11
jbe 0x27ceb
ucomisd 0x549c(%rip), %xmm2     # 0x2d000
movsd 0x566c(%rip), %xmm3     # 0x2d1d8
jb 0x27ceb
movapd %xmm5, %xmm1
movapd 0x5562(%rip), %xmm2     # 0x2d0e0
andpd %xmm2, %xmm1
ucomisd %xmm1, %xmm3
jbe 0x27ceb
movapd %xmm6, %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm1, %xmm3
jbe 0x27ceb
movapd %xmm0, %xmm1
andpd 0x5536(%rip), %xmm1     # 0x2d0e0
ucomisd %xmm1, %xmm3
jbe 0x27ceb
cvtsi2sd %esi, %xmm1
addsd %xmm1, %xmm5
ucomisd 0x543c(%rip), %xmm5     # 0x2d000
jb 0x27ceb
ucomisd %xmm5, %xmm12
jb 0x27ceb
cvtsi2sd %edx, %xmm1
addsd %xmm1, %xmm6
ucomisd 0x541b(%rip), %xmm6     # 0x2d000
jb 0x27ceb
ucomisd %xmm6, %xmm13
jb 0x27ceb
movl 0x40(%rsp), %ecx
cvtsi2sd %ecx, %xmm1
addsd %xmm1, %xmm0
ucomisd %xmm14, %xmm0
jb 0x27ceb
ucomisd %xmm0, %xmm15
jb 0x27ceb
movq 0x10(%rsp), %rbx
movl 0x3c(%rbx), %eax
movq 0x38(%rsp), %r15
movl %eax, (%r15)
movl %esi, 0x4(%r15)
movl %edx, 0x8(%r15)
movl %ecx, 0xc(%r15)
mulsd %xmm10, %xmm5
cvtsd2ss %xmm5, %xmm1
movss %xmm1, 0x10(%r15)
mulsd %xmm10, %xmm6
unpcklpd %xmm0, %xmm6            # xmm6 = xmm6[0],xmm0[0]
cvtpd2ps %xmm6, %xmm1
movlpd %xmm1, 0x14(%r15)
movsd 0x8(%rbx), %xmm1
movsd %xmm1, (%rsp)
cvtsi2sdl 0x2c(%rbx), %xmm1
divsd %xmm1, %xmm0
movsd %xmm11, 0x18(%rsp)
movsd %xmm12, 0x40(%rsp)
movsd %xmm13, 0x68(%rsp)
movsd %xmm14, 0x60(%rsp)
movsd %xmm15, 0x58(%rsp)
callq 0x9040
movsd 0x58(%rsp), %xmm15
movsd 0x60(%rsp), %xmm14
movsd 0x68(%rsp), %xmm13
movsd 0x40(%rsp), %xmm12
movsd 0x18(%rsp), %xmm11
movsd 0x98(%rsp), %xmm10
movsd 0x70(%rsp), %xmm9
mulsd (%rsp), %xmm0
mulsd %xmm10, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1c(%r15)
addq $0x20, %r15
movq %r15, 0x38(%rsp)
movl 0x80(%rbx), %eax
movl %eax, (%rsp)
movq 0x80(%rsp), %rdx
incq %rdx
jmp 0x2768c
movq 0x38(%rsp), %rcx
subq %rax, %rcx
shrq $0x5, %rcx
movq 0x10(%rsp), %rax
movl %ecx, 0x80(%rax)
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq