//
// lws_hdr_copy from 0xbbdf7c to 0xbbe020 (164 bytes)
//
// 8 xrefs:
// > sub_BBFDE0 @ 0xbbff1c
// > sub_BC30F4 @ 0xbc32f0
// > sub_BC30F4 @ 0xbc3328
// > sub_BC30F4 @ 0xbc3374
// > sub_BC33E4 @ 0xbc34e8
// > lws_extension_server_handshake @ 0xbc3fb4
// > sub_BC41E0 @ 0xbc4328
// > ??> @ 0x3c4c8
//
// 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 lws_hdr_copy(__int64 a1, char *a2, int a3, unsigned int a4)
{
unsigned int v6; // w22
__int64 v7; // x1
__int64 result; // x0
__int64 v9; // x3
__int64 v10; // x2
__int64 v11; // x19
__int64 v12; // x19
v6 = lws_hdr_total_length(a1, a4);
if ( (int)v6 >= a3 )
return 0xFFFFFFFFLL;
v7 = *(_QWORD *)(a1 + 152);
result = 0;
v9 = v7 + a4;
v10 = *(unsigned __int8 *)(v9 + 4);
if ( *(_BYTE *)(v9 + 4) )
{
do
{
v11 = 6 * v10;
strcpy(a2, (const char *)(v7 + *(unsigned __int16 *)(v7 + 6 * v10 + 86) + 1070));
v7 = *(_QWORD *)(a1 + 152);
v12 = v7 + v11;
v10 = *(unsigned __int8 *)(v12 + 90);
a2 += *(unsigned __int16 *)(v12 + 88);
}
while ( *(_BYTE *)(v12 + 90) );
return v6;
}
return result;
}