// File: /workspace/github_c_makefile_star2_O1/kek[P]evilwm/events.c
// Function: do_window_changes
static void do_window_changes(int value_mask, XWindowChanges *wc, Client *c,
		int gravity) {
	if (gravity == 0)
		gravity = c->win_gravity_hint;
	c->win_gravity = gravity;
	if (value_mask & CWX) c->x = wc->x;
	if (value_mask & CWY) c->y = wc->y;
	if (value_mask & (CWWidth|CWHeight)) {
		int dw = 0, dh = 0;
		if (!(value_mask & (CWX|CWY))) {
			gravitate_border(c, -c->border);
		}
		if (value_mask & CWWidth) {
			int neww = wc->width;
			if (neww < c->min_width)
				neww = c->min_width;
			if (c->max_width && neww > c->max_width)
				neww = c->max_width;
			dw = neww - c->width;
			c->width = neww;
		}
		if (value_mask & CWHeight) {
			int newh = wc->height;
			if (newh < c->min_height)
				newh = c->min_height;
			if (c->max_height && newh > c->max_height)
				newh = c->max_height;
			dh = newh - c->height;
			c->height = newh;
		}
		/* only apply position fixes if not being explicitly moved */
		if (!(value_mask & (CWX|CWY))) {
			switch (gravity) {
			default:
			case NorthWestGravity:
				break;
			case NorthGravity:
				c->x -= (dw / 2);
				break;
			case NorthEastGravity:
				c->x -= dw;
				break;
			case WestGravity:
				c->y -= (dh / 2);
				break;
			case CenterGravity:
				c->x -= (dw / 2);
				c->y -= (dh / 2);
				break;
			case EastGravity:
				c->x -= dw;
				c->y -= (dh / 2);
				break;
			case SouthWestGravity:
				c->y -= dh;
				break;
			case SouthGravity:
				c->x -= (dw / 2);
				c->y -= dh;
				break;
			case SouthEastGravity:
				c->x -= dw;
				c->y -= dh;
				break;
			}
			value_mask |= CWX|CWY;
			gravitate_border(c, c->border);
		}
	}
	wc->x = c->x - c->border;
	wc->y = c->y - c->border;
	wc->border_width = c->border;
	XConfigureWindow(dpy, c->parent, value_mask, wc);
	XMoveResizeWindow(dpy, c->window, 0, 0, c->width, c->height);
	if ((value_mask & (CWX|CWY)) && !(value_mask & (CWWidth|CWHeight))) {
		send_config(c);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %r15d
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
testl %ecx, %ecx
jne 0x4c93
movl 0x68(%rbx), %r15d
movl %r15d, 0x6c(%rbx)
testb $0x1, %bpl
je 0x4ca3
movl (%r14), %eax
movl %eax, 0x24(%rbx)
testb $0x2, %bpl
je 0x4cb0
movl 0x4(%r14), %eax
movl %eax, 0x28(%rbx)
testb $0xc, %bpl
je 0x4d9a
testb $0x3, %bpl
jne 0x4ccd
xorl %esi, %esi
subl 0x34(%rbx), %esi
movq %rbx, %rdi
callq 0x3c2a
xorl %eax, %eax
movl $0x0, %ecx
testb $0x4, %bpl
je 0x4cfd
movl 0x8(%r14), %ecx
movl 0x48(%rbx), %edx
movl 0x50(%rbx), %esi
cmpl %edx, %ecx
cmovgl %ecx, %edx
cmpl %esi, %edx
movl %esi, %edi
cmovll %edx, %edi
testl %esi, %esi
cmovel %edx, %edi
movl %edi, %ecx
subl 0x2c(%rbx), %ecx
movl %edi, 0x2c(%rbx)
testb $0x8, %bpl
je 0x4d26
movl 0xc(%r14), %eax
movl 0x4c(%rbx), %edx
movl 0x54(%rbx), %esi
cmpl %edx, %eax
cmovgl %eax, %edx
cmpl %esi, %edx
movl %esi, %edi
cmovll %edx, %edi
testl %esi, %esi
cmovel %edx, %edi
movl %edi, %eax
subl 0x30(%rbx), %eax
movl %edi, 0x30(%rbx)
testb $0x3, %bpl
jne 0x4d9a
addl $-0x2, %r15d
cmpl $0x7, %r15d
ja 0x4d8c
leaq 0x438b(%rip), %rdx      # 0x90c8
movslq (%rdx,%r15,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
subl %eax, 0x24(%rbx)
jmp 0x4d8c
subl %ecx, 0x24(%rbx)
jmp 0x4d65
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
subl %edx, 0x24(%rbx)
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
subl %ecx, 0x28(%rbx)
jmp 0x4d8c
subl %ecx, 0x24(%rbx)
jmp 0x4d89
subl %ecx, 0x24(%rbx)
jmp 0x4d8c
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
subl %edx, 0x24(%rbx)
subl %eax, 0x28(%rbx)
orl $0x3, %ebp
movl 0x34(%rbx), %esi
movq %rbx, %rdi
callq 0x3c2a
movl 0x24(%rbx), %eax
movl 0x34(%rbx), %ecx
subl %ecx, %eax
movl %eax, (%r14)
movl 0x28(%rbx), %eax
subl %ecx, %eax
movl %eax, 0x4(%r14)
movl %ecx, 0x10(%r14)
leaq 0x7a27(%rip), %r15      # 0xc7e0
movq (%r15), %rdi
movq 0x8(%rbx), %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x3040
movq (%r15), %rdi
movq (%rbx), %rsi
movl 0x2c(%rbx), %r8d
movl 0x30(%rbx), %r9d
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3250
testb $0x3, %bpl
sete %al
testb $0xc, %bpl
setne %cl
orb %al, %cl
jne 0x4e05
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3bc8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq