// File: /workspace/github_cpp_makefile_star2_O1/manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<unsigned char>& cimg_library::CImg<unsigned char>::draw_image<unsigned char, unsigned char>(int, int, int, int, cimg_library::CImg<unsigned char> const&, cimg_library::CImg<unsigned char> const&, float, float)
CImg<T>& draw_image(const int x0, const int y0, const int z0, const int c0,
                        const CImg<ti>& sprite, const CImg<tm>& mask, const float opacity=1,
                        const float mask_max_value=1) {
      if (is_empty() || !sprite || !mask) return *this;
      if (is_overlapped(sprite)) return draw_image(x0,y0,z0,c0,+sprite,mask,opacity,mask_max_value);
      if (is_overlapped(mask))   return draw_image(x0,y0,z0,c0,sprite,+mask,opacity,mask_max_value);
      if (mask._width!=sprite._width || mask._height!=sprite._height || mask._depth!=sprite._depth)
        throw CImgArgumentException(_cimg_instance
                                    "draw_image(): Sprite (%u,%u,%u,%u,%p) and mask (%u,%u,%u,%u,%p) have "
                                    "incompatible dimensions.",
                                    cimg_instance,
                                    sprite._width,sprite._height,sprite._depth,sprite._spectrum,sprite._data,
                                    mask._width,mask._height,mask._depth,mask._spectrum,mask._data);

      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 int
        coff = -(bx?x0:0)-(by?y0*mask.width():0)-(bz?z0*mask.width()*mask.height():0)-
          (bc?c0*mask.width()*mask.height()*mask.depth():0),
        ssize = mask.width()*mask.height()*mask.depth()*mask.spectrum();
      const ti *ptrs = sprite._data + coff;
      const tm *ptrm = mask._data   + coff;
      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);
      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 c = 0; c<lC; ++c) {
          ptrm = mask._data + (ptrm - mask._data)%ssize;
          for (int z = 0; z<lZ; ++z) {
            for (int y = 0; y<lY; ++y) {
              for (int x = 0; x<lX; ++x) {
                const float mopacity = (float)(*(ptrm++)*opacity),
                  nopacity = cimg::abs(mopacity), copacity = mask_max_value - cimg::max(mopacity,0);
                *ptrd = (T)((nopacity*(*(ptrs++)) + *ptrd*copacity)/mask_max_value);
                ++ptrd;
              }
              ptrd+=offX; ptrs+=soffX; ptrm+=soffX;
            }
            ptrd+=offY; ptrs+=soffY; ptrm+=soffY;
          }
          ptrd+=offZ; ptrs+=soffZ; ptrm+=soffZ;
        }
      }
      return *this;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %r15
movq 0x18(%rdi), %r11
testq %r11, %r11
je 0x15990
movdqa %xmm1, %xmm5
movdqu (%r15), %xmm2
pxor %xmm1, %xmm1
pcmpeqd %xmm2, %xmm1
movmskps %xmm1, %eax
testb %al, %al
jne 0x15990
movq %r9, %r14
movq 0x18(%r9), %rbx
testq %rbx, %rbx
je 0x15990
movq 0xe0(%rsp), %rax
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x15990
movl %r8d, %ebp
movl %edx, %r9d
movq %rcx, (%rsp)
movq %rsi, 0x20(%rsp)
movd %xmm2, %edx
pshufd $0x55, %xmm2, %xmm1     # xmm1 = xmm2[1,1,1,1]
movd %xmm1, %ecx
movq %rcx, 0x60(%rsp)
movq %rdx, 0x28(%rsp)
imulq %rdx, %rcx
pshufd $0xee, %xmm2, %xmm1     # xmm1 = xmm2[2,3,2,3]
movd %xmm1, %r13d
movl 0xc(%r15), %edx
movq %r13, %rsi
movq %rdx, 0x8(%rsp)
imulq %rdx, %rsi
movq %rcx, 0xa0(%rsp)
imulq %rcx, %rsi
movl (%r14), %edi
movl 0x4(%r14), %edx
movl 0x8(%r14), %r8d
movl 0xc(%r14), %r10d
addq %r11, %rsi
cmpq %rbx, %rsi
jbe 0x15517
movq %rdx, %rcx
imulq %rdi, %rcx
movq %rdx, %r12
movq %rdi, %rdx
movq %r8, %rdi
imulq %r10, %rdi
imulq %rcx, %rdi
addq %rbx, %rdi
cmpq %rdi, %r11
movq %rdx, %rdi
movq %r12, %rdx
jae 0x15517
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movss %xmm5, 0x8(%rsp)
movss %xmm0, 0x18(%rsp)
movq %r9, %r14
callq 0x14050
subq $0x8, %rsp
movq %r15, %rdi
movq 0x28(%rsp), %rsi
movl %r14d, %edx
movq 0x8(%rsp), %rcx
movl %ebp, %r8d
movq %rbx, %r9
movss 0x20(%rsp), %xmm0
movd 0x10(%rsp), %xmm1
pushq 0xe8(%rsp)
callq 0x153a6
addq $0x10, %rsp
movq %rax, %r15
cmpb $0x0, 0x80(%rsp)
jne 0x15990
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15990
jmp 0x155e1
movq %r10, 0x18(%rsp)
movq %r8, 0x40(%rsp)
movq %rdi, 0x58(%rsp)
movq %rbp, 0x10(%rsp)
movq 0xe0(%rsp), %rdi
movl (%rdi), %r12d
movl 0x4(%rdi), %r8d
movl 0x8(%rdi), %ebp
movl 0xc(%rdi), %ecx
cmpq %rax, %rsi
jbe 0x155eb
movq %r8, %rsi
imulq %r12, %rsi
movq %rbp, %rdi
imulq %rcx, %rdi
imulq %rsi, %rdi
addq %rax, %rdi
cmpq %rdi, %r11
jae 0x155eb
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq 0xe0(%rsp), %rsi
xorl %edx, %edx
movss %xmm5, 0x8(%rsp)
movss %xmm0, 0x18(%rsp)
movq %r9, %r12
callq 0x14050
subq $0x8, %rsp
movq %r15, %rdi
movq 0x28(%rsp), %rsi
movl %r12d, %edx
movq 0x8(%rsp), %rcx
movq 0x18(%rsp), %r8
movq %r14, %r9
movss 0x20(%rsp), %xmm0
movd 0x10(%rsp), %xmm1
pushq %rbx
callq 0x153a6
addq $0x10, %rsp
movq %rax, %r15
cmpb $0x0, 0x80(%rsp)
jne 0x15990
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15990
callq 0x4680
jmp 0x15990
movq %rbp, 0x38(%rsp)
movq %rcx, 0x50(%rsp)
movq 0x58(%rsp), %rsi
movq %r12, 0x48(%rsp)
cmpl %esi, %r12d
movq 0x40(%rsp), %r12
jne 0x159a5
cmpl %edx, %r8d
jne 0x159a5
cmpl %r12d, 0x38(%rsp)
jne 0x159a5
movq %r8, 0x98(%rsp)
movq 0x20(%rsp), %rcx
leal (%rsi,%rcx), %edi
xorl %ebp, %ebp
movq 0x28(%rsp), %r8
subl %edi, %r8d
cmovgel %ebp, %r8d
movl %ecx, %r14d
sarl $0x1f, %r14d
andl %ecx, %r14d
addl %esi, %r8d
addl %r14d, %r8d
movq %r9, %rsi
addl %edx, %r9d
movq 0x60(%rsp), %rcx
movl %ecx, %edi
subl %r9d, %edi
cmovgel %ebp, %edi
movq (%rsp), %rcx
leal (%r12,%rcx), %r9d
movl %r13d, %r10d
subl %r9d, %r10d
cmovgel %ebp, %r10d
movq 0x18(%rsp), %r9
movq 0x10(%rsp), %rcx
addl %ecx, %r9d
movq 0x8(%rsp), %rcx
subl %r9d, %ecx
cmovgel %ebp, %ecx
testl %r8d, %r8d
jle 0x15990
movl %esi, %ebp
sarl $0x1f, %ebp
movl %ebp, %r9d
movq %rsi, 0x90(%rsp)
andl %esi, %r9d
addl %edx, %r9d
addl %edi, %r9d
testl %r9d, %r9d
jle 0x15990
movq %rcx, %rsi
movq %rdx, 0x68(%rsp)
movq (%rsp), %rcx
movl %ecx, %edi
sarl $0x1f, %edi
movl %edi, %edx
andl %ecx, %edx
addl %r12d, %edx
addl %r10d, %edx
movl %edx, 0x8(%rsp)
testl %edx, %edx
jle 0x15990
movq %r15, 0x30(%rsp)
movq 0x10(%rsp), %rdx
movl %edx, %r15d
sarl $0x1f, %r15d
movl %r15d, %r10d
andl %edx, %r10d
movq 0x18(%rsp), %rcx
addl %r10d, %ecx
movq %rcx, %r10
addl %esi, %r10d
testl %r10d, %r10d
jle 0x1598b
movq 0x98(%rsp), %rcx
movq 0x48(%rsp), %rdx
imull %edx, %ecx
movq 0x38(%rsp), %rsi
imull %ecx, %esi
movq 0x50(%rsp), %r12
imull %esi, %r12d
movq %r12, 0x50(%rsp)
imull 0x10(%rsp), %esi
andl %esi, %r15d
movq 0x90(%rsp), %rsi
imull %esi, %edx
andl %edx, %ebp
addl %ebp, %r14d
movq (%rsp), %rdx
imull %edx, %ecx
movq %rdx, %r12
andl %ecx, %edi
addl %r14d, %edi
movslq %r8d, %rdx
addl %r15d, %edi
movq 0x28(%rsp), %r14
movq %rdx, 0x38(%rsp)
subq %rdx, %r14
negl %edi
movslq %edi, %rcx
addq %rcx, %rax
addq %rcx, %rbx
movq 0x58(%rsp), %rcx
subq %rdx, %rcx
movq 0x60(%rsp), %r15
subl %r9d, %r15d
movq 0x68(%rsp), %rbp
subl %r9d, %ebp
movl %r13d, %edi
movl 0x8(%rsp), %edx
subl %edx, %edi
movq %rdi, 0x48(%rsp)
movq 0x40(%rsp), %rdi
subl %edx, %edi
movq %rdi, 0x40(%rsp)
xorl %edi, %edi
movq 0x20(%rsp), %rdx
testl %edx, %edx
cmovlel %edi, %edx
testl %esi, %esi
cmovlel %edi, %esi
testl %r12d, %r12d
cmovlel %edi, %r12d
movq %r12, (%rsp)
cmpl $0x0, 0x10(%rsp)
movl $0x0, %edi
movq %rdi, 0x20(%rsp)
movl $0x0, %edi
movq 0x10(%rsp), %r12
cmovlel %edi, %r12d
movq %r12, 0x10(%rsp)
addq %rdx, %r11
imulq 0x28(%rsp), %rsi
addq %r11, %rsi
movq 0xa0(%rsp), %rdx
movq (%rsp), %rdi
imulq %rdx, %rdi
addq %rsi, %rdi
imulq %rdx, %r13
imulq 0x10(%rsp), %r13
addq %rdi, %r13
movq 0x60(%rsp), %rdx
imulq 0x48(%rsp), %rdx
addq %r15, %rdx
incq %rdx
movq 0x28(%rsp), %rsi
imulq %rsi, %rdx
incq %r15
imulq %rsi, %r15
movq 0x68(%rsp), %rsi
imulq 0x40(%rsp), %rsi
addq %rbp, %rsi
incq %rsi
movq 0x58(%rsp), %rdi
imulq %rdi, %rsi
incq %rbp
imulq %rdi, %rbp
movq 0x38(%rsp), %rdi
subq %rdi, %rdx
movq %rdx, (%rsp)
subq %rdi, %r15
subq %rdi, %rsi
movq %rsi, 0x10(%rsp)
subq %rdi, %rbp
movslq 0x50(%rsp), %rdx
movq %rdx, 0x28(%rsp)
movaps 0x5b8a0(%rip), %xmm6    # 0x71120
movq %r10, 0x18(%rsp)
movq 0xe0(%rsp), %rdx
movq 0x18(%rdx), %rsi
subq %rsi, %rax
cqto
idivq 0x28(%rsp)
addq %rsi, %rdx
xorl %r11d, %r11d
xorl %r10d, %r10d
movq %rdx, %rax
movq %rbx, %rsi
movq %r13, %rdi
xorl %r12d, %r12d
movzbl (%rax,%r12), %edx
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
mulss %xmm0, %xmm1
pxor %xmm2, %xmm2
cmpless %xmm1, %xmm2
andps %xmm1, %xmm2
movdqa %xmm5, %xmm3
subss %xmm2, %xmm3
movzbl (%rsi,%r12), %edx
xorps %xmm2, %xmm2
cvtsi2ss %edx, %xmm2
movzbl (%rdi,%r12), %edx
xorps %xmm4, %xmm4
cvtsi2ss %edx, %xmm4
andps %xmm6, %xmm1
mulss %xmm3, %xmm4
mulss %xmm1, %xmm2
addss %xmm4, %xmm2
divss %xmm5, %xmm2
cvttss2si %xmm2, %edx
movb %dl, (%rdi,%r12)
incq %r12
cmpl %r8d, %r12d
jl 0x158b0
leaq (%rdi,%r14), %r13
addq %r12, %r13
leaq (%rsi,%rcx), %rbx
addq %r12, %rbx
leaq (%rax,%rcx), %rdx
addq %r12, %rdx
incl %r10d
cmpl %r9d, %r10d
jl 0x158a4
leaq (%rdi,%r15), %r13
addq %r12, %r13
leaq (%rsi,%rbp), %rbx
addq %r12, %rbx
leaq (%rax,%rbp), %rdx
addq %r12, %rdx
incl %r11d
cmpl 0x8(%rsp), %r11d
jl 0x158a1
addq (%rsp), %rdi
addq %r12, %rdi
movq 0x10(%rsp), %rdx
addq %rdx, %rsi
addq %r12, %rsi
addq %rdx, %rax
addq %r12, %rax
movq 0x20(%rsp), %rdx
incl %edx
movq %rdi, %r13
movq %rsi, %rbx
movq 0x18(%rsp), %r10
movq %rdx, 0x20(%rsp)
cmpl %r10d, %edx
jl 0x15885
movq 0x30(%rsp), %r15
movq %r15, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %rdi
movl (%r15), %edx
movl 0x4(%r15), %ecx
movl 0x8(%r15), %r8d
movl 0xc(%r15), %r9d
leaq 0x5d970(%rip), %rax     # 0x73338
leaq 0x5ed43(%rip), %r10     # 0x74712
cmpb $0x0, 0x10(%r15)
cmovneq %rax, %r10
movl (%r14), %eax
movq %rax, 0x20(%rsp)
movl 0x4(%r14), %eax
movq %rax, 0x18(%rsp)
movl 0x8(%r14), %eax
movq %rax, (%rsp)
movl 0xc(%r14), %ebp
movq 0xe0(%rsp), %r13
movl (%r13), %r12d
movl 0x4(%r13), %r11d
movq %r15, 0x30(%rsp)
movl 0x8(%r13), %r15d
movl 0xc(%r13), %ebx
subq $0x8, %rsp
leaq 0x7d4a9(%rip), %rsi     # 0x92ec6
movq %rdi, 0x10(%rsp)
xorl %eax, %eax
pushq 0x18(%r13)
pushq %rbx
pushq %r15
pushq %r11
pushq %r12
pushq 0x18(%r14)
pushq %rbp
pushq 0x40(%rsp)
pushq 0x60(%rsp)
pushq 0x70(%rsp)
leaq 0x69890(%rip), %r11     # 0x7f2d7
pushq %r11
pushq %r10
movq 0x98(%rsp), %r10
pushq 0x18(%r10)
callq 0xc196
addq $0x70, %rsp
leaq 0x971b9(%rip), %rsi     # 0xacc20
movq 0x97562(%rip), %rdx     # 0xacfd0
movq 0x8(%rsp), %rdi
callq 0x4900
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x43b0
jmp 0x15ac2
movq %rax, %rbx
cmpb $0x0, 0x80(%rsp)
jne 0x15ac2
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15ac2
jmp 0x15abd
movq %rax, %rbx
cmpb $0x0, 0x80(%rsp)
jne 0x15ac2
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15ac2
callq 0x4680
movq %rbx, %rdi
callq 0x4950