//
// png_gamma_16bit_correct from 0x860550 to 0x8605cc (124 bytes)
//
// 14 xrefs:
// > png_gamma_correct @ 0x8605f2
// > png_build_gamma_table @ 0x86088a
// > sub_863660 @ 0x8636d8
// > sub_863660 @ 0x8636e4
// > sub_863660 @ 0x8636f2
// > sub_863A8C @ 0x863abc
// > sub_863A8C @ 0x863ae2
// > sub_863C68 @ 0x863cf2
// > sub_863C68 @ 0x863d00
// > sub_863C68 @ 0x863d10
// > sub_8644A4 @ 0x86515c
// > sub_8644A4 @ 0x865166
// > sub_8644A4 @ 0x865170
// > sub_8644A4 @ 0x8654e2
//
// 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:42 +0000
//
int __fastcall png_gamma_16bit_correct(int result, int a2)
{
double v2; // r0
if ( (unsigned int)(result - 1) > 0xFFFD )
return (unsigned __int16)result;
v2 = pow((double)result / 65535.0, (double)a2 * 0.00001);
return (unsigned __int16)(unsigned int)floor(v2 * 65535.0 + 0.5);
}