// File: /workspace/github_c_makefile_star2_O0/seanpringle[P]xoat/./event.c
// Function: key_press
void key_press(XEvent *ev)
{
	XKeyEvent *e = &ev->xkey;
	latest_action = e->time;
	KeySym key = XkbKeycodeToKeysym(display, e->keycode, 0, 0);
	unsigned int state = e->state & ~(LockMask|NumlockMask);
	while (XCheckTypedEvent(display, KeyPress, ev));

	if (menu && menu->mb && menu->mb->window == e->window)
	{
		int rc = menubox_keypress(menu->mb, ev);
		menu_update();

		if (rc == -2)
			menu_close();

		if (rc == -1)
			menu_select();

		return;
	}

	Binding *bind = NULL;
	for (int i = 0; i < settings.binding_count && !bind; i++)
		if (settings.bindings[i].key == key && (settings.bindings[i].mod == AnyModifier || settings.bindings[i].mod == state))
			bind = &settings.bindings[i];

	if (bind && bind->act)
	{
		Client *cli = window_build_client(current);
		bind->act(bind->data, bind->num, cli);
		client_free(cli);
		update_bars();
		menu_update();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x8a05(%rip)      # 0x13d88
movq 0x8816(%rip), %rdi      # 0x13ba0
movq -0x10(%rbp), %rax
movl 0x54(%rax), %eax
xorl %ecx, %ecx
movzbl %al, %esi
movl %ecx, %edx
callq 0x31d0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x50(%rax), %eax
movl 0x8e8e(%rip), %ecx      # 0x1423c
orl $0x2, %ecx
xorl $-0x1, %ecx
andl %ecx, %eax
movl %eax, -0x1c(%rbp)
movq 0x87e0(%rip), %rdi      # 0x13ba0
movq -0x8(%rbp), %rdx
movl $0x2, %esi
callq 0x31b0
cmpl $0x0, %eax
je 0xb3d5
jmp 0xb3b9
cmpq $0x0, 0x8e53(%rip)      # 0x14230
je 0xb446
movq 0x8e4a(%rip), %rax      # 0x14230
cmpq $0x0, 0x648(%rax)
je 0xb446
movq 0x8e39(%rip), %rax      # 0x14230
movq 0x648(%rax), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jne 0xb446
movq 0x8e1d(%rip), %rax      # 0x14230
movq 0x648(%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x5ba0
movl %eax, -0x20(%rbp)
callq 0x9bb0
cmpl $-0x2, -0x20(%rbp)
jne 0xb436
callq 0x9be0
cmpl $-0x1, -0x20(%rbp)
jne 0xb441
callq 0x9c90
jmp 0xb542
movq $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %ecx
xorl %eax, %eax
cmpl 0x8db0(%rip), %ecx      # 0x14210
movb %al, -0x39(%rbp)
jae 0xb472
cmpq $0x0, -0x28(%rbp)
setne %al
xorb $-0x1, %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0xb47b
jmp 0xb4f0
movq 0x8d96(%rip), %rax      # 0x14218
movslq -0x2c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0xb4e0
movq 0x8d7a(%rip), %rax      # 0x14218
movslq -0x2c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x8000, (%rax)         # imm = 0x8000
je 0xb4ca
movq 0x8d60(%rip), %rax      # 0x14218
movslq -0x2c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0xb4e0
movq 0x8d47(%rip), %rax      # 0x14218
movslq -0x2c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0xb4e2
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xb455
cmpq $0x0, -0x28(%rbp)
je 0xb542
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0xb542
movq 0x869f(%rip), %rdi      # 0x13ba8
callq 0x74a0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rcx
movq 0x18(%rcx), %rdi
movq -0x28(%rbp), %rcx
movl 0x20(%rcx), %esi
movq -0x38(%rbp), %rdx
callq *%rax
movq -0x38(%rbp), %rdi
callq 0x86e0
callq 0xa700
callq 0x9bb0
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)