// File: /workspace/github_cpp_makefile_star2_O3/manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImgDisplay::_handle_events(_XEvent const*)
void _handle_events(const XEvent *const pevent) {
      Display *const dpy = cimg::X11_attr().display;
      XEvent event = *pevent;
      switch (event.type) {
      case ClientMessage : {
        if ((int)event.xclient.message_type==(int)_wm_protocol_atom &&
            (int)event.xclient.data.l[0]==(int)_wm_window_atom) {
          XUnmapWindow(cimg::X11_attr().display,_window);
          _is_closed = _is_event = true;
          pthread_cond_broadcast(&cimg::X11_attr().wait_event);
        }
      } break;
      case ConfigureNotify : {
        while (XCheckWindowEvent(dpy,_window,StructureNotifyMask,&event)) {}
        const unsigned int nw = event.xconfigure.width, nh = event.xconfigure.height;
        const int nx = event.xconfigure.x, ny = event.xconfigure.y;
        if (nw && nh && (nw!=_window_width || nh!=_window_height)) {
          _window_width = nw; _window_height = nh; _mouse_x = _mouse_y = -1;
          XResizeWindow(dpy,_window,_window_width,_window_height);
          _is_resized = _is_event = true;
          pthread_cond_broadcast(&cimg::X11_attr().wait_event);
        }
        if (nx!=_window_x || ny!=_window_y) {
          _window_x = nx; _window_y = ny; _is_moved = _is_event = true;
          pthread_cond_broadcast(&cimg::X11_attr().wait_event);
        }
      } break;
      case Expose : {
        while (XCheckWindowEvent(dpy,_window,ExposureMask,&event)) {}
        _paint(false);
        if (_is_fullscreen) {
          XWindowAttributes attr;
          XGetWindowAttributes(dpy,_window,&attr);
          while (attr.map_state!=IsViewable) XSync(dpy,0);
          XSetInputFocus(dpy,_window,RevertToParent,CurrentTime);
        }
      } break;
      case ButtonPress : {
        do {
          _mouse_x = event.xmotion.x; _mouse_y = event.xmotion.y;
          if (_mouse_x<0 || _mouse_y<0 || _mouse_x>=width() || _mouse_y>=height()) _mouse_x = _mouse_y = -1;
          switch (event.xbutton.button) {
          case 1 : set_button(1); break;
          case 3 : set_button(2); break;
          case 2 : set_button(3); break;
          }
        } while (XCheckWindowEvent(dpy,_window,ButtonPressMask,&event));
      } break;
      case ButtonRelease : {
        do {
          _mouse_x = event.xmotion.x; _mouse_y = event.xmotion.y;
          if (_mouse_x<0 || _mouse_y<0 || _mouse_x>=width() || _mouse_y>=height()) _mouse_x = _mouse_y = -1;
          switch (event.xbutton.button) {
          case 1 : set_button(1,false); break;
          case 3 : set_button(2,false); break;
          case 2 : set_button(3,false); break;
          case 4 : set_wheel(1); break;
          case 5 : set_wheel(-1); break;
          }
        } while (XCheckWindowEvent(dpy,_window,ButtonReleaseMask,&event));
      } break;
      case KeyPress : {
        char tmp = 0; KeySym ksym;
        XLookupString(&event.xkey,&tmp,1,&ksym,0);
        set_key((unsigned int)ksym,true);
      } break;
      case KeyRelease : {
        char keys_return[32];  // Check that the key has been physically unpressed.
        XQueryKeymap(dpy,keys_return);
        const unsigned int kc = event.xkey.keycode, kc1 = kc/8, kc2 = kc%8;
        const bool is_key_pressed = kc1>=32?false:(keys_return[kc1]>>kc2)&1;
        if (!is_key_pressed) {
          char tmp = 0; KeySym ksym;
          XLookupString(&event.xkey,&tmp,1,&ksym,0);
          set_key((unsigned int)ksym,false);
        }
      } break;
      case EnterNotify: {
        while (XCheckWindowEvent(dpy,_window,EnterWindowMask,&event)) {}
        _mouse_x = event.xmotion.x;
        _mouse_y = event.xmotion.y;
        if (_mouse_x<0 || _mouse_y<0 || _mouse_x>=width() || _mouse_y>=height()) _mouse_x = _mouse_y = -1;
      } break;
      case LeaveNotify : {
        while (XCheckWindowEvent(dpy,_window,LeaveWindowMask,&event)) {}
        _mouse_x = _mouse_y =-1; _is_event = true;
        pthread_cond_broadcast(&cimg::X11_attr().wait_event);
      } break;
      case MotionNotify : {
        while (XCheckWindowEvent(dpy,_window,PointerMotionMask,&event)) {}
        _mouse_x = event.xmotion.x;
        _mouse_y = event.xmotion.y;
        if (_mouse_x<0 || _mouse_y<0 || _mouse_x>=width() || _mouse_y>=height()) _mouse_x = _mouse_y = -1;
        _is_event = true;
        pthread_cond_broadcast(&cimg::X11_attr().wait_event);
      } break;
      }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x160, %rsp            # imm = 0x160
movq %rsi, %r15
movq %rdi, %rbx
movb 0x8726f(%rip), %al      # 0xaad00
testb %al, %al
je 0x2407f
movq 0x87250(%rip), %r14     # 0xaacf0
leaq 0x10(%rsp), %r12
movl $0xc0, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x4440
movl (%r12), %ecx
leal -0x2(%rcx), %eax
cmpl $0x14, %eax
ja 0x23b06
leaq 0x4a8bc(%rip), %rcx     # 0x6e384
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x8(%rsp), %rsi
movb $0x0, (%rsi)
leaq 0x10(%rsp), %rdi
leaq 0xd0(%rsp), %r14
movl $0x1, %edx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x44b0
movl (%r14), %esi
movq %rbx, %rdi
movl $0x1, %edx
jmp 0x23f72
cmpl $0x21, %ecx
jne 0x2406f
movl 0x38(%rsp), %eax
cmpl 0x4c8(%rbx), %eax
jne 0x2406f
movl 0x48(%rsp), %eax
cmpl 0x4c0(%rbx), %eax
jne 0x2406f
movb 0x871cb(%rip), %al      # 0xaad00
testb %al, %al
je 0x24160
movq 0x871ac(%rip), %rdi     # 0xaacf0
movq 0x4d0(%rbx), %rsi
callq 0x47b0
movb $0x1, 0x463(%rbx)
movb 0x463(%rbx), %al
movb %al, 0x460(%rbx)
movb 0x87197(%rip), %al      # 0xaad00
testb %al, %al
je 0x241ab
leaq 0x85120(%rip), %rdi     # 0xa8c98
addq $0x160, %rsp            # imm = 0x160
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4180
leaq 0x10(%rsp), %r15
movq 0x4d0(%rbx), %rsi
movl $0x20000, %edx          # imm = 0x20000
movq %r14, %rdi
movq %r15, %rcx
callq 0x4390
testl %eax, %eax
jne 0x23b91
movl 0x48(%rsp), %eax
movl 0x4c(%rsp), %ecx
movl 0x40(%rsp), %ebp
movl 0x44(%rsp), %r15d
testl %eax, %eax
setne %dl
testl %ecx, %ecx
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x23c39
cmpl 0x40(%rbx), %eax
jne 0x23bdb
cmpl 0x44(%rbx), %ecx
je 0x23c39
movl %eax, 0x40(%rbx)
movl %ecx, 0x44(%rbx)
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
movq 0x4d0(%rbx), %rsi
movl 0x40(%rbx), %edx
movl 0x44(%rbx), %ecx
movq %r14, %rdi
callq 0x4790
movb $0x1, 0x463(%rbx)
movb 0x463(%rbx), %al
movb %al, 0x461(%rbx)
movb 0x870db(%rip), %al      # 0xaad00
testb %al, %al
je 0x24115
leaq 0x85064(%rip), %rdi     # 0xa8c98
callq 0x4180
cmpl 0x44c(%rbx), %ebp
jne 0x23c4e
cmpl 0x450(%rbx), %r15d
je 0x2406f
movl %ebp, 0x44c(%rbx)
movl %r15d, 0x450(%rbx)
movb $0x1, 0x463(%rbx)
movb 0x463(%rbx), %al
movb %al, 0x462(%rbx)
movb 0x8708c(%rip), %al      # 0xaad00
testb %al, %al
jne 0x23d90
leaq 0x8707d(%rip), %rdi     # 0xaad00
callq 0x49c0
testl %eax, %eax
je 0x23d90
leaq 0x84ff1(%rip), %rdi     # 0xa8c88
callq 0x211ec
jmp 0x240ea
leaq 0x10(%rsp), %r15
movq 0x4d0(%rbx), %rsi
movl $0x40, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4390
testl %eax, %eax
jne 0x23ca6
movl 0x50(%rsp), %eax
movl %eax, 0x454(%rbx)
movl 0x54(%rsp), %eax
movl %eax, 0x458(%rbx)
cmpl $0x0, 0x454(%rbx)
js 0x23cfd
cmpl $0x0, 0x458(%rbx)
js 0x23cfd
movl 0x454(%rbx), %eax
cmpl 0x18(%rbx), %eax
jge 0x23cfd
movl 0x458(%rbx), %eax
cmpl 0x1c(%rbx), %eax
jl 0x23d13
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
movb $0x1, 0x463(%rbx)
movb 0x86fe0(%rip), %al      # 0xaad00
testb %al, %al
jne 0x23d90
leaq 0x86fd5(%rip), %rdi     # 0xaad00
callq 0x49c0
testl %eax, %eax
je 0x23d90
leaq 0x84f4d(%rip), %rdi     # 0xa8c88
callq 0x211ec
jmp 0x240ea
leaq 0x10(%rsp), %r15
movq 0x4d0(%rbx), %rsi
movl $0x20, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4390
testl %eax, %eax
jne 0x23d4a
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
movb $0x1, 0x463(%rbx)
movb 0x86f78(%rip), %al      # 0xaad00
testb %al, %al
je 0x240ca
leaq 0x84f01(%rip), %rdi     # 0xa8c98
callq 0x4180
jmp 0x2406f
leaq 0x4bccc(%rip), %r12     # 0x6fa74
leaq 0x10(%rsp), %r15
movl 0x50(%rsp), %eax
movl %eax, 0x454(%rbx)
movl 0x54(%rsp), %eax
movl %eax, 0x458(%rbx)
cmpl $0x0, 0x454(%rbx)
js 0x23de9
cmpl $0x0, 0x458(%rbx)
js 0x23de9
movl 0x454(%rbx), %eax
cmpl 0x18(%rbx), %eax
jge 0x23de9
movl 0x458(%rbx), %eax
cmpl 0x1c(%rbx), %eax
jl 0x23dff
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
movl 0x64(%rsp), %eax
decl %eax
cmpl $0x2, %eax
ja 0x23e1d
movl %eax, %eax
movl (%r12,%rax,4), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x24352
movq 0x4d0(%rbx), %rsi
movl $0x4, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4390
testl %eax, %eax
jne 0x23dad
jmp 0x2406f
leaq 0x10(%rsp), %r15
leaq 0x4a58b(%rip), %r12     # 0x6e3d8
movl 0x50(%rsp), %eax
movl %eax, 0x454(%rbx)
movl 0x54(%rsp), %eax
movl %eax, 0x458(%rbx)
cmpl $0x0, 0x454(%rbx)
js 0x23e89
cmpl $0x0, 0x458(%rbx)
js 0x23e89
movl 0x454(%rbx), %eax
cmpl 0x18(%rbx), %eax
jge 0x23e89
movl 0x458(%rbx), %eax
cmpl 0x1c(%rbx), %eax
jl 0x23e9f
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
movl 0x64(%rsp), %eax
decl %eax
cmpl $0x4, %eax
ja 0x23eef
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movq %rbx, %rdi
movl $0x1, %esi
jmp 0x23ee8
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
jmp 0x23ed9
movq %rbx, %rdi
movl $0x2, %esi
jmp 0x23ee8
movq %rbx, %rdi
movl $0x1, %esi
callq 0x243fc
jmp 0x23eef
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x24352
movq 0x4d0(%rbx), %rsi
movl $0x8, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4390
testl %eax, %eax
jne 0x23e4d
jmp 0x2406f
leaq 0xd0(%rsp), %rsi
movq %r14, %rdi
callq 0x4600
movl 0x64(%rsp), %eax
cmpq $0xff, %rax
ja 0x23f48
movl %eax, %ecx
shrl $0x3, %ecx
movzbl 0xd0(%rsp,%rcx), %ecx
andl $0x7, %eax
btl %eax, %ecx
jb 0x2406f
leaq 0x7(%rsp), %rsi
movb $0x0, (%rsi)
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %r14
movl $0x1, %edx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x44b0
movl (%r14), %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x24488
jmp 0x2406f
leaq 0x10(%rsp), %r15
movq 0x4d0(%rbx), %rsi
movl $0x10, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4390
testl %eax, %eax
jne 0x23f81
movl 0x50(%rsp), %eax
movl %eax, 0x454(%rbx)
movl 0x54(%rsp), %eax
movl %eax, 0x458(%rbx)
cmpl $0x0, 0x454(%rbx)
js 0x23fdc
cmpl $0x0, 0x458(%rbx)
js 0x23fdc
movl 0x454(%rbx), %eax
cmpl 0x18(%rbx), %eax
jge 0x23fdc
movl 0x458(%rbx), %eax
cmpl 0x1c(%rbx), %eax
jl 0x2406f
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
jmp 0x2406f
leaq 0x10(%rsp), %r15
movq 0x4d0(%rbx), %rsi
movl $0x8000, %edx           # imm = 0x8000
movq %r14, %rdi
movq %r15, %rcx
callq 0x4390
testl %eax, %eax
jne 0x23ff9
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2421a
cmpb $0x1, 0x30(%rbx)
jne 0x2406f
movq 0x4d0(%rbx), %rsi
leaq 0xd0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x4970
cmpl $0x2, 0x5c(%r15)
je 0x24059
movq %r14, %rdi
xorl %esi, %esi
callq 0x4a30
cmpl $0x2, 0x12c(%rsp)
jne 0x24045
movq 0x4d0(%rbx), %rsi
movq %r14, %rdi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x4410
addq $0x160, %rsp            # imm = 0x160
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x86c7a(%rip), %rdi     # 0xaad00
callq 0x49c0
testl %eax, %eax
je 0x23a99
leaq 0x84bee(%rip), %rdi     # 0xa8c88
callq 0x211ec
leaq -0x2e7c(%rip), %rdi     # 0x2122a
leaq 0x84bdb(%rip), %rsi     # 0xa8c88
leaq 0x844ac(%rip), %rdx     # 0xa8560
callq 0x44c0
leaq 0x86c40(%rip), %rdi     # 0xaad00
callq 0x4330
jmp 0x23a99
leaq 0x86c2f(%rip), %rdi     # 0xaad00
callq 0x49c0
testl %eax, %eax
je 0x23d90
leaq 0x84ba3(%rip), %rdi     # 0xa8c88
callq 0x211ec
leaq -0x2ec7(%rip), %rdi     # 0x2122a
leaq 0x84b90(%rip), %rsi     # 0xa8c88
leaq 0x84461(%rip), %rdx     # 0xa8560
callq 0x44c0
leaq 0x86bf5(%rip), %rdi     # 0xaad00
callq 0x4330
jmp 0x23d90
leaq 0x86be4(%rip), %rdi     # 0xaad00
callq 0x49c0
testl %eax, %eax
je 0x23c2d
leaq 0x84b58(%rip), %rdi     # 0xa8c88
callq 0x211ec
leaq -0x2f12(%rip), %rdi     # 0x2122a
leaq 0x84b45(%rip), %rsi     # 0xa8c88
leaq 0x84416(%rip), %rdx     # 0xa8560
callq 0x44c0
leaq 0x86baa(%rip), %rdi     # 0xaad00
callq 0x4330
jmp 0x23c2d
leaq 0x86b99(%rip), %rdi     # 0xaad00
callq 0x49c0
testl %eax, %eax
je 0x23b3d
leaq 0x84b0d(%rip), %rdi     # 0xa8c88
callq 0x211ec
leaq -0x2f5d(%rip), %rdi     # 0x2122a
leaq 0x84afa(%rip), %rsi     # 0xa8c88
leaq 0x843cb(%rip), %rdx     # 0xa8560
callq 0x44c0
leaq 0x86b5f(%rip), %rdi     # 0xaad00
callq 0x4330
jmp 0x23b3d
leaq 0x86b4e(%rip), %rdi     # 0xaad00
callq 0x49c0
testl %eax, %eax
je 0x23b71
leaq 0x84ac2(%rip), %rdi     # 0xa8c88
callq 0x211ec
leaq -0x2fa8(%rip), %rdi     # 0x2122a
leaq 0x84aaf(%rip), %rsi     # 0xa8c88
leaq 0x84380(%rip), %rdx     # 0xa8560
callq 0x44c0
leaq 0x86b14(%rip), %rdi     # 0xaad00
callq 0x4330
jmp 0x23b71
jmp 0x24202
jmp 0x24202
jmp 0x24202
jmp 0x24202
jmp 0x24202
jmp 0x24202
movq %rax, %rbx
leaq 0x86af4(%rip), %rdi     # 0xaad00
callq 0x4310
movq %rbx, %rdi
callq 0x4960
nop