// File: /workspace/github_c_makefile_star2_O1/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 0xb0bc
movq %rdi, %rbx
movl (%rsi), %ecx
leaq 0x9891(%rip), %r15      # 0x14770
movl 0x58(%r15), %edx
leal -0x8(%rcx), %eax
leal (%rdx,%rdx), %esi
testb $0x8, %cl
leal (%rsi,%rsi,4), %ebp
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 0xaf27
leaq 0x3a56(%rip), %rdx      # 0xe968
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
negl %ebp
xorl %r14d, %r14d
jmp 0xaf29
negl %ebp
movl %ebp, %r14d
xorl %ebp, %ebp
movq 0x30(%rbx), %r12
andl $0x7, %eax
cmpl $0x4, %eax
je 0xb08d
cmpl $0x2, %eax
je 0xb00c
cmpl $0x1, %eax
jne 0xb0c9
movl 0x58(%rbx), %ecx
addl %ebp, %ecx
movl %ecx, 0x58(%rbx)
movl 0x60(%rbx), %eax
addl %eax, %ecx
jns 0xaf5f
negl %eax
movl %eax, 0x58(%rbx)
movl 0xb0(%r12), %eax
cmpl %eax, 0x58(%rbx)
jl 0xaf71
decl %eax
movl %eax, 0x58(%rbx)
movl 0x54(%rbx), %eax
addl %r14d, %eax
movl %eax, 0x54(%rbx)
movl 0x5c(%rbx), %esi
addl %esi, %eax
jns 0xaf88
movl %esi, %eax
negl %eax
movl %eax, 0x54(%rbx)
movl 0xac(%r12), %edx
cmpl %edx, 0x54(%rbx)
jl 0xaf9b
leal -0x1(%rdx), %eax
movl %eax, 0x54(%rbx)
movl 0x50(%rbx), %ecx
movl 0x54(%rbx), %edi
movl 0x5c(%r15), %r8d
callq 0x73f3
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 0x73f3
addl %eax, 0x58(%rbx)
movq %rbx, %rdi
callq 0x695d
movq 0x38(%rbx), %rdi
leaq 0xc(%rsp), %r15
leaq 0x8(%rsp), %r12
movq %r15, %rsi
movq %r12, %rdx
callq 0x89e4
addl (%r12), %ebp
movl %ebp, 0xa0(%rbx)
addl (%r15), %r14d
movl %r14d, 0x9c(%rbx)
movq %rbx, %rdi
callq 0x70e5
jmp 0xb0bc
addl 0x60(%rbx), %ebp
cmpl $0x2, %ebp
movl $0x1, %eax
cmovll %eax, %ebp
movl %ebp, 0x60(%rbx)
addl 0x5c(%rbx), %r14d
cmpl $0x2, %r14d
cmovll %eax, %r14d
movl %r14d, 0x5c(%rbx)
movq %rbx, %rdi
movl $0x1, %esi
callq 0x6eb4
movq 0x38(%rbx), %rdi
leaq 0x9c(%rbx), %rsi
leaq 0xa0(%rbx), %rdx
callq 0x89e4
movl 0x5c(%rbx), %eax
cmpl %eax, 0x9c(%rbx)
jle 0xb065
subl 0x50(%rbx), %eax
movl %eax, 0x9c(%rbx)
movl 0x60(%rbx), %eax
cmpl %eax, 0xa0(%rbx)
jle 0xb079
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 0x70e5
movq 0x18(%r12), %rdi
leaq 0xc(%rsp), %rbx
leaq 0x8(%rsp), %r15
movq %rbx, %rsi
movq %r15, %rdx
callq 0x89e4
movq 0x18(%r12), %rdi
addl (%rbx), %r14d
addl (%r15), %ebp
movl %r14d, %esi
movl %ebp, %edx
callq 0x8a27
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x38b8(%rip), %rdi      # 0xe988
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5140