//
// ASYNC_start_job from 0xfef40c to 0xfef7f4 (1000 bytes)
//
// 6 xrefs:
// > SSL_read @ 0xfbe240
// > SSL_peek @ 0xfbe3e0
// > SSL_write @ 0xfbe568
// > SSL_shutdown @ 0xfbe700
// > SSL_do_handshake @ 0xfc01e4
// > ??> @ 0xeaa60
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:15:45 +0000
//
__int64 __fastcall ASYNC_start_job(__int64 *a1, __int64 a2, _DWORD *a3, __int64 a4, const void *a5, size_t a6)
{
__int64 ctx; // x20
__int64 v13; // x19
unsigned int v14; // w21
unsigned int v15; // w21
__int64 v16; // x23
_QWORD *v17; // x24
_QWORD *v19; // x23
__int64 v20; // x0
_QWORD *local; // x27
__int64 v22; // x0
_QWORD *v23; // x23
__int64 v24; // x0
__int64 v25; // x1
__int64 v26; // x0
unsigned __int64 v27; // x0
__int64 v28; // x0
__int64 v29; // x21
__int64 v30; // x0
__int64 v31; // x22
_QWORD *v32; // x19
ctx = async_get_ctx();
if ( !ctx )
{
v26 = CRYPTO_malloc(24, "crypto/async/async.c", 39);
ctx = v26;
if ( v26 )
{
*(_QWORD *)(v26 + 8) = 0;
*(_DWORD *)(v26 + 16) = 0;
if ( (unsigned int)CRYPTO_THREAD_set_local(&unk_1566310, v26) )
goto LABEL_2;
}
else
{
ERR_put_error(51, 100, 65, "crypto/async/async.c", 41);
}
v15 = 0;
CRYPTO_free(ctx, "crypto/async/async.c", 53);
return v15;
}
LABEL_2:
v13 = *a1;
if ( *a1 )
{
*(_QWORD *)(ctx + 8) = v13;
goto LABEL_4;
}
v13 = *(_QWORD *)(ctx + 8);
if ( !v13 )
{
local = (_QWORD *)CRYPTO_THREAD_get_local(&unk_1566314);
if ( !local )
{
if ( !(unsigned int)ASYNC_init_thread(0, 0) )
goto LABEL_29;
local = (_QWORD *)CRYPTO_THREAD_get_local(&unk_1566314);
}
v22 = OPENSSL_sk_pop(*local);
v23 = (_QWORD *)v22;
if ( v22 )
{
*(_QWORD *)(ctx + 8) = v22;
if ( a5 )
{
v24 = CRYPTO_malloc(a6, "crypto/async/async.c", 227);
v25 = *(_QWORD *)(ctx + 8);
v23[2] = v24;
if ( !*(_QWORD *)(v25 + 16) )
{
v15 = 0;
ERR_put_error(51, 105, 65, "crypto/async/async.c", 229);
v31 = *(_QWORD *)(ctx + 8);
v32 = (_QWORD *)CRYPTO_THREAD_get_local(&unk_1566314);
CRYPTO_free(*(_QWORD *)(v31 + 16), "crypto/async/async.c", 141);
*(_QWORD *)(v31 + 16) = 0;
OPENSSL_sk_push(*v32, v31);
*(_QWORD *)(ctx + 8) = 0;
return v15;
}
memcpy(*(void **)(v25 + 16), a5, a6);
v23 = *(_QWORD **)(ctx + 8);
}
else
{
*(_QWORD *)(v22 + 16) = 0;
}
v23[1] = a4;
v23[4] = a2;
ERR_put_error(51, 105, 102, "crypto/async/async.c", 243);
LABEL_20:
v13 = *(_QWORD *)(ctx + 8);
v14 = 0;
v19 = (_QWORD *)CRYPTO_THREAD_get_local(&unk_1566314);
v20 = *(_QWORD *)(v13 + 16);
goto LABEL_11;
}
v27 = local[2];
if ( !v27 || v27 > local[1] )
{
v28 = CRYPTO_zalloc(40, "crypto/async/async.c", 84);
v29 = v28;
if ( v28 )
{
v30 = *(_QWORD *)(v28 + 16);
*(_DWORD *)(v29 + 28) = 0;
CRYPTO_free(v30, "crypto/async/async.c", 98);
CRYPTO_free(v29, "crypto/async/async.c", 100);
}
else
{
ERR_put_error(51, 102, 65, "crypto/async/async.c", 86);
}
}
LABEL_29:
*(_QWORD *)(ctx + 8) = 0;
return 1;
}
LABEL_4:
v14 = *(_DWORD *)(v13 + 28);
if ( v14 != 3 )
{
if ( v14 == 1 )
{
*a1 = v13;
*(_DWORD *)(*(_QWORD *)(ctx + 8) + 28LL) = 2;
*(_QWORD *)(ctx + 8) = 0;
return 2;
}
if ( v14 != 2 )
{
v15 = 0;
ERR_put_error(51, 105, 68, "crypto/async/async.c", 214);
v16 = *(_QWORD *)(ctx + 8);
v17 = (_QWORD *)CRYPTO_THREAD_get_local(&unk_1566314);
CRYPTO_free(*(_QWORD *)(v16 + 16), "crypto/async/async.c", 141);
*(_QWORD *)(v16 + 16) = 0;
OPENSSL_sk_push(*v17, v16);
*(_QWORD *)(ctx + 8) = 0;
*a1 = 0;
return v15;
}
*(_QWORD *)(ctx + 8) = *a1;
ERR_put_error(51, 105, 102, "crypto/async/async.c", 207);
goto LABEL_20;
}
*a3 = *(_DWORD *)(v13 + 24);
*(_QWORD *)(v13 + 32) = 0;
v19 = (_QWORD *)CRYPTO_THREAD_get_local(&unk_1566314);
v20 = *(_QWORD *)(v13 + 16);
LABEL_11:
CRYPTO_free(v20, "crypto/async/async.c", 141);
*(_QWORD *)(v13 + 16) = 0;
OPENSSL_sk_push(*v19, v13);
*(_QWORD *)(ctx + 8) = 0;
*a1 = 0;
return v14;
}