//
// ossl_statem_server_write_transition from 0xd4fef4 to 0xd50160 (620 bytes)
//
// 5 xrefs:
// > sub_D47644 @ 0xd478f8
// > sub_D47644 @ 0xd47d3c
// > ??> @ 0x32868
// > sub_D47644 @ 0xd47cb4
// > ??> @ 0x1229840
//
// 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
//
__int64 __fastcall ossl_statem_server_write_transition(__int64 a1)
{
__int64 v1; // x19
__int64 result; // x0
__int64 v3; // x1
int v4; // w2
int v5; // w3
int v6; // w3
int v7; // w1
int v8; // w1
__int64 v9; // x0
v1 = a1 + 72;
switch ( *(_DWORD *)(a1 + 92) )
{
case 0:
case 0x15:
case 0x1A:
return 2;
case 1:
result = 1;
*(_DWORD *)(v1 + 20) = 19;
return result;
case 0x13:
goto LABEL_34;
case 0x14:
if ( (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 104LL) & 8) != 0
&& !*(_DWORD *)(*(_QWORD *)(a1 + 152) + 260LL)
&& (SSL_get_options(a1) & 0x2000) != 0 )
{
*(_DWORD *)(v1 + 20) = 21;
return 1;
}
else
{
*(_DWORD *)(v1 + 20) = 22;
return 1;
}
case 0x16:
if ( *(_DWORD *)(a1 + 176) )
goto LABEL_32;
v3 = *(_QWORD *)(*(_QWORD *)(a1 + 144) + 552LL);
v4 = *(_DWORD *)(v3 + 24);
if ( (v4 & 0x54) != 0 )
{
v5 = *(_DWORD *)(v3 + 20);
if ( (v5 & 6) != 0 || (v5 & 0x48) != 0 && *(_QWORD *)(*(_QWORD *)(a1 + 328) + 464LL) || (v5 & 0x1A0) != 0 )
{
LABEL_43:
*(_DWORD *)(a1 + 92) = 24;
return 1;
}
else
{
v6 = *(_DWORD *)(a1 + 392);
if ( (v6 & 1) == 0
|| *(_QWORD *)(*(_QWORD *)(a1 + 376) + 152LL) && (v6 & 4) != 0
|| (v4 & 4) != 0 && (v6 & 2) == 0
|| (*(_DWORD *)(v3 + 24) & 0x50) != 0 )
{
LABEL_17:
*(_DWORD *)(v1 + 20) = 26;
return 1;
}
else
{
LABEL_28:
*(_DWORD *)(v1 + 20) = 25;
return 1;
}
}
}
else
{
*(_DWORD *)(a1 + 92) = 23;
return 1;
}
case 0x17:
if ( !*(_DWORD *)(a1 + 608) )
goto LABEL_19;
*(_DWORD *)(a1 + 92) = 34;
return 1;
case 0x18:
goto LABEL_22;
case 0x19:
goto LABEL_17;
case 0x20:
if ( *(_DWORD *)(a1 + 176) )
goto LABEL_34;
LABEL_32:
if ( *(_DWORD *)(a1 + 644) )
{
*(_DWORD *)(a1 + 92) = 33;
return 1;
}
else
{
LABEL_33:
*(_DWORD *)(a1 + 92) = 35;
return 1;
}
case 0x21:
goto LABEL_33;
case 0x22:
LABEL_19:
v7 = *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 144) + 552LL) + 20LL);
if ( (v7 & 6) != 0 || (v7 & 0x48) != 0 && *(_QWORD *)(*(_QWORD *)(a1 + 328) + 464LL) || (v7 & 0x1A0) != 0 )
goto LABEL_43;
LABEL_22:
v8 = *(_DWORD *)(a1 + 392);
if ( (v8 & 1) != 0 && (!*(_QWORD *)(*(_QWORD *)(a1 + 376) + 152LL) || (v8 & 4) == 0) )
{
v9 = *(_QWORD *)(*(_QWORD *)(a1 + 144) + 552LL);
if ( ((*(_DWORD *)(v9 + 24) & 4) == 0 || (v8 & 2) != 0) && (*(_DWORD *)(v9 + 24) & 0x50) == 0 )
goto LABEL_28;
}
goto LABEL_17;
case 0x23:
result = 1;
*(_DWORD *)(v1 + 20) = 36;
return result;
case 0x24:
if ( *(_DWORD *)(a1 + 176) )
return 2;
LABEL_34:
*(_DWORD *)(a1 + 92) = 1;
ossl_statem_set_in_init(a1, 0);
return 1;
default:
return 0;
}
}