//
// sub_10097D130 from 0x10097d130 to 0x10097d2d3 (419 bytes)
//
// 3 xrefs:
// > sub_10097CC90 @ 0x10097cfbb
// > sub_10097D080 @ 0x10097d11c
// > sub_10097D2E0 @ 0x10097d2f5
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:38:58 +0000
//
__int64 __fastcall sub_10097D130(__int64 a1)
{
__int64 result; // rax
__int64 v2; // rcx
char v3; // dl
char v4; // r14
char v5; // bl
__int64 *v6; // rdi
__int64 v7; // rsi
__int64 v8; // rdx
__int64 *v9; // r14
__int64 v10; // rdi
_DWORD v11[9]; // [rsp-24h] [rbp-24h] BYREF
v2 = *(_QWORD *)(a1 + 352);
if ( v2 )
{
v11[0] = HIDWORD(result);
v3 = *(_BYTE *)(a1 + 338);
v4 = *(_BYTE *)(a1 + 336);
v5 = *(_BYTE *)(a1 + 337);
v6 = (__int64 *)(a1 + 352);
result = (__int64)v6;
v7 = v2;
do
{
if ( *(int *)(v7 + 32) >= 16 )
result = v7;
v7 = *(_QWORD *)(v7 + 8LL * (*(_DWORD *)(v7 + 32) < 16));
}
while ( v7 );
if ( (__int64 *)result != v6 && *(int *)(result + 32) <= 16 )
{
result = *(_QWORD *)(*(_QWORD *)(result + 40) + 648LL);
if ( result )
{
if ( v3 )
{
BYTE2(v11[0]) = 120;
LOWORD(v11[0]) = -136;
}
else
{
BYTE2(v11[0]) = -1;
LOWORD(v11[0]) = -1;
}
result = (*(__int64 (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)result + 960LL))(result, v11);
v2 = *v6;
}
}
if ( v2 )
{
result = (__int64)v6;
v8 = v2;
do
{
if ( *(int *)(v8 + 32) >= 17 )
result = v8;
v8 = *(_QWORD *)(v8 + 8LL * (*(_DWORD *)(v8 + 32) < 17));
}
while ( v8 );
if ( (__int64 *)result != v6 && *(int *)(result + 32) <= 17 )
{
result = *(_QWORD *)(*(_QWORD *)(result + 40) + 648LL);
if ( result )
{
if ( v4 )
{
v9 = v6;
BYTE2(v11[0]) = 120;
LOWORD(v11[0]) = -136;
}
else
{
v9 = v6;
BYTE2(v11[0]) = -1;
LOWORD(v11[0]) = -1;
}
result = (*(__int64 (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)result + 960LL))(result, v11);
v6 = v9;
v2 = *v9;
}
}
if ( v2 )
{
result = (__int64)v6;
do
{
if ( *(int *)(v2 + 32) >= 18 )
result = v2;
v2 = *(_QWORD *)(v2 + 8LL * (*(_DWORD *)(v2 + 32) < 18));
}
while ( v2 );
if ( (__int64 *)result != v6 && *(int *)(result + 32) <= 18 )
{
result = *(_QWORD *)(result + 40);
v10 = *(_QWORD *)(result + 648);
if ( v10 )
{
if ( v5 )
{
BYTE2(v11[0]) = 120;
LOWORD(v11[0]) = -136;
}
else
{
BYTE2(v11[0]) = -1;
LOWORD(v11[0]) = -1;
}
return (*(__int64 (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v10 + 960LL))(v10, v11);
}
}
}
}
}
return result;
}