//
// DS_Dictionary::getIndexOfKeyWithClosestAlphaNumericalMatch from 0x18001a3b0 to 0x18001a56f (447 bytes)
//
// 2 xrefs:
// > ??> @ 0x18014cf68
// > ??> @ 0x1801b8a40
//
// This function is hookable on this platform (idp: pc, 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 11:21:26 +0000
//
__int64 __fastcall DS_Dictionary::getIndexOfKeyWithClosestAlphaNumericalMatch(DS_Dictionary *this, const char *a2)
{
DS_Dictionary *v2; // rsi
const char *v4; // r8
unsigned int v5; // r13d
bool v6; // zf
__int64 v7; // rcx
const char *v8; // rbx
const char *v9; // rdi
int v10; // r15d
int v11; // eax
int v12; // r14d
int v13; // eax
int v14; // ebp
int v15; // esi
int v16; // ecx
int v17; // ecx
int v18; // ecx
const char *v19; // r8
__int64 v22; // [rsp+70h] [rbp+18h] BYREF
char v23; // [rsp+78h] [rbp+20h] BYREF
v2 = this;
v4 = "k";
v5 = 0;
v6 = *((_BYTE *)this + 232) == 0;
v7 = *((_QWORD *)this + 27);
if ( !v6 )
v4 = "key";
sub_180082A40(v7 - 8, &v22, v4);
if ( !sub_1800823F0(&v22) )
return 0;
while ( 1 )
{
v8 = (const char *)sub_180082AC0(&v22);
v9 = a2;
v10 = sub_18001C060(a2);
v11 = sub_18001C060(v8);
v12 = v11;
if ( !v10 )
{
if ( v11 )
return v5;
v13 = stricmp(a2, v8);
goto LABEL_18;
}
if ( !v11 )
return v5;
v14 = 0;
v15 = 0;
if ( v10 > 0 )
break;
LABEL_16:
if ( v15 < v12 )
return v5;
v13 = stricmp(v9, v8);
v2 = this;
LABEL_18:
v18 = v13;
LABEL_19:
if ( v18 )
return v5;
++v5;
v19 = "k";
if ( *((_BYTE *)v2 + 232) )
v19 = "key";
v22 = *(_QWORD *)sub_180084A40(&v22, &v23, v19);
if ( !sub_1800823F0(&v22) )
return 0;
}
while ( v15 < v12 )
{
if ( !isdigit(*v9) )
{
do
v16 = *++v9;
while ( !isdigit(v16) );
}
if ( !isdigit(*v8) )
{
do
v17 = *++v8;
while ( !isdigit(v17) );
}
if ( *v9 != *v8 )
{
v2 = this;
v18 = *v9 - *v8;
goto LABEL_19;
}
++v9;
++v8;
++v14;
++v15;
if ( v14 >= v10 )
goto LABEL_16;
}
return v5;
}