//
// ERR_get_state from 0x7fa1b0 to 0x7fa57c (972 bytes)
//
// 16 xrefs:
// > ERR_put_error @ 0x7fa5e4
// > ERR_clear_error @ 0x7fa6ac
// > ERR_get_error_line_data @ 0x7fab5c
// > err_delete_thread_state @ 0x7fac74
// > ERR_get_error_line @ 0x7fb004
// > ERR_peek_last_error @ 0x7fb0dc
// > ERR_peek_error @ 0x7fb100
// > ERR_get_error @ 0x7fb13c
// > ERR_peek_last_error_line @ 0x7fb1d0
// > ERR_peek_error_line @ 0x7fb250
// > ERR_peek_last_error_line_data @ 0x7fb2e4
// > ERR_peek_error_line_data @ 0x7fb3a8
// > ERR_set_error_data @ 0x7fb4f0
// > ERR_set_mark @ 0x7fb648
// > ERR_pop_to_mark @ 0x7fb678
// > ??> @ 0x6293c
//
// 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 ERR_get_state()
{
int result; // r0
_DWORD *v1; // r6
int v2; // r3
int v3; // r3
int v4; // r3
int v5; // r3
int v6; // r3
int v7; // r3
int v8; // r3
int v9; // r3
int v10; // r3
int v11; // r3
int v12; // r3
int v13; // r3
int v14; // r3
int v15; // r3
int v16; // r3
if ( !CRYPTO_THREAD_run_once(&unk_AD43A8, sub_7F973C) || !dword_AD2EBC )
return 0;
result = CRYPTO_THREAD_get_local(&unk_AD2EB8);
if ( result )
return result;
v1 = (_DWORD *)CRYPTO_zalloc(392, "crypto/err/err.c", 652);
if ( !v1 )
return 0;
if ( CRYPTO_THREAD_set_local(&unk_AD2EB8, v1) )
{
OPENSSL_init_crypto(2);
ossl_init_thread_start(2, 0);
return (int)v1;
}
else
{
if ( (v1[48] & 1) != 0 )
{
CRYPTO_free(v1[32], "crypto/err/err.c", 247);
v1[32] = 0;
}
v2 = v1[49];
v1[48] = 0;
if ( (v2 & 1) != 0 )
{
CRYPTO_free(v1[33], "crypto/err/err.c", 247);
v1[33] = 0;
}
v3 = v1[50];
v1[49] = 0;
if ( (v3 & 1) != 0 )
{
CRYPTO_free(v1[34], "crypto/err/err.c", 247);
v1[34] = 0;
}
v4 = v1[51];
v1[50] = 0;
if ( (v4 & 1) != 0 )
{
CRYPTO_free(v1[35], "crypto/err/err.c", 247);
v1[35] = 0;
}
v5 = v1[52];
v1[51] = 0;
if ( (v5 & 1) != 0 )
{
CRYPTO_free(v1[36], "crypto/err/err.c", 247);
v1[36] = 0;
}
v6 = v1[53];
v1[52] = 0;
if ( (v6 & 1) != 0 )
{
CRYPTO_free(v1[37], "crypto/err/err.c", 247);
v1[37] = 0;
}
v7 = v1[54];
v1[53] = 0;
if ( (v7 & 1) != 0 )
{
CRYPTO_free(v1[38], "crypto/err/err.c", 247);
v1[38] = 0;
}
v8 = v1[55];
v1[54] = 0;
if ( (v8 & 1) != 0 )
{
CRYPTO_free(v1[39], "crypto/err/err.c", 247);
v1[39] = 0;
}
v9 = v1[56];
v1[55] = 0;
if ( (v9 & 1) != 0 )
{
CRYPTO_free(v1[40], "crypto/err/err.c", 247);
v1[40] = 0;
}
v10 = v1[57];
v1[56] = 0;
if ( (v10 & 1) != 0 )
{
CRYPTO_free(v1[41], "crypto/err/err.c", 247);
v1[41] = 0;
}
v11 = v1[58];
v1[57] = 0;
if ( (v11 & 1) != 0 )
{
CRYPTO_free(v1[42], "crypto/err/err.c", 247);
v1[42] = 0;
}
v12 = v1[59];
v1[58] = 0;
if ( (v12 & 1) != 0 )
{
CRYPTO_free(v1[43], "crypto/err/err.c", 247);
v1[43] = 0;
}
v13 = v1[60];
v1[59] = 0;
if ( (v13 & 1) != 0 )
{
CRYPTO_free(v1[44], "crypto/err/err.c", 247);
v1[44] = 0;
}
v14 = v1[61];
v1[60] = 0;
if ( (v14 & 1) != 0 )
{
CRYPTO_free(v1[45], "crypto/err/err.c", 247);
v1[45] = 0;
}
v15 = v1[62];
v1[61] = 0;
if ( (v15 & 1) != 0 )
{
CRYPTO_free(v1[46], "crypto/err/err.c", 247);
v1[46] = 0;
}
v16 = v1[63];
v1[62] = 0;
if ( (v16 & 1) != 0 )
{
CRYPTO_free(v1[47], "crypto/err/err.c", 247);
v1[47] = 0;
}
v1[63] = 0;
CRYPTO_free(v1, "crypto/err/err.c", 249);
return 0;
}
}