// File: /workspace/github_cpp_makefile_star2_O2/manikandan5[P]Image-Matching-Stitching-Warping/./Sift.h
// Function: Sift::compute_sift(cimg_library::CImg<float> const&)
static vector<SiftDescriptor> compute_sift(const CImg<float> &luma)
    {
      bool lowe_compatible = true;
      bool norm = true;
      
      vector<SiftDescriptor> descriptors;

      typedef vector<pair<VL::Sift::Keypoint,VL::float_t> > Keypoints ;

      //      if(lowe_compatible)
      //	luma /= 255.0;
      
      VL::PgmBuffer buffer;
      buffer.height = luma.height();
      buffer.width = luma.width();
      buffer.data = (VL::pixel_t *)luma.data();
      
      // ---------------------------------------------------------------
      //                                            Gaussian scale space
      // ---------------------------------------------------------------    
      int         O      = octaves ;    
      int const   S      = levels ;
      int const   omin   = first ;
      float const sigman = .5 ;
      float const sigma0 = 1.6 * powf(2.0f, 1.0f / S) ;
      

      if(O < 1 || lowe_compatible) {
	O = std::max
	  (int
	   (std::floor
	    (log2
	     (std::min(luma.height(), luma.width()))) - omin -3), 1) ;
      }

      // initialize scalespace
      VL::Sift sift(buffer.data, buffer.width, buffer.height, 
		    sigman, sigma0,
		    O, S,
		    omin, -1, S+1) ;
	
      sift.detectKeypoints(threshold, edgeThreshold) ;


      /* set descriptor options */
      sift.setNormalizeDescriptor( norm || lowe_compatible); //! unnormalized ) ;
      sift.setMagnification( magnif ) ;

      // -------------------------------------------------------------
      //            Run detector, compute orientations and descriptors
      // -------------------------------------------------------------
      
      for( VL::Sift::KeypointsConstIter iter = sift.keypointsBegin() ;
	   iter != sift.keypointsEnd() ; ++iter ) {
	    
	// detect orientations
	VL::float_t angles [4] ;
	int nangles ;
	nangles = sift.computeKeypointOrientations(angles, *iter) ;
	    
	// compute descriptors
	for(int a = 0 ; a < nangles ; ++a) {

	  /* compute descriptor */
	  VL::float_t descr_pt [128] ;
	  sift.computeKeypointDescriptor(descr_pt, *iter, angles[a]) ;

	  if(lowe_compatible)
	    for(int j=0; j<128; j++)
	      descr_pt[j] = (unsigned char)(descr_pt[j] * 512);

	  descriptors.push_back(SiftDescriptor(iter->y, iter->x, iter->sigma, angles[a], descr_pt));

	} // next angle
      } // next keypoint

      return descriptors;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x318, %rsp            # imm = 0x318
movq %rdi, %rbx
xorpd %xmm0, %xmm0
andq $0x0, 0x10(%rdi)
movupd %xmm0, (%rdi)
movl (%rsi), %ebp
movl 0x4(%rsi), %r14d
movq 0x18(%rsi), %r15
cmpl %r14d, %ebp
movl %r14d, %edi
cmovll %ebp, %edi
callq 0x43a93
callq 0x4900
addsd 0x286e8(%rip), %xmm0    # 0x54010
addsd 0x28708(%rip), %xmm0    # 0x54038
cvttsd2si %xmm0, %eax
cmpl $0x2, %eax
pushq $0x1
popq %r8
cmovgel %eax, %r8d
orl $-0x1, 0x8(%rsp)
movl $0x4, 0x10(%rsp)
orl $-0x1, (%rsp)
leaq 0x98(%rsp), %rdi
movss 0x288d0(%rip), %xmm0    # 0x54230
movss 0x28908(%rip), %xmm1    # 0x54270
pushq $0x3
popq %r9
movq %r15, %rsi
movl %ebp, %edx
movl %r14d, %ecx
callq 0x50e30
leaq 0x98(%rsp), %rdi
movss 0x288eb(%rip), %xmm0    # 0x54274
movss 0x288e7(%rip), %xmm1    # 0x54278
callq 0x515d2
leaq 0x98(%rsp), %rax
movb $0x1, 0x2c(%rax)
movl $0x40400000, 0x28(%rax) # imm = 0x40400000
movq 0x60(%rax), %r14
leaq 0x110(%rsp), %r13
leaq 0x70(%rsp), %rbp
cmpq 0x100(%rsp), %r14
je 0x2badc
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps 0x50(%rsp), %xmm0
movaps 0x60(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x52524
movl %eax, %r12d
testl %eax, %eax
movl $0x0, %eax
cmovlel %eax, %r12d
xorl %r15d, %r15d
cmpq %r12, %r15
je 0x2bad3
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movaps %xmm0, 0x30(%rsp)
movaps %xmm1, 0x40(%rsp)
movss 0x20(%rsp,%r15,4), %xmm0
movaps 0x30(%rsp), %xmm1
movaps 0x40(%rsp), %xmm2
movups %xmm2, 0x10(%rsp)
movups %xmm1, (%rsp)
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x52aa4
xorl %eax, %eax
movss 0x2881b(%rip), %xmm1    # 0x5427c
cmpq $0x80, %rax
je 0x2ba8f
movss 0x110(%rsp,%rax,4), %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movzbl %cl, %ecx
cvtsi2ss %ecx, %xmm0
movss %xmm0, 0x110(%rsp,%rax,4)
incq %rax
jmp 0x2ba61
movss 0x10(%r14), %xmm1
movss 0x14(%r14), %xmm0
movss 0x1c(%r14), %xmm2
movss 0x20(%rsp,%r15,4), %xmm3
movq %rbp, %rdi
movq %r13, %rsi
callq 0x43a9c
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x43ac8
leaq 0x80(%rsp), %rdi
callq 0x848c
incq %r15
jmp 0x2ba11
addq $0x20, %r14
jmp 0x2b9ba
leaq 0x98(%rsp), %rdi
callq 0x512ec
movq %rbx, %rax
addq $0x318, %rsp            # imm = 0x318
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2bb09
movq %rax, %r15
jmp 0x2bb2b
jmp 0x2bb09
jmp 0x2bb09
movq %rax, %r15
jmp 0x2bb1e
movq %rax, %r15
leaq 0x80(%rsp), %rdi
callq 0x848c
leaq 0x98(%rsp), %rdi
callq 0x512ec
movq %rbx, %rdi
callq 0x7f7a
movq %r15, %rdi
callq 0x4950
nop