//
// OPENSSL_LH_delete from 0x80c684 to 0x80c8a0 (540 bytes)
//
// 8 xrefs:
// > SSL_CTX_remove_session @ 0x79de4c
// > sub_79DED8 @ 0x79df0c
// > SSL_CTX_add_session @ 0x79e200
// > ERR_unload_strings @ 0x7f9c64
// > ERR_unload_strings @ 0x7f9ca4
// > OBJ_NAME_remove @ 0x81bc64
// > sub_878660 @ 0x878678
// > ??> @ 0x5ca6c
//
// 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 OPENSSL_LH_delete(int *a1, int a2)
{
unsigned int v4; // r0
unsigned int v5; // r1
unsigned int v6; // r9
unsigned int v7; // r1
int (__fastcall *v8)(int, int); // r8
_DWORD *v9; // r4
int **v10; // r6
int v11; // r2
int v12; // r0
int *v13; // r3
int v14; // r4
unsigned int v15; // r6
int v16; // r3
int v18; // r2
int v19; // r1
int v20; // r3
int v21; // r8
int v22; // r0
int v23; // r3
int v24; // r2
int v25; // r1
unsigned int v26; // r2
int v27; // r12
unsigned int v28; // r1
a1[23] = 0;
v4 = ((int (__fastcall *)(int))a1[2])(a2);
v5 = a1[6];
++a1[14];
v6 = v4;
v7 = v4 % v5;
if ( v7 < a1[5] )
v7 = v4 % a1[4];
v8 = (int (__fastcall *)(int, int))a1[1];
v9 = *(_DWORD **)(*a1 + 4 * v7);
v10 = (int **)(*a1 + 4 * v7);
if ( !v9 )
goto LABEL_19;
while ( 1 )
{
v11 = v9[2];
++a1[22];
if ( v6 == v11 )
{
v12 = *v9;
++a1[15];
if ( !v8(v12, a2) )
break;
}
v10 = (int **)(v9 + 1);
v9 = (_DWORD *)v9[1];
if ( !v9 )
goto LABEL_19;
}
v13 = *v10;
if ( !*v10 )
{
LABEL_19:
++a1[19];
return 0;
}
*v10 = (int *)v13[1];
v14 = *v13;
CRYPTO_free(v13, "crypto/lhash/lhash.c", 119);
v15 = a1[3];
v16 = a1[9] - 1;
++a1[18];
a1[9] = v16;
if ( v15 <= 0x10 || a1[8] < (v16 << 8) / v15 )
return v14;
v18 = a1[5];
v19 = a1[6];
v20 = v18 + v19 + 0x3FFFFFFF;
v21 = *(_DWORD *)(*a1 + 4 * v20);
*(_DWORD *)(*a1 + 4 * v20) = 0;
if ( v18 )
{
v22 = *a1;
v23 = v18 - 1;
a1[5] = v18 - 1;
}
else
{
v22 = CRYPTO_realloc(*a1, 4 * v19, "crypto/lhash/lhash.c", 240);
if ( !v22 )
{
++a1[23];
return v14;
}
v26 = (unsigned int)a1[6] >> 1;
v23 = v26 - 1;
v27 = a1[13] + 1;
v28 = (unsigned int)a1[4] >> 1;
*a1 = v22;
a1[6] = v26;
a1[5] = v26 - 1;
a1[13] = v27;
a1[4] = v28;
v15 = a1[3];
}
v24 = *(_DWORD *)(v22 + 4 * v23);
v25 = a1[12] + 1;
a1[3] = v15 - 1;
a1[12] = v25;
if ( v24 )
{
while ( *(_DWORD *)(v24 + 4) )
v24 = *(_DWORD *)(v24 + 4);
*(_DWORD *)(v24 + 4) = v21;
return v14;
}
else
{
*(_DWORD *)(v22 + 4 * v23) = v21;
return v14;
}
}