//
// sub_CA38A8 from 0xca38a8 to 0xca3960 (184 bytes)
//
// 4 xrefs:
// > sub_C9AC60 @ 0xc9ac9c
// > sub_C9BDA0 @ 0xc9c068
// > sub_C9BDA0 @ 0xc9c6bc
// > sub_C9BDA0 @ 0xc9d5b0
//
// 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_CA38A8(int a1)
{
__int64 v2; // x0
_DWORD *v3; // x19
size_t v4; // x2
__int64 v5; // x21
__int64 v7; // x0
size_t v8; // [xsp+38h] [xbp+38h]
if ( a1 <= 0 )
{
v7 = WebPSafeMalloc(4400, 1);
v3 = (_DWORD *)v7;
if ( v7 )
{
v5 = v7 + 3280;
*(_DWORD *)(v7 + 3240) = a1;
*(_QWORD *)v7 = v7 + 3280;
v4 = 4400;
goto LABEL_4;
}
return nullptr;
}
v8 = 4 * ((1 << a1) + 1100);
v2 = WebPSafeMalloc(v8, 1);
v3 = (_DWORD *)v2;
v4 = v8;
if ( !v2 )
return nullptr;
v5 = v2 + 3280;
*(_DWORD *)(v2 + 3240) = a1;
*(_QWORD *)v2 = v2 + 3280;
LABEL_4:
memset(v3, 0, v4);
v3[810] = a1;
*(_QWORD *)v3 = v5;
return v3;
}