// File: /workspace/github_c_makefile_star2_O0/baskerville[P]bspwm/src/window.c
// Function: resize_client
bool resize_client(coordinates_t *loc, resize_handle_t rh, int dx, int dy, bool relative)
{
	node_t *n = loc->node;
	if (n == NULL || n->client == NULL || n->client->state == STATE_FULLSCREEN) {
		return false;
	}
	node_t *horizontal_fence = NULL, *vertical_fence = NULL;
	xcb_rectangle_t rect = get_rectangle(NULL, NULL, n);
	uint16_t width = rect.width, height = rect.height;
	int16_t x = rect.x, y = rect.y;
	if (n->client->state == STATE_TILED) {
		if (rh & HANDLE_LEFT) {
			vertical_fence = find_fence(n, DIR_WEST);
		} else if (rh & HANDLE_RIGHT) {
			vertical_fence = find_fence(n, DIR_EAST);
		}
		if (rh & HANDLE_TOP) {
			horizontal_fence = find_fence(n, DIR_NORTH);
		} else if (rh & HANDLE_BOTTOM) {
			horizontal_fence = find_fence(n, DIR_SOUTH);
		}
		if (vertical_fence == NULL && horizontal_fence == NULL) {
			return false;
		}
		if (vertical_fence != NULL) {
			double sr = 0.0;
			if (relative) {
				sr = vertical_fence->split_ratio + (double) dx / (double) vertical_fence->rectangle.width;
			} else {
				sr = (double) (dx - vertical_fence->rectangle.x) / (double) vertical_fence->rectangle.width;
			}
			sr = MAX(0, sr);
			sr = MIN(1, sr);
			vertical_fence->split_ratio = sr;
			adjust_ratios(vertical_fence, vertical_fence->rectangle);
		}
		if (horizontal_fence != NULL) {
			double sr = 0.0;
			if (relative) {
				sr = horizontal_fence->split_ratio + (double) dy / (double) horizontal_fence->rectangle.height;
			} else {
				sr = (double) (dy - horizontal_fence->rectangle.y) / (double) horizontal_fence->rectangle.height;
			}
			sr = MAX(0, sr);
			sr = MIN(1, sr);
			horizontal_fence->split_ratio = sr;
			adjust_ratios(horizontal_fence, horizontal_fence->rectangle);
		}
		arrange(loc->monitor, loc->desktop);
	} else {
		int w = width, h = height;
		if (relative) {
			w += dx * (rh & HANDLE_LEFT ? -1 : (rh & HANDLE_RIGHT ? 1 : 0));
			h += dy * (rh & HANDLE_TOP ? -1 : (rh & HANDLE_BOTTOM ? 1 : 0));
		} else {
			if (rh & HANDLE_LEFT) {
				w = x + width - dx;
			} else if (rh & HANDLE_RIGHT) {
				w = dx - x;
			}
			if (rh & HANDLE_TOP) {
				h = y + height - dy;
			} else if (rh & HANDLE_BOTTOM) {
				h = dy - y;
			}
		}
		width = MAX(1, w);
		height = MAX(1, h);
		apply_size_hints(n->client, &width, &height);
		if (rh & HANDLE_LEFT) {
			x += rect.width - width;
		}
		if (rh & HANDLE_TOP) {
			y += rect.height - height;
		}
		n->client->floating_rectangle = (xcb_rectangle_t) {x, y, width, height};
		if (n->client->state == STATE_FLOATING) {
			window_move_resize(n->id, x, y, width, height);

			if (!grabbing) {
				put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", loc->monitor->id, loc->desktop->id, loc->node->id, width, height, x, y);
			}
		} else {
			arrange(loc->monitor, loc->desktop);
		}
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movb %r8b, %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
andb $0x1, %al
movb %al, -0x1d(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x179af
movq -0x28(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x179af
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x3, 0x308(%rax)
jne 0x179b8
movb $0x0, -0x1(%rbp)
jmp 0x17f32
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0xc7f0
movq %rax, -0x40(%rbp)
movw -0x3c(%rbp), %ax
movw %ax, -0x42(%rbp)
movw -0x3a(%rbp), %ax
movw %ax, -0x44(%rbp)
movw -0x40(%rbp), %ax
movw %ax, -0x46(%rbp)
movw -0x3e(%rbp), %ax
movw %ax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x0, 0x308(%rax)
jne 0x17c7d
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x17a30
movq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0xe9c0
movq %rax, -0x38(%rbp)
jmp 0x17a4f
movl -0x14(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x17a4d
movq -0x28(%rbp), %rdi
movl $0x3, %esi
callq 0xe9c0
movq %rax, -0x38(%rbp)
jmp 0x17a4f
movl -0x14(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x17a6b
movq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0xe9c0
movq %rax, -0x30(%rbp)
jmp 0x17a8a
movl -0x14(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x17a88
movq -0x28(%rbp), %rdi
movl $0x2, %esi
callq 0xe9c0
movq %rax, -0x30(%rbp)
jmp 0x17a8a
cmpq $0x0, -0x38(%rbp)
jne 0x17aa1
cmpq $0x0, -0x30(%rbp)
jne 0x17aa1
movb $0x0, -0x1(%rbp)
jmp 0x17f32
cmpq $0x0, -0x38(%rbp)
je 0x17b7e
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
testb $0x1, -0x1d(%rbp)
je 0x17adf
movq -0x38(%rbp), %rax
movsd 0x8(%rax), %xmm0
cvtsi2sdl -0x18(%rbp), %xmm1
movzwl 0x1c(%rax), %eax
cvtsi2sd %eax, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
jmp 0x17b01
movl -0x18(%rbp), %ecx
movq -0x38(%rbp), %rax
movswl 0x18(%rax), %edx
subl %edx, %ecx
cvtsi2sd %ecx, %xmm0
movzwl 0x1c(%rax), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x50(%rbp), %xmm0
jbe 0x17b15
xorps %xmm0, %xmm0
movsd %xmm0, -0x70(%rbp)
jmp 0x17b1f
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movsd 0x15c7a(%rip), %xmm1    # 0x2d7b0
ucomisd %xmm1, %xmm0
jbe 0x17b4b
movsd 0x15c6c(%rip), %xmm0    # 0x2d7b0
movsd %xmm0, -0x78(%rbp)
jmp 0x17b55
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x38(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0xf490
cmpq $0x0, -0x30(%rbp)
je 0x17c64
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
testb $0x1, -0x1d(%rbp)
je 0x17bbc
movq -0x30(%rbp), %rax
movsd 0x8(%rax), %xmm0
cvtsi2sdl -0x1c(%rbp), %xmm1
movzwl 0x1e(%rax), %eax
cvtsi2sd %eax, %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
jmp 0x17bde
movl -0x1c(%rbp), %ecx
movq -0x30(%rbp), %rax
movswl 0x1a(%rax), %edx
subl %edx, %ecx
cvtsi2sd %ecx, %xmm0
movzwl 0x1e(%rax), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x58(%rbp), %xmm0
jbe 0x17bf2
xorps %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
jmp 0x17bfc
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
movsd 0x15b9d(%rip), %xmm1    # 0x2d7b0
ucomisd %xmm1, %xmm0
jbe 0x17c2b
movsd 0x15b8f(%rip), %xmm0    # 0x2d7b0
movsd %xmm0, -0x88(%rbp)
jmp 0x17c38
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
movq -0x30(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x30(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0xf490
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xafd0
jmp 0x17f2e
movzwl -0x42(%rbp), %eax
movl %eax, -0x5c(%rbp)
movzwl -0x44(%rbp), %eax
movl %eax, -0x60(%rbp)
testb $0x1, -0x1d(%rbp)
je 0x17d35
movl -0x18(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x17cb6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x90(%rbp)
jmp 0x17ccf
movl -0x14(%rbp), %edx
andl $0x4, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x90(%rbp)
movl -0x8c(%rbp), %eax
movl -0x90(%rbp), %ecx
imull %ecx, %eax
addl -0x5c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0x14(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x17d05
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x98(%rbp)
jmp 0x17d1e
movl -0x14(%rbp), %edx
andl $0x8, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x98(%rbp)
movl -0x94(%rbp), %eax
movl -0x98(%rbp), %ecx
imull %ecx, %eax
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x17da3
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x17d52
movswl -0x46(%rbp), %eax
movzwl -0x42(%rbp), %ecx
addl %ecx, %eax
subl -0x18(%rbp), %eax
movl %eax, -0x5c(%rbp)
jmp 0x17d6b
movl -0x14(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x17d69
movl -0x18(%rbp), %eax
movswl -0x46(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x5c(%rbp)
jmp 0x17d6b
movl -0x14(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x17d88
movswl -0x48(%rbp), %eax
movzwl -0x44(%rbp), %ecx
addl %ecx, %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x17da1
movl -0x14(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x17d9f
movl -0x1c(%rbp), %eax
movswl -0x48(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x60(%rbp)
jmp 0x17da1
jmp 0x17da3
movl $0x1, %eax
cmpl -0x5c(%rbp), %eax
jle 0x17dba
movl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x17dc3
movl -0x5c(%rbp), %eax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movw %ax, -0x42(%rbp)
movl $0x1, %eax
cmpl -0x60(%rbp), %eax
jle 0x17de4
movl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x17ded
movl -0x60(%rbp), %eax
movl %eax, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
movw %ax, -0x44(%rbp)
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rdi
leaq -0x42(%rbp), %rsi
leaq -0x44(%rbp), %rdx
callq 0x17f40
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x17e2b
movzwl -0x3c(%rbp), %ecx
movzwl -0x42(%rbp), %eax
subl %eax, %ecx
movswl -0x46(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x46(%rbp)
movl -0x14(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x17e4a
movzwl -0x3a(%rbp), %ecx
movzwl -0x44(%rbp), %eax
subl %eax, %ecx
movswl -0x48(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movw -0x46(%rbp), %cx
movw %cx, -0x68(%rbp)
movw -0x48(%rbp), %cx
movw %cx, -0x66(%rbp)
movw -0x42(%rbp), %cx
movw %cx, -0x64(%rbp)
movw -0x44(%rbp), %cx
movw %cx, -0x62(%rbp)
movq -0x68(%rbp), %rcx
movq %rcx, 0x318(%rax)
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x2, 0x308(%rax)
jne 0x17f18
movq -0x28(%rbp), %rax
movl (%rax), %edi
movw -0x46(%rbp), %dx
movw -0x48(%rbp), %cx
movw -0x42(%rbp), %ax
movswl %dx, %esi
movswl %cx, %edx
movzwl %ax, %ecx
movzwl -0x44(%rbp), %r8d
callq 0x16da0
leaq 0x1df58(%rip), %rax     # 0x35e16
testb $0x1, (%rax)
jne 0x17f16
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x20(%rax), %edx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x20(%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %r8d
movzwl -0x42(%rbp), %r9d
movzwl -0x44(%rbp), %r11d
movswl -0x46(%rbp), %r10d
movswl -0x48(%rbp), %eax
movl $0x800000, %edi         # imm = 0x800000
leaq 0x158b6(%rip), %rsi     # 0x2d7b8
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x2c0b0
jmp 0x17f2c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xafd0
jmp 0x17f2e
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xc0, %rsp
popq %rbp
retq