//
// lws_add_http_header_by_name from 0x649798 to 0x649800 (104 bytes)
//
// 2 xrefs:
// > lws_add_http_header_by_token @ 0x649852
// > lws_add_http_header_status @ 0x6498f0
//
// 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 lws_add_http_header_by_name(int a1, char *a2, void *a3, size_t a4, void **a5, unsigned int a6)
{
_BYTE *i; // r0
char v8; // t1
_BYTE *v10; // r2
_BYTE *v11; // r3
if ( a2 )
{
for ( i = *a5; (unsigned int)*a5 < a6 && *a2; i = *a5 )
{
*a5 = i + 1;
v8 = *a2++;
*i = v8;
}
if ( (_BYTE *)a6 == i )
return 1;
*a5 = i + 1;
*i = 32;
}
if ( a6 <= (unsigned int)*a5 + a4 + 3 )
return 1;
memcpy(*a5, a3, a4);
v10 = *a5;
*a5 = (char *)*a5 + a4 + 1;
v10[a4] = 13;
v11 = *a5;
*a5 = (char *)*a5 + 1;
*v11 = 10;
return 0;
}