//
// png_write_png from 0xe5f044 to 0xe5f1a4 (352 bytes)
//
// 1 xrefs:
// > ??> @ 0x97a80
//
// 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:22 +0000
//
unsigned __int64 __fastcall png_write_png(unsigned __int64 result, __int64 a2, __int16 a3)
{
__int64 v3; // x20
v3 = result;
if ( result && a2 )
{
if ( (*(_DWORD *)(a2 + 8) & 0x8000) != 0 )
{
png_write_info(result, a2);
if ( (a3 & 0x20) != 0 )
{
png_set_invert_mono(v3);
if ( (a3 & 0x40) == 0 )
goto LABEL_8;
}
else if ( (a3 & 0x40) == 0 )
{
goto LABEL_8;
}
if ( (*(_DWORD *)(a2 + 8) & 2) != 0 )
png_set_shift(v3, a2 + 176);
LABEL_8:
if ( (a3 & 4) != 0 )
{
png_set_packing(v3);
if ( (a3 & 0x100) == 0 )
goto LABEL_10;
}
else if ( (a3 & 0x100) == 0 )
{
goto LABEL_10;
}
png_set_swap_alpha(v3);
LABEL_10:
if ( (a3 & 0x1800) != 0 )
{
if ( (a3 & 0x1000) != 0 )
{
if ( (a3 & 0x800) != 0 )
png_app_error(v3, "PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
png_set_filler(v3, 0, 1);
}
else if ( (a3 & 0x800) != 0 )
{
png_set_filler(v3, 0, 0);
if ( (a3 & 0x80) == 0 )
{
LABEL_16:
if ( (a3 & 0x200) == 0 )
goto LABEL_17;
goto LABEL_24;
}
LABEL_26:
png_set_bgr(v3);
if ( (a3 & 0x200) == 0 )
{
LABEL_17:
if ( (a3 & 8) == 0 )
goto LABEL_18;
goto LABEL_22;
}
LABEL_24:
png_set_swap(v3);
if ( (a3 & 8) == 0 )
{
LABEL_18:
if ( (a3 & 0x400) == 0 )
{
LABEL_19:
png_write_image(v3, *(void ***)(a2 + 336));
return png_write_end(v3, a2);
}
LABEL_23:
png_set_invert_alpha(v3);
goto LABEL_19;
}
LABEL_22:
png_set_packswap(v3);
if ( (a3 & 0x400) == 0 )
goto LABEL_19;
goto LABEL_23;
}
}
if ( (a3 & 0x80) == 0 )
goto LABEL_16;
goto LABEL_26;
}
return png_app_error(result, "no rows for png_write_image to write");
}
return result;
}