// File: /workspace/github_c_makefile_star2_O2/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 0xc5b9(%rip), %r14      # 0x28e30
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 0x1ca60
movl 0x38(%rsp), %eax
movl 0x3c(%rsp), %ecx
movl %eax, 0xc(%rsp)
movswl %ax, %edx
movswl 0x4c(%rsp), %eax
movl %eax, 0x1c(%rsp)
movswl 0x48(%rsp), %eax
movl %eax, 0x10(%rsp)
leaq 0xbeba(%rip), %rax      # 0x2877c
movl (%rax), %eax
movl %eax, 0x18(%rsp)
movl %ecx, 0x20(%rsp)
subl %ecx, %eax
movswl %ax, %r9d
movswl 0x54(%rsp), %eax
movl %eax, 0x34(%rsp)
movswl 0x50(%rsp), %eax
movl %eax, 0x28(%rsp)
movl 0x40(%rsp), %eax
movl %eax, 0x14(%rsp)
movswl %ax, %r14d
movswl 0x5c(%rsp), %eax
movl %eax, 0x2c(%rsp)
leaq 0xbe80(%rip), %rax      # 0x28780
movl (%rax), %r12d
movl 0x44(%rsp), %ecx
movl %r12d, %eax
movl %ecx, 0x30(%rsp)
subl %ecx, %eax
cwtl
movswl 0x58(%rsp), %ecx
movl %ecx, 0x24(%rsp)
movswl 0x64(%rsp), %esi
movswl 0x60(%rsp), %ecx
leaq 0xbddd(%rip), %r8       # 0x28708
xorl %ebx, %ebx
movq (%r8), %r8
testq %r8, %r8
je 0x1ca60
movswl 0x4c(%r8), %edi
movswl 0x4e(%r8), %r15d
movzwl 0x50(%r8), %r11d
movzwl 0x52(%r8), %ebp
cmpl %edi, %edx
jle 0x1c994
leal (%rdi,%r11), %r10d
decl %r10d
cmpl %r10d, %edx
jge 0x1c994
cmpl %r15d, 0x1c(%rsp)
jl 0x1c994
leal (%r15,%rbp), %r10d
cmpl %r10d, 0x10(%rsp)
jge 0x1c994
movl 0xc(%rsp), %r10d
subl %edi, %r10d
movl 0x3c(%r8), %ebx
cmpl %ebx, %r10d
movl %ebx, %r13d
cmovgl %r10d, %r13d
addl %ebx, %r10d
testl %ebx, %ebx
cmovnsl %r13d, %r10d
movl %r10d, 0x3c(%r8)
movb $0x1, %bl
addl %edi, %r11d
cmpl %r9d, %r11d
jle 0x1c9dd
cmpl %edi, %r9d
jle 0x1c9dd
cmpl %r15d, 0x34(%rsp)
jl 0x1c9dd
leal (%r15,%rbp), %r10d
cmpl %r10d, 0x28(%rsp)
jge 0x1c9dd
movl %r11d, %r10d
subl 0x18(%rsp), %r10d
addl 0x20(%rsp), %r10d
movl 0x34(%r8), %ebx
cmpl %ebx, %r10d
movl %ebx, %r13d
cmovgl %r10d, %r13d
addl %ebx, %r10d
testl %ebx, %ebx
cmovnsl %r13d, %r10d
movl %r10d, 0x34(%r8)
movb $0x1, %bl
cmpl %r15d, %r14d
jle 0x1ca20
leal (%r15,%rbp), %r10d
decl %r10d
cmpl %r10d, %r14d
jge 0x1ca20
cmpl %edi, 0x2c(%rsp)
jl 0x1ca20
cmpl %r11d, 0x24(%rsp)
jge 0x1ca20
movl 0x14(%rsp), %r10d
subl %r15d, %r10d
movl 0x30(%r8), %ebx
cmpl %ebx, %r10d
movl %ebx, %r13d
cmovgl %r10d, %r13d
addl %ebx, %r10d
testl %ebx, %ebx
cmovnsl %r13d, %r10d
movl %r10d, 0x30(%r8)
movb $0x1, %bl
addl %r15d, %ebp
cmpl %eax, %ebp
jle 0x1ca57
cmpl %r15d, %eax
jle 0x1ca57
cmpl %edi, %esi
jl 0x1ca57
cmpl %r11d, %ecx
jge 0x1ca57
subl %r12d, %ebp
addl 0x30(%rsp), %ebp
movl 0x38(%r8), %edi
cmpl %edi, %ebp
movl %edi, %r10d
cmovgl %ebp, %r10d
addl %edi, %ebp
testl %edi, %edi
cmovnsl %r10d, %ebp
movl %ebp, 0x38(%r8)
movb $0x1, %bl
addq $0x78, %r8
jmp 0x1c92d
andb $0x1, %bl
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq