//
// LogLuv32fromXYZ from 0x6dad84 to 0x6daff0 (620 bytes)
//
// 2 xrefs:
// > sub_6DB290 @ 0x6db2d0
// > ??> @ 0x5854c
//
// 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
//
int __fastcall LogLuv32fromXYZ(float *a1, int a2)
{
int v2; // r3
int v3; // r3
int v7; // [sp+Ch] [bp-30h]
unsigned int v8; // [sp+10h] [bp-2Ch]
unsigned int v9; // [sp+14h] [bp-28h]
double v10; // [sp+18h] [bp-24h]
double v11; // [sp+20h] [bp-1Ch]
double v12; // [sp+28h] [bp-14h]
v7 = LogL16fromY(a1[1], a2);
v12 = *a1 + a1[1] * 15.0 + a1[2] * 3.0;
if ( v7 && v12 > 0.0 )
{
v10 = *a1 * 4.0 / v12;
v11 = a1[1] * 9.0 / v12;
}
else
{
v10 = 0.210526316;
v11 = 0.473684211;
}
if ( v10 > 0.0 )
{
if ( a2 )
v2 = (int)(v10 * 410.0 + (double)sub_6D7100() * 4.65661288e-10 - 0.5);
else
v2 = (int)(v10 * 410.0);
v8 = v2;
}
else
{
v8 = 0;
}
if ( v8 > 0xFF )
v8 = 255;
if ( v11 > 0.0 )
{
if ( a2 )
v3 = (int)(v11 * 410.0 + (double)sub_6D7100() * 4.65661288e-10 - 0.5);
else
v3 = (int)(v11 * 410.0);
v9 = v3;
}
else
{
v9 = 0;
}
if ( v9 > 0xFF )
v9 = 255;
return (v7 << 16) | (v8 << 8) | v9;
}