//
// sub_CADFC from 0xcadfc to 0xcaf24 (296 bytes)
//
// 3 xrefs:
// > sub_C8FEC @ 0xc9150
// > sub_CADFC @ 0xcae98
// > sub_CADFC @ 0xcaed8
//
// 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_CADFC(
__int64 a1,
__int64 a2,
unsigned int a3,
unsigned int a4,
unsigned int a5,
unsigned int a6,
_BYTE *a7)
{
unsigned int *v7; // x8
unsigned int v8; // w9
__int16 v10; // w9
unsigned int v17; // w9
__int64 v18; // x8
_QWORD *v19; // x26
_QWORD *i; // x27
_BYTE v22[4]; // [xsp+Ch] [xbp-44h] BYREF
if ( *(_DWORD *)(a1 + 88) != a6 )
{
v7 = (unsigned int *)(a1 + 92);
v8 = atomic_load((unsigned int *)(a1 + 92));
if ( (v8 & 0x100000) == 0 )
{
v10 = atomic_load(v7);
if ( (v10 & 0x2000) != 0 )
{
v22[0] = 0;
do
v17 = __ldaxr(v7);
while ( __stlxr(v17 | 0x100000, v7) );
v18 = *(_QWORD *)(a1 + 104);
if ( v18 )
{
sub_CADFC(v18 + 8, a2, a3, a4, a5, a6, v22);
}
else
{
v19 = (_QWORD *)(a1 + 112);
for ( i = (_QWORD *)(a1 + 112); ; sub_CADFC(*(_QWORD *)(i[2] + 88LL) + 8LL, a2, a3, a4, a5, a6, v22) )
{
i = (_QWORD *)*i;
if ( i == v19 )
break;
}
}
if ( a7 )
*a7 = 1;
if ( *(_DWORD *)(*(_QWORD *)(a1 + 96) + 248LL) )
sub_C8F00(a2, a1);
}
else if ( a7 )
{
*a7 = 0;
}
}
}
return 0;
}