// File: /workspace/github_c_makefile_star2_O1/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 0x9700(%rip), %r14      # 0xda70
movl (%r14), %edi
movl 0xc(%rbx), %edx
leaq 0x15e1(%rip), %rcx      # 0x595e
movl $0x1, %esi
callq 0x6a0b
testq %rax, %rax
je 0x43e2
cmpl $0x7, %edx
ja 0x4629
movl %edx, %eax
leaq 0x4c66(%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 0x9577(%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 0x7b5a
jmp 0x4629
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x953c(%rip), %rcx      # 0xd930
movq 0x48(%rcx,%rax), %rdi
testq %rdi, %rdi
je 0x441f
movl 0x10(%rbx), %eax
leaq 0x8620(%rip), %r14      # 0xca28
movl $0x35, %esi
cmpl %eax, (%rdi,%rsi,4)
je 0x4466
addq $0x50, %r14
incq %rsi
cmpq $0x37, %rsi
jne 0x440d
movl 0xc(%rbx), %ecx
movswl 0x14(%rbx), %r8d
movswl 0x16(%rbx), %r9d
leaq 0x882d(%rip), %rdx      # 0xcc60
movq %rbx, %rdi
movl $0x2, %esi
callq 0x4a82
testl %eax, %eax
jne 0x4629
movl 0x10(%rbx), %ecx
movswl 0x18(%rbx), %r8d
movswl 0x1a(%rbx), %r9d
leaq 0x8644(%rip), %rdx      # 0xcaa0
movq %rbx, %rdi
movl $0x2, %esi
jmp 0x448a
addl $-0x33, %esi
movl $0x2, %edx
callq 0x58d9
movl (%r14), %esi
movq -0x8(%r14), %rdx
movl 0xc(%rbx), %ecx
movswl 0x18(%rbx), %r8d
movswl 0x1a(%rbx), %r9d
movq %rbx, %rdi
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4a82
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x9487(%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 0x7602
jmp 0x4629
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x944c(%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 0x7c8d
jmp 0x4629
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x9411(%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 0x7a51
jmp 0x4629
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x93d6(%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 0x793a
jmp 0x4629
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x939b(%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 0x7823
jmp 0x4629
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x9363(%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 0x771a
jmp 0x4629
movslq (%r14), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq 0x932b(%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 0x7db3
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq