//
// sub_E3B368 from 0xe3b368 to 0xe3b438 (208 bytes)
//
// 2 xrefs:
// > png_image_free @ 0xe42a08
// > png_image_free @ 0xe42a10
//
// 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:00 +0000
//
__int64 __fastcall sub_E3B368(__int64 **a1)
{
__int64 *v1; // x19
__int64 v2; // x2
__int64 v4; // x3
__int64 v5; // x3
__int64 v6; // x0
__int64 v7; // x2
__int64 v8; // x3
FILE *v10; // x0
__int64 v11; // [xsp+30h] [xbp+30h] BYREF
_QWORD v12[4]; // [xsp+38h] [xbp+38h] BYREF
__int64 v13; // [xsp+58h] [xbp+58h]
v1 = *a1;
v2 = **a1;
if ( !v2 )
return 0;
if ( (v1[5] & 2) != 0 )
{
v10 = *(FILE **)(v2 + 320);
*((_BYTE *)v1 + 40) &= ~2u;
if ( v10 )
{
*(_QWORD *)(v2 + 320) = 0;
fclose(v10);
}
}
v4 = v1[1];
v11 = *v1;
v12[0] = v4;
v5 = v1[3];
v12[1] = v1[2];
v12[2] = v5;
v6 = v11;
v7 = v1[4];
v8 = v1[5];
*a1 = &v11;
v12[3] = v7;
v13 = v8;
png_free(v6, v1);
if ( (v13 & 1) != 0 )
png_destroy_write_struct(&v11, v12);
else
png_destroy_read_struct(&v11, v12, 0);
return 1;
}