//
// sub_CD511C from 0xcd511c to 0xcd5254 (312 bytes)
//
// 1 xrefs:
// > sub_D1E7A0 @ 0xd1e978
//
// 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_CD511C(__int64 a1)
{
_QWORD *v2; // x0
int *v3; // x1
int v4; // w2
char v6; // [xsp+38h] [xbp+38h] BYREF
*(_QWORD *)(a1 + 8) = 0;
sub_CD43C0(&v6, (unsigned int **)a1, 1u);
if ( !v6 )
return a1;
v2 = *(_QWORD **)(a1 + *(_QWORD *)(*(_QWORD *)a1 - 24LL) + 232);
v3 = (int *)v2[2];
if ( (unsigned __int64)v3 >= v2[3] )
{
v4 = (*(__int64 (__fastcall **)(_QWORD *))(*v2 + 80LL))(v2);
}
else
{
v4 = *v3;
v2[2] = v3 + 1;
}
if ( v4 != -1 )
{
*(_QWORD *)(a1 + 8) = 1;
return a1;
}
sub_CCF1DC(a1 + *(_QWORD *)(*(_QWORD *)a1 - 24LL), *(_DWORD *)(a1 + *(_QWORD *)(*(_QWORD *)a1 - 24LL) + 32) | 2);
return a1;
}