//
// sub_B7C88 from 0xb7c88 to 0xb7df4 (364 bytes)
//
// 2 xrefs:
// > sub_562A4 @ 0x562a8
// > sub_AC560 @ 0xac564
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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:14:39 +0000
//
__int64 __fastcall sub_B7C88(__int16 *a1, char *dest, int *a3, unsigned int *a4, signed int a5)
{
unsigned int v5; // w8
int v6; // w11
unsigned int v7; // w10
const void *v8; // x8
signed int v9; // w13
__int64 v10; // x9
__int64 v11; // x12
__int64 v12; // x13
char *v13; // x15
__int64 v14; // x16
_DWORD *v15; // x2
__int64 v16; // x3
if ( !dest )
{
if ( (unsigned __int64)a3 | (unsigned __int64)a4 )
{
if ( a3 )
*a3 = a1[1];
if ( !a4 )
return 0;
v5 = 0;
*a4 = *a1;
return v5;
}
return 31;
}
v5 = 31;
if ( !a3 || !a4 )
return v5;
v6 = *a3;
if ( !*a3 )
{
v6 = a1[1];
*a3 = v6;
}
v7 = *a4;
if ( !*a4 )
{
v7 = *a1;
*a4 = v7;
v6 = *a3;
}
if ( v6 > 32 )
return 31;
v5 = 31;
if ( (v6 & 0x80000000) == 0 && v7 <= 0x20 )
{
v8 = *((const void **)a1 + 1);
if ( a5 )
v9 = a5;
else
v9 = v7;
if ( v8 && v6 == a1[1] && v9 == *a1 )
{
memcpy(dest, v8, 4LL * (int)(v7 * v6));
}
else
{
v10 = 0;
v11 = v9;
v12 = 4LL * v9;
v13 = dest;
while ( v10 < v6 )
{
v14 = 0;
v15 = v13;
while ( v14 < (int)v7 )
{
if ( v8 || v10 != v14 )
{
if ( v8 && v10 < a1[1] && (v16 = *a1, v14 < v16) )
*v15 = *((_DWORD *)v8 + (int)v14 + (int)v10 * (int)v16);
else
*v15 = 0;
}
else
{
*(_DWORD *)&dest[4 * v10 + 4 * v10 * v11] = 1065353216;
}
++v14;
++v15;
}
++v10;
v13 += v12;
}
}
return 0;
}
return v5;
}