//
// sub_CB227C from 0xcb227c to 0xcb2320 (164 bytes)
//
// 1 xrefs:
// > sub_CA1168 @ 0xca1978
//
// 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_CB227C(__int64 a1, __int64 a2)
{
_QWORD *v2; // x4
int v4; // w10
__int64 result; // x0
_QWORD *v6; // x9
int v7; // w6
int v8; // w5
char *v9; // x4
int v10; // w2
int v11; // w2
int v12; // w3
v2 = *(_QWORD **)a1;
if ( !*(_QWORD *)a1 )
return 0;
v4 = *(_DWORD *)(a1 + 28);
result = 0;
do
{
v6 = (_QWORD *)*v2;
v7 = 0;
if ( !*v2 )
v7 = *(_DWORD *)(a1 + 24);
v8 = v4;
v9 = (char *)v2 + 2 * v4;
while ( v7 < v8 )
{
LOWORD(v10) = *((_WORD *)v9 + 3);
v12 = v10 & 0x8000;
if ( (v10 & 0x4000) != 0 )
{
v10 = (unsigned __int8)v10;
if ( !v12 )
goto LABEL_7;
}
else
{
v10 = *(unsigned __int8 *)(a2 + (v10 & 0x3FFF));
if ( !v12 )
{
LABEL_7:
v11 = word_F52CC0[v10];
goto LABEL_8;
}
}
v11 = word_F52CC0[255 - v10];
LABEL_8:
--v8;
v9 -= 2;
result += v11;
}
v2 = v6;
}
while ( v6 );
return result;
}