// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImgList<unsigned char>::insert(cimg_library::CImg<unsigned char> const&, unsigned int, bool)
CImgList<T>& insert(const CImg<T>& img, const unsigned int pos=~0U, const bool is_shared=false) {
      const unsigned int npos = pos==~0U?_width:pos;
      if (npos>_width)
        throw CImgArgumentException(_cimglist_instance
                                    "insert(): Invalid insertion request of specified image (%u,%u,%u,%u,%p) "
                                    "at position %u.",
                                    cimglist_instance,
                                    img._width,img._height,img._depth,img._spectrum,img._data,npos);
      CImg<T> *const new_data = (++_width>_allocated_width)?new CImg<T>[_allocated_width?(_allocated_width<<=1):
                                                                        (_allocated_width=16)]:0;
      if (!_data) { // Insert new element into empty list.
        _data = new_data;
        if (is_shared && img) {
          _data->_width = img._width;
          _data->_height = img._height;
          _data->_depth = img._depth;
          _data->_spectrum = img._spectrum;
          _data->_is_shared = true;
          _data->_data = img._data;
        } else *_data = img;
      }
      else {
        if (new_data) { // Insert with re-allocation.
          if (npos) std::memcpy(new_data,_data,sizeof(CImg<T>)*npos);
          if (npos!=_width-1) std::memcpy(new_data+npos+1,_data+npos,sizeof(CImg<T>)*(_width-1-npos));
          if (is_shared && img) {
            new_data[npos]._width = img._width;
            new_data[npos]._height = img._height;
            new_data[npos]._depth = img._depth;
            new_data[npos]._spectrum = img._spectrum;
            new_data[npos]._is_shared = true;
            new_data[npos]._data = img._data;
          } else {
            new_data[npos]._width = new_data[npos]._height = new_data[npos]._depth = new_data[npos]._spectrum = 0;
            new_data[npos]._data = 0;
            new_data[npos] = img;
          }
          std::memset(_data,0,sizeof(CImg<T>)*(_width-1));
          delete[] _data;
          _data = new_data;
        } else { // Insert without re-allocation.
          if (npos!=_width-1) std::memmove(_data+npos+1,_data+npos,sizeof(CImg<T>)*(_width-1-npos));
          if (is_shared && img) {
            _data[npos]._width = img._width;
            _data[npos]._height = img._height;
            _data[npos]._depth = img._depth;
            _data[npos]._spectrum = img._spectrum;
            _data[npos]._is_shared = true;
            _data[npos]._data = img._data;
          } else {
            _data[npos]._width = _data[npos]._height = _data[npos]._depth = _data[npos]._spectrum = 0;
            _data[npos]._data = 0;
            _data[npos] = img;
          }
        }
      }
      return *this;
    }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x140, %rsp            # imm = 0x140
movb %cl, %al
movq %rdi, 0x138(%rsp)
movq %rsi, 0x130(%rsp)
movl %edx, 0x12c(%rsp)
andb $0x1, %al
movb %al, 0x12b(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0xd0(%rsp)
cmpl $-0x1, 0x12c(%rsp)
jne 0x2326a
movq 0xd0(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xcc(%rsp)
jmp 0x23278
movl 0x12c(%rsp), %eax
movl %eax, 0xcc(%rsp)
movq 0xd0(%rsp), %rcx
movl 0xcc(%rsp), %eax
movl %eax, 0x124(%rsp)
movl 0x124(%rsp), %eax
cmpl (%rcx), %eax
jbe 0x23396
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0xd0(%rsp), %rax
movq %rcx, 0xa8(%rsp)
movl (%rax), %ecx
movl %ecx, 0xb0(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0xb4(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0xb8(%rsp)
callq 0x23b90
movq %rax, 0xc0(%rsp)
jmp 0x232e8
movq 0xc0(%rsp), %r9
movq 0xb8(%rsp), %r8
movl 0xb4(%rsp), %ecx
movl 0xb0(%rsp), %edx
movq 0xa8(%rsp), %rdi
movq 0x130(%rsp), %rax
movl (%rax), %esi
movl 0x4(%rax), %r10d
movl 0x8(%rax), %r11d
movl 0xc(%rax), %ebx
movq 0x18(%rax), %r14
movl 0x124(%rsp), %ebp
movq %rsp, %rax
movl %ebp, 0x28(%rax)
movq %r14, 0x20(%rax)
movl %ebx, 0x18(%rax)
movl %r11d, 0x10(%rax)
movl %r10d, 0x8(%rax)
movl %esi, (%rax)
leaq 0xc4df2(%rip), %rsi     # 0xe813e
xorl %eax, %eax
callq 0x12220
jmp 0x23355
movq 0xa8(%rsp), %rdi
leaq 0xdc7fc(%rip), %rsi     # 0xffb60
leaq -0x10f0b(%rip), %rdx    # 0x12460
callq 0x5920
movq 0xa8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
callq 0x53a0
jmp 0x23b7e
movq 0xd0(%rsp), %rcx
movl (%rcx), %eax
addl $0x1, %eax
movl %eax, (%rcx)
movl 0x4(%rcx), %ecx
movb $0x0, 0xf7(%rsp)
movb $0x0, 0xdf(%rsp)
cmpl %ecx, %eax
jbe 0x2350a
movq 0xd0(%rsp), %rax
cmpl $0x0, 0x4(%rax)
je 0x233e7
movq 0xd0(%rsp), %rcx
movl 0x4(%rcx), %eax
shll %eax
movl %eax, 0x4(%rcx)
movl %eax, 0xa4(%rsp)
jmp 0x23402
movq 0xd0(%rsp), %rax
movl $0x10, 0x4(%rax)
movl $0x10, %eax
movl %eax, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
movl %eax, %eax
movq %rax, 0x90(%rsp)
movl $0x20, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
movq %rdi, 0x88(%rsp)
callq 0x5040
movq 0x88(%rsp), %rdx
movq %rax, %rcx
movq 0x90(%rsp), %rax
movq %rcx, 0x100(%rsp)
movq %rdx, 0xf8(%rsp)
movb $0x1, 0xf7(%rsp)
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, 0x98(%rsp)
cmpq $0x0, %rax
je 0x234fb
movq 0x98(%rsp), %rax
movq 0x90(%rsp), %rdx
shlq $0x5, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, 0x78(%rsp)
movq %rax, 0x80(%rsp)
movq 0x98(%rsp), %rax
movq 0x80(%rsp), %rdi
movq %rdi, 0x70(%rsp)
movq %rax, 0xe8(%rsp)
movq %rdi, 0xe0(%rsp)
movb $0x1, 0xdf(%rsp)
callq 0x156b0
jmp 0x234e0
movq 0x78(%rsp), %rcx
movq 0x70(%rsp), %rax
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, 0x80(%rsp)
jne 0x234ac
movq 0x98(%rsp), %rax
movq %rax, 0x68(%rsp)
jmp 0x23513
xorl %eax, %eax
movq %rax, 0x68(%rsp)
jmp 0x23513
movq 0xd0(%rsp), %rax
movq 0x68(%rsp), %rcx
movq %rcx, 0x108(%rsp)
cmpq $0x0, 0x8(%rax)
jne 0x2367f
movq 0xd0(%rsp), %rax
movq 0x108(%rsp), %rcx
movq %rcx, 0x8(%rax)
testb $0x1, 0x12b(%rsp)
je 0x23661
movq 0x130(%rsp), %rdi
callq 0x20360
cmpq $0x0, %rax
je 0x23661
movq 0xd0(%rsp), %rax
movq 0x130(%rsp), %rcx
movl (%rcx), %edx
movq 0x8(%rax), %rcx
movl %edx, (%rcx)
movq 0x130(%rsp), %rcx
movl 0x4(%rcx), %edx
movq 0x8(%rax), %rcx
movl %edx, 0x4(%rcx)
movq 0x130(%rsp), %rcx
movl 0x8(%rcx), %edx
movq 0x8(%rax), %rcx
movl %edx, 0x8(%rcx)
movq 0x130(%rsp), %rcx
movl 0xc(%rcx), %edx
movq 0x8(%rax), %rcx
movl %edx, 0xc(%rcx)
movq 0x8(%rax), %rcx
movb $0x1, 0x10(%rcx)
movq 0x130(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq 0x8(%rax), %rax
movq %rcx, 0x18(%rax)
jmp 0x2367a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
testb $0x1, 0xdf(%rsp)
jne 0x235fb
jmp 0x23643
movq 0xe8(%rsp), %rcx
movq %rcx, 0x58(%rsp)
movq 0xe0(%rsp), %rax
cmpq %rax, %rcx
movq %rax, 0x60(%rsp)
je 0x23641
movq 0x60(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x50(%rsp)
callq 0x15650
movq 0x58(%rsp), %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x60(%rsp)
jne 0x2361a
jmp 0x23643
testb $0x1, 0xf7(%rsp)
jne 0x2364f
jmp 0x2365c
movq 0x100(%rsp), %rdi
callq 0x5680
jmp 0x23b7e
movq 0xd0(%rsp), %rax
movq 0x130(%rsp), %rsi
movq 0x8(%rax), %rdi
callq 0x17780
jmp 0x23b6a
cmpq $0x0, 0x108(%rsp)
je 0x23979
cmpl $0x0, 0x124(%rsp)
je 0x236be
movq 0xd0(%rsp), %rax
movq 0x108(%rsp), %rdi
movq 0x8(%rax), %rsi
movl 0x124(%rsp), %eax
movl %eax, %edx
shlq $0x5, %rdx
callq 0x5420
movq 0xd0(%rsp), %rcx
movl 0x124(%rsp), %eax
movl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x23723
movq 0xd0(%rsp), %rax
movq 0x108(%rsp), %rdi
movl 0x124(%rsp), %ecx
shlq $0x5, %rcx
addq %rcx, %rdi
addq $0x20, %rdi
movq 0x8(%rax), %rsi
movl 0x124(%rsp), %ecx
shlq $0x5, %rcx
addq %rcx, %rsi
movl (%rax), %eax
subl $0x1, %eax
subl 0x124(%rsp), %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x5, %rdx
callq 0x5420
testb $0x1, 0x12b(%rsp)
je 0x2381b
movq 0x130(%rsp), %rdi
callq 0x20360
cmpq $0x0, %rax
je 0x2381b
movq 0x130(%rsp), %rax
movl (%rax), %ecx
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq 0x130(%rsp), %rax
movl 0x4(%rax), %ecx
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq 0x130(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq 0x130(%rsp), %rax
movl 0xc(%rax), %ecx
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movb $0x1, 0x10(%rax)
movq 0x130(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x238cf
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl $0x0, 0xc(%rax)
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl $0x0, 0x4(%rax)
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl $0x0, (%rax)
movq 0x108(%rsp), %rax
movl 0x124(%rsp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq $0x0, 0x18(%rax)
movq 0x130(%rsp), %rsi
movq 0x108(%rsp), %rdi
movl 0x124(%rsp), %eax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x17780
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rdi
movl (%rax), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x5, %rdx
xorl %esi, %esi
callq 0x52a0
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x48(%rsp)
cmpq $0x0, %rax
je 0x23960
movq 0x48(%rsp), %rcx
movq %rcx, %rax
addq $-0x8, %rax
movq %rax, 0x38(%rsp)
movq -0x8(%rcx), %rdx
shlq $0x5, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, 0x40(%rsp)
je 0x23956
movq 0x40(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x30(%rsp)
callq 0x15650
movq 0x48(%rsp), %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x40(%rsp)
jne 0x2392f
movq 0x38(%rsp), %rdi
callq 0x5680
movq 0xd0(%rsp), %rax
movq 0x108(%rsp), %rcx
movq %rcx, 0x8(%rax)
jmp 0x23b68
movq 0xd0(%rsp), %rcx
movl 0x124(%rsp), %eax
movl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x239da
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x124(%rsp), %ecx
shlq $0x5, %rcx
addq %rcx, %rdi
addq $0x20, %rdi
movq 0x8(%rax), %rsi
movl 0x124(%rsp), %ecx
shlq $0x5, %rcx
addq %rcx, %rsi
movl (%rax), %eax
subl $0x1, %eax
subl 0x124(%rsp), %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x5, %rdx
callq 0x58c0
testb $0x1, 0x12b(%rsp)
je 0x23ac2
movq 0x130(%rsp), %rdi
callq 0x20360
cmpq $0x0, %rax
je 0x23ac2
movq 0xd0(%rsp), %rax
movq 0x130(%rsp), %rcx
movl (%rcx), %edx
movq 0x8(%rax), %rcx
movl 0x124(%rsp), %esi
shlq $0x5, %rsi
addq %rsi, %rcx
movl %edx, (%rcx)
movq 0x130(%rsp), %rcx
movl 0x4(%rcx), %edx
movq 0x8(%rax), %rcx
movl 0x124(%rsp), %esi
shlq $0x5, %rsi
addq %rsi, %rcx
movl %edx, 0x4(%rcx)
movq 0x130(%rsp), %rcx
movl 0x8(%rcx), %edx
movq 0x8(%rax), %rcx
movl 0x124(%rsp), %esi
shlq $0x5, %rsi
addq %rsi, %rcx
movl %edx, 0x8(%rcx)
movq 0x130(%rsp), %rcx
movl 0xc(%rcx), %edx
movq 0x8(%rax), %rcx
movl 0x124(%rsp), %esi
shlq $0x5, %rsi
addq %rsi, %rcx
movl %edx, 0xc(%rcx)
movq 0x8(%rax), %rcx
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movb $0x1, 0x10(%rcx)
movq 0x130(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq 0x8(%rax), %rax
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x23b66
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rcx
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movl $0x0, 0xc(%rcx)
movq 0x8(%rax), %rcx
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movl $0x0, 0x8(%rcx)
movq 0x8(%rax), %rcx
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movl $0x0, 0x4(%rcx)
movq 0x8(%rax), %rcx
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movl $0x0, (%rcx)
movq 0x8(%rax), %rcx
movl 0x124(%rsp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movq $0x0, 0x18(%rcx)
movq 0x130(%rsp), %rsi
movq 0x8(%rax), %rdi
movl 0x124(%rsp), %eax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x17780
jmp 0x23b68
jmp 0x23b6a
movq 0xd0(%rsp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbx
popq %r14
popq %rbp
retq
movq 0x118(%rsp), %rdi
callq 0x5970
nopl (%rax,%rax)