//
// png_handle_gAMA from 0x86cbf4 to 0x86cc82 (142 bytes)
//
// 3 xrefs:
// > png_push_read_chunk @ 0x862a94
// > png_read_info @ 0x86591a
// > png_read_end @ 0x867426
//
// 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:55 +0000
//
int __fastcall png_handle_gAMA(_DWORD *a1, int a2, unsigned int a3)
{
int v4; // r3
int result; // r0
int v7; // r3
_BYTE v8[2]; // [sp+4h] [bp-8h] BYREF
unsigned __int8 v9; // [sp+6h] [bp-6h]
unsigned __int8 v10; // [sp+7h] [bp-5h]
v4 = a1[77];
if ( (v4 & 1) == 0 )
png_chunk_error((int)a1, "missing IHDR");
if ( (v4 & 6) != 0 )
{
png_crc_finish(a1, a3);
return png_chunk_benign_error((int)a1, "out of place");
}
else if ( a3 == 4 )
{
png_crc_read(a1, (int)v8, 4);
result = png_crc_finish(a1, 0);
if ( !result )
{
v7 = (v8[1] << 16) + (v8[0] << 24) + v10;
png_colorspace_set_gamma((int)a1, (int)(a1 + 231), (v7 + (v9 << 8)) | ((v7 + (v9 << 8)) >> 31));
return png_colorspace_sync((int)a1, a2);
}
}
else
{
png_crc_finish(a1, a3);
return png_chunk_benign_error((int)a1, "invalid");
}
return result;
}