// File: /workspace/github_cpp_makefile_star2_O1/manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::RGBtoHSI()
CImg<T>& RGBtoHSI() {
      if (_spectrum!=3)
        throw CImgInstanceException(_cimg_instance
                                    "RGBtoHSI(): Instance is not a RGB image.",
                                    cimg_instance);

      T *p1 = data(0,0,0,0), *p2 = data(0,0,0,1), *p3 = data(0,0,0,2);
      for (unsigned long N = (unsigned long)_width*_height*_depth; N; --N) {
        const Tfloat
          R = (Tfloat)*p1,
          G = (Tfloat)*p2,
          B = (Tfloat)*p3,
          nR = (R<0?0:(R>255?255:R))/255,
          nG = (G<0?0:(G>255?255:G))/255,
          nB = (B<0?0:(B>255?255:B))/255,
          m = cimg::min(nR,nG,nB),
          theta = (Tfloat)(std::acos(0.5f*((nR-nG)+(nR-nB))/std::sqrt(std::pow(nR-nG,2)+(nR-nB)*(nG-nB)))*180/cimg::PI),
          sum = nR + nG + nB;
        Tfloat H = 0, S = 0, I = 0;
        if (theta>0) H = (nB<=nG)?theta:360-theta;
        if (sum>0) S = 1 - 3/sum*m;
        I = sum/3;
        *(p1++) = (T)H;
        *(p2++) = (T)S;
        *(p3++) = (T)I;
      }
      return *this;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
cmpl $0x3, 0xc(%rdi)
jne 0x5c458
movl (%rbx), %eax
movl 0x4(%rbx), %r14d
imulq %rax, %r14
movl 0x8(%rbx), %eax
movq %r14, %r15
imulq %rax, %r15
testq %r15, %r15
je 0x5c447
movq 0x18(%rbx), %r13
imulq %rax, %r14
movq %r14, %r12
shlq $0x4, %r12
movsd (%r13), %xmm2
movsd 0x14d58(%rip), %xmm1    # 0x71008
movapd %xmm1, %xmm0
minsd %xmm2, %xmm0
divsd %xmm1, %xmm0
xorpd %xmm3, %xmm3
cmpltsd %xmm3, %xmm2
andnpd %xmm0, %xmm2
movsd (%r13,%r14,8), %xmm4
movhpd (%r13,%r12), %xmm4      # xmm4 = xmm4[0],mem[0]
movapd 0x14f81(%rip), %xmm1    # 0x71260
movapd %xmm1, %xmm0
minpd %xmm4, %xmm0
divpd %xmm1, %xmm0
cmpnltpd 0x14dfc(%rip), %xmm4    # 0x710f0
andpd %xmm0, %xmm4
pshufd $0xee, %xmm4, %xmm5     # xmm5 = xmm4[2,3,2,3]
movapd %xmm2, 0x20(%rsp)
movapd %xmm2, %xmm1
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
subpd %xmm4, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
movapd %xmm1, %xmm6
addsd %xmm2, %xmm6
mulsd 0x14d49(%rip), %xmm6    # 0x71070
mulsd %xmm1, %xmm1
movaps %xmm4, 0x30(%rsp)
movapd %xmm4, %xmm0
movdqa %xmm5, 0x10(%rsp)
subsd %xmm5, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
ucomisd %xmm3, %xmm0
jb 0x5c352
sqrtsd %xmm0, %xmm0
jmp 0x5c361
movapd %xmm6, (%rsp)
callq 0x4420
movapd (%rsp), %xmm6
divsd %xmm0, %xmm6
movapd %xmm6, %xmm0
callq 0x4500
mulsd 0x14d02(%rip), %xmm0    # 0x71078
divsd 0x14d02(%rip), %xmm0    # 0x71080
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movapd 0x30(%rsp), %xmm4
movapd 0x10(%rsp), %xmm6
jbe 0x5c3b9
movsd 0x14cec(%rip), %xmm2    # 0x71088
subsd %xmm0, %xmm2
movapd %xmm6, %xmm1
cmplesd %xmm4, %xmm1
movapd %xmm1, %xmm3
andnpd %xmm2, %xmm3
andpd %xmm0, %xmm1
orpd %xmm3, %xmm1
movapd 0x20(%rsp), %xmm5
movapd %xmm5, %xmm0
cmplesd %xmm4, %xmm0
movapd %xmm0, %xmm2
andpd %xmm5, %xmm2
andnpd %xmm4, %xmm0
orpd %xmm2, %xmm0
movapd %xmm0, %xmm2
cmplesd %xmm6, %xmm2
movapd %xmm2, %xmm3
andpd %xmm0, %xmm3
andnpd %xmm6, %xmm2
orpd %xmm3, %xmm2
addsd %xmm5, %xmm4
addsd %xmm6, %xmm4
movsd 0x14c3f(%rip), %xmm0    # 0x71040
divsd %xmm4, %xmm0
mulsd %xmm2, %xmm0
addsd 0x14c07(%rip), %xmm0    # 0x71018
xorpd %xmm2, %xmm2
cmpltsd %xmm4, %xmm2
andpd %xmm0, %xmm2
divsd 0x14c42(%rip), %xmm4    # 0x71068
movsd %xmm1, (%r13)
movlpd %xmm2, (%r13,%r14,8)
movsd %xmm4, (%r13,%r12)
addq $0x8, %r13
decq %r15
jne 0x5c2a2
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %r14
movl (%rbx), %edx
movl 0x4(%rbx), %ecx
movl 0x8(%rbx), %r8d
movl 0xc(%rbx), %r9d
leaq 0x16ebf(%rip), %rax     # 0x73338
leaq 0x18292(%rip), %r10     # 0x74712
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x3775c(%rip), %r11     # 0x93bef
leaq 0x39c6b(%rip), %rsi     # 0x96105
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0xbfd8
addq $0x20, %rsp
leaq 0x50752(%rip), %rsi     # 0xacc08
movq 0x50b13(%rip), %rdx     # 0xacfd0
movq %r14, %rdi
callq 0x4900
movq %rax, %rbx
movq %r14, %rdi
callq 0x43b0
movq %rbx, %rdi
callq 0x4950