// File: /workspace/github_cpp_makefile_star2_O2/manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>& cimg_library::CImg<double>::solve<double>(cimg_library::CImg<double> const&)
CImg<T>& solve(const CImg<t>& A) {
      if (_width!=1 || _depth!=1 || _spectrum!=1 || _height!=A._height || A._depth!=1 || A._spectrum!=1)
        throw CImgArgumentException(_cimg_instance
                                    "solve(): Instance and specified matrix (%u,%u,%u,%u,%p) have "
                                    "incompatible dimensions.",
                                    cimg_instance,
                                    A._width,A._height,A._depth,A._spectrum,A._data);
      typedef _cimg_Ttfloat Ttfloat;
      if (A._width==A._height) {
#ifdef cimg_use_lapack
        char TRANS = 'N';
        int INFO, N = _height, LWORK = 4*N, *const IPIV = new int[N];
        Ttfloat
          *const lapA = new Ttfloat[N*N],
          *const lapB = new Ttfloat[N],
          *const WORK = new Ttfloat[LWORK];
        cimg_forXY(A,k,l) lapA[k*N+l] = (Ttfloat)(A(k,l));
        cimg_forY(*this,i) lapB[i] = (Ttfloat)((*this)(i));
        cimg::getrf(N,lapA,IPIV,INFO);
        if (INFO)
          cimg::warn(_cimg_instance
                     "solve(): LAPACK library function dgetrf_() returned error code %d.",
                     cimg_instance,
                     INFO);

        if (!INFO) {
          cimg::getrs(TRANS,N,lapA,IPIV,lapB,INFO);
          if (INFO)
            cimg::warn(_cimg_instance
                       "solve(): LAPACK library function dgetrs_() returned error code %d.",
                       cimg_instance,
                       INFO);
        }
        if (!INFO) cimg_forY(*this,i) (*this)(i) = (T)(lapB[i]); else fill(0);
        delete[] IPIV; delete[] lapA; delete[] lapB; delete[] WORK;
#else
        CImg<Ttfloat> lu(A,false);
        CImg<Ttfloat> indx;
        bool d;
        lu._LU(indx,d);
        _solve(lu,indx);
#endif
      } else { // Least-square solution for non-square systems.
#ifdef cimg_use_lapack
        char TRANS = 'N';
        int INFO, N = A._width, M = A._height, LWORK = -1, LDA = M, LDB = M, NRHS = _width;
        Ttfloat WORK_QUERY;
        Ttfloat
          * const lapA = new Ttfloat[M*N],
          * const lapB = new Ttfloat[M*NRHS];
        cimg::sgels(TRANS, M, N, NRHS, lapA, LDA, lapB, LDB, &WORK_QUERY, LWORK, INFO);
        LWORK = (int) WORK_QUERY;
        Ttfloat *const WORK = new Ttfloat[LWORK];
        cimg_forXY(A,k,l) lapA[k*M+l] = (Ttfloat)(A(k,l));
        cimg_forXY(*this,k,l) lapB[k*M+l] = (Ttfloat)((*this)(k,l));
        cimg::sgels(TRANS, M, N, NRHS, lapA, LDA, lapB, LDB, WORK, LWORK, INFO);
        if (INFO != 0)
          cimg::warn(_cimg_instance
                     "solve(): LAPACK library function sgels() returned error code %d.",
                     cimg_instance,
                     INFO);
        assign(NRHS, N);
        if (!INFO != 0)
          cimg_forXY(*this,k,l) (*this)(k,l) = (T)lapB[k*M+l];
        else
          assign(A.get_pseudoinvert()*(*this));
        delete[] lapA; delete[] lapB; delete[] WORK;
#else
        assign(A.get_pseudoinvert()*(*this));
#endif
      }
      return *this;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x1, (%rdi)
jne 0x6f9c
cmpl $0x1, 0x8(%rbx)
jne 0x6f9c
cmpl $0x1, 0xc(%rbx)
jne 0x6f9c
movl 0x4(%rbx), %eax
cmpl 0x4(%r14), %eax
jne 0x6f9c
cmpl $0x1, 0x8(%r14)
jne 0x6f9c
cmpl $0x1, 0xc(%r14)
jne 0x6f9c
cmpl %eax, (%r14)
jne 0x6f49
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x2aae8
leaq 0x30(%rsp), %rsi
andq $0x0, 0x18(%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
movb $0x0, 0x10(%rsi)
leaq 0xf(%rsp), %rdx
movq %r15, %rdi
callq 0x4c338
leaq 0x10(%rsp), %r14
leaq 0x30(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4c6de
movq %r15, %rdi
callq 0x6c96
movq %r14, %rdi
jmp 0x6f85
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x501cc
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x4dca0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x2ad88
leaq 0x10(%rsp), %rdi
callq 0x6c96
leaq 0x30(%rsp), %rdi
callq 0x6c96
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r15
movl (%rbx), %edx
movl 0x4(%rbx), %ecx
movl 0x8(%rbx), %r8d
movl 0xc(%rbx), %r9d
leaq 0x4d82b(%rip), %rax     # 0x547e8
leaq 0x4ebfe(%rip), %r10     # 0x55bc2
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
movl (%r14), %r11d
movl 0x4(%r14), %r12d
movl 0x8(%r14), %r13d
movl 0xc(%r14), %ebp
leaq 0x72377(%rip), %rsi     # 0x79359
movq %r15, %rdi
xorl %eax, %eax
pushq 0x18(%r14)
pushq %rbp
pushq %r13
pushq %r12
pushq %r11
leaq 0x6e0a6(%rip), %r11     # 0x7509f
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0x9d52
addq $0x40, %rsp
leaq 0x88c50(%rip), %rsi     # 0x8fc60
movq 0x88fc1(%rip), %rdx     # 0x8ffd8
movq %r15, %rdi
callq 0x4910
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6c96
jmp 0x7031
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x704a
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x6c96
leaq 0x10(%rsp), %rdi
callq 0x6c96
jmp 0x705c
movq %rax, %rbx
movq %r15, %rdi
callq 0x4390
movq %rbx, %rdi
callq 0x4950