//
// SSL_get_error from 0x799aa8 to 0x799c38 (400 bytes)
//
// 8 xrefs:
// > sub_641BFC @ 0x641c38
// > sub_641F78 @ 0x641fb6
// > sub_644B1C @ 0x644b8a
// > sub_645094 @ 0x6450de
// > sub_785B18 @ 0x785b64
// > ??> @ 0x785cf8
// > sub_785EB0 @ 0x786304
// > ??> @ 0x54afc
//
// 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 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;
}