//
// OPENSSL_sk_deep_copy from 0x838a10 to 0x838b40 (304 bytes)
//
// 2 xrefs:
// > X509_VERIFY_PARAM_inherit @ 0x847180
// > ??> @ 0x667ec
//
// 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_sk_deep_copy(int *a1, int (__fastcall *a2)(_DWORD), void (__fastcall *a3)(int))
{
int *v6; // r5
int v7; // r1
int v8; // r2
int v9; // r3
int v10; // r3
void *v11; // r9
int v12; // r12
int v13; // r4
int v14; // r9
int v15; // r0
int v17; // r4
int v18; // r7
bool v19; // nf
int v20; // r3
if ( *a1 < 0 )
return nullptr;
v6 = (int *)CRYPTO_malloc(&dword_14, (int)"crypto/stack/stack.c", 72);
if ( !v6 )
return nullptr;
v7 = a1[1];
v8 = a1[2];
v9 = a1[3];
*v6 = *a1;
v6[1] = v7;
v6[2] = v8;
v6[3] = v9;
v10 = *a1;
if ( *a1 < 4 )
v10 = 4;
v6[4] = a1[4];
v6[3] = v10;
v11 = CRYPTO_zalloc((void *)(4 * v10), (int)"crypto/stack/stack.c", 79);
v6[1] = (int)v11;
if ( !v11 )
{
CRYPTO_free(v6, (int)"crypto/stack/stack.c", 81);
return nullptr;
}
v12 = *v6;
if ( *v6 <= 0 )
return v6;
v13 = 0;
while ( !*(_DWORD *)(a1[1] + 4 * v13) )
{
LABEL_12:
if ( ++v13 >= v12 )
return v6;
}
v14 = v6[1];
v15 = a2(*(_DWORD *)(a1[1] + 4 * v13));
*(_DWORD *)(v14 + 4 * v13) = v15;
if ( v15 )
{
v12 = *v6;
goto LABEL_12;
}
v17 = v13 - 1;
v18 = 4 * v17;
while ( 1 )
{
v19 = v17-- < 0;
if ( v19 )
break;
while ( 1 )
{
v20 = *(_DWORD *)(v6[1] + v18);
v18 -= 4;
if ( !v20 )
break;
a3(v20);
v19 = v17-- < 0;
if ( v19 )
goto LABEL_19;
}
}
LABEL_19:
OPENSSL_sk_free((void **)v6);
return nullptr;
}