//
// sub_10066BAC0 from 0x10066bac0 to 0x10066bdab (747 bytes)
//
// 1 xrefs:
// > sub_1006532E0 @ 0x1006536af
//
// 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:35:01 +0000
//
void __fastcall sub_10066BAC0(__int64 a1, _QWORD *a2, _QWORD *a3)
{
_QWORD *v3; // rbx
_QWORD *v4; // r15
__int64 *v6; // r13
__int64 *v7; // rax
__int64 v8; // rcx
__int64 *v9; // rdi
__int64 *v10; // r12
__int64 *v11; // rax
_QWORD *v12; // rbx
__int64 v13; // rdi
__int64 v14; // rax
_QWORD *v15; // r8
int v16; // ecx
int v17; // edi
__int64 v18; // rax
__int64 *v19; // rax
_QWORD *v20; // rax
bool v21; // zf
__int64 *v22; // rax
__int64 v23; // r13
__int64 *i; // rax
_QWORD *v25; // rcx
_QWORD *v26; // rax
__int64 *v27; // rax
__int64 *v29; // [rsp+10h] [rbp-40h]
__int64 *v30; // [rsp+18h] [rbp-38h]
v3 = a3;
v4 = a2;
if ( *(_QWORD *)(a1 + 16) )
{
v6 = (__int64 *)(a1 + 8);
v7 = *(__int64 **)a1;
v8 = *(_QWORD *)(a1 + 8);
*(_QWORD *)a1 = a1 + 8;
*(_QWORD *)(v8 + 16) = 0;
*(_OWORD *)(a1 + 8) = 0;
v9 = (__int64 *)v7[1];
if ( !v9 )
v9 = v7;
v30 = v9;
if ( v9 )
{
v10 = (__int64 *)v9[2];
if ( v10 )
{
v11 = (__int64 *)*v10;
if ( (__int64 *)*v10 == v9 )
{
*v10 = 0;
while ( 1 )
{
v27 = (__int64 *)v10[1];
if ( !v27 )
break;
do
{
v10 = v27;
v27 = (__int64 *)*v27;
}
while ( v27 );
}
}
else
{
for ( v10[1] = 0; v11; v11 = (__int64 *)v10[1] )
{
do
{
v10 = v11;
v11 = (__int64 *)*v11;
}
while ( v11 );
}
}
}
else
{
v10 = nullptr;
}
v29 = v10;
if ( a2 != a3 )
{
v12 = a2;
while ( 1 )
{
v9[4] = v12[4];
std::string::operator=((std::string *)(v9 + 5), (const std::string *)(v12 + 5));
v13 = *v6;
v14 = a1 + 8;
v15 = (_QWORD *)(a1 + 8);
if ( *v6 )
{
v16 = *((_DWORD *)v30 + 8);
do
{
while ( 1 )
{
v14 = v13;
v17 = *(_DWORD *)(v13 + 32);
if ( v16 >= v17 && (v16 > v17 || *((_DWORD *)v30 + 9) >= *(_DWORD *)(v14 + 36)) )
break;
v13 = *(_QWORD *)v14;
v15 = (_QWORD *)v14;
if ( !*(_QWORD *)v14 )
goto LABEL_23;
}
v13 = *(_QWORD *)(v14 + 8);
}
while ( v13 );
v15 = (_QWORD *)(v14 + 8);
}
LABEL_23:
*(_OWORD *)v30 = 0;
v30[2] = v14;
*v15 = v30;
v18 = **(_QWORD **)a1;
if ( v18 )
*(_QWORD *)a1 = v18;
sub_10001B680(*(__int64 **)(a1 + 8), v30);
++*(_QWORD *)(a1 + 16);
v9 = v29;
v30 = v29;
if ( v29 )
{
v10 = (__int64 *)v29[2];
if ( v10 )
{
v19 = (__int64 *)*v10;
if ( (__int64 *)*v10 == v29 )
{
*v10 = 0;
while ( 1 )
{
v22 = (__int64 *)v10[1];
if ( !v22 )
break;
do
{
v10 = v22;
v22 = (__int64 *)*v22;
}
while ( v22 );
}
}
else
{
for ( v10[1] = 0; v19; v19 = (__int64 *)v10[1] )
{
do
{
v10 = v19;
v19 = (__int64 *)*v19;
}
while ( v19 );
}
}
}
else
{
v10 = nullptr;
}
v29 = v10;
v20 = (_QWORD *)v12[1];
if ( !v20 )
{
do
{
LABEL_38:
v4 = (_QWORD *)v12[2];
v21 = *v4 == (_QWORD)v12;
v12 = v4;
}
while ( !v21 );
goto LABEL_39;
}
}
else
{
v10 = nullptr;
v20 = (_QWORD *)v12[1];
if ( !v20 )
goto LABEL_38;
}
do
{
v4 = v20;
v20 = (_QWORD *)*v20;
}
while ( v20 );
LABEL_39:
if ( v9 )
{
v12 = v4;
if ( v4 != a3 )
continue;
}
v23 = a1;
sub_100056AB0(a1, v9);
if ( !v10 )
goto LABEL_52;
goto LABEL_49;
}
}
v23 = a1;
sub_100056AB0(a1, v9);
if ( !v10 )
goto LABEL_52;
LABEL_49:
for ( i = (__int64 *)v10[2]; i; i = (__int64 *)i[2] )
v10 = i;
sub_100056AB0(v23, v10);
LABEL_52:
v3 = a3;
}
else
{
sub_100056AB0(a1, nullptr);
}
}
if ( v4 != v3 )
{
do
{
sub_10066BE20(a1, v4 + 4);
v25 = (_QWORD *)v4[1];
if ( v25 )
{
do
{
v26 = v25;
v25 = (_QWORD *)*v25;
}
while ( v25 );
}
else
{
do
{
v26 = (_QWORD *)v4[2];
v21 = *v26 == (_QWORD)v4;
v4 = v26;
}
while ( !v21 );
}
v4 = v26;
}
while ( v26 != v3 );
}
}