//
// sub_8D4F44 from 0x8d4f44 to 0x8d51e8 (676 bytes)
//
// 6 xrefs:
// > sub_8D51F8 @ 0x8d52a0
// > sub_8D5434 @ 0x8d552c
// > sub_8D5434 @ 0x8d55fc
// > sub_8D5434 @ 0x8d585c
// > sub_8D5434 @ 0x8d58d8
// > sub_8D5434 @ 0x8d5958
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:04:06 +0000
//
int __fastcall sub_8D4F44(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_C263BC[(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_C263BC[*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_C263BC[*v6] + v9;
v9 += 8;
v7 -= 8;
++v6;
}
if ( v7 > 0 )
{
v4 = v7;
if ( byte_C263BC[*v6] < v7 )
v4 = byte_C263BC[*v6];
v9 += v4;
}
return v9;
}