// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/system/backends/xlib/screenxlib.cpp
// Function: smooth::MonitorRectFromPoint(X11::_XDisplay*, smooth::GUI::Point const&)
GUI::Rect MonitorRectFromPoint(Display *display, const GUI::Point &point)
	{
		if (XRRGetMonitors == NIL) return GUI::Rect();

		GUI::Rect	 metrics;

		int		 monitorCount = 0;
		XRRMonitorInfo	*monitors     = XRRGetMonitors(display, DefaultRootWindow(display), True, &monitorCount);

		for (Int i = 0; i < monitorCount; i++)
		{
			if (point.x >= monitors[i].x			 &&
			    point.x <  monitors[i].x + monitors[i].width &&
			    point.y >= monitors[i].y			 &&
			    point.y <  monitors[i].y + monitors[i].height) metrics = GUI::Rect(GUI::Point(monitors[i].x, monitors[i].y), GUI::Size(monitors[i].width, monitors[i].height));
		}

		XRRFreeMonitors(monitors);

		return metrics;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
cmpq $0x0, 0xeb6e0(%rip)     # 0x214bf8
jne 0x129528
leaq -0x10(%rbp), %rdi
callq 0x5c030
jmp 0x1296bc
leaq -0x10(%rbp), %rdi
callq 0x5c030
movl $0x0, -0x24(%rbp)
movq 0xeb6b9(%rip), %rax     # 0x214bf8
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0xe8(%rcx), %rcx
movq -0x18(%rbp), %rdx
movslq 0xe0(%rdx), %rdx
shlq $0x7, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rsi
movl $0x1, %edx
leaq -0x24(%rbp), %rcx
callq *%rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x1296af
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x14(%rcx), %eax
jl 0x12969f
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
movl 0x14(%rcx), %ecx
movq -0x30(%rbp), %rdx
movslq -0x34(%rbp), %rsi
imulq $0x38, %rsi, %rsi
addq %rsi, %rdx
addl 0x1c(%rdx), %ecx
cmpl %ecx, %eax
jge 0x12969f
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x30(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x18(%rcx), %eax
jl 0x12969f
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x30(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
movq -0x30(%rbp), %rdx
movslq -0x34(%rbp), %rsi
imulq $0x38, %rsi, %rsi
addq %rsi, %rdx
addl 0x20(%rdx), %ecx
cmpl %ecx, %eax
jge 0x12969f
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %esi
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
leaq -0x4c(%rbp), %rdi
callq 0x5c2c0
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %esi
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %edx
leaq -0x54(%rbp), %rdi
callq 0x59260
leaq -0x44(%rbp), %rdi
leaq -0x4c(%rbp), %rsi
leaq -0x54(%rbp), %rdx
callq 0x59ff0
movq -0x44(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x3c(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1296a1
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x12957a
movq 0xeb54a(%rip), %rax     # 0x214c00
movq -0x30(%rbp), %rdi
callq *%rax
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)