//
// sub_609B8 from 0x609b8 to 0x60a9c (228 bytes)
//
// 6 xrefs:
// > sub_46B04 @ 0x46b44
// > sub_64E88 @ 0x64eae
// > sub_68A04 @ 0x68ae4
// > sub_69158 @ 0x69190
// > sub_9A830 @ 0x9a84c
// > sub_9AEF8 @ 0x9af28
//
// 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 sub_609B8(int a1, float a2, float a3, float a4, float *a5, float a6)
{
float v6; // s0
float v7; // s2
float v8; // s4
float v9; // s0
float v10; // s0
float v12; // s0
float v13; // s2
if ( !a5 )
return 31;
v6 = a4;
v7 = a2;
v8 = a4;
if ( a3 < a4 )
v8 = a3;
if ( v8 >= a2 || a6 <= 0.0 )
{
LABEL_13:
*a5 = 1.0;
}
else
{
if ( a6 != 1.0 )
v7 = v8 + (float)((float)(a2 - v8) * a6);
switch ( a1 )
{
case 0:
case 1:
if ( v7 >= a4 )
goto LABEL_22;
v9 = (float)(a4 - v7) / (float)(a4 - v8);
*a5 = v9;
if ( a1 )
return 0;
v10 = v9 * v9;
goto LABEL_20;
case 2:
if ( v7 < a4 )
v6 = v7;
v10 = v8 / v6;
goto LABEL_20;
case 3:
if ( v7 >= a4 )
{
LABEL_22:
*a5 = 0.0;
return 0;
}
v12 = a4 - v7;
v13 = v8 / v7;
v10 = (float)(v12 / (float)(a4 - v8)) * (float)(v12 / (float)(a4 - v8));
if ( v13 < v10 )
v10 = v13;
LABEL_20:
*a5 = v10;
break;
case 4:
goto LABEL_13;
default:
return 0;
}
}
return 0;
}