//
// sub_1004D5038 from 0x1004d5038 to 0x1004d5108 (208 bytes)
//
// 1 xrefs:
// > sub_1004D4F38 @ 0x1004d4fe0
//
// 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_1004D5038(__int64 a1)
{
__int64 v2; // x8
int v3; // w8
int *v4; // x1
int v5; // w8
sub_1004D5108();
v2 = *(int *)(a1 + 24);
if ( (v2 & 0x80000000) != 0 )
bzero((void *)(*(_QWORD *)(a1 + 16) + 16 * v2), 16LL * (unsigned int)-(int)v2);
*(_DWORD *)(a1 + 24) = 0;
v3 = *(_DWORD *)(a1 + 28);
if ( v3 )
{
if ( v3 >= 1 )
{
v4 = *(int **)(a1 + 16);
if ( v4 )
sub_1004B1970(*((_QWORD *)off_1008524C8 + 54), v4);
}
*(_QWORD *)(a1 + 16) = 0;
*(_DWORD *)(a1 + 28) = 0;
}
v5 = *(_DWORD *)(a1 + 12);
*(_DWORD *)(a1 + 8) = 0;
if ( v5 )
{
if ( v5 >= 1 && *(_QWORD *)a1 )
sub_1004B1970(*((_QWORD *)off_1008524C8 + 54), *(int **)a1);
*(_QWORD *)a1 = 0;
*(_DWORD *)(a1 + 12) = 0;
}
return a1;
}