//
// sub_6C5384 from 0x6c5384 to 0x6c5628 (676 bytes)
//
// 6 xrefs:
// > sub_6C5638 @ 0x6c56e0
// > sub_6C5874 @ 0x6c596c
// > sub_6C5874 @ 0x6c5a3c
// > sub_6C5874 @ 0x6c5c9c
// > sub_6C5874 @ 0x6c5d18
// > sub_6C5874 @ 0x6c5d98
//
// 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
//
int __fastcall sub_6C5384(int a1, int a2, int a3)
{
int v4; // r3
unsigned __int8 *v6; // [sp+Ch] [bp-18h]
int v7; // [sp+10h] [bp-14h]
int v8; // [sp+14h] [bp-10h]
int v9; // [sp+18h] [bp-Ch]
unsigned __int8 *i; // [sp+1Ch] [bp-8h]
v7 = a3 - a2;
v6 = (unsigned __int8 *)(a1 + (a2 >> 3));
if ( a3 - a2 > 0 && (v8 = a2 & 7, (a2 & 7) != 0) )
{
v9 = byte_9E3E24[(unsigned __int8)(*v6 << v8)];
if ( 8 - v8 < v9 )
v9 = 8 - v8;
if ( v9 > v7 )
v9 = a3 - a2;
if ( v8 + v9 <= 7 )
return v9;
v7 -= v9;
++v6;
}
else
{
v9 = 0;
}
if ( v7 <= 63 )
goto LABEL_25;
while ( ((unsigned __int8)v6 & 3) != 0 )
{
if ( *v6 != 255 )
return byte_9E3E24[*v6] + v9;
v9 += 8;
v7 -= 8;
++v6;
}
for ( i = v6; v7 > 31 && *(_DWORD *)i == -1; i += 4 )
{
v9 += 32;
v7 -= 32;
}
v6 = i;
LABEL_25:
while ( v7 > 7 )
{
if ( *v6 != 255 )
return byte_9E3E24[*v6] + v9;
v9 += 8;
v7 -= 8;
++v6;
}
if ( v7 > 0 )
{
v4 = v7;
if ( byte_9E3E24[*v6] < v7 )
v4 = byte_9E3E24[*v6];
v9 += v4;
}
return v9;
}