//
// sub_10053D16C from 0x10053d16c to 0x10053d350 (484 bytes)
//
// 1 xrefs:
// > sub_10053A8A4 @ 0x10053b198
//
// 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_10053D16C(unsigned int *a1)
{
__int64 v2; // x9
unsigned __int8 *v3; // x21
void (__fastcall *v4)(_QWORD, _QWORD, __int64, _QWORD, _QWORD, unsigned int *, _QWORD); // x8
unsigned int v5; // w8
__int64 v6; // x22
unsigned __int8 v7; // w24
unsigned __int8 v8; // w25
size_t v9; // x22
unsigned int v10; // w20
int v11; // w8
const void *v12; // x23
_BYTE *v13; // x21
void (__fastcall *v14)(__int64, _QWORD, __int64, _BYTE *, _QWORD, unsigned int *, _QWORD); // x8
v2 = *((_QWORD *)a1 + 16);
v3 = *(unsigned __int8 **)(v2 + 304);
v4 = *((void (__fastcall **)(_QWORD, _QWORD, __int64, _QWORD, _QWORD, unsigned int *, _QWORD))a1 + 19);
if ( v4 )
{
v4(0, *a1, 24, *(_QWORD *)(v2 + 304), *(unsigned int *)(v2 + 292), a1, *((_QWORD *)a1 + 20));
v2 = *((_QWORD *)a1 + 16);
}
v5 = *(_DWORD *)(v2 + 292);
if ( v5 - 19 > 0x3FED )
return 0;
v7 = v3[1];
v8 = v3[2];
v9 = v8 | (v7 << 8);
v10 = v9 + 19;
if ( (int)v9 + 19 > v5 )
return 0;
v11 = *v3;
if ( v11 == 2 )
{
if ( (_DWORD)v9 == 18 )
{
if ( (v3[4] | (v3[3] << 8)) == a1[168] )
{
sub_100539DD8((__int64)a1);
v6 = 0;
++a1[168];
a1[167] = 0;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
else if ( v11 == 1 )
{
if ( v10 <= 0x4000 )
{
v12 = v3 + 3;
v13 = (_BYTE *)sub_100588710((unsigned int)(v9 + 19), "d1_both.c", 1461);
*v13 = 2;
v13[1] = v7;
v13[2] = v8;
memcpy(v13 + 3, v12, v9);
if ( (sub_1005E0260(&v13[v9 + 3], 16) & 0x80000000) != 0 )
{
sub_100588C44(v13);
return 0xFFFFFFFFLL;
}
else
{
v6 = sub_10053B4E4((__int64)a1, 24, (__int64)v13, (unsigned int)(v9 + 19));
if ( (v6 & 0x80000000) != 0 )
{
sub_100588C44(v13);
}
else
{
v14 = *((void (__fastcall **)(__int64, _QWORD, __int64, _BYTE *, _QWORD, unsigned int *, _QWORD))a1 + 19);
if ( v14 )
v14(1, *a1, 24, v13, v10, a1, *((_QWORD *)a1 + 20));
sub_100588C44(v13);
return 0;
}
}
}
else
{
return 0;
}
}
else
{
return 0;
}
return v6;
}