//
// png_destroy_read_struct from 0x867508 to 0x867600 (248 bytes)
//
// 3 xrefs:
// > cocos2d::CCImage::_initWithPngData @ 0x7ebae0
// > sub_85D090 @ 0x85d0ce
// > sub_867600 @ 0x867682
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:02:48 +0000
//
int *__fastcall png_destroy_read_struct(int *result, void **a2, void **a3)
{
int v3; // r4
int *v5; // r6
void *v6; // r1
void *v7; // r1
void *v8; // r1
void *v9; // r1
int v10; // r2
unsigned int v11; // r3
void *v12; // r1
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 + 828));
v6 = *(void **)(v3 + 904);
*(_DWORD *)(v3 + 828) = 0;
png_free(v3, v6);
v7 = *(void **)(v3 + 888);
*(_DWORD *)(v3 + 904) = 0;
png_free(v3, v7);
v8 = *(void **)(v3 + 712);
*(_DWORD *)(v3 + 888) = 0;
png_free(v3, v8);
v9 = *(void **)(v3 + 716);
*(_DWORD *)(v3 + 712) = 0;
png_free(v3, v9);
v10 = *(_DWORD *)(v3 + 776);
*(_DWORD *)(v3 + 716) = 0;
if ( (v10 & 0x1000) != 0 )
{
png_zfree();
v10 = *(_DWORD *)(v3 + 776);
*(_DWORD *)(v3 + 516) = 0;
}
v11 = v10 & 0xFFFFEFFF;
*(_DWORD *)(v3 + 776) = v10 & 0xFFFFEFFF;
if ( (v10 & 0x2000) != 0 )
{
png_free(v3, *(void **)(v3 + 628));
v11 = *(_DWORD *)(v3 + 776);
*(_DWORD *)(v3 + 628) = 0;
}
*(_DWORD *)(v3 + 776) = v11 & 0xFFFFDFFF;
inflateEnd(v3 + 324);
png_free(v3, *(void **)(v3 + 668));
v12 = *(void **)(v3 + 872);
*(_DWORD *)(v3 + 668) = 0;
png_free(v3, v12);
*(_DWORD *)(v3 + 872) = 0;
png_free(v3, *(void **)(v3 + 796));
*(_DWORD *)(v3 + 796) = 0;
return (int *)png_destroy_png_struct((void *)v3);
}
}
return result;
}