//
// dtls1_record_bitmap_update from 0xd5eae4 to 0xd5ebfc (280 bytes)
//
// 2 xrefs:
// > dtls1_process_record @ 0xd360ac
// > ??> @ 0xb1e40
//
// 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 dtls1_record_bitmap_update(__int64 result, __int64 *a2)
{
unsigned __int64 v2; // x4
unsigned __int64 v3; // x2
__int64 v4; // x3
v2 = _byteswap_uint64(*(_QWORD *)(result + 4368));
v3 = _byteswap_uint64(a2[1]);
v4 = v2 - v3;
if ( (__int64)(v2 - v3) < 0 && v2 > v3 )
goto LABEL_3;
if ( v4 <= 0 || v2 >= v3 )
{
if ( v4 > 128 )
{
LABEL_3:
*a2 = 1;
result = *(_QWORD *)(result + 4368);
a2[1] = result;
return result;
}
if ( v4 >= -128 )
{
if ( (int)v4 > 0 )
{
if ( (int)v4 <= 63 )
{
*a2 = (*a2 << v4) | 1;
result = *(_QWORD *)(result + 4368);
a2[1] = result;
return result;
}
goto LABEL_3;
}
if ( (int)v3 - (int)v2 <= 63 )
{
*a2 |= 1LL << ((unsigned __int8)v3 - (unsigned __int8)v2);
return 1;
}
}
}
return result;
}