//
// sub_10001BD38 from 0x10001bd38 to 0x10001bdc0 (136 bytes)
//
// 2 xrefs:
// > sub_10001BCE8 @ 0x10001bcf8
// > GameStatsManager::accountIDForIcon @ 0x1000654d0
//
// 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_10001BD38(__int64 a1, int *a2)
{
__int64 *v2; // x0
__int64 *v3; // x11
__int64 *v4; // t1
int v5; // w9
int v6; // w10
__int64 *v7; // x8
int v8; // w12
int v9; // w11
v4 = *(__int64 **)(a1 + 8);
v2 = (__int64 *)(a1 + 8);
v3 = v4;
if ( !v4 )
return v2;
v6 = *a2;
v5 = a2[1];
v7 = v2;
do
{
v8 = *((_DWORD *)v3 + 7);
if ( v8 >= v6 )
{
if ( v6 >= v8 )
{
if ( *((_DWORD *)v3 + 8) >= v5 )
v7 = v3;
v3 += *((_DWORD *)v3 + 8) < v5;
}
else
{
v7 = v3;
}
}
else
{
++v3;
}
v3 = (__int64 *)*v3;
}
while ( v3 );
if ( v7 == v2 )
return v2;
v9 = *((_DWORD *)v7 + 7);
if ( v6 < v9 || v9 >= v6 && v5 < *((_DWORD *)v7 + 8) )
return v2;
return v7;
}