//
// TXT_DB_free from 0x839680 to 0x839808 (392 bytes)
//
// 2 xrefs:
// > SRP_VBASE_init @ 0x837a78
// > ??> @ 0x6676c
//
// 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
//
void __fastcall TXT_DB_free(void *a1)
{
char *v2; // r0
int v3; // r4
int v4; // r5
int v5; // r0
int v6; // r8
int v7; // r0
int v8; // lr
unsigned int v9; // r5
unsigned int v10; // r11
int v11; // r10
int i; // r4
void *v13; // r12
void *v14; // t1
int v15; // r3
void *v16; // r0
int v17; // r11
void *v18; // t1
if ( a1 )
{
v2 = *((char **)a1 + 2);
if ( v2 )
{
v3 = *(_DWORD *)a1 - 1;
if ( v3 >= 0 )
{
v4 = 4 * v3;
do
{
--v3;
OPENSSL_LH_free(*(int **)&v2[v4]);
v2 = *((char **)a1 + 2);
v4 -= 4;
}
while ( v3 != -1 );
}
CRYPTO_free(v2, (int)"crypto/txt_db/txt_db.c", 276);
}
CRYPTO_free(*((void **)a1 + 3), (int)"crypto/txt_db/txt_db.c", 278);
v5 = *((_DWORD *)a1 + 1);
if ( v5 )
{
v6 = OPENSSL_sk_num(v5) - 1;
if ( v6 >= 0 )
{
do
{
v7 = OPENSSL_sk_value(*((_DWORD **)a1 + 1), v6);
v8 = *(_DWORD *)a1;
v9 = *(_DWORD *)(v7 + 4 * *(_DWORD *)a1);
v10 = v7;
if ( v9 )
{
if ( v8 > 0 )
{
v11 = v7 - 4;
for ( i = 0; i < v8; ++i )
{
v14 = *(void **)(v11 + 4);
v11 += 4;
v13 = v14;
v15 = v10 > (unsigned int)v14;
if ( v9 < (unsigned int)v14 )
v15 |= 1u;
if ( v15 )
{
CRYPTO_free(v13, (int)"crypto/txt_db/txt_db.c", 293);
v8 = *(_DWORD *)a1;
}
}
}
}
else if ( v8 > 0 )
{
v17 = v7 - 4;
do
{
v18 = *(void **)(v17 + 4);
v17 += 4;
CRYPTO_free(v18, (int)"crypto/txt_db/txt_db.c", 289);
++v9;
}
while ( *(_DWORD *)a1 > (signed int)v9 );
}
v16 = (void *)OPENSSL_sk_value(*((_DWORD **)a1 + 1), v6--);
CRYPTO_free(v16, (int)"crypto/txt_db/txt_db.c", 296);
}
while ( v6 != -1 );
}
OPENSSL_sk_free(*((void ***)a1 + 1));
}
CRYPTO_free(a1, (int)"crypto/txt_db/txt_db.c", 300);
}
}