//
// sub_AFE50 from 0xafe50 to 0xafed8 (136 bytes)
//
// 2 xrefs:
// > sub_5AD18 @ 0x5aea0
// > sub_5AF44 @ 0x5b078
//
// 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_AFE50(__int64 a1)
{
__int16 v1; // w8
__int64 result; // x0
__int64 v4; // x1
__int64 v5; // [xsp+8h] [xbp-8h] BYREF
v1 = atomic_load((unsigned int *)(a1 + 100));
if ( (v1 & 0x100) != 0 )
{
sub_B0F04();
return 0;
}
else
{
sub_B7B14(*(_QWORD *)(a1 + 544) + 152LL, *(_QWORD *)(a1 + 168));
*(_QWORD *)(*(_QWORD *)(a1 + 544) + 144LL) = 1065353216;
result = sub_77980(*(_QWORD *)(a1 + 168), &v5, 24, 1);
if ( !(_DWORD)result )
{
*(_BYTE *)v5 = 18;
v4 = v5;
*(_QWORD *)(v5 + 8) = a1;
return sub_77A28(*(_QWORD *)(a1 + 168), v4, 1);
}
}
return result;
}