//
// sub_CA77C from 0xca77c to 0xca954 (472 bytes)
//
// 0 xrefs:
//
// 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_CA77C(int *a1, int a2, __int64 *a3, int a4)
{
int i; // r5
int v9; // r0
int v10; // r2
float *v11; // r1
float *v12; // r3
int j; // r0
float v14; // s0
int v15; // r9
int v16; // r0
int v17; // r2
int v18; // r1
float *v19; // r0
int v20; // r1
int v21; // r1
int v22; // r1
int v23; // r1
int v24; // r1
int v25; // r1
int v26; // r1
float *v27; // r3
float *v28; // r2
float v29; // s0
float *v30; // r2
float *v31; // r2
float v32; // s0
float *v33; // r2
float *v34; // r2
float v35; // s0
float *v36; // r2
float *v37; // r2
float v38; // s0
float *v39; // r2
float *v40; // r2
float v41; // s0
float *v42; // r2
float *v43; // r2
float v44; // s0
float *v45; // r2
float v46; // s0
float *v47; // r0
if ( a1[2] >= 1 )
{
if ( *a1 <= 8 )
{
v15 = 0;
while ( v15 < a4 )
{
v16 = sub_CA5FC(a1, a3);
if ( v16 == -1 )
return -1;
v17 = *a1;
v18 = a1[4];
switch ( *a1 )
{
case 1:
v19 = (float *)(v18 + 4 * v16 * v17);
v20 = 0;
goto LABEL_28;
case 2:
v19 = (float *)(v18 + 4 * v16 * v17);
v21 = 0;
goto LABEL_27;
case 3:
v19 = (float *)(v18 + 4 * v16 * v17);
v22 = 0;
goto LABEL_26;
case 4:
v19 = (float *)(v18 + 4 * v16 * v17);
v23 = 0;
goto LABEL_25;
case 5:
v19 = (float *)(v18 + 4 * v16 * v17);
v24 = 0;
goto LABEL_24;
case 6:
v19 = (float *)(v18 + 4 * v16 * v17);
v25 = 0;
goto LABEL_23;
case 7:
v19 = (float *)(v18 + 4 * v16 * v17);
v26 = 0;
goto LABEL_22;
case 8:
v27 = (float *)(a2 + 4 * v15++);
v19 = (float *)(v18 + 4 * v16 * v17);
v26 = 1;
*v27 = *v27 + *v19;
LABEL_22:
v28 = &v19[v26];
v25 = v26 + 1;
v29 = *v28;
v30 = (float *)(a2 + 4 * v15++);
*v30 = *v30 + v29;
LABEL_23:
v31 = &v19[v25];
v24 = v25 + 1;
v32 = *v31;
v33 = (float *)(a2 + 4 * v15++);
*v33 = *v33 + v32;
LABEL_24:
v34 = &v19[v24];
v23 = v24 + 1;
v35 = *v34;
v36 = (float *)(a2 + 4 * v15++);
*v36 = *v36 + v35;
LABEL_25:
v37 = &v19[v23];
v22 = v23 + 1;
v38 = *v37;
v39 = (float *)(a2 + 4 * v15++);
*v39 = *v39 + v38;
LABEL_26:
v40 = &v19[v22];
v21 = v22 + 1;
v41 = *v40;
v42 = (float *)(a2 + 4 * v15++);
*v42 = *v42 + v41;
LABEL_27:
v43 = &v19[v21];
v20 = v21 + 1;
v44 = *v43;
v45 = (float *)(a2 + 4 * v15++);
*v45 = *v45 + v44;
LABEL_28:
v46 = v19[v20];
v47 = (float *)(a2 + 4 * v15++);
*v47 = *v47 + v46;
break;
default:
continue;
}
}
}
else
{
for ( i = 0; i < a4; i += j )
{
v9 = sub_CA5FC(a1, a3);
if ( v9 == -1 )
return -1;
v10 = *a1;
v11 = (float *)(a2 + 4 * i);
v12 = (float *)(a1[4] + 4 * v9 * *a1);
for ( j = 0; j < v10; ++j )
{
v14 = *v12++;
*v11 = *v11 + v14;
++v11;
}
}
}
}
return 0;
}