//
// sub_1800024C0 from 0x1800024c0 to 0x180002542 (130 bytes)
//
// 3 xrefs:
// > sub_180001A10 @ 0x180001dad
// > ??> @ 0x1801f60e4
// > ??> @ 0x1801f60f0
//
// 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_1800024C0(int a1, unsigned int a2)
{
int v2; // eax
__int64 v3; // r11
unsigned int v5; // r8d
__int64 result; // rax
int v7; // ebx
int v8; // ecx
int v9; // edx
__int64 v10; // r8
int v11; // eax
v2 = 0;
v3 = a2;
v5 = a1;
if ( a1 )
{
do
{
++v2;
v5 >>= 1;
}
while ( v5 );
}
for ( result = (unsigned int)(a1 >> ((int)((a2 - 1) * (v2 - 1)) / (int)a2)); ; result = (unsigned int)(v7 + v11) )
{
v7 = result;
v8 = 1;
v9 = 1;
if ( (int)v3 > 0 )
{
v10 = v3;
do
{
v8 *= (_DWORD)result;
v9 *= (_DWORD)result + 1;
--v10;
}
while ( v10 );
}
if ( v8 <= a1 && v9 > a1 )
break;
v11 = -1;
if ( v8 <= a1 )
v11 = 1;
}
return result;
}