//
// sub_1004507B4 from 0x1004507b4 to 0x1004508e8 (308 bytes)
//
// 1 xrefs:
// > ??> @ 0x100827490
//
// 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_1004507B4(__int64 a1)
{
__int64 v2; // x20
__int64 **v3; // x8
__int64 *v4; // x23
__int64 v5; // x21
unsigned int *v6; // x28
int v7; // w8
unsigned int v8; // w8
int v9; // w8
v2 = qword_1008732D0[2 * *(int *)(a1 + 336) + *(int *)(a1 + 340)];
sub_1004B5C70(v2);
v3 = (__int64 **)&qword_100873110[6 * *(int *)(a1 + 336) + 3 * *(int *)(a1 + 340)];
v4 = *v3;
if ( *v3 != (__int64 *)v3 )
{
do
{
v5 = v4[2];
v6 = (unsigned int *)(v5 + 136);
v7 = atomic_load((unsigned int *)(v5 + 136));
if ( v7 >= 1 )
{
do
{
sub_1004D8560(*(_QWORD *)(v5 + 8) + 60LL * *(int *)(a1 + 340) + 68088);
sub_100451774(v5);
do
v8 = __ldaxr(v6);
while ( __stlxr(v8 - 1, v6) );
sub_1004D858C(*(_QWORD *)(v5 + 8) + 60LL * *(int *)(a1 + 340) + 68088, 90);
v9 = atomic_load((unsigned int *)(v5 + 136));
}
while ( v9 > 0 );
}
v4 = (__int64 *)*v4;
}
while ( v4 != &qword_100873110[6 * *(int *)(a1 + 336) + 3 * *(int *)(a1 + 340)] );
}
sub_1004B5CA0(v2);
return 0;
}