//
// EmoteSprite::charIndexForByte from 0x6df0a8 to 0x6df160 (184 bytes)
//
// 5 xrefs:
// > MultilineBitmapFont::initWithFont @ 0x6ac5d8
// > MultilineBitmapFont::initWithFont @ 0x6ac5e8
// > MultilineBitmapFont::initWithFont @ 0x6ac6ec
// > EmoteSprite::attachToLabel @ 0x6e17e8
// > ??> @ 0x1011e8
//
// 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 12:51:36 +0000
//
__int64 __fastcall EmoteSprite::charIndexForByte(unsigned __int8 *a1, int a2)
{
int v2; // w7
__int64 v3; // x2
int v4; // w5
int v5; // w5
__int64 v6; // x2
int v7; // w4
unsigned __int8 *v8; // x3
unsigned __int8 v9; // w3
int v10; // w2
v2 = *a1;
if ( (v2 & 1) != 0 )
{
v3 = *((_QWORD *)a1 + 1);
v4 = v3;
if ( a2 < (int)v3 )
{
v5 = a2;
v7 = 0;
if ( a2 < 0 )
return v7 - (unsigned int)(a2 < (int)v3);
goto LABEL_4;
}
}
else
{
v10 = v2 >> 1;
v4 = v2 >> 1;
if ( a2 < v2 >> 1 )
{
v5 = a2;
v7 = 0;
if ( a2 < 0 )
return v7 - (unsigned int)(a2 < v10);
goto LABEL_4;
}
}
v5 = v4 - 1;
if ( v5 < 0 )
{
v7 = 0;
goto LABEL_10;
}
LABEL_4:
v6 = 0;
v7 = 0;
do
{
v8 = a1 + 1;
if ( (v2 & 1) != 0 )
v8 = *((unsigned __int8 **)a1 + 2);
v9 = v8[v6++];
if ( (v9 & 0xC0) != 0x80 )
++v7;
}
while ( v5 >= (int)v6 );
LABEL_10:
v10 = v2 >> 1;
if ( (v2 & 1) != 0 )
{
v3 = *((_QWORD *)a1 + 1);
return v7 - (unsigned int)(a2 < (int)v3);
}
return v7 - (unsigned int)(a2 < v10);
}