//
// png_malloc from 0x652128 to 0x652142 (26 bytes)
//
// 39 xrefs:
// > cocos2d::CCImage::_saveImageToPNG @ 0x5e20e6
// > sub_64FEB4 @ 0x64ff18
// > png_build_gamma_table @ 0x6506a8
// > png_build_gamma_table @ 0x6507d4
// > png_build_gamma_table @ 0x650992
// > png_build_gamma_table @ 0x6509d4
// > png_calloc @ 0x65214c
// > sub_655D68 @ 0x656176
// > sub_655D68 @ 0x6561ec
// > sub_6569F0 @ 0x656b30
// > png_read_png @ 0x657746
// > png_read_png @ 0x657780
// > png_set_quantize @ 0x658d44
// > png_set_quantize @ 0x658e8a
// > png_set_quantize @ 0x658e96
// > png_set_quantize @ 0x659090
// > png_set_quantize @ 0x659176
// > png_read_start_row @ 0x65f60e
// > png_read_start_row @ 0x65f61a
// > png_set_tRNS @ 0x6604b0
// > png_set_keep_unknown_chunks @ 0x660988
// > png_set_keep_unknown_chunks @ 0x6609b2
// > sub_661270 @ 0x661278
// > sub_661270 @ 0x66129a
// > sub_661270 @ 0x6612a6
// > sub_661270 @ 0x66131c
// > sub_661270 @ 0x661328
// > png_set_filter @ 0x662844
// > png_set_filter @ 0x66287c
// > png_set_filter @ 0x6628a0
// > png_set_filter @ 0x6628be
// > sub_662E04 @ 0x662f7a
// > png_compress_IDAT @ 0x664826
// > png_write_pCAL @ 0x6658ac
// > png_write_start_row @ 0x665c8c
// > png_write_start_row @ 0x665d04
// > png_write_start_row @ 0x665d1a
// > png_write_start_row @ 0x665d34
// > png_write_start_row @ 0x665d4e
//
// 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
//
void *__fastcall png_malloc(void *result, size_t a2)
{
int v2; // r4
if ( result )
{
v2 = (int)result;
result = png_malloc_base((int)result, a2);
if ( !result )
png_error(v2, "Out of memory");
}
return result;
}