//
// sub_100720EB0 from 0x100720eb0 to 0x10072109d (493 bytes)
//
// 4 xrefs:
// > sub_1007210B0 @ 0x1007210bd
// > sub_1007210F0 @ 0x100721102
// > sub_100721130 @ 0x100721143
// > sub_1007211B0 @ 0x1007211c6
//
// 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 12:36:13 +0000
//
__int64 __fastcall sub_100720EB0(__int64 a1, const char *a2, int a3)
{
char v4; // si
char *v5; // rax
unsigned int v6; // ecx
unsigned int v7; // eax
__int64 v8; // r13
const char *v9; // r12
int v10; // r14d
unsigned int v11; // eax
size_t v12; // rax
size_t v13; // r12
__int64 v14; // rax
void *v15; // rdi
__int64 result; // rax
size_t v17; // rax
__int64 v18; // rax
size_t v19; // rax
__int64 v20; // rax
__int64 v23; // [rsp+10h] [rbp-30h]
v4 = *a2;
if ( v4 )
{
v5 = (char *)(a2 + 1);
v6 = 0;
do
{
v6 = (1025 * (v6 + v4)) ^ ((1025 * (v6 + v4)) >> 6);
v4 = *v5++;
}
while ( v4 );
v7 = 9 * v6;
}
else
{
v7 = 0;
}
v8 = ((unsigned __int8)v7 ^ (unsigned __int8)(v7 >> 11)) & 0x3F;
v9 = *(const char **)(a1 + 8 * v8);
if ( v9 )
{
while ( 1 )
{
v10 = *(_DWORD *)v9;
v11 = *(_DWORD *)v9 - 1;
if ( v11 >= 4 )
sub_1009A8210();
if ( !strcmp(&v9[qword_100A12170[v11]], a2) )
break;
v9 = *((const char **)v9 + 1);
if ( !v9 )
goto LABEL_10;
}
result = 0;
if ( v10 == a3 )
return (__int64)v9;
}
else
{
LABEL_10:
switch ( a3 )
{
case 1:
v19 = strlen(a2);
if ( !v19 )
goto LABEL_24;
v13 = v19;
v20 = off_100BE07E8();
if ( !v20 )
goto LABEL_24;
*(_OWORD *)(v20 + 32) = 0;
*(_OWORD *)(v20 + 48) = 0;
*(_OWORD *)(v20 + 16) = 0;
*(_OWORD *)v20 = 0;
*(_QWORD *)(v20 + 40) = v20 + 24;
*(_QWORD *)(v20 + 48) = v20 + 24;
v23 = v20;
v15 = (void *)(v20 + 56);
goto LABEL_23;
case 2:
case 3:
v12 = strlen(a2);
if ( !v12 )
goto LABEL_24;
v13 = v12;
v14 = off_100BE07E8();
if ( !v14 )
goto LABEL_24;
*(_DWORD *)v14 = 0;
*(_OWORD *)(v14 + 8) = 0;
v23 = v14;
v15 = (void *)(v14 + 24);
goto LABEL_23;
case 4:
v17 = strlen(a2);
if ( !v17 )
goto LABEL_24;
v13 = v17;
v18 = off_100BE07E8();
if ( !v18 )
goto LABEL_24;
*(_DWORD *)v18 = 0;
*(_QWORD *)(v18 + 8) = 0;
*(_BYTE *)(v18 + 16) = 0;
v23 = v18;
v15 = (void *)(v18 + 17);
LABEL_23:
memcpy(v15, a2, v13 + 1);
*(_DWORD *)v23 = a3;
*(_QWORD *)(v23 + 8) = *(_QWORD *)(a1 + 8 * v8);
*(_QWORD *)(a1 + 8 * v8) = v23;
result = v23;
break;
default:
LABEL_24:
result = 0;
break;
}
}
return result;
}