//
// sub_100706824 from 0x100706824 to 0x100706b78 (852 bytes)
//
// 2 xrefs:
// > sub_10070596C @ 0x100705a60
// > sub_100705AC4 @ 0x100705ba8
//
// 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 11:12:51 +0000
//
__int64 sub_100706824()
{
unsigned __int64 v0; // x25
int v1; // w23
int v2; // w0
__n128 v3; // q0
int v4; // w20
unsigned __int64 v5; // x8
_QWORD *v6; // x10
int v7; // w0
int v8; // w8
int v9; // w27
unsigned __int64 v10; // x24
__darwin_suseconds_t tv_usec; // w19
int v12; // w0
int v13; // w8
int *v14; // x0
char **v15; // x19
char *v16; // x0
int v17; // w0
int v18; // w8
char *v19; // t1
pid_t v22; // [xsp+10h] [xbp-2D0h]
timeval v23; // [xsp+20h] [xbp-2C0h] BYREF
fd_set __b; // [xsp+30h] [xbp-2B0h] BYREF
time_t v25; // [xsp+B0h] [xbp-230h] BYREF
_BYTE v26[432]; // [xsp+B8h] [xbp-228h] BYREF
_OWORD v27[26]; // [xsp+C0h] [xbp-220h] BYREF
char v28[32]; // [xsp+268h] [xbp-78h] BYREF
v22 = getpid();
bzero(v26, 0x1B0u);
v0 = 0;
v1 = 0;
do
{
v2 = open(off_1009BEE50[v0], 131076);
v4 = v2;
if ( (v2 & 0x80000000) == 0 )
{
if ( fstat(v2, (stat *)&v26[144 * v0]) )
{
LABEL_36:
close(v4);
goto LABEL_37;
}
if ( v0 )
{
v5 = 0;
v6 = v27;
while ( *v6 != *(_QWORD *)&v27[9 * v0] || *((_DWORD *)v6 - 2) != *(_DWORD *)&v26[144 * v0] )
{
++v5;
v6 += 18;
if ( v5 >= v0 )
goto LABEL_9;
}
goto LABEL_36;
}
LABEL_9:
if ( (unsigned int)v4 >= 0x400 )
{
v23.tv_sec = 0;
v23.tv_usec = 10000;
v7 = read(v4, &v28[v1], 32 - v1);
if ( v7 <= 0 )
v8 = 0;
else
v8 = v7;
v1 += v8;
if ( v7 <= 0 && *__error() != 4 )
__error();
goto LABEL_36;
}
v9 = 1 << (v4 & 0x1F);
v10 = (unsigned __int64)v4 >> 5;
tv_usec = 10000;
while ( 1 )
{
v23.tv_sec = 0;
v23.tv_usec = tv_usec;
memset(&__b, 0, sizeof(__b));
__b.fds_bits[v10] |= v9;
tv_usec = 0;
if ( select(v4 + 1, &__b, nullptr, nullptr, &v23) < 0 || (tv_usec = v23.tv_usec, (__b.fds_bits[v10] & v9) == 0) )
{
if ( tv_usec == 10000 )
tv_usec = 0;
}
else
{
v12 = read(v4, &v28[v1], 32 - v1);
if ( tv_usec == 10000 )
tv_usec = 0;
if ( v12 <= 0 )
v13 = 0;
else
v13 = v12;
v1 += v13;
if ( v12 > 0 )
goto LABEL_30;
}
if ( *__error() == 4 )
{
LABEL_30:
if ( !tv_usec || v1 >= 32 )
goto LABEL_36;
}
else
{
v14 = __error();
if ( v1 > 31 || !tv_usec || *v14 != 35 )
goto LABEL_36;
}
}
}
LABEL_37:
++v0;
}
while ( v0 <= 2 && v1 < 32 );
if ( v1 >= 32 )
goto LABEL_50;
v15 = off_1009BEE70;
v16 = "/var/run/egd-pool";
do
{
v17 = sub_10070652C(v16, (__int64)&v28[v1], 32 - v1);
if ( v17 <= 0 )
v18 = 0;
else
v18 = v17;
v1 += v18;
v19 = *v15++;
v16 = v19;
}
while ( v1 <= 31 && v16 != nullptr );
if ( v1 >= 1 )
{
LABEL_50:
v3.n128_f64[0] = (double)v1;
sub_100706288((__int64)v28, 32, v3);
sub_1006B0510(v28, v1);
}
v25 = v22;
sub_100706288((__int64)&v25, 8, (__n128)0);
v25 = getuid();
sub_100706288((__int64)&v25, 8, (__n128)0);
v25 = time(nullptr);
sub_100706288((__int64)&v25, 8, (__n128)0);
return 1;
}