//
// pqueue_insert from 0x9cc6e8 to 0x9cc76c (132 bytes)
//
// 5 xrefs:
// > dtls1_buffer_record @ 0x99b94c
// > sub_9B955C @ 0x9b97f8
// > dtls1_buffer_message @ 0x9ba04c
// > dtls_get_message @ 0x9bac88
// > ??> @ 0x73fec
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:07:09 +0000
//
void *__fastcall pqueue_insert(_DWORD **a1, void *a2)
{
_DWORD *v2; // r4
_DWORD *v5; // r6
void *result; // r0
v2 = *a1;
if ( !*a1 )
goto LABEL_11;
v5 = nullptr;
while ( 1 )
{
result = (void *)memcmp(v2, a2, 8u);
if ( (int)result > 0 )
break;
if ( !result )
return result;
v5 = v2;
if ( !v2[3] )
{
*((_DWORD *)a2 + 3) = 0;
v2[3] = a2;
return a2;
}
v2 = (_DWORD *)v2[3];
}
*((_DWORD *)a2 + 3) = v2;
if ( v5 )
{
v5[3] = a2;
return a2;
}
else
{
LABEL_11:
*a1 = a2;
return a2;
}
}