// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
cmpl $0x3, 0xc(%rdi)
jne 0x439cd
movq 0x18(%rbx), %r14
movl (%rbx), %eax
movl 0x4(%rbx), %ecx
imulq %rax, %rcx
movl 0x8(%rbx), %r15d
imulq %rcx, %r15
leaq (%r14,%r15,8), %r12
movq %r15, %r13
shlq $0x4, %r13
addq %r14, %r13
xorl %ebp, %ebp
cmpq %rbp, %r15
je 0x439bb
movsd (%r14,%rbp,8), %xmm2
movsd 0x107dd(%rip), %xmm1    # 0x54008
movapd %xmm1, %xmm0
minsd %xmm2, %xmm0
divsd %xmm1, %xmm0
xorpd %xmm3, %xmm3
cmpltsd %xmm3, %xmm2
andnpd %xmm0, %xmm2
movsd (%r12,%rbp,8), %xmm4
movhpd (%r13,%rbp,8), %xmm4    # xmm4 = xmm4[0],mem[0]
movapd 0x10977(%rip), %xmm1    # 0x541d0
movapd %xmm1, %xmm0
minpd %xmm4, %xmm0
divpd %xmm1, %xmm0
cmpnltpd 0x108a2(%rip), %xmm4    # 0x54110
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 0x107c7(%rip), %xmm6    # 0x54068
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 0x438cc
sqrtsd %xmm0, %xmm0
jmp 0x438db
movapd %xmm6, (%rsp)
callq 0x4400
movapd (%rsp), %xmm6
divsd %xmm0, %xmm6
movapd %xmm6, %xmm0
callq 0x44f0
mulsd 0x10780(%rip), %xmm0    # 0x54070
divsd 0x10780(%rip), %xmm0    # 0x54078
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movapd 0x30(%rsp), %xmm4
movapd 0x10(%rsp), %xmm6
jbe 0x43933
movsd 0x1076a(%rip), %xmm2    # 0x54080
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 0x106bd(%rip), %xmm0    # 0x54038
divsd %xmm4, %xmm0
mulsd %xmm2, %xmm0
addsd 0x10685(%rip), %xmm0    # 0x54010
xorpd %xmm2, %xmm2
cmpltsd %xmm4, %xmm2
andpd %xmm0, %xmm2
divsd 0x106c0(%rip), %xmm4    # 0x54060
movsd %xmm1, (%r14,%rbp,8)
movlpd %xmm2, (%r12,%rbp,8)
movsd %xmm4, (%r13,%rbp,8)
incq %rbp
jmp 0x43814
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
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 0x10dfa(%rip), %rax     # 0x547e8
leaq 0x121cd(%rip), %r10     # 0x55bc2
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x31697(%rip), %r11     # 0x7509f
leaq 0x33b7c(%rip), %rsi     # 0x7758b
movq %r14, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%rbx)
callq 0x9bf8
addq $0x20, %rsp
leaq 0x4c21d(%rip), %rsi     # 0x8fc48
movq 0x4c5a6(%rip), %rdx     # 0x8ffd8
movq %r14, %rdi
callq 0x4910
movq %rax, %rbx
movq %r14, %rdi
callq 0x4390
movq %rbx, %rdi
callq 0x4950
nop