// File: /workspace/github_cpp_makefile_star2_O3/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 0x598f8
movl (%rbx), %eax
movl 0x4(%rbx), %r14d
imulq %rax, %r14
movl 0x8(%rbx), %eax
movq %r14, %r15
imulq %rax, %r15
testq %r15, %r15
je 0x598e7
movq 0x18(%rbx), %r13
imulq %rax, %r14
movq %r14, %r12
shlq $0x4, %r12
movsd (%r13), %xmm2
movsd 0x148b8(%rip), %xmm1    # 0x6e008
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 0x14ae1(%rip), %xmm1    # 0x6e260
movapd %xmm1, %xmm0
minpd %xmm4, %xmm0
divpd %xmm1, %xmm0
cmpnltpd 0x1495c(%rip), %xmm4    # 0x6e0f0
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 0x148a1(%rip), %xmm6    # 0x6e068
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 0x597f2
sqrtsd %xmm0, %xmm0
jmp 0x59801
movapd %xmm6, (%rsp)
callq 0x4430
movapd (%rsp), %xmm6
divsd %xmm0, %xmm6
movapd %xmm6, %xmm0
callq 0x4510
mulsd 0x1485a(%rip), %xmm0    # 0x6e070
divsd 0x1485a(%rip), %xmm0    # 0x6e078
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movapd 0x30(%rsp), %xmm4
movapd 0x10(%rsp), %xmm6
jbe 0x59859
movsd 0x14844(%rip), %xmm2    # 0x6e080
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 0x14797(%rip), %xmm0    # 0x6e038
divsd %xmm4, %xmm0
mulsd %xmm2, %xmm0
addsd 0x1475f(%rip), %xmm0    # 0x6e010
xorpd %xmm2, %xmm2
cmpltsd %xmm4, %xmm2
andpd %xmm0, %xmm2
divsd 0x1479a(%rip), %xmm4    # 0x6e060
movsd %xmm1, (%r13)
movlpd %xmm2, (%r13,%r14,8)
movsd %xmm4, (%r13,%r12)
addq $0x8, %r13
decq %r15
jne 0x59742
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 0x14f4f(%rip), %rax     # 0x6e868
leaq 0x16322(%rip), %r10     # 0x6fc42
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x357ec(%rip), %r11     # 0x8f11f
leaq 0x37cfb(%rip), %rsi     # 0x91635
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0xbfac
addq $0x20, %rsp
leaq 0x4e2e2(%rip), %rsi     # 0xa7c38
movq 0x4e673(%rip), %rdx     # 0xa7fd0
movq %r14, %rdi
callq 0x4910
movq %rax, %rbx
movq %r14, %rdi
callq 0x43c0
movq %rbx, %rdi
callq 0x4960