// File: /workspace/github_cpp_makefile_star2_O1/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 $0x68, %rsp
movq %rdi, 0x20(%rsp)
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x15247
movq 0x20(%rsp), %rax
movdqu (%rax), %xmm2
pxor %xmm1, %xmm1
pcmpeqd %xmm2, %xmm1
movmskps %xmm1, %eax
testb %al, %al
jne 0x15247
movl 0xa0(%rsp), %eax
cmpl %r9d, %esi
movl %r9d, %r15d
cmovll %esi, %r15d
movq %rdi, 0x30(%rsp)
movslq %r9d, %r12
cmovgl %esi, %r9d
cmpl %eax, %edx
movl %eax, %ebp
movl %eax, %r10d
cmovll %edx, %r10d
movl 0xa8(%rsp), %edi
cmovgl %edx, %ebp
cmpl %edi, %ecx
movl %edi, %r14d
cmovll %ecx, %edi
movl 0xb0(%rsp), %ebx
cmovgl %ecx, %r14d
cmpl %ebx, %r8d
movl %ebx, %r11d
cmovll %r8d, %r11d
cmovgl %r8d, %ebx
movslq %esi, %rsi
subq %r12, %rsi
movq %rsi, %r13
negq %r13
cmovsq %rsi, %r13
movl %r15d, %r12d
sarl $0x1f, %r12d
movq %r15, 0x18(%rsp)
andl %r15d, %r12d
addl %r13d, %r12d
movl %r9d, %r13d
notl %r13d
movd %xmm2, %esi
addl %esi, %r13d
xorl %r15d, %r15d
movq %rsi, 0x28(%rsp)
cmpl %esi, %r9d
cltq
cmovll %r15d, %r13d
movslq %edx, %rdx
subq %rax, %rdx
movq %rdx, %r9
negq %r9
cmovsq %rdx, %r9
pshufd $0x55, %xmm2, %xmm1     # xmm1 = xmm2[1,1,1,1]
movl %ebp, %esi
notl %esi
movd %xmm1, %edx
addl %edx, %esi
cmpl %edx, %ebp
movslq 0xa8(%rsp), %rax
movl $0x0, %r15d
cmovll %r15d, %esi
movslq %ecx, %rcx
subq %rax, %rcx
movq %rcx, %rax
negq %rax
cmovsq %rcx, %rax
pshufd $0xee, %xmm2, %xmm1     # xmm1 = xmm2[2,3,2,3]
movl %r14d, %ebp
notl %ebp
movd %xmm1, %ecx
addl %ecx, %ebp
movl %ecx, 0xc(%rsp)
cmpl %ecx, %r14d
cmovll %r15d, %ebp
xorl %r15d, %r15d
movslq 0xb0(%rsp), %r14
movslq %r8d, %r8
subq %r14, %r8
movq %r8, %rcx
negq %rcx
cmovsq %r8, %rcx
movl %ebx, %r14d
notl %r14d
movq 0x20(%rsp), %r8
movl 0xc(%r8), %r8d
addl %r8d, %r14d
cmpl %r8d, %ebx
leal 0x1(%r13,%r12), %r8d
movq 0x30(%rsp), %r12
cmovll %r15d, %r14d
movl %r8d, 0x14(%rsp)
testl %r8d, %r8d
jle 0x15247
movl %r10d, %r8d
sarl $0x1f, %r8d
andl %r10d, %r8d
addl %r9d, %r8d
leal (%rsi,%r8), %r13d
incl %r13d
testl %r13d, %r13d
jle 0x15247
movl %edi, %esi
sarl $0x1f, %esi
andl %edi, %esi
addl %eax, %esi
leal (%rsi,%rbp), %eax
incl %eax
movl %eax, 0x10(%rsp)
testl %eax, %eax
jle 0x15247
movl %r11d, %eax
sarl $0x1f, %eax
andl %r11d, %eax
addl %ecx, %eax
addl %r14d, %eax
incl %eax
movl %eax, 0x3c(%rsp)
testl %eax, %eax
jle 0x15247
movslq 0x14(%rsp), %r14
movq 0x28(%rsp), %rcx
movq %rcx, %rbx
subq %r14, %rbx
movl %edx, %eax
subl %r13d, %eax
imulq %rcx, %rax
movq %rax, 0x48(%rsp)
imulq %rcx, %rdx
movl 0xc(%rsp), %esi
movl %esi, %eax
subl 0x10(%rsp), %eax
imulq %rdx, %rax
movq %rax, 0x40(%rsp)
xorl %eax, %eax
movq 0x18(%rsp), %r8
testl %r8d, %r8d
cmovlel %eax, %r8d
addq %r8, %r12
testl %r10d, %r10d
cmovlel %eax, %r10d
imulq %rcx, %r10
addq %r12, %r10
testl %edi, %edi
cmovlel %eax, %edi
imulq %rdx, %rdi
addq %r10, %rdi
testl %r11d, %r11d
movl $0x0, 0x18(%rsp)
cmovlel %eax, %r11d
movl %esi, %r15d
imulq %r11, %r15
imulq %rdx, %r15
movaps 0x5bfb5(%rip), %xmm2    # 0x71120
andps %xmm0, %xmm2
pxor %xmm1, %xmm1
cmpless %xmm0, %xmm1
andps %xmm0, %xmm1
movss 0x5c12e(%rip), %xmm3    # 0x712b0
movaps %xmm3, %xmm4
subss %xmm1, %xmm4
addq %rdi, %r15
movzbl 0xb8(%rsp), %ebp
cvtsi2ss %ebp, %xmm5
mulss %xmm2, %xmm5
movaps %xmm0, 0x50(%rsp)
movss %xmm4, 0x30(%rsp)
movss %xmm5, 0x28(%rsp)
xorl %eax, %eax
movl %eax, 0xc(%rsp)
xorl %r12d, %r12d
ucomiss %xmm3, %xmm0
jae 0x151e5
movl 0x14(%rsp), %eax
movzbl (%r15), %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
mulss %xmm4, %xmm1
addss %xmm5, %xmm1
cvttss2si %xmm1, %ecx
movb %cl, (%r15)
incq %r15
decl %eax
jne 0x151bf
addq %rbx, %r15
jmp 0x15215
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x4290
movss 0x28(%rsp), %xmm5
movss 0x30(%rsp), %xmm4
movss 0x5c0aa(%rip), %xmm3    # 0x712b0
movaps 0x50(%rsp), %xmm0
movq 0x20(%rsp), %rax
movl (%rax), %eax
addq %rax, %r15
incl %r12d
cmpl %r13d, %r12d
jne 0x151b6
addq 0x48(%rsp), %r15
movl 0xc(%rsp), %eax
incl %eax
cmpl 0x10(%rsp), %eax
jne 0x151af
addq 0x40(%rsp), %r15
movl 0x18(%rsp), %eax
incl %eax
movl %eax, 0x18(%rsp)
cmpl 0x3c(%rsp), %eax
jne 0x151ad
movq 0x20(%rsp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop