//
// sub_180022840 from 0x180022840 to 0x1800228b2 (114 bytes)
//
// 4 xrefs:
// > sub_18001FF20 @ 0x18001ff62
// > ??> @ 0x18017f914
// > ??> @ 0x18017f924
// > ??> @ 0x1801f7524
//
// This function is hookable on this platform (idp: pc, 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 10:52:58 +0000
//
__int64 __fastcall sub_180022840(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
unsigned int v4; // eax
unsigned int v5; // edi
int v7; // xmm6_4
v4 = *(_DWORD *)(a1 + 15296);
v5 = a3;
if ( (_DWORD)a3 != v4 )
{
if ( (unsigned int)a3 < v4 )
{
v7 = *(_DWORD *)(a1 + 15352);
sub_180020EF0(a1, 0, a3, a4);
v4 = *(_DWORD *)(a1 + 15296);
*(_DWORD *)(a1 + 15352) = v7;
}
if ( v4 < v5 )
{
do
{
LOBYTE(a2) = 1;
sub_1800250E0(a1, a2);
}
while ( *(_DWORD *)(a1 + 15296) < v5 );
}
}
return 0;
}