//
// sub_1004508E8 from 0x1004508e8 to 0x1004509b4 (204 bytes)
//
// 1 xrefs:
// > ??> @ 0x1008274d0
//
// 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_1004508E8(__int64 a1)
{
__int64 v2; // x19
int v3; // w8
unsigned int *v4; // x8
unsigned int v5; // w9
__int64 v6; // x0
v2 = sub_100436D80(*(_QWORD *)(a1 + 72), *(_QWORD *)(a1 + 48), *(_QWORD *)(a1 + 104), 0, 1);
if ( !(_DWORD)v2 )
{
memcpy(
(void *)(*(_QWORD *)(a1 + 96) + 8LL * (*(_DWORD *)(a1 + 16) + 1) * *(_DWORD *)(a1 + 40)),
*(const void **)(a1 + 104),
8 * (*(int *)(a1 + 16) + 1LL));
v3 = *(_DWORD *)(a1 + 40);
*(_DWORD *)(a1 + 40) = v3 - 1;
if ( v3 <= 0 )
*(_DWORD *)(a1 + 40) = *(_DWORD *)(a1 + 32) - 1;
v4 = (unsigned int *)(a1 + 136);
do
v5 = __ldaxr(v4);
while ( __stlxr(v5 + 1, v4) );
v6 = qword_100871B90[86 * *(unsigned int *)(*(_QWORD *)(a1 + 8) + 69816LL) + 37 + 43 * *(int *)(a1 + 168)];
if ( v6 )
sub_1004B5DD4(v6);
}
return v2;
}