//
// EmoteSprite::charIndexForByte from 0x1004dcc2c to 0x1004dccac (128 bytes)
//
// 4 xrefs:
// > sub_1002D0568 @ 0x1002d0af0
// > sub_1002D0568 @ 0x1002d0c6c
// > sub_1002D0568 @ 0x1002d0c7c
// > EmoteSprite::attachToLabel @ 0x1004dd0b8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:06:35 +0000
//
__int64 __fastcall EmoteSprite::charIndexForByte(__int64 a1, int a2)
{
int v2; // w8
int v3; // w10
int v4; // w11
int v5; // w10
char *v6; // x12
__int64 v7; // x11
char v8; // t1
int v9; // w8
v2 = *(char *)(a1 + 23);
if ( (v2 & 0x80000000) == 0 )
{
v3 = *(char *)(a1 + 23);
v4 = a2;
if ( v2 > a2 )
goto LABEL_4;
goto LABEL_3;
}
v3 = *(_DWORD *)(a1 + 8);
v4 = a2;
if ( v3 <= a2 )
LABEL_3:
v4 = v3 - 1;
LABEL_4:
v5 = 0;
if ( (v4 & 0x80000000) == 0 )
{
v6 = *(char **)a1;
v7 = (unsigned int)(v4 + 1);
if ( *(char *)(a1 + 23) >= 0 )
v6 = (char *)a1;
do
{
v8 = *v6++;
if ( (v8 & 0xC0) != 0x80 )
++v5;
--v7;
}
while ( v7 );
}
if ( v2 >= 0 )
v9 = *(char *)(a1 + 23);
else
v9 = *(_DWORD *)(a1 + 8);
return v5 - (unsigned int)(v9 > a2);
}