//
// sub_CB21AC from 0xcb21ac to 0xcb227c (208 bytes)
//
// 1 xrefs:
// > sub_CA1168 @ 0xca161c
//
// 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_CB21AC(__int64 a1, __int64 a2, __int64 a3, int a4)
{
_QWORD *v4; // x24
_QWORD *v9; // x25
int v10; // w22
int v11; // w19
char *i; // x20
unsigned int v13; // w3
__int64 v14; // x1
__int64 v15; // x2
__int64 v16; // x0
v4 = *(_QWORD **)a1;
if ( *(_QWORD *)a1 )
{
do
{
v9 = (_QWORD *)*v4;
v10 = 0;
if ( !*v4 )
v10 = *(_DWORD *)(a1 + 24);
v11 = *(_DWORD *)(a1 + 28);
for ( i = (char *)v4 + 2 * v11; ; i -= 2 )
{
v16 = a2;
if ( v10 >= v11 )
break;
v13 = *((unsigned __int16 *)i + 3);
v14 = v13 >> 15;
v15 = (unsigned __int8)v13;
if ( (v13 & 0x4000) == 0 )
{
v15 = *(unsigned __int8 *)(a3 + (v13 & 0x3FFF));
v16 = a2;
v14 = v13 >> 15;
}
--v11;
sub_CB67B0(v16, v14, v15);
}
if ( a4 )
WebPSafeFree(v4);
v4 = v9;
}
while ( v9 );
}
if ( a4 )
*(_QWORD *)a1 = 0;
return 1;
}