//
// ASYNC_init_thread from 0x7cae30 to 0x7cb000 (464 bytes)
//
// 2 xrefs:
// > ASYNC_start_job @ 0x7cb388
// > ??> @ 0x5f29c
//
// 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 ASYNC_init_thread(unsigned int a1, unsigned int a2)
{
int v4; // r4
int v6; // r0
int *v7; // r7
int v8; // r0
int v9; // r4
int v10; // r0
if ( a2 > a1 )
{
ERR_put_error(51, 101, 103, "crypto/async/async.c", 322);
return 0;
}
else
{
if ( !OPENSSL_init_crypto(256) || !ossl_init_thread_start(1, 0) )
return 0;
v6 = CRYPTO_zalloc(12, "crypto/async/async.c", 333);
v7 = (int *)v6;
if ( v6 )
{
v4 = OPENSSL_sk_new_null(v6);
*v7 = v4;
if ( v4 )
{
v7[2] = a1;
if ( a2 )
{
v8 = CRYPTO_zalloc(24, "crypto/async/async.c", 84);
v9 = v8;
if ( v8 )
{
v10 = *(_DWORD *)(v8 + 8);
*(_DWORD *)(v9 + 16) = 0;
CRYPTO_free(v10, "crypto/async/async.c", 98);
CRYPTO_free(v9, "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_AD2DE4, v7);
if ( v4 )
{
return 1;
}
else
{
ERR_put_error(51, 101, 101, "crypto/async/async.c", 366);
sub_7CAC1C(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);
}
return v4;
}
}