//
// LogLuv32toXYZ from 0xc57238 to 0xc57318 (224 bytes)
//
// 3 xrefs:
// > sub_C57320 @ 0xc5735c
// > sub_C5738C @ 0xc573c0
// > ??> @ 0x97d40
//
// 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
//
float __fastcall LogLuv32toXYZ(int a1, float *a2)
{
__int16 v2; // w19
double v3; // d0
double v4; // d2
double v5; // d1
float v6; // s6
double v7; // d4
double v8; // d1
double v9; // d4
double v10; // d1
double v11; // d3
float result; // s0
v2 = a1;
v3 = LogL16toY(SHIWORD(a1));
if ( v3 <= 0.0 )
{
a2[2] = 0.0;
a2[1] = 0.0;
*a2 = 0.0;
return 0.0;
}
else
{
v4 = ((double)(unsigned __int8)v2 + 0.5) * 0.00243902439;
v5 = ((double)HIBYTE(v2) + 0.5) * 0.00243902439;
v6 = v3;
v7 = v5 * 9.0;
a2[1] = v6;
v8 = 1.0 / (12.0 - (v4 * 16.0 - v5 * 6.0));
v9 = v7 * v8;
v10 = v4 * 4.0 * v8;
v11 = 1.0 - v9;
*(float *)&v9 = v9 / v10 * v3;
*a2 = *(float *)&v9;
result = (v11 - v10) / v10 * v3;
a2[2] = result;
}
return result;
}