//
// sub_B87A58 from 0xb87a58 to 0xb87b2c (212 bytes)
//
// 1 xrefs:
// > sub_B9C364 @ 0xb9c98c
//
// 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_B87A58(__int64 a1, _BYTE *a2)
{
__int64 result; // x0
__int64 (__fastcall *v5)(__int64, _BYTE *); // x2
*a2 = 0;
if ( *(_BYTE *)(a1 + 965) )
{
if ( *(_BYTE *)(a1 + 967) )
{
result = *(_QWORD *)(*(_QWORD *)(a1 + 1024) + 48LL);
if ( !result )
{
*a2 = 1;
return result;
}
return 0;
}
}
else if ( *(_BYTE *)(a1 + 967) )
{
return 0;
}
result = sub_BACAE0(a1, 0);
if ( (_DWORD)result )
return result;
if ( *(_DWORD *)(a1 + 384) == 2 && !*(_BYTE *)(a1 + 985)
|| *(_BYTE *)(a1 + 969) && *(_BYTE *)(a1 + 958) && *(_DWORD *)(a1 + 1808) != 2 )
{
return 0;
}
v5 = *(__int64 (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)(a1 + 1024) + 40LL);
if ( !v5 )
{
*a2 = 1;
goto LABEL_13;
}
result = v5(a1, a2);
if ( !(_DWORD)result )
{
LABEL_13:
*(_BYTE *)(a1 + 967) = 1;
return 0;
}
return result;
}