//
// sub_1004E6BAC from 0x1004e6bac to 0x1004e6cc4 (280 bytes)
//
// 1 xrefs:
// > sub_10042E2AC @ 0x10042e578
//
// 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
//
unsigned int __fastcall sub_1004E6BAC(int *a1)
{
int v1; // w19
int v2; // w20
float v3; // s0
unsigned int result; // w0
unsigned int v5; // w9
unsigned int v6; // w12
int v7; // w11
int v8; // w10
int32x4_t v9; // q2
int32x4_t v10; // q3
int32x4_t v11; // q0
unsigned int v12; // w10
int32x4_t v13; // q1
int32x4_t v14; // q4
int32x4_t v15; // q5
int8x16_t v16; // q2
int8x16_t v17; // q0
unsigned int v18; // w12
v2 = *a1;
v1 = a1[1];
v3 = pow((float)v1, (float)(1.0 / (float)*a1));
result = vcvtms_s32_f32(v3);
while ( 1 )
{
if ( v2 < 1 )
{
v8 = 1;
v7 = 1;
goto LABEL_14;
}
v5 = result + 1;
if ( (unsigned int)v2 < 8 )
{
v6 = 0;
v7 = 1;
v8 = 1;
LABEL_12:
v18 = v2 - v6;
do
{
v8 *= result;
v7 *= v5;
--v18;
}
while ( v18 );
goto LABEL_14;
}
v9 = vdupq_n_s32(result);
v10 = vdupq_n_s32(v5);
v11.i64[0] = 0x100000001LL;
v11.i64[1] = 0x100000001LL;
v12 = v2 & 0xFFFFFFF8;
v13.i64[0] = 0x100000001LL;
v13.i64[1] = 0x100000001LL;
v14.i64[0] = 0x100000001LL;
v14.i64[1] = 0x100000001LL;
v15.i64[0] = 0x100000001LL;
v15.i64[1] = 0x100000001LL;
do
{
v14 = vmulq_s32(v14, v9);
v15 = vmulq_s32(v15, v9);
v11 = vmulq_s32(v11, v10);
v13 = vmulq_s32(v13, v10);
v12 -= 8;
}
while ( v12 );
v16 = (int8x16_t)vmulq_s32(v15, v14);
*(int32x2_t *)v16.i8 = vmul_s32(*(int32x2_t *)v16.i8, (int32x2_t)vextq_s8(v16, v16, 8u));
v8 = v16.i32[0] * v16.i32[1];
v17 = (int8x16_t)vmulq_s32(v13, v11);
*(int32x2_t *)v17.i8 = vmul_s32(*(int32x2_t *)v17.i8, (int32x2_t)vextq_s8(v17, v17, 8u));
v7 = v17.i32[0] * v17.i32[1];
v6 = v2 & 0xFFFFFFF8;
if ( v2 != (v2 & 0xFFFFFFF8) )
goto LABEL_12;
LABEL_14:
if ( v8 <= v1 && v7 > v1 )
return result;
if ( v8 <= v1 )
++result;
else
--result;
}
}