//
// sub_C51CC0 from 0xc51cc0 to 0xc51e68 (424 bytes)
//
// 24 xrefs:
// > sub_C53C28 @ 0xc53c60
// > sub_C53C28 @ 0xc53c74
// > sub_C53C28 @ 0xc53cb4
// > sub_C53C28 @ 0xc53db0
// > sub_C53C28 @ 0xc53fb4
// > sub_C53C28 @ 0xc5409c
// > sub_C541F4 @ 0xc54494
// > sub_C541F4 @ 0xc545e0
// > sub_C546F8 @ 0xc5499c
// > sub_C546F8 @ 0xc54ae8
// > sub_C546F8 @ 0xc54bfc
// > sub_C54CE4 @ 0xc54d78
// > sub_C54CE4 @ 0xc54fc0
// > sub_C5516C @ 0xc55210
// > sub_C5516C @ 0xc5522c
// > sub_C5516C @ 0xc55250
// > sub_C5516C @ 0xc5526c
// > sub_C5516C @ 0xc55284
// > sub_C5516C @ 0xc5529c
// > sub_C5516C @ 0xc553a4
// > sub_C5516C @ 0xc55470
// > sub_C5516C @ 0xc554ec
// > sub_C5516C @ 0xc557c4
// > sub_C5516C @ 0xc55958
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:05:09 +0000
//
bool __fastcall sub_C51CC0(__int64 a1, __int64 a2)
{
__int64 v4; // x26
unsigned __int8 v5; // w19
int v6; // w24
size_t v7; // x2
unsigned __int8 v8; // w23
size_t v9; // x22
size_t v10; // x19
const void *v11; // x0
const void *v12; // x1
size_t v13; // x2
unsigned int v14; // w0
unsigned __int8 *v16; // x0
unsigned __int8 *v17; // x1
unsigned __int8 *v18; // x3
unsigned __int8 *v19; // x2
int v20; // t1
v4 = a1 + 96;
v5 = *(_BYTE *)(a1 + 96);
v6 = v5 & 1;
v7 = v5 >> 1;
if ( (v5 & 1) != 0 )
v7 = *(_QWORD *)(a1 + 104);
v8 = *(_BYTE *)(a2 + 96);
if ( (v8 & 1) != 0 )
{
v9 = *(_QWORD *)(a2 + 104);
if ( v9 != v7 )
goto LABEL_5;
}
else
{
v9 = v8 >> 1;
if ( v9 != v7 )
goto LABEL_5;
}
v16 = (unsigned __int8 *)(a1 + 97);
if ( (v5 & 1) != 0 )
v16 = *(unsigned __int8 **)(v4 + 16);
v17 = (unsigned __int8 *)(a2 + 97);
if ( (v8 & 1) != 0 )
v17 = *(unsigned __int8 **)(a2 + 112);
if ( (v5 & 1) != 0 )
{
if ( !v7 || !memcmp(v16, v17, v7) )
goto LABEL_26;
goto LABEL_40;
}
if ( v7 )
{
if ( *v16 == *v17 )
{
v18 = v16 + 1;
v19 = &v16[v7];
do
{
++v17;
if ( v18 == v19 )
goto LABEL_26;
v20 = *v18++;
}
while ( *v17 == v20 );
}
LABEL_40:
v9 = v8 >> 1;
if ( (v8 & 1) != 0 )
{
v9 = *(_QWORD *)(a2 + 104);
v10 = v5 >> 1;
if ( !v6 )
goto LABEL_7;
goto LABEL_6;
}
LABEL_5:
v10 = v5 >> 1;
if ( !v6 )
{
LABEL_7:
v11 = (const void *)(a2 + 97);
if ( (v8 & 1) != 0 )
v11 = *(const void **)(a2 + 112);
v12 = (const void *)(a1 + 97);
if ( v6 )
v12 = *(const void **)(v4 + 16);
goto LABEL_11;
}
LABEL_6:
v10 = *(_QWORD *)(v4 + 8);
goto LABEL_7;
}
LABEL_26:
v9 = *(_BYTE *)a2 >> 1;
if ( (*(_BYTE *)a2 & 1) != 0 )
v9 = *(_QWORD *)(a2 + 8);
v10 = *(_BYTE *)a1 >> 1;
if ( (*(_BYTE *)a1 & 1) != 0 )
v10 = *(_QWORD *)(a1 + 8);
v11 = (const void *)(a2 + 1);
if ( (*(_BYTE *)a2 & 1) != 0 )
v11 = *(const void **)(a2 + 16);
v12 = (const void *)(a1 + 1);
if ( (*(_BYTE *)a1 & 1) != 0 )
v12 = *(const void **)(a1 + 16);
LABEL_11:
if ( v10 > v9 )
v13 = v9;
else
v13 = v10;
if ( v13 && (v14 = memcmp(v11, v12, v13)) != 0 )
return v14 >> 31;
else
return v9 < v10;
}