// File: /workspace/github_cpp_makefile_star2_O2/kallaballa[P]PixelStencil/./CImg.h
// Function: cimg_library::CImgList<char>::insert(cimg_library::CImg<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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r13d
movq %rsi, %rbp
movq %rdi, %rbx
cmpl $-0x1, %edx
movl (%rdi), %r12d
cmovel %r12d, %r13d
cmpl %r13d, %r12d
jb 0x13816
leal 0x1(%r12), %edx
movl %edx, (%rbx)
movl 0x4(%rbx), %eax
cmpl %eax, %edx
jbe 0x136a7
movl %ecx, 0x4(%rsp)
movq %rbp, 0x10(%rsp)
leal (%rax,%rax), %ecx
testl %eax, %eax
pushq $0x10
popq %rbp
cmovnel %ecx, %ebp
movl %ebp, 0x4(%rbx)
movq %rbp, %r14
shlq $0x5, %r14
leaq 0x8(%r14), %rdi
callq 0x3040
movq %rax, %r15
movq %rbp, (%rax)
testl %ebp, %ebp
je 0x13616
leaq 0x20(%r15), %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
andq $0x0, (%rax,%rcx)
movups %xmm0, -0x18(%rax,%rcx)
movb $0x0, -0x8(%rax,%rcx)
addq $0x20, %rcx
cmpq %rcx, %r14
jne 0x135fe
addq $0x8, %r15
leaq 0x8(%rbx), %rdx
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0x137ad
movq %rdx, 0x8(%rsp)
testl %r13d, %r13d
movq 0x10(%rsp), %rbp
je 0x1364c
movl %r13d, %edx
shlq $0x5, %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3210
movl %r12d, %edx
subl %r13d, %edx
je 0x1366f
movl %r13d, %esi
shlq $0x5, %rsi
leaq (%r15,%rsi), %rdi
addq $0x20, %rdi
addq %r14, %rsi
shlq $0x5, %rdx
callq 0x3210
cmpb $0x0, 0x4(%rsp)
je 0x1371e
movq 0x18(%rbp), %rax
testq %rax, %rax
je 0x1371e
movl %r13d, %ecx
shlq $0x5, %rcx
movups (%rbp), %xmm0
movups %xmm0, (%r15,%rcx)
movb $0x1, 0x10(%r15,%rcx)
movq %rax, 0x18(%r15,%rcx)
jmp 0x13749
leaq 0x8(%rbx), %rdx
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x137b8
movl %ecx, %r15d
movl %r13d, %r14d
subl %r13d, %r12d
je 0x136e8
movq %r14, %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %rsi
leaq (%rax,%rcx), %rdi
addq $0x20, %rdi
shlq $0x5, %r12
movq %rdx, %r13
movq %r12, %rdx
callq 0x34c0
movq %r13, %rdx
testb %r15b, %r15b
je 0x137e3
movq 0x18(%rbp), %rcx
movq (%rdx), %rax
testq %rcx, %rcx
je 0x137e6
shlq $0x5, %r14
movups (%rbp), %xmm0
movups %xmm0, (%rax,%r14)
movb $0x1, 0x10(%rax,%r14)
movq %rcx, 0x18(%rax,%r14)
jmp 0x13804
movl %r13d, %eax
shlq $0x5, %rax
andq $0x0, 0x18(%r15,%rax)
leaq (%r15,%rax), %rdi
xorps %xmm0, %xmm0
movups %xmm0, (%r15,%rax)
movq %rbp, %rsi
callq 0x1388c
movq 0x8(%rbx), %r14
movl (%rbx), %r12d
decl %r12d
movl %r12d, %edx
shlq $0x5, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x3150
movq 0x8(%rsp), %rax
movq (%rax), %r13
testq %r13, %r13
je 0x137a8
leaq -0x8(%r13), %r14
movq -0x8(%r13), %r12
testq %r12, %r12
je 0x13790
addq $-0x20, %r13
movq %r12, %rbp
shlq $0x5, %rbp
movq %r13, %rdi
addq %rbp, %rdi
callq 0x13160
addq $-0x20, %rbp
jne 0x1377f
shlq $0x5, %r12
orq $0x8, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x3570
movq 0x8(%rsp), %rax
movq %r15, (%rax)
jmp 0x13804
movq 0x10(%rsp), %rbp
movl 0x4(%rsp), %ecx
jmp 0x137bb
xorl %r15d, %r15d
movq %r15, (%rdx)
testb %cl, %cl
je 0x137de
movq 0x18(%rbp), %rax
testq %rax, %rax
je 0x137de
movups (%rbp), %xmm0
movups %xmm0, (%r15)
movb $0x1, 0x10(%r15)
movq %rax, 0x18(%r15)
jmp 0x13804
movq %r15, %rdi
jmp 0x137fc
movq (%rdx), %rax
shlq $0x5, %r14
andq $0x0, 0x18(%rax,%r14)
leaq (%rax,%r14), %rdi
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%r14)
movq %rbp, %rsi
callq 0x1388c
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x3110
movq %rax, %r14
movl (%rbx), %edx
movl 0x4(%rbx), %ecx
movq 0x8(%rbx), %r8
movl (%rbp), %r10d
movl 0x4(%rbp), %r11d
movl 0x8(%rbp), %ebx
movl 0xc(%rbp), %r15d
leaq 0x105d5(%rip), %rsi     # 0x23e17
leaq 0xee4a(%rip), %r9       # 0x22693
movq %rax, %rdi
xorl %eax, %eax
pushq %r13
pushq 0x18(%rbp)
pushq %r15
pushq %rbx
pushq %r11
pushq %r10
callq 0x531a
addq $0x30, %rsp
leaq 0x1c45e(%rip), %rsi     # 0x2fcc8
movq 0x1c767(%rip), %rdx     # 0x2ffd8
movq %r14, %rdi
callq 0x34e0
movq %rax, %rbx
movq %r14, %rdi
callq 0x31d0
movq %rbx, %rdi
callq 0x3500