// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: void cimg_library::CImgDisplay::_resize<unsigned char>(unsigned char, unsigned int, unsigned int, bool)
void _resize(T pixel_type, const unsigned int ndimx, const unsigned int ndimy, const bool force_redraw) {
      Display *const dpy = cimg::X11_attr().display;
      cimg::unused(pixel_type);

#ifdef cimg_use_xshm
      if (_shminfo) {
        XShmSegmentInfo *const nshminfo = new XShmSegmentInfo;
        XImage *const nimage = XShmCreateImage(dpy,DefaultVisual(dpy,DefaultScreen(dpy)),
                                               cimg::X11_attr().nb_bits,ZPixmap,0,nshminfo,ndimx,ndimy);
        if (!nimage) { delete nshminfo; return; }
        else {
          nshminfo->shmid = shmget(IPC_PRIVATE,ndimx*ndimy*sizeof(T),IPC_CREAT | 0777);
          if (nshminfo->shmid==-1) { XDestroyImage(nimage); delete nshminfo; return; }
          else {
            nshminfo->shmaddr = nimage->data = (char*)shmat(nshminfo->shmid,0,0);
            if (nshminfo->shmaddr==(char*)-1) {
              shmctl(nshminfo->shmid,IPC_RMID,0); XDestroyImage(nimage); delete nshminfo; return;
            } else {
              nshminfo->readOnly = 0;
              cimg::X11_attr().is_shm_enabled = true;
              XErrorHandler oldXErrorHandler = XSetErrorHandler(_assign_xshm);
              XShmAttach(dpy,nshminfo);
              XFlush(dpy);
              XSetErrorHandler(oldXErrorHandler);
              if (!cimg::X11_attr().is_shm_enabled) {
                shmdt(nshminfo->shmaddr);
                shmctl(nshminfo->shmid,IPC_RMID,0);
                XDestroyImage(nimage);
                delete nshminfo;
                return;
              } else {
                T *const ndata = (T*)nimage->data;
                if (force_redraw) _render_resize((T*)_data,_width,_height,ndata,ndimx,ndimy);
                else std::memset(ndata,0,sizeof(T)*ndimx*ndimy);
                XShmDetach(dpy,_shminfo);
                XDestroyImage(_image);
                shmdt(_shminfo->shmaddr);
                shmctl(_shminfo->shmid,IPC_RMID,0);
                delete _shminfo;
                _shminfo = nshminfo;
                _image = nimage;
                _data = (void*)ndata;
              }
            }
          }
        }
      } else
#endif
        {
          T *ndata = (T*)std::malloc(ndimx*ndimy*sizeof(T));
          if (force_redraw) _render_resize((T*)_data,_width,_height,ndata,ndimx,ndimy);
          else std::memset(ndata,0,sizeof(T)*ndimx*ndimy);
          _data = (void*)ndata;
          XDestroyImage(_image);
          _image = XCreateImage(dpy,DefaultVisual(dpy,DefaultScreen(dpy)),
                                cimg::X11_attr().nb_bits,ZPixmap,0,(char*)_data,ndimx,ndimy,8,0);
        }
    }

// Assembly:
subq $0x68, %rsp
movb %r8b, %al
movq %rdi, 0x60(%rsp)
movb %sil, 0x5f(%rsp)
movl %edx, 0x58(%rsp)
movl %ecx, 0x54(%rsp)
andb $0x1, %al
movb %al, 0x53(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x38(%rsp)
callq 0x37200
movq 0x2068(%rax), %rax
movq %rax, 0x48(%rsp)
leaq 0x5f(%rsp), %rdi
movb $0x0, %al
callq 0x5be10
movl 0x58(%rsp), %eax
imull 0x54(%rsp), %eax
movl %eax, %eax
movl %eax, %edi
shlq $0x0, %rdi
callq 0x56a0
movq %rax, 0x40(%rsp)
testb $0x1, 0x53(%rsp)
je 0x5ba50
movq 0x38(%rsp), %rax
movq 0x4f0(%rax), %rdi
movl 0x18(%rax), %esi
movl 0x1c(%rax), %edx
movq 0x40(%rsp), %rcx
movl 0x58(%rsp), %r8d
movl 0x54(%rsp), %r9d
callq 0x43490
jmp 0x5ba6e
movq 0x40(%rsp), %rdi
movl 0x58(%rsp), %eax
movl %eax, %edx
shlq $0x0, %rdx
movl 0x54(%rsp), %eax
imulq %rax, %rdx
xorl %esi, %esi
callq 0x52a0
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rax, 0x4f0(%rcx)
movq 0x4e8(%rcx), %rax
movq 0x60(%rax), %rax
movq 0x4e8(%rcx), %rdi
callq *%rax
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq 0xe8(%rax), %rax
movq 0x48(%rsp), %rcx
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x40(%rax), %rax
movq %rax, 0x30(%rsp)
callq 0x37200
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq %rax, %rcx
movq 0x38(%rsp), %rax
movl 0x2070(%rcx), %edx
movq 0x4f0(%rax), %r9
movl 0x58(%rsp), %r10d
movl 0x54(%rsp), %eax
movl $0x2, %ecx
xorl %r8d, %r8d
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movl $0x8, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
callq 0x5620
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x4e8(%rax)
addq $0x68, %rsp
retq
nopl (%rax,%rax)