// File: /workspace/github_c_makefile_star2_O2/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 0x9804(%rip), %r14      # 0xda70
movl (%r14), %edi
movl 0xc(%rbx), %edx
leaq 0x1415(%rip), %rcx      # 0x568e
pushq $0x1
popq %rsi
callq 0x663d
testq %rax, %rax
je 0x42d8
cmpl $0x7, %edx
ja 0x44f4
movl %edx, %eax
leaq 0x4d6c(%rip), %rcx      # 0x9004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq (%r14), %rax
imulq $0x50, %rax, %rax
leaq 0x9681(%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 0x7475
jmp 0x44f4
movslq (%r14), %rax
imulq $0x50, %rax, %rax
leaq 0x964a(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rdi
testq %rdi, %rdi
je 0x4311
movl 0x10(%rbx), %eax
leaq 0x8726(%rip), %r14      # 0xca20
pushq $0x35
popq %rsi
cmpq $0x37, %rsi
je 0x4311
cmpl %eax, (%rdi,%rsi,4)
je 0x4350
addq $0x50, %r14
incq %rsi
jmp 0x42fd
movl 0xc(%rbx), %ecx
movswl 0x14(%rbx), %r8d
movswl 0x16(%rbx), %r9d
leaq 0x893b(%rip), %rdx      # 0xcc60
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x4944
testl %eax, %eax
jne 0x44f4
movl 0x10(%rbx), %ecx
movswl 0x18(%rbx), %r8d
movswl 0x1a(%rbx), %r9d
leaq 0x8754(%rip), %rdx      # 0xcaa0
pushq $0x2
jmp 0x436d
addl $-0x33, %esi
pushq $0x2
popq %rdx
callq 0x561b
movq (%r14), %rdx
movl 0xc(%rbx), %ecx
movswl 0x18(%rbx), %r8d
movswl 0x1a(%rbx), %r9d
pushq $0x1
popq %rsi
movq %rbx, %rdi
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4944
movslq (%r14), %rax
imulq $0x50, %rax, %rax
leaq 0x95a4(%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 0x7086
jmp 0x44f4
movslq (%r14), %rax
imulq $0x50, %rax, %rax
leaq 0x956d(%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 0x7531
jmp 0x44f4
movslq (%r14), %rax
imulq $0x50, %rax, %rax
leaq 0x9536(%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 0x73d1
jmp 0x44f4
movslq (%r14), %rax
imulq $0x50, %rax, %rax
leaq 0x94ff(%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 0x72f6
jmp 0x44f4
movslq (%r14), %rax
imulq $0x50, %rax, %rax
leaq 0x94c8(%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 0x721b
jmp 0x44f4
movslq (%r14), %rax
imulq $0x50, %rax, %rax
leaq 0x9494(%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 0x7177
jmp 0x44f4
movslq (%r14), %rax
imulq $0x50, %rax, %rax
leaq 0x9460(%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 0x75e9
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq