//
// sub_10056BAE8 from 0x10056bae8 to 0x10056bba0 (184 bytes)
//
// 9 xrefs:
// > sub_100569BB4 @ 0x100569cc4
// > sub_10056BF80 @ 0x10056c064
// > sub_10056DB30 @ 0x10056e1c0
// > sub_10056DB30 @ 0x10056ea60
// > sub_10056F32C @ 0x10056f3c8
// > sub_1005811A4 @ 0x1005812fc
// > sub_10058165C @ 0x100581684
// > sub_1005817EC @ 0x1005818ac
// > sub_100581A30 @ 0x100581a98
//
// 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_10056BAE8(__int64 *a1, __int64 a2, __int64 a3)
{
_QWORD *v6; // x0
__int64 v7; // x8
__int64 v8; // x9
__int64 *v9; // x10
__int64 v10; // x10
v6 = off_10085DEB0(0x18u);
if ( !v6 )
return 0;
*v6 = a3;
v7 = a1[3];
if ( v7 )
{
v8 = a2 + 16;
if ( a2 )
v9 = (__int64 *)(a2 + 16);
else
v9 = a1;
v10 = *v9;
v6[1] = a2;
v6[2] = v10;
if ( a2 )
{
if ( *(_QWORD *)v8 )
*(_QWORD *)(*(_QWORD *)v8 + 8LL) = v6;
else
a1[1] = (__int64)v6;
*(_QWORD *)v8 = v6;
}
else
{
*(_QWORD *)(*a1 + 8) = v6;
*a1 = (__int64)v6;
}
}
else
{
*a1 = (__int64)v6;
*(_OWORD *)(v6 + 1) = 0u;
a1[1] = (__int64)v6;
}
a1[3] = v7 + 1;
return 1;
}