//
// png_write_chunk from 0x874200 to 0x874282 (130 bytes)
//
// 3 xrefs:
// > png_write_info_before_PLTE @ 0x8719a6
// > png_write_info @ 0x871c84
// > png_write_end @ 0x871e3e
//
// 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:03:00 +0000
//
int __fastcall png_write_chunk(int result, unsigned int *a2, int a3, int a4)
{
int v4; // r5
_DWORD *v7; // r4
_BYTE v8[4]; // [sp+0h] [bp-Ch] BYREF
_BYTE v9[8]; // [sp+4h] [bp-8h] BYREF
v4 = _byteswap_ulong(*a2);
if ( result )
{
if ( a4 < 0 )
png_error(result, "length exceeds PNG maximum");
v7 = (_DWORD *)result;
*(_DWORD *)(result + 900) = 34;
png_save_uint_32(v8, a4);
png_save_uint_32(v9, v4);
png_write_data((int)v7);
v7[119] = v4;
png_reset_crc((int)v7);
png_calculate_crc(v7, (int)v9, 4);
v7[225] = 66;
png_write_chunk_data(v7, a3, a4);
return png_write_chunk_end((int)v7);
}
return result;
}