//
// ASYNC_init_thread from 0xd70eec to 0xd710ac (448 bytes)
//
// 2 xrefs:
// > ASYNC_start_job @ 0xd713ec
// > ??> @ 0x62760
//
// 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
//
__int64 __fastcall ASYNC_init_thread(unsigned __int64 a1, unsigned __int64 a2)
{
unsigned int v4; // w19
__int64 v6; // x0
_QWORD *v7; // x22
__int64 v8; // x0
__int64 v9; // x0
__int64 v10; // x19
__int64 v11; // x0
if ( a2 > a1 )
{
ERR_put_error(51, 101, 103, "crypto/async/async.c", 322);
return 0;
}
else
{
if ( (unsigned int)OPENSSL_init_crypto(256) && (unsigned int)ossl_init_thread_start(1) )
{
v6 = CRYPTO_zalloc(24, "crypto/async/async.c", 333);
v7 = (_QWORD *)v6;
if ( v6 )
{
v8 = OPENSSL_sk_new_null(v6);
*v7 = v8;
v4 = v8;
if ( v8 )
{
v7[2] = a1;
if ( a2 )
{
v9 = CRYPTO_zalloc(40, "crypto/async/async.c", 84);
v10 = v9;
if ( v9 )
{
v11 = *(_QWORD *)(v9 + 16);
*(_DWORD *)(v10 + 28) = 0;
CRYPTO_free(v11, "crypto/async/async.c", 98);
CRYPTO_free(v10, "crypto/async/async.c", 100);
}
else
{
ERR_put_error(51, 102, 65, "crypto/async/async.c", 86);
}
}
v7[1] = 0;
v4 = CRYPTO_THREAD_set_local(&unk_125D514, v7);
if ( v4 )
{
return 1;
}
else
{
ERR_put_error(51, 101, 101, "crypto/async/async.c", 366);
sub_D70C98(v7);
}
}
else
{
ERR_put_error(51, 101, 65, "crypto/async/async.c", 341);
CRYPTO_free(v7, "crypto/async/async.c", 342);
}
}
else
{
v4 = 0;
ERR_put_error(51, 101, 65, "crypto/async/async.c", 335);
}
}
else
{
return 0;
}
return v4;
}
}