//
// jinit_upsampler from 0xe8bc1c to 0xe8be2c (528 bytes)
//
// 2 xrefs:
// > jinit_master_decompress @ 0xe8a1f4
// > ??> @ 0xf0b38
//
// 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 jinit_upsampler(void (__fastcall ***a1)(_QWORD))
{
__int64 v2; // x27
int v3; // w1
__int64 result; // x0
_DWORD *v5; // x20
int *v6; // x26
_QWORD *v7; // x24
int v8; // w25
_BYTE *i; // x27
int v10; // w4
int v11; // w6
int v12; // w2
int v13; // w0
int v14; // w3
int v15; // w1
int v16; // w5
int v17; // w1
void (__fastcall *v18)(_QWORD); // x28
__int64 v19; // x0
void (__fastcall *v20)(_QWORD); // x2
void (__fastcall *v21)(_QWORD); // x2
v2 = ((__int64 (*)(void))*a1[1])();
a1[80] = (void (__fastcall **)(_QWORD))v2;
v3 = *((_DWORD *)a1 + 100);
*(_QWORD *)v2 = sub_E8B448;
*(_DWORD *)(v2 + 16) = 0;
*(_QWORD *)(v2 + 8) = sub_E8B460;
if ( v3 )
{
v21 = **a1;
*((_DWORD *)*a1 + 10) = 26;
v21(a1);
}
result = *((unsigned int *)a1 + 14);
v5 = a1[38];
if ( (int)result > 0 )
{
v6 = (int *)(v2 + 192);
v7 = (_QWORD *)(v2 + 24);
v8 = 0;
for ( i = (_BYTE *)(v2 + 232); ; ++i )
{
while ( 1 )
{
v10 = v5[13];
v11 = v5[9];
v12 = v5[2];
v13 = v5[3] * v5[10] / *((_DWORD *)a1 + 107);
v14 = *((_DWORD *)a1 + 104);
v15 = *((_DWORD *)a1 + 106);
v16 = *((_DWORD *)a1 + 105);
*v6 = v13;
if ( v10 )
break;
v7[10] = sub_E8B5C8;
LABEL_6:
result = *((unsigned int *)a1 + 14);
++v8;
v5 += 24;
++v6;
++v7;
++i;
if ( (int)result <= v8 )
return result;
}
v17 = v12 * v11 / v15;
if ( v13 != v16 || v17 != v14 )
break;
++v8;
v7[10] = sub_E8B5C0;
result = *((unsigned int *)a1 + 14);
v5 += 24;
++v6;
++v7;
if ( (int)result <= v8 )
return result;
}
if ( v14 != 2 * v17 )
goto LABEL_13;
if ( v13 == v16 )
{
v7[10] = sub_E8B5D0;
}
else
{
if ( v16 != 2 * v13 )
{
LABEL_13:
if ( v14 % v17 || v16 % v13 )
{
v20 = **a1;
*((_DWORD *)*a1 + 10) = 39;
v20(a1);
}
else
{
v7[10] = sub_E8B848;
*i = v14 / v17;
i[10] = v16 / v13;
}
goto LABEL_16;
}
v7[10] = sub_E8B954;
}
LABEL_16:
v18 = a1[1][2];
v19 = jround_up(*((unsigned int *)a1 + 34), *((int *)a1 + 104));
*v7 = ((__int64 (__fastcall *)(void (__fastcall ***)(_QWORD), __int64, __int64, _QWORD))v18)(
a1,
1,
v19,
*((unsigned int *)a1 + 105));
goto LABEL_6;
}
return result;
}