//
// ossl_statem_client_post_work from 0xd4ad74 to 0xd4aec0 (332 bytes)
//
// 5 xrefs:
// > sub_D47644 @ 0xd477b4
// > sub_D47644 @ 0xd4785c
// > ??> @ 0x809d0
// > sub_D47644 @ 0xd47744
// > ??> @ 0x122c538
//
// 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_client_post_work(__int64 a1, int a2)
{
int v2; // w2
__int64 result; // x0
bool v5; // zf
__int64 v6; // x0
__int64 v7; // x2
__int64 v8; // x1
int *v9; // x0
int v10; // w1
__int64 v11; // x3
v2 = *(_DWORD *)(a1 + 92) - 12;
*(_DWORD *)(a1 + 136) = 0;
switch ( v2 )
{
case 0:
if ( a2 != 3 || (v5 = (unsigned int)statem_flush(a1) == 1, result = 3, v5) )
{
if ( (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 104LL) & 8) == 0 )
return 2;
*(_DWORD *)(a1 + 512) = 1;
return 2;
}
return result;
case 2:
if ( (unsigned int)tls_client_key_exchange_post_work(a1) )
return 2;
return 0;
case 4:
v6 = *(_QWORD *)(a1 + 144);
v7 = *(_QWORD *)(a1 + 376);
v8 = *(_QWORD *)(v6 + 552);
v9 = *(int **)(v6 + 640);
*(_QWORD *)(v7 + 216) = v8;
if ( v9 )
v10 = *v9;
else
v10 = 0;
v11 = *(_QWORD *)(a1 + 8);
*(_DWORD *)(v7 + 208) = v10;
if ( !(*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)(v11 + 192) + 16LL))(a1)
|| !(*(unsigned int (__fastcall **)(__int64, __int64))(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 32LL))(a1, 18) )
{
return 0;
}
if ( (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 104LL) & 8) == 0 )
return 2;
dtls1_reset_seq_numbers((_QWORD *)a1, 2);
return 2;
case 6:
v5 = (unsigned int)statem_flush(a1) == 1;
result = 4;
if ( !v5 )
return result;
return 2;
default:
return 2;
}
}