//
// sub_10051EA8C from 0x10051ea8c to 0x10051eb5c (208 bytes)
//
// 2 xrefs:
// > sub_10051CF68 @ 0x10051d85c
// > sub_100537D24 @ 0x100538588
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_10051EA8C(__int64 a1)
{
__int64 v2; // x8
__int64 v3; // x9
__int64 v5; // x4
if ( *(_DWORD *)(a1 + 72) != 8512 )
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 200LL) + 128LL))(a1);
v2 = sub_10054026C(a1);
if ( v2
|| (v3 = *(_QWORD *)(*(_QWORD *)(a1 + 128) + 936LL), *(_QWORD *)(v3 + 32) == 32)
&& (*(_BYTE *)(v3 + 24) & 0x10) == 0 )
{
if ( sub_10052C7C0(a1, v2) )
{
*(_DWORD *)(a1 + 72) = 8513;
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 200LL) + 128LL))(a1);
}
v5 = 3334;
}
else
{
v5 = 3327;
}
sub_1005E0E48(20, 154, 68, "s3_srvr.c", v5);
*(_DWORD *)(a1 + 72) = 5;
return 0;
}