//
// sub_98886 from 0x98886 to 0x98920 (154 bytes)
//
// 6 xrefs:
// > sub_47DCC @ 0x47ebc
// > sub_61B58 @ 0x61e42
// > sub_67448 @ 0x67570
// > sub_8E2C4 @ 0x8e414
// > sub_8E2C4 @ 0x8e484
// > sub_8E2C4 @ 0x8e544
//
// 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_98886(__int16 *a1, char *a2, int a3, int a4, int a5)
{
int v5; // r4
char *v6; // lr
bool v7; // zf
int v8; // r8
int v9; // r9
int i; // r11
int v11; // r4
int v12; // r6
char *v13; // r5
bool v14; // cc
int v16; // [sp+0h] [bp-20h]
v5 = a5;
if ( !a5 )
v5 = a4;
v6 = *((char **)a1 + 1);
if ( !v6 )
return 30;
if ( !a2 )
return 31;
v16 = a1[1];
if ( v5 != a4 )
goto LABEL_9;
v7 = v16 == a3;
if ( v16 == a3 )
v7 = *a1 == a4;
if ( v7 )
{
qmemcpy(v6, a2, 4 * a3 * a4);
}
else
{
LABEL_9:
v8 = 4 * v5;
v9 = 0;
for ( i = 0; i < v16; ++i )
{
v11 = *a1;
v12 = 0;
v13 = &v6[v9 * v11];
while ( v12 < v11 )
{
v14 = i < a3;
if ( i < a3 )
v14 = v12 < a4;
if ( v14 )
*(_DWORD *)&v13[4 * v12] = *(_DWORD *)&a2[4 * v12];
else
*(_DWORD *)&v13[4 * v12] = 0;
++v12;
}
a2 += v8;
v9 += 4;
}
}
return 0;
}