//
// sub_C65BCC from 0xc65bcc to 0xc65d94 (456 bytes)
//
// 2 xrefs:
// > sub_C665F0 @ 0xc66cf0
// > sub_C706DC @ 0xc70bc0
//
// 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_C65BCC(__int64 result, _DWORD *a2)
{
int v2; // w3
__int64 v4; // x19
int v5; // w0
int v6; // w2
int v7; // w3
int v8; // w0
int v9; // w4
int v10; // w3
int v11; // w0
int v12; // w3
int v13; // w4
int v14; // w3
int v15; // w0
int v16; // w3
int v17; // w3
int v18; // w2
if ( !result )
return result;
v2 = *(_DWORD *)(result + 44);
v4 = result;
if ( v2 < 0 )
goto LABEL_15;
if ( v2 > 100 )
{
v5 = a2[271];
v6 = 255;
if ( v5 <= 11 )
goto LABEL_5;
LABEL_23:
v8 = a2[279];
v9 = a2[272];
if ( v8 <= 11 )
goto LABEL_8;
LABEL_24:
v11 = a2[287];
v13 = v9 | a2[280];
if ( v11 <= 11 )
goto LABEL_11;
goto LABEL_25;
}
v6 = 255 * v2 / 100;
if ( !v6 )
goto LABEL_15;
v5 = a2[271];
if ( v5 > 11 )
goto LABEL_23;
LABEL_5:
if ( v5 < 0 )
v5 = 0;
v7 = dword_F51AF0[v5 + 20];
v8 = a2[279];
v9 = (v6 * v7) >> 3;
a2[272] = v9;
if ( v8 > 11 )
goto LABEL_24;
LABEL_8:
if ( v8 < 0 )
v8 = 0;
v10 = dword_F51AF0[v8 + 20];
v11 = a2[287];
v12 = (v6 * v10) >> 3;
a2[280] = v12;
v13 = v9 | v12;
if ( v11 <= 11 )
{
LABEL_11:
if ( v11 < 0 )
v11 = 0;
v14 = dword_F51AF0[v11 + 20];
v15 = a2[295];
v16 = (v6 * v14) >> 3;
a2[288] = v16;
v17 = v13 | v16;
if ( v15 > 11 )
{
LABEL_14:
if ( !(v17 | a2[296]) )
goto LABEL_15;
LABEL_29:
sub_CBABC0(a2 + 207, 1.0);
a2[206] = 1;
LODWORD(result) = *(_DWORD *)(v4 + 52);
if ( (int)result <= 100 )
goto LABEL_16;
LABEL_30:
a2[750] = 100;
return 100;
}
goto LABEL_26;
}
LABEL_25:
v15 = a2[295];
v17 = v13 | a2[288];
if ( v15 > 11 )
goto LABEL_14;
LABEL_26:
if ( v15 < 0 )
v15 = 0;
v18 = (v6 * dword_F51AF0[v15 + 20]) >> 3;
a2[296] = v18;
if ( v17 | v18 )
goto LABEL_29;
LABEL_15:
LODWORD(result) = *(_DWORD *)(v4 + 52);
if ( (int)result > 100 )
goto LABEL_30;
LABEL_16:
if ( (int)result < 0 )
result = 0;
else
result = (unsigned int)result;
a2[750] = result;
return result;
}