//
// png_handle_gAMA from 0xe557b0 to 0xe55884 (212 bytes)
//
// 4 xrefs:
// > png_push_read_chunk @ 0xe45928
// > png_read_info @ 0xe497c4
// > png_read_end @ 0xe4bd2c
// > ??> @ 0x42aa8
//
// 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_gAMA(_DWORD *a1, __int64 a2, unsigned int a3)
{
int v3; // w3
__int64 result; // x0
int v7; // w2
_BYTE v8[8]; // [xsp+28h] [xbp+28h] BYREF
v3 = a1[89];
if ( (v3 & 1) == 0 )
png_chunk_error((__int64)a1, "missing IHDR");
if ( (v3 & 6) != 0 )
{
png_crc_finish(a1, a3);
return png_chunk_benign_error((__int64)a1, "out of place");
}
else if ( a3 == 4 )
{
png_crc_read((__int64)a1, (__int64)v8, 4u);
result = png_crc_finish(a1, 0);
if ( !(_DWORD)result )
{
v7 = (v8[1] << 16) + (v8[0] << 24) + v8[3] + (v8[2] << 8);
if ( v7 < 0 )
v7 = -1;
png_colorspace_set_gamma((__int64)a1, (__int64)(a1 + 324), v7);
return png_colorspace_sync((__int64)a1, a2);
}
}
else
{
png_crc_finish(a1, a3);
return png_chunk_benign_error((__int64)a1, "invalid");
}
return result;
}