//
// SSL_get_error from 0x9ae6ac to 0x9ae83c (400 bytes)
//
// 8 xrefs:
// > sub_851C7C @ 0x851cb8
// > sub_851FF8 @ 0x852036
// > sub_854B9C @ 0x854c0a
// > sub_855114 @ 0x85515e
// > sub_99A71C @ 0x99a768
// > ??> @ 0x99a8fc
// > sub_99AAB4 @ 0x99af08
// > ??> @ 0x67a2c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:06:55 +0000
//
int __fastcall SSL_get_error(_DWORD *a1, int a2)
{
int result; // r0
unsigned int v5; // r0
int rbio; // r4
int retry_reason; // r0
if ( a2 > 0 )
return 0;
v5 = ERR_peek_error();
if ( !v5 )
{
if ( !a2 )
{
if ( (a1[10] & 2) != 0 && !*(_DWORD *)(a1[26] + 224) )
return 6;
return 5;
}
if ( SSL_want((int)a1) == 3 )
{
rbio = SSL_get_rbio((int)a1);
if ( BIO_test_flags(rbio, 1) )
return 2;
if ( BIO_test_flags(rbio, 2) )
return 3;
if ( BIO_test_flags(rbio, 4) )
{
LABEL_25:
retry_reason = BIO_get_retry_reason(rbio);
if ( retry_reason == 2 )
return 7;
if ( retry_reason == 3 )
return 8;
return 5;
}
}
if ( SSL_want((int)a1) != 2 )
goto LABEL_12;
rbio = a1[3];
if ( BIO_test_flags(rbio, 2) )
return 3;
if ( !BIO_test_flags(rbio, 1) )
{
if ( !BIO_test_flags(rbio, 4) )
{
LABEL_12:
result = SSL_want((int)a1);
if ( result == 4 )
return result;
if ( SSL_want((int)a1) == 5 )
return 9;
if ( SSL_want((int)a1) == 6 )
return 10;
return 5;
}
goto LABEL_25;
}
return 2;
}
if ( HIBYTE(v5) == 2 )
return 5;
else
return 1;
}