//
// png_destroy_read_struct from 0xe4be6c to 0xe4bfb0 (324 bytes)
//
// 4 xrefs:
// > cocos2d::CCImage::_initWithPngData @ 0xd7ce64
// > sub_E3B368 @ 0xe3b3d0
// > sub_E4BFB0 @ 0xe4c094
// > ??> @ 0x62338
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:10:08 +0000
//
__int64 *__fastcall png_destroy_read_struct(__int64 *result, void **a2, void **a3)
{
__int64 v3; // x19
__int64 *v5; // x20
int v6; // w1
unsigned int v7; // w0
if ( result )
{
v3 = *result;
if ( *result )
{
v5 = result;
png_destroy_info_struct(*result, a3);
png_destroy_info_struct(v3, a2);
*v5 = 0;
png_destroy_gamma_table(v3);
png_free(v3, *(void **)(v3 + 1136));
*(_QWORD *)(v3 + 1136) = 0;
png_free(v3, *(void **)(v3 + 1256));
*(_QWORD *)(v3 + 1256) = 0;
png_free(v3, *(void **)(v3 + 1232));
*(_QWORD *)(v3 + 1232) = 0;
png_free(v3, *(void **)(v3 + 960));
*(_QWORD *)(v3 + 960) = 0;
png_free(v3, *(void **)(v3 + 968));
*(_QWORD *)(v3 + 968) = 0;
v6 = *(_DWORD *)(v3 + 1056);
if ( (v6 & 0x1000) != 0 )
{
png_zfree();
*(_QWORD *)(v3 + 664) = 0;
v6 = *(_DWORD *)(v3 + 1056);
}
v7 = v6 & 0xFFFFEFFF;
*(_DWORD *)(v3 + 1056) = v6 & 0xFFFFEFFF;
if ( (v6 & 0x2000) != 0 )
{
png_free(v3, *(void **)(v3 + 816));
*(_QWORD *)(v3 + 816) = 0;
v7 = *(_DWORD *)(v3 + 1056);
}
*(_DWORD *)(v3 + 1056) = v7 & 0xFFFFDFFF;
inflateEnd(v3 + 376);
png_free(v3, *(void **)(v3 + 888));
*(_QWORD *)(v3 + 888) = 0;
png_free(v3, *(void **)(v3 + 1200));
*(_QWORD *)(v3 + 1200) = 0;
png_free(v3, *(void **)(v3 + 1088));
*(_QWORD *)(v3 + 1088) = 0;
return (__int64 *)png_destroy_png_struct((void *)v3);
}
}
return result;
}