//
// png_image_write_to_stdio from 0x87337c to 0x873462 (230 bytes)
//
// 1 xrefs:
// > png_image_write_to_file @ 0x8734d0
//
// 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:59 +0000
//
int __fastcall png_image_write_to_stdio(int **a1, int a2, void *a3, void *a4, void *a5, void *a6)
{
_DWORD *v11; // r0
int *v12; // r0
int *v13; // r8
int v14; // r1
void *v15; // r2
char v16; // r3
int v17; // r5
_DWORD *v18; // [sp+4h] [bp-3Ch] BYREF
void *v19[14]; // [sp+8h] [bp-38h] BYREF
if ( !a1 )
return 0;
if ( a1[1] == (int *)((char *)&dword_0 + 1) )
{
if ( !a2 )
return png_image_error((int)a1, (int)"png_image_write_to_stdio: invalid argument");
v11 = png_create_write_struct((int)"1.6.16", (int)a1, (int)png_safe_error, (int)png_safe_warning);
v18 = v11;
if ( v11 )
{
v19[0] = png_create_info_struct(v11);
if ( v19[0] )
{
v12 = (int *)png_malloc_warn((int)v18, 0x18u);
v13 = v12;
if ( v12 )
{
memset(v12, 0, 0x18u);
v14 = (int)v18;
v15 = v19[0];
v16 = *((_BYTE *)v13 + 20);
*a1 = v13;
*v13 = v14;
*((_BYTE *)v13 + 20) = v16 | 1;
v13[1] = (int)v15;
goto LABEL_10;
}
png_destroy_info_struct((int)v18, v19);
}
png_destroy_write_struct((int *)&v18, nullptr);
}
if ( !png_image_error((int)a1, (int)"png_image_write_: out of memory") )
return 0;
v14 = **a1;
LABEL_10:
*(_DWORD *)(v14 + 288) = a2;
v19[0] = a1;
v19[2] = a5;
memset(&v19[5], 0, 12);
v19[3] = a6;
v19[1] = a4;
v19[4] = a3;
v17 = png_safe_execute((int)a1, (int (__fastcall *)(int))sub_872E84, (int)v19);
png_image_free((int)a1);
return v17;
}
return png_image_error((int)a1, (int)"png_image_write_to_stdio: incorrect PNG_IMAGE_VERSION");
}