//
// sub_100589A70 from 0x100589a70 to 0x100589c27 (439 bytes)
//
// 1 xrefs:
// > ??> @ 0x100970bb8
//
// 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_100589A70(__int64 *a1, __int64 *a2, __m128 a3)
{
__int64 v3; // rax
__int64 v4; // r14
unsigned int v5; // ebx
__int64 v6; // rax
char *v7; // rbx
char *v8; // r15
__int128 *v9; // r14
size_t v10; // rax
char *v11; // rdx
size_t v12; // r13
char v13; // r12
char *v14; // rdi
char *v15; // rbx
char *v16; // r14
char v17; // r14
size_t v18; // rbx
char *v19; // rsi
_BOOL4 v20; // r15d
size_t v21; // rdx
int v22; // eax
bool v23; // cf
void *__p; // [rsp+8h] [rbp-68h]
__int128 v26; // [rsp+10h] [rbp-60h] BYREF
void *__s1; // [rsp+20h] [rbp-50h]
size_t __n[2]; // [rsp+30h] [rbp-40h] BYREF
void *v29; // [rsp+40h] [rbp-30h]
v3 = *a1;
v4 = *a2;
v5 = *(unsigned __int8 *)(*a2 + 72);
if ( *(_BYTE *)(*a1 + 72) == (_BYTE)v5 )
{
if ( (*(_BYTE *)(v3 + 80) & 1) != 0 )
{
sub_100006B70(__n, *(const void **)(v3 + 96), *(_QWORD *)(v3 + 88), *(double *)a3.i64);
}
else
{
v6 = v3 + 80;
v29 = *(void **)(v6 + 16);
a3 = *(__m128 *)v6;
*(_OWORD *)__n = *(_OWORD *)v6;
}
v7 = (char *)v29;
v8 = (char *)__n + (LOBYTE(__n[0]) >> 1) + 1;
if ( (__n[0] & 1) != 0 )
v8 = (char *)v29 + __n[1];
else
v7 = (char *)__n + 1;
for ( ; v7 != v8; ++v7 )
*v7 = __tolower((unsigned __int8)*v7);
if ( (*(_BYTE *)(v4 + 80) & 1) != 0 )
{
sub_100006B70(&v26, *(const void **)(v4 + 96), *(_QWORD *)(v4 + 88), *(double *)a3.i64);
}
else
{
v9 = (__int128 *)(v4 + 80);
__s1 = *((void **)v9 + 2);
v26 = *v9;
}
v10 = *((_QWORD *)&v26 + 1);
v11 = (char *)__s1;
v12 = (unsigned __int8)v26 >> 1;
v13 = v26 & 1;
v14 = (char *)&v26 + 1;
v15 = (char *)&v26 + v12 + 1;
if ( (v26 & 1) != 0 )
v15 = (char *)__s1 + *((_QWORD *)&v26 + 1);
v16 = (char *)__s1;
if ( (v26 & 1) == 0 )
v16 = (char *)&v26 + 1;
if ( v16 != v15 )
{
do
{
*v16 = __tolower((unsigned __int8)*v16);
++v16;
}
while ( v16 != v15 );
v10 = *((_QWORD *)&v26 + 1);
v11 = (char *)__s1;
v13 = v26 & 1;
v12 = (unsigned __int8)v26 >> 1;
v14 = (char *)&v26 + 1;
}
if ( v13 )
{
v12 = v10;
v14 = v11;
}
v17 = __n[0] & 1;
__p = v11;
if ( (__n[0] & 1) != 0 )
{
v18 = __n[1];
v19 = (char *)v29;
}
else
{
v18 = LOBYTE(__n[0]) >> 1;
v19 = (char *)__n + 1;
}
v20 = v18 < v12;
v21 = v12;
if ( v18 < v12 )
v21 = v18;
v22 = memcmp(v14, v19, v21);
v23 = v12 < v18;
v5 = -1;
if ( !v23 )
v5 = v20;
if ( v22 )
v5 = v22;
if ( v13 )
{
operator delete(__p);
v17 = __n[0] & 1;
}
if ( v17 )
operator delete(v29);
}
return v5;
}