//
// TXT_DB_insert from 0x105f86c to 0x105f9bc (336 bytes)
//
// 1 xrefs:
// > ??> @ 0xb8cf0
//
// This function is hookable on this platform (idp: arm, 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 13:16:50 +0000
//
__int64 __fastcall TXT_DB_insert(__int64 a1, _QWORD *a2)
{
int v2; // w3
__int64 v3; // x19
int v6; // w21
__int64 v7; // x2
unsigned int (__fastcall *v8)(_QWORD *); // x3
__int64 v9; // x0
int v10; // w1
__int64 v11; // x19
int v12; // w21
__int64 *v13; // x2
unsigned int (__fastcall *v14)(_QWORD *); // x1
v2 = *(_DWORD *)a1;
v3 = 0;
v6 = 0;
if ( *(int *)a1 > 0 )
{
while ( 1 )
{
v7 = *(_QWORD *)(*(_QWORD *)(a1 + 16) + v3);
if ( v7 )
break;
LABEL_8:
++v6;
v3 += 8;
if ( v6 >= v2 )
goto LABEL_9;
}
v8 = *(unsigned int (__fastcall **)(_QWORD *))(*(_QWORD *)(a1 + 24) + v3);
if ( v8 )
{
if ( !v8(a2) )
{
LABEL_7:
v2 = *(_DWORD *)a1;
goto LABEL_8;
}
v7 = *(_QWORD *)(*(_QWORD *)(a1 + 16) + v3);
}
v9 = OPENSSL_LH_retrieve(v7, (__int64)a2);
if ( v9 )
{
*(_QWORD *)(a1 + 56) = v9;
*(_QWORD *)(a1 + 40) = v6;
*(_QWORD *)(a1 + 32) = 2;
return 0;
}
goto LABEL_7;
}
LABEL_9:
if ( (unsigned int)OPENSSL_sk_push(*(int **)(a1 + 8), (__int64)a2) )
{
v10 = *(_DWORD *)a1;
v11 = 0;
v12 = 0;
if ( *(int *)a1 <= 0 )
return 1;
while ( 1 )
{
v13 = *(__int64 **)(*(_QWORD *)(a1 + 16) + v11);
if ( v13 )
break;
LABEL_17:
++v12;
v11 += 8;
if ( v12 >= v10 )
return 1;
}
v14 = *(unsigned int (__fastcall **)(_QWORD *))(*(_QWORD *)(a1 + 24) + v11);
if ( v14 )
{
if ( !v14(a2) )
{
LABEL_16:
v10 = *(_DWORD *)a1;
goto LABEL_17;
}
v13 = *(__int64 **)(*(_QWORD *)(a1 + 16) + v11);
}
OPENSSL_LH_insert(v13, a2);
goto LABEL_16;
}
*(_QWORD *)(a1 + 32) = 1;
return 0;
}