//
// png_handle_pHYs from 0xe56c24 to 0xe56d64 (320 bytes)
//
// 4 xrefs:
// > png_push_read_chunk @ 0xe45a68
// > png_read_info @ 0xe49814
// > png_read_end @ 0xe4bda4
// > ??> @ 0xa9858
//
// 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:18 +0000
//
__int64 __fastcall png_handle_pHYs(_DWORD *a1, __int64 a2, unsigned int a3)
{
int v4; // w1
_BYTE v7[16]; // [xsp+38h] [xbp+38h] BYREF
v4 = a1[89];
if ( (v4 & 1) == 0 )
png_chunk_error((__int64)a1, "missing IHDR");
if ( (v4 & 4) != 0 )
{
png_crc_finish(a1, a3);
png_chunk_benign_error((__int64)a1, "out of place");
}
else if ( a2 && (*(_DWORD *)(a2 + 8) & 0x80) != 0 )
{
png_crc_finish(a1, a3);
png_chunk_benign_error((__int64)a1, "duplicate");
}
else if ( a3 == 9 )
{
png_crc_read((__int64)a1, (__int64)v7, 9u);
if ( !png_crc_finish(a1, 0) )
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);
png_chunk_benign_error((__int64)a1, "invalid");
}
return _stack_chk_guard;
}