//
// ossl_statem_server_pre_work from 0xfce4b4 to 0xfce5ec (312 bytes)
//
// 4 xrefs:
// > sub_FC5998 @ 0xfc5b34
// > ??> @ 0x101248
// > sub_FC5998 @ 0xfc6004
// > ??> @ 0x1547d98
//
// 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:28 +0000
//
__int64 __fastcall ossl_statem_server_pre_work(__int64 a1)
{
__int64 v1; // x20
__int64 v3; // x0
__int64 v5; // x1
__int64 v6; // x0
v1 = a1 + 72;
switch ( *(_DWORD *)(a1 + 92) )
{
case 1:
return tls_finish_handshake(a1);
case 0x13:
v3 = *(_QWORD *)(a1 + 8);
*(_DWORD *)(a1 + 68) = 0;
if ( (*(_DWORD *)(*(_QWORD *)(v3 + 192) + 104LL) & 8) == 0 )
return 2;
dtls1_clear_sent_buffer(a1);
return 2;
case 0x15:
v6 = *(_QWORD *)(a1 + 8);
*(_DWORD *)(a1 + 68) = 0;
if ( (*(_DWORD *)(*(_QWORD *)(v6 + 192) + 104LL) & 8) == 0 )
return 2;
dtls1_clear_sent_buffer(a1);
*(_DWORD *)(v1 + 40) = 0;
return 2;
case 0x16:
if ( (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 104LL) & 8) == 0 )
return 2;
*(_DWORD *)(v1 + 40) = 1;
return 2;
case 0x21:
goto LABEL_6;
case 0x23:
v5 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL);
*(_QWORD *)(*(_QWORD *)(a1 + 376) + 216LL) = *(_QWORD *)(*(_QWORD *)(a1 + 144) + 552LL);
if ( (*(unsigned int (__fastcall **)(__int64))(v5 + 16))(a1) )
{
LABEL_6:
if ( (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 104LL) & 8) != 0 )
{
*(_DWORD *)(v1 + 40) = 0;
return 2;
}
else
{
return 2;
}
}
else
{
ossl_statem_set_error(a1);
return 0;
}
default:
return 2;
}
}