//
// dtls1_record_bitmap_update from 0x7b7e64 to 0x7b80a8 (580 bytes)
//
// 2 xrefs:
// > dtls1_process_record @ 0x78cba4
// > ??> @ 0x5ab3c
//
// 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
//
unsigned __int8 *__fastcall dtls1_record_bitmap_update(unsigned __int8 *a1, unsigned __int8 *a2)
{
int v3; // r9
__int64 v4; // r2
int v5; // r7
__int64 v6; // r8
unsigned __int8 *result; // r0
unsigned __int64 v8; // r6
unsigned __int64 v9; // r10
unsigned __int64 v10; // r2
__int64 v11; // r8
bool v12; // cc
char v13; // r1
int v15; // r8
int v16; // [sp+8h] [bp-20h]
__int64 v17; // [sp+8h] [bp-20h]
__int64 v18; // [sp+10h] [bp-18h]
unsigned __int64 v19; // [sp+18h] [bp-10h]
__int64 v20; // [sp+20h] [bp-8h]
v16 = a1[2822];
v3 = (a1[2821] << 16) | (a1[2820] << 24);
LODWORD(v4) = 0;
HIDWORD(v4) = (a2[4] << 24) | (a2[5] << 16);
v20 = v4;
v5 = a1[2823];
LODWORD(v6) = (a1[2824] << 24) | a1[2827];
LODWORD(v4) = a1[2825];
result = a2;
HIDWORD(v6) = v3 | (v16 << 8) | v5;
HIDWORD(v17) = a2[6] << 8;
HIDWORD(v18) = a2[7];
v19 = v6 | (unsigned int)((_DWORD)v4 << 16);
LODWORD(v17) = 0;
LODWORD(v18) = 0;
v8 = (unsigned int)((_DWORD)v4 << 16);
LODWORD(v8) = a2[9] << 16;
v9 = (a1[2826] << 8) | v19;
v10 = v18 | v17 | v20 | result[11] | (result[8] << 24) | v8 | (a2[10] << 8);
v11 = v9 - v10;
v12 = HIDWORD(v19) > (v18 | v17 | v20 | result[11] | (result[8] << 24) | v8) >> 32;
if ( HIDWORD(v19) == (v18 | v17 | v20 | result[11] | (result[8] << 24) | v8) >> 32 )
v12 = (unsigned int)v9 > (unsigned int)v10;
v13 = v12;
if ( (*(_DWORD *)&v13 & (HIDWORD(v11) >> 31)) != 0 )
goto LABEL_7;
if ( v9 >= v10 || v11 < 1 )
{
if ( v11 < 129 )
{
if ( v11 < -128 )
return result;
if ( (int)v11 <= 0 )
{
v15 = -(int)v11;
if ( v15 <= 31 )
*(_DWORD *)result |= 1 << v15;
return result;
}
if ( (int)v11 <= 31 )
{
*(_DWORD *)result = (*(_DWORD *)result << v11) | 1;
return (unsigned __int8 *)memcpy(result + 4, a1 + 2820, 8u);
}
}
LABEL_7:
*(_DWORD *)result = 1;
return (unsigned __int8 *)memcpy(result + 4, a1 + 2820, 8u);
}
return result;
}