//
// sub_867600 from 0x867600 to 0x867692 (146 bytes)
//
// 3 xrefs:
// > png_image_begin_read_from_stdio @ 0x867850
// > png_image_begin_read_from_file @ 0x8678ba
// > png_image_begin_read_from_memory @ 0x867948
//
// 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 sub_867600(_DWORD *a1)
{
_DWORD *v3; // r7
_BYTE *v4; // r0
_BYTE *v5; // r7
int v6; // r1
void *v7; // r2
char v8; // r3
_DWORD *v9; // [sp+0h] [bp-Ch] BYREF
void *info_struct; // [sp+4h] [bp-8h] BYREF
if ( *a1 )
return png_image_error((int)a1, (int)"png_image_read: opaque pointer not NULL");
v3 = png_create_read_struct((int)"1.6.16", (int)a1, (int)png_safe_error, (int)png_safe_warning);
v9 = v3;
memset(a1, 0, 0x60u);
a1[1] = 1;
if ( v3 )
{
info_struct = png_create_info_struct(v3);
if ( info_struct )
{
v4 = png_malloc_warn((int)v9, 0x18u);
v5 = v4;
if ( v4 )
{
memset(v4, 0, 0x18u);
v6 = (int)v9;
v7 = info_struct;
v8 = v5[20];
*a1 = v5;
*(_DWORD *)v5 = v6;
v5[20] = v8 & 0xFE;
*((_DWORD *)v5 + 1) = v7;
return 1;
}
png_destroy_info_struct((int)v9, &info_struct);
}
png_destroy_read_struct((int *)&v9, nullptr, nullptr);
}
return png_image_error((int)a1, (int)"png_image_read: out of memory");
}