// File: /workspace/github_cpp_makefile_star2_O3/manikandan5[P]Image-Matching-Stitching-Warping/siftpp/sift.cpp
// Function: VL::Sift::detectKeypoints(float, float)
void
Sift::detectKeypoints(VL::float_t threshold, VL::float_t edgeThreshold)
{
  keypoints.clear() ;

  int nValidatedKeypoints = 0 ;

  // Process one octave per time
  for(int o = omin ; o < omin + O ; ++o) {
        
    int const xo = 1 ;
    int const yo = getOctaveWidth(o) ;
    int const so = getOctaveWidth(o) * getOctaveHeight(o) ;
    int const ow = getOctaveWidth(o) ;
    int const oh = getOctaveHeight(o) ;

    VL::float_t xperiod = getOctaveSamplingPeriod(o) ;

    // -----------------------------------------------------------------
    //                                           Difference of Gaussians
    // -----------------------------------------------------------------
    pixel_t* dog = temp ;
    tempIsGrad = false ;
    {
      pixel_t* pt = dog ;
      for(int s = smin ; s <= smax-1 ; ++s) {
        pixel_t* srca = getLevel(o, s  ) ;
        pixel_t* srcb = getLevel(o, s+1) ;
        pixel_t* enda = srcb ;
        while( srca != enda ) {
          *pt++ = *srcb++ - *srca++ ;
        }
      }
    }
    
    // -----------------------------------------------------------------
    //                                           Find points of extremum
    // -----------------------------------------------------------------
    {
      pixel_t* pt  = dog + xo + yo + so ;
      for(int s = smin+1 ; s <= smax-2 ; ++s) {
        for(int y = 1 ; y < oh - 1 ; ++y) {
          for(int x = 1 ; x < ow - 1 ; ++x) {          
            pixel_t v = *pt ;
            
            // assert( (pt - x*xo - y*yo - (s-smin)*so) - dog == 0 ) ;
            
#define CHECK_NEIGHBORS(CMP,SGN)                    \
            ( v CMP ## = SGN 0.8 * threshold &&     \
              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(<,-) ) {
              
              Keypoint k ;
              k.ix = x ;
              k.iy = y ;
              k.is = s ;
              keypoints.push_back(k) ;
            }
            pt += 1 ;
          }
          pt += 2 ;
        }
        pt += 2*yo ;
      }
    }

    // -----------------------------------------------------------------
    //                                               Refine local maxima
    // -----------------------------------------------------------------
    { // refine
      KeypointsIter siter ;
      KeypointsIter diter ;
      
      for(diter = siter = keypointsBegin() + nValidatedKeypoints ; 
          siter != keypointsEnd() ; 
          ++siter) {
       
        int x = int( siter->ix ) ;
        int y = int( siter->iy ) ;
        int s = int( siter->is ) ;
                
        VL::float_t Dx=0,Dy=0,Ds=0,Dxx=0,Dyy=0,Dss=0,Dxy=0,Dxs=0,Dys=0 ;
        VL::float_t  b [3] ;
        pixel_t* pt ;
        int dx = 0 ;
        int dy = 0 ;

        // must be exec. at least once
        for(int iter = 0 ; iter < 5 ; ++iter) {

          VL::float_t A[3*3] ;          

          x += dx ;
          y += dy ;

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

#define at(dx,dy,ds) (*( pt + (dx)*xo + (dy)*yo + (ds)*so))
#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(int j = 0 ; j < 3 ; ++j) {

            // look for leading pivot
            VL::float_t maxa = 0 ;
            VL::float_t maxabsa = 0 ;
            int   maxi = -1 ;
            int i ;
            for(i = j ; i < 3 ; ++i) {
              VL::float_t a    = Aat(i,j) ;
              VL::float_t absa = fabsf( a ) ;
              if ( absa > maxabsa ) {
                maxa    = a ;
                maxabsa = absa ;
                maxi    = i ;
              }
            }

            // singular?
            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(int jj = j ; jj < 3 ; ++jj) {
              std::swap( Aat(j,jj) , Aat(i,jj) ) ;
              Aat(j,jj) /= maxa ;
            }
            std::swap( b[j], b[i] ) ;
            b[j] /= maxa ;

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

          // backward substitution
          for(int i = 2 ; i > 0 ; --i) {
            VL::float_t x = b[i] ;
            for(int 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 < ow-2) ?  1 : 0 )
            + ((b[0] < -0.6 && x > 1   ) ? -1 : 0 ) ;
          
          dy= ((b[1] >  0.6 && y < oh-2) ?  1 : 0 )
            + ((b[1] < -0.6 && y > 1   ) ? -1 : 0 ) ;

          /*          
          std::cout<<x<<","<<y<<"="<<at(0,0,0)
                   <<"("
                   <<at(0,0,0)+0.5 * (Dx * b[0] + Dy * b[1] + Ds * b[2])<<")"
                   <<" "<<std::flush ; 
          */

          if( dx == 0 && dy == 0 ) break ;
        }
        
        /* std::cout<<std::endl ; */
        
        // Accept-reject keypoint
        {
          VL::float_t val = at(0,0,0) + 0.5 * (Dx * b[0] + Dy * b[1] + Ds * b[2]) ; 
          VL::float_t score = (Dxx+Dyy)*(Dxx+Dyy) / (Dxx*Dyy - Dxy*Dxy) ; 
          VL::float_t xn = x + b[0] ;
          VL::float_t yn = y + b[1] ;
          VL::float_t sn = s + b[2] ;
          
          if(fast_abs(val) > threshold &&
             score < (edgeThreshold+1)*(edgeThreshold+1)/edgeThreshold && 
             score >= 0 &&
             fast_abs(b[0]) < 1.5 &&
             fast_abs(b[1]) < 1.5 &&
             fast_abs(b[2]) < 1.5 &&
             xn >= 0    &&
             xn <= ow-1 &&
             yn >= 0    &&
             yn <= oh-1 &&
             sn >= smin &&
             sn <= smax ) {
            
            diter->o  = o ;
       
            diter->ix = x ;
            diter->iy = y ;
            diter->is = s ;

            diter->x = xn * xperiod ; 
            diter->y = yn * xperiod ; 
            diter->s = sn ;

            diter->sigma = getScaleFromIndex(o,sn) ;

            ++diter ;
          }
        }
      } // next candidate keypoint

      // prepare for next octave
      keypoints.resize( diter - keypoints.begin() ) ;
      nValidatedKeypoints = keypoints.size() ;
    } // refine block

  } // next octave
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movaps %xmm0, %xmm11
movq 0x60(%rdi), %rdx
cmpq %rdx, 0x68(%rdi)
je 0x6b2f3
movq %rdx, 0x68(%rdi)
cmpl $0x0, 0xc(%rdi)
jle 0x6c27b
leaq 0x60(%rdi), %rax
movq %rax, 0x80(%rsp)
movl 0x14(%rdi), %eax
cvtss2sd %xmm11, %xmm2
movsd 0x2812f(%rip), %xmm3    # 0x93448
mulsd %xmm2, %xmm3
mulsd 0x2812b(%rip), %xmm2    # 0x93450
movss 0x2f83(%rip), %xmm0     # 0x6e2b0
addss %xmm1, %xmm0
mulss %xmm0, %xmm0
divss %xmm1, %xmm0
xorl %r11d, %r11d
movss 0x2f7b(%rip), %xmm13    # 0x6e2c0
movsd 0x2810a(%rip), %xmm14   # 0x93458
movss 0x280c5(%rip), %xmm15   # 0x9341c
movl %eax, %ecx
movss %xmm11, 0x54(%rsp)
movsd %xmm2, 0xe8(%rsp)
movsd %xmm3, 0xe0(%rsp)
movss %xmm0, 0xdc(%rsp)
movq %rdi, 0x48(%rsp)
movl %ecx, %r9d
subl %eax, %r9d
jl 0x6c28d
movl 0x20(%rdi), %r10d
movl %r10d, %esi
movl %ecx, 0x4(%rsp)
movl 0x4(%rsp), %ecx
sarl %cl, %esi
movl 0x4(%rsp), %eax
negl %eax
movl %eax, %ecx
shll %cl, %r10d
movl 0x24(%rdi), %ebx
movl %ebx, %r8d
movl 0x4(%rsp), %ecx
sarl %cl, %r8d
movl %eax, %ecx
shll %cl, %ebx
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
cmovnsl %esi, %r10d
movq %r10, 0x68(%rsp)
movq %rbx, %r10
cmovnsl %r8d, %r10d
movq %r11, 0x128(%rsp)
js 0x6b3ef
movl $0x1, %eax
shll %cl, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x74(%rsp)
jmp 0x6b411
movl $0x1, %esi
movl %eax, %ecx
shll %cl, %esi
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
movss 0x2ea9(%rip), %xmm1     # 0x6e2b0
divss %xmm0, %xmm1
movss %xmm1, 0x74(%rsp)
movq %r10, 0xf0(%rsp)
movl %r10d, %ebp
imull 0x68(%rsp), %ebp
movq 0x30(%rdi), %rax
movq %rax, 0xd0(%rsp)
movb $0x0, 0x3c(%rdi)
movl 0x18(%rdi), %r12d
movl 0x1c(%rdi), %eax
cmpl %eax, %r12d
jge 0x6b4c8
movslq %r12d, %rsi
movslq %eax, %rcx
movq 0x48(%rsp), %rdi
movq 0x48(%rdi), %r8
movslq %r9d, %rdi
movq (%r8,%rdi,8), %rdi
xorl %r8d, %r8d
movl %ebp, %r9d
movq 0xd0(%rsp), %r10
movq %rsi, %r11
incq %rsi
subl %r12d, %r11d
imull %ebp, %r11d
movl %esi, %ebx
subl %r12d, %ebx
imull %ebp, %ebx
cmpl %ebx, %r11d
je 0x6b4bd
movslq %r8d, %r14
leaq (%rdi,%r14,4), %r11
shlq $0x2, %r14
movslq %r9d, %r15
leaq (,%r15,4), %rbx
subq %r14, %rbx
leaq (%rdi,%r15,4), %r15
xorl %r14d, %r14d
movss (%r15,%r14), %xmm0
subss (%r11,%r14), %xmm0
movss %xmm0, (%r10,%r14)
addq $0x4, %r14
cmpq %r14, %rbx
jne 0x6b49f
addq %r14, %r10
addl %ebp, %r8d
addl %ebp, %r9d
cmpq %rcx, %rsi
jne 0x6b465
movslq 0x68(%rsp), %rcx
movq %rcx, 0x108(%rsp)
movslq %ebp, %rcx
movq %rcx, 0x100(%rsp)
leal -0x2(%rax), %ecx
cmpl %ecx, %r12d
movq 0x48(%rsp), %rdi
movl %ebp, 0x7c(%rsp)
movq 0xf0(%rsp), %r9
jge 0x6bae1
movq 0x100(%rsp), %rcx
leaq (,%rcx,4), %r8
movq 0x108(%rsp), %rdx
leaq (%r8,%rdx,4), %r10
movq 0xd0(%rsp), %rcx
leaq 0x4(%rcx,%r10), %rbx
leal (%rdx,%rdx), %ecx
movslq %ecx, %rcx
movq %rcx, 0x130(%rsp)
leal -0x2(%rdx), %r15d
leal -0x2(%r9), %esi
movq %r8, %rcx
negq %rcx
leaq (,%rdx,4), %r14
movq %rcx, %rdx
movq %r14, %rcx
subq %r8, %r14
movq %r14, 0x88(%rsp)
movq %rcx, %r13
negq %r13
movq %r8, %r14
subq %rcx, %r14
movq %r14, 0xc0(%rsp)
movq %r13, 0xc8(%rsp)
subq %r8, %r13
movq %r13, 0x60(%rsp)
movq %rcx, 0xf8(%rsp)
incl %r12d
cmpl $0x3, %r9d
jl 0x6bab6
movl %r12d, 0x78(%rsp)
movl $0x1, %r12d
cmpl $0x3, 0x68(%rsp)
jl 0x6ba95
leaq (%rbx,%r8), %r14
leaq (%rbx,%rdx), %rax
movq %rax, 0x40(%rsp)
leaq (%rbx,%rcx), %rax
movq %rax, 0x38(%rsp)
leaq (%rbx,%r10), %rax
movq %rax, 0x18(%rsp)
movq 0x88(%rsp), %rax
addq %rbx, %rax
movq %rax, 0x28(%rsp)
movq 0xc8(%rsp), %rax
addq %rbx, %rax
movq %rax, 0x20(%rsp)
movq 0xc0(%rsp), %rax
addq %rbx, %rax
movq %rax, 0x30(%rsp)
movq 0x60(%rsp), %rax
addq %rbx, %rax
movq %rax, 0x58(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %r13, %rax
incq %r13
movss (%rbx,%rax,4), %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
ucomisd %xmm3, %xmm1
jb 0x6b79a
ucomiss 0x4(%rbx,%rax,4), %xmm0
jbe 0x6b79a
ucomiss -0x4(%rbx,%rax,4), %xmm0
jbe 0x6b79a
ucomiss (%r14,%rax,4), %xmm0
jbe 0x6b79a
movq 0x40(%rsp), %r11
ucomiss (%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x38(%rsp), %r11
ucomiss (%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x20(%rsp), %r11
ucomiss (%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x38(%rsp), %r11
ucomiss 0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x38(%rsp), %r11
ucomiss -0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x20(%rsp), %r11
ucomiss 0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x20(%rsp), %r11
ucomiss -0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
ucomiss 0x4(%r14,%rax,4), %xmm0
jbe 0x6b79a
ucomiss -0x4(%r14,%rax,4), %xmm0
jbe 0x6b79a
movq 0x18(%rsp), %r11
ucomiss (%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x30(%rsp), %r11
ucomiss (%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x18(%rsp), %r11
ucomiss 0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x18(%rsp), %r11
ucomiss -0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x30(%rsp), %r11
ucomiss 0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x30(%rsp), %r11
ucomiss -0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x40(%rsp), %r11
ucomiss 0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x40(%rsp), %r11
ucomiss -0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x28(%rsp), %r11
ucomiss (%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x58(%rsp), %r11
ucomiss (%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x28(%rsp), %r11
ucomiss 0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x28(%rsp), %r11
ucomiss -0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x58(%rsp), %r11
ucomiss 0x4(%r11,%rax,4), %xmm0
jbe 0x6b79a
movq 0x58(%rsp), %r11
ucomiss -0x4(%r11,%rax,4), %xmm0
ja 0x6b9a3
ucomisd %xmm1, %xmm2
jb 0x6ba85
movss 0x4(%rbx,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movss -0x4(%rbx,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movss (%r14,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x40(%rsp), %r11
movss (%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x38(%rsp), %r11
movss (%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x20(%rsp), %r11
movss (%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x38(%rsp), %r11
movss 0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x38(%rsp), %r11
movss -0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x20(%rsp), %r11
movss 0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x20(%rsp), %r11
movss -0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movss 0x4(%r14,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movss -0x4(%r14,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x18(%rsp), %r11
movss (%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x30(%rsp), %r11
movss (%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x18(%rsp), %r11
movss 0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x18(%rsp), %r11
movss -0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x30(%rsp), %r11
movss 0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x30(%rsp), %r11
movss -0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x40(%rsp), %r11
movss 0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x40(%rsp), %r11
movss -0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x28(%rsp), %r11
movss (%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x58(%rsp), %r11
movss (%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x28(%rsp), %r11
movss 0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x28(%rsp), %r11
movss -0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x58(%rsp), %r11
movss 0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movq 0x58(%rsp), %r11
movss -0x4(%r11,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x6ba85
movl %esi, 0xd8(%rsp)
movl %r13d, 0x94(%rsp)
movl %r12d, 0x98(%rsp)
movl 0x78(%rsp), %eax
movl %eax, 0x9c(%rsp)
movq 0x68(%rdi), %rsi
cmpq 0x70(%rdi), %rsi
je 0x6b9f0
movups 0x90(%rsp), %xmm0
movups 0xa0(%rsp), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x20, 0x68(%rdi)
jmp 0x6ba7e
movq 0x80(%rsp), %rdi
movq %rdx, 0x110(%rsp)
leaq 0x90(%rsp), %rdx
movq %r8, 0x120(%rsp)
movq %r10, 0x118(%rsp)
callq 0x6d79c
movq 0xf8(%rsp), %rcx
movq 0x110(%rsp), %rdx
movq 0x118(%rsp), %r10
movq 0x120(%rsp), %r8
movq 0xf0(%rsp), %r9
movss 0x279ce(%rip), %xmm15   # 0x9341c
movsd 0x27a01(%rip), %xmm14   # 0x93458
movss 0x2860(%rip), %xmm13    # 0x6e2c0
movsd 0xe0(%rsp), %xmm3
movsd 0xe8(%rsp), %xmm2
movq 0x48(%rsp), %rdi
movss 0x54(%rsp), %xmm11
movl 0xd8(%rsp), %esi
addq $-0x4, %rbp
cmpl %r13d, %r15d
jne 0x6b60b
subq %rbp, %rbx
addq $0x8, %rbx
leal 0x1(%r12), %eax
cmpl %esi, %r12d
movl %eax, %r12d
jne 0x6b59f
movl 0x1c(%rdi), %eax
movl 0x7c(%rsp), %ebp
movl 0x78(%rsp), %r12d
movq 0x130(%rsp), %rcx
leaq (%rbx,%rcx,4), %rbx
leal -0x2(%rax), %ecx
cmpl %ecx, %r12d
movq 0xf8(%rsp), %rcx
jl 0x6b587
movq 0x80(%rsp), %rax
movq (%rax), %rdx
movslq 0x128(%rsp), %r8
shlq $0x5, %r8
addq %rdx, %r8
movq 0x68(%rdi), %rax
movq %rax, 0x88(%rsp)
cmpq %rax, %r8
je 0x6c204
movq 0x68(%rsp), %rcx
movl %ecx, %eax
negl %eax
cltq
movq %rax, 0x40(%rsp)
movl %ebp, %eax
negl %eax
movslq %eax, %r12
leal -0x2(%rcx), %eax
movl %eax, 0x38(%rsp)
leal -0x2(%r9), %r13d
leal -0x1(%rcx), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, 0xc8(%rsp)
decl %r9d
xorps %xmm0, %xmm0
cvtsi2ss %r9d, %xmm0
movss %xmm0, 0xc0(%rsp)
xorps %xmm0, %xmm0
cvtsi2ssl 0x4(%rsp), %xmm0
movss %xmm0, 0x28(%rsp)
movq %r8, 0x60(%rsp)
movl 0x4(%r8), %esi
movl 0x8(%r8), %edx
movq %r8, 0x20(%rsp)
movl 0xc(%r8), %eax
movl 0x18(%rdi), %ecx
movl %eax, 0x18(%rsp)
movl %ecx, 0x30(%rsp)
subl %ecx, %eax
imull 0x7c(%rsp), %eax
movslq %eax, %r8
xorl %r9d, %r9d
xorl %edi, %edi
xorl %eax, %eax
movl %esi, %ecx
movl %edx, %esi
movl %edi, %edx
addl %esi, %edx
movl %eax, %esi
addl %ecx, %esi
movslq %esi, %rax
movq 0xd0(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movl %edx, %ecx
imull 0x68(%rsp), %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,4), %rax
leaq (%rax,%r8,4), %rdi
movss -0x4(%rdi), %xmm0
movss 0x4(%rdi), %xmm2
movq 0x108(%rsp), %rax
leaq (%rdi,%rax,4), %rax
movss (%rax), %xmm5
movq 0x40(%rsp), %rcx
leaq (%rdi,%rcx,4), %r10
movss (%r10), %xmm7
movq 0x100(%rsp), %rcx
movss (%rdi,%rcx,4), %xmm6
movss (%rdi,%r12,4), %xmm8
movaps %xmm6, %xmm3
subss %xmm8, %xmm3
movaps %xmm2, %xmm1
addss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm1
cvtss2sd (%rdi), %xmm4
movaps %xmm4, %xmm9
mulsd %xmm14, %xmm9
addsd %xmm9, %xmm1
cvtsd2ss %xmm1, %xmm1
unpcklps %xmm5, %xmm2            # xmm2 = xmm2[0],xmm5[0],xmm2[1],xmm5[1]
addss %xmm7, %xmm5
cvtss2sd %xmm5, %xmm5
addsd %xmm9, %xmm5
cvtsd2ss %xmm5, %xmm5
addss %xmm8, %xmm6
cvtss2sd %xmm6, %xmm6
addsd %xmm9, %xmm6
xorps %xmm8, %xmm8
cvtsd2ss %xmm6, %xmm8
movss 0x4(%rdi,%rcx,4), %xmm6
movss 0x4(%rax), %xmm9
unpcklps %xmm6, %xmm9            # xmm9 = xmm9[0],xmm6[0],xmm9[1],xmm6[1]
movss -0x4(%rdi,%r12,4), %xmm10
movss -0x4(%r10), %xmm6
unpcklps %xmm10, %xmm6           # xmm6 = xmm6[0],xmm10[0],xmm6[1],xmm10[1]
addps %xmm9, %xmm6
movss -0x4(%rdi,%rcx,4), %xmm9
movss -0x4(%rax), %xmm10
unpcklps %xmm9, %xmm10           # xmm10 = xmm10[0],xmm9[0],xmm10[1],xmm9[1]
subps %xmm10, %xmm6
movss 0x4(%rdi,%r12,4), %xmm9
movss 0x4(%r10), %xmm10
unpcklps %xmm9, %xmm10           # xmm10 = xmm10[0],xmm9[0],xmm10[1],xmm9[1]
movss (%rax,%rcx,4), %xmm9
addss (%r10,%r12,4), %xmm9
subss (%r10,%rcx,4), %xmm9
subss (%rax,%r12,4), %xmm9
subps %xmm10, %xmm6
movss %xmm1, 0x90(%rsp)
movss %xmm5, 0xa0(%rsp)
movss %xmm8, 0xb0(%rsp)
mulps 0x277cb(%rip), %xmm6    # 0x934a0
movss %xmm6, 0x9c(%rsp)
movlps %xmm6, 0x94(%rsp)
movaps %xmm6, %xmm8
shufps $0x55, %xmm6, %xmm8     # xmm8 = xmm8[1,1],xmm6[1,1]
movss %xmm8, 0xa8(%rsp)
mulss %xmm15, %xmm9
movss %xmm9, 0xa4(%rsp)
movss %xmm9, 0xac(%rsp)
unpcklps %xmm7, %xmm0            # xmm0 = xmm0[0],xmm7[0],xmm0[1],xmm7[1]
mulss %xmm13, %xmm3
subps %xmm0, %xmm2
mulps 0x2778c(%rip), %xmm2    # 0x934b0
movaps %xmm2, %xmm0
movaps 0x2452(%rip), %xmm7     # 0x6e180
xorps %xmm7, %xmm0
movlps %xmm0, 0x8(%rsp)
movaps %xmm3, %xmm0
xorps %xmm7, %xmm0
movss %xmm0, 0x10(%rsp)
movl $0x24, %r10d
movl $0x1, %r11d
leaq 0x90(%rsp), %rbp
movq %rbp, %r14
xorl %eax, %eax
leaq (%rax,%rax,2), %rdi
xorps %xmm7, %xmm7
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %r15d, %r15d
xorps %xmm8, %xmm8
movaps 0x23aa(%rip), %xmm12    # 0x6e120
movaps %xmm7, %xmm9
movss (%rbp,%r15,4), %xmm10
movaps %xmm10, %xmm7
andps %xmm12, %xmm7
leal (%rax,%r15), %ebx
ucomiss %xmm9, %xmm7
movaps %xmm9, %xmm0
cmpltss %xmm7, %xmm0
andps %xmm0, %xmm10
andnps %xmm8, %xmm0
orps %xmm10, %xmm0
maxss %xmm9, %xmm7
cmoval %ebx, %ecx
leaq (%rax,%r15), %rbx
incq %rbx
incq %r15
movaps %xmm0, %xmm8
cmpq $0x3, %rbx
jne 0x6bd76
movss 0x27655(%rip), %xmm8    # 0x93420
ucomiss %xmm7, %xmm8
ja 0x6becf
movslq %ecx, %rcx
leaq (%r14,%rcx,4), %r15
xorl %ebx, %ebx
movss (%rbp,%rbx), %xmm7
movss (%r15,%rbx), %xmm8
movss %xmm8, (%rbp,%rbx)
movss %xmm7, (%r15,%rbx)
movss (%rbp,%rbx), %xmm7
divss %xmm0, %xmm7
movss %xmm7, (%rbp,%rbx)
addq $0xc, %rbx
cmpq %rbx, %r10
jne 0x6bdde
movss 0x8(%rsp,%rax,4), %xmm7
movss 0x8(%rsp,%rcx,4), %xmm8
movss %xmm8, 0x8(%rsp,%rax,4)
movss %xmm7, 0x8(%rsp,%rcx,4)
movss 0x8(%rsp,%rax,4), %xmm7
divss %xmm0, %xmm7
movss %xmm7, 0x8(%rsp,%rax,4)
movq %rax, %rcx
cmpq $0x1, %rax
movaps 0x2337(%rip), %xmm8     # 0x6e180
ja 0x6bee8
leaq (%rcx,%rdi), %rbx
movss 0x94(%rsp,%rbx,4), %xmm0
xorps %xmm8, %xmm0
leaq (%r11,%rcx), %rbx
leaq (%rsp,%rbx,4), %r15
addq $0x90, %r15
xorl %ebx, %ebx
movss (%rbp,%rbx), %xmm7
mulss %xmm0, %xmm7
addss (%r15,%rbx), %xmm7
movss %xmm7, (%r15,%rbx)
addq $0xc, %rbx
cmpq %rbx, %r10
jne 0x6be71
mulss 0x8(%rsp,%rax,4), %xmm0
addss 0xc(%rsp,%rcx,4), %xmm0
movss %xmm0, 0xc(%rsp,%rcx,4)
testq %rcx, %rcx
movl $0x1, %ecx
je 0x6be4f
leaq 0x1(%rax), %rcx
addq $0x10, %rbp
addq $0xc, %r14
addq $-0xc, %r10
addq $0x3, %r11
cmpq $0x2, %rax
movq %rcx, %rax
jb 0x6bd5b
jmp 0x6bee8
movq $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movaps 0x2298(%rip), %xmm8     # 0x6e180
movl $0x2, %edi
movl $0x3, %eax
leaq 0xac(%rsp), %rcx
movss 0x8(%rsp,%rdi,4), %xmm0
xorps %xmm8, %xmm0
movq %rcx, %r10
movq %rax, %r11
movss (%r10), %xmm7
mulss %xmm0, %xmm7
addss (%rsp,%r11,4), %xmm7
movss %xmm7, (%rsp,%r11,4)
decq %r11
addq $-0x4, %r10
cmpq $0x1, %r11
ja 0x6bf0a
leaq -0x1(%rdi), %r10
decq %rax
addq $-0x10, %rcx
cmpq $0x1, %rdi
movq %r10, %rdi
ja 0x6befa
movss 0x8(%rsp), %xmm7
xorps %xmm0, %xmm0
cvtss2sd %xmm7, %xmm0
movsd 0x2750a(%rip), %xmm9    # 0x93460
ucomisd %xmm9, %xmm0
seta %cl
movss 0xc(%rsp), %xmm8
cmpl 0x38(%rsp), %esi
setl %al
andb %cl, %al
movsd 0x274f1(%rip), %xmm10   # 0x93468
ucomisd %xmm0, %xmm10
seta %dil
cmpl $0x2, %esi
setge %cl
andb %dil, %cl
xorps %xmm0, %xmm0
cvtss2sd %xmm8, %xmm0
ucomisd %xmm9, %xmm0
seta %r10b
cmpl %r13d, %edx
setl %dil
andb %r10b, %dil
ucomisd %xmm0, %xmm10
seta %r11b
cmpl $0x2, %edx
setge %r10b
andb %r11b, %r10b
cmpb %cl, %al
jne 0x6bfc3
movl %edi, %r11d
xorb %r10b, %r11b
je 0x6bfe3
movzbl %dil, %edi
movzbl %r10b, %r10d
subl %r10d, %edi
movzbl %al, %eax
movzbl %cl, %ecx
subl %ecx, %eax
incl %r9d
cmpl $0x5, %r9d
jne 0x6bb8f
movaps %xmm2, %xmm0
shufps $0x55, %xmm2, %xmm0     # xmm0 = xmm0[1,1],xmm2[1,1]
mulss %xmm8, %xmm0
mulss %xmm7, %xmm2
addss %xmm0, %xmm2
movss 0x10(%rsp), %xmm0
mulss %xmm0, %xmm3
addss %xmm2, %xmm3
xorps %xmm2, %xmm2
cvtss2sd %xmm3, %xmm2
mulsd 0x2054(%rip), %xmm2     # 0x6e068
addsd %xmm4, %xmm2
cvtsd2ss %xmm2, %xmm2
movaps 0x20fd(%rip), %xmm3     # 0x6e120
andps %xmm3, %xmm2
ucomiss %xmm11, %xmm2
jbe 0x6c1d6
movaps %xmm1, %xmm2
addss %xmm5, %xmm2
mulss %xmm2, %xmm2
mulss %xmm6, %xmm6
mulss %xmm5, %xmm1
subss %xmm6, %xmm1
divss %xmm1, %xmm2
movss 0xdc(%rsp), %xmm1
ucomiss %xmm2, %xmm1
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %r8
jbe 0x6c1e0
ucomiss 0x229a(%rip), %xmm2     # 0x6e308
jb 0x6c1e0
movaps %xmm7, %xmm1
andps %xmm3, %xmm1
movss 0x273a2(%rip), %xmm2    # 0x93424
ucomiss %xmm1, %xmm2
jbe 0x6c1e0
movaps %xmm8, %xmm1
andps %xmm3, %xmm1
ucomiss %xmm1, %xmm2
jbe 0x6c1e0
movaps %xmm0, %xmm1
andps %xmm3, %xmm1
ucomiss %xmm1, %xmm2
jbe 0x6c1e0
xorps %xmm1, %xmm1
cvtsi2ss %esi, %xmm1
addss %xmm1, %xmm7
ucomiss 0x224c(%rip), %xmm7     # 0x6e308
jb 0x6c1e0
movss 0xc8(%rsp), %xmm1
ucomiss %xmm7, %xmm1
jb 0x6c1e0
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
addss %xmm1, %xmm8
ucomiss 0x2220(%rip), %xmm8     # 0x6e308
jb 0x6c1e0
movss 0xc0(%rsp), %xmm1
ucomiss %xmm8, %xmm1
jb 0x6c1e0
movl 0x18(%rsp), %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
xorps %xmm2, %xmm2
cvtsi2ssl 0x30(%rsp), %xmm2
addss %xmm1, %xmm0
ucomiss %xmm2, %xmm0
jb 0x6c1e0
xorps %xmm1, %xmm1
cvtsi2ssl 0x1c(%rdi), %xmm1
ucomiss %xmm0, %xmm1
jb 0x6c1e0
movl 0x4(%rsp), %eax
movq 0x60(%rsp), %rbx
movl %eax, (%rbx)
movl %esi, 0x4(%rbx)
movl %edx, 0x8(%rbx)
movl %ecx, 0xc(%rbx)
movss 0x74(%rsp), %xmm1
mulss %xmm1, %xmm7
movss %xmm7, 0x10(%rbx)
mulss %xmm1, %xmm8
movss %xmm8, 0x14(%rbx)
movss %xmm0, 0x18(%rbx)
xorps %xmm1, %xmm1
cvtsi2ssl 0x10(%rdi), %xmm1
movss 0x4(%rdi), %xmm2
movss %xmm2, 0x18(%rsp)
divss %xmm1, %xmm0
addss 0x28(%rsp), %xmm0
callq 0x4a90
movq 0x20(%rsp), %r8
movss 0x27286(%rip), %xmm15   # 0x9341c
movsd 0x272b9(%rip), %xmm14   # 0x93458
movss 0x2118(%rip), %xmm13    # 0x6e2c0
movq 0x48(%rsp), %rdi
movss 0x54(%rsp), %xmm11
mulss 0x18(%rsp), %xmm0
movss %xmm0, 0x1c(%rbx)
addq $0x20, %rbx
movq %rbx, 0x60(%rsp)
movq 0x68(%rdi), %rax
movq %rax, 0x88(%rsp)
jmp 0x6c1e0
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %r8
addq $0x20, %r8
cmpq 0x88(%rsp), %r8
jne 0x6bb62
movq 0x80(%rsp), %rdi
movq (%rdi), %rdx
movq 0x60(%rsp), %rsi
jmp 0x6c20f
movq %r8, %rsi
movq 0x80(%rsp), %rdi
subq %rdx, %rsi
sarq $0x5, %rsi
callq 0x6d768
movq 0x48(%rsp), %rdi
movq 0x68(%rdi), %r11
movq 0x60(%rdi), %rdx
subq %rdx, %r11
sarq $0x5, %r11
movl 0x4(%rsp), %esi
incl %esi
movl 0x14(%rdi), %eax
movl 0xc(%rdi), %ecx
addl %eax, %ecx
cmpl %ecx, %esi
movl %esi, %ecx
movss 0x54(%rsp), %xmm11
movsd 0xe8(%rsp), %xmm2
movsd 0xe0(%rsp), %xmm3
movss 0x205d(%rip), %xmm13    # 0x6e2c0
movsd 0x271ec(%rip), %xmm14   # 0x93458
movss 0x271a7(%rip), %xmm15   # 0x9341c
jl 0x6b380
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x27307(%rip), %rdi     # 0x9359b
leaq 0x2731a(%rip), %rsi     # 0x935b5
leaq 0x27323(%rip), %rcx     # 0x935c5
movl $0x59, %edx
callq 0x4340