//
// sub_10050CAD4 from 0x10050cad4 to 0x10050cbc0 (236 bytes)
//
// 6 xrefs:
// > sub_10043E2C8 @ 0x10043e6b8
// > sub_100446E50 @ 0x10044704c
// > sub_1004F28F8 @ 0x1004f2acc
// > sub_1004F28F8 @ 0x1004f2b50
// > sub_1004F28F8 @ 0x1004f2c6c
// > sub_100508B28 @ 0x100508cb8
//
// 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
//
__int64 __fastcall sub_10050CAD4(__int16 *a1, char *a2, int a3, int a4, int a5)
{
int v6; // w15
char *v7; // x0
__int64 v8; // x9
__int64 v10; // x10
__int64 v11; // x8
__int64 v12; // x15
__int64 v13; // x16
int v14; // s0
if ( a5 )
v6 = a5;
else
v6 = a4;
v7 = *((char **)a1 + 1);
if ( !v7 )
return 30;
if ( !a2 )
return 31;
v8 = (unsigned int)a1[1];
if ( v6 == a4 && (_DWORD)v8 == a3 && *a1 == a4 )
{
memcpy(v7, a2, 4LL * a4 * a3);
}
else if ( (int)v8 >= 1 )
{
v10 = 0;
v11 = *a1;
v12 = 4LL * v6;
do
{
if ( (int)v11 >= 1 )
{
v13 = 0;
do
{
v14 = 0;
if ( v10 < a3 && v13 < a4 )
v14 = *(_DWORD *)&a2[4 * v13];
*(_DWORD *)&v7[4 * v13++] = v14;
}
while ( (unsigned int)v11 != v13 );
}
++v10;
v7 += 4 * v11;
a2 += v12;
}
while ( v10 != v8 );
}
return 0;
}