//
// sub_E8B5D0 from 0xe8b5d0 to 0xe8b848 (632 bytes)
//
// 2 xrefs:
// > jinit_upsampler @ 0xe8bc94
// > jinit_upsampler @ 0xe8bcb0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:10:53 +0000
//
__int64 __fastcall sub_E8B5D0(__int64 result, __int64 a2, __int64 a3, __int64 *a4)
{
int v4; // w5
__int64 v5; // x11
__int64 v6; // x8
char *v7; // x1
char *v8; // x3
unsigned __int64 v9; // x4
_BYTE *v10; // x5
unsigned __int64 v11; // x7
unsigned __int64 v12; // x9
bool v13; // cc
unsigned __int64 v14; // x6
__int64 v15; // x7
int8x16_t *v16; // x12
char *v17; // x10
unsigned __int64 v18; // x5
int8x16_t v19; // t1
char v20; // w6
char v21; // w6
char v22; // w6
char v23; // w6
char v24; // w6
char v25; // w6
char v26; // w6
char v27; // w6
char v28; // w6
char v29; // w6
char v30; // w6
char v31; // w6
char v32; // w6
char v33; // w6
char v34; // w3
char *v35; // x3
char v36; // t1
_BYTE *v37; // x1
char *v38; // x5
char v39; // t1
int8x16x2_t v40; // 0:q0.16,16:q1.16
v4 = *(_DWORD *)(result + 420);
v5 = *a4;
v6 = 0;
if ( v4 > 0 )
{
while ( 1 )
{
v7 = *(char **)(v5 + 8 * v6);
v8 = *(char **)(a3 + 8 * v6);
v9 = (unsigned __int64)&v7[*(unsigned int *)(result + 136)];
if ( (unsigned __int64)v7 < v9 )
break;
LABEL_27:
if ( (int)++v6 >= v4 )
return result;
}
v10 = v7 + 2;
v11 = *(unsigned int *)(result + 136) - 1LL;
v12 = (v11 >> 1) + 1;
if ( v8 < &v7[2 * v12] && v7 < &v8[v12] || v12 <= 0xF )
{
do
{
v36 = *v8;
v35 = v8 + 1;
v13 = v9 > (unsigned __int64)v10;
*v7 = v36;
v37 = v10;
*(v10 - 1) = v36;
v38 = v10 + 2;
if ( !v13 )
break;
v39 = *v35;
v8 = v35 + 1;
v13 = v9 > (unsigned __int64)v38;
*v37 = v39;
v7 = v38;
*(v38 - 1) = v39;
v10 = v38 + 2;
}
while ( v13 );
goto LABEL_26;
}
v13 = v11 > 0x1D;
v14 = (((v11 >> 1) - 15) >> 4) + 1;
v15 = 16 * v14;
if ( v13 )
{
v16 = *(int8x16_t **)(a3 + 8 * v6);
v17 = *(char **)(v5 + 8 * v6);
v18 = 0;
do
{
v19 = *v16++;
++v18;
v40.val[0] = v19;
v40.val[1] = v19;
vst2q_s8(v17, v40);
v17 += 32;
}
while ( v14 > v18 );
v8 += v15;
v7 += 32 * v14;
if ( v12 == v15 )
{
LABEL_26:
v4 = *(_DWORD *)(result + 420);
goto LABEL_27;
}
v10 = v7 + 2;
}
v20 = *v8;
*v7 = *v8;
v7[1] = v20;
if ( v9 > (unsigned __int64)v10 )
{
v21 = v8[1];
v7[2] = v21;
v7[3] = v21;
if ( v9 > (unsigned __int64)(v7 + 4) )
{
v22 = v8[2];
v7[4] = v22;
v7[5] = v22;
if ( v9 > (unsigned __int64)(v7 + 6) )
{
v23 = v8[3];
v7[6] = v23;
v7[7] = v23;
if ( v9 > (unsigned __int64)(v7 + 8) )
{
v24 = v8[4];
v7[8] = v24;
v7[9] = v24;
if ( v9 > (unsigned __int64)(v7 + 10) )
{
v25 = v8[5];
v7[10] = v25;
v7[11] = v25;
if ( v9 > (unsigned __int64)(v7 + 12) )
{
v26 = v8[6];
v7[12] = v26;
v7[13] = v26;
if ( v9 > (unsigned __int64)(v7 + 14) )
{
v27 = v8[7];
v7[14] = v27;
v7[15] = v27;
if ( v9 > (unsigned __int64)(v7 + 16) )
{
v28 = v8[8];
v7[16] = v28;
v7[17] = v28;
if ( v9 > (unsigned __int64)(v7 + 18) )
{
v29 = v8[9];
v7[18] = v29;
v7[19] = v29;
if ( v9 > (unsigned __int64)(v7 + 20) )
{
v30 = v8[10];
v7[20] = v30;
v7[21] = v30;
if ( v9 > (unsigned __int64)(v7 + 22) )
{
v31 = v8[11];
v7[22] = v31;
v7[23] = v31;
if ( v9 > (unsigned __int64)(v7 + 24) )
{
v32 = v8[12];
v7[24] = v32;
v7[25] = v32;
if ( v9 > (unsigned __int64)(v7 + 26) )
{
v33 = v8[13];
v7[26] = v33;
v7[27] = v33;
if ( v9 > (unsigned __int64)(v7 + 28) )
{
v34 = v8[14];
v7[28] = v34;
v7[29] = v34;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
goto LABEL_26;
}
return result;
}