//
// sub_1005D5FB0 from 0x1005d5fb0 to 0x1005d60fc (332 bytes)
//
// 11 xrefs:
// > sub_1005D9670 @ 0x1005d9a04
// > sub_1005D9670 @ 0x1005d9a60
// > sub_100612B84 @ 0x100612d18
// > sub_10061A6C4 @ 0x10061a728
// > sub_10061BC84 @ 0x10061bcf4
// > sub_10061CC78 @ 0x10061ccfc
// > sub_10061D688 @ 0x10061d6f4
// > sub_10061F4A8 @ 0x10061f530
// > sub_100620E74 @ 0x100620ed8
// > sub_1006215F4 @ 0x10062168c
// > sub_1006231D0 @ 0x100623248
//
// 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_1005D5FB0(__int64 *a1, char *__s, __int64 a3, int a4)
{
__int64 *v6; // x19
int v7; // w21
__int64 *v8; // x0
__int64 v9; // x2
__int64 v10; // x4
unsigned int (__fastcall *v11)(__int64 *); // x8
v6 = a1;
if ( a1 )
{
v7 = 0;
}
else
{
v8 = (__int64 *)sub_1005D5DC4(a3);
v6 = v8;
if ( !v8 )
{
sub_1005E0E48(37, 112, 65, "dso_lib.c", 198);
return nullptr;
}
*((_DWORD *)v8 + 5) = a4;
v7 = 1;
}
if ( v6[7] )
{
v9 = 110;
v10 = 211;
goto LABEL_17;
}
if ( !__s )
goto LABEL_13;
if ( !(unsigned int)sub_1005D60FC((int)v6, __s) )
{
v9 = 112;
v10 = 220;
goto LABEL_17;
}
if ( !v6[7] )
{
LABEL_13:
v9 = 111;
v10 = 225;
goto LABEL_17;
}
v11 = *(unsigned int (__fastcall **)(__int64 *))(*v6 + 8);
if ( !v11 )
{
v9 = 108;
v10 = 229;
LABEL_17:
sub_1005E0E48(37, 112, v9, "dso_lib.c", v10);
if ( v7 )
sub_1005D5EB4(v6);
return nullptr;
}
if ( !v11(v6) )
{
v9 = 103;
v10 = 233;
goto LABEL_17;
}
return v6;
}