//
// sub_CD9EA from 0xcd9ea to 0xcda3c (82 bytes)
//
// 4 xrefs:
// > ??> @ 0xcda3e
// > sub_CDF86 @ 0xce0d8
// > sub_CE994 @ 0xce9f0
// > sub_CF4E6 @ 0xcf55a
//
// 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
//
int __fastcall sub_CD9EA(int a1, int *a2)
{
int v2; // r5
int v4; // r0
unsigned int v5; // r1
int v6; // r0
_DWORD v7[5]; // [sp+4h] [bp-1Ch] BYREF
v2 = *(_DWORD *)(a1 + 28);
sub_C90DC(v7, *a2, a2[1]);
if ( sub_C91BC(v7, 1u) )
return -135;
v4 = *(_DWORD *)(v2 + 8);
v5 = 0;
while ( v4 >= 2 )
{
v4 = (unsigned int)v4 >> 1;
++v5;
}
v6 = sub_C91BC(v7, v5);
if ( v6 == -1 )
return -136;
else
return *(_DWORD *)(v2 + 4 * **(_DWORD **)(v2 + 4 * v6 + 28));
}