//
// BIO_dup_chain from 0x7d113c to 0x7d1218 (220 bytes)
//
// 1 xrefs:
// > ??> @ 0x5f79c
//
// 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 BIO_dup_chain(int *a1)
{
int *v1; // r4
_DWORD *v2; // r6
int v3; // r9
int v4; // r11
int v5; // r10
int v6; // r8
int v7; // r7
int v8; // lr
_DWORD *v9; // r5
v1 = a1;
if ( a1 )
{
v2 = nullptr;
v3 = 0;
while ( 1 )
{
v9 = BIO_new(*v1);
if ( !v9 )
break;
v4 = v1[1];
v5 = v1[2];
v6 = v1[3];
v7 = v1[4];
v8 = v1[5];
v9[7] = v1[7];
v9[1] = v4;
v9[2] = v5;
v9[3] = v6;
v9[4] = v7;
v9[5] = v8;
if ( !BIO_ctrl(v1, 12, 0, (int)v9) || !CRYPTO_dup_ex_data(12, v9 + 16, v1 + 16) )
{
BIO_free(v9);
break;
}
if ( v3 )
BIO_push(v2, (int)v9);
else
v3 = (int)v9;
v1 = (int *)v1[9];
v2 = v9;
if ( !v1 )
return v3;
}
BIO_free_all(v3);
return 0;
}
else
{
return 0;
}
}