//
// sub_100581CE8 from 0x100581ce8 to 0x100581d34 (76 bytes)
//
// 2 xrefs:
// > sub_1005F921C @ 0x1005f9420
// > sub_1005F9448 @ 0x1005f951c
//
// 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 11:08:30 +0000
//
__int64 __fastcall sub_100581CE8(__int64 a1, int a2)
{
unsigned int v2; // w9
unsigned int v3; // w9
int v4; // w9
__int64 v5; // x8
v2 = *(_DWORD *)(a1 + 80);
if ( (a2 & 1) == 0 )
v2 = *(_DWORD *)(a1 + 468);
v3 = (unsigned __int16)(v2 >> 1);
if ( v3 <= 0xFFFD )
v4 = 2 * v3 + 2;
else
v4 = 2;
v5 = *(_DWORD *)(a1 + 80) & 0xFFFE0000 | v4 | 1;
*(_QWORD *)(a1 + 80) = v5;
if ( a2 )
*(_DWORD *)(a1 + 468) = v5;
return 0;
}