//
// sub_180016500 from 0x180016500 to 0x18001658c (140 bytes)
//
// 1 xrefs:
// > sub_1800164F0 @ 0x1800164f0
//
// 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_180016500(__int64 a1, int a2, _QWORD *a3, unsigned int *a4)
{
__int64 v4; // r10
__int64 v6; // rdx
_BYTE *v7; // r8
char v8; // al
_DWORD *v9; // r8
unsigned int v10; // ecx
int v11; // eax
char v12; // dl
_DWORD *v13; // r8
__int64 result; // rax
v4 = a2;
v6 = *(_QWORD *)(a1 + 384);
if ( v6 )
LODWORD(v4) = *(_DWORD *)(v6 + 4 * v4);
v7 = (_BYTE *)(*(_QWORD *)(*(_QWORD *)(a1 + 376) + 64LL)
+ *(int *)(*(_QWORD *)(*(_QWORD *)(a1 + 376) + 56LL) + 4LL * (int)v4));
v8 = *v7;
v9 = v7 + 8;
if ( (v8 & 1) == 0 )
return 0;
while ( 1 )
{
v10 = (*v9 >> 1) & 0xFFFFFF;
v11 = *v9 >> 25;
v12 = *v9 & 1;
v13 = v9 + 1;
if ( v11 == 6 || v11 == 9 || v11 == 11 || v11 == 15 )
break;
v9 = (_DWORD *)((char *)v13 + v10);
if ( !v12 )
return 0;
}
if ( a3 )
*a3 = v13;
result = 0;
if ( a4 )
*a4 = v10;
return result;
}