//
// OPENSSL_sk_deep_copy from 0xde08e0 to 0xde0a48 (360 bytes)
//
// 2 xrefs:
// > X509_VERIFY_PARAM_inherit @ 0xdeed98
// > ??> @ 0x31ad0
//
// 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
//
_QWORD *__fastcall OPENSSL_sk_deep_copy(__int64 a1, __int64 (__fastcall *a2)(__int64), void (__fastcall *a3)(__int64))
{
_QWORD *v6; // x0
_QWORD *v7; // x21
__int64 v8; // x5
int v9; // w0
__int64 v10; // x5
void *v11; // x0
int v12; // w4
__int64 v13; // x20
int v14; // w19
__int64 v15; // x0
__int64 v16; // x23
__int64 v17; // x0
__int64 v19; // x20
__int64 v20; // x1
if ( (*(_DWORD *)a1 & 0x80000000) != 0 )
return nullptr;
v6 = CRYPTO_malloc(&qword_28, (__int64)"crypto/stack/stack.c", 72);
v7 = v6;
if ( !v6 )
return nullptr;
v8 = *(_QWORD *)(a1 + 8);
*v6 = *(_QWORD *)a1;
v6[1] = v8;
v9 = *(_DWORD *)a1;
v10 = *(_QWORD *)(a1 + 24);
if ( *(int *)a1 < 4 )
v9 = 4;
v7[2] = *(_QWORD *)(a1 + 16);
v7[3] = v10;
v7[4] = *(_QWORD *)(a1 + 32);
v7[3] = v9;
v11 = CRYPTO_zalloc((void *)(8LL * v9), (__int64)"crypto/stack/stack.c", 79);
v7[1] = v11;
if ( !v11 )
{
CRYPTO_free(v7, (__int64)"crypto/stack/stack.c", 81);
return nullptr;
}
v12 = *(_DWORD *)v7;
v13 = 0;
v14 = 0;
if ( *(int *)v7 <= 0 )
return v7;
while ( 1 )
{
v15 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + v13);
if ( v15 )
break;
LABEL_10:
++v14;
v13 += 8;
if ( v14 >= v12 )
return v7;
}
v16 = v7[1];
v17 = a2(v15);
*(_QWORD *)(v16 + v13) = v17;
if ( v17 )
{
v12 = *(_DWORD *)v7;
goto LABEL_10;
}
v19 = 8LL * v14 - 8;
while ( --v14 >= 0 )
{
while ( 1 )
{
v20 = *(_QWORD *)(v7[1] + v19);
v19 -= 8;
if ( !v20 )
break;
a3(v20);
if ( --v14 < 0 )
goto LABEL_16;
}
}
LABEL_16:
OPENSSL_sk_free((void **)v7);
return nullptr;
}