//
// sub_10097DCD0 from 0x10097dcd0 to 0x10097de4d (381 bytes)
//
// 1 xrefs:
// > sub_10097D570 @ 0x10097db16
//
// 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
//
unsigned __int64 __fastcall sub_10097DCD0(__int64 a1)
{
unsigned __int64 result; // rax
__int64 v2; // r12
__int64 v3; // r15
__int64 v5; // rdx
unsigned __int64 v6; // r14
__int64 v7; // rcx
__int64 v8; // r15
unsigned __int64 v9; // r12
__int64 v10; // rax
__int64 v11; // rdi
__int64 v12; // [rsp+0h] [rbp-30h]
v2 = *(_QWORD *)(a1 + 848);
v3 = *(_QWORD *)(a1 + 856);
if ( v2 != v3 )
{
v12 = *(_QWORD *)(a1 + 960);
sub_1001EAE60(a1 + 944, *(_QWORD **)(a1 + 952));
*(_QWORD *)(a1 + 944) = a1 + 952;
*(_OWORD *)(a1 + 952) = 0;
v5 = *(_QWORD *)(a1 + 848);
result = *(_QWORD *)(a1 + 856);
if ( result != v5 )
{
if ( (_DWORD)v12 == (unsigned int)((unsigned __int64)(v3 - v2) >> 7) )
{
v6 = 0;
do
{
v7 = *(_QWORD *)(a1 + 968);
if ( v6 < (*(_QWORD *)(a1 + 976) - v7) >> 3 )
{
CCMenuItemToggler::toggle(*(_QWORD *)(v7 + 8 * v6), 0);
v5 = *(_QWORD *)(a1 + 848);
result = *(_QWORD *)(a1 + 856);
}
++v6;
}
while ( v6 < (__int64)(result - v5) >> 7 );
}
else
{
v8 = 0;
v9 = 0;
do
{
sub_1005913C0((__int64 **)(a1 + 944), (unsigned __int8 *)(v8 + v5), v8 + v5);
v10 = *(_QWORD *)(a1 + 968);
if ( v9 < (*(_QWORD *)(a1 + 976) - v10) >> 3 )
CCMenuItemToggler::toggle(*(_QWORD *)(v10 + 8 * v9), 1u);
++v9;
v5 = *(_QWORD *)(a1 + 848);
result = (*(_QWORD *)(a1 + 856) - v5) >> 7;
v8 += 128;
}
while ( v9 < result );
}
}
v11 = *(_QWORD *)(a1 + 992);
if ( v11 )
return sub_10029CC00(v11, *(_DWORD *)(a1 + 960));
}
return result;
}