//
// sub_CD54BC from 0xcd54bc to 0xcd5650 (404 bytes)
//
// 0 xrefs:
//
// 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_CD54BC(__int64 a1, __int64 a2, __int64 a3)
{
_QWORD *v6; // x0
__int64 v7; // x2
__int64 v8; // x0
__int64 result; // x0
char v10; // [xsp+48h] [xbp+48h] BYREF
*(_QWORD *)(a1 + 8) = 0;
sub_CD43C0(&v10, (unsigned int **)a1, 1u);
if ( !v10 )
return *(_QWORD *)(a1 + 8);
v6 = *(_QWORD **)(a1 + *(_QWORD *)(*(_QWORD *)a1 - 24LL) + 232);
v7 = (__int64)(v6[3] - v6[2]) >> 2;
if ( !v7 )
{
v7 = (*(__int64 (__fastcall **)(_QWORD *))(*v6 + 56LL))(v6);
if ( v7 > 0 )
goto LABEL_4;
goto LABEL_7;
}
if ( v7 <= 0 )
{
LABEL_7:
if ( v7 == -1 )
{
sub_CCF1DC(a1 + *(_QWORD *)(*(_QWORD *)a1 - 24LL), *(_DWORD *)(a1 + *(_QWORD *)(*(_QWORD *)a1 - 24LL) + 32) | 2);
return *(_QWORD *)(a1 + 8);
}
return *(_QWORD *)(a1 + 8);
}
LABEL_4:
if ( v7 > a3 )
v7 = a3;
v8 = *(_QWORD *)(a1 + *(_QWORD *)(*(_QWORD *)a1 - 24LL) + 232);
result = (*(__int64 (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v8 + 64LL))(v8, a2, v7);
*(_QWORD *)(a1 + 8) = result;
return result;
}