//
// sub_1004A6C14 from 0x1004a6c14 to 0x1004a6d00 (236 bytes)
//
// 2 xrefs:
// > sub_100508FA0 @ 0x1005090f0
// > sub_100509844 @ 0x100509a70
//
// 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_1004A6C14(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, int a6)
{
int v7; // w19
int v8; // w21
int v9; // w22
__int64 v12; // x8
__int64 v13; // x8
__int16 v14; // w8
__int64 result; // x0
int *v16; // x1
int *v17; // [xsp+8h] [xbp-38h] BYREF
v7 = a5;
v8 = a4;
v9 = a3;
v12 = *(_QWORD *)(a1 + 232);
if ( v12 && !*(_DWORD *)(v12 + 40) )
return 5;
v13 = *(_QWORD *)(a2 + 232);
if ( v13 )
{
if ( !*(_DWORD *)(v13 + 44) )
return 5;
}
v14 = atomic_load((unsigned int *)(a1 + 100));
if ( (v14 & 0x100) != 0 )
return sub_1004A6D00(a1, a2, a3, a4, a5, 0);
result = sub_10043E710(*(_QWORD *)(a1 + 168), &v17, 40, a6);
if ( !(_DWORD)result )
{
*(_BYTE *)v17 = 2;
v16 = v17;
*((_QWORD *)v17 + 1) = a1;
*((_QWORD *)v16 + 2) = a2;
v16[6] = v9;
v16[7] = v8;
v16[8] = v7;
return sub_10043E7B4(*(_QWORD *)(a1 + 168), (__int64)v16, a6);
}
return result;
}