// File: /workspace/github_cpp_makefile_star2_O1/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 0x8c31b(%rip), %al      # 0xafcf0
testb %al, %al
je 0x23fc3
movq 0x8c2fc(%rip), %r14     # 0xafce0
leaq 0x10(%rsp), %r12
movl $0xc0, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x4430
movl (%r12), %ecx
leal -0x2(%rcx), %eax
cmpl $0x14, %eax
ja 0x23a4a
leaq 0x4d978(%rip), %rcx     # 0x71384
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 0x44a0
movl (%r14), %esi
movq %rbx, %rdi
movl $0x1, %edx
jmp 0x23eb6
cmpl $0x21, %ecx
jne 0x23fb3
movl 0x38(%rsp), %eax
cmpl 0x4c8(%rbx), %eax
jne 0x23fb3
movl 0x48(%rsp), %eax
cmpl 0x4c0(%rbx), %eax
jne 0x23fb3
movb 0x8c277(%rip), %al      # 0xafcf0
testb %al, %al
je 0x240a4
movq 0x8c258(%rip), %rdi     # 0xafce0
movq 0x4d0(%rbx), %rsi
callq 0x47a0
movb $0x1, 0x463(%rbx)
movb 0x463(%rbx), %al
movb %al, 0x460(%rbx)
movb 0x8c243(%rip), %al      # 0xafcf0
testb %al, %al
je 0x240ef
leaq 0x8a1cc(%rip), %rdi     # 0xadc88
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 0x4380
testl %eax, %eax
jne 0x23ad5
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 0x23b7d
cmpl 0x40(%rbx), %eax
jne 0x23b1f
cmpl 0x44(%rbx), %ecx
je 0x23b7d
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 0x4780
movb $0x1, 0x463(%rbx)
movb 0x463(%rbx), %al
movb %al, 0x461(%rbx)
movb 0x8c187(%rip), %al      # 0xafcf0
testb %al, %al
je 0x24059
leaq 0x8a110(%rip), %rdi     # 0xadc88
callq 0x4180
cmpl 0x44c(%rbx), %ebp
jne 0x23b92
cmpl 0x450(%rbx), %r15d
je 0x23fb3
movl %ebp, 0x44c(%rbx)
movl %r15d, 0x450(%rbx)
movb $0x1, 0x463(%rbx)
movb 0x463(%rbx), %al
movb %al, 0x462(%rbx)
movb 0x8c138(%rip), %al      # 0xafcf0
testb %al, %al
jne 0x23cd4
leaq 0x8c129(%rip), %rdi     # 0xafcf0
callq 0x49b0
testl %eax, %eax
je 0x23cd4
leaq 0x8a09d(%rip), %rdi     # 0xadc78
callq 0x21188
jmp 0x2402e
leaq 0x10(%rsp), %r15
movq 0x4d0(%rbx), %rsi
movl $0x40, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4380
testl %eax, %eax
jne 0x23bea
movl 0x50(%rsp), %eax
movl %eax, 0x454(%rbx)
movl 0x54(%rsp), %eax
movl %eax, 0x458(%rbx)
cmpl $0x0, 0x454(%rbx)
js 0x23c41
cmpl $0x0, 0x458(%rbx)
js 0x23c41
movl 0x454(%rbx), %eax
cmpl 0x18(%rbx), %eax
jge 0x23c41
movl 0x458(%rbx), %eax
cmpl 0x1c(%rbx), %eax
jl 0x23c57
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
movb $0x1, 0x463(%rbx)
movb 0x8c08c(%rip), %al      # 0xafcf0
testb %al, %al
jne 0x23cd4
leaq 0x8c081(%rip), %rdi     # 0xafcf0
callq 0x49b0
testl %eax, %eax
je 0x23cd4
leaq 0x89ff9(%rip), %rdi     # 0xadc78
callq 0x21188
jmp 0x2402e
leaq 0x10(%rsp), %r15
movq 0x4d0(%rbx), %rsi
movl $0x20, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4380
testl %eax, %eax
jne 0x23c8e
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
movb $0x1, 0x463(%rbx)
movb 0x8c024(%rip), %al      # 0xafcf0
testb %al, %al
je 0x2400e
leaq 0x89fad(%rip), %rdi     # 0xadc88
callq 0x4180
jmp 0x23fb3
leaq 0x50858(%rip), %r12     # 0x74544
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 0x23d2d
cmpl $0x0, 0x458(%rbx)
js 0x23d2d
movl 0x454(%rbx), %eax
cmpl 0x18(%rbx), %eax
jge 0x23d2d
movl 0x458(%rbx), %eax
cmpl 0x1c(%rbx), %eax
jl 0x23d43
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
movl 0x64(%rsp), %eax
decl %eax
cmpl $0x2, %eax
ja 0x23d61
movl %eax, %eax
movl (%r12,%rax,4), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x24296
movq 0x4d0(%rbx), %rsi
movl $0x4, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4380
testl %eax, %eax
jne 0x23cf1
jmp 0x23fb3
leaq 0x10(%rsp), %r15
leaq 0x4d647(%rip), %r12     # 0x713d8
movl 0x50(%rsp), %eax
movl %eax, 0x454(%rbx)
movl 0x54(%rsp), %eax
movl %eax, 0x458(%rbx)
cmpl $0x0, 0x454(%rbx)
js 0x23dcd
cmpl $0x0, 0x458(%rbx)
js 0x23dcd
movl 0x454(%rbx), %eax
cmpl 0x18(%rbx), %eax
jge 0x23dcd
movl 0x458(%rbx), %eax
cmpl 0x1c(%rbx), %eax
jl 0x23de3
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
movl 0x64(%rsp), %eax
decl %eax
cmpl $0x4, %eax
ja 0x23e33
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movq %rbx, %rdi
movl $0x1, %esi
jmp 0x23e2c
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
jmp 0x23e1d
movq %rbx, %rdi
movl $0x2, %esi
jmp 0x23e2c
movq %rbx, %rdi
movl $0x1, %esi
callq 0x24340
jmp 0x23e33
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x24296
movq 0x4d0(%rbx), %rsi
movl $0x8, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4380
testl %eax, %eax
jne 0x23d91
jmp 0x23fb3
leaq 0xd0(%rsp), %rsi
movq %r14, %rdi
callq 0x45f0
movl 0x64(%rsp), %eax
cmpq $0xff, %rax
ja 0x23e8c
movl %eax, %ecx
shrl $0x3, %ecx
movzbl 0xd0(%rsp,%rcx), %ecx
andl $0x7, %eax
btl %eax, %ecx
jb 0x23fb3
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 0x44a0
movl (%r14), %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x243cc
jmp 0x23fb3
leaq 0x10(%rsp), %r15
movq 0x4d0(%rbx), %rsi
movl $0x10, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x4380
testl %eax, %eax
jne 0x23ec5
movl 0x50(%rsp), %eax
movl %eax, 0x454(%rbx)
movl 0x54(%rsp), %eax
movl %eax, 0x458(%rbx)
cmpl $0x0, 0x454(%rbx)
js 0x23f20
cmpl $0x0, 0x458(%rbx)
js 0x23f20
movl 0x454(%rbx), %eax
cmpl 0x18(%rbx), %eax
jge 0x23f20
movl 0x458(%rbx), %eax
cmpl 0x1c(%rbx), %eax
jl 0x23fb3
movl $0xffffffff, 0x458(%rbx) # imm = 0xFFFFFFFF
movl 0x458(%rbx), %eax
movl %eax, 0x454(%rbx)
jmp 0x23fb3
leaq 0x10(%rsp), %r15
movq 0x4d0(%rbx), %rsi
movl $0x8000, %edx           # imm = 0x8000
movq %r14, %rdi
movq %r15, %rcx
callq 0x4380
testl %eax, %eax
jne 0x23f3d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2415e
cmpb $0x1, 0x30(%rbx)
jne 0x23fb3
movq 0x4d0(%rbx), %rsi
leaq 0xd0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x4960
cmpl $0x2, 0x5c(%r15)
je 0x23f9d
movq %r14, %rdi
xorl %esi, %esi
callq 0x4a20
cmpl $0x2, 0x12c(%rsp)
jne 0x23f89
movq 0x4d0(%rbx), %rsi
movq %r14, %rdi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x4400
addq $0x160, %rsp            # imm = 0x160
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8bd26(%rip), %rdi     # 0xafcf0
callq 0x49b0
testl %eax, %eax
je 0x239dd
leaq 0x89c9a(%rip), %rdi     # 0xadc78
callq 0x21188
leaq -0x2e24(%rip), %rdi     # 0x211c6
leaq 0x89c87(%rip), %rsi     # 0xadc78
leaq 0x89560(%rip), %rdx     # 0xad558
callq 0x44b0
leaq 0x8bcec(%rip), %rdi     # 0xafcf0
callq 0x4330
jmp 0x239dd
leaq 0x8bcdb(%rip), %rdi     # 0xafcf0
callq 0x49b0
testl %eax, %eax
je 0x23cd4
leaq 0x89c4f(%rip), %rdi     # 0xadc78
callq 0x21188
leaq -0x2e6f(%rip), %rdi     # 0x211c6
leaq 0x89c3c(%rip), %rsi     # 0xadc78
leaq 0x89515(%rip), %rdx     # 0xad558
callq 0x44b0
leaq 0x8bca1(%rip), %rdi     # 0xafcf0
callq 0x4330
jmp 0x23cd4
leaq 0x8bc90(%rip), %rdi     # 0xafcf0
callq 0x49b0
testl %eax, %eax
je 0x23b71
leaq 0x89c04(%rip), %rdi     # 0xadc78
callq 0x21188
leaq -0x2eba(%rip), %rdi     # 0x211c6
leaq 0x89bf1(%rip), %rsi     # 0xadc78
leaq 0x894ca(%rip), %rdx     # 0xad558
callq 0x44b0
leaq 0x8bc56(%rip), %rdi     # 0xafcf0
callq 0x4330
jmp 0x23b71
leaq 0x8bc45(%rip), %rdi     # 0xafcf0
callq 0x49b0
testl %eax, %eax
je 0x23a81
leaq 0x89bb9(%rip), %rdi     # 0xadc78
callq 0x21188
leaq -0x2f05(%rip), %rdi     # 0x211c6
leaq 0x89ba6(%rip), %rsi     # 0xadc78
leaq 0x8947f(%rip), %rdx     # 0xad558
callq 0x44b0
leaq 0x8bc0b(%rip), %rdi     # 0xafcf0
callq 0x4330
jmp 0x23a81
leaq 0x8bbfa(%rip), %rdi     # 0xafcf0
callq 0x49b0
testl %eax, %eax
je 0x23ab5
leaq 0x89b6e(%rip), %rdi     # 0xadc78
callq 0x21188
leaq -0x2f50(%rip), %rdi     # 0x211c6
leaq 0x89b5b(%rip), %rsi     # 0xadc78
leaq 0x89434(%rip), %rdx     # 0xad558
callq 0x44b0
leaq 0x8bbc0(%rip), %rdi     # 0xafcf0
callq 0x4330
jmp 0x23ab5
jmp 0x24146
jmp 0x24146
jmp 0x24146
jmp 0x24146
jmp 0x24146
jmp 0x24146
movq %rax, %rbx
leaq 0x8bba0(%rip), %rdi     # 0xafcf0
callq 0x4310
movq %rbx, %rdi
callq 0x4950
nop