//
// sub_E4BFB0 from 0xe4bfb0 to 0xe4c0ac (252 bytes)
//
// 3 xrefs:
// > png_image_begin_read_from_stdio @ 0xe4c354
// > png_image_begin_read_from_file @ 0xe4c418
// > png_image_begin_read_from_memory @ 0xe4c4d8
//
// 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 sub_E4BFB0(_QWORD *a1)
{
_DWORD *v3; // x0
_QWORD *v4; // x0
_QWORD *v5; // x1
void *v6; // x3
char v7; // w2
_DWORD *v8; // [xsp+20h] [xbp+20h] BYREF
void *info_struct; // [xsp+28h] [xbp+28h] BYREF
if ( *a1 )
return png_image_error((__int64)a1, (__int64)"png_image_read: opaque pointer not NULL");
v3 = png_create_read_struct((__int64)"1.6.16", (__int64)a1, (__int64)png_safe_error, (__int64)png_safe_warning);
a1[12] = 0;
*a1 = 0;
a1[1] = 0;
v8 = v3;
a1[2] = 0;
a1[3] = 0;
a1[4] = 0;
a1[5] = 0;
a1[6] = 0;
a1[7] = 0;
a1[8] = 0;
a1[9] = 0;
a1[10] = 0;
a1[11] = 0;
*((_DWORD *)a1 + 2) = 1;
if ( v3 )
{
info_struct = png_create_info_struct((__int64)v3);
if ( info_struct )
{
v4 = png_malloc_warn((__int64)v8, 0x30u);
v5 = v4;
if ( v4 )
{
v4[4] = 0;
v4[5] = 0;
v4[2] = 0;
v4[3] = 0;
v6 = info_struct;
v7 = *((_BYTE *)v4 + 40);
*v4 = v8;
v5[1] = v6;
*a1 = v5;
*((_BYTE *)v5 + 40) = v7 & 0xFE;
return 1;
}
png_destroy_info_struct((__int64)v8, &info_struct);
}
png_destroy_read_struct((__int64 *)&v8, nullptr, nullptr);
}
return png_image_error((__int64)a1, (__int64)"png_image_read: out of memory");
}