//
// sub_30F1A6 from 0x30f1a6 to 0x30f20e (104 bytes)
//
// 2 xrefs:
// > std::__detail::_ReuseOrAllocNode>>,false>>>::operator @ 0x3193d0
// > std::__detail::_ReuseOrAllocNode>>,false>>>::operator @ 0x3193e4
//
// 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
//
_DWORD *__fastcall sub_30F1A6(_DWORD *result, _DWORD *a2)
{
_DWORD *v3; // r5
int v4; // r6
signed int v5; // r6
unsigned int v6; // r4
int v7; // r12
int v8; // r6
int i; // r7
int v10; // r3
_DWORD *v12; // lr
int v13; // r1
int v14; // r2
int v15; // r3
v3 = result;
if ( result )
{
v4 = a2[1];
*result = *a2;
v5 = a2[2] - v4;
result[1] = 0;
v6 = v5 >> 4;
result[2] = 0;
result[3] = 0;
if ( v5 >> 4 )
{
if ( v6 >= 0x10000000 )
sub_772FB4();
result = (_DWORD *)operator new(v5);
v6 = (unsigned int)result;
}
v3[1] = v6;
v3[2] = v6;
v3[3] = v5 + v6;
v7 = a2[1];
v8 = a2[2];
for ( i = 0; ; i += 16 )
{
v10 = v7 + i;
if ( v8 == v7 + i )
break;
v12 = (_DWORD *)(v6 + i);
if ( v6 + i != 0 )
{
result = *(_DWORD **)v10;
v13 = *(_DWORD *)(v10 + 4);
v14 = *(_DWORD *)(v10 + 8);
v15 = *(_DWORD *)(v10 + 12);
*v12 = result;
v12[1] = v13;
v12[2] = v14;
v12[3] = v15;
}
}
v3[2] = v6 + ((v8 - v7) & 0xFFFFFFF0);
}
return result;
}