// File: /workspace/github_c_makefile_star2_O1/mati75[P]evilwm/client_move.c
// Function: client_resize_sweep
void client_resize_sweep(struct client *c, unsigned button) {
	// Ensure we can grab pointer events.
	if (!grab_pointer(c->screen->root, display.resize_curs))
		return;

	// Sweeping always raises.
	client_raise(c);

	int old_cx = c->x;
	int old_cy = c->y;

#ifdef INFOBANNER_MOVERESIZE
	create_info_window(c);
#endif
	XGrabServer(display.dpy);
	draw_outline(c);  // draw

	// Warp pointer to the bottom-right of the client for resizing
	setmouse(c->window, c->width, c->height);

	for (;;) {
		XEvent ev;
		XMaskEvent(display.dpy, ButtonPressMask|ButtonReleaseMask|PointerMotionMask, &ev);
		switch (ev.type) {
			case MotionNotify:
				if (ev.xmotion.root != c->screen->root)
					break;
				draw_outline(c);  // erase
				XUngrabServer(display.dpy);
				recalculate_sweep(c, old_cx, old_cy, ev.xmotion.x, ev.xmotion.y, ev.xmotion.state & altmask);
#ifdef INFOBANNER_MOVERESIZE
				update_info_window(c);
#endif
				XSync(display.dpy, False);
				XGrabServer(display.dpy);
				draw_outline(c);  // draw
				break;

			case ButtonRelease:
				if (ev.xbutton.button != button)
					continue;
				draw_outline(c);  // erase
				XUngrabServer(display.dpy);
#ifdef INFOBANNER_MOVERESIZE
				remove_info_window();
#endif
				XUngrabPointer(display.dpy, CurrentTime);
				client_moveresizeraise(c);
				// In case maximise state has changed:
				ewmh_set_net_wm_state(c);
				return;

			default:
				break;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %esi, 0x4(%rsp)
movq %rdi, %r14
leaq 0xa81d(%rip), %r12      # 0x10738
movq 0x10(%rdi), %rax
movq 0x10(%rax), %rsi
movq (%r12), %rdi
subq $0x8, %rsp
xorl %eax, %eax
xorl %edx, %edx
movl $0x4c, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
pushq %rax
pushq 0x170(%r12)
pushq %rax
callq 0x4220
addq $0x20, %rsp
testl %eax, %eax
jne 0x6166
movq %r14, %rdi
callq 0x56e7
movl 0x28(%r14), %ebp
movl 0x2c(%r14), %r13d
movq (%r12), %rdi
callq 0x4110
movq %r14, %rdi
callq 0x6178
movq (%r12), %rdi
movq (%r14), %rdx
movl 0x30(%r14), %eax
movl 0x34(%r14), %r10d
subq $0x8, %rsp
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r10
pushq %rax
pushq $0x0
callq 0x4530
addq $0x20, %rsp
leaq 0x8(%rsp), %r15
movq (%r12), %rdi
movl $0x4c, %esi
movq %r15, %rdx
callq 0x4510
movl 0x8(%rsp), %eax
cmpl $0x5, %eax
je 0x606d
xorl %ebx, %ebx
cmpl $0x6, %eax
jne 0x6155
movq 0x30(%rsp), %rax
movq 0x10(%r14), %rcx
cmpq 0x10(%rcx), %rax
jne 0x6155
movq %r14, %rdi
callq 0x6178
movq (%r12), %rdi
callq 0x43a0
movl 0x48(%rsp), %esi
leaq 0xa3ec(%rip), %rax      # 0x103f0
movl 0x28(%rax), %ecx
andl 0x58(%rsp), %ecx
je 0x60be
movl %ebp, %eax
subl %esi, %eax
movl %eax, %edi
negl %edi
cmovsl %eax, %edi
movl %edi, %eax
subl 0x84(%r14), %eax
cltd
idivl 0x7c(%r14)
subl %edx, %edi
movl 0x6c(%r14), %edx
movl %edi, %eax
cmpl %edx, %edi
jg 0x6038
movl %edx, %eax
movl 0x74(%r14), %r8d
testl %edx, %edx
cmovel %edi, %eax
movl %eax, %edx
cmpl %r8d, %eax
jl 0x604b
movl %r8d, %edx
testl %r8d, %r8d
cmovel %eax, %edx
cmpl %esi, %ebp
movl $0x0, %eax
movl %eax, 0x48(%r14)
movl %edx, 0x30(%r14)
cmovlel %eax, %edx
movl %ebp, %eax
subl %edx, %eax
movl %eax, 0x28(%r14)
jmp 0x60c9
movl $0x3, %ebx
movl 0x4(%rsp), %eax
cmpl %eax, 0x5c(%rsp)
jne 0x6155
movq %r14, %rdi
callq 0x6178
movq (%r12), %rdi
callq 0x43a0
movq (%r12), %rdi
xorl %esi, %esi
callq 0x41b0
movq %r14, %rdi
callq 0x56e7
movq %r14, %rdi
callq 0x6902
movq %r14, %rdi
callq 0x8090
movl $0x1, %ebx
jmp 0x6155
cmpl $0x0, 0x48(%r14)
je 0x6011
movl 0x4c(%rsp), %esi
testl %ecx, %ecx
je 0x6130
movl %r13d, %eax
subl %esi, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl %ecx, %eax
subl 0x88(%r14), %eax
cltd
idivl 0x80(%r14)
subl %edx, %ecx
movl 0x70(%r14), %edi
movl %ecx, %eax
cmpl %edi, %ecx
jg 0x60fc
movl %edi, %eax
movl 0x78(%r14), %edx
testl %edi, %edi
cmovel %ecx, %eax
movl %eax, %ecx
cmpl %edx, %eax
jl 0x610d
movl %edx, %ecx
testl %edx, %edx
cmovel %eax, %ecx
cmpl %esi, %r13d
movl $0x0, %eax
movl %eax, 0x4c(%r14)
movl %ecx, 0x34(%r14)
cmovlel %eax, %ecx
movl %r13d, %eax
subl %ecx, %eax
movl %eax, 0x2c(%r14)
jmp 0x6137
cmpl $0x0, 0x4c(%r14)
je 0x60d1
movq (%r12), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x4500
movq (%r12), %rdi
callq 0x4110
movq %r14, %rdi
callq 0x6178
testl %ebx, %ebx
je 0x5fac
cmpl $0x3, %ebx
je 0x5fac
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq