//
// sub_100586F7C from 0x100586f7c to 0x100587058 (220 bytes)
//
// 16 xrefs:
// > sub_10054AC2C @ 0x10054ac80
// > sub_10054AC2C @ 0x10054ac8c
// > sub_10054AC2C @ 0x10054ae48
// > sub_10054AC2C @ 0x10054ae54
// > sub_10057E440 @ 0x10057e520
// > sub_10057E440 @ 0x10057e52c
// > sub_10057E440 @ 0x10057e620
// > sub_10057E440 @ 0x10057e62c
// > sub_10057E9A4 @ 0x10057ed2c
// > sub_10057E9A4 @ 0x10057ed38
// > sub_10057E9A4 @ 0x10057ed44
// > sub_10057E9A4 @ 0x10057ed50
// > sub_10057F844 @ 0x10057f8bc
// > sub_10057F844 @ 0x10057f8cc
// > sub_10057F844 @ 0x10057f8d8
// > sub_10057F844 @ 0x10057f8e4
//
// 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_100586F7C(size_t a1)
{
int v2; // w8
int v4; // w20
int v5; // w1
int v6; // w21
unsigned __int64 v7; // t2
unsigned int v8; // [xsp+Ch] [xbp-24h] BYREF
v8 = 0;
if ( !(unsigned int)sub_1005862C0(a1, (__int64)&v8, 4) )
return v8;
if ( byte_100882BC8 == 1 )
{
v2 = dword_100882BCC;
}
else
{
v4 = sub_100548F0C();
v6 = v5;
sub_1005524A4(a1, "WARNING: Using weak random seed\n");
v2 = -2139243339 * (v6 + v4 + dword_100882BCC) - 1492899873;
dword_100882BCC = v2;
byte_100882BC8 = 1;
}
dword_100882BCC = 1103515245 * v2 + 12345;
HIDWORD(v7) = 1103515245 * v2 + 12345;
LODWORD(v7) = HIDWORD(v7);
return (unsigned int)(v7 >> 16);
}