// File: /workspace/github_cpp_makefile_star2_O3/manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<unsigned char>::draw_rectangle(int, int, int, int, int, int, int, int, unsigned char, float)
CImg<T>& draw_rectangle(const int x0, const int y0, const int z0, const int c0,
                            const int x1, const int y1, const int z1, const int c1,
                            const T val, const float opacity=1) {
      if (is_empty()) return *this;
      const bool bx = (x0<x1), by = (y0<y1), bz = (z0<z1), bc = (c0<c1);
      const int
        nx0 = bx?x0:x1, nx1 = bx?x1:x0,
        ny0 = by?y0:y1, ny1 = by?y1:y0,
        nz0 = bz?z0:z1, nz1 = bz?z1:z0,
        nc0 = bc?c0:c1, nc1 = bc?c1:c0;
      const int
        lX = (1 + nx1 - nx0) + (nx1>=width()?width() - 1 - nx1:0) + (nx0<0?nx0:0),
        lY = (1 + ny1 - ny0) + (ny1>=height()?height() - 1 - ny1:0) + (ny0<0?ny0:0),
        lZ = (1 + nz1 - nz0) + (nz1>=depth()?depth() - 1 - nz1:0) + (nz0<0?nz0:0),
        lC = (1 + nc1 - nc0) + (nc1>=spectrum()?spectrum() - 1 - nc1:0) + (nc0<0?nc0:0);
      const unsigned long
        offX = (unsigned long)_width - lX,
        offY = (unsigned long)_width*(_height - lY),
        offZ = (unsigned long)_width*_height*(_depth - lZ);
      const float nopacity = cimg::abs(opacity), copacity = 1 - cimg::max(opacity,0);
      T *ptrd = data(nx0<0?0:nx0,ny0<0?0:ny0,nz0<0?0:nz0,nc0<0?0:nc0);
      if (lX>0 && lY>0 && lZ>0 && lC>0)
        for (int v = 0; v<lC; ++v) {
          for (int z = 0; z<lZ; ++z) {
            for (int y = 0; y<lY; ++y) {
              if (opacity>=1) {
                if (sizeof(T)!=1) { for (int x = 0; x<lX; ++x) *(ptrd++) = val; ptrd+=offX; }
                else { std::memset(ptrd,(int)val,lX); ptrd+=_width; }
              } else { for (int x = 0; x<lX; ++x) { *ptrd = (T)(nopacity*val + *ptrd*copacity); ++ptrd; } ptrd+=offX; }
            }
            ptrd+=offY;
          }
          ptrd+=offZ;
        }
      return *this;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, 0x8(%rsp)
movq 0x18(%rdi), %rax
testq %rax, %rax
je 0x15307
movq 0x8(%rsp), %rdi
movdqu (%rdi), %xmm2
pxor %xmm1, %xmm1
pcmpeqd %xmm2, %xmm1
movmskps %xmm1, %edi
testb %dil, %dil
jne 0x15307
movd %r8d, %xmm1
movd %ecx, %xmm3
punpckldq %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
movd %edx, %xmm4
movd %esi, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
punpcklqdq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0]
movd 0xa0(%rsp), %xmm4
movd 0x98(%rsp), %xmm3
punpckldq %xmm4, %xmm3    # xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
movd 0x90(%rsp), %xmm5
movd %r9d, %xmm4
punpckldq %xmm5, %xmm4    # xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
punpcklqdq %xmm3, %xmm4    # xmm4 = xmm4[0],xmm3[0]
movdqa %xmm4, %xmm3
pcmpgtd %xmm1, %xmm3
movdqa %xmm3, %xmm5
pandn %xmm4, %xmm5
movdqa %xmm1, %xmm7
pand %xmm3, %xmm7
por %xmm5, %xmm7
movdqa %xmm4, %xmm5
pand %xmm3, %xmm5
pandn %xmm1, %xmm3
por %xmm5, %xmm3
movdqa 0x59038(%rip), %xmm5    # 0x6e150
movdqa %xmm1, %xmm6
pcmpgtd %xmm4, %xmm6
psubd %xmm4, %xmm1
pxor %xmm6, %xmm1
psubd %xmm1, %xmm6
pxor %xmm4, %xmm4
pcmpgtd %xmm7, %xmm4
pand %xmm7, %xmm4
paddd %xmm6, %xmm4
pcmpeqd %xmm6, %xmm6
movdqa %xmm2, %xmm1
pcmpgtd %xmm3, %xmm1
pxor %xmm6, %xmm3
paddd %xmm2, %xmm3
pandn %xmm3, %xmm1
paddd %xmm4, %xmm1
psubd %xmm6, %xmm1
pcmpgtd %xmm1, %xmm5
movmskps %xmm5, %ecx
testl %ecx, %ecx
jne 0x15307
movd %xmm2, %edx
pshufd $0x55, %xmm2, %xmm3     # xmm3 = xmm2[1,1,1,1]
movd %xmm3, %esi
movq %rsi, %rcx
imulq %rdx, %rcx
movaps 0x58f9a(%rip), %xmm3    # 0x6e120
andps %xmm0, %xmm3
pxor %xmm4, %xmm4
cmpless %xmm0, %xmm4
andps %xmm0, %xmm4
movss 0x59113(%rip), %xmm6    # 0x6e2b0
movd %xmm1, %edi
movl %edi, 0x2c(%rsp)
movslq %edi, %r14
movq %rdx, %r12
subq %r14, %r12
pshufd $0x55, %xmm1, %xmm5     # xmm5 = xmm1[1,1,1,1]
movd %xmm5, %ebx
subl %ebx, %esi
imulq %rdx, %rsi
movq %rsi, 0x38(%rsp)
pshufd $0xee, %xmm1, %xmm5     # xmm5 = xmm1[2,3,2,3]
movd %xmm5, %edi
pshufd $0xee, %xmm2, %xmm2     # xmm2 = xmm2[2,3,2,3]
movd %xmm2, %esi
movl %esi, %r15d
movl %edi, 0x1c(%rsp)
subl %edi, %esi
imulq %rcx, %rsi
movq %rsi, 0x30(%rsp)
movd %xmm7, %esi
xorl %edi, %edi
testl %esi, %esi
cmovlel %edi, %esi
movaps %xmm6, %xmm5
addq %rsi, %rax
pshufd $0x55, %xmm7, %xmm2     # xmm2 = xmm7[1,1,1,1]
movd %xmm2, %esi
testl %esi, %esi
cmovlel %edi, %esi
imulq %rdx, %rsi
addq %rax, %rsi
pshufd $0xee, %xmm7, %xmm2     # xmm2 = xmm7[2,3,2,3]
movd %xmm2, %eax
testl %eax, %eax
cmovlel %edi, %eax
imulq %rcx, %rax
pshufd $0xff, %xmm7, %xmm2     # xmm2 = xmm7[3,3,3,3]
movd %xmm2, %edx
testl %edx, %edx
cmovlel %edi, %edx
subss %xmm4, %xmm5
imulq %rcx, %r15
imulq %rdx, %r15
addq %rax, %r15
movzbl 0xa8(%rsp), %ebp
xorps %xmm2, %xmm2
cvtsi2ss %ebp, %xmm2
addq %rsi, %r15
pshufd $0xff, %xmm1, %xmm1     # xmm1 = xmm1[3,3,3,3]
movd %xmm1, 0x14(%rsp)
mulss %xmm3, %xmm2
movaps %xmm0, 0x40(%rsp)
movss %xmm5, 0x28(%rsp)
movss %xmm2, 0x24(%rsp)
movl %edi, 0x18(%rsp)
xorl %eax, %eax
movl %eax, 0x20(%rsp)
xorl %r13d, %r13d
ucomiss %xmm6, %xmm0
jae 0x152a9
movl 0x2c(%rsp), %eax
movzbl (%r15), %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
mulss %xmm5, %xmm1
addss %xmm2, %xmm1
cvttss2si %xmm1, %ecx
movb %cl, (%r15)
incq %r15
decl %eax
jne 0x15283
addq %r12, %r15
jmp 0x152d9
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x4290
movss 0x24(%rsp), %xmm2
movss 0x28(%rsp), %xmm5
movss 0x58fe6(%rip), %xmm6    # 0x6e2b0
movaps 0x40(%rsp), %xmm0
movq 0x8(%rsp), %rax
movl (%rax), %eax
addq %rax, %r15
incl %r13d
cmpl %ebx, %r13d
jne 0x1527a
addq 0x38(%rsp), %r15
movl 0x20(%rsp), %eax
incl %eax
cmpl 0x1c(%rsp), %eax
jne 0x15273
addq 0x30(%rsp), %r15
movl 0x18(%rsp), %edi
incl %edi
cmpl 0x14(%rsp), %edi
jne 0x1526d
movq 0x8(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop