//
// dtls1_retrieve_buffered_record from 0x786e30 to 0x786ecc (156 bytes)
//
// 3 xrefs:
// > dtls1_process_buffered_records @ 0x7881c4
// > dtls1_get_record @ 0x78cc94
// > ??> @ 0x5a57c
//
// 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
//
int __fastcall dtls1_retrieve_buffered_record(_DWORD *a1, int a2)
{
int v3; // r0
int v4; // r5
_DWORD *v5; // r6
int v6; // r2
v3 = pqueue_pop(*(_DWORD *)(a2 + 4));
v4 = v3;
if ( !v3 )
return 0;
v5 = *(_DWORD **)(v3 + 8);
SSL3_BUFFER_release(a1 + 144);
v6 = *v5;
a1[694] = v5[1];
a1[693] = v6;
memcpy(a1 + 144, v5 + 2, 0x14u);
memcpy(a1 + 309, v5 + 7, 0x30u);
memcpy((char *)a1 + 2822, (const void *)(*v5 + 5), 6u);
CRYPTO_free(*(_DWORD *)(v4 + 8), "ssl/record/rec_layer_d1.c", 212);
pitem_free(v4);
return 1;
}