//
// sub_100589640 from 0x100589640 to 0x100589805 (453 bytes)
//
// 1 xrefs:
// > MusicSearchResult::updateObjects_1 @ 0x10059a125
//
// 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_100589640(__int64 *a1, __int64 *a2, __m128 a3)
{
__int64 v3; // rax
__int64 v4; // r14
unsigned int v5; // ebx
__int64 v6; // rax
__int8 *v7; // rbx
__int8 *v8; // r15
__int128 *v9; // r14
size_t v10; // r13
char *v11; // rdx
size_t v12; // rax
char v13; // r12
char *v14; // r15
char *v15; // rbx
char *v16; // r14
char v17; // r14
size_t v18; // rbx
__int8 *v19; // rdi
const void *v20; // rsi
_BOOL4 v21; // r15d
size_t v22; // rdx
int v23; // eax
bool v24; // cf
void *__p; // [rsp+8h] [rbp-68h]
__int128 v27; // [rsp+10h] [rbp-60h] BYREF
void *__s2; // [rsp+20h] [rbp-50h]
__m128 __s1; // [rsp+30h] [rbp-40h] BYREF
void *v30; // [rsp+40h] [rbp-30h]
v3 = *a1;
v4 = *a2;
v5 = *(_DWORD *)(*a2 + 524) - *(_DWORD *)(*a1 + 524);
if ( !v5 )
{
if ( (*(_BYTE *)(v3 + 320) & 1) != 0 )
{
sub_100006B70(&__s1, *(const void **)(v3 + 336), *(_QWORD *)(v3 + 328), *(double *)a3.i64);
}
else
{
v6 = v3 + 320;
v30 = *(void **)(v6 + 16);
a3 = *(__m128 *)v6;
__s1 = *(__m128 *)v6;
}
v7 = (__int8 *)v30;
v8 = &__s1.i8[(__s1.u8[0] >> 1) + 1];
if ( (__s1.i8[0] & 1) != 0 )
v8 = (char *)v30 + __s1.i64[1];
else
v7 = &__s1.i8[1];
for ( ; v7 != v8; ++v7 )
*v7 = __tolower((unsigned __int8)*v7);
if ( (*(_BYTE *)(v4 + 320) & 1) != 0 )
{
sub_100006B70(&v27, *(const void **)(v4 + 336), *(_QWORD *)(v4 + 328), *(double *)a3.i64);
}
else
{
v9 = (__int128 *)(v4 + 320);
__s2 = *((void **)v9 + 2);
v27 = *v9;
}
v10 = *((_QWORD *)&v27 + 1);
v11 = (char *)__s2;
v12 = (unsigned __int8)v27 >> 1;
v13 = v27 & 1;
v14 = (char *)&v27 + 1;
v15 = (char *)&v27 + v12 + 1;
if ( (v27 & 1) != 0 )
v15 = (char *)__s2 + *((_QWORD *)&v27 + 1);
v16 = (char *)__s2;
if ( (v27 & 1) == 0 )
v16 = (char *)&v27 + 1;
if ( v16 != v15 )
{
do
{
*v16 = __tolower((unsigned __int8)*v16);
++v16;
}
while ( v16 != v15 );
v10 = *((_QWORD *)&v27 + 1);
v11 = (char *)__s2;
v13 = v27 & 1;
v12 = (unsigned __int8)v27 >> 1;
}
v17 = __s1.i8[0] & 1;
if ( (__s1.i8[0] & 1) != 0 )
{
v18 = __s1.u64[1];
v19 = (__int8 *)v30;
}
else
{
v18 = __s1.u8[0] >> 1;
v19 = &__s1.i8[1];
}
if ( v13 )
v14 = v11;
else
v10 = v12;
v20 = v14;
v21 = v10 < v18;
__p = v11;
v22 = v18;
if ( v10 < v18 )
v22 = v10;
v23 = memcmp(v19, v20, v22);
v24 = v18 < v10;
v5 = -1;
if ( !v24 )
v5 = v21;
if ( v23 )
v5 = v23;
if ( v13 )
{
operator delete(__p);
v17 = __s1.i8[0] & 1;
}
if ( v17 )
operator delete(v30);
}
return v5;
}