//
// sub_5F970 from 0x5f970 to 0x5fa28 (184 bytes)
//
// 2 xrefs:
// > sub_78B30 @ 0x790c8
// > sub_D28F0 @ 0xd2984
//
// 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_5F970(_QWORD *a1, __int64 *a2)
{
__int64 v2; // x21
_QWORD *v5; // x8
__int64 v6; // x23
_QWORD *v7; // x22
__int64 v8; // x8
v2 = *a2;
LABEL_2:
while ( a2 != (__int64 *)v2 )
{
v6 = *(_QWORD *)v2;
v5 = *(_QWORD **)(v2 + 8);
*v5 = *(_QWORD *)v2;
*(_QWORD *)(*(_QWORD *)v2 + 8LL) = v5;
LODWORD(v5) = *(unsigned __int8 *)(v2 + 61);
*(_QWORD *)v2 = v2;
*(_QWORD *)(v2 + 8) = v2;
if ( (_DWORD)v5 )
{
v7 = a1;
while ( 1 )
{
v7 = (_QWORD *)*v7;
if ( v7 == a1 )
break;
if ( !(unsigned int)sub_E3D84(v7[4], *(_QWORD *)(v2 + 32)) )
{
sub_5F6CC((__int64)v7, *(void **)(v2 + 40), *(unsigned int *)(v2 + 56));
sub_5F658(v2);
v2 = v6;
goto LABEL_2;
}
}
}
v8 = a1[1];
*(_QWORD *)v2 = a1;
*(_QWORD *)(v2 + 8) = v8;
a1[1] = v2;
**(_QWORD **)(v2 + 8) = v2;
v2 = v6;
}
return 0;
}