// File: /workspace/github_c_makefile_star2_O3/tudurom[P]windowchef/wm.c
// Function: pointer_grab
static bool
pointer_grab(enum pointer_action pac)
{
	xcb_window_t win = XCB_NONE;
	xcb_point_t pos = (xcb_point_t) {0, 0};
	struct client *client;

	xcb_query_pointer_reply_t *qr =
		xcb_query_pointer_reply(conn, xcb_query_pointer(conn, scr->root), NULL);

	if (qr == NULL) {
		return false;
	}

	win = qr->child;
	pos = (xcb_point_t) {qr->root_x, qr->root_y};
	free(qr);

	client = find_client(&win);
	if (client == NULL)
		return true;

	raise_window(client->window);
	if (pac == POINTER_ACTION_FOCUS) {
		DMSG("grabbing pointer to focus on 0x%08x\n", client->window);
		if (client != focused_win) {
			set_focused(client);
			if (!conf.replay_click_on_focus)
				return true;
		}
		return false;
	}

	if (is_special(client)) {
		return true;
	}

	xcb_grab_pointer_reply_t *reply =
		xcb_grab_pointer_reply(conn, xcb_grab_pointer(conn, 0, scr->root, XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_BUTTON_MOTION, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_NONE, XCB_NONE, XCB_CURRENT_TIME), NULL);

	if (reply == NULL || reply->status != XCB_GRAB_STATUS_SUCCESS) {
		free(reply);
		return true;
	}
	free(reply);

	track_pointer(client, pac, pos);

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edi, %r14d
movq 0x5ff4(%rip), %r15      # 0xc3b8
movq 0x640d(%rip), %rax      # 0xc7d8
movl (%rax), %esi
movq %r15, %rdi
callq 0x3510
xorl %ebx, %ebx
movq %r15, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x3680
testq %rax, %rax
je 0x6805
movl 0xc(%rax), %ebp
movzwl 0x10(%rax), %r12d
movzwl 0x12(%rax), %r13d
movq %rax, %rdi
callq 0x32d0
movq 0x5fc0(%rip), %rax      # 0xc3c8
movb $0x1, %bl
testq %rax, %rax
je 0x6805
movq (%rax), %r15
cmpl %ebp, (%r15)
je 0x6421
movq 0x10(%rax), %rax
jmp 0x640a
leaq 0x30(%rsp), %rcx
movl $0x0, (%rcx)
movq 0x5f85(%rip), %rdi      # 0xc3b8
movl %ebp, %esi
movl $0x40, %edx
callq 0x3200
cmpl $0x1, %r14d
jne 0x6489
cmpq 0x6394(%rip), %r15      # 0xc7e0
je 0x6482
movq %r15, %rdi
callq 0x4f9e
movl (%r15), %esi
leaq 0x34(%rsp), %rcx
movl $0x0, (%rcx)
movq 0x5f4d(%rip), %rdi      # 0xc3b8
movl $0x40, %edx
callq 0x3200
cmpb $0x1, 0x634a(%rip)      # 0xc7c6
jne 0x6805
xorl %ebx, %ebx
jmp 0x6805
cmpb $0x0, 0x24(%r15)
jne 0x6805
cmpb $0x0, 0x26(%r15)
jne 0x6805
cmpb $0x0, 0x25(%r15)
jne 0x6805
cmpb $0x0, 0x27(%r15)
jne 0x6805
cmpb $0x0, 0x28(%r15)
jne 0x6805
movl %r12d, %ebp
movq 0x5eee(%rip), %r12      # 0xc3b8
movq 0x6307(%rip), %rax      # 0xc7d8
movl (%rax), %edx
subq $0x8, %rsp
xorl %eax, %eax
movq %r12, %rdi
xorl %esi, %esi
movl $0x2008, %ecx           # imm = 0x2008
movl $0x1, %r8d
movl $0x1, %r9d
pushq %rax
pushq %rax
pushq %rax
callq 0x31a0
addq $0x20, %rsp
movq %r12, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x33b0
testq %rax, %rax
je 0x6512
cmpb $0x0, 0x1(%rax)
je 0x651f
movq %rax, %rdi
callq 0x32d0
jmp 0x6805
movq %rax, %rdi
callq 0x32d0
movzwl 0x4(%r15), %eax
movq %rax, 0x18(%rsp)
movzwl 0x6(%r15), %eax
movq %rax, 0x10(%rsp)
movzwl 0x8(%r15), %eax
movl %eax, 0xc(%rsp)
movzwl 0xa(%r15), %eax
movl %eax, 0x8(%rsp)
cmpl $0x3, %r14d
je 0x6596
movl $0x4, %eax
cmpl $0x4, %r14d
jne 0x65d0
movl %ebp, %eax
subl 0x18(%rsp), %eax
movl %r13d, %ecx
subl 0x10(%rsp), %ecx
cwtl
movl 0x8(%rsp), %edi
movl %edi, %edx
imull %eax, %edx
movswl %cx, %ecx
movl 0xc(%rsp), %esi
imull %esi, %ecx
subl %eax, %esi
imull %edi, %esi
xorl %edi, %edi
cmpl %ecx, %esi
setle %dil
leal 0x2(%rdi), %eax
cmpl %ecx, %edx
cmovll %edi, %eax
jmp 0x65d0
movl 0xc(%rsp), %eax
shrl %eax
movq 0x18(%rsp), %rcx
addl %eax, %ecx
movl 0x8(%rsp), %eax
shrl %eax
movq 0x10(%rsp), %rdx
addl %edx, %eax
cmpw %ax, %r13w
movl %ebp, %edx
jge 0x65c5
xorl %eax, %eax
cmpw %cx, %dx
setl %al
xorl $0x5, %eax
jmp 0x65d0
xorl %eax, %eax
cmpw %cx, %dx
setl %al
xorl $0x7, %eax
leal -0x3(%r14), %ecx
movl %ecx, 0x24(%rsp)
xorl %r12d, %r12d
movl %eax, %eax
movq %rax, 0x28(%rsp)
movq %r12, %rdi
callq 0x32d0
movq 0x5dc7(%rip), %rdi      # 0xc3b8
callq 0x33d0
testq %rax, %rax
jne 0x6609
movq 0x5db6(%rip), %rdi      # 0xc3b8
callq 0x3400
jmp 0x65ea
movq %rax, %r12
movzbl (%rax), %eax
andl $0x7f, %eax
cmpq $0x6, %rax
je 0x6638
cmpl $0x5, %eax
je 0x67ef
leaq 0x5db8(%rip), %rcx      # 0xc3e0
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x65e2
movq %r12, %rdi
callq *%rax
jmp 0x65e2
movzwl 0x14(%r12), %esi
movzwl 0x16(%r12), %r10d
subl %ebp, %esi
subl %r13d, %r10d
cmpl $0x2, %r14d
jne 0x6676
addl 0x18(%rsp), %esi
movw %si, 0x4(%r15)
addl 0x10(%rsp), %r10d
movw %r10w, 0x6(%r15)
movl (%r15), %edi
movswl %si, %esi
movswl %r10w, %edx
callq 0x4d70
jmp 0x65e2
cmpl $0x1, 0x24(%rsp)
ja 0x65e2
movzwl 0x4(%r15), %edi
movzwl 0x6(%r15), %ecx
movzwl 0x8(%r15), %r9d
movzwl 0xa(%r15), %r8d
cmpb $0x1, 0x6125(%rip)      # 0xc7c1
jne 0x66b7
movzwl 0x50(%r15), %r11d
movswl %si, %eax
cltd
idivl %r11d
subl %edx, %esi
movswl %r10w, %eax
cltd
idivl %r11d
subl %edx, %r10d
movq 0x28(%rsp), %rax
leaq 0x29a1(%rip), %rdx      # 0x9064
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x18(%rsp), %rax
leal (%rsi,%rax), %r11d
movswl %si, %eax
movl 0xc(%rsp), %r9d
subl %eax, %r9d
jmp 0x6786
movq 0x10(%rsp), %rax
addl %r10d, %eax
movswl %r10w, %edx
movl 0x8(%rsp), %r8d
subl %edx, %r8d
movq 0x18(%rsp), %rdx
leal (%rsi,%rdx), %r11d
movswl %si, %edx
movl 0xc(%rsp), %r9d
subl %edx, %r9d
jmp 0x6788
movq 0x10(%rsp), %rax
addl %r10d, %eax
movswl %r10w, %edx
movl 0x8(%rsp), %r8d
subl %edx, %r8d
jmp 0x6764
movswl %si, %r9d
addl 0xc(%rsp), %r9d
jmp 0x6742
movswl %si, %r9d
addl 0xc(%rsp), %r9d
movswl %r10w, %r8d
addl 0x8(%rsp), %r8d
movl %edi, %r11d
jmp 0x6786
movq 0x10(%rsp), %rax
addl %r10d, %eax
movswl %r10w, %edx
movl 0x8(%rsp), %r8d
subl %edx, %r8d
movswl %si, %r9d
addl 0xc(%rsp), %r9d
movl %edi, %r11d
jmp 0x6788
movq 0x18(%rsp), %rax
leal (%rsi,%rax), %r11d
movswl %si, %eax
movl 0xc(%rsp), %r9d
subl %eax, %r9d
movswl %r10w, %r8d
addl 0x8(%rsp), %r8d
movl %ecx, %eax
movzwl 0x48(%r15), %esi
cmpl %esi, %r9d
cmovll %edi, %r11d
cmovgl %r9d, %esi
movzwl 0x4a(%r15), %edx
cmpl %edx, %r8d
cmovll %ecx, %eax
cmovgl %r8d, %edx
movw %r11w, 0x4(%r15)
movw %si, 0x8(%r15)
movw %dx, 0xa(%r15)
movw %ax, 0x6(%r15)
movl (%r15), %edi
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %esi
andl %eax, %edx
callq 0x4dd8
movl (%r15), %edi
movswl 0x4(%r15), %esi
movswl 0x6(%r15), %edx
callq 0x4d70
movq 0x5bd3(%rip), %rdi      # 0xc3b8
callq 0x3400
jmp 0x65e2
movq %r12, %rdi
callq 0x32d0
movq 0x5bba(%rip), %rdi      # 0xc3b8
xorl %esi, %esi
callq 0x3040
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq