//
// sub_BC30F4 from 0xbc30f4 to 0xbc33e4 (752 bytes)
//
// 1 xrefs:
// > sub_BC33E4 @ 0xbc3758
//
// 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 sub_BC30F4(__int64 a1)
{
__int64 v2; // x19
int v3; // w20
unsigned int v4; // w1
unsigned int v5; // w19
__int64 v7; // x19
unsigned int v8; // w20
__int64 v9; // x20
__int64 v10; // x22
int v11; // w19
__int64 v12; // x4
char v13[16]; // [xsp+40h] [xbp+40h] BYREF
char v14[24]; // [xsp+50h] [xbp+50h] BYREF
char v15[32]; // [xsp+68h] [xbp+68h] BYREF
v2 = 0;
v3 = 0;
do
{
v4 = byte_F2B7F0[v2++];
if ( (unsigned int)lws_hdr_total_length(a1, v4) )
++v3;
}
while ( v2 != 6 );
if ( !v3 )
{
lws_log(2, "Missing URI in HTTP request\n");
goto LABEL_8;
}
if ( v3 != 1 )
{
lws_log(2, "multiple methods?\n");
LABEL_8:
v5 = 1;
sub_BBF88C(*(void **)(a1 + 152), 0);
*(_QWORD *)(a1 + 152) = 0;
return v5;
}
if ( (unsigned int)sub_BBBFCC(a1) )
goto LABEL_8;
v7 = 0;
while ( 1 )
{
v8 = byte_F2B7F0[v7];
if ( (unsigned int)lws_hdr_total_length(a1, v8) )
break;
if ( ++v7 == 6 )
{
v9 = 0;
v10 = 0;
goto LABEL_16;
}
}
v10 = sub_BBE020(a1, v8);
v9 = (int)lws_hdr_total_length(a1, v8);
LABEL_16:
*(_DWORD *)(a1 + 192) = 0;
if ( (unsigned int)lws_hdr_total_length(a1, 1u)
|| (unsigned int)lws_hdr_total_length(a1, 0x49u)
|| (unsigned int)lws_hdr_total_length(a1, 0x4Au) )
{
*(_DWORD *)(a1 + 192) = 104857600;
}
if ( (unsigned int)lws_hdr_total_length(a1, 0x1Bu) )
{
lws_hdr_copy(a1, v15, 31, 0x1Bu);
*(_DWORD *)(a1 + 192) = atoi(v15);
}
v11 = false;
if ( (int)lws_hdr_total_length(a1, 0xFu) > 7 )
{
lws_hdr_copy(a1, v13, 9, 0xFu);
if ( v13[5] == 49 && v13[7] == 49 )
v11 = true;
}
*(_DWORD *)(a1 + 184) = v11;
if ( (unsigned int)lws_hdr_total_length(a1, 4u) )
{
lws_hdr_copy(a1, v14, 19, 4u);
v14[19] = 0;
if ( !strcasecmp(v14, "keep-alive") )
{
v11 = 1;
}
else if ( !strcasecmp(v14, "close") )
{
v11 = 0;
}
}
v12 = *(_QWORD *)(a1 + 8);
*(_DWORD *)(a1 + 188) = v11;
if ( (*(unsigned int (__fastcall **)(__int64, __int64, _QWORD, __int64, __int64))(v12 + 8))(
a1,
18,
*(_QWORD *)(a1 + 144),
v10,
v9) )
{
goto LABEL_8;
}
lws_set_timeout(a1, 10, 5);
v5 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, __int64, __int64))(*(_QWORD *)(a1 + 8) + 8LL))(
a1,
12,
*(_QWORD *)(a1 + 144),
v10,
v9);
sub_BBF88C(*(void **)(a1 + 152), 0);
*(_QWORD *)(a1 + 152) = 0;
if ( v5 )
{
return 1;
}
else if ( *(_BYTE *)(a1 + 73) != 1 && *(_DWORD *)(a1 + 192) )
{
*(_BYTE *)(a1 + 73) = 3;
}
return v5;
}