//
// OPENSSL_LH_insert from 0x1031904 to 0x1031b90 (652 bytes)
//
// 18 xrefs:
// > SSL_load_client_CA_file @ 0xfb9340
// > SSL_CTX_add_session @ 0xfc4c88
// > ERR_load_ERR_strings @ 0x101daac
// > ERR_load_ERR_strings @ 0x101dac8
// > ERR_load_ERR_strings @ 0x101daec
// > ERR_load_ERR_strings @ 0x101db60
// > ERR_load_strings @ 0x101dc74
// > ERR_load_strings @ 0x101dc8c
// > ERR_load_strings @ 0x101dcc8
// > OBJ_NAME_add @ 0x103f738
// > OBJ_add_object @ 0x104032c
// > TXT_DB_create_index @ 0x105f5f8
// > TXT_DB_create_index @ 0x105f66c
// > TXT_DB_insert @ 0x105f944
// > _CONF_add_string @ 0x10a1384
// > _CONF_new_section @ 0x10a15f0
// > engine_table_register @ 0x10dc358
// > ??> @ 0x68008
//
// 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:20 +0000
//
_QWORD *__fastcall OPENSSL_LH_insert(__int64 *a1, _QWORD *a2)
{
unsigned __int64 v4; // x0
unsigned int v5; // w1
unsigned __int64 v6; // x2
unsigned int v7; // w0
unsigned int v8; // w9
__int64 v9; // x2
__int64 v10; // x3
__int64 v11; // x7
__int64 *v12; // x6
_QWORD *v13; // x7
unsigned int v14; // w19
__int64 i; // x2
unsigned __int64 v16; // x21
unsigned __int64 v17; // x2
unsigned __int64 v18; // x3
unsigned __int64 v19; // x0
unsigned int (__fastcall *v20)(__int64, _QWORD *); // x24
_QWORD **v21; // x22
_QWORD *v22; // x19
__int64 v23; // x3
__int64 v24; // x0
_QWORD **v25; // x2
__int64 v26; // x1
_QWORD *result; // x0
__int64 v28; // x1
unsigned int v29; // w19
_QWORD *v30; // x2
unsigned int v31; // w0
unsigned int v32; // w1
__int64 v33; // x1
__int64 v34; // x3
__int64 v35; // x2
int v36; // w1
int v37; // w3
v4 = a1[7] << 8;
v5 = *((_DWORD *)a1 + 6);
v6 = a1[5];
*((_DWORD *)a1 + 42) = 0;
if ( v6 <= v4 / v5 )
{
v7 = *((_DWORD *)a1 + 8);
v8 = *((_DWORD *)a1 + 9);
v9 = *a1;
v10 = a1[8];
v11 = 8LL * (v8 + v7);
*((_DWORD *)a1 + 6) = v5 + 1;
*((_DWORD *)a1 + 8) = v7 + 1;
a1[8] = v10 + 1;
v12 = (__int64 *)(v9 + 8LL * v7);
*(_QWORD *)(v9 + v11) = 0;
v13 = (_QWORD *)(v9 + v11);
v14 = *((_DWORD *)a1 + 7);
for ( i = *v12; *v12; i = *v12 )
{
if ( v7 == *(_QWORD *)(i + 16) % (unsigned __int64)v14 )
{
v12 = (__int64 *)(i + 8);
}
else
{
*v12 = *(_QWORD *)(i + 8);
*(_QWORD *)(i + 8) = *v13;
*v13 = i;
}
}
if ( v7 + 1 >= v8 )
{
v28 = (int)(16 * v14);
v29 = 2 * v14;
result = (_QWORD *)CRYPTO_realloc(*a1, v28, "crypto/lhash/lhash.c", 214);
v30 = result;
if ( !result )
{
v36 = *((_DWORD *)a1 + 6);
v37 = *((_DWORD *)a1 + 42) + 1;
*((_DWORD *)a1 + 8) = 0;
*((_DWORD *)a1 + 42) = v37;
*((_DWORD *)a1 + 6) = v36 - 1;
return result;
}
v31 = *((_DWORD *)a1 + 7);
v32 = v31;
if ( v29 > v31 )
{
do
v30[v32++] = 0;
while ( v29 != v32 );
}
v33 = a1[9];
*((_DWORD *)a1 + 9) = v31;
*((_DWORD *)a1 + 7) = v29;
a1[9] = v33 + 1;
*((_DWORD *)a1 + 8) = 0;
*a1 = (__int64)v30;
}
}
v16 = ((__int64 (__fastcall *)(_QWORD *))a1[2])(a2);
v17 = *((unsigned int *)a1 + 9);
v18 = *((unsigned int *)a1 + 8);
++a1[12];
v19 = v16 % v17;
if ( v16 % v17 < v18 )
v19 = v16 % *((unsigned int *)a1 + 7);
v20 = (unsigned int (__fastcall *)(__int64, _QWORD *))a1[1];
v21 = (_QWORD **)(*a1 + 8LL * (int)v19);
v22 = *v21;
if ( !*v21 )
goto LABEL_21;
while ( 1 )
{
v23 = v22[2];
++a1[20];
if ( v16 == v23 )
{
v24 = *v22;
++a1[13];
if ( !v20(v24, a2) )
break;
}
v21 = (_QWORD **)(v22 + 1);
v22 = (_QWORD *)v22[1];
if ( !v22 )
goto LABEL_21;
}
v25 = (_QWORD **)*v21;
if ( *v21 )
{
v26 = a1[15];
result = *v25;
*v25 = a2;
a1[15] = v26 + 1;
}
else
{
LABEL_21:
result = (_QWORD *)CRYPTO_malloc(24, "crypto/lhash/lhash.c", 83);
if ( result )
{
*result = a2;
result[2] = v16;
result[1] = 0;
v34 = a1[14];
v35 = a1[7];
*v21 = result;
a1[14] = v34 + 1;
a1[7] = v35 + 1;
return nullptr;
}
else
{
++*((_DWORD *)a1 + 42);
}
}
return result;
}