// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImgDisplay::_init_fullscreen()
void _init_fullscreen() {
      if (!_is_fullscreen || _is_closed) return;
      Display *const dpy = cimg::X11_attr().display;
      _background_window = 0;

#ifdef cimg_use_xrandr
      int foo;
      if (XRRQueryExtension(dpy,&foo,&foo)) {
        XRRRotations(dpy,DefaultScreen(dpy),&cimg::X11_attr().curr_rotation);
        if (!cimg::X11_attr().resolutions) {
          cimg::X11_attr().resolutions = XRRSizes(dpy,DefaultScreen(dpy),&foo);
          cimg::X11_attr().nb_resolutions = (unsigned int)foo;
        }
        if (cimg::X11_attr().resolutions) {
          cimg::X11_attr().curr_resolution = 0;
          for (unsigned int i = 0; i<cimg::X11_attr().nb_resolutions; ++i) {
            const unsigned int
              nw = (unsigned int)(cimg::X11_attr().resolutions[i].width),
              nh = (unsigned int)(cimg::X11_attr().resolutions[i].height);
            if (nw>=_width && nh>=_height &&
                nw<=(unsigned int)(cimg::X11_attr().resolutions[cimg::X11_attr().curr_resolution].width) &&
                nh<=(unsigned int)(cimg::X11_attr().resolutions[cimg::X11_attr().curr_resolution].height))
              cimg::X11_attr().curr_resolution = i;
          }
          if (cimg::X11_attr().curr_resolution>0) {
            XRRScreenConfiguration *config = XRRGetScreenInfo(dpy,DefaultRootWindow(dpy));
            XRRSetScreenConfig(dpy,config,DefaultRootWindow(dpy),
                               cimg::X11_attr().curr_resolution,cimg::X11_attr().curr_rotation,CurrentTime);
            XRRFreeScreenConfigInfo(config);
            XSync(dpy,0);
          }
        }
      }
      if (!cimg::X11_attr().resolutions)
        cimg::warn(_cimgdisplay_instance
                   "init_fullscreen(): Xrandr extension not supported by the X server.",
                   cimgdisplay_instance);
#endif

      const unsigned int sx = screen_width(), sy = screen_height();
      if (sx==_width && sy==_height) return;
      XSetWindowAttributes winattr;
      winattr.override_redirect = 1;
      _background_window = XCreateWindow(dpy,DefaultRootWindow(dpy),0,0,sx,sy,0,0,
                                         InputOutput,CopyFromParent,CWOverrideRedirect,&winattr);
      const unsigned long buf_size = (unsigned long)sx*sy*(cimg::X11_attr().nb_bits==8?1:
                                                           (cimg::X11_attr().nb_bits==16?2:4));
      void *background_data = std::malloc(buf_size);
      std::memset(background_data,0,buf_size);
      XImage *background_image = XCreateImage(dpy,DefaultVisual(dpy,DefaultScreen(dpy)),cimg::X11_attr().nb_bits,
                                              ZPixmap,0,(char*)background_data,sx,sy,8,0);
      XEvent event;
      XSelectInput(dpy,_background_window,StructureNotifyMask);
      XMapRaised(dpy,_background_window);
      do XWindowEvent(dpy,_background_window,StructureNotifyMask,&event);
      while (event.type!=MapNotify);
      GC gc = DefaultGC(dpy,DefaultScreen(dpy));
#ifdef cimg_use_xshm
      if (_shminfo) XShmPutImage(dpy,_background_window,gc,background_image,0,0,0,0,sx,sy,0);
      else XPutImage(dpy,_background_window,gc,background_image,0,0,0,0,sx,sy);
#else
      XPutImage(dpy,_background_window,gc,background_image,0,0,0,0,sx,sy);
#endif
      XWindowAttributes attr;
      XGetWindowAttributes(dpy,_background_window,&attr);
      while (attr.map_state!=IsViewable) XSync(dpy,0);
      XDestroyImage(background_image);
    }

// Assembly:
subq $0x248, %rsp            # imm = 0x248
movq %rdi, 0x240(%rsp)
movq 0x240(%rsp), %rax
movq %rax, 0x50(%rsp)
testb $0x1, 0x30(%rax)
je 0x3b491
movq 0x50(%rsp), %rax
movb 0x460(%rax), %al
testb $0x1, %al
je 0x3b496
jmp 0x3b7ff
callq 0x37200
movq %rax, %rcx
movq 0x50(%rsp), %rax
movq 0x2068(%rcx), %rcx
movq %rcx, 0x238(%rsp)
movq $0x0, 0x4d8(%rax)
callq 0x17990
movl %eax, 0x234(%rsp)
callq 0x17ab0
movq 0x50(%rsp), %rcx
movl %eax, 0x230(%rsp)
movl 0x234(%rsp), %eax
cmpl 0x18(%rcx), %eax
jne 0x3b4fc
movq 0x50(%rsp), %rcx
movl 0x230(%rsp), %eax
cmpl 0x1c(%rcx), %eax
jne 0x3b4fc
jmp 0x3b7ff
movl $0x1, 0x218(%rsp)
movq 0x238(%rsp), %rdi
movq 0x238(%rsp), %rax
movq 0xe8(%rax), %rax
movq 0x238(%rsp), %rcx
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
movl 0x234(%rsp), %r8d
movl 0x230(%rsp), %r9d
xorl %ecx, %ecx
xorl %eax, %eax
leaq 0x1c0(%rsp), %rax
movl %ecx, %edx
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x200, 0x20(%rsp)      # imm = 0x200
movq %rax, 0x28(%rsp)
callq 0x5840
movq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x4d8(%rax)
movl 0x234(%rsp), %eax
movl 0x230(%rsp), %ecx
imulq %rcx, %rax
movq %rax, 0x48(%rsp)
callq 0x37200
cmpl $0x8, 0x2070(%rax)
jne 0x3b5c8
movl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x3b5e7
callq 0x37200
movl 0x2070(%rax), %edx
movl $0x4, %eax
movl $0x2, %ecx
cmpl $0x10, %edx
cmovel %ecx, %eax
movl %eax, 0x44(%rsp)
movq 0x48(%rsp), %rax
movl 0x44(%rsp), %ecx
movslq %ecx, %rcx
imulq %rcx, %rax
movq %rax, 0x1b8(%rsp)
movq 0x1b8(%rsp), %rdi
callq 0x56a0
movq %rax, 0x1b0(%rsp)
movq 0x1b0(%rsp), %rdi
movq 0x1b8(%rsp), %rdx
xorl %esi, %esi
callq 0x52a0
movq 0x238(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x238(%rsp), %rax
movq 0xe8(%rax), %rax
movq 0x238(%rsp), %rcx
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x40(%rax), %rax
movq %rax, 0x38(%rsp)
callq 0x37200
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl 0x2070(%rax), %edx
movq 0x1b0(%rsp), %r9
movl 0x234(%rsp), %r10d
movl 0x230(%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 0x50(%rsp), %rax
movq %rcx, 0x1a8(%rsp)
movq 0x238(%rsp), %rdi
movq 0x4d8(%rax), %rsi
movl $0x20000, %edx          # imm = 0x20000
callq 0x5300
movq 0x50(%rsp), %rax
movq 0x238(%rsp), %rdi
movq 0x4d8(%rax), %rsi
callq 0x5a70
movq 0x50(%rsp), %rax
movq 0x238(%rsp), %rdi
movq 0x4d8(%rax), %rsi
movl $0x20000, %edx          # imm = 0x20000
leaq 0xe8(%rsp), %rcx
callq 0x5110
cmpl $0x13, 0xe8(%rsp)
jne 0x3b6f9
movq 0x50(%rsp), %rax
movq 0x238(%rsp), %rcx
movq 0xe8(%rcx), %rcx
movq 0x238(%rsp), %rdx
movslq 0xe0(%rdx), %rdx
shlq $0x7, %rdx
addq %rdx, %rcx
movq 0x48(%rcx), %rcx
movq %rcx, 0xe0(%rsp)
movq 0x238(%rsp), %rdi
movq 0x4d8(%rax), %rsi
movq 0xe0(%rsp), %rdx
movq 0x1a8(%rsp), %rcx
movl 0x234(%rsp), %r10d
movl 0x230(%rsp), %eax
xorl %r9d, %r9d
movl %r9d, %r8d
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
callq 0x5ad0
movq 0x50(%rsp), %rax
movq 0x238(%rsp), %rdi
movq 0x4d8(%rax), %rsi
leaq 0x58(%rsp), %rdx
callq 0x5990
cmpl $0x2, 0xb4(%rsp)
je 0x3b7e9
movq 0x238(%rsp), %rdi
xorl %esi, %esi
callq 0x5a60
jmp 0x3b7ce
movq 0x1a8(%rsp), %rax
movq 0x60(%rax), %rax
movq 0x1a8(%rsp), %rdi
callq *%rax
addq $0x248, %rsp            # imm = 0x248
retq
nopw (%rax,%rax)