//
// sub_98920 from 0x98920 to 0x98a1e (254 bytes)
//
// 2 xrefs:
// > sub_47ED8 @ 0x47eda
// > sub_8E5E8 @ 0x8e5ea
//
// 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 11:41:29 +0000
//
int __fastcall sub_98920(__int16 *a1, char *a2, __int64 a3, unsigned int a4)
{
signed int v4; // r12
int v5; // r4
int v6; // r8
unsigned int v7; // r6
unsigned int v8; // r2
const void *v9; // r3
char *v10; // r11
int i; // r2
signed int j; // r5
int v13; // r4
bool v14; // cc
int v16; // [sp+4h] [bp-24h]
unsigned int v17; // [sp+8h] [bp-20h]
if ( !a2 )
{
if ( a3 )
{
if ( (_DWORD)a3 )
*(_DWORD *)a3 = a1[1];
if ( HIDWORD(a3) )
*(_DWORD *)HIDWORD(a3) = *a1;
return 0;
}
return 31;
}
v5 = 31;
if ( !(_DWORD)a3 || !HIDWORD(a3) )
return v5;
v6 = *(_DWORD *)a3;
if ( !*(_DWORD *)a3 )
{
v6 = a1[1];
*(_DWORD *)a3 = v6;
}
v7 = *(_DWORD *)HIDWORD(a3);
if ( !*(_DWORD *)HIDWORD(a3) )
{
v7 = *a1;
*(_DWORD *)HIDWORD(a3) = v7;
v6 = *(_DWORD *)a3;
}
if ( v6 > 32 )
return 31;
v5 = 31;
if ( v6 >= 0 && v7 <= 0x20 )
{
v8 = a4;
if ( !a4 )
v8 = v7;
v9 = *((const void **)a1 + 1);
v17 = v8;
if ( v9 && v6 == a1[1] && v8 == *a1 )
{
qmemcpy(a2, v9, 4 * v6 * v7);
}
else
{
v10 = a2;
v16 = 4 * v8;
for ( i = 0; i < v6; ++i )
{
for ( j = 0; j < (int)v7; ++j )
{
if ( v9 || i != j )
{
if ( !v9 )
goto LABEL_34;
v13 = a1[1];
v14 = i < v13;
if ( i < v13 )
{
v4 = *a1;
v14 = j < v4;
}
if ( v14 )
*(_DWORD *)&v10[4 * j] = *((_DWORD *)v9 + j + i * v4);
else
LABEL_34:
*(_DWORD *)&v10[4 * j] = 0;
}
else
{
*(_DWORD *)&a2[4 * i + 4 * i * v17] = 1065353216;
}
}
v10 += v16;
}
}
return 0;
}
return v5;
}