//
// png_handle_pHYs from 0x86db38 to 0x86dbfa (194 bytes)
//
// 3 xrefs:
// > png_push_read_chunk @ 0x862b84
// > png_read_info @ 0x865956
// > png_read_end @ 0x867476
//
// 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:56 +0000
//
int __fastcall png_handle_pHYs(_DWORD *a1, int a2, unsigned int a3)
{
int v4; // r3
int result; // r0
_BYTE v7[16]; // [sp+Ch] [bp-10h] BYREF
v4 = a1[77];
if ( (v4 & 1) == 0 )
png_chunk_error((int)a1, "missing IHDR");
if ( (v4 & 4) != 0 )
{
png_crc_finish(a1, a3);
return png_chunk_benign_error((int)a1, "out of place");
}
else if ( a2 && (*(_DWORD *)(a2 + 8) & 0x80) != 0 )
{
png_crc_finish(a1, a3);
return png_chunk_benign_error((int)a1, "duplicate");
}
else if ( a3 == 9 )
{
png_crc_read(a1, (int)v7, 9);
result = png_crc_finish(a1, 0);
if ( !result )
return png_set_pHYs(
a1,
a2,
(v7[1] << 16) + (v7[0] << 24) + v7[3] + (v7[2] << 8),
(v7[5] << 16) + (v7[4] << 24) + v7[7] + (v7[6] << 8),
v7[8]);
}
else
{
png_crc_finish(a1, a3);
return png_chunk_benign_error((int)a1, "invalid");
}
return result;
}