//
// sub_78546C from 0x78546c to 0x7854f0 (132 bytes)
//
// 7 xrefs:
// > sub_78145C @ 0x782180
// > sub_782184 @ 0x782194
// > sub_783308 @ 0x78330e
// > sub_783BF2 @ 0x783c38
// > sub_784060 @ 0x784066
// > sub_7841FE @ 0x78420e
// > sub_7844AE @ 0x7844be
//
// 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_78546C(int result, int a2, _DWORD *a3)
{
int v3; // r4
int v4; // r3
int v5; // r7
char *v6; // r5
int v7; // r3
char *v8; // r7
int v9; // r1
char v10; // r6
v3 = result;
if ( *a3 != 49 )
return sub_78145C(result, a2, a3);
v4 = a3[1];
v5 = *(_DWORD *)(v4 + 8);
v6 = *(char **)(v4 + 4);
if ( v5 )
{
v7 = *(_DWORD *)(result + 256);
v8 = &v6[v5];
do
{
v10 = *v6;
if ( v7 == 255 )
{
*(_BYTE *)(v3 + 255) = 0;
result = (*(int (__fastcall **)(int, int, _DWORD))(v3 + 264))(v3, 255, *(_DWORD *)(v3 + 268));
v9 = 0;
++*(_DWORD *)(v3 + 288);
v7 = 1;
}
else
{
v9 = v7++;
}
*(_DWORD *)(v3 + 256) = v7;
++v6;
*(_BYTE *)(v3 + v9) = v10;
*(_BYTE *)(v3 + 260) = v10;
}
while ( v6 != v8 );
}
return result;
}