//
// sub_BAFB78 from 0xbafb78 to 0xbafc04 (140 bytes)
//
// 2 xrefs:
// > sub_B87DB4 @ 0xb89e1c
// > sub_B9905C @ 0xb990a0
//
// 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_BAFB78(__int64 *result, __int64 a2, __int64 (__fastcall *a3)(__int64, __int64))
{
__int64 *v5; // x22
__int64 v6; // x19
__int64 *v7; // x19
__int64 v8; // x0
__int64 v9[3]; // [xsp+48h] [xbp+48h] BYREF
if ( result )
{
sub_B99E04((__int64)result, (__int64)v9);
result = (__int64 *)sub_B99E14(v9);
v5 = result;
LABEL_3:
while ( v5 )
{
v6 = *v5;
v5 = (__int64 *)sub_B99E14(v9);
result = *(__int64 **)(v6 + 16);
v7 = (__int64 *)*result;
if ( *result )
{
while ( 1 )
{
v8 = *v7;
v7 = (__int64 *)v7[2];
result = (__int64 *)a3(v8, a2);
if ( (_DWORD)result == 1 )
return result;
if ( !v7 )
goto LABEL_3;
}
}
}
}
return result;
}