//
// sub_BAFE58 from 0xbafe58 to 0xbafed0 (120 bytes)
//
// 1 xrefs:
// > sub_B9C364 @ 0xb9c7e4
//
// 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
//
void __fastcall sub_BAFE58(__int64 a1, __int64 a2)
{
_QWORD *v2; // x4
_QWORD *v3; // x2
_QWORD **v5; // x0
_QWORD *v6; // x0
v2 = *(_QWORD **)(a2 + 1144);
v3 = (_QWORD *)*v2;
if ( *v2 )
{
while ( *v3 != a1 )
{
v3 = (_QWORD *)v3[2];
if ( !v3 )
return;
}
sub_B99668(v2, (__int64)v3, *(_QWORD **)(a2 + 1152), *(_QWORD *)(*(_QWORD *)(a2 + 1152) + 8LL));
v5 = **(_QWORD ****)(a2 + 1144);
if ( v5 )
{
v6 = *v5;
*(_BYTE *)(a2 + 1137) = 0;
sub_B9B94C(v6, 0);
}
}
}