//
// sub_66D84 from 0x66d84 to 0x66e18 (148 bytes)
//
// 4 xrefs:
// > sub_51A54 @ 0x51b84
// > sub_5470C @ 0x54a28
// > sub_688D4 @ 0x68984
// > sub_78B30 @ 0x7a3c0
//
// 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 12:13:55 +0000
//
__int64 __fastcall sub_66D84(__int64 a1)
{
__int64 v1; // x8
unsigned int v3; // w20
unsigned int v4; // w8
__int64 result; // x0
__int64 v6; // x0
unsigned int v7; // w8
unsigned int *v8; // x8
unsigned int v9; // w9
v1 = *(_QWORD *)(a1 + 384);
if ( !v1 )
goto LABEL_10;
if ( (*(_BYTE *)(a1 + 45) & 4) != 0 )
{
v4 = *(_DWORD *)(v1 + 68);
}
else
{
v3 = *(_DWORD *)(a1 + 68);
v4 = *(_DWORD *)(v1 + 68);
if ( v3 <= v4 )
goto LABEL_7;
}
v3 = v4;
LABEL_7:
result = sub_66A00(a1, 0, v3, nullptr);
if ( (result & 0xFFFFFFEF) != 0 )
return result;
v6 = *(_QWORD *)(a1 + 384);
v7 = *(_DWORD *)(v6 + 68);
if ( v7 > v3 )
sub_67F54(v6, v3, v7 - v3);
LABEL_10:
v8 = (unsigned int *)(a1 + 88);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 & 0xFFFFFFEF, v8) );
return 0;
}