//
// sub_CD5650 from 0xcd5650 to 0xcd57bc (364 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_CD5650(__int64 a1, unsigned int a2)
{
unsigned int *v3; // x0
_QWORD *v5; // x0
unsigned __int64 v6; // x1
__int64 v8; // x0
char v9; // [xsp+38h] [xbp+38h] BYREF
v3 = *(unsigned int **)a1;
*(_QWORD *)(a1 + 8) = 0;
sub_CCF1DC(a1 + *((_QWORD *)v3 - 3), *(_DWORD *)(a1 + *((_QWORD *)v3 - 3) + 32) & 0xFFFFFFFD);
sub_CD43C0(&v9, (unsigned int **)a1, 1u);
if ( !v9 )
return a1;
v5 = *(_QWORD **)(a1 + *(_QWORD *)(*(_QWORD *)a1 - 24LL) + 232);
if ( !v5 )
{
v8 = a1 + *(_QWORD *)(*(_QWORD *)a1 - 24LL);
goto LABEL_9;
}
v6 = v5[2];
if ( v5[1] < v6 && a2 == *(_DWORD *)(v6 - 4) )
{
v5[2] = v6 - 4;
if ( a2 == -1 )
goto LABEL_8;
return a1;
}
if ( (*(unsigned int (__fastcall **)(_QWORD *, _QWORD))(*v5 + 88LL))(v5, a2) != -1 )
return a1;
LABEL_8:
v8 = a1 + *(_QWORD *)(*(_QWORD *)a1 - 24LL);
LABEL_9:
sub_CCF1DC(v8, *(_DWORD *)(v8 + 32) | 1);
return a1;
}