// File: /workspace/github_cpp_makefile_star2_O2/manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::draw_image(int, int, int, int, cimg_library::CImg<double> const&, float)
CImg<T>& draw_image(const int x0, const int y0, const int z0, const int c0,
                        const CImg<T>& sprite, const float opacity=1) {
      if (is_empty() || !sprite) return *this;
      if (is_overlapped(sprite)) return draw_image(x0,y0,z0,c0,+sprite,opacity);
      if (x0==0 && y0==0 && z0==0 && c0==0 && is_sameXYZC(sprite) && opacity>=1 && !is_shared())
        return assign(sprite,false);
      const bool bx = (x0<0), by = (y0<0), bz = (z0<0), bc = (c0<0);
      const int
        lX = sprite.width() - (x0 + sprite.width()>width()?x0 + sprite.width() - width():0) + (bx?x0:0),
        lY = sprite.height() - (y0 + sprite.height()>height()?y0 + sprite.height() - height():0) + (by?y0:0),
        lZ = sprite.depth() - (z0 + sprite.depth()>depth()?z0 + sprite.depth() - depth():0) + (bz?z0:0),
        lC = sprite.spectrum() - (c0 + sprite.spectrum()>spectrum()?c0 + sprite.spectrum() - spectrum():0) + (bc?c0:0);
      const T
        *ptrs = sprite._data -
        (bx?x0:0) -
        (by?y0*sprite.width():0) -
        (bz?z0*sprite.width()*sprite.height():0) -
        (bc?c0*sprite.width()*sprite.height()*sprite.depth():0);
      const unsigned long
        offX = (unsigned long)_width - lX,
        soffX = (unsigned long)sprite._width - lX,
        offY = (unsigned long)_width*(_height - lY),
        soffY = (unsigned long)sprite._width*(sprite._height - lY),
        offZ = (unsigned long)_width*_height*(_depth - lZ),
        soffZ = (unsigned long)sprite._width*sprite._height*(sprite._depth - lZ),
        slX = lX*sizeof(T);
      const float nopacity = cimg::abs(opacity), copacity = 1 - cimg::max(opacity,0);
      if (lX>0 && lY>0 && lZ>0 && lC>0) {
        T *ptrd = data(x0<0?0:x0,y0<0?0:y0,z0<0?0:z0,c0<0?0:c0);
        for (int v = 0; v<lC; ++v) {
          for (int z = 0; z<lZ; ++z) {
            if (opacity>=1)
              for (int y = 0; y<lY; ++y) { std::memcpy(ptrd,ptrs,slX); ptrd+=_width; ptrs+=sprite._width; }
            else for (int y = 0; y<lY; ++y) {
                for (int x = 0; x<lX; ++x) { *ptrd = (T)(nopacity*(*(ptrs++)) + *ptrd*copacity); ++ptrd; }
                ptrd+=offX; ptrs+=soffX;
              }
            ptrd+=offY; ptrs+=soffY;
          }
          ptrd+=offZ; ptrs+=soffZ;
        }
      }
      return *this;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movaps %xmm0, 0x10(%rsp)
movq %r9, %rbx
movl %r8d, %ebp
movl %ecx, %r12d
movl %edx, %r13d
movl %esi, %r15d
movq %rdi, %r14
callq 0x8dc8
testb %al, %al
jne 0x2aabd
cmpq $0x0, 0x18(%rbx)
je 0x2aabd
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2ad24
testb %al, %al
je 0x2a767
leaq 0x78(%rsp), %rdi
movq %rbx, %rsi
callq 0x2a6b0
movq %r14, %rdi
movl %r15d, %esi
movl %r13d, %edx
movl %r12d, %ecx
movl %ebp, %r8d
leaq 0x78(%rsp), %r9
movdqa 0x10(%rsp), %xmm0
callq 0x2a6da
movq %rax, %r14
leaq 0x78(%rsp), %rdi
callq 0x6c96
jmp 0x2aabd
movl %r13d, %eax
orl %r15d, %eax
orl %r12d, %eax
orl %ebp, %eax
je 0x2aa6c
movd %ebp, %xmm0
movd %r12d, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movd %r13d, %xmm0
movd %r15d, %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
punpcklqdq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0]
pxor %xmm3, %xmm3
pxor %xmm1, %xmm1
pcmpgtd %xmm2, %xmm1
pand %xmm2, %xmm1
movdqu (%rbx), %xmm0
paddd %xmm0, %xmm2
movdqu (%r14), %xmm4
movdqa %xmm2, %xmm5
pcmpgtd %xmm4, %xmm5
psubd %xmm2, %xmm4
pand %xmm5, %xmm4
paddd %xmm1, %xmm0
paddd %xmm4, %xmm0
movdqa %xmm0, %xmm2
pcmpgtd %xmm3, %xmm2
movmskps %xmm2, %eax
cmpl $0xf, %eax
jne 0x2aabd
movl (%rbx), %r8d
movl 0x4(%rbx), %ecx
movl (%r14), %r9d
movl 0x4(%r14), %r11d
pshufd $0x55, %xmm0, %xmm2     # xmm2 = xmm0[1,1,1,1]
movl %ecx, %r10d
pshufd $0xee, %xmm0, %xmm3     # xmm3 = xmm0[2,3,2,3]
movd %xmm3, %eax
movl %eax, 0x4(%rsp)
movq %rcx, %rdx
imulq %r8, %rdx
movl 0x8(%rbx), %esi
movl %esi, %edi
subl %eax, %edi
imulq %rdx, %rdi
movq %rdi, 0x30(%rsp)
imull %r8d, %ecx
imull %ebp, %esi
imull %ecx, %esi
movl %ebp, %edx
sarl $0x1f, %edx
andl %esi, %edx
movq %rbx, 0x70(%rsp)
movq %r12, %rax
movq 0x18(%rbx), %r12
movd %xmm1, %esi
movslq %esi, %rsi
shlq $0x3, %rsi
subq %rsi, %r12
movl %r8d, %esi
imull %r13d, %esi
movl %r13d, %edi
sarl $0x1f, %edi
andl %esi, %edi
movd %xmm2, %ebx
movl %ebx, (%rsp)
movslq %edi, %rsi
shlq $0x3, %rsi
subq %rsi, %r12
imull %eax, %ecx
movl %eax, %esi
sarl $0x1f, %esi
andl %ecx, %esi
movl %r11d, %ecx
subl %ebx, %ecx
imulq %r9, %rcx
movq %rcx, 0x50(%rsp)
subl %ebx, %r10d
imulq %r8, %r10
movq %r10, 0x58(%rsp)
imulq %r9, %r11
movslq %esi, %rcx
shlq $0x3, %rcx
subq %rcx, %r12
movl 0x8(%r14), %ecx
movslq %edx, %rdx
shlq $0x3, %rdx
subq %rdx, %r12
movl %ecx, %edx
movl 0x4(%rsp), %edi
subl %edi, %edx
imulq %r11, %rdx
movq %rdx, 0x28(%rsp)
xorl %r10d, %r10d
testl %r15d, %r15d
cmovlel %r10d, %r15d
testl %r13d, %r13d
cmovlel %r10d, %r13d
testl %eax, %eax
cmovlel %r10d, %eax
testl %ebp, %ebp
cmovlel %r10d, %ebp
shlq $0x3, %r15
movq %r14, %rbx
addq 0x18(%r14), %r15
movl (%rsp), %r14d
imulq %r9, %r13
leaq (%r15,%r13,8), %rdx
imulq %r11, %rax
leaq (%rdx,%rax,8), %rdx
movl %ecx, %ecx
imulq %rbp, %rcx
movd %xmm0, %esi
movslq %esi, %rsi
imulq %r11, %rcx
leaq (,%rsi,8), %r15
pxor %xmm1, %xmm1
movaps 0x10(%rsp), %xmm3
cmpless %xmm3, %xmm1
andps %xmm3, %xmm1
movss 0x298fd(%rip), %xmm4    # 0x54220
movaps %xmm4, %xmm2
subss %xmm1, %xmm2
movaps 0x297ef(%rip), %xmm1    # 0x54120
andps %xmm3, %xmm1
leaq (%rdx,%rcx,8), %r13
cvtss2sd %xmm1, %xmm3
cvtss2sd %xmm2, %xmm2
pshufd $0xff, %xmm0, %xmm0     # xmm0 = xmm0[3,3,3,3]
movd %xmm0, 0x8(%rsp)
shlq $0x3, %r8
shlq $0x3, %r9
movl %esi, %ebp
movq %r8, 0x40(%rsp)
movq %r9, 0x38(%rsp)
movsd %xmm3, 0x68(%rsp)
movsd %xmm2, 0x60(%rsp)
cmpl 0x8(%rsp), %r10d
je 0x2aaba
xorl %eax, %eax
movq %r10, 0x48(%rsp)
cmpl %edi, %eax
je 0x2aa51
movl %eax, 0xc(%rsp)
movaps 0x10(%rsp), %xmm0
ucomiss %xmm4, %xmm0
jae 0x2a9e0
xorl %eax, %eax
cmpl %r14d, %eax
je 0x2aa33
xorl %edx, %edx
movq %r15, %rcx
cmpl %edx, %ebp
je 0x2a9d0
movsd (%r13,%rdx,8), %xmm0
mulsd %xmm2, %xmm0
movsd (%r12,%rdx,8), %xmm1
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r13,%rdx,8)
addq $-0x8, %rcx
incq %rdx
jmp 0x2a9a3
addq %r9, %r13
subq %rcx, %r13
addq %r8, %r12
subq %rcx, %r12
incl %eax
jmp 0x2a995
subl $0x1, %r14d
jb 0x2aa14
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4410
movsd 0x60(%rsp), %xmm2
movsd 0x68(%rsp), %xmm3
movl (%rbx), %eax
leaq (%r13,%rax,8), %r13
movq 0x70(%rsp), %rax
movl (%rax), %eax
leaq (%r12,%rax,8), %r12
jmp 0x2a9e0
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %r9
movl 0x4(%rsp), %edi
movl (%rsp), %r14d
movq 0x48(%rsp), %r10
movss 0x297ed(%rip), %xmm4    # 0x54220
movq 0x50(%rsp), %rax
leaq (%r13,%rax,8), %r13
movq 0x58(%rsp), %rax
leaq (%r12,%rax,8), %r12
movl 0xc(%rsp), %eax
incl %eax
jmp 0x2a97d
movq 0x28(%rsp), %rax
leaq (%r13,%rax,8), %r13
movq 0x30(%rsp), %rax
leaq (%r12,%rax,8), %r12
incl %r10d
jmp 0x2a96b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2ad72
movaps 0x10(%rsp), %xmm0
ucomiss 0x2979d(%rip), %xmm0    # 0x54220
jb 0x2a778
testb %al, %al
je 0x2a778
cmpb $0x0, 0x10(%r14)
jne 0x2a778
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8dea
movq %rbx, %r14
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x6c96
movq %rbx, %rdi
callq 0x4950
nop