//
// LogL16fromY from 0xc565e8 to 0xc56710 (296 bytes)
//
// 3 xrefs:
// > sub_C56750 @ 0xc5678c
// > LogLuv32fromXYZ @ 0xc57404
// > ??> @ 0x6e250
//
// 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 LogL16fromY(int a1, double a2)
{
unsigned int v2; // w1
double v4; // d0
double v5; // [xsp+10h] [xbp+10h]
double v6; // [xsp+10h] [xbp+10h]
v2 = 0x7FFF;
if ( a2 < 1.8371976e19 )
{
v2 = 0xFFFF;
if ( a2 > -1.8371976e19 )
{
if ( a2 <= 5.4136769e-20 )
{
v2 = 0;
if ( a2 < -5.4136769e-20 )
{
v4 = -a2;
if ( a1 )
{
v6 = log(v4);
return (int)((double)rand() * 4.65661288e-10 + (v6 * 1.44269504 + 64.0) * 256.0 - 0.5) | 0xFFFF8000;
}
else
{
return (int)((log(v4) * 1.44269504 + 64.0) * 256.0) | 0xFFFF8000;
}
}
}
else if ( a1 )
{
v5 = log(a2);
return (unsigned int)(int)((double)rand() * 4.65661288e-10 + (v5 * 1.44269504 + 64.0) * 256.0 - 0.5);
}
else
{
return (unsigned int)(int)((log(a2) * 1.44269504 + 64.0) * 256.0);
}
}
}
return v2;
}