//
// sub_CD1BE8 from 0xcd1be8 to 0xcd1d38 (336 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
//
unsigned __int64 *__fastcall sub_CD1BE8(unsigned __int64 *a1, _BYTE *a2)
{
_QWORD *v4; // x0
char *v5; // x1
char v6; // w2
char *v7; // x1
int v9; // w0
char v10; // [xsp+38h] [xbp+38h] BYREF
a1[1] = 0;
sub_CD14C0(&v10, a1, 1);
if ( v10 )
{
v4 = *(_QWORD **)((char *)a1 + *(_QWORD *)(*a1 - 24) + 232);
v5 = (char *)v4[2];
if ( (unsigned __int64)v5 >= v4[3] )
{
v9 = (*(__int64 (__fastcall **)(_QWORD *))(*v4 + 80LL))(v4);
v6 = v9;
if ( v9 == -1 )
{
if ( a1[1] )
LODWORD(v7) = 2;
else
v7 = byte_6;
goto LABEL_7;
}
}
else
{
v6 = *v5;
v4[2] = v5 + 1;
}
a1[1] = 1;
*a2 = v6;
}
if ( !a1[1] )
{
LODWORD(v7) = 4;
LABEL_7:
sub_CCE830(
(__int64)a1 + *(_QWORD *)(*a1 - 24),
(unsigned int)v7 | *(_DWORD *)((char *)a1 + *(_QWORD *)(*a1 - 24) + 32));
}
return a1;
}