// File: /workspace/github_c_makefile_star2_O3/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 0xaefd
movq %rdi, %rbx
movl (%rsi), %ecx
leaq 0x9a41(%rip), %r15      # 0x14760
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 0xad67
leaq 0x3c06(%rip), %rdx      # 0xe958
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
negl %ebp
xorl %r14d, %r14d
jmp 0xad69
negl %ebp
movl %ebp, %r14d
xorl %ebp, %ebp
movq 0x30(%rbx), %r12
andl $0x7, %eax
cmpl $0x4, %eax
je 0xaece
cmpl $0x2, %eax
je 0xae4d
cmpl $0x1, %eax
jne 0xaf0a
movl 0x58(%rbx), %eax
addl %ebp, %eax
movl %eax, 0x58(%rbx)
movl 0x60(%rbx), %ecx
movl %ecx, %edx
addl %eax, %edx
jns 0xada3
negl %ecx
movl %ecx, 0x58(%rbx)
movl %ecx, %eax
movl 0xb0(%r12), %ecx
cmpl %ecx, %eax
jl 0xadb4
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 0xadcd
movl %esi, %edi
negl %edi
movl %edi, 0x54(%rbx)
movl 0xac(%r12), %edx
cmpl %edx, %edi
jl 0xaddf
leal -0x1(%rdx), %edi
movl %edi, 0x54(%rbx)
movl 0x50(%rbx), %ecx
movl 0x5c(%r15), %r8d
callq 0x7391
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 0x7391
addl %eax, 0x58(%rbx)
movq %rbx, %rdi
callq 0x6910
movq 0x38(%rbx), %rdi
leaq 0xc(%rsp), %r15
leaq 0x8(%rsp), %r12
movq %r15, %rsi
movq %r12, %rdx
callq 0x8854
addl (%r12), %ebp
movl %ebp, 0xa0(%rbx)
addl (%r15), %r14d
movl %r14d, 0x9c(%rbx)
movq %rbx, %rdi
callq 0x7088
jmp 0xaefd
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 0x6e4d
movq 0x38(%rbx), %rdi
leaq 0x9c(%rbx), %rsi
leaq 0xa0(%rbx), %rdx
callq 0x8854
movl 0x5c(%rbx), %eax
cmpl %eax, 0x9c(%rbx)
jle 0xaea6
subl 0x50(%rbx), %eax
movl %eax, 0x9c(%rbx)
movl 0x60(%rbx), %eax
cmpl %eax, 0xa0(%rbx)
jle 0xaeba
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 0x7088
movq 0x18(%r12), %rdi
leaq 0xc(%rsp), %rbx
leaq 0x8(%rsp), %r15
movq %rbx, %rsi
movq %r15, %rdx
callq 0x8854
movq 0x18(%r12), %rdi
addl (%rbx), %r14d
addl (%r15), %ebp
movl %r14d, %esi
movl %ebp, %edx
callq 0x8897
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3a67(%rip), %rdi      # 0xe978
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5140