//
// sub_1800E3110 from 0x1800e3110 to 0x1800e343f (815 bytes)
//
// 3 xrefs:
// > sub_1800DA0D0 @ 0x1800da190
// > sub_1800E1D90 @ 0x1800e221d
// > ??> @ 0x1801c52f8
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:22:37 +0000
//
void sub_1800E3110()
{
__int64 v0; // r12
__int64 v1; // rsi
char *v2; // r14
DWORD v3; // r13d
BOOL v4; // r15d
DWORD v5; // ebp
char *v6; // r8
int v7; // ebx
__int64 v8; // r9
__int64 v9; // r10
__int64 v10; // rax
char *v11; // rax
int v12; // ecx
int v13; // edx
void **v14; // rax
int v15; // r10d
__int64 v16; // r9
__int64 v17; // rax
char *v18; // rax
int v19; // ecx
int v20; // edx
void **v21; // rax
void **v22; // rcx
struct _DISPLAY_DEVICEW DisplayDevice; // [rsp+20h] [rbp-6D8h] BYREF
struct _DISPLAY_DEVICEW v24; // [rsp+370h] [rbp-388h] BYREF
v0 = dword_1801B3FF0;
v1 = 0;
v2 = nullptr;
if ( dword_1801B3FF0 )
{
v2 = (char *)calloc(dword_1801B3FF0, 8u);
memcpy(v2, qword_1801B3FE8, 8LL * dword_1801B3FF0);
}
v3 = 0;
memset(DisplayDevice.DeviceName, 0, 0x344u);
DisplayDevice.cb = 840;
if ( EnumDisplayDevicesW(nullptr, 0, &DisplayDevice, 0) )
{
do
{
if ( (DisplayDevice.StateFlags & 1) != 0 )
{
v4 = (DisplayDevice.StateFlags & 4) == 0;
v5 = 0;
memset(v24.DeviceName, 0, 0x344u);
v24.cb = 840;
if ( !EnumDisplayDevicesW(DisplayDevice.DeviceName, 0, &v24, 0) )
goto LABEL_21;
do
{
if ( (v24.StateFlags & 1) != 0 )
{
v7 = 0;
v8 = 0;
if ( (int)v0 > 0 )
{
while ( 1 )
{
v9 = 8 * v8;
v10 = *(_QWORD *)&v2[8 * v8];
if ( v10 )
{
v11 = (char *)(v10 + 328);
v6 = (char *)((char *)v24.DeviceName - v11);
do
{
v12 = *(unsigned __int16 *)&v6[(_QWORD)v11];
v13 = *(unsigned __int16 *)v11 - v12;
if ( v13 )
break;
v11 += 2;
}
while ( v12 );
if ( !v13 )
break;
}
++v7;
if ( ++v8 >= v0 )
goto LABEL_16;
}
*(_QWORD *)&v2[v9] = 0;
EnumDisplayMonitors(nullptr, nullptr, fnEnum, *(_QWORD *)((char *)qword_1801B3FE8 + v9));
}
LABEL_16:
if ( v7 >= (int)v0 )
{
v14 = (void **)sub_1800E3630(&DisplayDevice, &v24, v6, v8);
if ( !v14 )
goto LABEL_38;
sub_1800DBBB0(v14, 0x40001u, v4);
v4 = 1;
}
}
++v5;
memset(v24.DeviceName, 0, 0x344u);
v24.cb = 840;
}
while ( EnumDisplayDevicesW(DisplayDevice.DeviceName, v5, &v24, 0) );
if ( !v5 )
{
LABEL_21:
v15 = 0;
v16 = 0;
if ( (int)v0 > 0 )
{
while ( 1 )
{
v17 = *(_QWORD *)&v2[8 * v16];
if ( v17 )
{
v18 = (char *)(v17 + 264);
v6 = (char *)((char *)DisplayDevice.DeviceName - v18);
do
{
v19 = *(unsigned __int16 *)&v6[(_QWORD)v18];
v20 = *(unsigned __int16 *)v18 - v19;
if ( v20 )
break;
v18 += 2;
}
while ( v19 );
if ( !v20 )
break;
}
++v15;
if ( ++v16 >= v0 )
goto LABEL_30;
}
*(_QWORD *)&v2[8 * v16] = 0;
}
LABEL_30:
if ( v15 >= (int)v0 )
{
v21 = (void **)sub_1800E3630(&DisplayDevice, 0, v6, v16);
if ( !v21 )
goto LABEL_38;
sub_1800DBBB0(v21, 0x40001u, v4);
}
}
}
++v3;
memset(DisplayDevice.DeviceName, 0, 0x344u);
DisplayDevice.cb = 840;
}
while ( EnumDisplayDevicesW(nullptr, v3, &DisplayDevice, 0) );
}
if ( (int)v0 > 0 )
{
do
{
v22 = *(void ***)&v2[8 * v1];
if ( v22 )
sub_1800DBBB0(v22, 0x40002u, 0);
++v1;
}
while ( v1 < v0 );
}
LABEL_38:
free(v2);
}