//
// sub_1005D3B48 from 0x1005d3b48 to 0x1005d3cac (356 bytes)
//
// 2 xrefs:
// > ??> @ 0x10083b310
// > ??> @ 0x10083b3e0
//
// 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_1005D3B48(__int64 a1, __int64 a2)
{
int *v4; // x19
__int64 v5; // x0
__int64 v6; // x1
int v7; // w0
__int64 v8; // x0
void *v9; // x22
__int64 v10; // x23
char **v11; // x0
void *v13; // [xsp+8h] [xbp-38h] BYREF
v13 = nullptr;
v4 = (int *)sub_1005FBA1C();
if ( v4 )
{
v5 = *(_QWORD *)(a2 + 32);
v6 = (__int64)(v4 + 2);
if ( *(_UNKNOWN **)(a2 + 16) == &unk_10083B398 )
v7 = sub_1005D2364(v5, v6);
else
v7 = sub_1005D2270(v5, v6);
*v4 = v7;
if ( v7 <= 0 )
{
sub_1005E0E48(5, 111, 65, "dh_ameth.c", 273);
}
else
{
v4[1] = 16;
v8 = sub_1005F00A0(*(_QWORD *)(*(_QWORD *)(a2 + 32) + 40LL), 0);
v9 = (void *)v8;
if ( v8 )
{
v10 = sub_1005F8E9C(v8, &v13);
sub_1005FBB5C(v9);
v11 = sub_10058AB9C(**(_DWORD **)(a2 + 16));
if ( (unsigned int)sub_1005FC4BC(a1, v11, 0, 16, v4, v13, v10) )
return 1;
if ( v13 )
sub_100588C44(v13);
}
else
{
sub_1005E0E48(5, 111, 106, "dh_ameth.c", 282);
}
}
sub_1005FBA78(v4);
}
else
{
sub_1005E0E48(5, 111, 65, "dh_ameth.c", 267);
}
return 0;
}