//
// sub_91CD0 from 0x91cd0 to 0x91eb4 (484 bytes)
//
// 2 xrefs:
// > sub_91F10 @ 0x91fac
// > sub_947DC @ 0x947e0
//
// 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 sub_91CD0(__int64 a1, __int16 a2, int a3, _DWORD *a4, double a5, float a6, float a7)
{
__int64 v7; // x8
int v8; // w9
__int64 v9; // x10
int v10; // w14
__int64 v11; // x13
int v12; // w15
int v13; // w14
int v14; // s2
float v15; // s2
__int64 v16; // x13
float v17; // s1
v7 = 0;
v8 = 0;
v9 = 0;
LOBYTE(v10) = 0;
*a4 = 0;
while ( v9 < *(int *)(a1 + 748) )
{
v11 = *(_QWORD *)(a1 + 752);
if ( *(unsigned __int16 *)(v11 + v7 + 4) != a3 )
goto LABEL_48;
v12 = *(unsigned __int16 *)(v11 + v7);
switch ( *(_WORD *)(v11 + v7) )
{
case 0:
a6 = 1.0;
if ( (a2 & 1) != 0 )
goto LABEL_31;
goto LABEL_48;
case 1:
a6 = 1.0;
if ( (a2 & 2) != 0 )
goto LABEL_31;
goto LABEL_48;
case 2:
if ( (a2 & 4) != 0 )
{
LOBYTE(a6) = *(_BYTE *)(a1 + 744);
goto LABEL_23;
}
goto LABEL_48;
case 3:
if ( (a2 & 8) != 0 )
{
LOBYTE(a6) = *(_BYTE *)(a1 + 736);
LABEL_23:
a7 = 0.0078125;
a6 = (float)LODWORD(a6) * 0.0078125;
goto LABEL_31;
}
goto LABEL_48;
case 4:
a6 = 1.0;
if ( (a2 & 0x10) != 0 )
goto LABEL_31;
goto LABEL_48;
case 5:
a6 = 1.0;
if ( (a2 & 0x20) != 0 )
goto LABEL_31;
goto LABEL_48;
case 6:
a6 = 1.0;
if ( (a2 & 0x40) != 0 )
goto LABEL_31;
goto LABEL_48;
default:
switch ( v12 )
{
case 129:
a6 = 1.0;
if ( (a2 & 0x80) == 0 )
goto LABEL_48;
goto LABEL_31;
case 135:
a6 = 1.0;
if ( (a2 & 0x100) == 0 )
goto LABEL_48;
LABEL_31:
v13 = *(unsigned __int16 *)(v11 + v7 + 2);
if ( v13 != 139 )
{
if ( v13 == 3 )
{
LOBYTE(a7) = *(_BYTE *)(a1 + 736);
LABEL_40:
v15 = (float)LODWORD(a7);
}
else
{
switch ( v13 )
{
case 129:
v14 = *(_DWORD *)(*(_QWORD *)(a1 + 792) + 872LL);
break;
case 135:
v14 = *(_DWORD *)(*(_QWORD *)(a1 + 792) + 876LL);
break;
case 138:
v14 = *(_DWORD *)(*(_QWORD *)(a1 + 792) + 880LL);
break;
default:
a7 = 1.0;
if ( v13 == 2 )
{
LOBYTE(a7) = *(_BYTE *)(a1 + 744);
goto LABEL_40;
}
LABEL_46:
v16 = v11 + v7;
v10 = *(unsigned __int16 *)(v16 + 6);
if ( v10 != 1 )
{
v17 = a7 * a6;
LOBYTE(v10) = 1;
a7 = (float)*(int *)(v16 + 8);
a6 = v17 * a7;
v8 += (int)a6;
*a4 = v8;
}
goto LABEL_48;
}
LABEL_44:
v15 = (float)v14;
}
a7 = v15 * 0.0078125;
goto LABEL_46;
}
v14 = *(_DWORD *)(*(_QWORD *)(a1 + 792) + 884LL);
goto LABEL_44;
case 138:
a6 = 1.0;
if ( (a2 & 0x200) == 0 )
goto LABEL_48;
goto LABEL_31;
}
a6 = 1.0;
if ( v12 != 139 )
goto LABEL_31;
a6 = 1.0;
if ( (a2 & 0x400) != 0 )
goto LABEL_31;
LABEL_48:
++v9;
v7 += 12;
break;
}
}
if ( (v10 & 1) != 0 )
return 0;
else
return 31;
}