// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/window.c
// Function: draw_presel_feedback
void draw_presel_feedback(monitor_t *m, desktop_t *d, node_t *n)
{
	if (n == NULL || n->presel == NULL || d->user_layout == LAYOUT_MONOCLE || !presel_feedback) {
		return;
	}

	bool exists = (n->presel->feedback != XCB_NONE);
	if (!exists) {
		initialize_presel_feedback(n);
	}

	int gap = gapless_monocle && d->layout == LAYOUT_MONOCLE ? 0 : d->window_gap;
	presel_t *p = n->presel;
	xcb_rectangle_t rect = n->rectangle;
	rect.x = rect.y = 0;
	rect.width -= gap;
	rect.height -= gap;
	xcb_rectangle_t presel_rect = rect;

	switch (p->split_dir) {
		case DIR_NORTH:
			presel_rect.height = p->split_ratio * rect.height;
			break;
		case DIR_EAST:
			presel_rect.width = (1 - p->split_ratio) * rect.width;
			presel_rect.x = rect.width - presel_rect.width;
			break;
		case DIR_SOUTH:
			presel_rect.height = (1 - p->split_ratio) * rect.height;
			presel_rect.y = rect.height - presel_rect.height;
			break;
		case DIR_WEST:
			presel_rect.width = p->split_ratio * rect.width;
			break;
	}

	window_move_resize(p->feedback, n->rectangle.x + presel_rect.x, n->rectangle.y + presel_rect.y,
	                   presel_rect.width, presel_rect.height);

	if (!exists && m->desk == d) {
		window_show(p->feedback);
	}
}

// Assembly:
testq %rdx, %rdx
je 0x10348
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movq 0x10(%rdx), %rax
testq %rax, %rax
je 0x1033c
movq %rsi, %rbx
cmpl $0x1, 0x28(%rsi)
je 0x1033c
leaq 0x19bec(%rip), %rcx     # 0x29df5
cmpb $0x1, (%rcx)
jne 0x1033c
movq %rdi, %r14
movl 0xc(%rax), %ebp
testl %ebp, %ebp
jne 0x10224
movq %r15, %rdi
callq 0x1007e
leaq 0x19bcc(%rip), %rax     # 0x29df7
cmpb $0x1, (%rax)
jne 0x1023a
cmpl $0x1, 0x24(%rbx)
jne 0x1023a
xorl %ecx, %ecx
jmp 0x1023e
movzwl 0x60(%rbx), %ecx
movq 0x10(%r15), %r12
movl 0x1c(%r15), %edx
movzwl 0x1e(%r15), %eax
subl %ecx, %edx
subl %ecx, %eax
movl 0x8(%r12), %ecx
cmpq $0x3, %rcx
ja 0x102e0
leaq 0xf953(%rip), %rsi      # 0x1fbb8
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
mulsd (%r12), %xmm0
cvttsd2si %xmm0, %eax
jmp 0x102e0
movsd 0xf38f(%rip), %xmm0     # 0x1f618
subsd (%r12), %xmm0
movzwl %ax, %ecx
cvtsi2sd %ecx, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %esi
subl %esi, %eax
movl %eax, %edi
xorl %ecx, %ecx
movl %esi, %eax
jmp 0x102e4
movsd 0xf368(%rip), %xmm0     # 0x1f618
subsd (%r12), %xmm0
movzwl %dx, %ecx
cvtsi2sd %ecx, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %esi
subl %esi, %edx
movl %edx, %ecx
xorl %edi, %edi
movl %esi, %edx
jmp 0x102e4
movzwl %dx, %ecx
cvtsi2sd %ecx, %xmm0
mulsd (%r12), %xmm0
cvttsd2si %xmm0, %edx
xorl %edi, %edi
xorl %ecx, %ecx
addw 0x18(%r15), %cx
addw 0x1a(%r15), %di
movl 0xc(%r12), %esi
movswl %cx, %r8d
movq %rsp, %rcx
movl %r8d, (%rcx)
movswl %di, %edi
movl %edi, 0x4(%rcx)
movzwl %dx, %edx
movl %edx, 0x8(%rcx)
movzwl %ax, %eax
movl %eax, 0xc(%rcx)
leaq 0x193b2(%rip), %rax     # 0x296c8
movq (%rax), %rdi
movl $0xf, %edx
callq 0x4310
testl %ebp, %ebp
jne 0x1033c
cmpq %rbx, 0x58(%r14)
jne 0x1033c
movl 0xc(%r12), %edi
movl $0x1, %esi
callq 0x1138c
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq