//
// sub_1005E0A80 from 0x1005e0a80 to 0x1005e0ccc (588 bytes)
//
// 2 xrefs:
// > sub_1005E0CCC @ 0x1005e0ce4
// > sub_1005E2558 @ 0x1005e2560
//
// 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 sub_1005E0A80()
{
int *v0; // x19
__int64 *v1; // x20
__int64 v2; // t1
__int64 *v3; // x20
__int64 v4; // t1
__int64 i; // x8
int *v6; // x19
__int64 v7; // x0
__int64 v8; // x3
__int64 v9; // x19
char **v10; // x23
char *v11; // x20
char *v12; // x8
char *v13; // x8
__int64 result; // x0
__int64 v15; // x8
__int64 *v16; // x19
__int64 v17; // t1
if ( !qword_100883228 )
{
sub_100588190(9, 1, (__int64)"err.c", 295);
if ( !qword_100883228 )
qword_100883228 = (__int64)off_10083B820;
sub_100588190(10, 1, (__int64)"err.c", 298);
}
v0 = &dword_100861230;
v1 = &qword_1008612E8;
if ( qword_1008612E8 )
{
do
{
(*(void (__fastcall **)(__int64 *))(qword_100883228 + 24))(v1);
v2 = v1[2];
v1 += 2;
}
while ( v2 );
}
if ( qword_1008614B8 )
{
v3 = &qword_1008614B8;
do
{
(*(void (__fastcall **)(__int64 *))(qword_100883228 + 24))(v3);
v4 = v3[2];
v3 += 2;
}
while ( v4 );
}
for ( i = qword_100861238; i; v0 = v6 + 2 )
{
*((_QWORD *)v0 + 1) = i | 0x2000000;
v6 = v0 + 2;
(*(void (__fastcall **)(int *))(qword_100883228 + 24))(v6);
i = *((_QWORD *)v6 + 2);
}
sub_100588190(5, 1, (__int64)"err.c", 583);
if ( byte_100883220 == 1 )
{
v7 = 6;
v8 = 585;
}
else
{
v9 = 1;
sub_100588190(6, 1, (__int64)"err.c", 589);
sub_100588190(9, 1, (__int64)"err.c", 590);
if ( byte_100883220 == 1 )
{
v7 = 10;
v8 = 592;
}
else
{
v10 = (char **)&unk_1008835A0;
v11 = (char *)&unk_100883DA0;
do
{
*(v10 - 1) = (char *)v9;
if ( !*v10 )
{
v12 = strerror(v9);
if ( v12 )
{
strncpy(v11, v12, 0x20u);
v11[31] = 0;
*v10 = v11;
v13 = v11;
}
else
{
v13 = *v10;
}
if ( !v13 )
*v10 = "unknown";
}
++v9;
v11 += 32;
v10 += 2;
}
while ( v9 != 128 );
byte_100883220 = 1;
v7 = 10;
v8 = 620;
}
}
result = sub_100588190(v7, 1, (__int64)"err.c", v8);
v15 = qword_100883598;
if ( qword_100883598 )
{
v16 = &qword_100883598;
do
{
*v16 = v15 | 0x2000000;
result = (*(__int64 (__fastcall **)(__int64 *))(qword_100883228 + 24))(v16);
v17 = v16[2];
v16 += 2;
v15 = v17;
}
while ( v17 );
}
return result;
}