//
// png_gamma_16bit_correct from 0xbca470 to 0xbca4dc (108 bytes)
//
// 15 xrefs:
// > png_gamma_correct @ 0xbca510
// > png_build_gamma_table @ 0xbca85c
// > sub_BD0758 @ 0xbd0808
// > sub_BD0758 @ 0xbd0820
// > sub_BD0758 @ 0xbd0838
// > sub_BD0D18 @ 0xbd0d8c
// > sub_BD0D18 @ 0xbd0f14
// > sub_BD1094 @ 0xbd1148
// > sub_BD1094 @ 0xbd1160
// > sub_BD1094 @ 0xbd1178
// > sub_BD1BEC @ 0xbd2cec
// > sub_BD1BEC @ 0xbd2cfc
// > sub_BD1BEC @ 0xbd2d0c
// > sub_BD1BEC @ 0xbd30ec
// > ??> @ 0x7a6b8
//
// 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
//
__int64 __fastcall png_gamma_16bit_correct(__int64 result, int a2)
{
if ( (unsigned int)(result - 1) <= 0xFFFD )
return (unsigned __int16)vcvtmd_u64_f64(pow((double)(int)result / 65535.0, (double)a2 * 0.00001) * 65535.0 + 0.5);
else
return (unsigned __int16)result;
}