//
// sub_CB736C from 0xcb736c to 0xcb7468 (252 bytes)
//
// 2 xrefs:
// > sub_C98F4C @ 0xc98ff4
// > sub_C98F4C @ 0xc99008
//
// 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_CB736C(__int64 a1, const void *a2, size_t a3)
{
__int64 v5; // x0
unsigned __int64 v8; // x21
size_t v9; // x1
unsigned __int64 v10; // x1
char *v11; // x0
char *v12; // x24
size_t v13; // x2
if ( *(_DWORD *)(a1 + 12) != -8 )
return 0;
v5 = *(_QWORD *)(a1 + 24);
v8 = a3 + v5;
v9 = *(_QWORD *)(a1 + 32);
if ( a3 + v5 <= v9 )
{
v12 = *(char **)(a1 + 16);
}
else
{
v10 = 2 * v9;
if ( v8 < v10 )
v8 = v10;
if ( v8 <= 0x3FF )
v8 = 1024;
v11 = (char *)WebPSafeMalloc(1, v8);
v12 = v11;
if ( !v11 )
{
*(_DWORD *)(a1 + 40) = 1;
return 0;
}
v13 = *(_QWORD *)(a1 + 24);
if ( v13 )
memcpy(v11, *(const void **)(a1 + 16), v13);
WebPSafeFree(*(void **)(a1 + 16));
*(_QWORD *)(a1 + 16) = v12;
v5 = *(_QWORD *)(a1 + 24);
*(_QWORD *)(a1 + 32) = v8;
}
memcpy(&v12[v5], a2, a3);
*(_QWORD *)(a1 + 24) += a3;
return 1;
}