//
// std::__ndk1::random_device::operator from 0xf7a5a8 to 0xf7a678 (208 bytes)
//
// 2 xrefs:
// > GameToolbox::gen_random @ 0x6a8844
// > ??> @ 0xf46f0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:13:46 +0000
//
__int64 __fastcall std::random_device::operator()(int *a1)
{
unsigned int *p_buf; // x20
size_t v3; // x21
ssize_t v4; // x0
int *v5; // x0
__int64 result; // x0
unsigned int buf; // [xsp+4h] [xbp-3Ch] BYREF
__int64 v8; // [xsp+8h] [xbp-38h]
p_buf = &buf;
v3 = 4;
v8 = *(_QWORD *)(_ReadStatusReg(TPIDR_EL0) + 40);
do
{
while ( 1 )
{
v4 = read(*a1, p_buf, v3);
if ( v4 != -1 )
break;
v5 = (int *)__errno();
if ( *v5 != 4 )
std::__throw_system_error(*v5, "random_device got an unexpected error");
}
if ( !v4 )
{
std::__throw_system_error(61, "random_device got EOF");
v4 = 0;
}
v3 -= v4;
p_buf = (unsigned int *)((char *)p_buf + v4);
}
while ( v3 );
result = buf;
_ReadStatusReg(TPIDR_EL0);
return result;
}