//
// sub_180022840 from 0x180022840 to 0x1800228b2 (114 bytes)
//
// 4 xrefs:
// > sub_18001FF20 @ 0x18001ff62
// > ??> @ 0x18017f914
// > ??> @ 0x18017f924
// > ??> @ 0x1801f7524
//
// 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_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;
}