//
// dtls1_record_bitmap_update from 0xfdce38 to 0xfdcf50 (280 bytes)
//
// 2 xrefs:
// > dtls1_process_record @ 0xfb4400
// > ??> @ 0xe8b58
//
// 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:35 +0000
//
__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;
}