// File: /workspace/github_cpp_makefile_star2_O2/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 $0x98, %rsp
movss %xmm1, 0x20(%rsp)
movss %xmm0, 0x18(%rsp)
movq %r9, %r12
movl %r8d, %r15d
movl %ecx, %r13d
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
callq 0xfd1c
testb %al, %al
jne 0x11f5c
cmpq $0x0, 0x18(%r12)
je 0x11f5c
movq %r13, 0x10(%rsp)
movq 0xd0(%rsp), %r13
cmpq $0x0, 0x18(%r13)
je 0x11f5c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x108d8
testb %al, %al
je 0x11bec
leaq 0x78(%rsp), %rdi
movq %r12, %rsi
callq 0x10924
subq $0x8, %rsp
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
movq 0x18(%rsp), %rcx
movl %r15d, %r8d
leaq 0x80(%rsp), %r9
movss 0x20(%rsp), %xmm0
movss 0x28(%rsp), %xmm1
pushq %r13
callq 0x11b3e
popq %rcx
popq %rdx
jmp 0x11c3b
movq %rbx, %rdi
movq %r13, %rsi
callq 0x108d8
testb %al, %al
je 0x11c4d
leaq 0x78(%rsp), %rdi
movq %r13, %rsi
callq 0x10924
subq $0x8, %rsp
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
movq 0x18(%rsp), %rcx
movl %r15d, %r8d
movq %r12, %r9
movss 0x20(%rsp), %xmm0
movss 0x28(%rsp), %xmm1
leaq 0x80(%rsp), %rax
pushq %rax
callq 0x11b3e
popq %rcx
popq %rdx
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0xb8ae
jmp 0x11f5c
movl (%r13), %eax
cmpl (%r12), %eax
movq %rbx, 0x8(%rsp)
jne 0x11f71
movl 0x4(%r13), %r10d
cmpl 0x4(%r12), %r10d
jne 0x11f71
movl 0x8(%r13), %r8d
cmpl 0x8(%r12), %r8d
jne 0x11f71
leal (%rax,%r14), %edx
movl (%rbx), %esi
movl 0x4(%rbx), %r11d
xorl %ecx, %ecx
movq %rsi, 0x40(%rsp)
subl %edx, %esi
cmovgel %ecx, %esi
movl %r14d, %edx
sarl $0x1f, %edx
andl %r14d, %edx
movq %rdx, 0x48(%rsp)
addl %eax, %edx
addl %edx, %esi
leal (%r10,%rbp), %edx
movl %r11d, %edi
subl %edx, %edi
cmovgel %ecx, %edi
movq 0x10(%rsp), %rdx
movq %r8, 0x30(%rsp)
addl %r8d, %edx
movl 0x8(%rbx), %r8d
movq %r8, 0x60(%rsp)
movl %r8d, %r9d
subl %edx, %r9d
cmovgel %ecx, %r9d
movl 0xc(%r12), %edx
movq %rdx, %r13
addl %r15d, %edx
movl 0xc(%rbx), %r8d
subl %edx, %r8d
cmovgel %ecx, %r8d
testl %esi, %esi
movss 0x20(%rsp), %xmm5
movss 0x18(%rsp), %xmm6
jle 0x11f57
movl %esi, %ebx
movl %ebp, %edx
sarl $0x1f, %edx
movl %edx, %esi
andl %ebp, %esi
movq %r10, 0x70(%rsp)
addl %r10d, %esi
addl %edi, %esi
testl %esi, %esi
jle 0x11f57
movq %r11, 0x68(%rsp)
movq 0x10(%rsp), %r11
movl %r11d, %ecx
sarl $0x1f, %ecx
movl %ecx, %edi
andl %r11d, %edi
addl 0x30(%rsp), %edi
addl %r9d, %edi
testl %edi, %edi
jle 0x11f57
movl %r15d, %r11d
sarl $0x1f, %r11d
movl %r11d, %r9d
andl %r15d, %r9d
addl %r9d, %r13d
addl %r8d, %r13d
movq %r13, 0x50(%rsp)
testl %r13d, %r13d
jle 0x11f57
movl %ebx, 0x5c(%rsp)
movslq %ebx, %r10
movq 0x40(%rsp), %r8
subq %r10, %r8
movq %rax, %r9
subq %r10, %r9
movq 0x70(%rsp), %r13
movq %r13, %r10
imulq %rax, %r10
movq 0x30(%rsp), %rbx
movl %r11d, 0x2c(%rsp)
movl %ebx, %r11d
subl %edi, %r11d
imulq %r10, %r11
movq %r11, 0x38(%rsp)
movl %r13d, %r10d
imull %eax, %r10d
imull %ebx, %r10d
movl %eax, %r11d
imull %r15d, %r11d
imull %r13d, %ebx
imull %r11d, %ebx
andl %ebx, 0x2c(%rsp)
movl %eax, %r11d
imull %ebp, %r11d
andl %r11d, %edx
movl %edx, %r11d
movq 0x48(%rsp), %rdx
addl %r11d, %edx
movl %r13d, %r11d
subl %esi, %r11d
imulq %rax, %r11
movq 0x10(%rsp), %rbx
imull %ebx, %eax
imull %r13d, %eax
andl %eax, %ecx
addl %edx, %ecx
addl 0x2c(%rsp), %ecx
negl %ecx
movslq %ecx, %rcx
movq 0xd0(%rsp), %rdx
movq 0x18(%rdx), %rax
addq %rcx, %rax
addq 0x18(%r12), %rcx
movslq 0xc(%rdx), %rdx
movslq %r10d, %r10
imulq %rdx, %r10
movq %r10, 0x30(%rsp)
movq 0x68(%rsp), %r10
movl %r10d, %r12d
subl %esi, %r12d
movq 0x40(%rsp), %rdx
imulq %rdx, %r12
imulq %rdx, %r10
movq 0x60(%rsp), %rdx
subl %edi, %edx
imulq %r10, %rdx
movq %rdx, 0x48(%rsp)
xorl %r13d, %r13d
testl %r14d, %r14d
cmovlel %r13d, %r14d
testl %ebp, %ebp
cmovlel %r13d, %ebp
testl %ebx, %ebx
cmovlel %r13d, %ebx
testl %r15d, %r15d
cmovlel %r13d, %r15d
imulq 0x40(%rsp), %rbp
movq 0x8(%rsp), %rdx
addq 0x18(%rdx), %r14
addq %r14, %rbp
imulq %r10, %rbx
addq %rbp, %rbx
imulq 0x60(%rsp), %r15
imulq %r10, %r15
addq %rbx, %r15
movl 0x5c(%rsp), %r14d
movaps 0x42297(%rip), %xmm0    # 0x54120
cmpl 0x50(%rsp), %r13d
je 0x11f57
movq 0xd0(%rsp), %rdx
movq 0x18(%rdx), %r10
subq %r10, %rax
cqto
idivq 0x30(%rsp)
movq %rdx, %rax
addq %r10, %rax
xorl %edx, %edx
cmpl %edi, %edx
je 0x11f3f
xorl %ebp, %ebp
cmpl %esi, %ebp
je 0x11f2f
xorl %r10d, %r10d
cmpl %r10d, %r14d
je 0x11f19
movzbl (%rax,%r10), %ebx
cvtsi2ss %ebx, %xmm1
mulss %xmm6, %xmm1
xorps %xmm2, %xmm2
cmpless %xmm1, %xmm2
andps %xmm1, %xmm2
andps %xmm0, %xmm1
movaps %xmm5, %xmm3
subss %xmm2, %xmm3
movzbl (%rcx,%r10), %ebx
cvtsi2ss %ebx, %xmm2
movzbl (%r15,%r10), %ebx
cvtsi2ss %ebx, %xmm4
mulss %xmm3, %xmm4
mulss %xmm1, %xmm2
addss %xmm4, %xmm2
divss %xmm5, %xmm2
cvttss2si %xmm2, %ebx
movb %bl, (%r15,%r10)
incq %r10
jmp 0x11ec3
addq %r8, %r15
addq %r10, %r15
addq %r9, %rcx
addq %r10, %rcx
addq %r9, %rax
addq %r10, %rax
incl %ebp
jmp 0x11ebc
addq %r12, %r15
addq %r11, %rcx
addq %r11, %rax
incl %edx
jmp 0x11eb2
addq 0x48(%rsp), %r15
movq 0x38(%rsp), %rdx
addq %rdx, %rcx
addq %rdx, %rax
incl %r13d
jmp 0x11e89
movq 0x8(%rsp), %rbx
movq %rbx, %rax
addq $0x98, %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 (%rbx), %edx
movl 0x4(%rbx), %ecx
movl 0x8(%rbx), %r8d
movl 0xc(%rbx), %r9d
leaq 0x42856(%rip), %rax     # 0x547e8
leaq 0x43c29(%rip), %r10     # 0x55bc2
cmpb $0x0, 0x10(%rbx)
cmovneq %rax, %r10
movl (%r12), %eax
movq %rax, 0x20(%rsp)
movl 0x4(%r12), %eax
movq %rax, 0x18(%rsp)
movl 0x8(%r12), %eax
movq %rax, 0x50(%rsp)
movl 0xc(%r12), %ebx
movl (%r13), %r11d
movl 0x4(%r13), %r14d
movl 0x8(%r13), %r15d
movl 0xc(%r13), %ebp
subq $0x8, %rsp
leaq 0x62398(%rip), %rsi     # 0x74376
movq %rdi, 0x40(%rsp)
xorl %eax, %eax
pushq 0x18(%r13)
pushq %rbp
pushq %r15
pushq %r14
pushq %r11
pushq 0x18(%r12)
pushq %rbx
pushq 0x90(%rsp)
pushq 0x60(%rsp)
pushq 0x70(%rsp)
leaq 0x4e77b(%rip), %r11     # 0x60787
pushq %r11
pushq %r10
movq 0x70(%rsp), %r10
pushq 0x18(%r10)
callq 0x9d52
addq $0x70, %rsp
leaq 0x7dc37(%rip), %rsi     # 0x8fc60
movq 0x7dfa8(%rip), %rdx     # 0x8ffd8
movq 0x38(%rsp), %rdi
callq 0x4910
jmp 0x1204b
movq %rax, %rbx
movq 0x38(%rsp), %rdi
callq 0x4390
jmp 0x12058
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0xb8ae
movq %rbx, %rdi
callq 0x4950