//
// TXT_DB_create_index from 0x839298 to 0x8393c4 (300 bytes)
//
// 1 xrefs:
// > ??> @ 0x6684c
//
// 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
//
int __fastcall TXT_DB_create_index(
_DWORD *a1,
int a2,
int (*a3)(void),
unsigned __int8 *(__fastcall *a4)(unsigned __int8 *result),
int (**a5)(const char *, const char *))
{
int *v9; // r7
int v10; // r8
unsigned int v11; // r4
int v12; // r6
int v13; // r0
int v14; // r0
int v15; // r0
if ( *a1 > a2 )
{
v9 = OPENSSL_LH_new(a4, a5);
if ( v9 )
{
v10 = OPENSSL_sk_num(a1[1]);
if ( v10 <= 0 )
{
LABEL_11:
OPENSSL_LH_free(*(int **)(a1[2] + 4 * a2));
*(_DWORD *)(a1[2] + 4 * a2) = v9;
*(_DWORD *)(a1[3] + 4 * a2) = a3;
return 1;
}
else
{
if ( a3 )
{
v11 = 0;
while ( 1 )
{
v12 = OPENSSL_sk_value((_DWORD *)a1[1], v11);
if ( a3() )
{
v13 = OPENSSL_LH_insert(v9, v12);
if ( v13 )
break;
}
if ( ++v11 == v10 )
goto LABEL_11;
}
}
else
{
v11 = 0;
while ( 1 )
{
v14 = OPENSSL_sk_value((_DWORD *)a1[1], v11);
v13 = OPENSSL_LH_insert(v9, v14);
if ( v13 )
break;
if ( ++v11 == v10 )
goto LABEL_11;
}
}
a1[4] = 2;
v15 = OPENSSL_sk_find(a1[1], v13);
a1[6] = v11;
a1[5] = v15;
OPENSSL_LH_free(v9);
return 0;
}
}
else
{
a1[4] = 1;
return 0;
}
}
else
{
a1[4] = 3;
return 0;
}
}