// File: /workspace/github_c_makefile_star2_O3/mati75[P]evilwm/events.c
// Function: do_window_changes
static void do_window_changes(int value_mask, XWindowChanges *wc, struct client *c,
		int gravity) {
	LOG_XENTER("do_window_changes(window=%lx), was: %dx%d+%d+%d", (unsigned long)c->window, c->width, c->height, c->x, c->y);
	if (gravity == 0)
		gravity = c->win_gravity_hint;
	c->win_gravity = gravity;
	if (value_mask & CWX) {
		c->x = wc->x;
		LOG_XDEBUG("CWX      x=%d\n", wc->x);
	}
	if (value_mask & CWY) {
		c->y = wc->y;
		LOG_XDEBUG("CWY      y=%d\n", wc->y);
	}
	if (value_mask & (CWWidth|CWHeight)) {
		int dw = 0, dh = 0;
		if (!(value_mask & (CWX|CWY))) {
			client_gravitate(c, -c->border);
		}
		if (value_mask & CWWidth) {
			LOG_XDEBUG("CWWidth  width=%d\n", wc->width);
			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) {
			LOG_XDEBUG("CWHeight height=%d\n", wc->height);
			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;
			client_gravitate(c, c->border);
		}
	}

	wc->x = c->x - c->border;
	wc->y = c->y - c->border;
	wc->border_width = c->border;
	XConfigureWindow(display.dpy, c->parent, value_mask, wc);
	XMoveResizeWindow(display.dpy, c->window, 0, 0, c->width, c->height);
	if ((value_mask & (CWX|CWY)) && !(value_mask & (CWWidth|CWHeight))) {
		send_config(c);
	}
	LOG_XLEAVE();
}

// 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 0x7ad4
movl 0x8c(%rbx), %r15d
movl %r15d, 0x90(%rbx)
testb $0x1, %bpl
je 0x7ae7
movl (%r14), %eax
movl %eax, 0x28(%rbx)
testb $0x2, %bpl
je 0x7af4
movl 0x4(%r14), %eax
movl %eax, 0x2c(%rbx)
testb $0xc, %bpl
je 0x7bde
testb $0x3, %bpl
jne 0x7b11
xorl %esi, %esi
subl 0x3c(%rbx), %esi
movq %rbx, %rdi
callq 0x56df
xorl %eax, %eax
movl $0x0, %ecx
testb $0x4, %bpl
je 0x7b41
movl 0x8(%r14), %ecx
movl 0x6c(%rbx), %edx
movl 0x74(%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 0x30(%rbx), %ecx
movl %edi, 0x30(%rbx)
testb $0x8, %bpl
je 0x7b6a
movl 0xc(%r14), %eax
movl 0x70(%rbx), %edx
movl 0x78(%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 0x34(%rbx), %eax
movl %edi, 0x34(%rbx)
testb $0x3, %bpl
jne 0x7bde
addl $-0x2, %r15d
cmpl $0x7, %r15d
ja 0x7bd0
leaq 0x2dcf(%rip), %rdx      # 0xa950
movslq (%rdx,%r15,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
subl %eax, 0x28(%rbx)
jmp 0x7bd0
subl %ecx, 0x28(%rbx)
jmp 0x7ba9
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
subl %edx, 0x28(%rbx)
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
subl %ecx, 0x2c(%rbx)
jmp 0x7bd0
subl %ecx, 0x28(%rbx)
jmp 0x7bcd
subl %ecx, 0x28(%rbx)
jmp 0x7bd0
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
subl %edx, 0x28(%rbx)
subl %eax, 0x2c(%rbx)
orl $0x3, %ebp
movl 0x3c(%rbx), %esi
movq %rbx, %rdi
callq 0x56df
movl 0x3c(%rbx), %eax
movq 0x28(%rbx), %xmm0
movd %eax, %xmm1
pshufd $0x50, %xmm1, %xmm1     # xmm1 = xmm1[0,0,1,1]
psubd %xmm1, %xmm0
movq %xmm0, (%r14)
movl %eax, 0x10(%r14)
leaq 0x7b25(%rip), %r15      # 0xf728
movq (%r15), %rdi
movq 0x8(%rbx), %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x40e0
movq (%r15), %rdi
movq (%rbx), %rsi
movl 0x30(%rbx), %r8d
movl 0x34(%rbx), %r9d
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x43b0
testb $0x3, %bpl
sete %al
testb $0xc, %bpl
setne %cl
orb %al, %cl
jne 0x7c4f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x567f
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop