//
// png_handle_pHYs from 0x65dab8 to 0x65db7a (194 bytes)
//
// 3 xrefs:
// > png_push_read_chunk @ 0x652b04
// > png_read_info @ 0x6558d6
// > png_read_end @ 0x6573f6
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
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;
}