// File: /workspace/github_c_makefile_star2_O2/zenlinux[P]cwm/kbfunc.c
// Function: kbfunc_moveresize
void
kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
{
	struct screen_ctx	*sc = cc->sc;
	int			 x, y, flags, amt;
	u_int			 mx, my;

	if (cc->flags & CLIENT_FREEZE)
		return;

	mx = my = 0;

	flags = arg->i;
	amt = Conf.mamount;

	if (flags & CWM_BIGMOVE) {
		flags -= CWM_BIGMOVE;
		amt = amt * 10;
	}

	switch (flags & MOVEMASK) {
	case CWM_UP:
		my -= amt;
		break;
	case CWM_DOWN:
		my += amt;
		break;
	case CWM_RIGHT:
		mx += amt;
		break;
	case CWM_LEFT:
		mx -= amt;
		break;
	}
	switch (flags & TYPEMASK) {
	case CWM_MOVE:
		cc->geom.y += my;
		if (cc->geom.y + cc->geom.h < 0)
			cc->geom.y = -cc->geom.h;
		if (cc->geom.y > sc->view.h - 1)
			cc->geom.y = sc->view.h - 1;

		cc->geom.x += mx;
		if (cc->geom.x + cc->geom.w < 0)
			cc->geom.x = -cc->geom.w;
		if (cc->geom.x > sc->view.w - 1)
			cc->geom.x = sc->view.w - 1;

		cc->geom.x += client_snapcalc(cc->geom.x,
		    cc->geom.w, sc->view.w,
		    cc->bwidth, Conf.snapdist);
		cc->geom.y += client_snapcalc(cc->geom.y,
		    cc->geom.h, sc->view.h,
		    cc->bwidth, Conf.snapdist);

		client_move(cc);
		xu_ptr_getpos(cc->win, &x, &y);
		cc->ptr.y = y + my;
		cc->ptr.x = x + mx;
		client_ptrwarp(cc);
		break;
	case CWM_RESIZE:
		if ((cc->geom.h += my) < 1)
			cc->geom.h = 1;
		if ((cc->geom.w += mx) < 1)
			cc->geom.w = 1;
		client_resize(cc, 1);

		/* Make sure the pointer stays within the window. */
		xu_ptr_getpos(cc->win, &cc->ptr.x, &cc->ptr.y);
		if (cc->ptr.x > cc->geom.w)
			cc->ptr.x = cc->geom.w - cc->bwidth;
		if (cc->ptr.y > cc->geom.h)
			cc->ptr.y = cc->geom.h - cc->bwidth;
		client_ptrwarp(cc);
		break;
	case CWM_PTRMOVE:
		xu_ptr_getpos(sc->rootwin, &x, &y);
		xu_ptr_setpos(sc->rootwin, x + mx, y + my);
		break;
	default:
		warnx("invalid flags passed to kbfunc_client_moveresize");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
testb $0x10, 0xa8(%rdi)
jne 0xaa63
movq %rdi, %rbx
movl (%rsi), %ecx
leaq 0x9ed1(%rip), %r15      # 0x14760
movl 0x58(%r15), %edx
leal -0x8(%rcx), %eax
imull $0xa, %edx, %ebp
testb $0x8, %cl
cmovel %ecx, %eax
cmovel %edx, %ebp
movl %eax, %ecx
andl $0xf0, %ecx
addl $-0x10, %ecx
shrl $0x4, %ecx
xorl %r14d, %r14d
cmpl $0x7, %ecx
ja 0xa8d4
leaq 0x4099(%rip), %rdx      # 0xe958
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
negl %ebp
xorl %r14d, %r14d
jmp 0xa8d6
negl %ebp
movl %ebp, %r14d
xorl %ebp, %ebp
movq 0x30(%rbx), %r12
andl $0x7, %eax
cmpl $0x4, %eax
je 0xaa34
cmpl $0x2, %eax
je 0xa9ba
cmpl $0x1, %eax
jne 0xaa70
movl 0x58(%rbx), %eax
addl %ebp, %eax
movl %eax, 0x58(%rbx)
movl 0x60(%rbx), %ecx
movl %ecx, %edx
addl %eax, %edx
jns 0xa910
negl %ecx
movl %ecx, 0x58(%rbx)
movl %ecx, %eax
movl 0xb0(%r12), %ecx
cmpl %ecx, %eax
jl 0xa921
decl %ecx
movl %ecx, 0x58(%rbx)
movl 0x54(%rbx), %edi
addl %r14d, %edi
movl %edi, 0x54(%rbx)
movl 0x5c(%rbx), %esi
movl %esi, %eax
addl %edi, %eax
jns 0xa93a
movl %esi, %edi
negl %edi
movl %edi, 0x54(%rbx)
movl 0xac(%r12), %edx
cmpl %edx, %edi
jl 0xa94c
leal -0x1(%rdx), %edi
movl %edi, 0x54(%rbx)
movl 0x50(%rbx), %ecx
movl 0x5c(%r15), %r8d
callq 0x71b8
addl %eax, 0x54(%rbx)
movl 0x50(%rbx), %ecx
movl 0x58(%rbx), %edi
movl 0x60(%rbx), %esi
movl 0xb0(%r12), %edx
movl 0x5c(%r15), %r8d
callq 0x71b8
addl %eax, 0x58(%rbx)
movq %rbx, %rdi
callq 0x677b
movq 0x38(%rbx), %rdi
leaq 0xc(%rsp), %r15
leaq 0x8(%rsp), %r12
movq %r15, %rsi
movq %r12, %rdx
callq 0x85b2
addl (%r12), %ebp
movl %ebp, 0xa0(%rbx)
addl (%r15), %r14d
movl %r14d, 0x9c(%rbx)
movq %rbx, %rdi
callq 0x6eaa
jmp 0xaa63
addl 0x60(%rbx), %ebp
cmpl $0x2, %ebp
pushq $0x1
popq %rsi
cmovll %esi, %ebp
movl %ebp, 0x60(%rbx)
addl 0x5c(%rbx), %r14d
cmpl $0x2, %r14d
cmovll %esi, %r14d
movl %r14d, 0x5c(%rbx)
movq %rbx, %rdi
callq 0x6c74
movq 0x38(%rbx), %rdi
leaq 0x9c(%rbx), %rsi
leaq 0xa0(%rbx), %rdx
callq 0x85b2
movl 0x5c(%rbx), %eax
cmpl %eax, 0x9c(%rbx)
jle 0xaa0c
subl 0x50(%rbx), %eax
movl %eax, 0x9c(%rbx)
movl 0x60(%rbx), %eax
cmpl %eax, 0xa0(%rbx)
jle 0xaa20
subl 0x50(%rbx), %eax
movl %eax, 0xa0(%rbx)
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6eaa
movq 0x18(%r12), %rdi
leaq 0xc(%rsp), %rbx
leaq 0x8(%rsp), %r15
movq %rbx, %rsi
movq %r15, %rdx
callq 0x85b2
movq 0x18(%r12), %rdi
addl (%rbx), %r14d
addl (%r15), %ebp
movl %r14d, %esi
movl %ebp, %edx
callq 0x85f5
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f01(%rip), %rdi      # 0xe978
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5140