//
// sub_C6318 from 0xc6318 to 0xc6478 (352 bytes)
//
// 2 xrefs:
// > sub_C60F4 @ 0xc61b4
// > sub_C68BC @ 0xc6a70
//
// 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_C6318(__int64 result)
{
int v1; // w8
__int64 v2; // x10
int32x2_t *v3; // x9
__int64 v4; // x14
float v5; // s1
int v6; // s0
float v7; // s1
float v8; // s0
signed int v9; // w10
int8x16_t v10; // q1
int32x2_t v11; // d3
float32x2_t v12; // d2
float v13; // s3
float v14; // s2
__int64 v15; // x11
__int64 v16; // x8
float v17; // s1
int v18; // w13
float v19; // s1
int v20; // w13
_DWORD v21[32]; // [xsp+0h] [xbp-80h]
v1 = *(_DWORD *)(result + 992);
v2 = 0;
v3 = (int32x2_t *)(result + 580);
while ( v2 < v1 )
{
v4 = result + 4 * v2;
v5 = *(float *)(result + 656);
*(float *)&v21[v2 + 16] = v5 * (float)*(int *)(v4 + 664);
*(float *)&v21[v2++] = v5 * (float)*(int *)(v4 + 856);
}
v6 = *(_DWORD *)(result + 988);
v7 = *(float *)(result + 544);
*(_QWORD *)(result + 624) = 0;
v8 = (float)v6 / v7;
v9 = vcvtms_s32_f32(v8);
*(float *)(result + 656) = 1.0 / v8;
*(float *)(result + 612) = v8;
*(_DWORD *)(result + 616) = v9;
*(float *)(result + 620) = v8 - floorf(v8);
v10 = *(int8x16_t *)v3->n64_u64;
v11.n64_u64[0] = vextq_s8(v10, v10, 8u).n128_u64[0];
v12.n64_u64[0] = vmul_n_f32(
vsub_f32(vzip2_s32((int32x2_t)v3->n64_u64[0], v11), vzip1_s32((int32x2_t)v3->n64_u64[0], v11)),
*(float *)(result + 660) * v8).n64_u64[0];
*(float32x2_t *)(result + 632) = v12;
if ( v12.n64_f32[0] <= 0.0 )
{
*(_DWORD *)(result + 632) = 0;
v13 = 0.0;
}
else
{
v13 = *(float *)(result + 548) / v12.n64_f32[0];
}
*(float *)(result + 640) = v13;
if ( v12.n64_f32[1] <= 0.0 )
{
*(_DWORD *)(result + 636) = 0;
v14 = 0.0;
}
else
{
v14 = *(float *)(result + 548) / v12.n64_f32[1];
}
v15 = 0;
*(float *)(result + 644) = v14;
*(int32x4_t *)(result + 596) = vcvtq_s32_f32(vmulq_n_f32(v10, v8));
while ( v15 < v1 )
{
v16 = result + 4 * v15;
v17 = *(float *)&v21[v15 + 16] * v8;
v18 = (int)v17;
if ( v8 <= truncf(v17) )
v18 = 0;
*(_DWORD *)(v16 + 664) = v18;
v19 = *(float *)&v21[v15++];
v20 = (int)(float)(v19 * v8);
if ( v9 <= v20 )
v20 = 0;
*(_DWORD *)(v16 + 856) = v20;
v1 = *(_DWORD *)(result + 992);
}
return result;
}