//
// sub_D2216C from 0xd2216c to 0xd221e8 (124 bytes)
//
// 4 xrefs:
// > sub_D221E8 @ 0xd2225c
// > sub_D2A218 @ 0xd2b418
// > sub_D2A218 @ 0xd2c670
// > sub_D2A218 @ 0xd2c814
//
// 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_D2216C(__int64 a1, __int64 *a2)
{
__int64 v2; // x2
__int64 v3; // x0
__int64 v4; // x2
__int64 v5; // x1
int v6; // w0
v2 = *(_QWORD *)(a1 + 288);
if ( !v2 )
{
*(_DWORD *)(a1 + 304) = 1;
return 0;
}
v3 = *(_QWORD *)(v2 + 8);
v4 = *a2;
v5 = *(_QWORD *)(v3 + 16);
v6 = v4;
if ( !v5 || *(_DWORD *)v5 != 47 )
return 0;
if ( (int)v4 > 0 )
{
while ( 1 )
{
v5 = *(_QWORD *)(v5 + 16);
--v6;
if ( !v5 || *(_DWORD *)v5 != 47 )
break;
if ( !v6 )
return *(_QWORD *)(v5 + 8);
}
return 0;
}
if ( (_DWORD)v4 )
return 0;
return *(_QWORD *)(v5 + 8);
}