//
// sub_E82EA8 from 0xe82ea8 to 0xe83038 (400 bytes)
//
// 1 xrefs:
// > sub_E82464 @ 0xe82a30
//
// 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:47 +0000
//
__int64 __fastcall sub_E82EA8(__int64 a1, _WORD **a2)
{
__int64 v4; // x24
__int64 v5; // x3
int v6; // w4
unsigned __int8 *v7; // x5
__int64 v8; // x19
int v9; // w21
__int64 v10; // x1
int v11; // w2
int v12; // w19
int v13; // w4
int v15; // w3
__int64 v16; // x2
int v17; // w1
unsigned int (*v18)(void); // x3
int v19; // w0
int v20; // w1
int v21; // w0
unsigned __int8 *v22; // [xsp+48h] [xbp+48h] BYREF
__int64 v23; // [xsp+50h] [xbp+50h]
__int64 v24; // [xsp+58h] [xbp+58h]
int v25; // [xsp+60h] [xbp+60h]
__int64 v26; // [xsp+68h] [xbp+68h]
v4 = *(_QWORD *)(a1 + 624);
if ( *(_DWORD *)(a1 + 372) && !*(_DWORD *)(v4 + 64) )
{
v15 = *(_DWORD *)(v4 + 32);
v16 = *(_QWORD *)(a1 + 616);
v17 = v15 + 7;
if ( v15 >= 0 )
v17 = *(_DWORD *)(v4 + 32);
v18 = *(unsigned int (**)(void))(v16 + 16);
*(_DWORD *)(v16 + 36) += v17 >> 3;
*(_DWORD *)(v4 + 32) = 0;
if ( !v18() )
return 0;
v19 = *(_DWORD *)(a1 + 448);
if ( v19 > 0 )
memset((void *)(v4 + 44), 0, 4 * ((unsigned int)(v19 - 1) + 1LL));
v20 = *(_DWORD *)(a1 + 372);
v21 = *(_DWORD *)(a1 + 572);
*(_DWORD *)(v4 + 40) = 0;
*(_DWORD *)(v4 + 64) = v20;
if ( !v21 )
*(_DWORD *)(v4 + 60) = 0;
}
v5 = *(_QWORD *)(a1 + 40);
v6 = *(_DWORD *)(a1 + 496);
v7 = *(unsigned __int8 **)v5;
v8 = *(_QWORD *)(v5 + 8);
v9 = 1 << *(_DWORD *)(a1 + 552);
v26 = a1;
v22 = v7;
v23 = v8;
v10 = *(_QWORD *)(v4 + 24);
v11 = *(_DWORD *)(v4 + 32);
if ( v6 > 0 )
{
v12 = 0;
do
{
++v12;
if ( v11 <= 0 )
{
if ( !(unsigned int)sub_E8045C(&v22, v10, v11, 1) )
return 0;
v10 = v24;
v11 = v25;
v6 = *(_DWORD *)(a1 + 496);
}
if ( ((v10 >> --v11) & 1) != 0 )
**a2 |= v9;
++a2;
}
while ( v12 < v6 );
v5 = *(_QWORD *)(a1 + 40);
v7 = v22;
v8 = v23;
}
v13 = *(_DWORD *)(v4 + 64);
*(_QWORD *)(v5 + 8) = v8;
*(_QWORD *)v5 = v7;
*(_QWORD *)(v4 + 24) = v10;
*(_DWORD *)(v4 + 32) = v11;
*(_DWORD *)(v4 + 64) = v13 - 1;
return 1;
}