// File: /workspace/github_c_makefile_star2_O3/baskerville[P]bspwm/src/ewmh.c
// Function: ewmh_handle_struts
bool ewmh_handle_struts(xcb_window_t win)
{
	xcb_ewmh_wm_strut_partial_t struts;
	bool changed = false;
	if (xcb_ewmh_get_wm_strut_partial_reply(ewmh, xcb_ewmh_get_wm_strut_partial(ewmh, win), &struts, NULL) == 1) {
		for (monitor_t *m = mon_head; m != NULL; m = m->next) {
			xcb_rectangle_t rect = m->rectangle;
			if (rect.x < (int16_t) struts.left &&
			    (int16_t) struts.left < (rect.x + rect.width - 1) &&
			    (int16_t) struts.left_end_y >= rect.y &&
			    (int16_t) struts.left_start_y < (rect.y + rect.height)) {
				int dx = struts.left - rect.x;
				if (m->padding.left < 0) {
					m->padding.left += dx;
				} else {
					m->padding.left = MAX(dx, m->padding.left);
				}
				changed = true;
			}
			if ((rect.x + rect.width) > (int16_t) (screen_width - struts.right) &&
			    (int16_t) (screen_width - struts.right) > rect.x &&
			    (int16_t) struts.right_end_y >= rect.y &&
			    (int16_t) struts.right_start_y < (rect.y + rect.height)) {
				int dx = (rect.x + rect.width) - screen_width + struts.right;
				if (m->padding.right < 0) {
					m->padding.right += dx;
				} else {
					m->padding.right = MAX(dx, m->padding.right);
				}
				changed = true;
			}
			if (rect.y < (int16_t) struts.top &&
			    (int16_t) struts.top < (rect.y + rect.height - 1) &&
			    (int16_t) struts.top_end_x >= rect.x &&
			    (int16_t) struts.top_start_x < (rect.x + rect.width)) {
				int dy = struts.top - rect.y;
				if (m->padding.top < 0) {
					m->padding.top += dy;
				} else {
					m->padding.top = MAX(dy, m->padding.top);
				}
				changed = true;
			}
			if ((rect.y + rect.height) > (int16_t) (screen_height - struts.bottom) &&
			    (int16_t) (screen_height - struts.bottom) > rect.y &&
			    (int16_t) struts.bottom_end_x >= rect.x &&
			    (int16_t) struts.bottom_start_x < (rect.x + rect.width)) {
				int dy = (rect.y + rect.height) - screen_height + struts.bottom;
				if (m->padding.bottom < 0) {
					m->padding.bottom += dy;
				} else {
					m->padding.bottom = MAX(dy, m->padding.bottom);
				}
				changed = true;
			}
		}
	}
	return changed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edi, %esi
movq 0xbfa0(%rip), %r14      # 0x29e30
movq %r14, %rdi
callq 0x4490
xorl %ebx, %ebx
leaq 0x38(%rsp), %rdx
movq %r14, %rdi
movl %eax, %esi
xorl %ecx, %ecx
callq 0x4580
cmpb $0x1, %al
jne 0x1e077
leaq 0xb84e(%rip), %rax      # 0x29708
movq (%rax), %rax
testq %rax, %rax
je 0x1e075
movl 0x38(%rsp), %ecx
movl 0x3c(%rsp), %edx
movl %ecx, 0xc(%rsp)
movswl %cx, %esi
movswl 0x4c(%rsp), %ecx
movl %ecx, 0x1c(%rsp)
movswl 0x48(%rsp), %ecx
movl %ecx, 0x10(%rsp)
leaq 0xb88e(%rip), %rcx      # 0x2977c
movl (%rcx), %ecx
movl %ecx, 0x18(%rsp)
movl %edx, 0x20(%rsp)
subl %edx, %ecx
movswl %cx, %r10d
movswl 0x54(%rsp), %ecx
movl %ecx, 0x34(%rsp)
movswl 0x50(%rsp), %ecx
movl %ecx, 0x28(%rsp)
movl 0x40(%rsp), %ecx
movl %ecx, 0x14(%rsp)
movswl %cx, %r15d
movswl 0x5c(%rsp), %ecx
movl %ecx, 0x2c(%rsp)
leaq 0xb854(%rip), %rcx      # 0x29780
movl (%rcx), %r13d
movl 0x44(%rsp), %ecx
movl %r13d, %edx
movl %ecx, 0x30(%rsp)
subl %ecx, %edx
movswl %dx, %r8d
movswl 0x58(%rsp), %ecx
movl %ecx, 0x24(%rsp)
movswl 0x64(%rsp), %edx
movswl 0x60(%rsp), %r9d
xorl %ebx, %ebx
movswl 0x4c(%rax), %edi
movswl 0x4e(%rax), %r12d
movzwl 0x50(%rax), %ebp
movzwl 0x52(%rax), %r14d
cmpl %edi, %esi
jle 0x1dfad
leal (%rdi,%rbp), %r11d
decl %r11d
cmpl %r11d, %esi
jge 0x1dfad
cmpl %r12d, 0x1c(%rsp)
jl 0x1dfad
leal (%r14,%r12), %r11d
cmpl %r11d, 0x10(%rsp)
jge 0x1dfad
movl 0xc(%rsp), %r11d
subl %edi, %r11d
movl 0x3c(%rax), %ebx
cmpl %ebx, %r11d
movl %ebx, %ecx
cmovgl %r11d, %ecx
addl %ebx, %r11d
testl %ebx, %ebx
cmovnsl %ecx, %r11d
movl %r11d, 0x3c(%rax)
movb $0x1, %bl
addl %edi, %ebp
cmpl %r10d, %ebp
jle 0x1dfef
cmpl %edi, %r10d
jle 0x1dfef
cmpl %r12d, 0x34(%rsp)
jl 0x1dfef
leal (%r14,%r12), %ecx
cmpl %ecx, 0x28(%rsp)
jge 0x1dfef
movl %ebp, %ecx
subl 0x18(%rsp), %ecx
addl 0x20(%rsp), %ecx
movl 0x34(%rax), %r11d
cmpl %r11d, %ecx
movl %r11d, %ebx
cmovgl %ecx, %ebx
addl %r11d, %ecx
testl %r11d, %r11d
cmovnsl %ebx, %ecx
movl %ecx, 0x34(%rax)
movb $0x1, %bl
cmpl %r12d, %r15d
jle 0x1e02d
leal (%r12,%r14), %ecx
decl %ecx
cmpl %ecx, %r15d
jge 0x1e02d
cmpl %edi, 0x2c(%rsp)
jl 0x1e02d
cmpl %ebp, 0x24(%rsp)
jge 0x1e02d
movl 0x14(%rsp), %ecx
subl %r12d, %ecx
movl 0x30(%rax), %r11d
cmpl %r11d, %ecx
movl %r11d, %ebx
cmovgl %ecx, %ebx
addl %r11d, %ecx
testl %r11d, %r11d
cmovnsl %ebx, %ecx
movl %ecx, 0x30(%rax)
movb $0x1, %bl
addl %r12d, %r14d
cmpl %r8d, %r14d
jle 0x1e066
cmpl %r12d, %r8d
jle 0x1e066
cmpl %edi, %edx
jl 0x1e066
cmpl %ebp, %r9d
jge 0x1e066
subl %r13d, %r14d
addl 0x30(%rsp), %r14d
movl 0x38(%rax), %ecx
cmpl %ecx, %r14d
movl %ecx, %edi
cmovgl %r14d, %edi
addl %ecx, %r14d
testl %ecx, %ecx
cmovnsl %edi, %r14d
movl %r14d, 0x38(%rax)
movb $0x1, %bl
movq 0x78(%rax), %rax
testq %rax, %rax
jne 0x1df56
jmp 0x1e077
xorl %ebx, %ebx
andb $0x1, %bl
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq