//
// sub_7EBF8 from 0x7ebf8 to 0x7ecde (230 bytes)
//
// 2 xrefs:
// > sub_80E24 @ 0x80f78
// > sub_80E24 @ 0x80fd0
//
// 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_7EBF8(int a1, int *a2, int a3, int a4, _DWORD *a5)
{
__int64 v7; // kr00_8
char *v8; // r1
unsigned int v9; // r0
int v10; // r1
int v11; // r2
int i; // r8
int v13; // r6
int v14; // r10
int v15; // r11
int v17; // [sp+8h] [bp-28h]
int v18; // [sp+Ch] [bp-24h]
unsigned int v19; // [sp+10h] [bp-20h]
*a5 = 0;
v7 = *(_QWORD *)(a3 + 12);
v8 = (char *)&unk_108E24 + ((2 * v7) & 0xFFFFFFFD);
if ( !a4 )
v8 = (char *)&unk_108624 + 4 * v7;
v9 = *(_DWORD *)v8;
*(_DWORD *)(a3 + 76) = (*(_DWORD *)v8 >> 15) & 1;
v18 = 0;
if ( HIDWORD(v7) == 2 )
{
v10 = *(_DWORD *)(a3 + 20);
v11 = 2;
if ( !v10 )
v11 = 1;
v18 = v11;
}
v17 = (v9 >> 12) & 7;
for ( i = 0; i != 4; ++i )
{
v13 = v9 & 7;
v14 = byte_407EC[24 * v18 + 4 * v17 + i];
v19 = v9 >> 3;
v15 = v14;
if ( (v9 & 7) != 0 )
{
while ( v15 )
{
*a2++ = sub_7C512(a1, v13);
--v15;
}
*a5 += (__int16)v13 * (__int16)v14;
}
else
{
while ( v14 )
{
*a2++ = 0;
--v14;
}
}
v9 = v19;
}
memset(a2, 0, 4 * (2 * v18 + 1));
return 0;
}