//
// sub_E8B954 from 0xe8b954 to 0xe8bc1c (712 bytes)
//
// 2 xrefs:
// > jinit_upsampler @ 0xe8bc90
// > jinit_upsampler @ 0xe8bcac
//
// 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_E8B954(__int64 a1, __int64 a2, __int64 a3, __int64 *a4)
{
__int64 result; // x0
__int64 v7; // x22
__int64 v8; // x21
int v9; // w20
size_t v10; // x5
char *v11; // x1
char *v12; // x0
unsigned __int64 v13; // x2
_BYTE *v14; // x3
unsigned __int64 v15; // x5
unsigned __int64 v16; // x6
bool v17; // cc
unsigned __int64 v18; // x4
__int64 v19; // x5
int8x16_t *v20; // x8
char *v21; // x7
unsigned __int64 v22; // x3
int8x16_t v23; // t1
char v24; // w4
char v25; // w4
char v26; // w4
char v27; // w4
char v28; // w4
char v29; // w4
char v30; // w4
char v31; // w4
char v32; // w4
char v33; // w4
char v34; // w4
char v35; // w4
char v36; // w4
char v37; // w4
char v38; // w1
int v39; // w1
int v40; // w3
char *v41; // x1
char v42; // t1
_BYTE *v43; // x0
char *v44; // x3
char v45; // t1
int8x16x2_t v46; // 0:q0.16,16:q1.16
result = *(unsigned int *)(a1 + 420);
v7 = *a4;
v8 = 0;
v9 = 0;
if ( (int)result > 0 )
{
while ( 1 )
{
v10 = *(unsigned int *)(a1 + 136);
v11 = *(char **)(a3 + v8);
v12 = *(char **)(v7 + 2 * v8);
v13 = (unsigned __int64)&v12[(unsigned int)v10];
if ( (unsigned __int64)v12 < v13 )
break;
LABEL_27:
v39 = v9;
v40 = v9 + 1;
v9 += 2;
v8 += 8;
jcopy_sample_rows(v7, v39, v7, v40, 1, v10);
result = *(unsigned int *)(a1 + 420);
if ( (int)result <= v9 )
return result;
}
v14 = v12 + 2;
v15 = (unsigned int)v10 - 1LL;
v16 = (v15 >> 1) + 1;
if ( v11 < &v12[2 * v16] && v12 < &v11[v16] || v16 <= 0xF )
{
do
{
v42 = *v11;
v41 = v11 + 1;
v17 = v13 > (unsigned __int64)v14;
*v12 = v42;
v43 = v14;
*(v14 - 1) = v42;
v44 = v14 + 2;
if ( !v17 )
break;
v45 = *v41;
v11 = v41 + 1;
v17 = v13 > (unsigned __int64)v44;
*v43 = v45;
v12 = v44;
*(v44 - 1) = v45;
v14 = v44 + 2;
}
while ( v17 );
goto LABEL_26;
}
v17 = v15 > 0x1D;
v18 = (((v15 >> 1) - 15) >> 4) + 1;
v19 = 16 * v18;
if ( v17 )
{
v20 = *(int8x16_t **)(a3 + v8);
v21 = *(char **)(v7 + 2 * v8);
v22 = 0;
do
{
v23 = *v20++;
++v22;
v46.val[0] = v23;
v46.val[1] = v23;
vst2q_s8(v21, v46);
v21 += 32;
}
while ( v18 > v22 );
v11 += v19;
v12 += 32 * v18;
if ( v16 == v19 )
{
LABEL_26:
v10 = *(unsigned int *)(a1 + 136);
goto LABEL_27;
}
v14 = v12 + 2;
}
v24 = *v11;
*v12 = *v11;
v12[1] = v24;
if ( v13 > (unsigned __int64)v14 )
{
v25 = v11[1];
v12[2] = v25;
v12[3] = v25;
if ( v13 > (unsigned __int64)(v12 + 4) )
{
v26 = v11[2];
v12[4] = v26;
v12[5] = v26;
if ( v13 > (unsigned __int64)(v12 + 6) )
{
v27 = v11[3];
v12[6] = v27;
v12[7] = v27;
if ( v13 > (unsigned __int64)(v12 + 8) )
{
v28 = v11[4];
v12[8] = v28;
v12[9] = v28;
if ( v13 > (unsigned __int64)(v12 + 10) )
{
v29 = v11[5];
v12[10] = v29;
v12[11] = v29;
if ( v13 > (unsigned __int64)(v12 + 12) )
{
v30 = v11[6];
v12[12] = v30;
v12[13] = v30;
if ( v13 > (unsigned __int64)(v12 + 14) )
{
v31 = v11[7];
v12[14] = v31;
v12[15] = v31;
if ( v13 > (unsigned __int64)(v12 + 16) )
{
v32 = v11[8];
v12[16] = v32;
v12[17] = v32;
if ( v13 > (unsigned __int64)(v12 + 18) )
{
v33 = v11[9];
v12[18] = v33;
v12[19] = v33;
if ( v13 > (unsigned __int64)(v12 + 20) )
{
v34 = v11[10];
v12[20] = v34;
v12[21] = v34;
if ( v13 > (unsigned __int64)(v12 + 22) )
{
v35 = v11[11];
v12[22] = v35;
v12[23] = v35;
if ( v13 > (unsigned __int64)(v12 + 24) )
{
v36 = v11[12];
v12[24] = v36;
v12[25] = v36;
if ( v13 > (unsigned __int64)(v12 + 26) )
{
v37 = v11[13];
v12[26] = v37;
v12[27] = v37;
if ( v13 > (unsigned __int64)(v12 + 28) )
{
v38 = v11[14];
v12[28] = v38;
v12[29] = v38;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
goto LABEL_26;
}
return result;
}