//
// sub_601B48 from 0x601b48 to 0x601b9e (86 bytes)
//
// 3 xrefs:
// > sub_601BA4 @ 0x601bc6
// > sub_601BE6 @ 0x601c14
// > sub_606D38 @ 0x606e9c
//
// 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
//
int *__fastcall sub_601B48(int a1, int *a2, int a3, int a4)
{
unsigned int v4; // r3
size_t v6; // r5
int v7; // r8
int *v9; // r0
int *v10; // r7
int *v11; // r0
int v12; // r5
v4 = (a4 + 3) & 0xFFFFFFFC;
v6 = (a3 + 3) & 0xFFFFFFFC;
v7 = *(_DWORD *)(a1 + 4);
if ( a2 )
*(_DWORD *)(a1 + 4) = v7 - v6;
v9 = sub_601B34(a1, v4);
v10 = v9;
if ( v9 != a2 )
{
if ( a2 )
{
memcpy(v9, a2, v6);
if ( v7 == v6 )
{
v11 = **(int ***)a1;
v12 = *v11;
if ( *v11 )
{
off_ABAE70(v11);
**(_DWORD **)a1 = v12;
}
}
}
}
return v10;
}