//
// TXT_DB_insert from 0xa4e15c to 0xa4e280 (292 bytes)
//
// 1 xrefs:
// > ??> @ 0x802ec
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:08:21 +0000
//
int __fastcall TXT_DB_insert(int a1, int a2)
{
int v2; // r2
int v5; // r4
int v6; // r3
int (__fastcall *v7)(int); // r2
int v8; // r0
int result; // r0
int v10; // r2
int v11; // r4
int *v12; // r3
int (__fastcall *v13)(int); // r2
v2 = *(_DWORD *)a1;
if ( *(int *)a1 <= 0 )
{
LABEL_11:
result = OPENSSL_sk_push(*(int **)(a1 + 4), a2);
if ( !result )
{
*(_DWORD *)(a1 + 16) = 1;
return result;
}
v10 = *(_DWORD *)a1;
if ( *(int *)a1 <= 0 )
return 1;
v11 = 0;
while ( 1 )
{
v12 = *(int **)(*(_DWORD *)(a1 + 8) + 4 * v11);
if ( v12 )
break;
LABEL_21:
if ( ++v11 >= v10 )
return 1;
}
v13 = *(int (__fastcall **)(int))(*(_DWORD *)(a1 + 12) + 4 * v11);
if ( v13 )
{
if ( !v13(a2) )
{
LABEL_20:
v10 = *(_DWORD *)a1;
goto LABEL_21;
}
v12 = *(int **)(*(_DWORD *)(a1 + 8) + 4 * v11);
}
OPENSSL_LH_insert(v12, a2);
goto LABEL_20;
}
v5 = 0;
while ( 1 )
{
v6 = *(_DWORD *)(*(_DWORD *)(a1 + 8) + 4 * v5);
if ( v6 )
break;
LABEL_10:
if ( ++v5 >= v2 )
goto LABEL_11;
}
v7 = *(int (__fastcall **)(int))(*(_DWORD *)(a1 + 12) + 4 * v5);
if ( v7 )
{
if ( !v7(a2) )
{
LABEL_9:
v2 = *(_DWORD *)a1;
goto LABEL_10;
}
v6 = *(_DWORD *)(*(_DWORD *)(a1 + 8) + 4 * v5);
}
v8 = OPENSSL_LH_retrieve(v6, a2);
if ( !v8 )
goto LABEL_9;
*(_DWORD *)(a1 + 28) = v8;
*(_DWORD *)(a1 + 20) = v5;
*(_DWORD *)(a1 + 16) = 2;
return 0;
}