// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::invert(bool)
CImg<T>& invert(const bool use_LU=true) {
      if (_width!=_height || _depth!=1 || _spectrum!=1)
        throw CImgInstanceException(_cimg_instance
                                    "invert(): Instance is not a square matrix.",
                                    cimg_instance);
#ifdef cimg_use_lapack
      int INFO = (int)use_LU, N = _width, LWORK = 4*N, *const IPIV = new int[N];
      Tfloat
        *const lapA = new Tfloat[N*N],
        *const WORK = new Tfloat[LWORK];
      cimg_forXY(*this,k,l) lapA[k*N+l] = (Tfloat)((*this)(k,l));
      cimg::getrf(N,lapA,IPIV,INFO);
      if (INFO)
        cimg::warn(_cimg_instance
                   "invert(): LAPACK function dgetrf_() returned error code %d.",
                   cimg_instance,
                   INFO);
      else {
        cimg::getri(N,lapA,IPIV,WORK,LWORK,INFO);
        if (INFO)
          cimg::warn(_cimg_instance
                     "invert(): LAPACK function dgetri_() returned error code %d.",
                     cimg_instance,
                     INFO);
      }
      if (!INFO) cimg_forXY(*this,k,l) (*this)(k,l) = (T)(lapA[k*N+l]); else fill(0);
      delete[] IPIV; delete[] lapA; delete[] WORK;
#else
      const double dete = _width>3?-1.0:det();
      if (dete!=0.0 && _width==2) {
        const double
          a = _data[0], c = _data[1],
          b = _data[2], d = _data[3];
        _data[0] = (T)(d/dete); _data[1] = (T)(-c/dete);
        _data[2] = (T)(-b/dete); _data[3] = (T)(a/dete);
      } else if (dete!=0.0 && _width==3) {
        const double
          a = _data[0], d = _data[1], g = _data[2],
          b = _data[3], e = _data[4], h = _data[5],
          c = _data[6], f = _data[7], i = _data[8];
        _data[0] = (T)((i*e-f*h)/dete), _data[1] = (T)((g*f-i*d)/dete), _data[2] = (T)((d*h-g*e)/dete);
        _data[3] = (T)((h*c-i*b)/dete), _data[4] = (T)((i*a-c*g)/dete), _data[5] = (T)((g*b-a*h)/dete);
        _data[6] = (T)((b*f-e*c)/dete), _data[7] = (T)((d*c-a*f)/dete), _data[8] = (T)((a*e-d*b)/dete);
      } else {
        if (use_LU) { // LU-based inverse computation
          CImg<Tfloat> A(*this), indx, col(1,_width);
          bool d;
          A._LU(indx,d);
          cimg_forX(*this,j) {
            col.fill(0);
            col(j) = 1;
            col._solve(A,indx);
            cimg_forX(*this,i) (*this)(j,i) = (T)col(i);
          }
        } else { // SVD-based inverse computation
          CImg<Tfloat> U(_width,_width), S(1,_width), V(_width,_width);
          SVD(U,S,V,false);
          U.transpose();
          cimg_forY(S,k) if (S[k]!=0) S[k]=1/S[k];
          S.diagonal();
          *this = V*S*U;
        }
      }
#endif
      return *this;
    }

// Assembly:
subq $0x228, %rsp            # imm = 0x228
movb %sil, %al
movq %rdi, 0x220(%rsp)
andb $0x1, %al
movb %al, 0x21f(%rsp)
movq 0x220(%rsp), %rcx
movq %rcx, 0x78(%rsp)
movl (%rcx), %eax
cmpl 0x4(%rcx), %eax
jne 0x8d79
movq 0x78(%rsp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x8d79
movq 0x78(%rsp), %rax
cmpl $0x1, 0xc(%rax)
je 0x8e5c
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0x78(%rsp), %rax
movq %rcx, 0x48(%rsp)
movl (%rax), %ecx
movl %ecx, 0x50(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x54(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x58(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x5c(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x60(%rsp)
movb 0x10(%rax), %dl
leaq 0xdfc14(%rip), %rcx     # 0xe89d2
leaq 0xc0d1c(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x68(%rsp)
callq 0x118f0
movq %rax, 0x70(%rsp)
jmp 0x8ddd
movl 0x5c(%rsp), %r9d
movl 0x58(%rsp), %r8d
movl 0x54(%rsp), %ecx
movl 0x50(%rsp), %edx
movq 0x48(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %r10
movq 0x70(%rsp), %r11
movq %rsp, %rax
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0xe4393(%rip), %rsi     # 0xed1ab
xorl %eax, %eax
callq 0x11fd0
jmp 0x8e21
movq 0x48(%rsp), %rdi
leaq 0xf6d1b(%rip), %rsi     # 0xffb48
leaq 0x93dc(%rip), %rdx      # 0x12210
callq 0x5920
movq 0x48(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
callq 0x53a0
jmp 0x9842
movq 0x78(%rsp), %rax
cmpl $0x3, (%rax)
jbe 0x8e76
movsd 0xbf1a2(%rip), %xmm0    # 0xc8010
movsd %xmm0, 0x40(%rsp)
jmp 0x8e86
movq 0x78(%rsp), %rdi
callq 0xb6030
movsd %xmm0, 0x40(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x200(%rsp)
movsd 0x200(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x8eae
jp 0x8eae
jmp 0x8fa6
movq 0x78(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x8fa6
movq 0x78(%rsp), %rax
movq 0x18(%rax), %rcx
movsd (%rcx), %xmm0
movsd %xmm0, 0x1f8(%rsp)
movq 0x18(%rax), %rcx
movsd 0x8(%rcx), %xmm0
movsd %xmm0, 0x1f0(%rsp)
movq 0x18(%rax), %rcx
movsd 0x10(%rcx), %xmm0
movsd %xmm0, 0x1e8(%rsp)
movq 0x18(%rax), %rcx
movsd 0x18(%rcx), %xmm0
movsd %xmm0, 0x1e0(%rsp)
movsd 0x1e0(%rsp), %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, (%rcx)
movsd 0x1f0(%rsp), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, 0x8(%rcx)
movsd 0x1e8(%rsp), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, 0x10(%rcx)
movsd 0x1f8(%rsp), %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rax
movsd %xmm0, 0x18(%rax)
jmp 0x9835
movsd 0x200(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x8fbf
jp 0x8fbf
jmp 0x9374
movq 0x78(%rsp), %rax
cmpl $0x3, (%rax)
jne 0x9374
movq 0x78(%rsp), %rax
movq 0x18(%rax), %rcx
movsd (%rcx), %xmm0
movsd %xmm0, 0x1d8(%rsp)
movq 0x18(%rax), %rcx
movsd 0x8(%rcx), %xmm0
movsd %xmm0, 0x1d0(%rsp)
movq 0x18(%rax), %rcx
movsd 0x10(%rcx), %xmm0
movsd %xmm0, 0x1c8(%rsp)
movq 0x18(%rax), %rcx
movsd 0x18(%rcx), %xmm0
movsd %xmm0, 0x1c0(%rsp)
movq 0x18(%rax), %rcx
movsd 0x20(%rcx), %xmm0
movsd %xmm0, 0x1b8(%rsp)
movq 0x18(%rax), %rcx
movsd 0x28(%rcx), %xmm0
movsd %xmm0, 0x1b0(%rsp)
movq 0x18(%rax), %rcx
movsd 0x30(%rcx), %xmm0
movsd %xmm0, 0x1a8(%rsp)
movq 0x18(%rax), %rcx
movsd 0x38(%rcx), %xmm0
movsd %xmm0, 0x1a0(%rsp)
movq 0x18(%rax), %rcx
movsd 0x40(%rcx), %xmm0
movsd %xmm0, 0x198(%rsp)
movsd 0x198(%rsp), %xmm0
movsd 0x1b8(%rsp), %xmm2
movsd 0x1a0(%rsp), %xmm1
mulsd 0x1b0(%rsp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, (%rcx)
movsd 0x1c8(%rsp), %xmm0
movsd 0x1a0(%rsp), %xmm2
movsd 0x198(%rsp), %xmm1
mulsd 0x1d0(%rsp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, 0x8(%rcx)
movsd 0x1d0(%rsp), %xmm0
movsd 0x1b0(%rsp), %xmm2
movsd 0x1c8(%rsp), %xmm1
mulsd 0x1b8(%rsp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, 0x10(%rcx)
movsd 0x1b0(%rsp), %xmm0
movsd 0x1a8(%rsp), %xmm2
movsd 0x198(%rsp), %xmm1
mulsd 0x1c0(%rsp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, 0x18(%rcx)
movsd 0x198(%rsp), %xmm0
movsd 0x1d8(%rsp), %xmm2
movsd 0x1a8(%rsp), %xmm1
mulsd 0x1c8(%rsp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, 0x20(%rcx)
movsd 0x1c8(%rsp), %xmm0
movsd 0x1c0(%rsp), %xmm2
movsd 0x1d8(%rsp), %xmm1
mulsd 0x1b0(%rsp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, 0x28(%rcx)
movsd 0x1c0(%rsp), %xmm0
movsd 0x1a0(%rsp), %xmm2
movsd 0x1b8(%rsp), %xmm1
mulsd 0x1a8(%rsp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, 0x30(%rcx)
movsd 0x1d0(%rsp), %xmm0
movsd 0x1a8(%rsp), %xmm2
movsd 0x1d8(%rsp), %xmm1
mulsd 0x1a0(%rsp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rcx
movsd %xmm0, 0x38(%rcx)
movsd 0x1d8(%rsp), %xmm0
movsd 0x1b8(%rsp), %xmm2
movsd 0x1d0(%rsp), %xmm1
mulsd 0x1c0(%rsp), %xmm1
movq %xmm1, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x200(%rsp), %xmm0
movq 0x18(%rax), %rax
movsd %xmm0, 0x40(%rax)
jmp 0x9833
testb $0x1, 0x21f(%rsp)
je 0x9585
movq 0x78(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0xadb0
leaq 0x158(%rsp), %rdi
callq 0xb6c0
jmp 0x93a3
movq 0x78(%rsp), %rax
movl (%rax), %edx
leaq 0x138(%rsp), %rdi
movl $0x1, %r8d
movl %r8d, %esi
movl %r8d, %ecx
callq 0xa580
jmp 0x93c5
leaq 0x178(%rsp), %rdi
leaq 0x158(%rsp), %rsi
leaq 0x137(%rsp), %rdx
callq 0xb65c0
jmp 0x93e4
movl $0x0, 0x130(%rsp)
movq 0x78(%rsp), %rcx
movl 0x130(%rsp), %eax
cmpl (%rcx), %eax
jge 0x953a
leaq 0x138(%rsp), %rdi
movq %rdi, 0x38(%rsp)
xorps %xmm0, %xmm0
callq 0x5dfa0
movq 0x38(%rsp), %rdi
movl 0x130(%rsp), %esi
callq 0x897e0
movq 0x38(%rsp), %rdi
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, (%rax)
leaq 0x178(%rsp), %rsi
leaq 0x158(%rsp), %rdx
callq 0xb6ea0
jmp 0x9452
movl $0x0, 0x12c(%rsp)
movq 0x78(%rsp), %rcx
movl 0x12c(%rsp), %eax
cmpl (%rcx), %eax
jge 0x9522
movl 0x12c(%rsp), %esi
leaq 0x138(%rsp), %rdi
callq 0x897e0
movq 0x78(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movl 0x130(%rsp), %esi
movl 0x12c(%rsp), %edx
callq 0x9850
movq %rax, 0x30(%rsp)
jmp 0x94ae
movq 0x30(%rsp), %rax
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rax)
movl 0x12c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x12c(%rsp)
jmp 0x945d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x9573
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x9566
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0x138(%rsp), %rdi
callq 0xa540
jmp 0x9566
jmp 0x9524
movl 0x130(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x130(%rsp)
jmp 0x93ef
leaq 0x138(%rsp), %rdi
callq 0xa540
leaq 0x158(%rsp), %rdi
callq 0xa540
leaq 0x178(%rsp), %rdi
callq 0xa540
jmp 0x9831
leaq 0x158(%rsp), %rdi
callq 0xa540
leaq 0x178(%rsp), %rdi
callq 0xa540
jmp 0x9842
movq 0x78(%rsp), %rax
movl (%rax), %edx
leaq 0x108(%rsp), %rdi
movl $0x1, %r8d
movl %r8d, 0x24(%rsp)
movl %edx, %esi
movl %r8d, %ecx
callq 0xa580
movq 0x78(%rsp), %rax
movl 0x24(%rsp), %r8d
movl (%rax), %edx
leaq 0xe8(%rsp), %rdi
movl %r8d, %esi
movl %r8d, %ecx
callq 0xa580
jmp 0x95ca
movq 0x78(%rsp), %rax
movl (%rax), %edx
leaq 0xc8(%rsp), %rdi
movl $0x1, %r8d
movl %edx, %esi
movl %r8d, %ecx
callq 0xa580
jmp 0x95eb
movq 0x78(%rsp), %rdi
leaq 0x108(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
xorl %r8d, %r8d
movl $0x28, %r9d
xorps %xmm0, %xmm0
callq 0xb7140
jmp 0x961b
leaq 0x108(%rsp), %rdi
callq 0xba060
jmp 0x962a
movl $0x0, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
cmpl 0xec(%rsp), %eax
jge 0x9720
leaq 0xe8(%rsp), %rdi
callq 0x5cf30
movslq 0xc4(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x9673
jp 0x9673
jmp 0x9708
leaq 0xe8(%rsp), %rdi
callq 0x5cf30
movslq 0xc4(%rsp), %rcx
movsd 0xbe988(%rip), %xmm0    # 0xc8018
divsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x5cf30
movsd 0x18(%rsp), %xmm0
movslq 0xc4(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x9708
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x9822
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x9815
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x9808
jmp 0x970a
movl 0xc4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc4(%rsp)
jmp 0x9635
leaq 0xe8(%rsp), %rdi
callq 0xba240
jmp 0x972f
leaq 0x80(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0xba2b0
jmp 0x974e
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x108(%rsp), %rdx
callq 0xba2b0
jmp 0x976d
movq 0x78(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xba610
jmp 0x9781
leaq 0xa0(%rsp), %rdi
callq 0xa540
leaq 0x80(%rsp), %rdi
callq 0xa540
leaq 0xc8(%rsp), %rdi
callq 0xa540
leaq 0xe8(%rsp), %rdi
callq 0xa540
leaq 0x108(%rsp), %rdi
callq 0xa540
jmp 0x9831
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x97fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0xa540
leaq 0x80(%rsp), %rdi
callq 0xa540
leaq 0xc8(%rsp), %rdi
callq 0xa540
leaq 0xe8(%rsp), %rdi
callq 0xa540
leaq 0x108(%rsp), %rdi
callq 0xa540
jmp 0x9842
jmp 0x9833
jmp 0x9835
movq 0x78(%rsp), %rax
addq $0x228, %rsp            # imm = 0x228
retq
movq 0x210(%rsp), %rdi
callq 0x5970
nop