//
// sub_1005D37C4 from 0x1005d37c4 to 0x1005d391c (344 bytes)
//
// 2 xrefs:
// > ??> @ 0x10083b2f0
// > ??> @ 0x10083b3c0
//
// 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_1005D37C4(__int64 a1, __int64 a2)
{
__int64 v4; // x22
__int64 v5; // x0
_DWORD *v6; // x19
__int64 v7; // x1
int v8; // w0
__int64 v9; // x4
__int64 v10; // x0
__int64 v11; // x23
__int64 v12; // x22
char **v13; // x0
void *v15; // [xsp+8h] [xbp-38h] BYREF
v15 = nullptr;
v4 = *(_QWORD *)(a2 + 32);
v5 = sub_1005FBA1C();
v6 = (_DWORD *)v5;
if ( !v5 )
{
v9 = 164;
LABEL_13:
sub_1005E0E48(5, 109, 65, "dh_ameth.c", v9);
goto LABEL_14;
}
v7 = v5 + 8;
if ( *(_UNKNOWN **)(a2 + 16) == &unk_10083B398 )
v8 = sub_1005D2364(v4, v7);
else
v8 = sub_1005D2270(v4, v7);
*v6 = v8;
if ( v8 <= 0 )
{
v9 = 169;
goto LABEL_13;
}
v10 = sub_1005F00A0(*(_QWORD *)(v4 + 32), 0);
v11 = v10;
if ( !v10 )
goto LABEL_14;
v12 = sub_1005F8E9C(v10, &v15);
sub_1005F8EB4(v11);
if ( (int)v12 <= 0 )
{
v9 = 183;
goto LABEL_13;
}
v13 = sub_10058AB9C(**(_DWORD **)(a2 + 16));
if ( (unsigned int)sub_1005F2DF0(a1, v13, 16, v6, v15, v12) )
return 1;
LABEL_14:
if ( v15 )
sub_100588C44(v15);
if ( v6 )
sub_1005FBA78(v6);
return 0;
}