//
// SSL_get_error from 0xfc0928 to 0xfc0aac (388 bytes)
//
// 8 xrefs:
// > sub_E2AE00 @ 0xe2aea8
// > sub_E2B320 @ 0xe2b38c
// > sub_E2F20C @ 0xe2f2a8
// > sub_E2F9C8 @ 0xe2fa6c
// > sub_FAD980 @ 0xfad9d4
// > sub_FADB1C @ 0xfadb70
// > sub_FADD3C @ 0xfadeb8
// > ??> @ 0x58438
//
// 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:21 +0000
//
__int64 __fastcall SSL_get_error(__int64 a1, int a2)
{
unsigned int v2; // w2
__int64 v6; // x0
int v7; // w0
int v8; // w0
__int64 rbio; // x19
int retry_reason; // w0
v2 = 0;
if ( a2 > 0 )
return v2;
v6 = ERR_peek_error(a1);
if ( v6 )
{
if ( BYTE3(v6) == 2 )
return 5;
else
return 1;
}
if ( !a2 )
{
if ( (*(_DWORD *)(a1 + 68) & 2) != 0 )
{
v2 = 6;
if ( *(_DWORD *)(*(_QWORD *)(a1 + 144) + 236LL) )
return 5;
}
else
{
return 5;
}
return v2;
}
if ( (unsigned int)SSL_want(a1) == 3 )
{
rbio = SSL_get_rbio(a1);
if ( (unsigned int)BIO_test_flags(rbio, 1) )
return 2;
if ( (unsigned int)BIO_test_flags(rbio, 2) )
return 3;
if ( (unsigned int)BIO_test_flags(rbio, 4) )
goto LABEL_23;
}
if ( (unsigned int)SSL_want(a1) != 2 )
{
LABEL_14:
v2 = SSL_want(a1);
if ( v2 != 4 )
{
v7 = SSL_want(a1);
v2 = 9;
if ( v7 != 5 )
{
v8 = SSL_want(a1);
v2 = 10;
if ( v8 != 6 )
return 5;
}
}
return v2;
}
rbio = *(_QWORD *)(a1 + 24);
if ( (unsigned int)BIO_test_flags(rbio, 2) )
return 3;
if ( (unsigned int)BIO_test_flags(rbio, 1) )
return 2;
if ( !(unsigned int)BIO_test_flags(rbio, 4) )
goto LABEL_14;
LABEL_23:
retry_reason = BIO_get_retry_reason(rbio);
v2 = 7;
if ( retry_reason != 2 )
{
v2 = 8;
if ( retry_reason != 3 )
return 5;
}
return v2;
}