// File: /workspace/github_cpp_makefile_star2_O3/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 %r9, %r14
movl %edx, %ebp
movq %rdi, %r12
movq 0x18(%rdi), %rdx
testq %rdx, %rdx
sete %al
movl (%rdi), %ebx
movl 0x4(%rdi), %r11d
testl %ebx, %ebx
sete %r10b
orb %al, %r10b
testl %r11d, %r11d
sete %al
movl 0x8(%rdi), %edi
testl %edi, %edi
sete %r9b
orb %al, %r9b
orb %r10b, %r9b
movl 0xc(%r12), %r10d
testl %r10d, %r10d
sete %al
orb %r9b, %al
jne 0x15a39
movq 0x18(%r14), %r13
testq %r13, %r13
je 0x15a39
movq 0xe0(%rsp), %rax
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x15a39
movaps %xmm1, %xmm5
movq %rsi, 0x30(%rsp)
movq %rcx, 0x20(%rsp)
movq %r8, 0x10(%rsp)
movl %ebx, %r9d
movl %r11d, %ebx
movl %edi, %esi
movl %r10d, %edi
movq %rbx, 0x70(%rsp)
imulq %r9, %rbx
movq %rbx, 0xa0(%rsp)
movq %rsi, 0x28(%rsp)
imulq %rsi, %rbx
movq %rbx, %rsi
movq %rdi, 0x8(%rsp)
imulq %rdi, %rsi
movl (%r14), %r10d
movl 0x4(%r14), %ecx
movl 0x8(%r14), %r11d
movl 0xc(%r14), %r15d
addq %rdx, %rsi
cmpq %r13, %rsi
jbe 0x155d8
movq %rcx, %rdi
imulq %r10, %rdi
movq %r11, %r8
imulq %r15, %r8
imulq %rdi, %r8
addq %r13, %r8
cmpq %r8, %rdx
jae 0x155d8
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movss %xmm5, 0x8(%rsp)
movss %xmm0, 0x18(%rsp)
callq 0x14184
subq $0x8, %rsp
movq %r12, %rdi
movq 0x38(%rsp), %rsi
movl %ebp, %edx
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %r8
movq %rbx, %r9
movss 0x20(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
pushq 0xe8(%rsp)
callq 0x15464
addq $0x10, %rsp
movq %rax, %r12
cmpb $0x0, 0x90(%rsp)
jne 0x15a39
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x15a39
jmp 0x156a3
movq %r11, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %r10, 0x68(%rsp)
movq %r9, 0x60(%rsp)
movq 0xe0(%rsp), %r10
movl (%r10), %r9d
movl 0x4(%r10), %r8d
movl 0x8(%r10), %edi
movl 0xc(%r10), %ecx
cmpq %rax, %rsi
jbe 0x156ad
movq %r8, %rsi
imulq %r9, %rsi
movq %rdi, %r10
imulq %rcx, %r10
imulq %rsi, %r10
addq %rax, %r10
cmpq %r10, %rdx
jae 0x156ad
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq 0xe0(%rsp), %rsi
xorl %edx, %edx
movss %xmm5, 0x8(%rsp)
movss %xmm0, 0x18(%rsp)
callq 0x14184
subq $0x8, %rsp
movq %r12, %rdi
movq 0x38(%rsp), %rsi
movl %ebp, %edx
movq 0x28(%rsp), %rcx
movq 0x18(%rsp), %r8
movq %r14, %r9
movss 0x20(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
pushq %rbx
callq 0x15464
addq $0x10, %rsp
movq %rax, %r12
cmpb $0x0, 0x90(%rsp)
jne 0x15a39
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x15a39
callq 0x4690
jmp 0x15a39
movq %rcx, 0x58(%rsp)
movq %r15, 0x18(%rsp)
movq 0x68(%rsp), %r10
cmpl %r10d, %r9d
movq 0x40(%rsp), %rcx
jne 0x15a4e
cmpl 0x38(%rsp), %r8d
jne 0x15a4e
cmpl %ecx, %edi
jne 0x15a4e
movq 0x30(%rsp), %r9
leal (%r10,%r9), %edi
xorl %esi, %esi
movq 0x60(%rsp), %r8
subl %edi, %r8d
cmovgel %esi, %r8d
movl %r9d, %r14d
sarl $0x1f, %r14d
andl %r9d, %r14d
addl %r10d, %r8d
addl %r14d, %r8d
movq 0x38(%rsp), %rsi
leal (%rsi,%rbp), %edi
movq 0x70(%rsp), %r9
movl %r9d, %r10d
subl %edi, %r10d
movl $0x0, %r9d
cmovgel %r9d, %r10d
movq 0x20(%rsp), %rdi
addl %ecx, %edi
movq 0x28(%rsp), %rcx
movl %ecx, %r15d
subl %edi, %r15d
cmovgel %r9d, %r15d
xorl %ecx, %ecx
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %r9
addl %r9d, %edi
movq 0x8(%rsp), %r11
subl %edi, %r11d
cmovgel %ecx, %r11d
testl %r8d, %r8d
jle 0x15a39
movl %ebp, %ecx
sarl $0x1f, %ecx
movl %ecx, %r9d
andl %ebp, %r9d
addl %esi, %r9d
addl %r10d, %r9d
testl %r9d, %r9d
jle 0x15a39
movl %ecx, 0x7c(%rsp)
movq 0x20(%rsp), %rsi
movl %esi, %r10d
sarl $0x1f, %r10d
movl %r10d, %edi
andl %esi, %edi
movq 0x40(%rsp), %rcx
addl %ecx, %edi
addl %r15d, %edi
movl %edi, 0x8(%rsp)
testl %edi, %edi
jle 0x15a39
movq 0x10(%rsp), %rdi
movl %edi, %r15d
sarl $0x1f, %r15d
movl %r15d, %esi
andl %edi, %esi
movq 0x18(%rsp), %rdi
addl %esi, %edi
addl %r11d, %edi
movq %rdi, 0x18(%rsp)
testl %edi, %edi
jle 0x15a39
movq %r12, 0x48(%rsp)
movq 0x38(%rsp), %rsi
movl %esi, %r11d
movq 0x68(%rsp), %rsi
imull %esi, %r11d
movq %rsi, %rdi
movl %ecx, %esi
movq %rsi, 0x50(%rsp)
imull %r11d, %ecx
movq 0x58(%rsp), %rsi
imull %ecx, %esi
movq %rsi, 0x58(%rsp)
imull 0x10(%rsp), %ecx
andl %ecx, %r15d
movl %edi, %ecx
imull %ebp, %ecx
movl 0x7c(%rsp), %esi
andl %ecx, %esi
addl %esi, %r14d
movq 0x20(%rsp), %r12
imull %r12d, %r11d
andl %r11d, %r10d
addl %r14d, %r10d
addl %r15d, %r10d
movslq %r8d, %rsi
negl %r10d
movslq %r10d, %rcx
addq %rcx, %rax
addq %rcx, %r13
movq 0x60(%rsp), %r14
movq %rsi, 0x40(%rsp)
subq %rsi, %r14
movq %rdi, %rcx
subq %rsi, %rcx
movq 0x70(%rsp), %r11
subl %r9d, %r11d
movq 0x38(%rsp), %r15
subl %r9d, %r15d
movl 0x8(%rsp), %r10d
movq 0x28(%rsp), %rsi
subl %r10d, %esi
movq %rsi, 0x28(%rsp)
movq 0x50(%rsp), %rdi
subl %r10d, %edi
movq %rdi, 0x50(%rsp)
xorl %esi, %esi
movq 0x30(%rsp), %r10
testl %r10d, %r10d
cmovlel %esi, %r10d
testl %ebp, %ebp
cmovlel %esi, %ebp
testl %r12d, %r12d
cmovlel %esi, %r12d
movq 0x10(%rsp), %rsi
testl %esi, %esi
movl $0x0, %edi
movq %rdi, 0x20(%rsp)
movq %rsi, %rdi
movl $0x0, %esi
cmovlel %esi, %edi
addq %r10, %rdx
movq 0x60(%rsp), %rsi
imulq %rsi, %rbp
addq %rdx, %rbp
movq 0xa0(%rsp), %rdx
imulq %r12, %rdx
addq %rbp, %rdx
imulq %rdi, %rbx
addq %rdx, %rbx
movq 0x70(%rsp), %rdx
imulq 0x28(%rsp), %rdx
addq %r11, %rdx
incq %rdx
imulq %rsi, %rdx
incq %r11
imulq %rsi, %r11
movq 0x50(%rsp), %rsi
imulq 0x38(%rsp), %rsi
addq %r15, %rsi
incq %rsi
movq 0x68(%rsp), %rdi
imulq %rdi, %rsi
incq %r15
imulq %rdi, %r15
movq 0x40(%rsp), %rdi
subq %rdi, %rdx
movq %rdx, 0x10(%rsp)
subq %rdi, %r11
subq %rdi, %rsi
movq %rsi, 0x30(%rsp)
subq %rdi, %r15
movslq 0x58(%rsp), %rdx
movq %rdx, 0x28(%rsp)
movaps 0x587ea(%rip), %xmm6    # 0x6e120
movq 0xe0(%rsp), %rdx
movq 0x18(%rdx), %rsi
subq %rsi, %rax
cqto
idivq 0x28(%rsp)
addq %rsi, %rdx
xorl %ebp, %ebp
xorl %r10d, %r10d
movq %rdx, %rax
movq %r13, %rsi
movq %rbx, %rdi
xorl %r12d, %r12d
movzbl (%rax,%r12), %edx
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
mulss %xmm0, %xmm1
xorps %xmm2, %xmm2
cmpless %xmm1, %xmm2
andps %xmm1, %xmm2
movaps %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 0x15960
leaq (%rdi,%r14), %rbx
addq %r12, %rbx
leaq (%rsi,%rcx), %r13
addq %r12, %r13
leaq (%rax,%rcx), %rdx
addq %r12, %rdx
incl %r10d
cmpl %r9d, %r10d
jl 0x15954
leaq (%rdi,%r11), %rbx
addq %r12, %rbx
leaq (%rsi,%r15), %r13
addq %r12, %r13
leaq (%rax,%r15), %rdx
addq %r12, %rdx
incl %ebp
cmpl 0x8(%rsp), %ebp
jl 0x15951
addq 0x10(%rsp), %rdi
addq %r12, %rdi
movq 0x30(%rsp), %rdx
addq %rdx, %rsi
addq %r12, %rsi
addq %rdx, %rax
addq %r12, %rax
movq 0x20(%rsp), %rdx
incl %edx
movq %rdi, %rbx
movq %rsi, %r13
movq %rdx, 0x20(%rsp)
cmpl 0x18(%rsp), %edx
jl 0x15936
movq 0x48(%rsp), %r12
movq %r12, %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 (%r12), %edx
movl 0x4(%r12), %ecx
movl 0x8(%r12), %r8d
movl 0xc(%r12), %r9d
leaq 0x58df3(%rip), %rax     # 0x6e868
leaq 0x5a1c6(%rip), %r10     # 0x6fc42
cmpb $0x0, 0x10(%r12)
cmovneq %rax, %r10
movl (%r14), %eax
movq %rax, 0x20(%rsp)
movl 0x4(%r14), %eax
movq %rax, 0x18(%rsp)
movl 0x8(%r14), %eax
movq %rax, 0x10(%rsp)
movl 0xc(%r14), %ebp
movq %r12, 0x48(%rsp)
movq 0xe0(%rsp), %r13
movl (%r13), %r12d
movl 0x4(%r13), %r11d
movl 0x8(%r13), %r15d
movl 0xc(%r13), %ebx
subq $0x8, %rsp
leaq 0x7892a(%rip), %rsi     # 0x8e3f6
movq %rdi, 0x10(%rsp)
xorl %eax, %eax
pushq 0x18(%r13)
pushq %rbx
pushq %r15
pushq %r11
pushq %r12
pushq 0x18(%r14)
pushq %rbp
pushq 0x50(%rsp)
pushq 0x60(%rsp)
pushq 0x70(%rsp)
leaq 0x64d11(%rip), %r11     # 0x7a807
pushq %r11
pushq %r10
movq 0xb0(%rsp), %r10
pushq 0x18(%r10)
callq 0xc16a
addq $0x70, %rsp
leaq 0x9213a(%rip), %rsi     # 0xa7c50
movq 0x924b3(%rip), %rdx     # 0xa7fd0
movq 0x8(%rsp), %rdi
callq 0x4910
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x43c0
jmp 0x15b71
movq %rax, %rbx
cmpb $0x0, 0x90(%rsp)
jne 0x15b71
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x15b71
jmp 0x15b6c
movq %rax, %rbx
cmpb $0x0, 0x90(%rsp)
jne 0x15b71
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x15b71
callq 0x4690
movq %rbx, %rdi
callq 0x4960
nop