//
// lws_hdr_copy from 0xe3413c to 0xe341e0 (164 bytes)
//
// 8 xrefs:
// > sub_E35FA0 @ 0xe360dc
// > sub_E392B4 @ 0xe394b0
// > sub_E392B4 @ 0xe394e8
// > sub_E392B4 @ 0xe39534
// > sub_E395A4 @ 0xe396a8
// > lws_extension_server_handshake @ 0xe3a174
// > sub_E3A3A0 @ 0xe3a4e8
// > ??> @ 0x57610
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:09:57 +0000
//
__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;
}