// File: /workspace/github_c_makefile_star2_O1/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, %ebx
movq 0x5f3e(%rip), %r14      # 0xc3b8
movq 0x6357(%rip), %rax      # 0xc7d8
movl (%rax), %esi
movq %r14, %rdi
callq 0x3510
xorl %r15d, %r15d
movq %r14, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x3680
testq %rax, %rax
je 0x68d1
movl 0xc(%rax), %r15d
movzwl 0x10(%rax), %ebp
movzwl 0x12(%rax), %r13d
movq %rax, %rdi
callq 0x32d0
movq 0x5f09(%rip), %rax      # 0xc3c8
testq %rax, %rax
je 0x64d2
movq (%rax), %r14
cmpl %r15d, (%r14)
je 0x64d5
movq 0x10(%rax), %rax
jmp 0x64bf
xorl %r14d, %r14d
movb $0x1, %r15b
testq %r14, %r14
je 0x68d1
movl (%r14), %esi
leaq 0x30(%rsp), %rcx
movl $0x0, (%rcx)
movq 0x5ec2(%rip), %rdi      # 0xc3b8
movl $0x40, %edx
callq 0x3200
cmpl $0x1, %ebx
jne 0x654a
cmpq 0x62d4(%rip), %r14      # 0xc7e0
je 0x6542
movq %r14, %rdi
callq 0x5045
movl (%r14), %esi
leaq 0x34(%rsp), %rcx
movl $0x0, (%rcx)
movq 0x5e8d(%rip), %rdi      # 0xc3b8
movl $0x40, %edx
callq 0x3200
cmpb $0x1, 0x628a(%rip)      # 0xc7c6
jne 0x68d1
xorl %r15d, %r15d
jmp 0x68d1
cmpb $0x0, 0x24(%r14)
jne 0x68d1
cmpb $0x0, 0x26(%r14)
jne 0x68d1
cmpb $0x0, 0x25(%r14)
jne 0x68d1
cmpb $0x0, 0x27(%r14)
jne 0x68d1
cmpb $0x0, 0x28(%r14)
jne 0x68d1
movq 0x5e30(%rip), %r12      # 0xc3b8
movq 0x6249(%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 0x65d0
cmpb $0x0, 0x1(%rax)
je 0x65dd
movq %rax, %rdi
callq 0x32d0
jmp 0x68d1
movq %rax, %rdi
callq 0x32d0
movzwl 0x4(%r14), %eax
movq %rax, 0x18(%rsp)
movzwl 0x6(%r14), %eax
movq %rax, 0x10(%rsp)
movzwl 0x8(%r14), %eax
movl %eax, 0xc(%rsp)
movzwl 0xa(%r14), %eax
movl %eax, 0x8(%rsp)
cmpl $0x3, %ebx
je 0x6652
movl $0x4, %eax
cmpl $0x4, %ebx
jne 0x668a
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 0x668a
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
jge 0x667f
xorl %eax, %eax
cmpw %cx, %bp
setl %al
xorl $0x5, %eax
jmp 0x668a
xorl %eax, %eax
cmpw %cx, %bp
setl %al
xorl $0x7, %eax
leal -0x3(%rbx), %ecx
movl %ecx, 0x24(%rsp)
movb $0x1, %r12b
xorl %r15d, %r15d
movl %eax, %eax
movq %rax, 0x28(%rsp)
movq %r15, %rdi
callq 0x32d0
movq 0x5d0b(%rip), %rdi      # 0xc3b8
callq 0x33d0
testq %rax, %rax
jne 0x66c5
movq 0x5cfa(%rip), %rdi      # 0xc3b8
callq 0x3400
jmp 0x66a6
movq %rax, %r15
movzbl (%rax), %eax
andl $0x7f, %eax
cmpq $0x5, %rax
je 0x6714
cmpl $0x6, %eax
jne 0x671c
movzwl 0x14(%r15), %esi
movzwl 0x16(%r15), %r10d
subl %ebp, %esi
subl %r13d, %r10d
cmpl $0x2, %ebx
jne 0x673a
addl 0x18(%rsp), %esi
movw %si, 0x4(%r14)
addl 0x10(%rsp), %r10d
movw %r10w, 0x6(%r14)
movl (%r14), %edi
movswl %si, %esi
movswl %r10w, %edx
callq 0x4e11
jmp 0x68ae
xorl %r12d, %r12d
jmp 0x68ae
leaq 0x5cbd(%rip), %rcx      # 0xc3e0
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x68ae
movq %r15, %rdi
callq *%rax
jmp 0x68ae
cmpl $0x1, 0x24(%rsp)
ja 0x68ae
movzwl 0x4(%r14), %edi
movzwl 0x6(%r14), %ecx
movzwl 0x8(%r14), %r9d
movzwl 0xa(%r14), %r8d
cmpb $0x1, 0x6061(%rip)      # 0xc7c1
jne 0x677b
movzwl 0x50(%r14), %r11d
movswl %si, %eax
cltd
idivl %r11d
subl %edx, %esi
movswl %r10w, %eax
cltd
idivl %r11d
subl %edx, %r10d
movq 0x28(%rsp), %rax
leaq 0x2891(%rip), %rdx      # 0x9018
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 0x684a
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 0x684c
movq 0x10(%rsp), %rax
addl %r10d, %eax
movswl %r10w, %edx
movl 0x8(%rsp), %r8d
subl %edx, %r8d
jmp 0x6828
movswl %si, %r9d
addl 0xc(%rsp), %r9d
jmp 0x6806
movswl %si, %r9d
addl 0xc(%rsp), %r9d
movswl %r10w, %r8d
addl 0x8(%rsp), %r8d
movl %edi, %r11d
jmp 0x684a
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 0x684c
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(%r14), %esi
cmpl %esi, %r9d
cmovll %edi, %r11d
cmovgl %r9d, %esi
movzwl 0x4a(%r14), %edx
cmpl %edx, %r8d
cmovll %ecx, %eax
cmovgl %r8d, %edx
movw %r11w, 0x4(%r14)
movw %si, 0x8(%r14)
movw %dx, 0xa(%r14)
movw %ax, 0x6(%r14)
movl (%r14), %edi
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %esi
andl %eax, %edx
callq 0x4e79
movl (%r14), %edi
movswl 0x4(%r14), %esi
movswl 0x6(%r14), %edx
callq 0x4e11
movq 0x5b0f(%rip), %rdi      # 0xc3b8
callq 0x3400
testb $0x1, %r12b
jne 0x669e
movq %r15, %rdi
callq 0x32d0
movq 0x5af1(%rip), %rdi      # 0xc3b8
xorl %esi, %esi
callq 0x3040
movb $0x1, %r15b
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq