//
// sub_1005181B4 from 0x1005181b4 to 0x100518264 (176 bytes)
//
// 3 xrefs:
// > NewsPopup::init @ 0x100518138
// > NewsPopup::musicActionFinished @ 0x100519a60
// > sub_100519A68 @ 0x100519a74
//
// 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:07:07 +0000
//
__int64 __fastcall sub_1005181B4(__int64 a1)
{
int v2; // w20
int v3; // w20
__int64 v4; // x1
if ( a1 + 680 != MusicDownloadManager::sharedState() + 840 )
sub_10051A044();
v2 = *(_DWORD *)(MusicDownloadManager::sharedState() + 868);
if ( v2 > *(_DWORD *)(GameManager::sharedState() + 1152) )
{
v3 = *(_DWORD *)(MusicDownloadManager::sharedState() + 868);
*(_DWORD *)(GameManager::sharedState() + 1152) = v3;
}
v4 = *(unsigned int *)(a1 + 704);
if ( (int)v4 >= (int)(-858993459 * ((*(_QWORD *)(a1 + 688) - *(_QWORD *)(a1 + 680)) >> 4)) )
{
v4 = 0;
*(_DWORD *)(a1 + 704) = 0;
}
return sub_100518264(a1, v4);
}