//
// sub_10050C978 from 0x10050c978 to 0x10050ca84 (268 bytes)
//
// 2 xrefs:
// > sub_1004F30D4 @ 0x1004f3108
// > sub_1004F30D4 @ 0x1004f311c
//
// 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_10050C978(__int16 *a1, __int64 a2, __int16 *a3)
{
int *v6; // x8
int *v7; // x0
__int64 result; // x0
const void *v9; // x1
__int64 v10; // x9
__int64 v11; // x10
v6 = *((int **)a1 + 1);
if ( v6 )
{
if ( a1[1] * *a1 == a3[1] * *a3 )
goto LABEL_7;
sub_1004B1970(a2 + 67784, v6);
*(_DWORD *)a1 = 0;
*((_QWORD *)a1 + 1) = 0;
}
if ( !*((_QWORD *)a3 + 1) )
return 0;
v7 = (int *)sub_1004B11FC((__int64 *)(a2 + 67784), 4 * *a3 * a3[1], (char)"", 0, 0, 0);
if ( !v7 )
return 38;
v6 = v7;
*(_DWORD *)a1 = *(_DWORD *)a3;
*((_QWORD *)a1 + 1) = v7;
LABEL_7:
result = 0;
if ( a1 != a3 )
{
v9 = *((const void **)a3 + 1);
if ( v9 )
{
v10 = *a3;
*a1 = v10;
v11 = a3[1];
a1[1] = v11;
memcpy(v6, v9, 4 * v10 * v11);
return 0;
}
}
return result;
}