//
// lws_hdr_copy_fragment from 0x8583a0 to 0x85840a (106 bytes)
//
// 0 xrefs:
//
// 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:02:37 +0000
//
int __fastcall lws_hdr_copy_fragment(_DWORD **a1, void *a2, int a3, int a4, int a5)
{
_DWORD *v5; // r5
int v6; // r4
int v7; // r7
char *v8; // r3
int v9; // r4
v5 = *a1;
v6 = *((unsigned __int8 *)*a1 + a4 + 988);
if ( a5 > 0 )
{
v7 = 0;
v6 = *((unsigned __int8 *)v5 + 6 * v6 + 8);
if ( !v6 )
return -1;
while ( 1 )
{
++v7;
v8 = (char *)v5 + 6 * v6;
if ( v7 == a5 )
break;
v6 = (unsigned __int8)v8[8];
if ( !v8[8] )
return -1;
}
}
v9 = 6 * v6;
if ( *(unsigned __int16 *)((char *)v5 + v9 + 6) < a3 )
{
*((_BYTE *)memcpy(
a2,
(const void *)(*(unsigned __int16 *)((char *)v5 + v9 + 4) + *v5),
*(unsigned __int16 *)((char *)v5 + v9 + 6))
+ *(unsigned __int16 *)((char *)*a1 + v9 + 6)) = 0;
return *(unsigned __int16 *)((char *)*a1 + v9 + 6);
}
return -1;
}