//
// sub_10052C540 from 0x10052c540 to 0x10052c6cc (396 bytes)
//
// 4 xrefs:
// > sub_10051CF68 @ 0x10051d24c
// > sub_100521AE0 @ 0x100521d44
// > sub_100537D24 @ 0x100538018
// > sub_100538A48 @ 0x100538d80
//
// 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_10052C540(__int64 a1)
{
__int64 v2; // x0
size_t v3; // x20
__int64 v4; // x8
__int64 v5; // x21
__int64 v6; // x2
int v8; // [xsp+Ch] [xbp-24h]
v2 = (*(__int64 (**)(void))(*(_QWORD *)(a1 + 8) + 96LL))();
v3 = v2;
if ( v8 )
{
v4 = *(_QWORD *)(a1 + 128);
if ( !*(_DWORD *)(v4 + 456) )
{
sub_1005E0E48(20, 140, 154, "s3_both.c", 257);
v6 = 10;
goto LABEL_8;
}
*(_DWORD *)(v4 + 456) = 0;
v5 = *(int *)(v4 + 916);
if ( v5 != v2 )
{
sub_1005E0E48(20, 140, 111, "s3_both.c", 267);
v6 = 50;
goto LABEL_8;
}
if ( (unsigned int)sub_1005885F4(*(_QWORD *)(a1 + 88), v4 + 788, v2) )
{
sub_1005E0E48(20, 140, 149, "s3_both.c", 273);
v6 = 51;
LABEL_8:
sub_10052C058(a1, 2, v6);
return 0;
}
if ( *(_DWORD *)(a1 + 4) == 0x2000 )
{
if ( (int)v5 >= 65 )
sub_1005884E4((char)"s3_both.c");
memcpy((void *)(*(_QWORD *)(a1 + 128) + 1056LL), (const void *)(*(_QWORD *)(a1 + 128) + 788LL), v3);
*(_BYTE *)(*(_QWORD *)(a1 + 128) + 1120LL) = v5;
}
else
{
if ( (int)v5 >= 65 )
sub_1005884E4((char)"s3_both.c");
memcpy((void *)(*(_QWORD *)(a1 + 128) + 1121LL), (const void *)(*(_QWORD *)(a1 + 128) + 788LL), v3);
*(_BYTE *)(*(_QWORD *)(a1 + 128) + 1185LL) = v5;
}
return 1;
}
return v3;
}