// File: /workspace/github_c_makefile_star2_O0/9wm[P]9wm/grab.c
// Function: sweepdrag
int
sweepdrag(Client * c, XButtonEvent * e0, void (*recalc) ())
{
	XEvent ev;
	int idle;
	int cx, cy, rx, ry;
	int ox, oy, odx, ody;
	XButtonEvent *e;

	ox = c->x;
	oy = c->y;
	odx = c->dx;
	ody = c->dy;
	c->x -= BORDER;
	c->y -= BORDER;
	c->dx += 2 * BORDER;
	c->dy += 2 * BORDER;
	if (e0) {
		c->x = cx = e0->x;
		c->y = cy = e0->y;
		recalc(c, e0->x, e0->y);
	} else
		getmouse(&cx, &cy, c->screen);
	XGrabServer(dpy);
	drawbound(c);
	idle = 0;
	for (;;) {
		if (XCheckMaskEvent(dpy, ButtonMask, &ev) == 0) {
			getmouse(&rx, &ry, c->screen);
			if (rx != cx || ry != cy || ++idle > 300) {
				drawbound(c);
				if (rx == cx && ry == cy) {
					XUngrabServer(dpy);
					XFlush(dpy);
					misleep(500);
					XGrabServer(dpy);
					idle = 0;
				}
				recalc(c, rx, ry);
				cx = rx;
				cy = ry;
				drawbound(c);
				XFlush(dpy);
			}
			misleep(50);
			continue;
		}
		e = &ev.xbutton;
		switch (ev.type) {
		case ButtonPress:
		case ButtonRelease:
			drawbound(c);
			ungrab(e);
			XUngrabServer(dpy);
			recalc(c, ev.xbutton.x, ev.xbutton.y);
			if (c->dx < 0) {
				c->x += c->dx;
				c->dx = -c->dx;
			}
			if (c->dy < 0) {
				c->y += c->dy;
				c->dy = -c->dy;
			}
			c->x += BORDER;
			c->y += BORDER;
			c->dx -= 2 * BORDER;
			c->dy -= 2 * BORDER;
			if (c->dx < 4 || c->dy < 4 || c->dx < c->min_dx || c->dy < c->min_dy)
				goto bad;
			return 1;
		}
	}
      bad:
	c->x = ox;
	c->y = oy;
	c->dx = odx;
	c->dy = ody;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0xf8(%rbp)
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0xfc(%rbp)
movq -0x10(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x100(%rbp)
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x104(%rbp)
leaq 0x3ffe(%rip), %rax      # 0xc320
movl (%rax), %edx
movq -0x10(%rbp), %rax
movl 0x28(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x28(%rax)
leaq 0x3fe9(%rip), %rax      # 0xc320
movl (%rax), %edx
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x2c(%rax)
leaq 0x3fd4(%rip), %rax      # 0xc320
movl (%rax), %ecx
shll %ecx
movq -0x10(%rbp), %rax
addl 0x30(%rax), %ecx
movl %ecx, 0x30(%rax)
leaq 0x3fbf(%rip), %rax      # 0xc320
movl (%rax), %ecx
shll %ecx
movq -0x10(%rbp), %rax
addl 0x34(%rax), %ecx
movl %ecx, 0x34(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x83ba
movq -0x18(%rbp), %rax
movl 0x40(%rax), %ecx
movl %ecx, -0xe8(%rbp)
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x18(%rbp), %rax
movl 0x44(%rax), %ecx
movl %ecx, -0xec(%rbp)
movq -0x10(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x40(%rax), %esi
movq -0x18(%rbp), %rax
movl 0x44(%rax), %edx
movb $0x0, %al
callq *%rcx
jmp 0x83d8
movq -0x10(%rbp), %rax
movq 0xf8(%rax), %rdx
leaq -0xe8(%rbp), %rdi
leaq -0xec(%rbp), %rsi
callq 0x8940
leaq 0x4599(%rip), %rax      # 0xc978
movq (%rax), %rdi
callq 0x23c0
movq -0x10(%rbp), %rdi
callq 0x8180
movl $0x0, -0xe4(%rbp)
leaq 0x4577(%rip), %rax      # 0xc978
movq (%rax), %rdi
movl $0xc, %esi
leaq -0xe0(%rbp), %rdx
callq 0x24b0
cmpl $0x0, %eax
jne 0x852f
movq -0x10(%rbp), %rax
movq 0xf8(%rax), %rdx
leaq -0xf0(%rbp), %rdi
leaq -0xf4(%rbp), %rsi
callq 0x8940
movl -0xf0(%rbp), %eax
cmpl -0xe8(%rbp), %eax
jne 0x8472
movl -0xf4(%rbp), %eax
cmpl -0xec(%rbp), %eax
jne 0x8472
movl -0xe4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
cmpl $0x12c, %eax            # imm = 0x12C
jle 0x8520
movq -0x10(%rbp), %rdi
callq 0x8180
movl -0xf0(%rbp), %eax
cmpl -0xe8(%rbp), %eax
jne 0x84d8
movl -0xf4(%rbp), %eax
cmpl -0xec(%rbp), %eax
jne 0x84d8
leaq 0x44da(%rip), %rax      # 0xc978
movq (%rax), %rdi
callq 0x2300
leaq 0x44cb(%rip), %rax      # 0xc978
movq (%rax), %rdi
callq 0x2480
movl $0x1f4, %edi            # imm = 0x1F4
callq 0x8280
leaq 0x44b2(%rip), %rax      # 0xc978
movq (%rax), %rdi
callq 0x23c0
movl $0x0, -0xe4(%rbp)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rdi
movl -0xf0(%rbp), %esi
movl -0xf4(%rbp), %edx
movb $0x0, %al
callq *%rcx
movl -0xf0(%rbp), %eax
movl %eax, -0xe8(%rbp)
movl -0xf4(%rbp), %eax
movl %eax, -0xec(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8180
leaq 0x4460(%rip), %rax      # 0xc978
movq (%rax), %rdi
callq 0x2480
movl $0x32, %edi
callq 0x8280
jmp 0x83fa
leaq -0xe0(%rbp), %rax
movq %rax, -0x110(%rbp)
movl -0xe0(%rbp), %eax
addl $-0x4, %eax
subl $0x1, %eax
ja 0x867c
jmp 0x8551
movq -0x10(%rbp), %rdi
callq 0x8180
movq -0x110(%rbp), %rdi
callq 0x7370
leaq 0x440b(%rip), %rax      # 0xc978
movq (%rax), %rdi
callq 0x2300
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rdi
movl -0xa0(%rbp), %esi
movl -0x9c(%rbp), %edx
movb $0x0, %al
callq *%rcx
movq -0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jge 0x85b8
movq -0x10(%rbp), %rax
movl 0x30(%rax), %ecx
movq -0x10(%rbp), %rax
addl 0x28(%rax), %ecx
movl %ecx, 0x28(%rax)
movq -0x10(%rbp), %rax
xorl %ecx, %ecx
subl 0x30(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x34(%rax)
jge 0x85e3
movq -0x10(%rbp), %rax
movl 0x34(%rax), %ecx
movq -0x10(%rbp), %rax
addl 0x2c(%rax), %ecx
movl %ecx, 0x2c(%rax)
movq -0x10(%rbp), %rax
xorl %ecx, %ecx
subl 0x34(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
leaq 0x3d36(%rip), %rax      # 0xc320
movl (%rax), %ecx
movq -0x10(%rbp), %rax
addl 0x28(%rax), %ecx
movl %ecx, 0x28(%rax)
leaq 0x3d23(%rip), %rax      # 0xc320
movl (%rax), %ecx
movq -0x10(%rbp), %rax
addl 0x2c(%rax), %ecx
movl %ecx, 0x2c(%rax)
leaq 0x3d10(%rip), %rax      # 0xc320
movl (%rax), %edx
shll %edx
movq -0x10(%rbp), %rax
movl 0x30(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x30(%rax)
leaq 0x3cf9(%rip), %rax      # 0xc320
movl (%rax), %edx
shll %edx
movq -0x10(%rbp), %rax
movl 0x34(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x34(%rax)
movq -0x10(%rbp), %rax
cmpl $0x4, 0x30(%rax)
jl 0x8671
movq -0x10(%rbp), %rax
cmpl $0x4, 0x34(%rax)
jl 0x8671
movq -0x10(%rbp), %rax
movl 0x30(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x90(%rcx), %eax
jl 0x8671
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x94(%rcx), %eax
jge 0x8673
jmp 0x8681
movl $0x1, -0x4(%rbp)
jmp 0x86bc
jmp 0x83fa
movl -0xf8(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movl -0xfc(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2c(%rax)
movl -0x100(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movl -0x104(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x34(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopl (%rax,%rax)