// File: /workspace/github_c_makefile_star2_O3/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 0x103c3
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movq 0x10(%rdx), %rax
testq %rax, %rax
je 0x103b7
movq %rsi, %rbx
cmpl $0x1, 0x28(%rsi)
je 0x103b7
leaq 0x19b7a(%rip), %rcx     # 0x29df5
cmpb $0x1, (%rcx)
jne 0x103b7
movq %rdi, %r14
movl 0xc(%rax), %ebp
testl %ebp, %ebp
jne 0x10296
movq %r15, %rdi
callq 0x100f0
leaq 0x19b5a(%rip), %rax     # 0x29df7
cmpb $0x1, (%rax)
jne 0x102ac
cmpl $0x1, 0x24(%rbx)
jne 0x102ac
xorl %ecx, %ecx
jmp 0x102b0
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
pxor %xmm0, %xmm0
cmpq $0x3, %rcx
ja 0x1035e
leaq 0xf8d5(%rip), %rsi      # 0x1fbb0
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movzwl %ax, %eax
cvtsi2sd %eax, %xmm1
mulsd (%r12), %xmm1
cvttsd2si %xmm1, %eax
jmp 0x1035e
movsd 0xf309(%rip), %xmm0     # 0x1f608
subsd (%r12), %xmm0
movzwl %ax, %ecx
cvtsi2sd %ecx, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
subl %ecx, %eax
xorpd %xmm0, %xmm0
pinsrw $0x1, %eax, %xmm0
movl %ecx, %eax
jmp 0x1035e
movsd 0xf2dd(%rip), %xmm0     # 0x1f608
subsd (%r12), %xmm0
movzwl %dx, %ecx
cvtsi2sd %ecx, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
subl %ecx, %edx
movzwl %dx, %edx
movd %edx, %xmm0
movl %ecx, %edx
jmp 0x1035e
movzwl %dx, %ecx
cvtsi2sd %ecx, %xmm1
mulsd (%r12), %xmm1
cvttsd2si %xmm1, %edx
movl 0xc(%r12), %esi
movq 0x18(%r15), %xmm1
paddw %xmm0, %xmm1
pshuflw $0x60, %xmm1, %xmm0     # xmm0 = xmm1[0,0,2,1,4,5,6,7]
psrad $0x10, %xmm0
movq %rsp, %rcx
movq %xmm0, (%rcx)
movzwl %dx, %edx
movl %edx, 0x8(%rcx)
movzwl %ax, %eax
movl %eax, 0xc(%rcx)
leaq 0x19337(%rip), %rax     # 0x296c8
movq (%rax), %rdi
movl $0xf, %edx
callq 0x4310
testl %ebp, %ebp
jne 0x103b7
cmpq %rbx, 0x58(%r14)
jne 0x103b7
movl 0xc(%r12), %edi
movl $0x1, %esi
callq 0x11398
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq