//
// compareStrings from 0x78bd48 to 0x78c0fc (948 bytes)
//
// 1 xrefs:
// > ??> @ 0xb6268
//
// 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 compareStrings(unsigned __int8 **a1, unsigned __int8 **a2)
{
unsigned __int8 *v3; // x2
unsigned __int8 *v5; // x4
__int64 v6; // x6
__int64 v7; // x5
unsigned __int8 *v8; // x6
unsigned __int8 *v9; // x1
unsigned __int8 *v10; // x5
unsigned __int8 *v11; // x0
int v12; // t1
int v13; // w19
__int64 v15; // x0
int v16; // w25
int v17; // w19
unsigned __int64 v18; // x24
int v19; // w26
unsigned __int64 v20; // x4
__int64 v21; // x0
void *v22; // x0
__int64 v23; // x0
void *v24; // x21
unsigned int *v25; // x19
int v26; // w0
unsigned int *v27; // x1
int v28; // w2
__int64 v29; // x0
__int64 v30; // [xsp+70h] [xbp+70h] BYREF
v3 = *a2;
v5 = *a1;
v6 = *((_QWORD *)*a1 - 3);
v7 = *((_QWORD *)*a2 - 3);
if ( !v6 )
{
v10 = &v3[v7];
goto LABEL_8;
}
if ( !v7 )
{
LABEL_9:
sub_CEE964(&qword_1249C10, "The strings have different lengths.\n", 36);
return _stack_chk_guard;
}
if ( *v5 == *v3 )
{
v8 = &v5[v6];
v9 = v3 + 1;
v10 = &v3[v7];
v11 = *a1;
while ( 1 )
{
++v11;
v3 = v9;
v13 = (_DWORD)v11 - (_DWORD)v5;
if ( v11 == v8 )
break;
if ( v9 == v10 )
goto LABEL_9;
v12 = *v9++;
if ( *v11 != v12 )
{
sub_CEE964(&qword_1249C10, "Mismatch found at position ", 27);
v15 = sub_CEF1D4(&qword_1249C10, (unsigned int)v13);
sub_CEE964(v15, ":\n", 2);
if ( v13 <= 100 )
{
v17 = v13 + 100;
v18 = 0;
v16 = 0;
}
else
{
v16 = v13 - 100;
v17 = v13 + 100;
v18 = v16;
}
goto LABEL_13;
}
}
LABEL_8:
if ( v3 == v10 )
{
sub_CEE964(&qword_1249C10, "The strings are identical.\n", 27);
return _stack_chk_guard;
}
goto LABEL_9;
}
v18 = 0;
v16 = 0;
sub_CEE964(&qword_1249C10, "Mismatch found at position ", 27);
v17 = 100;
v29 = sub_CEF1D4(&qword_1249C10, 0);
sub_CEE964(v29, ":\n", 2);
LABEL_13:
if ( v17 > (int)*((_QWORD *)*a1 - 3) )
v19 = *((_QWORD *)*a1 - 3);
else
v19 = v17;
if ( v17 > (int)*((_QWORD *)*a2 - 3) )
v17 = *((_QWORD *)*a2 - 3);
sub_CEE964(&qword_1249C10, "Str1: ", 6);
v20 = *((_QWORD *)*a1 - 3);
if ( v20 < v18 )
goto LABEL_38;
sub_D14F84(&v30, a1, v18, v19 - v16);
v21 = sub_CEE964(&qword_1249C10, v30, *(_QWORD *)(v30 - 24));
sub_CEE964(v21, &byte_F1AB78, 1);
v22 = (void *)(v30 - 24);
if ( (__int64 *)(v30 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(v30 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *(_DWORD *)(v30 - 8);
*(_DWORD *)(v30 - 8) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v22);
}
sub_CEE964(&qword_1249C10, "Str2: ", 6);
v20 = *((_QWORD *)*a2 - 3);
if ( v20 < v18 )
LABEL_38:
sub_D13C5C("%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::substr", v18, v20);
sub_D14F84(&v30, a2, v18, v17 - v16);
v23 = sub_CEE964(&qword_1249C10, v30, *(_QWORD *)(v30 - 24));
sub_CEE964(v23, &byte_F1AB78, 1);
v24 = (void *)(v30 - 24);
if ( (__int64 *)(v30 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v30 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *(_DWORD *)(v30 - 8);
*(_DWORD *)(v30 - 8) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v24);
}
return _stack_chk_guard;
}