//
// png_safe_execute from 0xbcd518 to 0xbcd5bc (164 bytes)
//
// 13 xrefs:
// > png_image_free @ 0xbcc854
// > png_read_row @ 0xbd4280
// > sub_BD4E74 @ 0xbd5030
// > png_image_begin_read_from_stdio @ 0xbd61d0
// > png_image_begin_read_from_file @ 0xbd6290
// > png_image_begin_read_from_memory @ 0xbd638c
// > png_image_finish_read @ 0xbd645c
// > png_image_finish_read @ 0xbd64c0
// > png_image_finish_read @ 0xbd6508
// > sub_BE8924 @ 0xbe8af0
// > sub_BE8924 @ 0xbe8c48
// > png_image_write_to_stdio @ 0xbe9128
// > ??> @ 0xafc80
//
// 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
//
__int64 __fastcall png_safe_execute(__int64 a1, __int64 (__fastcall *a2)(__int64), __int64 a3)
{
unsigned int v6; // [xsp+3Ch] [xbp+3Ch]
__int64 v8; // [xsp+48h] [xbp+48h]
jmp_buf env; // [xsp+50h] [xbp+50h] BYREF
v8 = *(_QWORD *)(*(_QWORD *)a1 + 16LL);
v6 = setjmp(env) == 0;
if ( v6 )
{
*(_QWORD *)(*(_QWORD *)a1 + 16LL) = env;
v6 = a2(a3);
}
*(_QWORD *)(*(_QWORD *)a1 + 16LL) = v8;
if ( !v6 )
png_image_free(a1);
return v6;
}