//
// dtls1_process_buffered_records from 0xd31940 to 0xd31a80 (320 bytes)
//
// 3 xrefs:
// > dtls1_get_record @ 0xd36134
// > dtls1_get_record @ 0xd361a4
// > ??> @ 0x895c8
//
// 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_process_buffered_records(__int64 a1)
{
unsigned __int16 *v2; // x3
__int64 result; // x0
unsigned __int16 *bitmap; // x20
__int16 *v5; // x2
__int16 v6; // w1
int v7; // [xsp+4Ch] [xbp+4Ch] BYREF
if ( !pqueue_peek(*(_QWORD *)(*(_QWORD *)(a1 + 4392) + 48LL)) )
{
LABEL_10:
v5 = *(__int16 **)(a1 + 4392);
v6 = *v5;
v5[28] = *v5;
v5[20] = v6 + 1;
return 1;
}
v2 = *(unsigned __int16 **)(a1 + 4392);
result = 1;
if ( v2[20] == *v2 && *(int *)(a1 + 980) <= 0 )
{
while ( pqueue_peek(*((_QWORD *)v2 + 6)) )
{
dtls1_retrieve_buffered_record(a1, *(_QWORD *)(a1 + 4392) + 40LL);
bitmap = dtls1_get_bitmap(a1, a1 + 2008, &v7);
if ( !bitmap )
{
ERR_put_error(20, 424, 68, "ssl/record/rec_layer_d1.c", 269);
return 0;
}
if ( (unsigned int)dtls1_record_replay_check(a1, bitmap) && (unsigned int)dtls1_process_record(a1, bitmap) )
{
if ( (dtls1_buffer_record(a1, *(_QWORD *)(a1 + 4392) + 56LL, a1 + 2072) & 0x80000000) != 0 )
return 0;
}
else
{
*(_DWORD *)(a1 + 2016) = 0;
*(_DWORD *)(a1 + 4320) = 0;
}
v2 = *(unsigned __int16 **)(a1 + 4392);
}
goto LABEL_10;
}
return result;
}