//
// sub_1005FB650 from 0x1005fb650 to 0x1005fb69c (76 bytes)
//
// 26 xrefs:
// > sub_100545CBC @ 0x100546010
// > sub_100545CBC @ 0x100546050
// > sub_100545CBC @ 0x100546088
// > sub_100545CBC @ 0x1005460bc
// > sub_100545CBC @ 0x1005460f0
// > sub_100545CBC @ 0x100546130
// > sub_100545CBC @ 0x10054616c
// > sub_100545CBC @ 0x1005461a8
// > sub_100545CBC @ 0x1005461e4
// > sub_100545CBC @ 0x10054621c
// > sub_100545CBC @ 0x100546258
// > sub_100545CBC @ 0x1005462a0
// > sub_100545CBC @ 0x1005462c0
// > sub_10058AF50 @ 0x10058b15c
// > sub_1005CEC18 @ 0x1005cec74
// > sub_1005D1150 @ 0x1005d11e0
// > sub_1005EDC10 @ 0x1005edc44
// > sub_1005F623C @ 0x1005f6518
// > sub_1005F660C @ 0x1005f6794
// > sub_1005F660C @ 0x1005f6800
// > sub_1005F660C @ 0x1005f681c
// > sub_1005F6ABC @ 0x1005f6bb4
// > sub_1005F9900 @ 0x1005f9f58
// > sub_1005F9900 @ 0x1005f9f94
// > sub_1005FBD14 @ 0x1005fbd80
// > sub_1005FC000 @ 0x1005fc084
//
// 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_1005FB650(int a1, int a2, int a3)
{
int v3; // w8
__int64 result; // x0
v3 = a2 + 1;
if ( a3 >= 31 )
{
do
{
a3 >>= 7;
++v3;
}
while ( a3 > 0 );
}
if ( a1 == 2 )
return (unsigned int)(v3 + 3);
result = (unsigned int)(v3 + 1);
if ( a2 >= 128 )
{
do
{
a2 >>= 8;
result = (unsigned int)(result + 1);
}
while ( a2 > 0 );
}
return result;
}