// File: /workspace/github_c_makefile_star2_O0/kek[P]evilwm/events.c
// Function: handle_key_event
static void handle_key_event(XKeyEvent *e) {
	KeySym key = XKeycodeToKeysym(dpy,e->keycode,0);
	Client *c;
	int width_inc, height_inc;
	ScreenInfo *current_screen = find_current_screen();

	switch(key) {
		case KEY_NEW:
			spawn((const char *const *)opt_term);
			break;
		case KEY_NEXT:
			next();
			if (XGrabKeyboard(dpy, e->root, False, GrabModeAsync, GrabModeAsync, CurrentTime) == GrabSuccess) {
				XEvent ev;
				do {
					XMaskEvent(dpy, KeyPressMask|KeyReleaseMask, &ev);
					if (ev.type == KeyPress && XKeycodeToKeysym(dpy,ev.xkey.keycode,0) == KEY_NEXT)
						next();
				} while (ev.type == KeyPress || XKeycodeToKeysym(dpy,ev.xkey.keycode,0) == KEY_NEXT);
				XUngrabKeyboard(dpy, CurrentTime);
			}
			ewmh_select_client(current);
			break;
		case KEY_DOCK_TOGGLE:
			set_docks_visible(current_screen, !current_screen->docks_visible);
			break;
#ifdef VWM
		case XK_1: case XK_2: case XK_3: case XK_4:
		case XK_5: case XK_6: case XK_7: case XK_8:
			switch_vdesk(current_screen, KEY_TO_VDESK(key));
			break;
		case KEY_PREVDESK:
			if (current_screen->vdesk > 0) {
				switch_vdesk(current_screen,
						current_screen->vdesk - 1);
			}
			break;
		case KEY_NEXTDESK:
			if (current_screen->vdesk < VDESK_MAX) {
				switch_vdesk(current_screen,
						current_screen->vdesk + 1);
			}
			break;
		case KEY_TOGGLEDESK:
			switch_vdesk(current_screen, current_screen->old_vdesk);
			break;
#endif
		default: break;
	}
	c = current;
	if (c == NULL) return;
	width_inc = (c->width_inc > 1) ? c->width_inc : 16;
	height_inc = (c->height_inc > 1) ? c->height_inc : 16;
	switch (key) {
		case KEY_LEFT:
			if (e->state & altmask) {
				if ((c->width - width_inc) >= c->min_width)
					c->width -= width_inc;
			} else {
				c->x -= 16;
			}
			goto move_client;
		case KEY_DOWN:
			if (e->state & altmask) {
				if (!c->max_height || (c->height + height_inc) <= c->max_height)
					c->height += height_inc;
			} else {
				c->y += 16;
			}
			goto move_client;
		case KEY_UP:
			if (e->state & altmask) {
				if ((c->height - height_inc) >= c->min_height)
					c->height -= height_inc;
			} else {
				c->y -= 16;
			}
			goto move_client;
		case KEY_RIGHT:
			if (e->state & altmask) {
				if (!c->max_width || (c->width + width_inc) <= c->max_width)
					c->width += width_inc;
			} else {
				c->x += 16;
			}
			goto move_client;
		case KEY_TOPLEFT:
			c->x = c->border;
			c->y = c->border;
			goto move_client;
		case KEY_TOPRIGHT:
			c->x = DisplayWidth(dpy, c->screen->screen)
				- c->width-c->border;
			c->y = c->border;
			goto move_client;
		case KEY_BOTTOMLEFT:
			c->x = c->border;
			c->y = DisplayHeight(dpy, c->screen->screen)
				- c->height-c->border;
			goto move_client;
		case KEY_BOTTOMRIGHT:
			c->x = DisplayWidth(dpy, c->screen->screen)
				- c->width-c->border;
			c->y = DisplayHeight(dpy, c->screen->screen)
				- c->height-c->border;
			goto move_client;
		case KEY_KILL:
			send_wm_delete(c, e->state & altmask);
			break;
		case KEY_LOWER: case KEY_ALTLOWER:
			client_lower(c);
			break;
		case KEY_INFO:
			show_info(c, e->keycode);
			break;
		case KEY_MAX:
			maximise_client(c, NET_WM_STATE_TOGGLE, MAXIMISE_HORZ|MAXIMISE_VERT);
			break;
		case KEY_MAXVERT:
			maximise_client(c, NET_WM_STATE_TOGGLE, MAXIMISE_VERT);
			break;
#ifdef VWM
		case KEY_FIX:
			if (is_fixed(c)) {
				client_to_vdesk(c, current_screen->vdesk);
			} else {
				client_to_vdesk(c, VDESK_FIXED);
			}
			break;
#endif
		default: break;
	}
	return;
move_client:
	if (abs(c->x) == c->border && c->oldw != 0)
		c->x = 0;
	if (abs(c->y) == c->border && c->oldh != 0)
		c->y = 0;
	moveresize(c);
#ifdef WARP_POINTER
	setmouse(c->window, c->width + c->border - 1,
			c->height + c->border - 1);
#endif
	discard_enter_events(c);
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
leaq 0xb2ca(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movzbl 0x54(%rax), %esi
xorl %edx, %edx
callq 0x35a0
movq %rax, -0x10(%rbp)
callq 0xa6b0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf0(%rbp)
addq $-0x31, %rax
subq $0x8, %rax
jb 0x4889
jmp 0x46f0
movq -0xf0(%rbp), %rax
subq $0x61, %rax
je 0x48dc
jmp 0x4703
movq -0xf0(%rbp), %rax
subq $0x64, %rax
je 0x486c
jmp 0x4716
movq -0xf0(%rbp), %rax
subq $0xff09, %rax           # imm = 0xFF09
je 0x4779
jmp 0x4727
movq -0xf0(%rbp), %rax
subq $0xff0d, %rax           # imm = 0xFF0D
je 0x4765
jmp 0x4738
movq -0xf0(%rbp), %rax
subq $0xff51, %rax           # imm = 0xFF51
je 0x489e
jmp 0x474d
movq -0xf0(%rbp), %rax
subq $0xff53, %rax           # imm = 0xFF53
je 0x48bd
jmp 0x48ee
leaq 0xac74(%rip), %rax      # 0xf3e0
movq (%rax), %rdi
callq 0x7db0
jmp 0x48f0
callq 0xa2f0
leaq 0xb1fb(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rsi
xorl %edx, %edx
movl $0x1, %r8d
xorl %eax, %eax
movl %eax, %r9d
movl %r8d, %ecx
callq 0x3770
cmpl $0x0, %eax
jne 0x4858
jmp 0x47b0
leaq 0xb1c9(%rip), %rax      # 0xf980
movq (%rax), %rdi
movl $0x3, %esi
leaq -0xe8(%rbp), %rdx
callq 0x3740
cmpl $0x2, -0xe8(%rbp)
jne 0x47fb
leaq 0xb1a5(%rip), %rax      # 0xf980
movq (%rax), %rdi
movl -0x94(%rbp), %eax
xorl %edx, %edx
movzbl %al, %esi
callq 0x35a0
cmpq $0xff09, %rax           # imm = 0xFF09
jne 0x47fb
callq 0xa2f0
jmp 0x47fd
movb $0x1, %al
cmpl $0x2, -0xe8(%rbp)
movb %al, -0xf1(%rbp)
je 0x4837
leaq 0xb16b(%rip), %rax      # 0xf980
movq (%rax), %rdi
movl -0x94(%rbp), %eax
xorl %edx, %edx
movzbl %al, %esi
callq 0x35a0
cmpq $0xff09, %rax           # imm = 0xFF09
sete %al
movb %al, -0xf1(%rbp)
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x47b0
leaq 0xb134(%rip), %rax      # 0xf980
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x36a0
leaq 0xb0f1(%rip), %rax      # 0xf950
movq (%rax), %rdi
callq 0x6660
jmp 0x48f0
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
cmpl $0x0, 0x68(%rax)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %esi
callq 0xa580
jmp 0x48f0
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
subq $0x31, %rax
movl %eax, %esi
callq 0xa480
jmp 0x48f0
movq -0x28(%rbp), %rax
cmpl $0x0, 0x40(%rax)
jbe 0x48bb
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x40(%rax), %esi
subl $0x1, %esi
callq 0xa480
jmp 0x48f0
movq -0x28(%rbp), %rax
cmpl $0x7, 0x40(%rax)
jae 0x48da
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x40(%rax), %esi
addl $0x1, %esi
callq 0xa480
jmp 0x48f0
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x58(%rax), %esi
callq 0xa480
jmp 0x48f0
jmp 0x48f0
leaq 0xb059(%rip), %rax      # 0xf950
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x490a
jmp 0x4e5a
movq -0x18(%rbp), %rax
cmpl $0x1, 0x58(%rax)
jle 0x4923
movq -0x18(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0xf8(%rbp)
jmp 0x4930
movl $0x10, %eax
movl %eax, -0xf8(%rbp)
jmp 0x4930
movl -0xf8(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x1, 0x5c(%rax)
jle 0x4952
movq -0x18(%rbp), %rax
movl 0x5c(%rax), %eax
movl %eax, -0xfc(%rbp)
jmp 0x495f
movl $0x10, %eax
movl %eax, -0xfc(%rbp)
jmp 0x495f
movl -0xfc(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x108(%rbp)
subq $0x3d, %rax
je 0x4d53
jmp 0x497f
movq -0x108(%rbp), %rax
subq $0x62, %rax
je 0x4c3d
jmp 0x4992
movq -0x108(%rbp), %rax
subq $0x66, %rax
je 0x4d65
jmp 0x49a5
movq -0x108(%rbp), %rax
subq $0x68, %rax
je 0x4a92
jmp 0x49b8
movq -0x108(%rbp), %rax
subq $0x69, %rax
je 0x4d2c
jmp 0x49cb
movq -0x108(%rbp), %rax
subq $0x6a, %rax
je 0x4add
jmp 0x49de
movq -0x108(%rbp), %rax
subq $0x6b, %rax
je 0x4b30
jmp 0x49f1
movq -0x108(%rbp), %rax
subq $0x6c, %rax
je 0x4b7b
jmp 0x4a04
movq -0x108(%rbp), %rax
subq $0x6e, %rax
je 0x4c8b
jmp 0x4a17
movq -0x108(%rbp), %rax
subq $0x75, %rax
je 0x4bef
jmp 0x4a2a
movq -0x108(%rbp), %rax
subq $0x78, %rax
je 0x4d3e
jmp 0x4a3d
movq -0x108(%rbp), %rax
subq $0x79, %rax
je 0x4bce
jmp 0x4a50
movq -0x108(%rbp), %rax
subq $0xff1b, %rax           # imm = 0xFF1B
je 0x4d06
jmp 0x4a65
movq -0x108(%rbp), %rax
subq $0xff63, %rax           # imm = 0xFF63
je 0x4d21
jmp 0x4a7a
movq -0x108(%rbp), %rax
subq $0xff9e, %rax           # imm = 0xFF9E
je 0x4d21
jmp 0x4d91
movq -0x8(%rbp), %rax
movl 0x50(%rax), %eax
leaq 0xa938(%rip), %rcx      # 0xf3d8
andl (%rcx), %eax
cmpl $0x0, %eax
je 0x4acb
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %eax
subl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x48(%rcx), %eax
jl 0x4ac9
movl -0x1c(%rbp), %edx
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x2c(%rax)
jmp 0x4ad8
movq -0x18(%rbp), %rax
movl 0x24(%rax), %ecx
subl $0x10, %ecx
movl %ecx, 0x24(%rax)
jmp 0x4d98
movq -0x8(%rbp), %rax
movl 0x50(%rax), %eax
leaq 0xa8ed(%rip), %rcx      # 0xf3d8
andl (%rcx), %eax
cmpl $0x0, %eax
je 0x4b1e
movq -0x18(%rbp), %rax
cmpl $0x0, 0x54(%rax)
je 0x4b0f
movq -0x18(%rbp), %rax
movl 0x30(%rax), %eax
addl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x54(%rcx), %eax
jg 0x4b1c
movl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
addl 0x30(%rax), %ecx
movl %ecx, 0x30(%rax)
jmp 0x4b2b
movq -0x18(%rbp), %rax
movl 0x28(%rax), %ecx
addl $0x10, %ecx
movl %ecx, 0x28(%rax)
jmp 0x4d98
movq -0x8(%rbp), %rax
movl 0x50(%rax), %eax
leaq 0xa89a(%rip), %rcx      # 0xf3d8
andl (%rcx), %eax
cmpl $0x0, %eax
je 0x4b69
movq -0x18(%rbp), %rax
movl 0x30(%rax), %eax
subl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4c(%rcx), %eax
jl 0x4b67
movl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movl 0x30(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x30(%rax)
jmp 0x4b76
movq -0x18(%rbp), %rax
movl 0x28(%rax), %ecx
subl $0x10, %ecx
movl %ecx, 0x28(%rax)
jmp 0x4d98
movq -0x8(%rbp), %rax
movl 0x50(%rax), %eax
leaq 0xa84f(%rip), %rcx      # 0xf3d8
andl (%rcx), %eax
cmpl $0x0, %eax
je 0x4bbc
movq -0x18(%rbp), %rax
cmpl $0x0, 0x50(%rax)
je 0x4bad
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %eax
addl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jg 0x4bba
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
addl 0x2c(%rax), %ecx
movl %ecx, 0x2c(%rax)
jmp 0x4bc9
movq -0x18(%rbp), %rax
movl 0x24(%rax), %ecx
addl $0x10, %ecx
movl %ecx, 0x24(%rax)
jmp 0x4d98
movq -0x18(%rbp), %rax
movl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x18(%rbp), %rax
movl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x4d98
leaq 0xad8a(%rip), %rax      # 0xf980
movq (%rax), %rax
movq 0xe8(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq (%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x2c(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x18(%rbp), %rax
movl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x4d98
movq -0x18(%rbp), %rax
movl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
leaq 0xad2e(%rip), %rax      # 0xf980
movq (%rax), %rax
movq 0xe8(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq (%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x30(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x4d98
leaq 0xacee(%rip), %rax      # 0xf980
movq (%rax), %rax
movq 0xe8(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq (%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x2c(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
leaq 0xacb3(%rip), %rax      # 0xf980
movq (%rax), %rax
movq 0xe8(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movslq (%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x30(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x4d98
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x50(%rax), %esi
leaq 0xa6c0(%rip), %rax      # 0xf3d8
andl (%rax), %esi
callq 0x40a0
jmp 0x4d93
movq -0x18(%rbp), %rdi
callq 0x3a50
jmp 0x4d93
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x54(%rax), %esi
callq 0x9660
jmp 0x4d93
movq -0x18(%rbp), %rdi
movl $0x2, %esi
movl $0x3, %edx
callq 0xa050
jmp 0x4d93
movq -0x18(%rbp), %rdi
movl $0x2, %edx
movl %edx, %esi
callq 0xa050
jmp 0x4d93
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x74(%rax)
jne 0x4d81
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x40(%rax), %esi
callq 0x3e20
jmp 0x4d8f
movq -0x18(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3e20
jmp 0x4d93
jmp 0x4d93
jmp 0x4e5a
movq -0x18(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movq -0x18(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jne 0x4dc4
movq -0x18(%rbp), %rax
cmpl $0x0, 0x40(%rax)
je 0x4dc4
movq -0x18(%rbp), %rax
movl $0x0, 0x24(%rax)
movq -0x18(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movq -0x18(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jne 0x4df0
movq -0x18(%rbp), %rax
cmpl $0x0, 0x44(%rax)
je 0x4df0
movq -0x18(%rbp), %rax
movl $0x0, 0x28(%rax)
movq -0x18(%rbp), %rdi
callq 0x95c0
leaq 0xab80(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %r10d
movq -0x18(%rbp), %rax
addl 0x34(%rax), %r10d
subl $0x1, %r10d
movq -0x18(%rbp), %rax
movl 0x30(%rax), %eax
movq -0x18(%rbp), %rcx
addl 0x34(%rcx), %eax
subl $0x1, %eax
xorl %ecx, %ecx
movl %ecx, %esi
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
movl $0x0, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x32e0
movq -0x18(%rbp), %rdi
callq 0x7f30
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)