//
// sub_1800A5BE0 from 0x1800a5be0 to 0x1800a5e19 (569 bytes)
//
// 2 xrefs:
// > sub_1800A6260 @ 0x1800a634f
// > ??> @ 0x1801fb7b4
//
// 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_1800A5BE0(
__int64 *a1,
int a2,
CHAR *a3,
unsigned int a4,
_OWORD *a5,
_DWORD *a6,
__int64 a7,
_DWORD *a8)
{
__int64 v9; // r8
int v11; // ecx
__int64 v12; // r9
_WORD *v13; // r10
int v14; // eax
__int16 v15; // dx
int v16; // ecx
int v17; // ecx
_OWORD *v18; // rax
const WCHAR *bstrVal; // r8
unsigned __int16 *v20; // rcx
__int64 v22; // [rsp+40h] [rbp-30h] BYREF
__int64 v23; // [rsp+48h] [rbp-28h]
LPVOID pv; // [rsp+50h] [rbp-20h] BYREF
PROPVARIANT lpWideCharStr; // [rsp+58h] [rbp-18h] BYREF
__int64 v26; // [rsp+90h] [rbp+20h] BYREF
int v27; // [rsp+98h] [rbp+28h] BYREF
v9 = *a1;
v11 = -2128831035;
v12 = v9 + 8LL * a2;
v13 = *(_WORD **)(v12 + 728);
LOWORD(v14) = *v13;
if ( *v13 )
{
HIBYTE(v15) = HIBYTE(*v13);
do
{
++v13;
v16 = 16777619 * (v11 ^ (char)v14);
v14 = SHIBYTE(v15);
v15 = *v13;
v17 = v14 ^ v16;
LOBYTE(v14) = *v13;
v11 = 16777619 * v17;
}
while ( *v13 );
}
v18 = a5;
a5 = nullptr;
*v18 = 0;
*(_DWORD *)v18 = v11;
if ( (*(int (__fastcall **)(_QWORD, _QWORD, _OWORD **))(**(_QWORD **)(v9 + 704) + 40LL))(
*(_QWORD *)(v9 + 704),
*(_QWORD *)(v12 + 728),
&a5) >= 0 )
{
v26 = 0;
if ( (*(int (__fastcall **)(_OWORD *, _QWORD, __int64 *))(*(_QWORD *)a5 + 32LL))(a5, 0, &v26) < 0 )
return 49;
memset(&lpWideCharStr, 0, sizeof(lpWideCharStr));
if ( (*(int (__fastcall **)(__int64, void *, PROPVARIANT *))(*(_QWORD *)v26 + 40LL))(
v26,
&unk_18016FAD0,
&lpWideCharStr) < 0 )
return 49;
bstrVal = L"Unknown";
if ( lpWideCharStr.vt == 31 )
bstrVal = lpWideCharStr.bstrVal;
WideCharToMultiByte(0xFDE9u, 0, bstrVal, -1, a3, a4 - 1, nullptr, nullptr);
if ( PropVariantClear(&lpWideCharStr) < 0 )
return 49;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v26 + 16LL))(v26);
v22 = 0;
if ( (**(int (__fastcall ***)(_OWORD *, void *, __int64 *))a5)(a5, &unk_18016A0C8, &v22) >= 0
&& (*(int (__fastcall **)(__int64, int *))(*(_QWORD *)v22 + 24LL))(v22, &v27) >= 0 )
{
if ( !v27 )
sub_1800B7CC0(a3, " [loopback]", a4);
v23 = 0;
if ( (*(int (__fastcall **)(_OWORD *, void *, __int64))(*(_QWORD *)a5 + 24LL))(a5, &unk_18016A080, 23) >= 0 )
{
pv = nullptr;
if ( (*(int (__fastcall **)(__int64, LPVOID *))(*(_QWORD *)v23 + 64LL))(v23, &pv) >= 0 )
{
v20 = (unsigned __int16 *)pv;
*a6 = *((_DWORD *)pv + 1);
*a8 = v20[1];
CoTaskMemFree(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v22 + 16LL))(v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v23 + 16LL))(v23);
(*(void (__fastcall **)(_OWORD *))(*(_QWORD *)a5 + 16LL))(a5);
return 0;
}
}
}
}
return 57;
}