//
// sub_10052D068 from 0x10052d068 to 0x10052d15c (244 bytes)
//
// 2 xrefs:
// > sub_10052D024 @ 0x10052d04c
// > sub_10052D15C @ 0x10052d184
//
// 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_10052D068(__int64 a1, int a2, unsigned __int64 a3, _QWORD *a4)
{
__int64 *v8; // x8
__int64 v9; // x8
bool v10; // zf
unsigned int v11; // w9
__int64 result; // x0
sub_100588190(9, 12, "s3_both.c", 624);
v8 = (__int64 *)(a1 + 560);
if ( !a2 )
v8 = (__int64 *)(a1 + 552);
v9 = *v8;
if ( v9
&& (*(_QWORD *)v9 != a3 ? (v10 = *(_QWORD *)v9 == 0) : (v10 = 1),
v10 && a3 >= 8 && (v11 = *(_DWORD *)(v9 + 8), v11 < *(_DWORD *)(a1 + 544))) )
{
*(_QWORD *)v9 = a3;
*a4 = *(_QWORD *)(v9 + 16);
*(_QWORD *)(v9 + 16) = a4;
*(_DWORD *)(v9 + 8) = v11 + 1;
return sub_100588190(10, 12, "s3_both.c", 637);
}
else
{
result = sub_100588190(10, 12, "s3_both.c", 637);
if ( a4 )
return sub_100588C44(a4);
}
return result;
}