//
// sub_1004A1548 from 0x1004a1548 to 0x1004a15ac (100 bytes)
//
// 8 xrefs:
// > sub_10043E2C8 @ 0x10043e630
// > sub_1004661D0 @ 0x100468710
// > sub_1004661D0 @ 0x1004687ac
// > sub_1004661D0 @ 0x1004687c4
// > sub_10046BCA0 @ 0x10046c4c0
// > sub_10046DFAC @ 0x10046ed9c
// > sub_10047CDD0 @ 0x10047dd9c
// > sub_10048319C @ 0x100484410
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_1004A1548(__int64 a1, int a2, int a3)
{
__int16 v3; // w8
unsigned int *v4; // x8
unsigned int v5; // w9
unsigned int v6; // w9
if ( a3 )
{
v3 = atomic_load((unsigned int *)(a1 + 100));
if ( a2 != (unsigned __int16)(v3 & 0x2000) >> 13 )
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 168) + 67512LL) + 48LL) = 1;
}
v4 = (unsigned int *)(a1 + 100);
if ( (a2 & 1) != 0 )
{
do
v5 = __ldaxr(v4);
while ( __stlxr(v5 | 0x2000, v4) );
}
else
{
do
v6 = __ldaxr(v4);
while ( __stlxr(v6 & 0xFFFFDFFF, v4) );
}
return 0;
}