// File: /workspace/github_c_makefile_star2_O3/kaiserschmarrn0[P]mywm/mywm.c
// Function: button_press
static void button_press(xcb_generic_event_t *ev) {
	xcb_button_press_event_t *e = (xcb_button_press_event_t *)ev;

	search_data ret = search_helper(curws, TYPE_NORMAL, e->event, search_resize_regions);
	if (ret.win) {
		switch(ret.index) {
			case 0: mouse_resize_north_west(&(press_arg){ stack[curws].fwin->windows[WIN_PARENT], e->root_x, e->root_y }); break;
			case 1: mouse_resize_north(&(press_arg){ stack[curws].fwin->windows[WIN_PARENT], e->root_x, e->root_y }); break;
			case 2: mouse_resize_north_east(&(press_arg){ stack[curws].fwin->windows[WIN_PARENT], e->root_x, e->root_y }); break;
			case 3: mouse_resize_east(&(press_arg){ stack[curws].fwin->windows[WIN_PARENT], e->root_x, e->root_y }); break;
			case 4: mouse_resize_south_east(&(press_arg){ stack[curws].fwin->windows[WIN_PARENT], e->root_x, e->root_y }); break;
			case 5: mouse_resize_south(&(press_arg){ stack[curws].fwin->windows[WIN_PARENT], e->root_x, e->root_y }); break;
			case 6: mouse_resize_south_west(&(press_arg){ stack[curws].fwin->windows[WIN_PARENT], e->root_x, e->root_y }); break;
			case 7: mouse_resize_west(&(press_arg){ stack[curws].fwin->windows[WIN_PARENT], e->root_x, e->root_y }); break;
		}
		return;
	}

	if (stack[curws].fwin) {
		for (int i = WIN_COUNT; i < REGION_COUNT; i++) {
			if (stack[curws].fwin->windows[i] == e->child) {
				draw_region(stack[curws].fwin, i, PM_PRESS);
				button_press_helper(e, controls[i - WIN_COUNT].buttons_len,
						controls[i - WIN_COUNT].buttons, e->event,
						e->event_x, e->event_y);
				return;
			}
		}
	}

	if (button_press_helper(e, LEN(parent_buttons), parent_buttons, e->event, e->root_x,
			e->root_y)) {
		return;
	}
	if (button_press_helper(e, LEN(grab_buttons), grab_buttons, e->child, e->event_x,
			e->event_y)) {
		return;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
leaq 0x96ec(%rip), %r14      # 0xda70
movl (%r14), %edi
movl 0xc(%rbx), %edx
leaq 0x15cc(%rip), %rcx      # 0x595d
movl $0x1, %esi
callq 0x6a3e
testq %rax, %rax
je 0x43f6
cmpl $0x7, %edx
ja 0x4651
movl %edx, %eax
leaq 0x4c52(%rip), %rcx      # 0x9004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x9563(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rax
movl 0xd0(%rax), %eax
leaq -0x70(%rbp), %rdi
movl %eax, (%rdi)
movswl 0x14(%rbx), %eax
movl %eax, 0x4(%rdi)
movswl 0x16(%rbx), %eax
movl %eax, 0x8(%rdi)
callq 0x7b44
jmp 0x4651
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x9528(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rdi
testq %rdi, %rdi
je 0x446d
movl 0x10(%rbx), %eax
movl $0x2, %r14d
cmpl %eax, 0xd4(%rdi)
je 0x4431
movl $0x3, %r14d
cmpl %eax, 0xd8(%rdi)
jne 0x446d
movl %r14d, %esi
movl $0x2, %edx
callq 0x58ef
addl $-0x2, %r14d
leaq (%r14,%r14,4), %rax
shlq $0x4, %rax
leaq 0x85af(%rip), %rcx      # 0xca00
movq 0x20(%rax,%rcx), %rdx
movl 0xc(%rbx), %ecx
movswl 0x18(%rbx), %r8d
movswl 0x1a(%rbx), %r9d
movq %rbx, %rdi
movl $0x1, %esi
jmp 0x44b2
movl 0xc(%rbx), %ecx
movswl 0x14(%rbx), %r8d
movswl 0x16(%rbx), %r9d
leaq 0x87df(%rip), %rdx      # 0xcc60
movq %rbx, %rdi
movl $0x2, %esi
callq 0x4aaa
testl %eax, %eax
jne 0x4651
movl 0x10(%rbx), %ecx
movswl 0x18(%rbx), %r8d
movswl 0x1a(%rbx), %r9d
leaq 0x85f6(%rip), %rdx      # 0xcaa0
movq %rbx, %rdi
movl $0x2, %esi
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4aaa
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x945f(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rax
movl 0xd0(%rax), %eax
leaq -0x40(%rbp), %rdi
movl %eax, (%rdi)
movswl 0x14(%rbx), %eax
movl %eax, 0x4(%rdi)
movswl 0x16(%rbx), %eax
movl %eax, 0x8(%rdi)
callq 0x75ec
jmp 0x4651
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x9424(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rax
movl 0xd0(%rax), %eax
leaq -0x58(%rbp), %rdi
movl %eax, (%rdi)
movswl 0x14(%rbx), %eax
movl %eax, 0x4(%rdi)
movswl 0x16(%rbx), %eax
movl %eax, 0x8(%rdi)
callq 0x7c77
jmp 0x4651
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x93e9(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rax
movl 0xd0(%rax), %eax
leaq -0x4c(%rbp), %rdi
movl %eax, (%rdi)
movswl 0x14(%rbx), %eax
movl %eax, 0x4(%rdi)
movswl 0x16(%rbx), %eax
movl %eax, 0x8(%rdi)
callq 0x7a3b
jmp 0x4651
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x93ae(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rax
movl 0xd0(%rax), %eax
leaq -0x1c(%rbp), %rdi
movl %eax, (%rdi)
movswl 0x14(%rbx), %eax
movl %eax, 0x4(%rdi)
movswl 0x16(%rbx), %eax
movl %eax, 0x8(%rdi)
callq 0x7924
jmp 0x4651
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x9373(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rax
movl 0xd0(%rax), %eax
leaq -0x64(%rbp), %rdi
movl %eax, (%rdi)
movswl 0x14(%rbx), %eax
movl %eax, 0x4(%rdi)
movswl 0x16(%rbx), %eax
movl %eax, 0x8(%rdi)
callq 0x780d
jmp 0x4651
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x933b(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rax
movl 0xd0(%rax), %eax
leaq -0x34(%rbp), %rdi
movl %eax, (%rdi)
movswl 0x14(%rbx), %eax
movl %eax, 0x4(%rdi)
movswl 0x16(%rbx), %eax
movl %eax, 0x8(%rdi)
callq 0x7704
jmp 0x4651
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x9303(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rax
movl 0xd0(%rax), %eax
leaq -0x28(%rbp), %rdi
movl %eax, (%rdi)
movswl 0x14(%rbx), %eax
movl %eax, 0x4(%rdi)
movswl 0x16(%rbx), %eax
movl %eax, 0x8(%rdi)
callq 0x7d9d
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq