// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/system/backends/xlib/screenxlib.cpp
// Function: smooth::System::ScreenXLib::GetVirtualScreenMetrics()
S::GUI::Rect S::System::ScreenXLib::GetVirtualScreenMetrics()
{
	if (display == NIL) return GUI::Rect();

	if (XRRGetMonitors != NIL)
	{
		GUI::Rect	 metrics;

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

		for (Int i = 0; i < monitorCount; i++)
		{
			metrics.left   = Math::Min(metrics.left, monitors[i].x);
			metrics.top    = Math::Min(metrics.top, monitors[i].y);
			metrics.right  = Math::Max(metrics.right, monitors[i].x + monitors[i].width);
			metrics.bottom = Math::Max(metrics.bottom, monitors[i].y + monitors[i].height);
		}

		XRRFreeMonitors(monitors);

		if (monitorCount > 0) return metrics;
	}

	return GUI::Rect(GUI::Point(0, 0), GUI::Size(XWidthOfScreen(XDefaultScreenOfDisplay(display)), XHeightOfScreen(XDefaultScreenOfDisplay(display))));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, 0x10(%rax)
jne 0x129999
leaq -0x10(%rbp), %rdi
callq 0x5c030
jmp 0x129b21
cmpq $0x0, 0xeb257(%rip)     # 0x214bf8
je 0x129ac6
leaq -0x10(%rbp), %rdi
callq 0x5c030
movq -0x48(%rbp), %rdx
movl $0x0, -0x1c(%rbp)
movq 0xeb236(%rip), %rax     # 0x214bf8
movq 0x10(%rdx), %rdi
movq 0x10(%rdx), %rcx
movq 0xe8(%rcx), %rcx
movq 0x10(%rdx), %rdx
movslq 0xe0(%rdx), %rdx
shlq $0x7, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rsi
movl $0x1, %edx
leaq -0x1c(%rbp), %rcx
callq *%rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x129aaf
movl -0x10(%rbp), %edi
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %esi
callq 0x5ce90
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %edi
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %esi
callq 0x5ce90
movl %eax, -0xc(%rbp)
movl -0x8(%rbp), %edi
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %esi
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
addl 0x1c(%rax), %esi
callq 0x5aae0
movl %eax, -0x8(%rbp)
movl -0x4(%rbp), %edi
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %esi
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
addl 0x20(%rax), %esi
callq 0x5aae0
movl %eax, -0x4(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1299fd
movq 0xeb14a(%rip), %rax     # 0x214c00
movq -0x28(%rbp), %rdi
callq *%rax
cmpl $0x0, -0x1c(%rbp)
jle 0x129ac4
jmp 0x129b21
jmp 0x129ac6
leaq -0x34(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x5c2c0
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5b660
movq %rax, %rdi
callq 0x5a6e0
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, -0x4c(%rbp)
movq 0x10(%rax), %rdi
callq 0x5b660
movq %rax, %rdi
callq 0x5cda0
movl -0x4c(%rbp), %esi
movl %eax, %edx
leaq -0x3c(%rbp), %rdi
callq 0x59260
leaq -0x10(%rbp), %rdi
leaq -0x34(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
callq 0x59ff0
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x50, %rsp
popq %rbp
retq
nop